@krantho/studio 1.0.1 → 1.0.2
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/assets/{AssistantPanel-B7HETGhh.js → AssistantPanel-ECkcslXS.js} +1 -1
- package/dist/assets/{GraphBrowser-DIjsu_2L.js → GraphBrowser-BBKTzzRV.js} +2 -2
- package/dist/assets/{GraphCanvas-B1JM8f2x.js → GraphCanvas-Cct1E2As.js} +1 -1
- package/dist/assets/{api-seo-Cjv4a9Y_.js → api-seo-CwGP6Bi2.js} +1 -1
- package/dist/assets/{collection-view-CUWLWvwR.js → collection-view--erTGbRH.js} +1 -1
- package/dist/assets/{editor-page-jSK3xMkh.js → editor-page-XOJrwlcZ.js} +3 -3
- package/dist/assets/{fill-job-B-Z4jnVQ.js → fill-job-YPZFETW1.js} +1 -1
- package/dist/assets/{fill-run-view-Bx-nSvtd.js → fill-run-view-B6rnYhKS.js} +1 -1
- package/dist/assets/{graph-config-BJA_ztYM.js → graph-config-DKVGDPTG.js} +1 -1
- package/dist/assets/{image-editor-CEzh5OFw.js → image-editor-BX-DHJDa.js} +1 -1
- package/dist/assets/{index-qiIlvPyv.js → index-CEQ7ZdKC.js} +2 -2
- package/dist/assets/{live-markdown-editor-BGbJGFKJ.js → live-markdown-editor-DM8hYG3n.js} +29 -29
- package/dist/assets/{media-page-B3Q4EH3m.js → media-page-CeBC5FQS.js} +1 -1
- package/dist/assets/{pulse-page-HsxpGgEu.js → pulse-page-C00oCF2o.js} +1 -1
- package/dist/assets/{setup-page-DsYYpFrd.js → setup-page-BHJcTaTH.js} +1 -1
- package/dist/assets/{site-BfbIKOk1.js → site-BYsfQB_3.js} +1 -1
- package/dist/assets/{site-model-CoSgHHeY.js → site-model-C5bJvTbk.js} +1 -1
- package/dist/assets/{site-overview-BJNMesQZ.js → site-overview-5EhmXIR0.js} +1 -1
- package/dist/assets/{structure-page-ZD8c7Ukz.js → structure-page-9d9MG7vU.js} +2 -2
- package/dist/assets/{use-drawer-actions-D-rIBvJ8.js → use-drawer-actions-CR6Q0qdd.js} +1 -1
- package/dist/assets/{use-loaded-DFUDFVFt.js → use-loaded-BBFak2E1.js} +1 -1
- package/dist/assets/{use-locale-versions-DHt-x8c_.js → use-locale-versions-BycCbBLd.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +14 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{i as t,n,t as r}from"./createLucideIcon-BklFHeMd.js";import{St as i,Tt as a,bt as o,d as s,tt as c}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{i as t,n,t as r}from"./createLucideIcon-BklFHeMd.js";import{St as i,Tt as a,bt as o,d as s,tt as c}from"./index-CEQ7ZdKC.js";import{i as l,o as u,r as d,s as f}from"./vendor-diff-DGCTJYJ4.js";import{c as p,p as m,t as h}from"./vendor-router-B4czwg8X.js";import{n as g,t as _}from"./api-client-BRi_ki2Y.js";import{i as v,n as y}from"./auth-CIpilSKF.js";import{t as ee}from"./send-kYpW5JED.js";import{r as te,t as ne}from"./vendor-markdown-pd8vs9n-.js";import{t as b}from"./circle-check-big-DQjpuxcC.js";import{t as x}from"./clock-DoBIVjZO.js";import{t as re}from"./copy-V85khWct.js";import{t as ie}from"./info-Cxkabti5.js";import{t as ae}from"./triangle-exclamation-point-ttN5lZI0.js";import{t as S}from"./circle-x-peGpq98w.js";var C={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};C.node;var oe=r(C),w={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};w.node;var T=r(w),E={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};E.node;var se=r(E),D={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};D.node;var ce=r(D);function O(){return{event:``,data:[]}}async function*le(e,t){let n=e.getReader(),r=new TextDecoder,i=()=>{n.cancel().catch(()=>void 0)};t?.addEventListener(`abort`,i,{once:!0});let a=!1,o=``,s=O();try{for(;;){if(k(t))return;let{value:e,done:i}=await n.read();if(k(t))return;o+=i?r.decode():r.decode(e,{stream:!0});for(let e=A(o,i);e!==null;e=A(o,i)){o=e.rest;let t=j(s,e.text);t!==void 0&&(s=O(),t!==null&&(yield t))}if(i)break}a=!0,o!==``&&j(s,o);let e=M(s);e!==null&&(yield e)}finally{t?.removeEventListener(`abort`,i),a||await n.cancel().catch(()=>void 0),n.releaseLock()}}function k(e){return e?.aborted===!0}function A(e,t){let n=e.search(/[\r\n]/);if(n===-1)return null;if(e[n]===`
|
|
2
2
|
`)return{text:e.slice(0,n),rest:e.slice(n+1)};if(n===e.length-1&&!t)return null;let r=e[n+1]===`
|
|
3
3
|
`?2:1;return{text:e.slice(0,n),rest:e.slice(n+r)}}function j(e,t){if(t===``)return M(e);if(t.startsWith(`:`))return;let n=t.indexOf(`:`),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+1),a=i.startsWith(` `)?i.slice(1):i;r===`event`?e.event=a:r===`data`?e.data.push(a):r===`id`&&(e.id=a)}function M(e){let t=e.data.join(`
|
|
4
4
|
`);if(t===``)return null;let n={event:e.event===``?`message`:e.event,data:t};return e.id!==void 0&&(n.id=e.id),n}var N=e(f(),1),ue=new Set([`text`,`tool`,`activity`,`usage`,`error`,`done`]);async function P(e){let t={};try{t=await e.json()}catch{}let n=typeof t.error==`string`?t.error:`Request failed: ${e.status}`;return new _(n,e.status,t)}function F(e,t,n){return y(`${g}${e}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),...n?{signal:n}:{}})}async function de(){let e=await y(`${g}/assistant`);if(!e.ok)throw await P(e);return await e.json()}async function fe(e,t,n){let r=await F(`/assistant/chat`,e,n);if(!r.ok)throw await P(r);if(!r.body)throw new _(`The assistant sent no response`,r.status,{});for await(let e of le(r.body,n))ue.has(e.event)&&t({...JSON.parse(e.data),type:e.event})}async function pe(e){let t=await F(`/assistant/confirm`,{token:e});if(!t.ok)throw await P(t);return await t.json()}var I={entries:[],streaming:!1,pending:{},notes:[],streamId:null,nextId:1};function L(e,t){return e.entries.map(n=>n.kind===`assistant`&&n.id===e.streamId?t(n):n)}function R(e,t,n){let r={kind:`error`,id:`e${e.nextId}`,code:t,message:n};return{...e,entries:[...e.entries,r],nextId:e.nextId+1}}function z(e,t){let n=L(e,e=>({...e,tools:e.tools.filter(e=>e.id!==t.id),activities:[...e.activities,t]})),r=t.pending;return r?{...e,entries:n,pending:{...e.pending,[r.token]:{view:r,phase:`open`}}}:{...e,entries:n}}function B(e,t){switch(t.type){case`text`:return{...e,entries:L(e,e=>({...e,text:e.text+t.text}))};case`tool`:{let n={id:t.id,tool:t.tool,label:t.label};return{...e,entries:L(e,e=>({...e,tools:[...e.tools,n]}))}}case`activity`:return z(e,t.activity);case`error`:return R(e,t.code,t.message);case`done`:return V(e);default:return e}}function V(e){if(e.streamId===null)return e;let t=e.entries.flatMap(t=>t.kind!==`assistant`||t.id!==e.streamId?[t]:t.text===``&&t.activities.length===0?[]:[{...t,streaming:!1,tools:[]}]);return{...e,entries:t,streaming:!1,streamId:null}}function H(e,t){return e.streamId===`a${t}`}function U(e,t,n,r,i){let a=e.pending[t];return a?{...e,pending:{...e.pending,[t]:{...a,phase:n,result:r}},notes:i===null?e.notes:[...e.notes,i]}:e}function me(e,t,n){return t?`Confirmed: ${e} — ${n}`:`Confirmation failed: ${e} — ${n}`}function he(e,t){switch(t.type){case`send`:{let n={kind:`user`,id:`u${t.seq}`,text:t.text,notes:e.notes},r=`a${t.seq}`,i={kind:`assistant`,id:r,text:``,streaming:!0,tools:[],activities:[]},a=[...e.entries,n,i];return{...e,entries:a,streaming:!0,streamId:r,notes:[]}}case`event`:return H(e,t.seq)?B(e,t.event):e;case`fail`:return H(e,t.seq)?R(e,t.code,t.message):e;case`finish`:return H(e,t.seq)?V(e):e;case`confirming`:return U(e,t.token,`confirming`,void 0,null);case`resolved`:{let n=me(e.pending[t.token]?.view.title??``,t.ok,t.message),r=t.ok?`done`:`failed`;return U(e,t.token,r,t.message,n)}case`cancel`:{let n=e.pending[t.token];return n?.phase===`open`?U(e,t.token,`cancelled`,void 0,`Cancelled: ${n.view.title}`):e}case`reset`:return{...I,nextId:e.nextId}}}function W(e,t){return e.length===0?t:`${e.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphCanvas-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{t}from"./save-ClSXW9cb.js";import{t as n}from"./createLucideIcon-BklFHeMd.js";import{t as r}from"./upload-CaqQJaUr.js";import{a as i,o as a,s as o}from"./vendor-diff-DGCTJYJ4.js";import{C as s,S as c,T as l,_ as u,b as d,d as f,f as p,g as m,h,m as g,p as _,v,x as y,y as b}from"./graph-config-BJA_ztYM.js";import{$ as x,ft as S,mt as C,ot as w,st as T,tt as E}from"./index-qiIlvPyv.js";import{n as D}from"./catalog-offer-CeRRk2Zo.js";import{t as O}from"./circle-check-big-DQjpuxcC.js";import{t as k}from"./circle-x-peGpq98w.js";import{t as A}from"./trash-DzRCm500.js";import{a as j,i as M,n as N,r as ee,t as P}from"./export-helpers-C_HVpJN9.js";import{t as F}from"./triangle-exclamation-point-ttN5lZI0.js";import{n as I}from"./use-loaded-DFUDFVFt.js";import{t as te}from"./external-link-Dh7p8Ii6.js";var L={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};L.node;var R=n(L),z={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};z.node;var B=n(z),V={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};V.node;var H=n(V),U={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};U.node;var ne=n(U),W=e(o(),1);function G(){return{overrides:new Map,removed:new Map,added:new Map,deleted:new Set}}function re(e){return e.overrides.size>0||e.removed.size>0||e.added.size>0||e.deleted.size>0}function ie(e,t,n,r){let i=e.overrides.get(t)??{},a=new Map(e.overrides);a.set(t,{...i,[n]:r});let o=e.removed.get(t);if(o?.has(n)){let r=new Map(e.removed),i=new Set(o);return i.delete(n),i.size===0?r.delete(t):r.set(t,i),{...e,overrides:a,removed:r}}return{...e,overrides:a}}function ae(e,t,n){let r=e.removed.get(t),i=new Map(e.removed);i.set(t,new Set([...r??[],n]));let a=e.overrides.get(t);if(a&&n in a){let r=new Map(e.overrides),{[n]:o,...s}=a;return Object.keys(s).length===0?r.delete(t):r.set(t,s),{...e,overrides:r,removed:i}}return{...e,removed:i}}function oe(e,t){let n=ue(t),r=new Map(e.added);if(r.set(n,t),e.deleted.has(n)){let t=new Set(e.deleted);return t.delete(n),{...e,added:r,deleted:t}}return{...e,added:r}}function se(e,t){if(e.added.has(t)){let n=new Map(e.added);return n.delete(t),{...e,added:n}}let n=new Set(e.deleted);n.add(t);let r=new Map(e.overrides);r.delete(t);let i=new Map(e.removed);return i.delete(t),{...e,overrides:r,removed:i,deleted:n}}function ce(e,t){if(!re(t))return e;let n=[];for(let r of e.nodes){let e=J(r);if(t.deleted.has(e))continue;let i=t.overrides.get(e),a=t.removed.get(e);if(!i&&!a){n.push(r);continue}let o={};for(let[e,t]of Object.entries(r))a?.has(e)||(o[e]=t);if(i){let e=i[`@type`];typeof e==`string`&&(o[`@type`]=e);for(let[e,t]of Object.entries(i))e!==`@type`&&(o[e]=t)}n.push(o)}let r=0;for(let e of t.added.values()){let t={"@type":e[`@type`],...e.properties,_ek:`added:${r++}`};e[`@id`]&&(t[`@id`]=e[`@id`]),n.push(t)}let i=_(n),a=new Map;for(let e of n){let t=e[`@id`];typeof t==`string`&&a.set(t,e)}return{nodes:n,byEk:i,byId:a,referencedBy:h(n),primary:e.primary?a.get(e.primary[`@id`]??``)??null:null}}function le(e,t,n){let r=new Map;for(let[e,t]of n)r.set(t,e);let i=[];for(let n=0;n<t.entities.length;n++){let a=t.entities[n],o=r.get(n);if(o&&e.deleted.has(o))continue;let s=o?e.overrides.get(o):void 0,c=o?e.removed.get(o):void 0;if(!s&&!c){i.push({...a,properties:K(a.properties)});continue}let l={};for(let[e,t]of Object.entries(a.properties))c?.has(e)||(l[e]=t);if(s)for(let[e,t]of Object.entries(s))e!==`@type`&&(l[e]=t);let u=s?.[`@type`];i.push({"@type":typeof u==`string`?u:a[`@type`],...a[`@id`]?{"@id":a[`@id`]}:{},...a.role?{role:a.role}:{},properties:K(l)})}for(let t of e.added.values())i.push({...t,properties:K(t.properties)});return{...t,entities:i}}function K(e){let t={};for(let[n,r]of Object.entries(e))t[n]=q(r);return t}function q(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(q);let t=e;if(`@type`in t){let e={};for(let[n,r]of Object.entries(t))n!==`@id`&&(e[n]=q(r));return e}return e}function ue(e){return e[`@id`]?e[`@id`]:e.role?`${e[`@type`]}:${e.role}`:e[`@type`]}function J(e){let t=e._ek;if(typeof t==`string`)return t;let n=typeof e[`@type`]==`string`?e[`@type`]:Array.isArray(e[`@type`])?e[`@type`][0]:null;return typeof n==`string`?n:`unknown`}var Y=a();function de({catalogTypes:e,onAdd:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(``),o=(0,W.useCallback)(e=>{e?.focus()},[]);if(!n)return(0,Y.jsxs)(`button`,{type:`button`,className:`graph-add-entity-btn`,onClick:()=>r(!0),children:[(0,Y.jsx)(w,{size:14}),` Add entity`]});let s=fe(e,i);return(0,Y.jsxs)(`div`,{className:`graph-add-entity-picker`,children:[(0,Y.jsxs)(`div`,{className:`graph-add-entity-header`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text graph-add-entity-search`,value:i,onChange:e=>a(e.target.value),placeholder:`Search types…`,ref:o}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-add-entity-close`,onClick:()=>{r(!1),a(``)},"aria-label":`Close picker`,children:(0,Y.jsx)(E,{size:16})})]}),(0,Y.jsxs)(`div`,{className:`graph-add-entity-list`,children:[s.length===0&&(0,Y.jsx)(`p`,{className:`graph-add-entity-empty`,children:`No matching types.`}),s.map(e=>(0,Y.jsxs)(`div`,{className:`graph-add-entity-group`,children:[(0,Y.jsx)(`div`,{className:`graph-add-entity-category`,children:e.label}),e.types.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`graph-add-entity-type`,onClick:()=>{t(e.type),r(!1),a(``)},children:[(0,Y.jsx)(`span`,{className:`graph-add-entity-type-name`,children:e.type}),(0,Y.jsx)(`span`,{className:`graph-add-entity-type-desc`,children:e.label}),e.richResult&&(0,Y.jsx)(`span`,{className:`graph-add-entity-rich-badge`,children:`Rich result`}),e.lifecycle?.status===`pending`&&(0,Y.jsx)(`span`,{className:`graph-add-entity-rich-badge`,children:`pending`})]},e.type))]},e.category))]})]})}function fe(e,t){let n=e.filter(e=>D(e,!1)),r=t?n.filter(e=>e.type.toLowerCase().includes(t.toLowerCase())||e.label.toLowerCase().includes(t.toLowerCase())):n,i=new Map;for(let e of[`business`,`content`,`commerce`,`people`,`navigation`,`reviews`])i.set(e,{category:e,label:p[e],types:[]});for(let e of r){let t=e.category,n=i.get(t);n&&n.types.push(e)}return[...i.values()].filter(e=>e.types.length>0)}function X({category:e}){return e===null?null:(0,Y.jsx)(`span`,{className:`graph-category-badge graph-category-${e}`,children:p[e]})}function Z({node:e,category:t,classifications:n,selected:r,focused:i,onSelect:a,onToggleExpanded:o,expanded:c}){let l=s(e[`@type`])??`Unknown`,u=e[`@id`],d=Q(e),{requiredSet:f,requiredTotal:p}=v(n);return(0,Y.jsxs)(`div`,{className:[`graph-entity-header`,r?`graph-entity-header--selected`:``,i?`graph-focused`:``].filter(Boolean).join(` `),children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-entity-expand-button`,onClick:e=>{e.stopPropagation(),o()},"aria-expanded":c,"aria-label":c?`Collapse entity`:`Expand entity`,children:(0,Y.jsx)(`span`,{className:`graph-entity-chevron ${c?`graph-entity-chevron--open`:``}`,children:`▸`})}),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-entity-header-main`,onClick:a,children:[(0,Y.jsxs)(`div`,{className:`graph-entity-header-row`,children:[(0,Y.jsx)(`span`,{className:`graph-entity-type`,children:l}),d&&(0,Y.jsx)(`span`,{className:`graph-entity-name`,children:d}),(0,Y.jsx)(X,{category:t})]}),(0,Y.jsxs)(`div`,{className:`graph-entity-header-meta`,children:[u&&(0,Y.jsx)(`span`,{className:`graph-entity-id`,children:u}),p>0&&(0,Y.jsxs)(`span`,{className:`graph-entity-eligibility ${f===p?`graph-entity-eligibility--complete`:`graph-entity-eligibility--incomplete`}`,title:`${f} of ${p} required properties set`,children:[f,`/`,p,` required`]})]})]})]})}function Q(e){for(let t of[`name`,`headline`,`title`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function pe({value:e,onChange:t,label:n,placeholder:r}){let i=[...e],a=()=>{t([...i,``])},o=(e,n)=>{let r=[...i];r[e]=n,t(r)},s=e=>{t(i.filter((t,n)=>n!==e))};return(0,Y.jsxs)(`div`,{className:`graph-input graph-input--array`,role:`group`,"aria-label":n,children:[i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`graph-input-array-item`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text`,value:e,onChange:e=>o(t,e.target.value),placeholder:r}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-input-array-remove`,onClick:()=>s(t),"aria-label":`Remove item`,children:(0,Y.jsx)(E,{size:14})})]},t)),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-input-array-add`,onClick:a,children:[(0,Y.jsx)(w,{size:14}),` Add item`]})]})}function me({value:e,onChange:t,label:n}){return(0,Y.jsx)(`input`,{type:`date`,className:`graph-input graph-input--date`,value:e,onChange:e=>t(e.target.value),"aria-label":n})}function he({value:e,onChange:t,label:n,min:r,max:i}){return(0,Y.jsx)(`input`,{type:`number`,className:`graph-input graph-input--number`,value:e,onChange:e=>{let n=e.target.value;t(n===``?``:Number(n))},"aria-label":n,min:r,max:i})}function ge({value:e,onChange:t,label:n}){let r=(0,W.useId)(),i=(n,r,i)=>{t(e.map((e,t)=>t===n?{...e,[r]:i}:e))},a=n=>{t(e.filter((e,t)=>t!==n))},o=()=>{let n={},r=e[0];if(r)for(let[t,i]of Object.entries(r))t===`@type`?n[`@type`]=i:n[t]=typeof i==`number`?Math.max(...e.map(e=>Number(e[t])||0))+1:``;t([...e,n])},s=new Set;for(let t of e)for(let e of Object.keys(t))e!==`@type`&&s.add(e);let c=[...s];return(0,Y.jsxs)(`div`,{className:`graph-input graph-input--object-array`,role:`group`,"aria-label":n,children:[e.map((e,t)=>(0,Y.jsxs)(`div`,{className:`graph-object-array-item`,children:[(0,Y.jsxs)(`span`,{className:`graph-object-array-item-index`,children:[t+1,`.`]}),(0,Y.jsx)(`div`,{className:`graph-object-array-item-fields`,children:c.map(n=>{let a=e[n],o=`${r}-${t}-${n}`;return(0,Y.jsxs)(`div`,{className:`graph-object-array-field`,children:[(0,Y.jsx)(`label`,{htmlFor:o,className:`graph-object-array-field-label`,children:n}),typeof a==`string`||typeof a==`number`||a===void 0?(0,Y.jsx)(`input`,{id:o,type:`text`,className:`graph-input graph-input--text`,value:a===void 0?``:String(a),onChange:e=>{let r=typeof a==`number`&&Number(e.target.value)||e.target.value;i(t,n,r)},placeholder:n}):(0,Y.jsx)(`span`,{id:o,className:`graph-property-value-object`,children:JSON.stringify(a).slice(0,60)})]},n)})}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-object-array-item-remove`,onClick:()=>a(t),"aria-label":`Remove item ${t+1}`,children:(0,Y.jsx)(A,{size:12})})]},t)),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-input-array-add`,onClick:o,children:[(0,Y.jsx)(w,{size:14}),` Add item`]})]})}function _e({value:e,onChange:t,options:n,label:r}){return(0,Y.jsxs)(`select`,{className:`graph-input graph-input--select`,value:e,onChange:e=>t(e.target.value),"aria-label":r,children:[(0,Y.jsx)(`option`,{value:``,children:`Select…`}),n.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]})}function ve({value:e,onChange:t,placeholder:n,label:r}){return(0,Y.jsx)(`textarea`,{className:`graph-input graph-input--textarea`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r,rows:3})}function ye({value:e,onChange:t,placeholder:n,label:r}){return(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r})}function be({value:e,onChange:t,placeholder:n,label:r}){let[i,a]=(0,W.useState)(!1),o=e===``||xe(e);return(0,Y.jsx)(`input`,{type:`url`,className:`graph-input graph-input--url ${i&&!o?`graph-input--invalid`:``}`,value:e,onChange:e=>t(e.target.value),onBlur:()=>a(!0),placeholder:n??`https://`,"aria-label":r,"aria-invalid":i&&!o})}function xe(e){try{return new URL(e),!0}catch{return!1}}function Se({classification:e,onFollowReference:t,onValueChange:n,onRemove:r}){let{property:i,value:a,importance:o,state:s,isReference:u,referenceId:d,def:f}=e,p=f?.label??i,m=we(o,s),h=n!==void 0;return(0,Y.jsxs)(`div`,{className:`graph-property-row ${m}`,children:[(0,Y.jsxs)(`div`,{className:`graph-property-label-col`,children:[(0,Y.jsx)(Te,{importance:o,state:s}),(0,Y.jsx)(`span`,{className:`graph-property-label`,children:p})]}),(0,Y.jsx)(`div`,{className:`graph-property-value`,children:u&&d!==void 0?(0,Y.jsxs)(`button`,{type:`button`,className:`graph-reference-link`,onClick:()=>t?.(d),"aria-label":`Follow reference to ${d}`,children:[(0,Y.jsx)(l,{size:12}),(0,Y.jsx)(`span`,{className:`graph-reference-link-id`,children:c(d)})]}):h?(0,Y.jsxs)(`div`,{className:`graph-property-input-row`,children:[(0,Y.jsx)(Ce,{property:i,value:a,fieldType:f?.fieldType,hint:f?.hint,onChange:e=>n(i,e)}),r&&(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-remove`,onClick:()=>r(i),"aria-label":`Remove ${p}`,children:(0,Y.jsx)(E,{size:14})})]}):(0,Y.jsx)(Ee,{value:a})})]})}function Ce({property:e,value:t,fieldType:n,hint:r,onChange:i}){if(n!==`array`&&typeof t==`object`&&t){if(Array.isArray(t))return(0,Y.jsxs)(`span`,{className:`graph-property-value-array`,children:[`Array (`,t.length,` item`,t.length===1?``:`s`,`)`]});let e=t,n=typeof e[`@type`]==`string`?e[`@type`]:null;return(0,Y.jsx)(`span`,{className:`graph-property-value-object`,children:n?`{${n}}`:JSON.stringify(t).slice(0,80)})}let a=typeof t==`string`?t:t==null?``:String(t);switch(n){case`textarea`:return(0,Y.jsx)(ve,{value:a,onChange:i,label:e});case`url`:return(0,Y.jsx)(be,{value:a,onChange:i,label:e});case`date`:return(0,Y.jsx)(me,{value:a,onChange:i,label:e});case`number`:return(0,Y.jsx)(he,{value:typeof t==`number`?t:a,onChange:i,label:e});case`select`:{let t=r?r.split(`|`).map(e=>e.trim()).filter(Boolean):[];return(0,Y.jsx)(_e,{value:a,onChange:i,options:t,label:e})}case`array`:return Array.isArray(t)?t.some(e=>typeof e==`object`&&!!e)?(0,Y.jsx)(ge,{value:t,onChange:i,label:e}):(0,Y.jsx)(pe,{value:t.map(e=>typeof e==`string`?e:String(e)),onChange:i,label:e}):(0,Y.jsx)(ye,{value:``,onChange:i,label:e});case`email`:return(0,Y.jsx)(`input`,{type:`email`,className:`graph-input graph-input--email`,value:a,onChange:e=>i(e.target.value),"aria-label":e});case`tel`:return(0,Y.jsx)(`input`,{type:`tel`,className:`graph-input graph-input--tel`,value:a,onChange:e=>i(e.target.value),"aria-label":e});default:return(0,Y.jsx)(ye,{value:a,onChange:i,label:e})}}function we(e,t){return e===`required`&&t===`missing`?`graph-property-row--required-missing`:e===`recommended`&&t===`missing`?`graph-property-row--recommended-missing`:t===`set`&&e===`required`?`graph-property-row--required-set`:``}function Te({importance:e,state:t}){return e===`required`&&t===`missing`?(0,Y.jsx)(k,{size:14,className:`graph-property-badge graph-property-badge--required-missing`,"aria-label":`Missing required`}):e===`recommended`&&t===`missing`?(0,Y.jsx)(S,{size:14,className:`graph-property-badge graph-property-badge--recommended-missing`,"aria-label":`Missing recommended`}):t===`set`&&e===`required`?(0,Y.jsx)(O,{size:14,className:`graph-property-badge graph-property-badge--set`,"aria-label":`Set`}):(0,Y.jsx)(`span`,{className:`graph-property-badge graph-property-badge--placeholder`,"aria-hidden":!0})}function Ee({value:e}){if(e==null||e===``)return(0,Y.jsx)(`span`,{className:`graph-property-value-empty`,children:`—`});if(typeof e==`string`)return(0,Y.jsx)(`span`,{className:`graph-property-value-string`,children:De(e,120)});if(typeof e==`number`||typeof e==`boolean`)return(0,Y.jsx)(`span`,{className:`graph-property-value-primitive`,children:String(e)});if(Array.isArray(e))return(0,Y.jsxs)(`span`,{className:`graph-property-value-array`,children:[`Array (`,e.length,` item`,e.length===1?``:`s`,`)`]});if(typeof e==`object`){let t=e,n=typeof t[`@type`]==`string`?t[`@type`]:`object`;return(0,Y.jsx)(`span`,{className:`graph-property-value-object`,children:`{${n}}`})}return(0,Y.jsx)(`span`,{className:`graph-property-value-unknown`,children:String(e)})}function De(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Oe({node:e,catalogTypes:t,catalogDetail:n,selected:r,focused:i,onSelect:a,onFollowReference:o,initiallyExpanded:s=!1}){let[c,l]=(0,W.useState)(s),f=b(e,t),p=u(e,n),m=d(p),h=p.some(e=>e.importance===`required`&&e.state===`missing`);return(0,Y.jsxs)(`div`,{className:`graph-entity-card ${r?`graph-entity-card--selected`:``} ${h?`graph-entity-card--missing-required`:``}`,"data-entity-id":e[`@id`]??``,role:`treeitem`,tabIndex:r?0:-1,"aria-selected":r,"aria-expanded":c,children:[(0,Y.jsx)(Z,{node:e,category:f,classifications:p,selected:r,focused:i,onSelect:()=>a(e),onToggleExpanded:()=>l(e=>!e),expanded:c}),c&&(0,Y.jsx)(`div`,{className:`graph-entity-body`,children:m.length===0?(0,Y.jsx)(`p`,{className:`graph-entity-empty`,children:`No properties.`}):(0,Y.jsx)(`div`,{className:`graph-property-list`,children:m.map(e=>(0,Y.jsx)(Se,{classification:e,onFollowReference:o},e.property))})})]})}function ke({data:e,collection:t,slug:n}){let[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(null),c=(0,W.useRef)(null);return(0,W.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]),(0,W.useEffect)(()=>{if(!r)return;let e=e=>{s.current&&!s.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]),(0,Y.jsxs)(`div`,{className:`graph-export-dropdown`,ref:s,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`graph-export-btn`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-haspopup":`true`,children:[(0,Y.jsx)(j,{size:14}),` Export`]}),r&&(0,Y.jsxs)(`div`,{className:`graph-export-menu`,role:`menu`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-export-menu-item`,role:`menuitem`,onClick:()=>{let r=N(e),a=M(t,n);P(r,a,`application/ld+json`),i(!1)},children:`Download .jsonld`}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-export-menu-item`,role:`menuitem`,onClick:()=>{let t=ee(e);navigator.clipboard.writeText(t).then(()=>{o(`success`),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3)}).catch(()=>{o(`error`),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3)}),i(!1)},children:a===`success`?`Copied!`:a===`error`?`Copy failed`:`Copy as <script> tag`})]})]})}function Ae({label:e,variant:t,children:n}){return(0,Y.jsxs)(`section`,{className:`graph-section graph-section--${t}`,children:[(0,Y.jsx)(`h3`,{className:`graph-section-label`,children:e}),(0,Y.jsx)(`div`,{className:`graph-section-content`,children:n})]})}function je({model:e,layout:t,catalogTypes:n,catalogDetails:r}){let i=Me(e,n,r),a=`${t.siteContext.length} site, ${+!!t.page} page, ${+!!t.primary} primary, ${t.linked.length} linked`;return(0,Y.jsxs)(`header`,{className:`graph-summary`,children:[(0,Y.jsxs)(`div`,{className:`graph-summary-primary`,children:[(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.entityCount}),` entities`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.categories.size}),` categories`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.richResultCount}),` rich-result eligible`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric ${i.requiredTotal-i.requiredSet>0?`graph-summary-metric--warning`:``}`,children:[(0,Y.jsxs)(`strong`,{children:[i.requiredSet,`/`,i.requiredTotal]}),` `,`required set`,i.requiredTotal-i.requiredSet>0&&(0,Y.jsxs)(`span`,{className:`graph-summary-missing`,children:[`(`,i.requiredTotal-i.requiredSet,` missing)`]})]})]}),(0,Y.jsx)(`div`,{className:`graph-summary-secondary`,children:a})]})}function Me(e,t,n){let r=new Set,i=0,a=0,o=0,s=new Map;for(let e of t)s.set(e.type,e);for(let c of e.nodes){let e=b(c,t);e!==null&&r.add(e);let l=typeof c[`@type`]==`string`?c[`@type`]:null;if(l!==null){s.get(l)?.richResult&&(o+=1);let e=n.get(l)??null,t=u(c,e);for(let e of t)e.importance===`required`&&(a+=1,e.state===`set`&&(i+=1))}}return{entityCount:e.nodes.length,categories:r,richResultCount:o,requiredSet:i,requiredTotal:a}}function Ne(e,t,n,r){let i;try{i=JSON.parse(e)}catch(e){return ze(e instanceof Error?`Invalid JSON: ${e.message}`:`Invalid JSON`)}let a=y(i);if(a.nodes.length===0)return ze(`No entities found in the imported JSON-LD.`);let o=[],c=0;for(let e of a.nodes){let i=s(e[`@type`]);if(!i)continue;let a=typeof e.role==`string`?e.role:void 0,l=Re(t,i,a),u=!l,d=!n.has(i),f=r.get(i),p=[];for(let[t,n]of Object.entries(e)){if(t===`@type`||t===`@id`||t===`@context`||t===`role`)continue;let e=l?.[t],r=f?!f.has(t):!1;l&&t in l?Be(e,n)||p.push({entityType:i,entityRole:a,property:t,kind:`changed`,oldValue:e,newValue:n,unknownProperty:r}):p.push({entityType:i,entityRole:a,property:t,kind:`added`,oldValue:void 0,newValue:n,unknownProperty:r})}if(l)for(let[t,n]of Object.entries(l))t!==`@type`&&t!==`@id`&&t!==`@context`&&t!==`role`&&(t in e||p.push({entityType:i,entityRole:a,property:t,kind:`removed`,oldValue:n,newValue:void 0,unknownProperty:!1}));(p.length>0||u)&&(o.push({type:i,role:a,disabled:d,disabledReason:d?`${i} is not part of this document's archetype`:void 0,changes:p}),u&&(c+=1))}let l=o.reduce((e,t)=>e+t.changes.length,0);return{entities:o,totalPropertyChanges:l,totalEntityAdditions:c,requiresConfirmation:l>=10||o.length>=3,error:void 0,importedModel:a}}function Pe(e,t){if(e==null||typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>Pe(e,t));if(typeof e==`object`){let n=e,r={};for(let[e,i]of Object.entries(n))r[e]=e===`@id`&&typeof i==`string`?t.get(i)??i:Pe(i,t);return r}return e}function Fe(e,t,n){let r=new Map;for(let i of e.nodes){let e=i[`@id`];if(typeof e!=`string`)continue;let a=s(i[`@type`]);if(!a)continue;let o=Re(t,a,typeof i.role==`string`?i.role:void 0);o&&typeof o[`@id`]==`string`?r.set(e,o[`@id`]):r.set(e,`${n.replace(/\/+$/,``)}/#${a.toLowerCase()}`)}return r}function Ie(e,t,n){let r=e;for(let e of t){let t=Le(e),i=Pe(e.value,n);r=ie(r,t,e.property,i)}return r}function Le(e){return e.entityId?e.entityId:e.entityRole?`${e.entityType}:${e.entityRole}`:e.entityType}function Re(e,t,n){return e.nodes.find(e=>s(e[`@type`])===t?!n||e.role===n:!1)}function ze(e){return{entities:[],totalPropertyChanges:0,totalEntityAdditions:0,requiresConfirmation:!1,error:e,importedModel:void 0}}function Be(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!=`object`||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>Be(e,t[n]));let n=e,r=t,i=Object.keys(n),a=Object.keys(r);return i.length===a.length&&i.every(e=>Be(n[e],r[e]))}function Ve({entities:e,selectedProperties:t,onToggle:n}){return e.length===0?(0,Y.jsx)(`p`,{className:`import-diff-empty`,children:`No changes detected.`}):(0,Y.jsx)(`div`,{className:`import-diff-panel`,children:e.map(e=>(0,Y.jsxs)(`div`,{className:`import-diff-entity ${e.disabled?`import-diff-entity--disabled`:``}`,children:[(0,Y.jsxs)(`div`,{className:`import-diff-entity-header`,children:[(0,Y.jsx)(`span`,{className:`import-diff-entity-type`,children:e.type}),e.role&&(0,Y.jsx)(`span`,{className:`import-diff-entity-role`,children:e.role}),e.disabled&&(0,Y.jsx)(`span`,{className:`import-diff-entity-badge import-diff-entity-badge--disabled`,children:`Disabled`}),(0,Y.jsxs)(`span`,{className:`import-diff-entity-count`,children:[e.changes.length,` change`,e.changes.length===1?``:`s`]})]}),e.disabled&&e.disabledReason&&(0,Y.jsx)(`p`,{className:`import-diff-disabled-reason`,children:e.disabledReason}),(0,Y.jsx)(`div`,{className:`import-diff-changes`,children:e.changes.map(r=>{let i=He(e,r),a=t.has(i),o=!e.disabled&&r.kind!==`removed`;return(0,Y.jsxs)(`label`,{className:`import-diff-change import-diff-change--${r.kind}`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:a,disabled:!o,onChange:()=>n(i),className:`import-diff-checkbox`}),(0,Y.jsxs)(`div`,{className:`import-diff-change-content`,children:[(0,Y.jsxs)(`div`,{className:`import-diff-change-header`,children:[(0,Y.jsx)(Ue,{kind:r.kind}),(0,Y.jsx)(`span`,{className:`import-diff-property`,children:r.property}),r.unknownProperty&&(0,Y.jsxs)(`span`,{className:`import-diff-warning`,children:[(0,Y.jsx)(F,{size:12}),` Unknown property`]})]}),(0,Y.jsxs)(`div`,{className:`import-diff-change-values`,children:[r.kind===`changed`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`import-diff-old-value`,children:$(r.oldValue)}),(0,Y.jsx)(`span`,{className:`import-diff-arrow`,children:`→`}),(0,Y.jsx)(`span`,{className:`import-diff-new-value`,children:$(r.newValue)})]}),r.kind===`added`&&(0,Y.jsx)(`span`,{className:`import-diff-new-value`,children:$(r.newValue)}),r.kind===`removed`&&(0,Y.jsx)(`span`,{className:`import-diff-removed-value`,children:$(r.oldValue)})]})]})]},i)})})]},`${e.type}-${e.role??``}`))})}function He(e,t){return`${e.type}:${e.role??``}:${t.property}`}function Ue({kind:e}){switch(e){case`added`:return(0,Y.jsx)(w,{size:14,className:`import-diff-icon import-diff-icon--added`});case`changed`:return(0,Y.jsx)(I,{size:14,className:`import-diff-icon import-diff-icon--changed`});case`removed`:return(0,Y.jsx)(H,{size:14,className:`import-diff-icon import-diff-icon--removed`});default:return(0,Y.jsx)(I,{size:14})}}function $(e){if(e==null)return`—`;if(typeof e==`string`)return e.length>80?`${e.slice(0,77)}…`:e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`object`){let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}…`:t}return String(e)}function We({currentModel:e,currentEntityTypes:t,catalogPropertySets:n,baseUrl:i,buffer:a,onApply:o,onClose:s}){let[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(new Set),[m,h]=(0,W.useState)(!1),g=(0,W.useRef)(null),_=(0,W.useId)();x(g,!0),(0,W.useEffect)(()=>{let e=e=>{e.key===`Escape`&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s]);let v=(0,W.useCallback)(()=>{let r=Ne(c,e,t,n);if(d(r),!r.error){let e=new Set;for(let t of r.entities)if(!t.disabled)for(let n of t.changes)n.kind!==`removed`&&e.add(He(t,n));p(e)}},[c,e,t,n]),y=(0,W.useCallback)(e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),b=(0,W.useCallback)(()=>{if(!u?.importedModel)return;let t=[];for(let n of u.entities){if(n.disabled)continue;let r=e.nodes.find(e=>(typeof e[`@type`]==`string`?e[`@type`]:void 0)===n.type&&(!n.role||e.role===n.role)),i=typeof r?.[`@id`]==`string`?r[`@id`]:void 0;for(let e of n.changes){let r=He(n,e);f.has(r)&&e.kind!==`removed`&&t.push({entityType:e.entityType,entityRole:e.entityRole,entityId:i,property:e.property,value:e.newValue,kind:e.kind})}}t.length===0||o(Ie(a,t,Fe(u.importedModel,e,i))),s()},[u,f,e,i,a,o,s]),S=u!==null&&!u.error&&f.size>0&&(!u.requiresConfirmation||m);return(0,Y.jsxs)(`div`,{className:`import-modal-overlay`,children:[(0,Y.jsx)(`div`,{className:`import-modal-scrim`,"aria-hidden":`true`,onClick:s}),(0,Y.jsxs)(`div`,{ref:g,className:`import-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":_,tabIndex:-1,children:[(0,Y.jsxs)(`div`,{className:`import-modal-header`,children:[(0,Y.jsxs)(`h2`,{id:_,className:`import-modal-title`,children:[(0,Y.jsx)(r,{size:18}),` Import JSON-LD`]}),(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-close`,onClick:s,children:`×`})]}),(0,Y.jsx)(`div`,{className:`import-modal-body`,children:u?u.error?(0,Y.jsxs)(`div`,{className:`import-modal-error`,children:[(0,Y.jsx)(`p`,{children:u.error}),(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--secondary`,onClick:()=>d(null),children:`Edit JSON`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`import-modal-summary`,children:[u.totalPropertyChanges,` property change`,u.totalPropertyChanges===1?``:`s`,` across `,u.entities.length,` entit`,u.entities.length===1?`y`:`ies`,u.totalEntityAdditions>0&&` (${u.totalEntityAdditions} new entit${u.totalEntityAdditions===1?`y`:`ies`})`]}),(0,Y.jsx)(Ve,{entities:u.entities,selectedProperties:f,onToggle:y}),u.requiresConfirmation&&(0,Y.jsxs)(`label`,{className:`import-modal-confirm`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked)}),`I've reviewed these changes`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`import-modal-hint`,children:`Paste a JSON-LD blob to import entities and properties into this document. Changes will be reviewed before applying.`}),(0,Y.jsx)(`textarea`,{className:`import-modal-textarea`,value:c,onChange:e=>l(e.target.value),placeholder:`{"@context": "https://schema.org", "@graph": [...]}`,rows:12})]})}),(0,Y.jsxs)(`div`,{className:`import-modal-footer`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--secondary`,onClick:s,children:`Cancel`}),u?u.error?null:(0,Y.jsxs)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--primary`,onClick:b,disabled:!S,children:[`Apply `,f.size,` change`,f.size===1?``:`s`]}):(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--primary`,onClick:v,disabled:!c.trim(),children:`Parse`})]})]})]})}var Ge=`krantho:graphLayout`;function Ke({value:e,onChange:t}){let n=e===`tree`?`canvas`:`tree`,r=n===`canvas`?`Canvas`:`Tree`,i=n===`canvas`?T:B;return(0,Y.jsxs)(`button`,{type:`button`,className:`graph-layout-toggle-btn`,onClick:()=>t(n),title:`Switch to ${r} view`,children:[(0,Y.jsx)(i,{size:14}),` `,r]})}function qe(){let[e,t]=(0,W.useState)(()=>{try{return localStorage.getItem(Ge)===`canvas`?`canvas`:`tree`}catch{return`tree`}});return[e,e=>{t(e);try{localStorage.setItem(Ge,e)}catch{}}]}function Je({references:e,onFollow:t}){return e.length===0?(0,Y.jsx)(`p`,{className:`graph-references-empty`,children:`No inbound references.`}):(0,Y.jsx)(`ul`,{className:`graph-references-list`,children:e.map((e,n)=>{let r=e.source[`@id`],i=s(e.source[`@type`])??`Node`,a=`${r??`anon`}-${e.property}-${n}`;return(0,Y.jsx)(`li`,{className:`graph-references-item`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`graph-references-link`,onClick:()=>r&&t?.(r),disabled:r===void 0,children:[(0,Y.jsx)(R,{size:12}),(0,Y.jsx)(`span`,{className:`graph-references-source`,children:i}),(0,Y.jsxs)(`span`,{className:`graph-references-property`,children:[`.`,e.property]})]})},a)})})}function Ye({value:e,onChange:t}){let n=(0,W.useId)();return(0,Y.jsxs)(`div`,{className:`graph-scope-propagation`,children:[(0,Y.jsx)(`span`,{className:`graph-scope-propagation-label`,children:`Apply changes to:`}),(0,Y.jsxs)(`label`,{className:`graph-scope-propagation-option`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:n,value:`document`,checked:e===`document`,onChange:()=>t(`document`)}),`This document`]}),(0,Y.jsxs)(`label`,{className:`graph-scope-propagation-option`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:n,value:`site`,checked:e===`site`,onChange:()=>t(`site`)}),`All documents (site-level)`]})]})}function Xe({classifications:e,compact:t=!1}){let n=e.filter(e=>e.importance===`required`),r=e.filter(e=>e.importance===`recommended`),i=n.filter(e=>e.state===`set`).length,a=r.filter(e=>e.state===`set`).length;if(n.length===0&&r.length===0)return(0,Y.jsx)(`span`,{className:`graph-validation-meter graph-validation-meter--empty`});let o=i===n.length?`graph-validation-meter--eligible`:`graph-validation-meter--incomplete`;return t?(0,Y.jsx)(`span`,{className:`graph-validation-meter graph-validation-meter--compact ${o}`,children:n.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment`,children:[i,`/`,n.length]})}):(0,Y.jsxs)(`div`,{className:`graph-validation-meter ${o}`,children:[n.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment graph-validation-meter-segment--required`,children:[i,`/`,n.length,` required`]}),r.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment graph-validation-meter-segment--recommended`,children:[a,`/`,r.length,` recommended`]})]})}function Ze({node:e,model:t,catalogTypes:n,catalogDetails:r,onFollowReference:i,onPropertyChange:a,onPropertyRemove:o,onDeleteEntity:c,isSiteLevel:l,propagationScope:f,onPropagationChange:m}){let[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(!1),y=a!==void 0;if((0,W.useEffect)(()=>{g(!1),v(!1)},[e]),e===null)return(0,Y.jsx)(`aside`,{className:`graph-property-panel graph-property-panel--empty`,children:(0,Y.jsx)(`p`,{className:`graph-property-panel-hint`,children:`Select an entity to see its details.`})});let x=s(e[`@type`])??`Unknown`,S=b(e,n),C=r.get(x)??null,T=u(e,C),E=d(T),D=Qe(C),O=e[`@id`]?t.referencedBy.get(e[`@id`])??[]:[],k=new Set(Object.keys(e).filter(e=>e!==`@type`&&e!==`@id`&&e!==`@context`&&e!==`_ek`)),j=C?C.properties.filter(e=>!k.has(e.property)):[],M=J(e);return(0,Y.jsxs)(`aside`,{className:`graph-property-panel`,children:[(0,Y.jsxs)(`header`,{className:`graph-property-panel-header`,children:[(0,Y.jsxs)(`div`,{className:`graph-property-panel-title-row`,children:[(0,Y.jsx)(`h3`,{className:`graph-property-panel-title`,children:x}),(0,Y.jsx)(X,{category:S}),y&&c&&!_&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-panel-delete`,onClick:()=>v(!0),"aria-label":`Delete ${x} entity`,children:[(0,Y.jsx)(A,{size:12}),` Delete`]}),y&&c&&_&&(0,Y.jsxs)(`span`,{className:`graph-property-panel-delete-confirm`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-panel-delete graph-property-panel-delete--confirm`,onClick:()=>{c(M),v(!1)},children:`Confirm`}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-panel-delete-cancel`,onClick:()=>v(!1),children:`Cancel`})]})]}),S&&(0,Y.jsx)(`p`,{className:`graph-property-panel-category-label`,children:p[S]}),D.map(e=>(0,Y.jsxs)(`div`,{className:`graph-property-panel-rich-result`,children:[(0,Y.jsxs)(`span`,{className:`graph-property-panel-rich-result-label`,children:[e.reader,`:`]}),` `,(0,Y.jsx)(`strong`,{children:e.feature}),e.status!==`active`&&` (${e.status})`,(0,Y.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noopener noreferrer`,className:`graph-property-panel-docs-link`,children:[`Docs `,(0,Y.jsx)(te,{size:12})]})]},e.reader)),(0,Y.jsx)(Xe,{classifications:T}),y&&l&&f&&m&&(0,Y.jsx)(Ye,{value:f,onChange:m})]}),(0,Y.jsxs)(`section`,{className:`graph-property-panel-section`,children:[(0,Y.jsx)(`h4`,{className:`graph-property-panel-section-label`,children:`Properties`}),E.length===0?(0,Y.jsx)(`p`,{className:`graph-property-panel-empty`,children:`No catalog properties available.`}):(0,Y.jsx)(`div`,{className:`graph-property-list`,children:E.map(e=>(0,Y.jsx)(Se,{classification:e,onFollowReference:i,onValueChange:y?(e,t)=>a(M,e,t):void 0,onRemove:y&&o?e=>o(M,e):void 0},e.property))}),y&&j.length>0&&(0,Y.jsx)(`div`,{className:`graph-property-add`,children:h?(0,Y.jsxs)(`div`,{className:`graph-property-add-picker`,children:[j.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-add-option`,onClick:()=>{a(M,e.property,``),g(!1)},children:[(0,Y.jsx)(`span`,{className:`graph-property-add-option-name`,children:e.label}),(0,Y.jsx)(`span`,{className:`graph-property-add-option-importance graph-property-add-option-importance--${e.importance}`,children:e.importance})]},e.property)),(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-add-cancel`,onClick:()=>g(!1),children:`Cancel`})]}):(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-add-btn`,onClick:()=>g(!0),children:[(0,Y.jsx)(w,{size:14}),` Add property`]})})]}),(0,Y.jsxs)(`section`,{className:`graph-property-panel-section`,children:[(0,Y.jsx)(`h4`,{className:`graph-property-panel-section-label`,children:`Referenced by`}),(0,Y.jsx)(Je,{references:O,onFollow:i})]})]})}function Qe(e){return(e?.rules??[]).flatMap(e=>e.feature?[{reader:e.readerName,feature:e.feature,status:e.status,source:e.source}]:[])}function $e({data:e}){let[t,n]=(0,W.useState)(!1);return(0,Y.jsxs)(`div`,{className:`graph-raw-toggle ${t?`graph-raw-toggle--open`:``}`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`graph-raw-toggle-button`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,Y.jsx)(C,{size:14,className:`graph-raw-toggle-chevron`}),t?`Hide raw JSON-LD`:`Show raw JSON-LD`]}),t&&(0,Y.jsx)(`div`,{className:`graph-raw-toggle-body`,children:(0,Y.jsx)(f,{data:e,label:`Raw JSON-LD`})})]})}var et=(0,W.lazy)(()=>i(()=>import(`./GraphCanvas-B1JM8f2x.js`).then(e=>({default:e.GraphCanvas})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])));function tt({saveLabel:e=`Save`,model:n,catalogTypes:i,catalogDetails:a,rawData:o,configData:c,onSave:l,siteLevelTypeSet:u,collection:d,slug:f}){let p=c!==void 0&&l!==void 0,[h,_]=qe(),[v,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(G),[S,C]=(0,W.useState)(!1),w=re(b),T=(0,W.useMemo)(()=>w?ce(n,b):n,[n,b,w]),E=(0,W.useMemo)(()=>{let e=new Set;for(let t of T.nodes){let n=s(t[`@type`]);n&&e.add(n)}return e},[T]),D=(0,W.useMemo)(()=>{let e=new Map;for(let[t,n]of a)e.set(t,new Set(n.properties.map(e=>e.property)));return e},[a]),O=(0,W.useMemo)(()=>{if(u)return u;let e=new Set;for(let t of i)t.siteLevel&&e.add(t.type);return e},[i,u]),k=(0,W.useMemo)(()=>m(T,O),[T,O]),A=(0,W.useMemo)(()=>{let e=[];return e.push(...k.siteContext),k.page&&e.push(k.page),k.primary&&e.push(k.primary),e.push(...k.linked),e},[k]),[j,M]=(0,W.useState)(null),[N,ee]=(0,W.useState)(null),P=(0,W.useRef)(null),F=(0,W.useRef)(null),[I,te]=(0,W.useState)(`site`);(0,W.useEffect)(()=>()=>{P.current!==null&&clearTimeout(P.current)},[]),(0,W.useEffect)(()=>{if(!w)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[w]);let L=(0,W.useMemo)(()=>c?g(T.nodes,c.entities):new Map,[T,c]),R=(0,W.useMemo)(()=>{if(j!==null){let e=T.byEk.get(j);if(e)return e}return k.primary??A[0]??null},[j,T,k.primary,A]),z=R?._ek??null,B=(0,W.useMemo)(()=>{if(!R)return!1;let e=s(R[`@type`]);return e!==null&&O.has(e)},[R,O]),V=(0,W.useCallback)(e=>{let t=e._ek;typeof t==`string`&&M(t)},[]),H=(0,W.useCallback)(e=>{let t=T.byId.get(e);if(!t)return;let n=t._ek;typeof n==`string`&&M(n),ee(e),F.current&&F.current.querySelector(`[data-entity-id="${nt(e)}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}),P.current!==null&&clearTimeout(P.current),P.current=setTimeout(()=>ee(null),1200)},[T]),U=(0,W.useCallback)(e=>{if(A.length===0)return;let t=A.findIndex(e=>e._ek===z);if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault();let n=A[Math.min(t+1,A.length-1)];n&&V(n)}else if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault();let n=A[Math.max(t-1,0)];n&&V(n)}},[A,z,V]),K=(0,W.useCallback)((e,t,n)=>{x(r=>ie(r,e,t,n))},[]),q=(0,W.useCallback)((e,t)=>{x(n=>ae(n,e,t))},[]),ue=(0,W.useCallback)(e=>{x(t=>se(t,e))},[]),J=(0,W.useCallback)(e=>{x(t=>oe(t,{"@type":e,properties:{}}))},[]),fe=(0,W.useCallback)(()=>{x(G())},[]),X=(0,W.useCallback)(async()=>{if(l&&c&&w){C(!0);try{await l(le(b,c,L)),x(G())}finally{C(!1)}}},[l,c,b,w,L]);(0,W.useEffect)(()=>{if(!p)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),w&&!S&&X())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p,w,S,X]);let Z=(0,W.useCallback)((e,t,n)=>{let r=e._ek??`node-${n}`,o=s(e[`@type`]),c=o===null?null:a.get(o)??null;return(0,Y.jsx)(Oe,{node:e,catalogTypes:i,catalogDetail:c,selected:z===r,focused:N===e[`@id`],onSelect:V,onFollowReference:H,initiallyExpanded:t},r)},[a,i,N,H,V,z]);if(T.nodes.length===0&&!p)return(0,Y.jsxs)(`div`,{className:`graph-browser graph-browser--empty`,children:[(0,Y.jsx)(`p`,{className:`graph-browser-empty-message`,children:`This document has no composed JSON-LD graph yet. Configure a Schema.org archetype for the collection or document to see structured data here.`}),(0,Y.jsx)($e,{data:o})]});let Q=(0,Y.jsx)(Ze,{node:R,model:T,catalogTypes:i,catalogDetails:a,onFollowReference:H,onPropertyChange:p?K:void 0,onPropertyRemove:p?q:void 0,onDeleteEntity:p?ue:void 0,isSiteLevel:B,propagationScope:B?I:void 0,onPropagationChange:B?te:void 0});return(0,Y.jsxs)(`div`,{className:`graph-browser`,ref:F,role:`tree`,"aria-label":`JSON-LD graph browser`,tabIndex:0,onKeyDown:U,children:[(0,Y.jsxs)(`div`,{className:`graph-browser-header`,children:[(0,Y.jsx)(je,{model:T,layout:k,catalogTypes:i,catalogDetails:a}),(0,Y.jsxs)(`div`,{className:`graph-browser-header-actions`,children:[p&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn graph-header-btn--discard`,onClick:fe,disabled:!w||S,children:[(0,Y.jsx)(ne,{size:14}),` Discard`]}),(0,Y.jsx)(Ke,{value:h,onChange:_}),p&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn`,onClick:()=>y(!0),children:[(0,Y.jsx)(r,{size:14}),` Import`]}),(0,Y.jsx)(ke,{data:o,collection:d,slug:f}),p&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn graph-header-btn--save`,onClick:()=>void X(),disabled:!w||S,children:[(0,Y.jsx)(t,{size:14}),` `,S?`${e}…`:e]})]})]}),(0,Y.jsx)(`div`,{className:`graph-browser-body`,children:h===`tree`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`graph-browser-tree`,children:[k.siteContext.length>0&&(0,Y.jsxs)(Ae,{label:`Site Context`,variant:`site`,children:[k.siteContext.map((e,t)=>Z(e,!1,t)),p&&(0,Y.jsx)(de,{catalogTypes:i.filter(e=>e.siteLevel),onAdd:J})]}),k.page&&(0,Y.jsx)(Ae,{label:`Page`,variant:`page`,children:Z(k.page,!1,0)}),(k.primary||p)&&(0,Y.jsxs)(Ae,{label:`Primary Entity`,variant:`primary`,children:[k.primary&&Z(k.primary,!0,0),k.linked.map((e,t)=>Z(e,!1,t+1)),p&&(0,Y.jsx)(de,{catalogTypes:i.filter(e=>e.documentLevel),onAdd:J})]})]}),Q]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`graph-canvas-loading`,children:`Loading canvas…`}),children:(0,Y.jsx)(et,{model:T,catalogTypes:i,catalogDetails:a,selectedEk:z,onSelect:V})}),Q]})}),(0,Y.jsx)($e,{data:o}),v&&(0,Y.jsx)(We,{currentModel:T,currentEntityTypes:E,catalogPropertySets:D,baseUrl:typeof window<`u`?window.location.origin:``,buffer:b,onApply:e=>x(e),onClose:()=>y(!1)})]})}function nt(e){return typeof globalThis.CSS?.escape==`function`?globalThis.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,`\\$&`)}export{tt as GraphBrowser,X as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphCanvas-Cct1E2As.js","assets/rolldown-runtime-COiEfhsA.js","assets/vendor-react-CXaWJ_ii.js","assets/vendor-diff-DGCTJYJ4.js","assets/vendor-react-DLioOiRN.css","assets/vendor-reactflow-CMKi7AEX.js","assets/graph-config-DKVGDPTG.js","assets/createLucideIcon-BklFHeMd.js","assets/createLucideIcon-DO6kYgVn.css","assets/use-loaded-BBFak2E1.js","assets/index-CEQ7ZdKC.js","assets/vendor-router-B4czwg8X.js","assets/auth-CIpilSKF.js","assets/format-C3ZX9yGM.js","assets/api-client-BRi_ki2Y.js","assets/index-Buq8auz3.css","assets/copy-V85khWct.js","assets/corner-down-right-BpwOGRFR.js","assets/findability-BrhtZ2yD.js","assets/layers-0VWe0rKm.js","assets/guards-BFEDbduR.js","assets/graph-config-mZyX0Lqo.css","assets/GraphCanvas-C_Wsk21g.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{t}from"./save-ClSXW9cb.js";import{t as n}from"./createLucideIcon-BklFHeMd.js";import{t as r}from"./upload-CaqQJaUr.js";import{a as i,o as a,s as o}from"./vendor-diff-DGCTJYJ4.js";import{C as s,S as c,T as l,_ as u,b as d,d as f,f as p,g as m,h,m as g,p as _,v,x as y,y as b}from"./graph-config-DKVGDPTG.js";import{$ as x,ft as S,mt as C,ot as w,st as T,tt as E}from"./index-CEQ7ZdKC.js";import{n as D}from"./catalog-offer-CeRRk2Zo.js";import{t as O}from"./circle-check-big-DQjpuxcC.js";import{t as k}from"./circle-x-peGpq98w.js";import{t as A}from"./trash-DzRCm500.js";import{a as j,i as M,n as N,r as ee,t as P}from"./export-helpers-C_HVpJN9.js";import{t as F}from"./triangle-exclamation-point-ttN5lZI0.js";import{n as I}from"./use-loaded-BBFak2E1.js";import{t as te}from"./external-link-Dh7p8Ii6.js";var L={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};L.node;var R=n(L),z={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};z.node;var B=n(z),V={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};V.node;var H=n(V),U={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};U.node;var ne=n(U),W=e(o(),1);function G(){return{overrides:new Map,removed:new Map,added:new Map,deleted:new Set}}function re(e){return e.overrides.size>0||e.removed.size>0||e.added.size>0||e.deleted.size>0}function ie(e,t,n,r){let i=e.overrides.get(t)??{},a=new Map(e.overrides);a.set(t,{...i,[n]:r});let o=e.removed.get(t);if(o?.has(n)){let r=new Map(e.removed),i=new Set(o);return i.delete(n),i.size===0?r.delete(t):r.set(t,i),{...e,overrides:a,removed:r}}return{...e,overrides:a}}function ae(e,t,n){let r=e.removed.get(t),i=new Map(e.removed);i.set(t,new Set([...r??[],n]));let a=e.overrides.get(t);if(a&&n in a){let r=new Map(e.overrides),{[n]:o,...s}=a;return Object.keys(s).length===0?r.delete(t):r.set(t,s),{...e,overrides:r,removed:i}}return{...e,removed:i}}function oe(e,t){let n=ue(t),r=new Map(e.added);if(r.set(n,t),e.deleted.has(n)){let t=new Set(e.deleted);return t.delete(n),{...e,added:r,deleted:t}}return{...e,added:r}}function se(e,t){if(e.added.has(t)){let n=new Map(e.added);return n.delete(t),{...e,added:n}}let n=new Set(e.deleted);n.add(t);let r=new Map(e.overrides);r.delete(t);let i=new Map(e.removed);return i.delete(t),{...e,overrides:r,removed:i,deleted:n}}function ce(e,t){if(!re(t))return e;let n=[];for(let r of e.nodes){let e=J(r);if(t.deleted.has(e))continue;let i=t.overrides.get(e),a=t.removed.get(e);if(!i&&!a){n.push(r);continue}let o={};for(let[e,t]of Object.entries(r))a?.has(e)||(o[e]=t);if(i){let e=i[`@type`];typeof e==`string`&&(o[`@type`]=e);for(let[e,t]of Object.entries(i))e!==`@type`&&(o[e]=t)}n.push(o)}let r=0;for(let e of t.added.values()){let t={"@type":e[`@type`],...e.properties,_ek:`added:${r++}`};e[`@id`]&&(t[`@id`]=e[`@id`]),n.push(t)}let i=_(n),a=new Map;for(let e of n){let t=e[`@id`];typeof t==`string`&&a.set(t,e)}return{nodes:n,byEk:i,byId:a,referencedBy:h(n),primary:e.primary?a.get(e.primary[`@id`]??``)??null:null}}function le(e,t,n){let r=new Map;for(let[e,t]of n)r.set(t,e);let i=[];for(let n=0;n<t.entities.length;n++){let a=t.entities[n],o=r.get(n);if(o&&e.deleted.has(o))continue;let s=o?e.overrides.get(o):void 0,c=o?e.removed.get(o):void 0;if(!s&&!c){i.push({...a,properties:K(a.properties)});continue}let l={};for(let[e,t]of Object.entries(a.properties))c?.has(e)||(l[e]=t);if(s)for(let[e,t]of Object.entries(s))e!==`@type`&&(l[e]=t);let u=s?.[`@type`];i.push({"@type":typeof u==`string`?u:a[`@type`],...a[`@id`]?{"@id":a[`@id`]}:{},...a.role?{role:a.role}:{},properties:K(l)})}for(let t of e.added.values())i.push({...t,properties:K(t.properties)});return{...t,entities:i}}function K(e){let t={};for(let[n,r]of Object.entries(e))t[n]=q(r);return t}function q(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(q);let t=e;if(`@type`in t){let e={};for(let[n,r]of Object.entries(t))n!==`@id`&&(e[n]=q(r));return e}return e}function ue(e){return e[`@id`]?e[`@id`]:e.role?`${e[`@type`]}:${e.role}`:e[`@type`]}function J(e){let t=e._ek;if(typeof t==`string`)return t;let n=typeof e[`@type`]==`string`?e[`@type`]:Array.isArray(e[`@type`])?e[`@type`][0]:null;return typeof n==`string`?n:`unknown`}var Y=a();function de({catalogTypes:e,onAdd:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(``),o=(0,W.useCallback)(e=>{e?.focus()},[]);if(!n)return(0,Y.jsxs)(`button`,{type:`button`,className:`graph-add-entity-btn`,onClick:()=>r(!0),children:[(0,Y.jsx)(w,{size:14}),` Add entity`]});let s=fe(e,i);return(0,Y.jsxs)(`div`,{className:`graph-add-entity-picker`,children:[(0,Y.jsxs)(`div`,{className:`graph-add-entity-header`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text graph-add-entity-search`,value:i,onChange:e=>a(e.target.value),placeholder:`Search types…`,ref:o}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-add-entity-close`,onClick:()=>{r(!1),a(``)},"aria-label":`Close picker`,children:(0,Y.jsx)(E,{size:16})})]}),(0,Y.jsxs)(`div`,{className:`graph-add-entity-list`,children:[s.length===0&&(0,Y.jsx)(`p`,{className:`graph-add-entity-empty`,children:`No matching types.`}),s.map(e=>(0,Y.jsxs)(`div`,{className:`graph-add-entity-group`,children:[(0,Y.jsx)(`div`,{className:`graph-add-entity-category`,children:e.label}),e.types.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`graph-add-entity-type`,onClick:()=>{t(e.type),r(!1),a(``)},children:[(0,Y.jsx)(`span`,{className:`graph-add-entity-type-name`,children:e.type}),(0,Y.jsx)(`span`,{className:`graph-add-entity-type-desc`,children:e.label}),e.richResult&&(0,Y.jsx)(`span`,{className:`graph-add-entity-rich-badge`,children:`Rich result`}),e.lifecycle?.status===`pending`&&(0,Y.jsx)(`span`,{className:`graph-add-entity-rich-badge`,children:`pending`})]},e.type))]},e.category))]})]})}function fe(e,t){let n=e.filter(e=>D(e,!1)),r=t?n.filter(e=>e.type.toLowerCase().includes(t.toLowerCase())||e.label.toLowerCase().includes(t.toLowerCase())):n,i=new Map;for(let e of[`business`,`content`,`commerce`,`people`,`navigation`,`reviews`])i.set(e,{category:e,label:p[e],types:[]});for(let e of r){let t=e.category,n=i.get(t);n&&n.types.push(e)}return[...i.values()].filter(e=>e.types.length>0)}function X({category:e}){return e===null?null:(0,Y.jsx)(`span`,{className:`graph-category-badge graph-category-${e}`,children:p[e]})}function Z({node:e,category:t,classifications:n,selected:r,focused:i,onSelect:a,onToggleExpanded:o,expanded:c}){let l=s(e[`@type`])??`Unknown`,u=e[`@id`],d=Q(e),{requiredSet:f,requiredTotal:p}=v(n);return(0,Y.jsxs)(`div`,{className:[`graph-entity-header`,r?`graph-entity-header--selected`:``,i?`graph-focused`:``].filter(Boolean).join(` `),children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-entity-expand-button`,onClick:e=>{e.stopPropagation(),o()},"aria-expanded":c,"aria-label":c?`Collapse entity`:`Expand entity`,children:(0,Y.jsx)(`span`,{className:`graph-entity-chevron ${c?`graph-entity-chevron--open`:``}`,children:`▸`})}),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-entity-header-main`,onClick:a,children:[(0,Y.jsxs)(`div`,{className:`graph-entity-header-row`,children:[(0,Y.jsx)(`span`,{className:`graph-entity-type`,children:l}),d&&(0,Y.jsx)(`span`,{className:`graph-entity-name`,children:d}),(0,Y.jsx)(X,{category:t})]}),(0,Y.jsxs)(`div`,{className:`graph-entity-header-meta`,children:[u&&(0,Y.jsx)(`span`,{className:`graph-entity-id`,children:u}),p>0&&(0,Y.jsxs)(`span`,{className:`graph-entity-eligibility ${f===p?`graph-entity-eligibility--complete`:`graph-entity-eligibility--incomplete`}`,title:`${f} of ${p} required properties set`,children:[f,`/`,p,` required`]})]})]})]})}function Q(e){for(let t of[`name`,`headline`,`title`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function pe({value:e,onChange:t,label:n,placeholder:r}){let i=[...e],a=()=>{t([...i,``])},o=(e,n)=>{let r=[...i];r[e]=n,t(r)},s=e=>{t(i.filter((t,n)=>n!==e))};return(0,Y.jsxs)(`div`,{className:`graph-input graph-input--array`,role:`group`,"aria-label":n,children:[i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`graph-input-array-item`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text`,value:e,onChange:e=>o(t,e.target.value),placeholder:r}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-input-array-remove`,onClick:()=>s(t),"aria-label":`Remove item`,children:(0,Y.jsx)(E,{size:14})})]},t)),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-input-array-add`,onClick:a,children:[(0,Y.jsx)(w,{size:14}),` Add item`]})]})}function me({value:e,onChange:t,label:n}){return(0,Y.jsx)(`input`,{type:`date`,className:`graph-input graph-input--date`,value:e,onChange:e=>t(e.target.value),"aria-label":n})}function he({value:e,onChange:t,label:n,min:r,max:i}){return(0,Y.jsx)(`input`,{type:`number`,className:`graph-input graph-input--number`,value:e,onChange:e=>{let n=e.target.value;t(n===``?``:Number(n))},"aria-label":n,min:r,max:i})}function ge({value:e,onChange:t,label:n}){let r=(0,W.useId)(),i=(n,r,i)=>{t(e.map((e,t)=>t===n?{...e,[r]:i}:e))},a=n=>{t(e.filter((e,t)=>t!==n))},o=()=>{let n={},r=e[0];if(r)for(let[t,i]of Object.entries(r))t===`@type`?n[`@type`]=i:n[t]=typeof i==`number`?Math.max(...e.map(e=>Number(e[t])||0))+1:``;t([...e,n])},s=new Set;for(let t of e)for(let e of Object.keys(t))e!==`@type`&&s.add(e);let c=[...s];return(0,Y.jsxs)(`div`,{className:`graph-input graph-input--object-array`,role:`group`,"aria-label":n,children:[e.map((e,t)=>(0,Y.jsxs)(`div`,{className:`graph-object-array-item`,children:[(0,Y.jsxs)(`span`,{className:`graph-object-array-item-index`,children:[t+1,`.`]}),(0,Y.jsx)(`div`,{className:`graph-object-array-item-fields`,children:c.map(n=>{let a=e[n],o=`${r}-${t}-${n}`;return(0,Y.jsxs)(`div`,{className:`graph-object-array-field`,children:[(0,Y.jsx)(`label`,{htmlFor:o,className:`graph-object-array-field-label`,children:n}),typeof a==`string`||typeof a==`number`||a===void 0?(0,Y.jsx)(`input`,{id:o,type:`text`,className:`graph-input graph-input--text`,value:a===void 0?``:String(a),onChange:e=>{let r=typeof a==`number`&&Number(e.target.value)||e.target.value;i(t,n,r)},placeholder:n}):(0,Y.jsx)(`span`,{id:o,className:`graph-property-value-object`,children:JSON.stringify(a).slice(0,60)})]},n)})}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-object-array-item-remove`,onClick:()=>a(t),"aria-label":`Remove item ${t+1}`,children:(0,Y.jsx)(A,{size:12})})]},t)),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-input-array-add`,onClick:o,children:[(0,Y.jsx)(w,{size:14}),` Add item`]})]})}function _e({value:e,onChange:t,options:n,label:r}){return(0,Y.jsxs)(`select`,{className:`graph-input graph-input--select`,value:e,onChange:e=>t(e.target.value),"aria-label":r,children:[(0,Y.jsx)(`option`,{value:``,children:`Select…`}),n.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]})}function ve({value:e,onChange:t,placeholder:n,label:r}){return(0,Y.jsx)(`textarea`,{className:`graph-input graph-input--textarea`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r,rows:3})}function ye({value:e,onChange:t,placeholder:n,label:r}){return(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r})}function be({value:e,onChange:t,placeholder:n,label:r}){let[i,a]=(0,W.useState)(!1),o=e===``||xe(e);return(0,Y.jsx)(`input`,{type:`url`,className:`graph-input graph-input--url ${i&&!o?`graph-input--invalid`:``}`,value:e,onChange:e=>t(e.target.value),onBlur:()=>a(!0),placeholder:n??`https://`,"aria-label":r,"aria-invalid":i&&!o})}function xe(e){try{return new URL(e),!0}catch{return!1}}function Se({classification:e,onFollowReference:t,onValueChange:n,onRemove:r}){let{property:i,value:a,importance:o,state:s,isReference:u,referenceId:d,def:f}=e,p=f?.label??i,m=we(o,s),h=n!==void 0;return(0,Y.jsxs)(`div`,{className:`graph-property-row ${m}`,children:[(0,Y.jsxs)(`div`,{className:`graph-property-label-col`,children:[(0,Y.jsx)(Te,{importance:o,state:s}),(0,Y.jsx)(`span`,{className:`graph-property-label`,children:p})]}),(0,Y.jsx)(`div`,{className:`graph-property-value`,children:u&&d!==void 0?(0,Y.jsxs)(`button`,{type:`button`,className:`graph-reference-link`,onClick:()=>t?.(d),"aria-label":`Follow reference to ${d}`,children:[(0,Y.jsx)(l,{size:12}),(0,Y.jsx)(`span`,{className:`graph-reference-link-id`,children:c(d)})]}):h?(0,Y.jsxs)(`div`,{className:`graph-property-input-row`,children:[(0,Y.jsx)(Ce,{property:i,value:a,fieldType:f?.fieldType,hint:f?.hint,onChange:e=>n(i,e)}),r&&(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-remove`,onClick:()=>r(i),"aria-label":`Remove ${p}`,children:(0,Y.jsx)(E,{size:14})})]}):(0,Y.jsx)(Ee,{value:a})})]})}function Ce({property:e,value:t,fieldType:n,hint:r,onChange:i}){if(n!==`array`&&typeof t==`object`&&t){if(Array.isArray(t))return(0,Y.jsxs)(`span`,{className:`graph-property-value-array`,children:[`Array (`,t.length,` item`,t.length===1?``:`s`,`)`]});let e=t,n=typeof e[`@type`]==`string`?e[`@type`]:null;return(0,Y.jsx)(`span`,{className:`graph-property-value-object`,children:n?`{${n}}`:JSON.stringify(t).slice(0,80)})}let a=typeof t==`string`?t:t==null?``:String(t);switch(n){case`textarea`:return(0,Y.jsx)(ve,{value:a,onChange:i,label:e});case`url`:return(0,Y.jsx)(be,{value:a,onChange:i,label:e});case`date`:return(0,Y.jsx)(me,{value:a,onChange:i,label:e});case`number`:return(0,Y.jsx)(he,{value:typeof t==`number`?t:a,onChange:i,label:e});case`select`:{let t=r?r.split(`|`).map(e=>e.trim()).filter(Boolean):[];return(0,Y.jsx)(_e,{value:a,onChange:i,options:t,label:e})}case`array`:return Array.isArray(t)?t.some(e=>typeof e==`object`&&!!e)?(0,Y.jsx)(ge,{value:t,onChange:i,label:e}):(0,Y.jsx)(pe,{value:t.map(e=>typeof e==`string`?e:String(e)),onChange:i,label:e}):(0,Y.jsx)(ye,{value:``,onChange:i,label:e});case`email`:return(0,Y.jsx)(`input`,{type:`email`,className:`graph-input graph-input--email`,value:a,onChange:e=>i(e.target.value),"aria-label":e});case`tel`:return(0,Y.jsx)(`input`,{type:`tel`,className:`graph-input graph-input--tel`,value:a,onChange:e=>i(e.target.value),"aria-label":e});default:return(0,Y.jsx)(ye,{value:a,onChange:i,label:e})}}function we(e,t){return e===`required`&&t===`missing`?`graph-property-row--required-missing`:e===`recommended`&&t===`missing`?`graph-property-row--recommended-missing`:t===`set`&&e===`required`?`graph-property-row--required-set`:``}function Te({importance:e,state:t}){return e===`required`&&t===`missing`?(0,Y.jsx)(k,{size:14,className:`graph-property-badge graph-property-badge--required-missing`,"aria-label":`Missing required`}):e===`recommended`&&t===`missing`?(0,Y.jsx)(S,{size:14,className:`graph-property-badge graph-property-badge--recommended-missing`,"aria-label":`Missing recommended`}):t===`set`&&e===`required`?(0,Y.jsx)(O,{size:14,className:`graph-property-badge graph-property-badge--set`,"aria-label":`Set`}):(0,Y.jsx)(`span`,{className:`graph-property-badge graph-property-badge--placeholder`,"aria-hidden":!0})}function Ee({value:e}){if(e==null||e===``)return(0,Y.jsx)(`span`,{className:`graph-property-value-empty`,children:`—`});if(typeof e==`string`)return(0,Y.jsx)(`span`,{className:`graph-property-value-string`,children:De(e,120)});if(typeof e==`number`||typeof e==`boolean`)return(0,Y.jsx)(`span`,{className:`graph-property-value-primitive`,children:String(e)});if(Array.isArray(e))return(0,Y.jsxs)(`span`,{className:`graph-property-value-array`,children:[`Array (`,e.length,` item`,e.length===1?``:`s`,`)`]});if(typeof e==`object`){let t=e,n=typeof t[`@type`]==`string`?t[`@type`]:`object`;return(0,Y.jsx)(`span`,{className:`graph-property-value-object`,children:`{${n}}`})}return(0,Y.jsx)(`span`,{className:`graph-property-value-unknown`,children:String(e)})}function De(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Oe({node:e,catalogTypes:t,catalogDetail:n,selected:r,focused:i,onSelect:a,onFollowReference:o,initiallyExpanded:s=!1}){let[c,l]=(0,W.useState)(s),f=b(e,t),p=u(e,n),m=d(p),h=p.some(e=>e.importance===`required`&&e.state===`missing`);return(0,Y.jsxs)(`div`,{className:`graph-entity-card ${r?`graph-entity-card--selected`:``} ${h?`graph-entity-card--missing-required`:``}`,"data-entity-id":e[`@id`]??``,role:`treeitem`,tabIndex:r?0:-1,"aria-selected":r,"aria-expanded":c,children:[(0,Y.jsx)(Z,{node:e,category:f,classifications:p,selected:r,focused:i,onSelect:()=>a(e),onToggleExpanded:()=>l(e=>!e),expanded:c}),c&&(0,Y.jsx)(`div`,{className:`graph-entity-body`,children:m.length===0?(0,Y.jsx)(`p`,{className:`graph-entity-empty`,children:`No properties.`}):(0,Y.jsx)(`div`,{className:`graph-property-list`,children:m.map(e=>(0,Y.jsx)(Se,{classification:e,onFollowReference:o},e.property))})})]})}function ke({data:e,collection:t,slug:n}){let[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(null),c=(0,W.useRef)(null);return(0,W.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]),(0,W.useEffect)(()=>{if(!r)return;let e=e=>{s.current&&!s.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]),(0,Y.jsxs)(`div`,{className:`graph-export-dropdown`,ref:s,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`graph-export-btn`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-haspopup":`true`,children:[(0,Y.jsx)(j,{size:14}),` Export`]}),r&&(0,Y.jsxs)(`div`,{className:`graph-export-menu`,role:`menu`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-export-menu-item`,role:`menuitem`,onClick:()=>{let r=N(e),a=M(t,n);P(r,a,`application/ld+json`),i(!1)},children:`Download .jsonld`}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-export-menu-item`,role:`menuitem`,onClick:()=>{let t=ee(e);navigator.clipboard.writeText(t).then(()=>{o(`success`),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3)}).catch(()=>{o(`error`),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3)}),i(!1)},children:a===`success`?`Copied!`:a===`error`?`Copy failed`:`Copy as <script> tag`})]})]})}function Ae({label:e,variant:t,children:n}){return(0,Y.jsxs)(`section`,{className:`graph-section graph-section--${t}`,children:[(0,Y.jsx)(`h3`,{className:`graph-section-label`,children:e}),(0,Y.jsx)(`div`,{className:`graph-section-content`,children:n})]})}function je({model:e,layout:t,catalogTypes:n,catalogDetails:r}){let i=Me(e,n,r),a=`${t.siteContext.length} site, ${+!!t.page} page, ${+!!t.primary} primary, ${t.linked.length} linked`;return(0,Y.jsxs)(`header`,{className:`graph-summary`,children:[(0,Y.jsxs)(`div`,{className:`graph-summary-primary`,children:[(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.entityCount}),` entities`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.categories.size}),` categories`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.richResultCount}),` rich-result eligible`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric ${i.requiredTotal-i.requiredSet>0?`graph-summary-metric--warning`:``}`,children:[(0,Y.jsxs)(`strong`,{children:[i.requiredSet,`/`,i.requiredTotal]}),` `,`required set`,i.requiredTotal-i.requiredSet>0&&(0,Y.jsxs)(`span`,{className:`graph-summary-missing`,children:[`(`,i.requiredTotal-i.requiredSet,` missing)`]})]})]}),(0,Y.jsx)(`div`,{className:`graph-summary-secondary`,children:a})]})}function Me(e,t,n){let r=new Set,i=0,a=0,o=0,s=new Map;for(let e of t)s.set(e.type,e);for(let c of e.nodes){let e=b(c,t);e!==null&&r.add(e);let l=typeof c[`@type`]==`string`?c[`@type`]:null;if(l!==null){s.get(l)?.richResult&&(o+=1);let e=n.get(l)??null,t=u(c,e);for(let e of t)e.importance===`required`&&(a+=1,e.state===`set`&&(i+=1))}}return{entityCount:e.nodes.length,categories:r,richResultCount:o,requiredSet:i,requiredTotal:a}}function Ne(e,t,n,r){let i;try{i=JSON.parse(e)}catch(e){return ze(e instanceof Error?`Invalid JSON: ${e.message}`:`Invalid JSON`)}let a=y(i);if(a.nodes.length===0)return ze(`No entities found in the imported JSON-LD.`);let o=[],c=0;for(let e of a.nodes){let i=s(e[`@type`]);if(!i)continue;let a=typeof e.role==`string`?e.role:void 0,l=Re(t,i,a),u=!l,d=!n.has(i),f=r.get(i),p=[];for(let[t,n]of Object.entries(e)){if(t===`@type`||t===`@id`||t===`@context`||t===`role`)continue;let e=l?.[t],r=f?!f.has(t):!1;l&&t in l?Be(e,n)||p.push({entityType:i,entityRole:a,property:t,kind:`changed`,oldValue:e,newValue:n,unknownProperty:r}):p.push({entityType:i,entityRole:a,property:t,kind:`added`,oldValue:void 0,newValue:n,unknownProperty:r})}if(l)for(let[t,n]of Object.entries(l))t!==`@type`&&t!==`@id`&&t!==`@context`&&t!==`role`&&(t in e||p.push({entityType:i,entityRole:a,property:t,kind:`removed`,oldValue:n,newValue:void 0,unknownProperty:!1}));(p.length>0||u)&&(o.push({type:i,role:a,disabled:d,disabledReason:d?`${i} is not part of this document's archetype`:void 0,changes:p}),u&&(c+=1))}let l=o.reduce((e,t)=>e+t.changes.length,0);return{entities:o,totalPropertyChanges:l,totalEntityAdditions:c,requiresConfirmation:l>=10||o.length>=3,error:void 0,importedModel:a}}function Pe(e,t){if(e==null||typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>Pe(e,t));if(typeof e==`object`){let n=e,r={};for(let[e,i]of Object.entries(n))r[e]=e===`@id`&&typeof i==`string`?t.get(i)??i:Pe(i,t);return r}return e}function Fe(e,t,n){let r=new Map;for(let i of e.nodes){let e=i[`@id`];if(typeof e!=`string`)continue;let a=s(i[`@type`]);if(!a)continue;let o=Re(t,a,typeof i.role==`string`?i.role:void 0);o&&typeof o[`@id`]==`string`?r.set(e,o[`@id`]):r.set(e,`${n.replace(/\/+$/,``)}/#${a.toLowerCase()}`)}return r}function Ie(e,t,n){let r=e;for(let e of t){let t=Le(e),i=Pe(e.value,n);r=ie(r,t,e.property,i)}return r}function Le(e){return e.entityId?e.entityId:e.entityRole?`${e.entityType}:${e.entityRole}`:e.entityType}function Re(e,t,n){return e.nodes.find(e=>s(e[`@type`])===t?!n||e.role===n:!1)}function ze(e){return{entities:[],totalPropertyChanges:0,totalEntityAdditions:0,requiresConfirmation:!1,error:e,importedModel:void 0}}function Be(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!=`object`||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>Be(e,t[n]));let n=e,r=t,i=Object.keys(n),a=Object.keys(r);return i.length===a.length&&i.every(e=>Be(n[e],r[e]))}function Ve({entities:e,selectedProperties:t,onToggle:n}){return e.length===0?(0,Y.jsx)(`p`,{className:`import-diff-empty`,children:`No changes detected.`}):(0,Y.jsx)(`div`,{className:`import-diff-panel`,children:e.map(e=>(0,Y.jsxs)(`div`,{className:`import-diff-entity ${e.disabled?`import-diff-entity--disabled`:``}`,children:[(0,Y.jsxs)(`div`,{className:`import-diff-entity-header`,children:[(0,Y.jsx)(`span`,{className:`import-diff-entity-type`,children:e.type}),e.role&&(0,Y.jsx)(`span`,{className:`import-diff-entity-role`,children:e.role}),e.disabled&&(0,Y.jsx)(`span`,{className:`import-diff-entity-badge import-diff-entity-badge--disabled`,children:`Disabled`}),(0,Y.jsxs)(`span`,{className:`import-diff-entity-count`,children:[e.changes.length,` change`,e.changes.length===1?``:`s`]})]}),e.disabled&&e.disabledReason&&(0,Y.jsx)(`p`,{className:`import-diff-disabled-reason`,children:e.disabledReason}),(0,Y.jsx)(`div`,{className:`import-diff-changes`,children:e.changes.map(r=>{let i=He(e,r),a=t.has(i),o=!e.disabled&&r.kind!==`removed`;return(0,Y.jsxs)(`label`,{className:`import-diff-change import-diff-change--${r.kind}`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:a,disabled:!o,onChange:()=>n(i),className:`import-diff-checkbox`}),(0,Y.jsxs)(`div`,{className:`import-diff-change-content`,children:[(0,Y.jsxs)(`div`,{className:`import-diff-change-header`,children:[(0,Y.jsx)(Ue,{kind:r.kind}),(0,Y.jsx)(`span`,{className:`import-diff-property`,children:r.property}),r.unknownProperty&&(0,Y.jsxs)(`span`,{className:`import-diff-warning`,children:[(0,Y.jsx)(F,{size:12}),` Unknown property`]})]}),(0,Y.jsxs)(`div`,{className:`import-diff-change-values`,children:[r.kind===`changed`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`import-diff-old-value`,children:$(r.oldValue)}),(0,Y.jsx)(`span`,{className:`import-diff-arrow`,children:`→`}),(0,Y.jsx)(`span`,{className:`import-diff-new-value`,children:$(r.newValue)})]}),r.kind===`added`&&(0,Y.jsx)(`span`,{className:`import-diff-new-value`,children:$(r.newValue)}),r.kind===`removed`&&(0,Y.jsx)(`span`,{className:`import-diff-removed-value`,children:$(r.oldValue)})]})]})]},i)})})]},`${e.type}-${e.role??``}`))})}function He(e,t){return`${e.type}:${e.role??``}:${t.property}`}function Ue({kind:e}){switch(e){case`added`:return(0,Y.jsx)(w,{size:14,className:`import-diff-icon import-diff-icon--added`});case`changed`:return(0,Y.jsx)(I,{size:14,className:`import-diff-icon import-diff-icon--changed`});case`removed`:return(0,Y.jsx)(H,{size:14,className:`import-diff-icon import-diff-icon--removed`});default:return(0,Y.jsx)(I,{size:14})}}function $(e){if(e==null)return`—`;if(typeof e==`string`)return e.length>80?`${e.slice(0,77)}…`:e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`object`){let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}…`:t}return String(e)}function We({currentModel:e,currentEntityTypes:t,catalogPropertySets:n,baseUrl:i,buffer:a,onApply:o,onClose:s}){let[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(new Set),[m,h]=(0,W.useState)(!1),g=(0,W.useRef)(null),_=(0,W.useId)();x(g,!0),(0,W.useEffect)(()=>{let e=e=>{e.key===`Escape`&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s]);let v=(0,W.useCallback)(()=>{let r=Ne(c,e,t,n);if(d(r),!r.error){let e=new Set;for(let t of r.entities)if(!t.disabled)for(let n of t.changes)n.kind!==`removed`&&e.add(He(t,n));p(e)}},[c,e,t,n]),y=(0,W.useCallback)(e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),b=(0,W.useCallback)(()=>{if(!u?.importedModel)return;let t=[];for(let n of u.entities){if(n.disabled)continue;let r=e.nodes.find(e=>(typeof e[`@type`]==`string`?e[`@type`]:void 0)===n.type&&(!n.role||e.role===n.role)),i=typeof r?.[`@id`]==`string`?r[`@id`]:void 0;for(let e of n.changes){let r=He(n,e);f.has(r)&&e.kind!==`removed`&&t.push({entityType:e.entityType,entityRole:e.entityRole,entityId:i,property:e.property,value:e.newValue,kind:e.kind})}}t.length===0||o(Ie(a,t,Fe(u.importedModel,e,i))),s()},[u,f,e,i,a,o,s]),S=u!==null&&!u.error&&f.size>0&&(!u.requiresConfirmation||m);return(0,Y.jsxs)(`div`,{className:`import-modal-overlay`,children:[(0,Y.jsx)(`div`,{className:`import-modal-scrim`,"aria-hidden":`true`,onClick:s}),(0,Y.jsxs)(`div`,{ref:g,className:`import-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":_,tabIndex:-1,children:[(0,Y.jsxs)(`div`,{className:`import-modal-header`,children:[(0,Y.jsxs)(`h2`,{id:_,className:`import-modal-title`,children:[(0,Y.jsx)(r,{size:18}),` Import JSON-LD`]}),(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-close`,onClick:s,children:`×`})]}),(0,Y.jsx)(`div`,{className:`import-modal-body`,children:u?u.error?(0,Y.jsxs)(`div`,{className:`import-modal-error`,children:[(0,Y.jsx)(`p`,{children:u.error}),(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--secondary`,onClick:()=>d(null),children:`Edit JSON`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`import-modal-summary`,children:[u.totalPropertyChanges,` property change`,u.totalPropertyChanges===1?``:`s`,` across `,u.entities.length,` entit`,u.entities.length===1?`y`:`ies`,u.totalEntityAdditions>0&&` (${u.totalEntityAdditions} new entit${u.totalEntityAdditions===1?`y`:`ies`})`]}),(0,Y.jsx)(Ve,{entities:u.entities,selectedProperties:f,onToggle:y}),u.requiresConfirmation&&(0,Y.jsxs)(`label`,{className:`import-modal-confirm`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked)}),`I've reviewed these changes`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`import-modal-hint`,children:`Paste a JSON-LD blob to import entities and properties into this document. Changes will be reviewed before applying.`}),(0,Y.jsx)(`textarea`,{className:`import-modal-textarea`,value:c,onChange:e=>l(e.target.value),placeholder:`{"@context": "https://schema.org", "@graph": [...]}`,rows:12})]})}),(0,Y.jsxs)(`div`,{className:`import-modal-footer`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--secondary`,onClick:s,children:`Cancel`}),u?u.error?null:(0,Y.jsxs)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--primary`,onClick:b,disabled:!S,children:[`Apply `,f.size,` change`,f.size===1?``:`s`]}):(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--primary`,onClick:v,disabled:!c.trim(),children:`Parse`})]})]})]})}var Ge=`krantho:graphLayout`;function Ke({value:e,onChange:t}){let n=e===`tree`?`canvas`:`tree`,r=n===`canvas`?`Canvas`:`Tree`,i=n===`canvas`?T:B;return(0,Y.jsxs)(`button`,{type:`button`,className:`graph-layout-toggle-btn`,onClick:()=>t(n),title:`Switch to ${r} view`,children:[(0,Y.jsx)(i,{size:14}),` `,r]})}function qe(){let[e,t]=(0,W.useState)(()=>{try{return localStorage.getItem(Ge)===`canvas`?`canvas`:`tree`}catch{return`tree`}});return[e,e=>{t(e);try{localStorage.setItem(Ge,e)}catch{}}]}function Je({references:e,onFollow:t}){return e.length===0?(0,Y.jsx)(`p`,{className:`graph-references-empty`,children:`No inbound references.`}):(0,Y.jsx)(`ul`,{className:`graph-references-list`,children:e.map((e,n)=>{let r=e.source[`@id`],i=s(e.source[`@type`])??`Node`,a=`${r??`anon`}-${e.property}-${n}`;return(0,Y.jsx)(`li`,{className:`graph-references-item`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`graph-references-link`,onClick:()=>r&&t?.(r),disabled:r===void 0,children:[(0,Y.jsx)(R,{size:12}),(0,Y.jsx)(`span`,{className:`graph-references-source`,children:i}),(0,Y.jsxs)(`span`,{className:`graph-references-property`,children:[`.`,e.property]})]})},a)})})}function Ye({value:e,onChange:t}){let n=(0,W.useId)();return(0,Y.jsxs)(`div`,{className:`graph-scope-propagation`,children:[(0,Y.jsx)(`span`,{className:`graph-scope-propagation-label`,children:`Apply changes to:`}),(0,Y.jsxs)(`label`,{className:`graph-scope-propagation-option`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:n,value:`document`,checked:e===`document`,onChange:()=>t(`document`)}),`This document`]}),(0,Y.jsxs)(`label`,{className:`graph-scope-propagation-option`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:n,value:`site`,checked:e===`site`,onChange:()=>t(`site`)}),`All documents (site-level)`]})]})}function Xe({classifications:e,compact:t=!1}){let n=e.filter(e=>e.importance===`required`),r=e.filter(e=>e.importance===`recommended`),i=n.filter(e=>e.state===`set`).length,a=r.filter(e=>e.state===`set`).length;if(n.length===0&&r.length===0)return(0,Y.jsx)(`span`,{className:`graph-validation-meter graph-validation-meter--empty`});let o=i===n.length?`graph-validation-meter--eligible`:`graph-validation-meter--incomplete`;return t?(0,Y.jsx)(`span`,{className:`graph-validation-meter graph-validation-meter--compact ${o}`,children:n.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment`,children:[i,`/`,n.length]})}):(0,Y.jsxs)(`div`,{className:`graph-validation-meter ${o}`,children:[n.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment graph-validation-meter-segment--required`,children:[i,`/`,n.length,` required`]}),r.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment graph-validation-meter-segment--recommended`,children:[a,`/`,r.length,` recommended`]})]})}function Ze({node:e,model:t,catalogTypes:n,catalogDetails:r,onFollowReference:i,onPropertyChange:a,onPropertyRemove:o,onDeleteEntity:c,isSiteLevel:l,propagationScope:f,onPropagationChange:m}){let[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(!1),y=a!==void 0;if((0,W.useEffect)(()=>{g(!1),v(!1)},[e]),e===null)return(0,Y.jsx)(`aside`,{className:`graph-property-panel graph-property-panel--empty`,children:(0,Y.jsx)(`p`,{className:`graph-property-panel-hint`,children:`Select an entity to see its details.`})});let x=s(e[`@type`])??`Unknown`,S=b(e,n),C=r.get(x)??null,T=u(e,C),E=d(T),D=Qe(C),O=e[`@id`]?t.referencedBy.get(e[`@id`])??[]:[],k=new Set(Object.keys(e).filter(e=>e!==`@type`&&e!==`@id`&&e!==`@context`&&e!==`_ek`)),j=C?C.properties.filter(e=>!k.has(e.property)):[],M=J(e);return(0,Y.jsxs)(`aside`,{className:`graph-property-panel`,children:[(0,Y.jsxs)(`header`,{className:`graph-property-panel-header`,children:[(0,Y.jsxs)(`div`,{className:`graph-property-panel-title-row`,children:[(0,Y.jsx)(`h3`,{className:`graph-property-panel-title`,children:x}),(0,Y.jsx)(X,{category:S}),y&&c&&!_&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-panel-delete`,onClick:()=>v(!0),"aria-label":`Delete ${x} entity`,children:[(0,Y.jsx)(A,{size:12}),` Delete`]}),y&&c&&_&&(0,Y.jsxs)(`span`,{className:`graph-property-panel-delete-confirm`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-panel-delete graph-property-panel-delete--confirm`,onClick:()=>{c(M),v(!1)},children:`Confirm`}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-panel-delete-cancel`,onClick:()=>v(!1),children:`Cancel`})]})]}),S&&(0,Y.jsx)(`p`,{className:`graph-property-panel-category-label`,children:p[S]}),D.map(e=>(0,Y.jsxs)(`div`,{className:`graph-property-panel-rich-result`,children:[(0,Y.jsxs)(`span`,{className:`graph-property-panel-rich-result-label`,children:[e.reader,`:`]}),` `,(0,Y.jsx)(`strong`,{children:e.feature}),e.status!==`active`&&` (${e.status})`,(0,Y.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noopener noreferrer`,className:`graph-property-panel-docs-link`,children:[`Docs `,(0,Y.jsx)(te,{size:12})]})]},e.reader)),(0,Y.jsx)(Xe,{classifications:T}),y&&l&&f&&m&&(0,Y.jsx)(Ye,{value:f,onChange:m})]}),(0,Y.jsxs)(`section`,{className:`graph-property-panel-section`,children:[(0,Y.jsx)(`h4`,{className:`graph-property-panel-section-label`,children:`Properties`}),E.length===0?(0,Y.jsx)(`p`,{className:`graph-property-panel-empty`,children:`No catalog properties available.`}):(0,Y.jsx)(`div`,{className:`graph-property-list`,children:E.map(e=>(0,Y.jsx)(Se,{classification:e,onFollowReference:i,onValueChange:y?(e,t)=>a(M,e,t):void 0,onRemove:y&&o?e=>o(M,e):void 0},e.property))}),y&&j.length>0&&(0,Y.jsx)(`div`,{className:`graph-property-add`,children:h?(0,Y.jsxs)(`div`,{className:`graph-property-add-picker`,children:[j.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-add-option`,onClick:()=>{a(M,e.property,``),g(!1)},children:[(0,Y.jsx)(`span`,{className:`graph-property-add-option-name`,children:e.label}),(0,Y.jsx)(`span`,{className:`graph-property-add-option-importance graph-property-add-option-importance--${e.importance}`,children:e.importance})]},e.property)),(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-add-cancel`,onClick:()=>g(!1),children:`Cancel`})]}):(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-add-btn`,onClick:()=>g(!0),children:[(0,Y.jsx)(w,{size:14}),` Add property`]})})]}),(0,Y.jsxs)(`section`,{className:`graph-property-panel-section`,children:[(0,Y.jsx)(`h4`,{className:`graph-property-panel-section-label`,children:`Referenced by`}),(0,Y.jsx)(Je,{references:O,onFollow:i})]})]})}function Qe(e){return(e?.rules??[]).flatMap(e=>e.feature?[{reader:e.readerName,feature:e.feature,status:e.status,source:e.source}]:[])}function $e({data:e}){let[t,n]=(0,W.useState)(!1);return(0,Y.jsxs)(`div`,{className:`graph-raw-toggle ${t?`graph-raw-toggle--open`:``}`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`graph-raw-toggle-button`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,Y.jsx)(C,{size:14,className:`graph-raw-toggle-chevron`}),t?`Hide raw JSON-LD`:`Show raw JSON-LD`]}),t&&(0,Y.jsx)(`div`,{className:`graph-raw-toggle-body`,children:(0,Y.jsx)(f,{data:e,label:`Raw JSON-LD`})})]})}var et=(0,W.lazy)(()=>i(()=>import(`./GraphCanvas-Cct1E2As.js`).then(e=>({default:e.GraphCanvas})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])));function tt({saveLabel:e=`Save`,model:n,catalogTypes:i,catalogDetails:a,rawData:o,configData:c,onSave:l,siteLevelTypeSet:u,collection:d,slug:f}){let p=c!==void 0&&l!==void 0,[h,_]=qe(),[v,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(G),[S,C]=(0,W.useState)(!1),w=re(b),T=(0,W.useMemo)(()=>w?ce(n,b):n,[n,b,w]),E=(0,W.useMemo)(()=>{let e=new Set;for(let t of T.nodes){let n=s(t[`@type`]);n&&e.add(n)}return e},[T]),D=(0,W.useMemo)(()=>{let e=new Map;for(let[t,n]of a)e.set(t,new Set(n.properties.map(e=>e.property)));return e},[a]),O=(0,W.useMemo)(()=>{if(u)return u;let e=new Set;for(let t of i)t.siteLevel&&e.add(t.type);return e},[i,u]),k=(0,W.useMemo)(()=>m(T,O),[T,O]),A=(0,W.useMemo)(()=>{let e=[];return e.push(...k.siteContext),k.page&&e.push(k.page),k.primary&&e.push(k.primary),e.push(...k.linked),e},[k]),[j,M]=(0,W.useState)(null),[N,ee]=(0,W.useState)(null),P=(0,W.useRef)(null),F=(0,W.useRef)(null),[I,te]=(0,W.useState)(`site`);(0,W.useEffect)(()=>()=>{P.current!==null&&clearTimeout(P.current)},[]),(0,W.useEffect)(()=>{if(!w)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[w]);let L=(0,W.useMemo)(()=>c?g(T.nodes,c.entities):new Map,[T,c]),R=(0,W.useMemo)(()=>{if(j!==null){let e=T.byEk.get(j);if(e)return e}return k.primary??A[0]??null},[j,T,k.primary,A]),z=R?._ek??null,B=(0,W.useMemo)(()=>{if(!R)return!1;let e=s(R[`@type`]);return e!==null&&O.has(e)},[R,O]),V=(0,W.useCallback)(e=>{let t=e._ek;typeof t==`string`&&M(t)},[]),H=(0,W.useCallback)(e=>{let t=T.byId.get(e);if(!t)return;let n=t._ek;typeof n==`string`&&M(n),ee(e),F.current&&F.current.querySelector(`[data-entity-id="${nt(e)}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}),P.current!==null&&clearTimeout(P.current),P.current=setTimeout(()=>ee(null),1200)},[T]),U=(0,W.useCallback)(e=>{if(A.length===0)return;let t=A.findIndex(e=>e._ek===z);if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault();let n=A[Math.min(t+1,A.length-1)];n&&V(n)}else if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault();let n=A[Math.max(t-1,0)];n&&V(n)}},[A,z,V]),K=(0,W.useCallback)((e,t,n)=>{x(r=>ie(r,e,t,n))},[]),q=(0,W.useCallback)((e,t)=>{x(n=>ae(n,e,t))},[]),ue=(0,W.useCallback)(e=>{x(t=>se(t,e))},[]),J=(0,W.useCallback)(e=>{x(t=>oe(t,{"@type":e,properties:{}}))},[]),fe=(0,W.useCallback)(()=>{x(G())},[]),X=(0,W.useCallback)(async()=>{if(l&&c&&w){C(!0);try{await l(le(b,c,L)),x(G())}finally{C(!1)}}},[l,c,b,w,L]);(0,W.useEffect)(()=>{if(!p)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),w&&!S&&X())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p,w,S,X]);let Z=(0,W.useCallback)((e,t,n)=>{let r=e._ek??`node-${n}`,o=s(e[`@type`]),c=o===null?null:a.get(o)??null;return(0,Y.jsx)(Oe,{node:e,catalogTypes:i,catalogDetail:c,selected:z===r,focused:N===e[`@id`],onSelect:V,onFollowReference:H,initiallyExpanded:t},r)},[a,i,N,H,V,z]);if(T.nodes.length===0&&!p)return(0,Y.jsxs)(`div`,{className:`graph-browser graph-browser--empty`,children:[(0,Y.jsx)(`p`,{className:`graph-browser-empty-message`,children:`This document has no composed JSON-LD graph yet. Configure a Schema.org archetype for the collection or document to see structured data here.`}),(0,Y.jsx)($e,{data:o})]});let Q=(0,Y.jsx)(Ze,{node:R,model:T,catalogTypes:i,catalogDetails:a,onFollowReference:H,onPropertyChange:p?K:void 0,onPropertyRemove:p?q:void 0,onDeleteEntity:p?ue:void 0,isSiteLevel:B,propagationScope:B?I:void 0,onPropagationChange:B?te:void 0});return(0,Y.jsxs)(`div`,{className:`graph-browser`,ref:F,role:`tree`,"aria-label":`JSON-LD graph browser`,tabIndex:0,onKeyDown:U,children:[(0,Y.jsxs)(`div`,{className:`graph-browser-header`,children:[(0,Y.jsx)(je,{model:T,layout:k,catalogTypes:i,catalogDetails:a}),(0,Y.jsxs)(`div`,{className:`graph-browser-header-actions`,children:[p&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn graph-header-btn--discard`,onClick:fe,disabled:!w||S,children:[(0,Y.jsx)(ne,{size:14}),` Discard`]}),(0,Y.jsx)(Ke,{value:h,onChange:_}),p&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn`,onClick:()=>y(!0),children:[(0,Y.jsx)(r,{size:14}),` Import`]}),(0,Y.jsx)(ke,{data:o,collection:d,slug:f}),p&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn graph-header-btn--save`,onClick:()=>void X(),disabled:!w||S,children:[(0,Y.jsx)(t,{size:14}),` `,S?`${e}…`:e]})]})]}),(0,Y.jsx)(`div`,{className:`graph-browser-body`,children:h===`tree`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`graph-browser-tree`,children:[k.siteContext.length>0&&(0,Y.jsxs)(Ae,{label:`Site Context`,variant:`site`,children:[k.siteContext.map((e,t)=>Z(e,!1,t)),p&&(0,Y.jsx)(de,{catalogTypes:i.filter(e=>e.siteLevel),onAdd:J})]}),k.page&&(0,Y.jsx)(Ae,{label:`Page`,variant:`page`,children:Z(k.page,!1,0)}),(k.primary||p)&&(0,Y.jsxs)(Ae,{label:`Primary Entity`,variant:`primary`,children:[k.primary&&Z(k.primary,!0,0),k.linked.map((e,t)=>Z(e,!1,t+1)),p&&(0,Y.jsx)(de,{catalogTypes:i.filter(e=>e.documentLevel),onAdd:J})]})]}),Q]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`graph-canvas-loading`,children:`Loading canvas…`}),children:(0,Y.jsx)(et,{model:T,catalogTypes:i,catalogDetails:a,selectedEk:z,onSelect:V})}),Q]})}),(0,Y.jsx)($e,{data:o}),v&&(0,Y.jsx)(We,{currentModel:T,currentEntityTypes:E,catalogPropertySets:D,baseUrl:typeof window<`u`?window.location.origin:``,buffer:b,onApply:e=>x(e),onClose:()=>y(!1)})]})}function nt(e){return typeof globalThis.CSS?.escape==`function`?globalThis.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,`\\$&`)}export{tt as GraphBrowser,X as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,c as n,d as r,f as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./vendor-react-CXaWJ_ii.js";import{o as p,s as m}from"./vendor-diff-DGCTJYJ4.js";import{t as h}from"./vendor-reactflow-CMKi7AEX.js";import{C as g,S as _,_ as v,v as y,y as b}from"./graph-config-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,c as n,d as r,f as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./vendor-react-CXaWJ_ii.js";import{o as p,s as m}from"./vendor-diff-DGCTJYJ4.js";import{t as h}from"./vendor-reactflow-CMKi7AEX.js";import{C as g,S as _,_ as v,v as y,y as b}from"./graph-config-DKVGDPTG.js";import{t as x}from"./GraphBrowser-BBKTzzRV.js";var S=e(m(),1),C=e(h(),1),w=p();function T({data:e}){let t=e.type,n=e.id,r=e.category,i=e.requiredSet,a=e.requiredTotal,o=e.selected;return(0,w.jsxs)(`div`,{className:`canvas-entity-node ${o?`canvas-entity-node--selected`:``} ${r?`canvas-entity-node--${r}`:``}`,children:[(0,w.jsx)(l,{type:`target`,position:f.Top,className:`canvas-handle`}),(0,w.jsxs)(`div`,{className:`canvas-entity-node-header`,children:[(0,w.jsx)(`span`,{className:`canvas-entity-node-type`,children:t}),(0,w.jsx)(x,{category:r})]}),n&&!n.startsWith(`__synthetic:`)&&(0,w.jsx)(`div`,{className:`canvas-entity-node-id`,children:_(n)}),a>0&&(0,w.jsxs)(`div`,{className:`canvas-entity-node-meter ${i===a?`canvas-entity-node-meter--complete`:``}`,children:[i,`/`,a,` required`]}),(0,w.jsx)(l,{type:`source`,position:f.Bottom,className:`canvas-handle`})]})}var E=220,D=100,O={entity:T};function k(e){return(0,w.jsx)(t,{children:(0,w.jsx)(A,{...e})})}function A({model:e,catalogTypes:t,catalogDetails:l,selectedEk:f,onSelect:p}){let{initialNodes:m,initialEdges:h}=(0,S.useMemo)(()=>j(e,t,l,null),[e,t,l]),[g,_,v]=n(m),[y,b,x]=u(h),{setViewport:C}=o(),T=(0,S.useRef)(null);(0,S.useEffect)(()=>{_(m),b(h)},[m,h,_,b]),(0,S.useEffect)(()=>{_(e=>e.map(e=>({...e,data:{...e.data,selected:e.id===f}})))},[f,_]),(0,S.useEffect)(()=>{if(g.length===0)return;let e=setTimeout(()=>{let e=r(g);if(!T.current)return;let{width:t,height:n}=T.current.getBoundingClientRect(),a=i(e,t,n,.2,1,.15);C({x:a.x,y:30,zoom:a.zoom},{duration:0})},100);return()=>clearTimeout(e)},[g,C]);let E=(0,S.useCallback)((t,n)=>{let r=e.byEk.get(n.id);r&&p(r)},[e,p]),D=(0,S.useCallback)(()=>{let e=M(m,h);_(e)},[m,h,_]);return(0,w.jsx)(`div`,{className:`graph-canvas-container`,children:(0,w.jsx)(`div`,{ref:T,className:`graph-canvas-flow`,children:(0,w.jsxs)(c,{nodes:g,edges:y,onNodesChange:v,onEdgesChange:x,onNodeClick:E,nodeTypes:O,minZoom:.2,maxZoom:2,children:[(0,w.jsx)(d,{}),(0,w.jsx)(s,{position:`bottom-left`,showInteractive:!1,children:(0,w.jsx)(`button`,{type:`button`,className:`react-flow__controls-button graph-canvas-reset-btn`,onClick:D,title:`Reset layout`,children:`↻`})}),(0,w.jsx)(a,{position:`bottom-right`,pannable:!0,zoomable:!0})]})})})}function j(e,t,n,r){let i=[],a=[];for(let a=0;a<e.nodes.length;a++){let o=e.nodes[a],s=g(o[`@type`])??`Unknown`,c=o._ek,l=typeof c==`string`?c:`__synthetic:${s}:${a}`,u=b(o,t),d=n.get(s)??null,f=v(o,d),{requiredSet:p,requiredTotal:m}=y(f);i.push({id:l,type:`entity`,position:{x:0,y:0},data:{type:s,id:l,category:u,requiredSet:p,requiredTotal:m,selected:l===r}})}let o=new Map;for(let t of e.nodes){let e=t[`@id`],n=t._ek;typeof e==`string`&&typeof n==`string`&&o.set(e,n)}for(let t of e.nodes){let e=t._ek;if(typeof e==`string`)for(let[n,r]of Object.entries(t)){if(n===`@type`||n===`@id`||n===`@context`||n===`_ek`)continue;let t=N(r);if(t){let r=o.get(t);r&&a.push({id:`${e}-${n}-${r}`,source:e,target:r,label:n,animated:!1,style:{stroke:`var(--color-border)`}})}}}return{initialNodes:M(i,a),initialEdges:a}}function M(e,t){let n=new C.default.graphlib.Graph;n.setGraph({rankdir:`TB`,nodesep:80,ranksep:120}),n.setDefaultEdgeLabel(()=>({}));for(let t of e)n.setNode(t.id,{width:E,height:D});for(let e of t)n.setEdge(e.source,e.target);return C.default.layout(n),e.map(e=>{let t=n.node(e.id);return{...e,position:{x:(t?.x??0)-E/2,y:(t?.y??0)-D/2}}})}function N(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;return typeof t[`@id`]==`string`?t[`@id`]:null}export{k as GraphCanvas};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-BklFHeMd.js";import{a as t,i as n,n as r,r as i,t as a}from"./api-client-BRi_ki2Y.js";import{p as o}from"./index-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BklFHeMd.js";import{a as t,i as n,n as r,r as i,t as a}from"./api-client-BRi_ki2Y.js";import{p as o}from"./index-CEQ7ZdKC.js";var s={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};s.node;var c=e(s);async function l(e,t,r){return n(`/seo/preview/${e}/${t}${i(r)}`)}async function u(e,t,r){return n(`/seo/resolved/${e}/${t}${i(r)}`)}async function d(e,t,r){return n(`/seo/findings/${e}/${t}${i(r)}`)}async function f(){return n(`/seo/findings`)}async function p(){return n(`/seo/sitemap.json`)}async function m(){return t(`/seo/robots.txt`)}async function h(){let e=await fetch(`${r}/seo/llms.txt`);if(!e.ok)throw new a(`Request failed: ${e.status}`,e.status,{});let t=e.headers.get(`x-krantho-llms-origin`),n=t===`snapshot`||t===`generated`?t:null;return{text:await e.text(),origin:n}}function g(e){return typeof e?.robotsTxt==`string`&&e.robotsTxt.length>0}async function _(){return(await T(`site`).catch(e=>{if(o(e))return{config:null};throw e})).config?.config??null}async function v(e){return(await D(`site`,{...await _()??{entities:[]},robotsTxt:e})).config}async function y(){let e=await _();if(!e||!g(e))return!1;let{robotsTxt:t,...n}=e;return await D(`site`,n),!0}async function b(e){return n(`/seo/enrich`,{method:`POST`,body:JSON.stringify(e)})}async function x(e){let t=e?`?jobId=${e}`:``;return n(`/seo/enrich/status${t}`)}async function S(){return n(`/seo/catalog`)}async function C(e){return n(`/seo/catalog?type=${encodeURIComponent(e)}`)}function w(e){return e.includes(`/`)?`/seo/config?id=${encodeURIComponent(e)}`:`/seo/config/${e}`}async function T(e){return n(w(e))}async function E(){return(await n(`/seo/config`)).configs}async function D(e,t){return n(`/seo/config`,{method:`PUT`,body:JSON.stringify({config:t,id:e})})}async function O(e,t){return n(`/seo/collection/${encodeURIComponent(e)}/impact?archetype=${encodeURIComponent(t)}`)}export{D as _,m as a,E as c,u as d,f,v as g,y as h,h as i,d as l,g as m,O as n,S as o,p,x as r,T as s,C as t,l as u,b as v,c as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t}from"./findability-BrhtZ2yD.js";import{i as n,n as r,t as i}from"./createLucideIcon-BklFHeMd.js";import{o as a,s as o}from"./vendor-diff-DGCTJYJ4.js";import{f as s,r as c,t as l,u}from"./vendor-router-B4czwg8X.js";import{i as d}from"./auth-CIpilSKF.js";import{d as ee,o as te,t as f}from"./format-C3ZX9yGM.js";import{Dt as ne,J as p,L as m,N as h,P as re,a as ie,d as g,f as _,j as ae,n as v,ot as oe,pt as se,t as ce,tt as y,x as b}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t}from"./findability-BrhtZ2yD.js";import{i as n,n as r,t as i}from"./createLucideIcon-BklFHeMd.js";import{o as a,s as o}from"./vendor-diff-DGCTJYJ4.js";import{f as s,r as c,t as l,u}from"./vendor-router-B4czwg8X.js";import{i as d}from"./auth-CIpilSKF.js";import{d as ee,o as te,t as f}from"./format-C3ZX9yGM.js";import{Dt as ne,J as p,L as m,N as h,P as re,a as ie,d as g,f as _,j as ae,n as v,ot as oe,pt as se,t as ce,tt as y,x as b}from"./index-CEQ7ZdKC.js";import{n as x,t as S}from"./data-table-B1kqxrEw.js";import{t as C}from"./empty-state-CeUZocHx.js";import{a as w,t as T}from"./export-helpers-C_HVpJN9.js";import{t as E}from"./upload-CaqQJaUr.js";import{t as D}from"./guards-BFEDbduR.js";import{c as O,d as k,f as A,i as j,l as M,n as N,o as P,r as F,s as I,t as L}from"./site-model-C5bJvTbk.js";import{t as R}from"./trash-DzRCm500.js";import{i as z,n as B,o as V,t as H}from"./site-BYsfQB_3.js";import{t as U}from"./use-loaded-BBFak2E1.js";var W={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};W.node;var G=i(W),K=e(o(),1),q=a();function J(e){return e===1?`1 document`:`${e} documents`}function Y(e,t){return{done:e,failures:t.filter(e=>!e.changed).map(e=>({slug:e.slug,error:e.error??`Not changed`}))}}async function le(e,t,n,r){if(e===`publish`){let{published:e,results:i}=await re(t,[...n],r);return Y(e,i.map(e=>({slug:e.slug,changed:e.published,error:e.error})))}let{deleted:i,results:a}=await h(t,[...n],r);return Y(i,a.map(e=>({slug:e.slug,changed:e.deleted,error:e.error})))}var X={publish:{title:`Publish documents`,verb:`Publish`,busy:`Publishing…`,ask:`Publishing makes each saved version what visitors see.`},delete:{title:`Delete documents`,verb:`Delete`,busy:`Deleting…`,ask:`Each document leaves the site and Studio in this locale. This cannot be undone.`}};function ue({action:e,outcome:t}){return(0,q.jsxs)(`div`,{role:`status`,children:[(0,q.jsxs)(`p`,{children:[e===`publish`?`Published`:`Deleted`,` `,J(t.done),`.`]}),t.failures.length>0&&(0,q.jsx)(`ul`,{className:`site-outcome-failures`,children:t.failures.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`code`,{children:e.slug}),`: `,e.error]},e.slug))})]})}function de({props:e,phase:t}){if(t.name===`done`)return(0,q.jsx)(ue,{action:e.action,outcome:t.outcome});if(t.name===`failed`)return(0,q.jsx)(`p`,{role:`alert`,children:t.message});let n=X[e.action];return(0,q.jsxs)(`p`,{children:[n.verb,` `,J(e.slugs.length),` in `,(0,q.jsx)(`code`,{children:e.locale}),`? `,n.ask]})}function fe({props:e,phase:t,safeRef:n,onRun:i}){if(t.name===`done`||t.name===`failed`)return(0,q.jsx)(r,{ref:n,onClick:e.onClose,children:`Close`});let a=t.name===`working`,o=X[e.action].verb;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(r,{ref:n,onClick:a?void 0:e.onClose,"aria-disabled":a,children:`Cancel`}),(0,q.jsx)(r,{variant:e.action===`delete`?`danger`:`primary`,onClick:a?void 0:i,"aria-disabled":a,children:a?X[e.action].busy:`${o} ${J(e.slugs.length)}`})]})}function pe(e){let[t,n]=(0,K.useState)({name:`ask`}),r=(0,K.useRef)(null),i=t.name===`working`;(0,K.useEffect)(()=>{(t.name===`done`||t.name===`failed`)&&r.current?.focus()},[t.name]);async function a(){n({name:`working`});try{let t=await le(e.action,e.collection,e.slugs,e.locale);n({name:`done`,outcome:t})}catch(t){n({name:`failed`,message:_(t,`${X[e.action].verb} failed`)})}e.onDone()}return(0,q.jsx)(g,{title:X[e.action].title,onClose:i?()=>void 0:e.onClose,initialFocus:r,busy:i,actions:(0,q.jsx)(fe,{props:e,phase:t,safeRef:r,onRun:()=>void a()}),children:(0,q.jsx)(de,{props:e,phase:t})})}function me(e=3e3){let[t,n]=(0,K.useState)(null),r=(0,K.useRef)(null),i=(0,K.useCallback)(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]),a=(0,K.useCallback)(()=>{i(),n(null)},[i]),o=(0,K.useCallback)((t,a)=>{i(),n({text:t,kind:`success`});let o=a??e;o>0&&(r.current=setTimeout(()=>{n(null),r.current=null},o))},[i,e]),s=(0,K.useCallback)(e=>{i(),n({text:e,kind:`error`})},[i]);return(0,K.useEffect)(()=>()=>{i()},[i]),{message:t,showSuccess:o,showError:s,clear:a}}function Z(e){return typeof e==`string`&&e!==``?e:void 0}function he(e){if(!D(e)||!D(e.identity)||!D(e.fields)||!D(e.metadata)||!Array.isArray(e.defaults)||typeof e.body!=`string`)return null;let t=e.identity;return!Z(t.collection)||!Z(t.slug)||!Z(t.locale)?null:e}function ge(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:`This is not valid JSON.`}}let n=D(t)?t.items:void 0;if(!Array.isArray(n))return{ok:!1,error:`The JSON needs an "items" array.`};if(n.length===0)return{ok:!1,error:`The "items" array is empty.`};let r=[];for(let[e,t]of n.entries()){let n=he(t);if(!n)return{ok:!1,error:`Item ${e+1} is missing its document identity or portable content envelope.`};r.push(n)}return{ok:!0,items:r}}function _e(e,t){return`${e}-${t}.json`}function ve(e,t){let{message:n,showSuccess:r,showError:i}=me(4e3);async function a(){if(t)try{let n=await m(e,`json`,t);T(JSON.stringify(n,null,2),_e(e,t),`application/json`),r(`Exported ${n.count===1?`1 document`:`${n.count} documents`}`)}catch(e){i(_(e,`Export failed`))}}return{notice:n,run:a}}function ye({name:e,notice:t,onExport:i,onImport:a}){let{hasRole:o}=d();return(0,q.jsxs)(`div`,{className:`site-header-actions`,children:[(0,q.jsx)(`p`,{className:t?`site-notice site-notice--${t.kind}`:`site-notice`,role:`status`,children:t?.text}),(0,q.jsx)(r,{icon:w,onClick:i,children:`Export`}),o(`editor`)&&(0,q.jsx)(r,{icon:E,onClick:a,children:`Import`}),o(`editor`)&&(0,q.jsxs)(l,{to:ne(e),className:n(`primary`),children:[(0,q.jsx)(oe,{className:`ui-button-icon`,"aria-hidden":`true`}),`New `,te(e)]})]})}function be(e){let{name:t,data:n}=e,r=n?.collection?ie(n.collection):null;return(0,q.jsxs)(`header`,{className:`site-header site-header--row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`site-heading`,children:f(t)}),(0,q.jsxs)(`p`,{className:`site-lede`,children:[r?(0,q.jsx)(`code`,{children:r}):`No pages of its own`,n&&(0,q.jsxs)(q.Fragment,{children:[` `,`· in `,(0,q.jsx)(`code`,{children:n.locale})]})]})]}),n&&(0,q.jsx)(ye,{...e})]})}var xe={updated:`Last updated`,slug:`Slug`};function Se(e,t){return e===`all`?t.total:t[e]}function Ce({filter:e,counts:t,onFilter:n}){return(0,q.jsxs)(`fieldset`,{className:`site-filters`,children:[(0,q.jsx)(`legend`,{className:`visually-hidden`,children:`Status`}),N.map(r=>(0,q.jsxs)(`button`,{type:`button`,className:`site-filter`,"aria-pressed":e===r,onClick:()=>n(r),children:[r!==`all`&&(0,q.jsx)(b,{status:r,decorative:!0}),r===`all`?`All`:ae[r],(0,q.jsx)(`span`,{className:`site-filter-count`,children:Se(r,t)})]},r))]})}function Q({label:e,value:t,options:n,labelOf:r,onChange:i}){let a=(0,K.useId)();return(0,q.jsxs)(`span`,{className:`site-picker`,children:[(0,q.jsx)(`label`,{htmlFor:a,children:e}),(0,q.jsx)(`select`,{id:a,value:t,onChange:e=>{let t=n.find(t=>t===e.target.value);t!==void 0&&i(t)},children:n.map(e=>(0,q.jsx)(`option`,{value:e,children:r(e)},e))})]})}function we(e){return(0,q.jsxs)(`div`,{className:`site-toolbar`,children:[(0,q.jsx)(Ce,{filter:e.filter,counts:e.counts,onFilter:e.onFilter}),(0,q.jsxs)(`div`,{className:`site-toolbar-end`,children:[e.locales.length>1&&(0,q.jsx)(Q,{label:`Locale`,value:e.locale,options:e.locales,labelOf:e=>e,onChange:e.onLocale}),(0,q.jsx)(Q,{label:`Sort`,value:e.order,options:L,labelOf:e=>xe[e],onChange:e.onOrder}),(0,q.jsxs)(`p`,{className:`site-shown`,role:`status`,children:[(0,q.jsx)(`span`,{className:`site-shown-number`,children:I(e.shown,e.counts.total)}),` `,`shown`]})]})]})}var Te=`{
|
|
2
2
|
"items": [
|
|
3
3
|
{ "identity": { "collection": "pages", "slug": "my-page", "locale": "en" }, "contract": null, "fields": { "title": "My page" }, "metadata": {}, "defaults": [], "body": "## Section" }
|
|
4
4
|
]
|