@krantho/studio 1.0.0 → 1.0.1
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 +8 -0
- package/dist/assets/GraphBrowser-DIjsu_2L.js +2 -0
- package/dist/assets/GraphCanvas-B1JM8f2x.js +1 -0
- package/dist/assets/{action-button-Co7fp7HS.js → action-button-DIrhqMRc.js} +1 -1
- package/dist/assets/{api-seo-2H6_VoWE.js → api-seo-Cjv4a9Y_.js} +1 -1
- package/dist/assets/{arduino-CEYAtK6G.js → arduino-DKR9_xyJ.js} +1 -1
- package/dist/assets/{arrow-down-CsgZZR1B.js → arrow-down-B5kfR2lG.js} +1 -1
- package/dist/assets/{arrow-left-DKjipJjb.js → arrow-left-7opbl8fu.js} +1 -1
- package/dist/assets/{auth-GRfs02w7.js → auth-CIpilSKF.js} +1 -1
- package/dist/assets/{c-C8PoWFx3.js → c-CEM0h_nK.js} +1 -1
- package/dist/assets/{circle-check-big-zoQrH4Hp.js → circle-check-big-DQjpuxcC.js} +1 -1
- package/dist/assets/{circle-dashed-Cu2MEHnb.js → circle-dashed-cuYrILNo.js} +1 -1
- package/dist/assets/{circle-x-DMb3ZtiK.js → circle-x-peGpq98w.js} +1 -1
- package/dist/assets/{clike-jjKDqbJf.js → clike-BlGBRct5.js} +1 -1
- package/dist/assets/{clock-CzpAlvS3.js → clock-DoBIVjZO.js} +1 -1
- package/dist/assets/collection-view-CUWLWvwR.js +5 -0
- package/dist/assets/{copy-DloNx7rC.js → copy-V85khWct.js} +1 -1
- package/dist/assets/{corner-down-right-D2cWjQTP.js → corner-down-right-BpwOGRFR.js} +1 -1
- package/dist/assets/{cpp-BNrDeSFM.js → cpp-C0nea612.js} +1 -1
- package/dist/assets/createLucideIcon-BklFHeMd.js +1 -0
- package/dist/assets/{csharp-C2EQRp-I.js → csharp-C430X67Y.js} +1 -1
- package/dist/assets/{data-table-D8BsE1pn.js → data-table-B1kqxrEw.js} +1 -1
- package/dist/assets/editor-page-jSK3xMkh.js +27 -0
- package/dist/assets/{empty-state-CU7q3Ypl.js → empty-state-CeUZocHx.js} +1 -1
- package/dist/assets/{export-helpers-B2KV_EB5.js → export-helpers-C_HVpJN9.js} +1 -1
- package/dist/assets/{external-link-BRKJTCZG.js → external-link-Dh7p8Ii6.js} +1 -1
- package/dist/assets/{fill-job-D41ra-DR.js → fill-job-B-Z4jnVQ.js} +1 -1
- package/dist/assets/{fill-run-view-DFeyjdsI.js → fill-run-view-Bx-nSvtd.js} +1 -1
- package/dist/assets/{findability-CUYOthYI.js → findability-BrhtZ2yD.js} +1 -1
- package/dist/assets/{format-pPdsDgeS.js → format-C3ZX9yGM.js} +1 -1
- package/dist/assets/{go-BTdFQSkQ.js → go-2ldyX7zA.js} +1 -1
- package/dist/assets/graph-config-BJA_ztYM.js +1 -0
- package/dist/assets/image-editor-CEzh5OFw.js +1 -0
- package/dist/assets/index-qiIlvPyv.js +2 -0
- package/dist/assets/{info-B69U-gXd.js → info-Cxkabti5.js} +1 -1
- package/dist/assets/{java-OEPW09uX.js → java-BaDy4FT-.js} +1 -1
- package/dist/assets/{javascript-DWFokqmn.js → javascript-DoKZVVG7.js} +1 -1
- package/dist/assets/{kotlin-lSpEPTBz.js → kotlin-aNSUnDDr.js} +1 -1
- package/dist/assets/{layers-BQ89qo5R.js → layers-0VWe0rKm.js} +1 -1
- package/dist/assets/{list-checks-DmMdd-uP.js → list-checks-BCEhMMVY.js} +1 -1
- package/dist/assets/live-markdown-editor-BGbJGFKJ.js +54 -0
- package/dist/assets/{markdown-D0Y7CUbI.js → markdown-ChIsYjIt.js} +1 -1
- package/dist/assets/{markup-Bfi2BWVm.js → markup-C09yLKTH.js} +1 -1
- package/dist/assets/{markup-templating-BkH2dBCn.js → markup-templating-DNhq-UOv.js} +1 -1
- package/dist/assets/media-page-B3Q4EH3m.js +1 -0
- package/dist/assets/{meter-mJxPk3I3.js → meter-ZOLJ0WhG.js} +1 -1
- package/dist/assets/{objectivec-Cv_qlwGW.js → objectivec-s2I4Tn1D.js} +1 -1
- package/dist/assets/{pen-line-CZkcVGBd.js → pen-line-B524Nue8.js} +1 -1
- package/dist/assets/{pencil-BHnNXVY1.js → pencil-xdGZtrO4.js} +1 -1
- package/dist/assets/{php-MrfIyKXK.js → php-B_6N-5RT.js} +1 -1
- package/dist/assets/pulse-page-HsxpGgEu.js +1 -0
- package/dist/assets/rolldown-runtime-COiEfhsA.js +1 -0
- package/dist/assets/{rotate-ccw-CjpQmti_.js → rotate-ccw-BgARBEK3.js} +1 -1
- package/dist/assets/ruby-C8GJZDTg.js +1 -0
- package/dist/assets/{save-kXwhieDK.js → save-ClSXW9cb.js} +1 -1
- package/dist/assets/{send-ib_sr-OU.js → send-kYpW5JED.js} +1 -1
- package/dist/assets/setup-page-DsYYpFrd.js +1 -0
- package/dist/assets/{site-XpqFn80l.js → site-BfbIKOk1.js} +1 -1
- package/dist/assets/site-model-CoSgHHeY.js +1 -0
- package/dist/assets/site-overview-BJNMesQZ.js +1 -0
- package/dist/assets/structure-page-ZD8c7Ukz.js +2 -0
- package/dist/assets/{trash-Cknp3eZ5.js → trash-DzRCm500.js} +1 -1
- package/dist/assets/triangle-exclamation-point-ttN5lZI0.js +1 -0
- package/dist/assets/{typescript-Brau3Puh.js → typescript-s_P45ayF.js} +1 -1
- package/dist/assets/{upload-BvBYjswd.js → upload-CaqQJaUr.js} +1 -1
- package/dist/assets/{use-drawer-actions-DChrztN2.js → use-drawer-actions-D-rIBvJ8.js} +1 -1
- package/dist/assets/{use-loaded-C3hBdQe0.js → use-loaded-DFUDFVFt.js} +1 -1
- package/dist/assets/{use-locale-versions-Bp4V9fN-.js → use-locale-versions-DHt-x8c_.js} +1 -1
- package/dist/assets/{vendor-diff-Dm2YfgXt.js → vendor-diff-DGCTJYJ4.js} +14 -14
- package/dist/assets/vendor-markdown-pd8vs9n-.js +74 -0
- package/dist/assets/{vendor-media-yY6fAUvp.js → vendor-media-DXSmPN_d.js} +1 -1
- package/dist/assets/vendor-react-CXaWJ_ii.js +15 -0
- package/dist/assets/{vendor-reactflow-5Qvgw90M.js → vendor-reactflow-CMKi7AEX.js} +1 -1
- package/dist/assets/vendor-router-B4czwg8X.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +18 -18
- package/dist/assets/AssistantPanel-CzFfUizn.js +0 -8
- package/dist/assets/GraphBrowser-DvcHXw-i.js +0 -2
- package/dist/assets/GraphCanvas-Bq75rYgC.js +0 -1
- package/dist/assets/collection-view-BlqX2SDN.js +0 -5
- package/dist/assets/createLucideIcon-D_HN41p3.js +0 -1
- package/dist/assets/editor-page-C8G81B5n.js +0 -27
- package/dist/assets/graph-config-ZUe9BjGK.js +0 -1
- package/dist/assets/image-editor-Bmjrioxz.js +0 -1
- package/dist/assets/index-DVe5jFLX.js +0 -2
- package/dist/assets/live-markdown-editor-CTvxOTrh.js +0 -53
- package/dist/assets/media-page-DYRRse48.js +0 -1
- package/dist/assets/pulse-page-B44AnguJ.js +0 -1
- package/dist/assets/rolldown-runtime-Dd_uD5pT.js +0 -1
- package/dist/assets/ruby-DGkU311C.js +0 -1
- package/dist/assets/setup-page-x51U8px6.js +0 -1
- package/dist/assets/site-model-DX8WxTJg.js +0 -1
- package/dist/assets/site-overview--k6hNYk0.js +0 -1
- package/dist/assets/structure-page-BW1y8L1n.js +0 -2
- package/dist/assets/triangle-alert-C4yqbtOC.js +0 -1
- package/dist/assets/vendor-markdown-DlwjVoJi.js +0 -66
- package/dist/assets/vendor-react-DMqGe90A.js +0 -15
- package/dist/assets/vendor-router-DjV3D6zM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./markup-
|
|
1
|
+
import{t as e}from"./markup-C09yLKTH.js";t.displayName=`markdown`,t.aliases=[`md`];function t(t){t.register(e),(function(e){function t(e){return e=e.replace(/<inner>/g,function(){return`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var n="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",r=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return n}),i=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`;e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+r+i+`(?:`+r+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+r+i+`)(?:`+r+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+r+`)`+i+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+r+`$`),inside:{"table-header":{pattern:RegExp(n),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:t(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:t(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){if(e.language!==`markdown`&&e.language!==`md`)return;function t(e){if(e&&typeof e!=`string`)for(var n=0,r=e.length;n<r;n++){var i=e[n];if(i.type!==`code`)t(i.content);else{var a=i.content[1],o=i.content[3];if(a&&o&&a.type===`code-language`&&o.type===`code-block`&&typeof a.content==`string`){var s=a.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`);s=(/[a-z][\w-]*/i.exec(s)||[``])[0].toLowerCase();var c=`language-`+s;o.alias?typeof o.alias==`string`?o.alias=[o.alias,c]:o.alias.push(c):o.alias=[c]}}}}t(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],o=/language-(.+)/.exec(a);if(o){n=o[1];break}}var s=e.languages[n];if(s)t.content=e.highlight(t.content.value,s,n);else if(n&&n!==`none`&&e.plugins.autoloader){var c=`md-`+new Date().valueOf()+`-`+Math.floor(Math.random()*0x2386f26fc10000);t.attributes.id=c,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(c);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))})}}}),RegExp(e.languages.markup.tag.pattern.source,`gi`),String.fromCodePoint||String.fromCharCode,e.languages.md=e.languages.markdown})(t)}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-COiEfhsA.js";var t=e({default:()=>n});n.displayName=`markup`,n.aliases=[`atom`,`html`,`mathml`,`rss`,`ssml`,`svg`,`xml`];function n(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside[`attr-value`].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside[`internal-subset`].inside=e.languages.markup,e.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.value.replace(/&/,`&`))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,n){var r={};r[`language-`+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[n]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var a={};a[t]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return t}),`i`),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+t+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,`language-`+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend(`markup`,{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}export{t as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./markup-
|
|
1
|
+
import{t as e}from"./markup-C09yLKTH.js";t.displayName=`markup-templating`,t.aliases=[];function t(t){t.register(e),(function(e){function t(e,t){return`___`+e.toUpperCase()+t+`___`}Object.defineProperties(e.languages[`markup-templating`]={},{buildPlaceholders:{value:function(n,r,i,a){if(n.language===r){var o=n.tokenStack=[];n.code=n.code.replace(i,function(e){if(typeof a==`function`&&!a(e))return e;for(var i=o.length,s;n.code.indexOf(s=t(r,i))!==-1;)++i;return o[i]=e,s}),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language!==r||!n.tokenStack)return;n.grammar=e.languages[r];var i=0,a=Object.keys(n.tokenStack);function o(s){for(var c=0;c<s.length&&!(i>=a.length);c++){var l=s[c];if(typeof l==`string`||l.content&&typeof l.content==`string`){var u=a[i],d=n.tokenStack[u],f=typeof l==`string`?l:l.content,p=t(r,u),m=f.indexOf(p);if(m>-1){++i;var h=f.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),`language-`+r,d),_=f.substring(m+p.length),v=[];h&&v.push.apply(v,o([h])),v.push(g),_&&v.push.apply(v,o([_])),typeof l==`string`?s.splice.apply(s,[c,1].concat(v)):l.content=v}}else l.content&&o(l.content)}return s}o(n.tokens)}}})})(t)}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{c as t,d as n,i as r,l as i,n as a,o,p as s,r as c,s as l,t as u,u as d}from"./use-drawer-actions-D-rIBvJ8.js";import{o as ee,s as f}from"./vendor-diff-DGCTJYJ4.js";import{A as te,C as ne,D as re,E as ie,M as ae,N as p,O as oe,P as se,S as ce,_ as le,a as ue,b as m,c as h,d as g,f as de,g as fe,h as _,i as pe,j as me,l as he,m as v,n as y,o as b,p as x,r as S,t as ge,u as C,v as _e,w as ve,x as ye,y as w}from"./media-model-D4F1Farw.js";import{i as be}from"./auth-CIpilSKF.js";import{d as xe,i as T,n as Se,u as Ce}from"./format-C3ZX9yGM.js";import{Et as we,Tt as Te,d as E,et as D,f as O,it as Ee,mt as De,tt as k}from"./index-qiIlvPyv.js";import{t as Oe}from"./empty-state-CeUZocHx.js";import{i as A,n as j,r as ke,t as M}from"./createLucideIcon-BklFHeMd.js";import{t as N}from"./vendor-router-B4czwg8X.js";import{t as Ae}from"./copy-V85khWct.js";import{t as je}from"./external-link-Dh7p8Ii6.js";import{t as P}from"./trash-DzRCm500.js";import{t as F}from"./action-button-DIrhqMRc.js";import{n as Me}from"./guards-BFEDbduR.js";import{t as I}from"./save-ClSXW9cb.js";import{t as Ne}from"./layers-0VWe0rKm.js";import{t as Pe}from"./pencil-xdGZtrO4.js";import{t as Fe}from"./list-checks-BCEhMMVY.js";var L={name:`check-check`,size:24,node:[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]};L.node;var Ie=M(L),R={name:`copy-plus`,size:24,node:[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};R.node;var Le=M(R),z={name:`file-image`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]};z.node;var B=M(z),V={name:`folder-input`,size:24,node:[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]};V.node;var Re=M(V),H={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};H.node;var ze=M(H),U={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};U.node;var Be=M(U),W={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};W.node;var Ve=M(W),G=e(f(),1),K=ee();async function He(e){let[t]=e;return t&&e.length===1?(await ne(t.id),{deleted:[t.id],skipped:[]}):ye(e.map(e=>e.id))}function Ue({items:e,references:t}){let n=e.filter(e=>(x(t(e.id))??0)>0),r=e.filter(e=>x(t(e.id))===null);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ul`,{className:`media-delete-list`,children:e.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`strong`,{children:e.filename}),` — `,v(t(e.id))]},e.id))}),n.length>0&&(0,K.jsxs)(`p`,{className:`media-warning`,role:`note`,children:[h(n.length),` `,n.length===1?`is`:`are`,` used by documents. Their pages lose the image: the documents still point at a file that is gone.`]}),r.length>0&&(0,K.jsxs)(`p`,{className:`media-warning`,role:`note`,children:[`The references of `,h(r.length),` are not read yet or could not be read, so they may be in use.`]}),(0,K.jsx)(`p`,{children:`This cannot be undone.`})]})}function We({outcome:e,items:t}){let n=e=>t.find(t=>t.id===e)?.filename??e;return(0,K.jsxs)(`div`,{role:`status`,children:[(0,K.jsxs)(`p`,{children:[`Deleted `,h(e.deleted.length),`.`]}),e.skipped.length>0&&(0,K.jsx)(`ul`,{className:`media-delete-list`,children:e.skipped.map(e=>(0,K.jsxs)(`li`,{children:[n(e.id),`: `,e.reason]},e.id))})]})}function Ge({phase:e,count:t,safe:n,onClose:r,onRun:i}){if(e.name===`done`||e.name===`failed`)return(0,K.jsx)(j,{ref:n,onClick:r,children:`Close`});let a=e.name===`working`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(j,{ref:n,"aria-disabled":a,onClick:a?void 0:r,children:`Cancel`}),(0,K.jsx)(j,{variant:`danger`,"aria-disabled":a,onClick:a?void 0:i,children:a?`Deleting…`:`Delete ${h(t)}`})]})}function Ke(e){let[t,n]=(0,G.useState)({name:`ask`});async function r(){n({name:`working`});try{let t=await He(e.items);n({name:`done`,outcome:t}),e.onDone(t.deleted)}catch(e){n({name:`failed`,message:O(e,`Delete failed`)})}}return{phase:t,run:r}}function qe(e){let{phase:t,run:n}=Ke(e),r=(0,G.useRef)(null);(0,G.useEffect)(()=>{(t.name===`done`||t.name===`failed`)&&r.current?.focus()},[t.name]);let i=t.name===`working`;return(0,K.jsxs)(E,{title:e.items.length===1?`Delete file`:`Delete files`,onClose:i?()=>void 0:e.onClose,initialFocus:r,busy:i,actions:(0,K.jsx)(Ge,{phase:t,count:e.items.length,safe:r,onClose:e.onClose,onRun:()=>void n()}),children:[t.name===`done`&&(0,K.jsx)(We,{outcome:t.outcome,items:e.items}),t.name===`failed`&&(0,K.jsx)(`p`,{role:`alert`,children:t.message}),(t.name===`ask`||t.name===`working`)&&(0,K.jsx)(Ue,{items:e.items,references:e.references})]})}function Je({item:e,canEdit:t}){return t?(0,K.jsxs)(N,{to:we(e.id),className:A(`secondary`,`sm`),children:[(0,K.jsx)(n,{className:`ui-button-icon`,"aria-hidden":`true`}),`Crop & hotspot`]}):(0,K.jsx)(F,{size:`sm`,icon:n,reason:S,onClick:()=>void 0,children:`Crop & hotspot`})}function Ye({item:e,reason:t,onReplaced:n}){let a=(0,G.useRef)(null),o=r(e,n);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{ref:a,type:`file`,accept:`image/*`,hidden:!0,"aria-label":`Replace ${e.filename}`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&o.run(t)}}),(0,K.jsx)(F,{size:`sm`,icon:i,reason:t??(o.busy?`Replacing…`:null),onClick:()=>a.current?.click(),children:o.busy?`Replacing…`:`Replace`})]})}function Xe({item:e}){let t=u(),n=Me(e.url);return(0,K.jsxs)(`div`,{className:`media-actions`,children:[C(e)&&(0,K.jsx)(j,{size:`sm`,icon:Ae,onClick:()=>t(_e(e),`Markdown`),children:`Copy markdown`}),(0,K.jsx)(j,{size:`sm`,variant:`ghost`,icon:Ve,onClick:()=>t(e.id,`ID`),children:`Copy ID`}),n&&(0,K.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:A(`ghost`,`sm`),children:[(0,K.jsx)(je,{className:`ui-button-icon`,"aria-hidden":`true`}),`Open original`,(0,K.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]})]})}function Ze(e){let{item:t,canEdit:n}=e,r=n?null:S,i=a(t,e.onDuplicated);return(0,K.jsxs)(`div`,{className:`media-actions`,children:[C(t)&&(0,K.jsx)(Je,{item:t,canEdit:n}),(0,K.jsx)(Ye,{item:t,reason:r,onReplaced:e.onReplaced}),(0,K.jsx)(F,{size:`sm`,icon:Le,reason:r??(i.busy?`Duplicating…`:null),onClick:()=>void i.run(),children:`Duplicate`}),(0,K.jsx)(F,{size:`sm`,variant:`danger`,icon:P,reason:r,onClick:e.onDelete,children:`Delete`})]})}function Qe({tags:e,disabled:t,onRemove:n}){return e.length===0?null:(0,K.jsx)(`ul`,{className:`media-tags`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`media-tag`,children:[e,(0,K.jsx)(`button`,{type:`button`,className:`media-tag-remove`,"aria-label":`Remove ${e}`,disabled:t,onClick:()=>n(e),children:(0,K.jsx)(k,{"aria-hidden":`true`})})]},e))})}function $e({id:e,known:t,tags:n}){return(0,K.jsx)(`datalist`,{id:e,children:t.filter(e=>!n.includes(e)).map(e=>(0,K.jsx)(`option`,{value:e},e))})}function et({tags:e,known:t,disabled:n,onChange:r}){let i=(0,G.useId)(),a=(0,G.useRef)(null),[o,s]=(0,G.useState)(``);function c(t){if(t.key!==`Enter`&&t.key!==`,`)return;t.preventDefault();let n=o.trim();n&&!e.includes(n)&&r([...e,n]),s(``)}function l(t){r(e.filter(e=>e!==t)),a.current?.focus()}return(0,K.jsxs)(`div`,{className:`media-field`,children:[(0,K.jsx)(`label`,{htmlFor:i,className:`media-label`,children:`Tags`}),(0,K.jsx)(Qe,{tags:e,disabled:n,onRemove:l}),(0,K.jsx)(`input`,{ref:a,id:i,className:`media-input`,list:`${i}-known`,placeholder:`Type a tag and press Enter`,value:o,disabled:n,onChange:e=>s(e.target.value),onKeyDown:c}),(0,K.jsx)($e,{id:`${i}-known`,known:t,tags:e})]})}var tt=5e3;function q(e){if(!e||e.state===`loading`)return`wait`;if(e.state===`failed`)return{count:null};let t=e.documents.length;return t===0?`save`:{count:t}}function nt(e,t){let[n,r]=(0,G.useState)({phase:`idle`}),i=(0,G.useRef)(t);i.current=t;let a=(0,G.useCallback)(e=>{e===`wait`?r({phase:`checking`}):e===`save`?(r({phase:`idle`}),i.current()):r({phase:`confirm`,count:e.count})},[]),o=n.phase===`checking`;return(0,G.useEffect)(()=>{if(!o)return;let t=q(e);if(t!==`wait`){a(t);return}let n=setTimeout(()=>a({count:null}),tt);return()=>clearTimeout(n)},[o,e,a]),{state:n,request:()=>a(q(e)),confirm:()=>{r({phase:`idle`}),i.current()},cancel:()=>r({phase:`idle`})}}function rt({count:e,onConfirm:t,onCancel:n}){let r=(0,G.useRef)(null);return(0,K.jsx)(E,{title:`Rename a file in use`,onClose:n,initialFocus:r,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(j,{ref:r,onClick:n,children:`Cancel`}),(0,K.jsx)(j,{variant:`primary`,onClick:t,children:`Rename`})]}),children:(0,K.jsx)(`p`,{children:fe(e)})})}function J({label:e,value:t,disabled:n,note:r,onChange:i}){let a=(0,G.useId)();return(0,K.jsxs)(`div`,{className:`media-field`,children:[(0,K.jsx)(`label`,{htmlFor:a,className:`media-label`,children:e}),(0,K.jsx)(`input`,{id:a,className:`media-input`,value:t,disabled:n,"aria-describedby":r?`${a}-note`:void 0,onChange:e=>i(e.target.value)}),r&&(0,K.jsx)(`p`,{id:`${a}-note`,className:`media-note`,children:r})]})}function it({item:e,folders:t,disabled:n,onMoved:r}){let i=(0,G.useId)(),a=c(e,r);return(0,K.jsxs)(`div`,{className:`media-field`,children:[(0,K.jsx)(`label`,{htmlFor:i,className:`media-label`,children:`Folder`}),(0,K.jsxs)(`select`,{id:i,className:`media-select`,value:e.folder??``,disabled:n||a.busy,onChange:e=>void a.run(e.target.value||null),children:[(0,K.jsx)(`option`,{value:``,children:`No folder`}),t.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}function at({canEdit:e,busy:t,checking:n}){return e?(0,K.jsx)(j,{type:`submit`,variant:`primary`,size:`sm`,icon:I,"aria-disabled":t||n,children:n?`Checking references…`:t?`Saving…`:`Save`}):(0,K.jsx)(F,{size:`sm`,icon:I,reason:S,onClick:()=>void 0,children:`Save`})}var ot=`No alt text: screen readers and search engines get no description of the image.`;function st({props:e,details:t,change:n}){let r=!e.canEdit;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(J,{label:`Name`,value:t.filename,disabled:r,onChange:e=>n({filename:e})}),(0,K.jsx)(J,{label:`Alt text`,value:t.altText,disabled:r,note:t.altText.trim()?void 0:ot,onChange:e=>n({altText:e})}),(0,K.jsx)(et,{tags:t.tags,known:e.knownTags,disabled:r,onChange:e=>n({tags:e})}),e.folders&&e.folders.length>0&&(0,K.jsx)(it,{item:e.item,folders:e.folders,disabled:r,onMoved:e.onSaved})]})}function ct(e){let{item:t}=e,[n,r]=(0,G.useState)({filename:t.filename,altText:t.altText,tags:[...t.tags]}),i=o(t,e.onSaved),a=nt(e.references,()=>void i.run(n)),s=e=>r(t=>({...t,...e}));function c(r){r.preventDefault(),e.canEdit&&!i.busy&&a.state.phase===`idle`&&(n.filename===t.filename?i.run(n):a.request())}return(0,K.jsxs)(`form`,{className:`media-details`,"aria-label":`Details`,onSubmit:c,children:[(0,K.jsx)(st,{props:e,details:n,change:s}),(0,K.jsx)(at,{canEdit:e.canEdit,busy:i.busy,checking:a.state.phase===`checking`}),a.state.phase===`confirm`&&(0,K.jsx)(rt,{count:a.state.count,onCancel:a.cancel,onConfirm:a.confirm})]})}function lt({references:e}){return(0,K.jsxs)(`div`,{className:`media-references`,children:[(0,K.jsx)(`p`,{className:`media-references-count`,children:v(e)}),e?.state===`ready`&&e.documents.length>0&&(0,K.jsx)(`ul`,{className:`media-reference-list`,children:e.documents.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(N,{to:Te(e.collection,e.slug),className:`media-link`,children:[e.collection,`/`,e.slug]}),` `,(0,K.jsxs)(`span`,{className:`media-reference-fields`,children:[`(`,e.fields.join(`, `),`)`]})]},`${e.collection}/${e.slug}`))})]})}function ut({item:e}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`media-drawer-preview`,children:C(e)?(0,K.jsx)(`img`,{src:w(e,`lg`),alt:e.altText}):(0,K.jsx)(B,{"aria-hidden":`true`})}),(0,K.jsxs)(`dl`,{className:`media-facts`,children:[(0,K.jsx)(`dt`,{children:`Kind`}),(0,K.jsx)(`dd`,{children:g(e.mimeType)}),(0,K.jsx)(`dt`,{children:`Dimensions`}),(0,K.jsx)(`dd`,{children:b(e)??`None stored`}),(0,K.jsx)(`dt`,{children:`Size`}),(0,K.jsx)(`dd`,{children:T(e.size)}),(0,K.jsx)(`dt`,{children:`Uploaded`}),(0,K.jsx)(`dd`,{children:(0,K.jsx)(`time`,{dateTime:e.createdAt,children:Se(e.createdAt)})}),(0,K.jsx)(`dt`,{children:`Stable URL`}),(0,K.jsx)(`dd`,{children:(0,K.jsx)(`code`,{className:`media-url`,children:m(e.id)})})]})]})}function dt({titleId:e,item:t,onClose:n}){let r=(0,G.useRef)(null);return(0,G.useEffect)(()=>{r.current?.focus()},[]),(0,K.jsxs)(`div`,{className:`media-drawer-head`,children:[(0,K.jsx)(`h2`,{id:e,ref:r,tabIndex:-1,className:`media-drawer-title`,children:t.filename}),(0,K.jsx)(ke,{icon:k,label:`Close details`,onClick:n})]})}function ft(e){let{item:t,permissions:n}=e,r=(0,G.useId)();function i(t){t.key!==`Escape`||t.defaultPrevented||(t.stopPropagation(),e.onClose())}return(0,K.jsxs)(`section`,{className:`media-drawer`,"aria-labelledby":r,onKeyDown:i,children:[(0,K.jsx)(dt,{titleId:r,item:t,onClose:e.onClose}),(0,K.jsx)(ut,{item:t}),(0,K.jsx)(lt,{references:e.references}),(0,K.jsx)(Xe,{item:t}),(0,K.jsx)(Ze,{item:t,canEdit:n.canEdit,onReplaced:t=>e.onChanged(t,!0),onDuplicated:e.onDuplicated,onDelete:e.onDelete}),(0,K.jsx)(ct,{item:t,references:e.references,folders:e.folders,knownTags:e.knownTags,canEdit:n.canEdit,onSaved:t=>e.onChanged(t,!1)},`${t.id}:${t.url}`)]})}function Y(e){let{label:t,submitLabel:n,onCancel:r}=e,i=(0,G.useId)(),[a,o]=(0,G.useState)(e.initial),[s,c]=(0,G.useState)(!1);async function l(t){t.preventDefault(),a.trim()&&!s&&(c(!0),await e.onSubmit(a.trim()),c(!1))}return(0,K.jsxs)(`form`,{className:`media-folder-form`,onSubmit:e=>void l(e),children:[(0,K.jsx)(`label`,{htmlFor:i,className:`media-label`,children:t}),(0,K.jsx)(`input`,{id:i,className:`media-input`,value:a,autoFocus:!0,onChange:e=>o(e.target.value),onKeyDown:e=>e.key===`Escape`&&r()}),(0,K.jsxs)(`div`,{className:`media-actions`,children:[(0,K.jsx)(j,{size:`sm`,variant:`primary`,type:`submit`,"aria-disabled":s,children:n}),(0,K.jsx)(j,{size:`sm`,variant:`ghost`,onClick:r,children:`Cancel`})]})]})}function pt({folder:e,onClose:t,onDeleted:n}){let r=D(),i=(0,G.useRef)(null);async function a(){try{await ve(e.id),r({text:`Folder ${e.name} deleted.`}),n()}catch(e){r({text:O(e,`The folder could not be deleted`),tone:`error`})}t()}return(0,K.jsx)(E,{title:`Delete folder`,onClose:t,initialFocus:i,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(j,{ref:i,onClick:t,children:`Cancel`}),(0,K.jsx)(j,{variant:`danger`,onClick:()=>void a(),children:`Delete folder`})]}),children:(0,K.jsxs)(`p`,{children:[`Delete the folder `,(0,K.jsx)(`strong`,{children:e.name}),`? Only an empty folder can be deleted; its files stay in the library.`]})})}function mt(e){let t=D();async function n(n,r){try{e(await n())}catch(e){t({text:O(e,r),tone:`error`})}}return{create:(e,t)=>n(async()=>(await ce(t,e?.id??null)).id,`The folder could not be created`),rename:(e,t)=>n(async()=>{await se(e.id,t)},`The folder could not be renamed`)}}function ht({props:e,onEdit:t}){let n=e.canEdit?null:S;return(0,K.jsxs)(`div`,{className:`media-folder-actions`,children:[(0,K.jsx)(F,{size:`sm`,icon:ze,reason:n,onClick:()=>t(`new`),children:`New folder`}),e.selected&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(F,{size:`sm`,variant:`ghost`,icon:Pe,reason:n,onClick:()=>t(`rename`),children:`Rename folder`}),(0,K.jsx)(F,{size:`sm`,variant:`ghost`,icon:P,reason:e.canAdminister?null:`Deleting several files at once, or a folder, needs the admin role.`,onClick:()=>t(`delete`),children:`Delete folder`})]})]})}function gt(e){let{selected:t,onChanged:n}=e,[r,i]=(0,G.useState)(`none`),a=()=>i(`none`),o=mt(e=>{a(),n(e)});return r===`new`?(0,K.jsx)(Y,{label:t?`New folder in ${t.name}`:`New folder`,initial:``,submitLabel:`Create`,onSubmit:e=>o.create(t,e),onCancel:a}):r===`rename`&&t?(0,K.jsx)(Y,{label:`Folder name`,initial:t.name,submitLabel:`Rename`,onSubmit:e=>o.rename(t,e),onCancel:a}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ht,{props:e,onEdit:i}),r===`delete`&&t&&(0,K.jsx)(pt,{folder:t,onClose:a,onDeleted:()=>n()})]})}function _t({value:e}){return e==null?null:(0,K.jsxs)(`span`,{className:`media-folder-count`,children:[e,(0,K.jsxs)(`span`,{className:`visually-hidden`,children:[` `,e===1?`file`:`files`]})]})}function X(e){let{icon:t}=e;function n(t){let n=t.dataTransfer.getData(y);n&&(t.preventDefault(),e.onDropMedia(n))}return(0,K.jsxs)(`button`,{type:`button`,className:`media-folder`,"aria-pressed":e.pressed,onClick:e.onSelect,onDragOver:e=>{e.dataTransfer.types.includes(`application/krantho-media-id`)&&e.preventDefault()},onDrop:n,children:[(0,K.jsx)(t,{className:`media-folder-icon`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`media-folder-name`,children:e.label}),(0,K.jsx)(_t,{value:e.count})]})}function vt({row:e,open:t,onToggle:n}){if(!e.hasChildren)return(0,K.jsx)(`span`,{className:`media-folder-toggle-space`,"aria-hidden":`true`});let r=t?s:De;return(0,K.jsx)(`button`,{type:`button`,className:`media-folder-toggle`,"aria-expanded":t,"aria-label":`Subfolders of ${e.folder.name}`,onClick:n,children:(0,K.jsx)(r,{"aria-hidden":`true`})})}function yt({props:e}){let[t,n]=(0,G.useState)(new Set),r=e=>n(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return he(e.folders,t).map(n=>(0,K.jsxs)(`li`,{className:`media-folder-row`,style:{paddingInlineStart:`calc(${n.depth} * var(--space-4))`},children:[(0,K.jsx)(vt,{row:n,open:!t.has(n.folder.id),onToggle:()=>r(n.folder.id)}),(0,K.jsx)(X,{label:n.folder.name,count:e.counts.get(n.folder.id),pressed:e.selected===n.folder.id,icon:Be,onSelect:()=>e.onSelect(n.folder.id),onDropMedia:t=>e.onMove(t,n.folder.id)})]},n.folder.id))}function bt(e){let t=e.folders.find(t=>t.id===e.selected)??null;return(0,K.jsxs)(`nav`,{className:`media-folders`,"aria-label":`Folders`,children:[(0,K.jsx)(`h2`,{className:`media-folders-title`,children:`Folders`}),(0,K.jsxs)(`ul`,{className:`media-folder-list`,children:[(0,K.jsxs)(`li`,{className:`media-folder-row`,children:[(0,K.jsx)(`span`,{className:`media-folder-toggle-space`,"aria-hidden":`true`}),(0,K.jsx)(X,{label:`All files`,count:e.total,pressed:e.selected===null,icon:Ne,onSelect:()=>e.onSelect(null),onDropMedia:t=>e.onMove(t,null)})]}),(0,K.jsx)(yt,{props:e})]}),(0,K.jsx)(gt,{selected:t,canEdit:e.permissions.canEdit,canAdminister:e.permissions.canAdminister,onChanged:e.onChanged})]})}function Z({item:e,references:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`media-tile-thumb`,children:[C(e)?(0,K.jsx)(`img`,{src:w(e,`md`),alt:``,loading:`lazy`}):(0,K.jsx)(B,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`media-tile-kind`,children:g(e.mimeType)})]}),(0,K.jsx)(`span`,{className:`media-tile-name`,children:e.filename}),(0,K.jsx)(`span`,{className:`media-tile-meta`,children:b(e)??`No pixel dimensions`}),(0,K.jsx)(`span`,{className:`media-tile-refs`,children:v(t)})]})}function xt({item:e,props:t}){let n=t.references(e.id);if(t.bulk){let r=t.selected.has(e.id);return(0,K.jsxs)(`label`,{className:`media-tile${r?` media-tile--selected`:``}`,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`media-tile-check`,"aria-label":`Select ${e.filename}`,checked:r,onChange:()=>t.onToggle(e.id)}),(0,K.jsx)(Z,{item:e,references:n})]})}return(0,K.jsx)(`button`,{type:`button`,className:`media-tile`,"data-media-id":e.id,"aria-pressed":t.open===e.id,draggable:t.draggable,onDragStart:t=>{t.dataTransfer.setData(y,e.id),t.dataTransfer.effectAllowed=`move`},onClick:()=>t.onOpen(e),children:(0,K.jsx)(Z,{item:e,references:n})})}function St(e){return(0,K.jsx)(`ul`,{className:`media-grid`,"aria-label":`Files`,children:e.items.map(t=>(0,K.jsx)(`li`,{children:(0,K.jsx)(xt,{item:t,props:e})},t.id))})}function Ct({info:e,read:t}){return(0,K.jsxs)(`header`,{className:`media-header`,children:[(0,K.jsx)(`h1`,{className:`media-title`,children:`Media`}),e?(0,K.jsxs)(`p`,{className:`media-lead`,children:[`Stored in `,(0,K.jsx)(`strong`,{className:`media-store`,children:e.storageLabel}),e.storagePath&&(0,K.jsxs)(K.Fragment,{children:[` `,`at `,(0,K.jsx)(`code`,{className:`media-store-path`,children:e.storagePath})]}),(0,K.jsxs)(`span`,{children:[` `,`· `,h(e.totalItems),`, `,T(e.totalSize)]})]}):(0,K.jsx)(`p`,{className:`media-lead`,children:t?`The media store could not be read.`:`Reading the media store…`})]})}function wt({value:e,onChange:t}){let n=(0,G.useId)();return(0,K.jsxs)(`span`,{className:`media-search`,children:[(0,K.jsx)(`label`,{htmlFor:n,className:`visually-hidden`,children:`Search media`}),(0,K.jsx)(Ee,{className:`media-search-icon`,"aria-hidden":`true`}),(0,K.jsx)(`input`,{id:n,type:`search`,className:`media-input media-search-input`,placeholder:`Search by name`,value:e,onChange:e=>t(e.target.value)})]})}function Q(e){let t=(0,G.useId)();return(0,K.jsxs)(`span`,{className:`media-filter`,children:[(0,K.jsx)(`label`,{htmlFor:t,children:e.label}),(0,K.jsx)(`select`,{id:t,className:`media-select`,value:e.value,onChange:t=>{let n=e.options.find(e=>e.value===t.target.value);n&&e.onChange(n.value)},children:e.options.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})}function Tt(e){let{filters:t,onFilters:n,tags:r}=e,i=[{value:``,label:`All tags`},...r.map(e=>({value:e,label:e}))];return(0,K.jsxs)(`div`,{className:`media-toolbar`,children:[(0,K.jsx)(wt,{value:t.search,onChange:e=>n({search:e})}),r.length>0&&(0,K.jsx)(Q,{label:`Tag`,value:t.tag,options:i,onChange:e=>n({tag:e})}),(0,K.jsx)(Q,{label:`Order this page`,value:e.sort,options:ue.map(e=>({value:e,label:pe[e]})),onChange:e.onSort}),(0,K.jsx)(j,{size:`sm`,icon:Fe,"aria-pressed":e.bulk,onClick:e.onBulk,children:`Bulk select`})]})}function Et(e){let t=e.count===0?`Select files to delete.`:null;return(0,K.jsxs)(`section`,{className:`media-selection`,"aria-label":`Selection`,children:[(0,K.jsxs)(`p`,{className:`media-selection-count`,role:`status`,children:[(0,K.jsx)(`span`,{className:`media-figure`,children:e.count}),` selected`]}),(0,K.jsxs)(`div`,{className:`media-actions`,children:[(0,K.jsx)(F,{size:`sm`,variant:`danger`,icon:P,reason:e.canDelete?t:ge,onClick:e.onDelete,children:`Delete`}),(0,K.jsx)(j,{size:`sm`,variant:`ghost`,icon:Ie,onClick:e.onSelectPage,children:`Select this page`}),(0,K.jsx)(j,{size:`sm`,variant:`ghost`,icon:k,onClick:e.onClear,children:`Clear selection`})]})]})}function Dt({items:e,folder:t}){let n=e.length===1;return`Uploaded ${h(e.length)} to All files: an upload goes into no folder. Move ${n?`it`:`them`} to ${t.name} from ${n?`its`:`their`} details, or with Move here.`}async function Ot(e,t){let n=0;for(let r of e)await p(r.id,t.id),n++;return n}function kt({notice:e,onMoved:t,onDismiss:n}){let r=D(),[i,a]=(0,G.useState)(!1);async function o(){a(!0);try{let n=await Ot(e.items,e.folder);r({text:`Moved ${h(n)} to ${e.folder.name}.`}),t()}catch(e){r({text:O(e,`The files could not be moved`),tone:`error`}),a(!1)}}return(0,K.jsxs)(`div`,{className:`media-upload-notice`,role:`status`,children:[(0,K.jsx)(`p`,{children:Dt(e)}),(0,K.jsxs)(`div`,{className:`media-actions`,children:[(0,K.jsx)(j,{size:`sm`,variant:`primary`,icon:Re,"aria-disabled":i,onClick:i?void 0:()=>void o(),children:i?`Moving…`:`Move here`}),(0,K.jsx)(j,{size:`sm`,variant:`ghost`,icon:k,onClick:n,children:`Dismiss`})]})]})}var At={search:``,tag:``,folder:null,page:0},jt={read:!1,info:null,tags:[],folders:[],folderCounts:new Map};function Mt(e,t){return t?new Map(e.map(e=>[e.id,t.folderCounts[e.id]??0])):new Map}async function Nt(e){let[t,n,r]=await Promise.all([oe().catch(()=>null),te().catch(()=>[]),e?re().catch(()=>[]):Promise.resolve([])]);return{read:!0,info:t,tags:n,folders:r,folderCounts:Mt(r,t)}}function $(e){return ie({limit:24,offset:e.page*24,search:e.search||void 0,tag:e.tag||void 0,folder:e.folder??void 0})}function Pt(e,t){let[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(null);return(0,G.useEffect)(()=>{let t=!0;return $(e).then(e=>{t&&(r(e),a(null))}).catch(e=>t&&a(O(e,`Media could not be read`))),()=>{t=!1}},[e,t]),[n,i]}function Ft(e,t){let[n,r]=(0,G.useState)(jt);return(0,G.useEffect)(()=>{let t=!0;return Nt(e).then(e=>t&&r(e)),()=>{t=!1}},[e,t]),n}function It(e){let[t,n]=(0,G.useState)(At),[r,i]=(0,G.useState)(`newest`),[a,o]=(0,G.useState)(0),[s,c]=Pt(t,a),l=Ft(e,a),u=(0,G.useCallback)(e=>{n(t=>({...t,page:0,...e}))},[]),d=(0,G.useCallback)(()=>o(e=>e+1),[]);return{filters:t,setFilters:u,sort:r,setSort:i,listing:s,items:(0,G.useMemo)(()=>le(s?.items??[],r),[s,r]),pageCount:Math.ceil((s?.total??0)/24),library:l,error:c,reload:d}}function Lt(e){queueMicrotask(()=>{([...document.querySelectorAll(`[data-media-id]`)].find(t=>t.getAttribute(`data-media-id`)===e)??document.getElementById(`studio-main`))?.focus()})}function Rt(e){let[t,n]=(0,G.useState)(null);return(0,G.useEffect)(()=>{n(t=>(t&&e.find(e=>e.id===t.id))??t)},[e]),{item:t,open:n,close:(0,G.useCallback)(()=>{n(e=>(e&&Lt(e.id),null))},[]),drop:(0,G.useCallback)(()=>n(null),[]),update:n}}function zt(){let[e,t]=(0,G.useState)(!1),[n,r]=(0,G.useState)(new Map),i=e=>r(t=>{let n=new Map(t);return e(n),n});return{on:e,toggleMode:()=>{t(e=>!e),r(new Map)},ids:new Set(n.keys()),items:[...n.values()],toggle:e=>i(t=>{t.delete(e.id)||t.set(e.id,e)}),add:e=>i(t=>{for(let n of e)t.set(n.id,n)}),remove:e=>i(t=>{for(let n of e)t.delete(n)}),clear:()=>r(new Map)}}function Bt(e){let[t,n]=(0,G.useState)(new Map),r=(0,G.useRef)(new Set),i=(0,G.useCallback)(e=>{n(t=>{let n=new Map(t);for(let[t,r]of e)n.set(t,r);return n})},[]),a=(0,G.useCallback)(e=>{r.current.add(e),i([[e,{state:`loading`}]]),me(e).then(e=>({state:`ready`,documents:_(e.usage)})).catch(()=>({state:`failed`})).then(t=>i([[e,t]]))},[i]);return(0,G.useEffect)(()=>{let t=e.filter(e=>!r.current.has(e));if(t.length!==0){for(let e of t)r.current.add(e);i(t.map(e=>[e,{state:`loading`}])),ae(t).then(e=>t.map(t=>[t,{state:`ready`,documents:_(e[t]??[])}])).catch(()=>t.map(e=>[e,{state:`failed`}])).then(e=>i(e))}},[e,i]),{of:(0,G.useCallback)(e=>t.get(e),[t]),refresh:a}}function Vt(){setTimeout(()=>{document.activeElement!==document.body&&document.activeElement||document.getElementById(`studio-main`)?.focus()},0)}function Ht({page:e}){let{media:t,selection:n,open:r}=e;if(t.error)return(0,K.jsx)(`p`,{role:`alert`,children:t.error});if(!t.listing)return(0,K.jsx)(`p`,{role:`status`,children:`Reading media…`});if(t.items.length===0){let e=t.filters.search||t.filters.tag||t.filters.folder;return(0,K.jsx)(Oe,{icon:d,title:e?`No files match`:`No media yet`,children:e?`Nothing here matches the search, tag and folder chosen.`:`Upload an image to start the library.`})}return(0,K.jsx)(St,{items:t.items,references:e.references.of,bulk:n.on,selected:n.ids,onToggle:e=>{let r=t.items.find(t=>t.id===e);r&&n.toggle(r)},open:r.item?.id??null,onOpen:r.open,draggable:e.hasFolders&&e.permissions.canEdit})}function Ut(e){let t=D();return(n,r)=>{p(n,r).then(()=>{t({text:`Moved.`}),e()}).catch(e=>t({text:O(e,`The file could not be moved`),tone:`error`}))}}function Wt({page:e}){let{media:t}=e,{library:n,filters:r,setFilters:i,reload:a}=t,o=Ut(a),s=(0,G.useRef)(r.folder);return s.current=r.folder,(0,G.useEffect)(()=>{let e=s.current;n.read&&e!==null&&(n.folders.some(t=>t.id===e)||i({folder:null}))},[n,i]),e.hasFolders?(0,K.jsx)(bt,{folders:n.folders,counts:n.folderCounts,total:n.info?.totalItems??null,selected:r.folder,onSelect:e=>i({folder:e}),permissions:e.permissions,onChanged:e=>{a(),e&&i({folder:e})},onMove:o}):null}function Gt({page:e}){let{media:n,permissions:r}=e,[i,a]=(0,G.useState)(null);function o(e){let t=n.library.folders.find(e=>e.id===n.filters.folder);a(t?{items:e,folder:t}:null),n.setFilters({page:0}),n.reload()}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(t,{blocked:r.canEdit?null:S,onUploaded:o}),i&&(0,K.jsx)(kt,{notice:i,onDismiss:()=>a(null),onMoved:()=>{a(null),n.reload()}})]})}function Kt({page:e}){let{media:t,selection:n,permissions:r}=e;return(0,K.jsxs)(`div`,{className:`media-main`,children:[(0,K.jsx)(Gt,{page:e}),(0,K.jsx)(Tt,{filters:t.filters,onFilters:t.setFilters,tags:t.library.tags,sort:t.sort,onSort:t.setSort,bulk:n.on,onBulk:n.toggleMode}),n.on&&(0,K.jsx)(Et,{count:n.ids.size,canDelete:r.canAdminister,onDelete:()=>e.askDelete(n.items),onSelectPage:()=>n.add(t.items),onClear:n.clear}),(0,K.jsx)(Ht,{page:e}),(0,K.jsx)(l,{page:t.filters.page,count:t.pageCount,onPage:e=>t.setFilters({page:e})})]})}function qt({page:e}){let{media:t,open:n}=e,r=n.item;return r?(0,K.jsx)(ft,{item:r,references:e.references.of(r.id),folders:e.hasFolders?t.library.folders:null,knownTags:t.library.tags,permissions:e.permissions,onClose:n.close,onChanged:e=>{n.update(e),t.reload()},onDuplicated:e=>{t.reload(),n.open(e)},onDelete:()=>e.askDelete([r])},r.id):null}function Jt({page:e,items:t,onClose:n}){let{open:r,selection:i,media:a}=e;return(0,K.jsx)(qe,{items:t,references:e.references.of,onClose:()=>{n(),Vt()},onDone:e=>{r.item&&e.includes(r.item.id)&&r.drop(),i.remove(e),a.reload()}})}function Yt(){let{hasRole:e}=be(),t=Ce(xe(),`mediaFolders`),n=It(t),r=Bt((0,G.useMemo)(()=>n.items.map(e=>e.id),[n.items])),i=Rt(n.items),a=zt(),[o,s]=(0,G.useState)(null),c={media:n,references:r,open:i,selection:a,permissions:de(e),hasFolders:t,askDelete:e=>{for(let t of e)r.refresh(t.id);s(e)}};return(0,K.jsxs)(`div`,{className:`media${i.item?` media--drawer`:``}`,children:[(0,K.jsx)(Ct,{info:n.library.info,read:n.library.read}),(0,K.jsxs)(`div`,{className:`media-body`,children:[(0,K.jsx)(Wt,{page:c}),(0,K.jsx)(Kt,{page:c})]}),(0,K.jsx)(qt,{page:c}),o&&(0,K.jsx)(Jt,{page:c,items:o,onClose:()=>s(null)})]})}export{Yt as MediaPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as e}from"./vendor-diff-DGCTJYJ4.js";var t={created:`Created`,published:`Published`,saved:`Draft saved`};function n(e){return e.liveVersion===null&&e.version===1?`created`:e.liveVersion!==null&&e.liveVersion>=e.version?`published`:`saved`}var r=8;function i(e,t=r){return[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).slice(0,t).map(e=>({document:e,event:n(e)}))}var a=6e4,o=60*a,s=24*o;function c(e,t=Date.now(),n){let r=new Date(e).getTime(),i=t-r;if(i<a)return`just now`;let c=new Intl.RelativeTimeFormat(n,{numeric:`auto`});return i<o?c.format(-Math.floor(i/a),`minute`):i<s?c.format(-Math.floor(i/o),`hour`):i<7*s?c.format(-Math.floor(i/s),`day`):new Date(r).toLocaleDateString(n,{dateStyle:`medium`})}var l=e();function u({segments:e,max:t}){return(0,l.jsx)(`span`,{className:`ui-meter`,"aria-hidden":`true`,children:t>0&&e.filter(e=>e.value>0).map(e=>(0,l.jsx)(`span`,{className:`ui-meter-part ui-meter-part--${e.tone}`,style:{flexGrow:e.value/t}},e.tone))})}export{c as i,t as n,i as r,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./c-
|
|
1
|
+
import{t as e}from"./c-CEM0h_nK.js";t.displayName=`objectivec`,t.aliases=[`objc`];function t(t){t.register(e),t.languages.objectivec=t.languages.extend(`c`,{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete t.languages.objectivec[`class-name`],t.languages.objc=t.languages.objectivec}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BklFHeMd.js";var t={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BklFHeMd.js";var t={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./markup-templating-
|
|
1
|
+
import e from"./markup-templating-DNhq-UOv.js";t.displayName=`php`,t.aliases=[];function t(t){t.register(e),(function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:`boolean`},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,a=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:`important`},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:`class-name`},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:`function`},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:`type-casting`,greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:`type-hint`,greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:`return-type`,greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:`type-declaration`,greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:`type-declaration`,greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:`static-context`,greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:`class-name-fully-qualified`,greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:`class-name-fully-qualified`,greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:`class-name-fully-qualified`,greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:`type-declaration`,greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:[`class-name-fully-qualified`,`type-declaration`],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:`static-context`,greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:[`class-name-fully-qualified`,`static-context`],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:`type-hint`,greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:[`class-name-fully-qualified`,`type-hint`],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:`return-type`,greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:[`class-name-fully-qualified`,`return-type`],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:i,punctuation:a};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},s=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:`nowdoc-string`,greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:`symbol`,inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:`heredoc-string`,greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:`symbol`,inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:`backtick-quoted-string`,greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:`single-quoted-string`,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:`double-quoted-string`,greedy:!0,inside:{interpolation:o}}];e.languages.insertBefore(`php`,`variable`,{string:s,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:s,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:`class-name`,greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:[`class-name`,`class-name-fully-qualified`],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:r,operator:i,punctuation:a}},delimiter:{pattern:/^#\[|\]$/,alias:`punctuation`}}}}),e.hooks.add(`before-tokenize`,function(t){/<\?/.test(t.code)&&e.languages[`markup-templating`].buildPlaceholders(t,`php`,/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)}),e.hooks.add(`after-tokenize`,function(t){e.languages[`markup-templating`].tokenizePlaceholders(t,`php`)})})(t)}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{f as t,y as n}from"./api-seo-Cjv4a9Y_.js";import{t as r}from"./triangle-exclamation-point-ttN5lZI0.js";import{o as i,s as a}from"./vendor-diff-DGCTJYJ4.js";import{i as o}from"./auth-CIpilSKF.js";import{d as s,l as c,t as l,u}from"./format-C3ZX9yGM.js";import{C as d,Ct as ee,D as te,Dt as ne,K as re,M as ie,S as ae,St as oe,Tt as f,V as p,a as m,at as se,ct as h,f as g,h as _,i as v,lt as y,nt as b,ot as x,pt as S,q as ce,r as le,s as ue,ut as de,x as fe,z as pe}from"./index-qiIlvPyv.js";import{n as C,t as w}from"./source-CGZGd3Xy.js";import{i as T,n as E,t as D}from"./createLucideIcon-BklFHeMd.js";import{t as O}from"./empty-state-CeUZocHx.js";import{t as k}from"./vendor-router-B4czwg8X.js";import{a as A,i as j,n as M,r as N}from"./findability-BrhtZ2yD.js";import{i as P,n as F,r as I,t as L}from"./meter-ZOLJ0WhG.js";import{t as R}from"./pen-line-B524Nue8.js";var z={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};z.node;var B=D(z),V={name:`text-search`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M10 12H3`,key:`1ulcyk`}],[`path`,{d:`M10 19H3`,key:`108z41`}],[`circle`,{cx:`17`,cy:`15`,r:`3`,key:`1upz2a`}],[`path`,{d:`m21 19-1.9-1.9`,key:`dwi7p8`}]]};V.node;var H=D(V),U=e(a(),1),W=i(),me={live:`live`,ahead:`draft ahead`,draft:`draft`};function G({status:e,count:t}){return(0,W.jsxs)(`span`,{className:`collection-count${t===0?` collection-count--zero`:``}`,children:[(0,W.jsx)(fe,{status:e,decorative:!0}),(0,W.jsx)(`span`,{className:`collection-count-number`,children:t}),` `,me[e]]})}function he({counts:e}){let{collection:t,live:n,ahead:r,draft:i}=e,a=m(t);return(0,W.jsx)(`li`,{children:(0,W.jsxs)(k,{to:ee(t.name),className:`collection-row`,children:[(0,W.jsxs)(`span`,{className:`collection-name`,children:[l(t.name),a!==null&&(0,W.jsx)(`code`,{className:`collection-path`,children:a})]}),(0,W.jsxs)(`span`,{className:`collection-counts`,children:[(0,W.jsx)(G,{status:`live`,count:n}),r>0&&(0,W.jsx)(G,{status:`ahead`,count:r}),(0,W.jsx)(G,{status:`draft`,count:i})]})]})})}function ge({collections:e}){return(0,W.jsxs)(`section`,{className:`pulse-panel`,"aria-labelledby":`pulse-collections-title`,children:[(0,W.jsx)(`div`,{className:`pulse-panel-head`,children:(0,W.jsx)(`h2`,{id:`pulse-collections-title`,children:`Collections`})}),e.length===0?(0,W.jsxs)(O,{icon:de,title:`No collections`,children:[`Collections are defined in code, in `,(0,W.jsx)(`code`,{children:`krantho.collections.ts`}),`.`]}):(0,W.jsx)(`ul`,{className:`collection-list`,children:e.map(e=>(0,W.jsx)(he,{counts:e},e.collection.name))})]})}function K({icon:e,label:t,value:n,total:r,detail:i,children:a}){let o=(0,U.useId)();return(0,W.jsx)(`li`,{className:`pulse-figure`,children:(0,W.jsxs)(`figure`,{className:`pulse-figure-body`,"aria-labelledby":o,children:[(0,W.jsxs)(`figcaption`,{id:o,className:`pulse-figure-label`,children:[(0,W.jsx)(e,{"aria-hidden":`true`}),t]}),n===null?(0,W.jsx)(`p`,{className:`pulse-figure-value pulse-figure-value--unavailable`,children:`Unavailable`}):(0,W.jsxs)(`p`,{className:`pulse-figure-value`,children:[(0,W.jsx)(`span`,{className:`pulse-figure-number`,children:n}),r&&(0,W.jsx)(`span`,{className:`pulse-figure-total`,children:r})]}),a,(0,W.jsx)(`p`,{className:`pulse-figure-detail`,children:i})]})})}function q(e,t,n){return`${e} ${e===1?t:n}`}function J({figure:e}){let t=e.pages===0?`No pages yet`:e.ahead===0?`None with unpublished changes`:`${e.ahead} with unpublished changes`;return(0,W.jsx)(K,{icon:A,label:`Live pages`,value:e.live,total:`of ${q(e.pages,`page`,`pages`)}`,detail:t,children:(0,W.jsx)(L,{max:e.pages,segments:[{value:e.live-e.ahead,tone:`live`},{value:e.ahead,tone:`ahead`}]})})}function _e({figure:e}){let t=e.pages===0?`No pages yet`:`${e.fallback} fall back to description · ${e.missing} missing`;return(0,W.jsx)(K,{icon:H,label:`Meta descriptions`,value:e.covered,total:`of ${q(e.pages,`page`,`pages`)} set`,detail:t,children:(0,W.jsx)(L,{max:e.pages,segments:[{value:e.covered,tone:`live`},{value:e.fallback,tone:`ahead`},{value:e.missing,tone:`danger`}]})})}function ve({source:e}){if(e.state!==`ok`)return(0,W.jsx)(K,{icon:B,label:`Valid structured data`,value:null,detail:`The site's SEO findings could not be read`});let t=e.value,n=t.pages===0?`No live pages yet`:t.mainTypes.length>0?`Main types: ${t.mainTypes.join(`, `)}`:`No types search engines show as rich results`;return(0,W.jsx)(K,{icon:B,label:`Valid structured data`,value:t.valid,total:`of ${q(t.pages,`live page`,`live pages`)}`,detail:n,children:(0,W.jsx)(L,{max:t.pages,segments:[{value:t.valid,tone:`live`},{value:t.pages-t.valid,tone:`danger`}]})})}function ye({live:e,coverage:t,structuredData:n}){return(0,W.jsxs)(`section`,{className:`pulse-figures-section`,"aria-labelledby":`pulse-figures-title`,children:[(0,W.jsx)(`h2`,{id:`pulse-figures-title`,className:`visually-hidden`,children:`Key figures`}),(0,W.jsxs)(`ul`,{className:`pulse-figures`,children:[(0,W.jsx)(J,{figure:e}),(0,W.jsx)(_e,{figure:t}),n.state!==`off`&&(0,W.jsx)(ve,{source:n})]})]})}var be={delivery:b,lock:h,ahead:R,meta:H,locale:y},xe={delivery:[`failed delivery`,`failed deliveries`],lock:[`more locked document`,`more locked documents`],ahead:[`more document with unpublished changes`,`more documents with unpublished changes`],meta:[`more page without a meta description`,`more pages without a meta description`],locale:[`more collection missing a locale`,`more collections missing a locale`]};function Se({row:e}){let t=be[e.kind];return(0,W.jsxs)(`li`,{className:`attention-row attention-row--${e.kind}`,children:[(0,W.jsx)(`span`,{className:`attention-icon`,"aria-hidden":`true`,children:(0,W.jsx)(t,{})}),(0,W.jsxs)(`div`,{className:`attention-text`,children:[(0,W.jsx)(`p`,{className:`attention-title`,children:e.title}),(0,W.jsx)(`p`,{className:`attention-detail`,children:e.detail})]}),(0,W.jsx)(k,{to:e.to,className:T(`secondary`,`sm`,`attention-action`),"aria-label":`${e.action}: ${e.title}`,children:e.action})]})}function Ce({kind:e,count:t}){let[n,r]=xe[e];return`${t} ${t===1?n:r}`}function we({attention:e,watched:t,unread:n}){let{rows:i,overflow:a}=e;return(0,W.jsxs)(`section`,{className:`pulse-panel`,"aria-labelledby":`pulse-attention-title`,children:[(0,W.jsxs)(`div`,{className:`pulse-panel-head`,children:[(0,W.jsx)(`h2`,{id:`pulse-attention-title`,children:`Needs attention`}),i.length>0&&(0,W.jsx)(`span`,{className:`pulse-count`,"aria-hidden":`true`,children:i.length+a.reduce((e,t)=>e+t.count,0)})]}),i.length===0?(0,W.jsxs)(O,{icon:S,title:`Nothing needs you right now`,children:[t,` show up here.`]}):(0,W.jsx)(`ul`,{className:`attention-list`,children:i.map(e=>(0,W.jsx)(Se,{row:e},e.key))}),a.length>0&&(0,W.jsxs)(`p`,{className:`attention-more`,children:[`And `,a.map(Ce).join(`, `),`.`]}),n.length>0&&(0,W.jsxs)(`p`,{className:`pulse-unread`,children:[(0,W.jsx)(r,{"aria-hidden":`true`}),`Could not check `,n.join(` or `),`.`]})]})}var Te=[`delivery`,`lock`,`ahead`,`meta`,`locale`];function Y(e,t){let n=e.locale===t.defaultLocale?void 0:e.locale;return f(e.collection,e.slug,n)}function X(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function Z(e){return e===`globals`?`Layout`:l(e)}function Ee(e,t){return e.filter(e=>e.status===`ahead`).sort(X).map(e=>({key:`ahead:${e.collection}/${e.slug}/${e.locale}`,kind:`ahead`,title:`${e.title} has unpublished changes`,detail:`${Z(e.collection)} · version ${e.liveVersion} is live, version ${e.version} is saved`,action:`Review`,to:Y(e,t)}))}function De(e,t){return e.filter(e=>t.pageCollections.has(e.collection)&&e.locale===t.defaultLocale&&e.metaDescription===`missing`).sort(X).map(e=>({key:`meta:${e.collection}/${e.slug}`,kind:`meta`,title:`${e.title} has no meta description`,detail:`${Z(e.collection)} · neither meta-description nor description is set`,action:`Fix`,to:Y(e,t)}))}function Oe(e){let t=new Map(e.documents.map(e=>[`${e.collection}/${e.slug}/${e.locale}`,e.title]));return[...e.locks??[]].sort((e,t)=>t.lockedAt.localeCompare(e.lockedAt)).map(n=>{let r=`${n.collection}/${n.slug}/${n.locale}`;return{key:`lock:${r}`,kind:`lock`,title:`${t.get(r)??n.slug} is being edited by ${le(n.lockedBy)}`,detail:`${Z(n.collection)} · locked until ${je(n.expiresAt)}`,action:`Open`,to:Y(n,e.scope)}})}function ke(e){if(!e||e.total===0)return[];let{total:t,latest:n}=e;return[{key:`delivery:failed`,kind:`delivery`,title:t===1?`1 webhook delivery failed`:`${t} webhook deliveries failed`,detail:n?`Latest: ${n.event} to ${n.url}`:`See the delivery log`,action:`Open log`,to:`/setup/integrations`}]}function Ae(e){return(e??[]).flatMap(e=>{let t=e.items.filter(e=>e.missing.length>0);if(t.length===0)return[];let n=[...new Set(t.flatMap(e=>e.missing))].sort(),r=t.length;return[{key:`locale:${e.collection}`,kind:`locale`,title:`${Z(e.collection)}: ${r} ${r===1?`document is`:`documents are`} missing a locale version`,detail:`No version in ${n.join(`, `)}`,action:`Locales`,to:`/setup/locales`}]})}function je(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function Me(e){let t={delivery:ke(e.deliveries),lock:Oe(e),ahead:Ee(e.documents,e.scope),meta:De(e.documents,e.scope),locale:Ae(e.translations)},n=[],r=[];for(let e of Te){let i=t[e];n.push(...i.slice(0,5)),i.length>5&&r.push({kind:e,count:i.length-5})}return{rows:n,overflow:r}}function Ne({site:e,framework:t}){return(0,W.jsxs)(`dl`,{className:`pulse-facts`,children:[(0,W.jsxs)(`div`,{className:`pulse-fact`,children:[(0,W.jsx)(`dt`,{children:`Domain`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(`code`,{children:e.site.domain})})]}),c({framework:t})&&(0,W.jsxs)(`div`,{className:`pulse-fact`,children:[(0,W.jsx)(`dt`,{children:`Framework`}),(0,W.jsx)(`dd`,{children:c({framework:t})})]}),(0,W.jsxs)(`div`,{className:`pulse-fact`,children:[(0,W.jsx)(`dt`,{children:`Page cache`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(`code`,{children:e.cache.pages})})]})]})}function Pe({site:e,loading:t,framework:n,pageCollection:r}){return(0,W.jsxs)(`header`,{className:`pulse-header`,children:[(0,W.jsxs)(`div`,{className:`pulse-header-text`,children:[e&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h1`,{className:`pulse-title`,children:e.site.name}),(0,W.jsx)(Ne,{site:e,framework:n})]}),!e&&t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`h1`,{className:`pulse-title`,children:[(0,W.jsx)(`span`,{className:`pulse-skeleton pulse-skeleton--title`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`visually-hidden`,children:`Pulse`})]}),(0,W.jsx)(`span`,{className:`pulse-skeleton pulse-skeleton--facts`,"aria-hidden":`true`})]}),!e&&!t&&(0,W.jsx)(`h1`,{className:`pulse-title`,children:`Pulse`})]}),r&&(0,W.jsxs)(k,{to:ne(r.name),className:T(`primary`),children:[(0,W.jsx)(x,{className:`ui-button-icon`,"aria-hidden":`true`}),`New page`]})]})}function Fe({meta:e,fields:t}){let n=t.title;return{collection:e.collection,slug:e.slug,locale:e.locale,title:M(n)?String(n):e.slug,status:ie(e),version:e.version,liveVersion:e.liveVersion,updatedAt:e.createdAt,metaDescription:j(t)}}function Ie(e,t){return{pageCollections:new Set(e.filter(e=>e.pages).map(e=>e.name)),defaultLocale:t}}function Le(e,t){return e.filter(e=>t.pageCollections.has(e.collection)&&e.locale===t.defaultLocale)}function Re(e){return{pages:e.length,live:e.filter(e=>e.status!==`draft`).length,ahead:e.filter(e=>e.status===`ahead`).length}}function ze(e){let t=t=>e.filter(e=>e.metaDescription===t).length;return{pages:e.length,covered:t(`covered`),fallback:t(`fallback`),missing:t(`missing`)}}var Be=3;function Ve(e){let t=e.filter(N),n=new Map;for(let e of t)for(let t of new Set(e.features.map(e=>e.type)))n.set(t,(n.get(t)??0)+1);let r=[...n.entries()].sort(([e,t],[n,r])=>r-t||e.localeCompare(n)).slice(0,Be).map(([e])=>e);return{pages:e.length,valid:t.length,mainTypes:r}}function He(e,t,n){return e.filter(e=>e.name!==oe).map(e=>{let r=t.filter(t=>t.collection===e.name&&t.locale===n),i=e=>r.filter(t=>t.status===e).length;return{collection:e,live:i(`live`),ahead:i(`ahead`),draft:i(`draft`)}})}function Q(){return(0,W.jsx)(`div`,{className:`pulse-figure`,children:(0,W.jsxs)(`div`,{className:`pulse-figure-body`,children:[(0,W.jsx)(`span`,{className:`pulse-skeleton pulse-skeleton--label`}),(0,W.jsx)(`span`,{className:`pulse-skeleton pulse-skeleton--number`}),(0,W.jsx)(`span`,{className:`pulse-skeleton pulse-skeleton--line`})]})})}var Ue=[`first`,`second`,`third`,`fourth`];function $({title:e,rows:t}){return(0,W.jsxs)(`div`,{className:`pulse-panel`,children:[(0,W.jsx)(`div`,{className:`pulse-panel-head`,children:(0,W.jsx)(`p`,{className:`pulse-panel-title`,children:e})}),Ue.slice(0,t).map(e=>(0,W.jsxs)(`div`,{className:`pulse-skeleton-row`,children:[(0,W.jsx)(`span`,{className:`pulse-skeleton pulse-skeleton--line`}),(0,W.jsx)(`span`,{className:`pulse-skeleton pulse-skeleton--short`})]},e))]})}function We(){return(0,W.jsxs)(`div`,{className:`pulse-skeleton-frame`,"aria-hidden":`true`,children:[(0,W.jsxs)(`div`,{className:`pulse-figures`,children:[(0,W.jsx)(Q,{}),(0,W.jsx)(Q,{}),(0,W.jsx)(Q,{})]}),(0,W.jsxs)(`div`,{className:`pulse-columns`,children:[(0,W.jsx)($,{title:`Needs attention`,rows:3}),(0,W.jsx)($,{title:`Collections`,rows:3})]}),(0,W.jsx)($,{title:`Recent activity`,rows:4})]})}var Ge={created:{tone:`neutral`,icon:x},saved:{tone:`neutral`,icon:R},published:{tone:`accent`,icon:S}};function Ke({entry:e,defaultLocale:t,now:n}){let{document:r,event:i}=e,a=r.locale===t?void 0:r.locale,o=Ge[i];return(0,W.jsxs)(`li`,{className:`activity-row`,children:[(0,W.jsx)(k,{to:f(r.collection,r.slug,a),className:`activity-slug`,children:r.slug}),(0,W.jsxs)(`span`,{className:`activity-collection`,children:[r.collection===`globals`?`Layout`:l(r.collection),a&&(0,W.jsx)(`code`,{className:`activity-locale`,children:a})]}),(0,W.jsx)(`span`,{className:`activity-event`,children:(0,W.jsx)(ue,{tone:o.tone,icon:o.icon,children:F[i]})}),(0,W.jsx)(`time`,{className:`activity-time`,dateTime:r.updatedAt,title:new Date(r.updatedAt).toLocaleString(),children:P(r.updatedAt,n)})]})}function qe({entries:e,defaultLocale:t,now:n}){return(0,W.jsxs)(`section`,{className:`pulse-panel`,"aria-labelledby":`pulse-activity-title`,children:[(0,W.jsx)(`div`,{className:`pulse-panel-head`,children:(0,W.jsx)(`h2`,{id:`pulse-activity-title`,children:`Recent activity`})}),e.length===0?(0,W.jsx)(O,{icon:se,title:`No activity yet`,children:`New documents, saved drafts and publishes show up here.`}):(0,W.jsx)(`ol`,{className:`activity-list`,children:e.map(e=>(0,W.jsx)(Ke,{entry:e,defaultLocale:t,now:n},`${e.document.collection}/${e.document.slug}/${e.document.locale}`))})]})}async function Je(e){return(await pe()).filter(t=>e.includes(t.meta.locale)).map(Fe)}async function Ye(){let{deliveries:e,total:t}=await ce({status:`failed`,limit:1});return{total:t,latest:e[0]??null}}async function Xe(e){let[n,r,i]=await Promise.all([te(),p(),d()]),[a,o,s,c,l]=await Promise.all([Je(i.supportedLocales),w(!0,_),w(u(e,`seo`),async()=>(await t()).pages),w(u(e,`webhookDeliveries`),Ye),w(ae(i),async()=>(await re()).collections)]);return{site:n,locales:i,collections:r,documents:a,locks:o,findings:s,deliveries:c,translations:l}}function Ze(){let e=s(),[t,n]=(0,U.useState)({state:`loading`}),[r,i]=(0,U.useState)(0);return(0,U.useEffect)(()=>{let t=!0;return n({state:`loading`}),Xe(e).then(e=>{t&&n({state:`ready`,data:e})}).catch(e=>{t&&n({state:`error`,message:g(e,`Pulse could not load`)})}),()=>{t=!1}},[e,r]),{pulse:t,reload:(0,U.useCallback)(()=>i(e=>e+1),[])}}function Qe(e){let t=[`unpublished changes`,`edit locks`,`pages without a meta description`];e.deliveries.state!==`off`&&t.unshift(`failed webhook deliveries`),e.translations.state!==`off`&&t.push(`missing locale versions`);let n=t.pop(),r=`${t.join(`, `)} and ${n}`;return r.charAt(0).toUpperCase()+r.slice(1)}function $e(e){return[[e.locks,`edit locks`],[e.deliveries,`webhook deliveries`],[e.translations,`locale versions`]].filter(([e])=>e.state===`failed`).map(([,e])=>e)}function et(e,t){return(0,U.useMemo)(()=>{let n=Date.now(),r=Ie(e.collections,e.locales.defaultLocale),i=Le(e.documents,r),a=C(e.locks),o=e.findings;return{now:n,live:Re(i),coverage:ze(i),structuredData:o.state===`ok`?{state:`ok`,value:Ve(o.value)}:o,attention:Me({documents:e.documents,scope:r,locks:a?v(a,t,n):null,deliveries:C(e.deliveries),translations:C(e.translations)}),collections:He(e.collections,e.documents,r.defaultLocale),activity:I(e.documents)}},[e,t])}function tt({data:e,user:t}){let n=et(e,t);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ye,{live:n.live,coverage:n.coverage,structuredData:n.structuredData}),(0,W.jsxs)(`div`,{className:`pulse-columns`,children:[(0,W.jsx)(we,{attention:n.attention,watched:Qe(e),unread:$e(e)}),(0,W.jsx)(ge,{collections:n.collections})]}),(0,W.jsx)(qe,{entries:n.activity,defaultLocale:e.locales.defaultLocale,now:n.now})]})}function nt({message:e,onRetry:t}){return(0,W.jsx)(`div`,{className:`pulse-panel`,role:`alert`,children:(0,W.jsx)(O,{icon:r,title:`Pulse could not load`,action:(0,W.jsx)(E,{icon:n,onClick:t,children:`Try again`}),children:e})})}function rt(){let{pulse:e,reload:t}=Ze(),{user:n,hasRole:r}=o(),i=s(),a=e.state===`ready`?e.data:null,c=r(`editor`)?a?.collections.find(e=>e.pages)??null:null;return(0,W.jsxs)(`div`,{className:`pulse`,"aria-busy":e.state===`loading`,children:[(0,W.jsx)(Pe,{site:a?.site??null,loading:e.state===`loading`,framework:i.framework,pageCollection:c}),e.state===`loading`&&(0,W.jsx)(`p`,{className:`visually-hidden`,role:`status`,children:`Loading Pulse…`}),e.state===`error`&&(0,W.jsx)(nt,{message:e.message,onRetry:t}),e.state===`loading`&&(0,W.jsx)(We,{}),a&&(0,W.jsx)(tt,{data:a,user:n})]})}export{rt as PulsePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});export{l as i,s as n,u as r,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BklFHeMd.js";var t={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./clike-BlGBRct5.js";t.displayName=`ruby`,t.aliases=[`rb`];function t(t){t.register(e),(function(e){e.languages.ruby=e.languages.extend(`clike`,{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore(`ruby`,`operator`,{"double-colon":{pattern:/::/,alias:`punctuation`}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:`punctuation`}}};delete e.languages.ruby.function;var n=`(?:([^a-zA-Z0-9\\s{(\\[<=])(?:(?!\\1)[^\\\\]|\\\\[\\s\\S])*\\1|\\((?:[^()\\\\]|\\\\[\\s\\S]|\\((?:[^()\\\\]|\\\\[\\s\\S])*\\))*\\)|\\{(?:[^{}\\\\]|\\\\[\\s\\S]|\\{(?:[^{}\\\\]|\\\\[\\s\\S])*\\})*\\}|\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S]|\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S])*\\])*\\]|<(?:[^<>\\\\]|\\\\[\\s\\S]|<(?:[^<>\\\\]|\\\\[\\s\\S])*>)*>)`,r=`(?:"(?:\\\\.|[^"\\\\\\r\\n])*"|(?:\\b[a-zA-Z_]\\w*|[^\\s\\0-\\x7F]+)[?!]?|\\$.)`;e.languages.insertBefore(`ruby`,`keyword`,{"regex-literal":[{pattern:RegExp(`%r`+n+`[egimnosux]{0,6}`),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(`(^|[^:]):`+r),lookbehind:!0,greedy:!0},{pattern:RegExp(`([\\r\\n{(,][ \\t]*)`+r+`(?=:(?!:))`),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore(`ruby`,`string`,{"string-literal":[{pattern:RegExp(`%[qQiIwWs]?`+n),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:`heredoc-string`,greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:`heredoc-string`,greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(`%x`+n),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:`string`}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:`string`}}}]}),delete e.languages.ruby.string,e.languages.insertBefore(`ruby`,`number`,{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby})(t)}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BklFHeMd.js";var t={name:`save`,size:24,node:[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BklFHeMd.js";var t={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{i as r,n as i,t as a}from"./fill-run-view-Bx-nSvtd.js";import{A as o,E as s,G as c,I as l,K as u,O as d,Ot as f,R as p,T as m,Tt as ee,V as te,W as ne,X as re,Z as ie,_ as ae,at as oe,b as se,ct as ce,d as h,dt as le,et as g,f as _,ft as ue,ht as de,k as v,nt as fe,o as pe,ot as me,pt as he,q as ge,rt as _e,s as y,v as ve,w as ye,y as be}from"./index-qiIlvPyv.js";import{i as b}from"./auth-CIpilSKF.js";import{n as xe,t as x}from"./use-loaded-DFUDFVFt.js";import{n as S,t as C}from"./createLucideIcon-BklFHeMd.js";import{t as w}from"./trash-DzRCm500.js";import{t as T}from"./action-button-DIrhqMRc.js";import{c as Se,o as Ce,y as we}from"./api-seo-Cjv4a9Y_.js";import{t as Te}from"./list-checks-BCEhMMVY.js";import{a as Ee,i as De,n as Oe,r as ke,s as Ae,t as je,u as Me}from"./fill-job-B-Z4jnVQ.js";import{d as Ne,l as Pe,n as Fe,r as E,t as D,u as Ie}from"./format-C3ZX9yGM.js";import{t as O}from"./data-table-B1kqxrEw.js";import{t as Le}from"./empty-state-CeUZocHx.js";import{r as Re,t as ze}from"./vendor-router-B4czwg8X.js";import{t as Be}from"./guards-BFEDbduR.js";import{t as Ve}from"./source-CGZGd3Xy.js";import{t as He}from"./pencil-xdGZtrO4.js";import{t as Ue}from"./copy-V85khWct.js";import{t as We}from"./clock-DoBIVjZO.js";import{t as Ge}from"./send-kYpW5JED.js";import{i as k,t as Ke}from"./api-client-BRi_ki2Y.js";import{t as qe}from"./use-locale-versions-DHt-x8c_.js";var Je={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};Je.node;var Ye=C(Je),Xe={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};Xe.node;var Ze=C(Xe),Qe={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Qe.node;var $e=C(Qe),et={name:`list-tree`,size:24,node:[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]};et.node;var tt=C(et),nt={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};nt.node;var rt=C(nt),it={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};it.node;var at=C(it),ot={name:`refresh-ccw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]};ot.node;var st=C(ot),ct={name:`user-plus`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]};ct.node;var lt=C(ct);async function ut(){let{users:e}=await k(`/users`);return e}async function dt(e){return k(`/users`,{method:`POST`,body:JSON.stringify(e)})}async function A(e,t){return k(`/users/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(t)})}async function ft(e){await k(`/users/${encodeURIComponent(e)}`,{method:`DELETE`})}var pt={anthropic:{label:`Claude`,vendor:`Anthropic`,format:`anthropic`,baseUrl:`https://api.anthropic.com`,defaultModel:`claude-haiku-4-5`,chatPath:`/v1/messages`,maxTokensParam:`max_tokens`,forbidTools:`tool_choice`,openObjects:`native`},"claude-code":{label:`Claude Code`,vendor:`Anthropic`,format:`anthropic`,baseUrl:`https://api.anthropic.com`,defaultModel:`claude-haiku-4-5-20251001`,chatPath:`/v1/messages`,maxTokensParam:`max_tokens`,forbidTools:`tool_choice`,openObjects:`native`},openai:{label:`ChatGPT`,vendor:`OpenAI`,format:`openai`,baseUrl:`https://api.openai.com`,defaultModel:`gpt-4o`,chatPath:`/v1/chat/completions`,maxTokensParam:`max_completion_tokens`,forbidTools:`tool_choice`,openObjects:`native`,reasoningParam:`reasoning_effort`},gemini:{label:`Gemini`,vendor:`Google`,format:`openai`,baseUrl:`https://generativelanguage.googleapis.com/v1beta/openai`,defaultModel:`gemini-3.6-flash`,chatPath:`/chat/completions`,maxTokensParam:`max_tokens`,forbidTools:`tool_choice`,openObjects:`json_string`,reasoningParam:`reasoning_effort`},openrouter:{label:`OpenRouter`,vendor:`OpenRouter`,format:`openai`,baseUrl:`https://openrouter.ai/api`,defaultModel:`anthropic/claude-haiku-4.5`,chatPath:`/v1/chat/completions`,maxTokensParam:`max_tokens`,forbidTools:`tool_choice`,openObjects:`native`,reasoningParam:`reasoning`},ollama:{label:`Ollama`,vendor:`Ollama (on your own computer)`,format:`openai`,baseUrl:`http://localhost:11434`,defaultModel:`llama3.1`,chatPath:`/v1/chat/completions`,maxTokensParam:`max_tokens`,forbidTools:`omit_tools`,openObjects:`native`,reasoningParam:`reasoning_effort`}},j=e(n(),1),mt=`claude-code`,ht=[`openrouter`,mt,`ollama`];function gt(e){return Object.hasOwn(pt,e)}function M(e){return gt(e)?pt[e]:null}function N(e){return M(e)?.label??e}function _t(e){return M(e)?.vendor??e}function vt(e){return ht.includes(e)}function yt(e){return e.providers.filter(e=>e.ready).sort((e,t)=>Number(t.active)-Number(e.active))}function bt(e){return e.providers.filter(e=>!e.ready&&!vt(e.provider))}function xt(e){return e.providers.filter(e=>!e.ready&&vt(e.provider))}function St(e,t=!0){return!e.configured||!e.provider?t?`AI help is off. Add a key below to turn it on.`:`AI help is off. An admin can add a key to turn it on.`:`AI help is on, using ${N(e.provider)}.`}function Ct(e){return!e.configured||!e.provider?`The AI`:`${N(e.provider)} · ${e.model??`its default model`}`}function wt(e){return e===`saved`?`Key saved here, encrypted.`:e===`environment`||e===`configuration`?`Set up by your developer.`:`Runs on your own computer.`}var Tt=/401|403|unauthori[sz]ed|invalid|incorrect|api[ -]?key|permission/i;function Et(e,t){let n=N(e);return t.success?`${n} works: it answered.`:Tt.test(t.error??``)?`${n} did not accept the key. Check that you copied all of it.`:`${n} did not answer: ${t.error??`no reason given`}.`}function P(){let[e,t]=(0,j.useState)(!1),n=(0,j.useRef)(!1);async function r(e){if(!n.current){n.current=!0,t(!0);try{await e()}finally{n.current=!1,t(!1)}}}return{busy:e,once:r}}function F(){let{busy:e,once:t}=P(),[n,r]=(0,j.useState)(null);return{busy:e,error:n,setError:r,run:(e,n)=>t(async()=>{r(null);try{await e()}catch(e){r(_(e,n))}})}}function Dt(e){let t=g(),{busy:n,once:r}=P();function i(e,n){r(async()=>{try{await e()}catch(e){t({text:_(e,n),tone:`error`})}})}async function a(e){let n=await d(e);t({text:Et(e,n),tone:n.success?`success`:`error`})}return{busy:n,turnOn:t=>i(async()=>{e(await v(t)),await a(t.provider)},`The key could not be saved`),use:n=>i(async()=>{e(await v({provider:n,use:!0})),t({text:`The site now uses ${N(n)}.`})},`The AI could not be changed`),save:n=>i(async()=>{e(await v(n)),t({text:`Saved the settings for ${N(n.provider)}.`})},`The settings could not be saved`),test:e=>i(()=>a(e),`The test failed`)}}var I=t();function L({title:e,children:t,confirmLabel:n,danger:r=!1,onConfirm:i,onClose:a}){let o=(0,j.useRef)(null),{busy:s,error:c,run:l}=F(),u=s?()=>void 0:a;return(0,I.jsxs)(h,{title:e,onClose:u,actions:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(S,{ref:o,onClick:u,"aria-disabled":s,children:`Cancel`}),(0,I.jsx)(S,{variant:r?`danger`:`primary`,"aria-disabled":s,onClick:()=>void l(i,`It did not work`),children:s?`Working…`:n})]}),initialFocus:o,busy:s,children:[(0,I.jsx)(`div`,{className:`setup-confirm`,children:t}),c&&(0,I.jsx)(R,{text:c})]})}function R({text:e}){return(0,I.jsx)(`p`,{role:`alert`,className:`setup-note setup-note--error`,children:e})}function Ot({id:e,label:t,hint:n,children:r}){return(0,I.jsxs)(`div`,{className:`setup-field`,children:[(0,I.jsx)(`label`,{htmlFor:e,children:t}),r,n&&(0,I.jsx)(`span`,{id:`${e}-hint`,className:`setup-hint`,children:n})]})}function z({label:e,value:t,onChange:n,disabled:r=!1,hint:i,type:a=`text`,placeholder:o}){let s=(0,j.useId)();return(0,I.jsx)(Ot,{id:s,label:e,hint:i,children:(0,I.jsx)(`input`,{id:s,type:a,className:`setup-input`,value:t,disabled:r,placeholder:o,"aria-describedby":i?`${s}-hint`:void 0,onChange:e=>n(e.target.value)})})}function B({label:e,value:t,onChange:n,disabled:r=!1,hint:i,options:a}){let o=(0,j.useId)(),s=e=>{let t=a.find(t=>t.value===e);t&&n(t.value)};return(0,I.jsx)(Ot,{id:o,label:e,hint:i,children:(0,I.jsx)(`select`,{id:o,className:`setup-input`,value:t,disabled:r,"aria-describedby":i?`${o}-hint`:void 0,onChange:e=>s(e.target.value),children:a.map(e=>(0,I.jsx)(`option`,{value:e.value,children:e.label},e.value))})})}function kt({label:e,checked:t,onChange:n}){return(0,I.jsxs)(`label`,{className:`setup-check`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked)}),e]})}function At({provider:e}){return(0,I.jsxs)(`div`,{className:`ai-card-title`,children:[(0,I.jsx)(`h3`,{className:`ai-card-name`,children:N(e)}),(0,I.jsx)(`span`,{className:`setup-muted`,children:_t(e)})]})}function jt({provider:e,onRemoved:t,onClose:n}){let r=g();async function i(){t(await ye(e)),r({text:`Removed the saved key for ${N(e)}.`}),n()}return(0,I.jsx)(L,{title:`Remove the key for ${N(e)}?`,confirmLabel:`Remove key`,danger:!0,onConfirm:i,onClose:n,children:(0,I.jsx)(`p`,{children:`The key saved here is deleted, and it cannot be shown again: you would have to paste it anew. A key set up by your developer is not touched.`})})}function Mt({status:e,actions:t}){let n=M(e.provider),[r,i]=(0,j.useState)(e.model??``),[a,o]=(0,j.useState)(e.baseUrl??``),s=e.provider===mt;return(0,I.jsxs)(`details`,{className:`ai-advanced`,children:[(0,I.jsx)(`summary`,{children:`Advanced`}),(0,I.jsxs)(`div`,{className:`setup-stack`,children:[(0,I.jsx)(z,{label:`Model`,value:s?n?.defaultModel??``:r,onChange:i,disabled:s,placeholder:n?.defaultModel,hint:s?`Fixed: this one runs a single model.`:`Empty uses the default model.`}),(0,I.jsx)(z,{label:`Address`,type:`url`,value:a,onChange:o,placeholder:n?.baseUrl,hint:`Only for a proxy or your own server. Empty uses the usual address.`}),(0,I.jsx)(`div`,{className:`setup-actions`,children:(0,I.jsx)(S,{"aria-disabled":t.busy,onClick:()=>t.save({provider:e.provider,model:r,baseUrl:a}),children:`Save`})})]})]})}function Nt({status:e,actions:t,readOnly:n,onChange:r}){let[i,a]=(0,j.useState)(!1),o=t.busy?`Working…`:null;return(0,I.jsxs)(`li`,{className:`ai-card ai-card--on`,children:[(0,I.jsxs)(`div`,{className:`ai-card-head`,children:[(0,I.jsx)(At,{provider:e.provider}),e.active&&(0,I.jsx)(y,{tone:`success`,icon:xe,children:`In use`})]}),(0,I.jsx)(`p`,{className:`setup-note`,children:wt(e.keySource)}),!n&&(0,I.jsxs)(`div`,{className:`setup-actions`,children:[!e.active&&(0,I.jsx)(T,{variant:`primary`,icon:at,reason:o,onClick:()=>t.use(e.provider),children:`Use this one`}),(0,I.jsx)(T,{icon:rt,reason:o,onClick:()=>t.test(e.provider),children:`Test`}),e.keySource===`saved`&&(0,I.jsx)(S,{variant:`ghost`,icon:w,onClick:()=>a(!0),children:`Remove key`})]}),!n&&(0,I.jsx)(Mt,{status:e,actions:t}),i&&(0,I.jsx)(jt,{provider:e.provider,onRemoved:r,onClose:()=>a(!1)})]})}function Pt({status:e,actions:t}){let[n,r]=(0,j.useState)(``),i=N(e.provider),a=()=>{t.turnOn({provider:e.provider,apiKey:n}),r(``)},o=t.busy?`Working…`:n.trim()===``?`Paste the key first.`:null;return(0,I.jsxs)(`li`,{className:`ai-card`,children:[(0,I.jsx)(`div`,{className:`ai-card-head`,children:(0,I.jsx)(At,{provider:e.provider})}),(0,I.jsx)(z,{label:`${i} key`,type:`password`,value:n,onChange:r,hint:`Paste the key from ${_t(e.provider)}. It is saved encrypted and never shown again.`}),(0,I.jsx)(`div`,{className:`setup-actions`,children:(0,I.jsx)(T,{variant:`primary`,icon:$e,reason:o,onClick:a,children:`Turn on`})})]})}function Ft({status:e}){return(0,I.jsxs)(`li`,{className:`ai-card`,children:[(0,I.jsx)(`h3`,{className:`ai-card-name`,children:N(e.provider)}),(0,I.jsxs)(`p`,{className:`setup-note`,children:[`Runs on your Claude subscription, on your own machine only. Set the token`,` `,(0,I.jsx)(`code`,{children:`claude setup-token`}),` prints as `,(0,I.jsx)(`code`,{children:e.env}),`, and restart the site.`]})]})}function It({status:e,actions:t}){let n=M(e.provider),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``);return(0,I.jsxs)(`li`,{className:`ai-card`,children:[(0,I.jsx)(`h3`,{className:`ai-card-name`,children:N(e.provider)}),(0,I.jsx)(`p`,{className:`setup-note`,children:`Runs a model on your own computer. It needs no key.`}),(0,I.jsx)(z,{label:`Model`,value:r,onChange:i,placeholder:n?.defaultModel}),(0,I.jsx)(z,{label:`Address`,type:`url`,value:a,onChange:o,placeholder:n?.baseUrl}),(0,I.jsx)(`div`,{className:`setup-actions`,children:(0,I.jsx)(S,{variant:`primary`,"aria-disabled":t.busy,onClick:()=>t.save({provider:e.provider,model:r,baseUrl:a,use:!0}),children:`Turn on`})})]})}function Lt({status:e,actions:t}){return e.provider===`claude-code`?(0,I.jsx)(Ft,{status:e}):e.provider===`ollama`?(0,I.jsx)(It,{status:e,actions:t}):(0,I.jsx)(Pt,{status:e,actions:t})}function Rt({settings:e,providers:t,actions:n}){let r=e.providers.filter(e=>e.env!==``);return(0,I.jsxs)(`details`,{className:`ai-developer`,children:[(0,I.jsx)(`summary`,{children:`For developers`}),(0,I.jsxs)(`div`,{className:`setup-stack`,children:[t.length>0&&(0,I.jsx)(`ul`,{className:`ai-cards`,children:t.map(e=>(0,I.jsx)(Lt,{status:e,actions:n},e.provider))}),(0,I.jsxs)(`div`,{className:`setup-prose`,children:[(0,I.jsx)(`p`,{children:`A key can also be set in the environment of the machine that runs the site. A provider with a key there turns on at the next start, and no key is saved in the database.`}),(0,I.jsx)(`ul`,{className:`ai-variables`,children:r.map(e=>(0,I.jsxs)(`li`,{children:[N(e.provider),`: `,(0,I.jsx)(`code`,{children:e.env})]},e.provider))})]})]})]})}var zt={config:{icon:Ze,label:`Configuration`},database:{icon:Ye,label:`Database`},server:{icon:_e,label:`Server`}};function V({source:e,children:t}){let{icon:n,label:r}=zt[e];return(0,I.jsxs)(`p`,{className:`setup-source`,children:[(0,I.jsx)(y,{icon:n,children:r}),(0,I.jsx)(`span`,{children:t})]})}function H({title:e,sources:t,actions:n,children:r}){let i=(0,j.useId)();return(0,I.jsxs)(`section`,{className:`setup-section`,"aria-labelledby":i,children:[(0,I.jsxs)(`div`,{className:`setup-section-head`,children:[(0,I.jsx)(`h2`,{id:i,className:`setup-section-title`,children:e}),n&&(0,I.jsx)(`div`,{className:`setup-actions`,children:n})]}),(0,I.jsx)(`div`,{className:`setup-sources`,children:t}),r]})}function U({children:e,tone:t=`muted`}){return(0,I.jsx)(`p`,{className:t===`error`?`setup-note setup-note--error`:`setup-note`,children:e})}function W({what:e}){return(0,I.jsxs)(U,{children:[`Reading `,e,`…`]})}function G({message:e,onRetry:t}){return(0,I.jsxs)(`div`,{role:`alert`,className:`setup-row`,children:[(0,I.jsx)(U,{tone:`error`,children:e}),(0,I.jsx)(S,{size:`sm`,icon:we,onClick:t,children:`Try again`})]})}var Bt=new Map([[je,`Fill missing SEO`],[ke,`Meta only`],[Oe,`Force regenerate`]]);function Vt(e){return e.scope===`collection`?`${D(e.collection)}`:`the whole site`}function Ht(e){let t=e.state===`idle`?`Enrichment`:Bt.get(e.plan)??`Enrichment`;return e.state===`failed`?{text:`${t} failed: ${e.message}`,tone:`error`}:{text:`${t} finished. Setup › AI provider lists what each step did.`}}function Ut(){return(0,I.jsxs)(`div`,{className:`setup-prose`,children:[(0,I.jsxs)(`p`,{children:[(0,I.jsx)(`strong`,{children:`Fill missing SEO`}),` writes meta descriptions and the Schema.org properties no one has set. `,(0,I.jsx)(`strong`,{children:`Meta only`}),` writes only the missing meta descriptions. Neither overwrites a value someone set. `,(0,I.jsx)(`strong`,{children:`Force regenerate`}),` writes both over every value, the editors' own included.`]}),(0,I.jsx)(`p`,{children:`What a run writes is saved at once: each meta description as a new version of its document and in the document's SEO settings, the Schema.org properties in those settings. The SEO settings have no versions, so the live pages' meta descriptions and structured data change straight away. A document someone else is editing keeps its meta description.`})]})}function Wt({scope:e,model:t,onConfirm:n,onClose:r}){return(0,I.jsxs)(L,{title:`Force regenerate SEO for ${Vt(e)}?`,confirmLabel:`Overwrite and regenerate`,danger:!0,onConfirm:n,onClose:r,children:[(0,I.jsxs)(`p`,{children:[t,` writes a new meta description and new Schema.org properties for every document in`,` `,Vt(e),`. It`,` `,(0,I.jsx)(`strong`,{children:`overwrites the values there now, the editors' own included`}),`.`]}),(0,I.jsx)(`p`,{children:`Each meta description is saved as a new version of its document and in the document's SEO settings; the Schema.org properties are written to those settings, which have no versions. The live pages' meta descriptions and structured data change at once: this is not a draft, there is nothing to publish first, and the SEO settings keep no earlier values to go back to. A document someone else is editing keeps its meta description.`})]})}function Gt(e,t,n){return e.state===`running`?`Enrichment is running.`:t?n?null:`Add an AI key first.`:`Enrichment is run by an admin.`}function Kt({reason:e,onRun:t,onForce:n}){return(0,I.jsxs)(`div`,{className:`setup-actions`,children:[(0,I.jsx)(T,{variant:`primary`,icon:Me,reason:e,onClick:()=>t(je),children:`Fill missing SEO`}),(0,I.jsx)(T,{icon:Te,reason:e,onClick:()=>t(ke),children:`Meta only`}),(0,I.jsx)(T,{variant:`danger`,icon:st,reason:e,onClick:n,children:`Force regenerate…`})]})}function qt(){let{loaded:e}=x(te,`The collections could not be read`);return e.state===`ready`?e.data.filter(e=>e.pages):[]}var Jt=(0,I.jsx)(V,{source:`database`,children:`Writes to the documents and their SEO settings in the site's database, with the AI in use above.`});function Yt({configured:e,admin:t,model:n}){let r=g(),o=Ae(),s=qt(),[c,l]=(0,j.useState)({scope:`all`}),[u,d]=(0,j.useState)(!1);(0,j.useEffect)(()=>()=>De(),[]);let f=(0,j.useCallback)(e=>Ee(c,e=>r(Ht(e)),e),[c,r]),p=Gt(o,t,e),m=o.state===`running`;return(0,I.jsxs)(H,{title:`Run across the site`,sources:Jt,children:[(0,I.jsx)(Ut,{}),(0,I.jsx)(i,{collections:s,value:c,disabled:m,onChange:l}),(0,I.jsx)(Kt,{reason:p,onRun:f,onForce:()=>d(!0)}),p&&!m&&(0,I.jsx)(`p`,{className:`setup-note`,children:p}),(0,I.jsx)(a,{run:o}),u&&(0,I.jsx)(Wt,{scope:c,model:n,onClose:()=>d(!1),onConfirm:async()=>{d(!1),f(Oe)||r({text:`Another run is going across the site, so Force regenerate did not start. Try again when it ends.`,tone:`error`})}})]})}function Xt({settings:e,readOnly:t,onChange:n}){let r=Dt(n),i=yt(e),a=bt(e);return(0,I.jsxs)(I.Fragment,{children:[i.length>0&&(0,I.jsxs)(`section`,{className:`ai-group`,"aria-labelledby":`ai-configured`,children:[(0,I.jsx)(`h3`,{id:`ai-configured`,className:`ai-group-title`,children:`Ready to use`}),(0,I.jsx)(`ul`,{className:`ai-cards`,children:i.map(e=>(0,I.jsx)(Nt,{status:e,actions:r,readOnly:t,onChange:n},e.provider))})]}),!t&&a.length>0&&(0,I.jsxs)(`section`,{className:`ai-group`,"aria-labelledby":`ai-available`,children:[(0,I.jsx)(`h3`,{id:`ai-available`,className:`ai-group-title`,children:i.length>0?`Add another`:`Add a key to turn one on`}),(0,I.jsx)(`ul`,{className:`ai-cards`,children:a.map(e=>(0,I.jsx)(Pt,{status:e,actions:r},e.provider))})]}),!t&&(0,I.jsx)(Rt,{settings:e,providers:xt(e),actions:r})]})}function Zt(){let e=b().hasRole(`admin`),{loaded:t,reload:n}=x(m,`The AI provider could not be read`),[r,i]=(0,j.useState)(null);if(t.state===`loading`)return(0,I.jsx)(W,{what:`the AI provider`});if(t.state===`error`)return(0,I.jsx)(G,{message:t.message,onRetry:n});let a=r??t.data;return(0,I.jsxs)(`div`,{className:`setup-stack`,children:[(0,I.jsxs)(H,{title:`AI help`,sources:(0,I.jsx)(`p`,{className:`setup-source`,children:`An AI turns on when it has a key. Pick the one the site uses; the assistant lets editors pick another.`}),children:[(0,I.jsx)(`p`,{className:a.configured?`ai-status ai-status--on`:`ai-status`,role:`status`,children:St(a,e)}),(0,I.jsx)(Xt,{settings:a,readOnly:!e,onChange:i}),a.assistantProvider&&(0,I.jsxs)(`p`,{className:`setup-note`,children:[`The assistant is set to `,N(a.assistantProvider),` in the site's configuration.`]})]}),(0,I.jsx)(Yt,{configured:a.configured,admin:e,model:Ct(a)})]})}var Qt={manual:`By hand`,"pre-restore":`Before a restore`,"pre-migration":`Before a migration`,"pre-import":`Before an import`};function K(e){return e.name?`v${e.version} · ${e.name}`:`v${e.version}`}function $t({checkpoint:e,onDone:t,onClose:n}){let r=g(),i=K(e);async function a(){await se(e.version),r({text:`Restored ${i}. A safety checkpoint of the state before was taken first.`}),t()}return(0,I.jsxs)(L,{title:`Restore ${i}?`,confirmLabel:`Restore checkpoint`,danger:!0,onConfirm:a,onClose:n,children:[(0,I.jsxs)(`p`,{children:[`Every document — the version being edited and the version that is live — the runtime fields and the media library's records go back to how they stood at`,` `,E(e.createdAt),`. Versions saved since stay in each document's history but are no longer current.`]}),(0,I.jsxs)(`p`,{children:[`A safety checkpoint, `,(0,I.jsxs)(`code`,{children:[`pre-restore-v`,e.version]}),`, is taken first, so you can return to how things are now. Settings, SEO configuration and people are not rewound.`]}),(0,I.jsx)(`p`,{children:`Every cached page is marked stale: its next visit may still get the old page while it is rendered again.`})]})}function en({checkpoint:e,onDone:t,onClose:n}){let r=g(),i=K(e);async function a(){await ve(e.version),r({text:`Deleted ${i}.`}),t()}return(0,I.jsx)(L,{title:`Delete ${i}?`,confirmLabel:`Delete checkpoint`,danger:!0,onConfirm:a,onClose:n,children:(0,I.jsx)(`p`,{children:`It can no longer be restored. The content stays as it is.`})})}function tn(e,t){return[{id:`name`,header:`Checkpoint`,primary:!0,cell:e=>K(e)},{id:`trigger`,header:`Taken`,cell:e=>(0,I.jsx)(y,{children:Qt[e.trigger]})},{id:`created`,header:`Created`,cell:e=>E(e.createdAt)},{id:`actions`,header:`Actions`,cell:n=>e?(0,I.jsxs)(`span`,{className:`setup-row-actions`,children:[(0,I.jsx)(S,{size:`sm`,icon:oe,"aria-label":`Restore ${K(n)}`,onClick:()=>t({kind:`restore`,checkpoint:n}),children:`Restore`}),(0,I.jsx)(S,{size:`sm`,variant:`ghost`,icon:w,"aria-label":`Delete ${K(n)}`,onClick:()=>t({kind:`delete`,checkpoint:n}),children:`Delete`})]}):null}]}function nn({onCreated:e}){let t=g(),[n,r]=(0,j.useState)(``),[i,a]=(0,j.useState)(!1),o=(0,j.useRef)(!1);async function s(){if(!o.current){o.current=!0,a(!0);try{let i=await ae(n.trim()||void 0);t({text:`Created ${K(i)}.`}),r(``),e()}catch(e){t({text:_(e,`The checkpoint could not be created`),tone:`error`})}finally{o.current=!1,a(!1)}}}return(0,I.jsxs)(`form`,{className:`setup-inline-form`,onSubmit:e=>{e.preventDefault(),i||s()},children:[(0,I.jsx)(z,{label:`Name`,value:n,onChange:r,placeholder:`Before the spring relaunch`,hint:`Optional`}),(0,I.jsx)(S,{type:`submit`,variant:`primary`,icon:de,"aria-disabled":i,children:i?`Creating…`:`Create checkpoint`})]})}function rn(){return(0,I.jsx)(V,{source:`database`,children:`Stored in the site's database. A checkpoint marks a point in time and copies nothing; restoring one rewinds to it. The API lists each checkpoint's number, name, what took it and when — not its size or the schema version it was taken under.`})}function an(){let{hasRole:e}=b(),{loaded:t,reload:n}=x(be,`The checkpoints could not be read`),[r,i]=(0,j.useState)(null),a=()=>i(null),o=()=>{a(),n()};return(0,I.jsxs)(H,{title:`Checkpoints`,sources:(0,I.jsx)(rn,{}),children:[e(`editor`)?(0,I.jsx)(nn,{onCreated:n}):(0,I.jsx)(U,{children:`Editors and admins create checkpoints.`}),t.state===`loading`&&(0,I.jsx)(W,{what:`the checkpoints`}),t.state===`error`&&(0,I.jsx)(G,{message:t.message,onRetry:n}),t.state===`ready`&&t.data.length===0&&(0,I.jsx)(Le,{icon:de,title:`No checkpoints yet`,children:`Create one to mark the content store as it is now, so you can return to it.`}),t.state===`ready`&&t.data.length>0&&(0,I.jsx)(O,{caption:`Checkpoints, newest first`,columns:tn(e(`admin`),i),rows:t.data,rowKey:e=>String(e.version)}),r?.kind===`restore`&&(0,I.jsx)($t,{checkpoint:r.checkpoint,onDone:o,onClose:a}),r?.kind===`delete`&&(0,I.jsx)(en,{checkpoint:r.checkpoint,onDone:o,onClose:a})]})}async function on(e){let[t,n,r]=await Promise.all([te(),Ve(e,Se),Ve(e,async()=>(await Ce()).types)]);return{collections:t,configs:n,catalog:r}}function sn(e,t){return e.state===`ok`?e.value.find(e=>e.id===`collection:${t}`)?.config.entities.map(e=>e[`@type`])??[]:null}function cn(e,t){if(e.state!==`ok`||t===null)return null;let n=e.value.filter(e=>t.includes(e.type)&&e.richResult!==null).filter(e=>e.richResultStatus===`active`||e.richResultStatus===`restricted`).map(e=>e.richResult??``);return[...new Set(n)]}function ln(e){return e.collections.map(t=>{let n=t.pages?sn(e.configs,t.name):[];return{collection:t,rendersAt:pe(t,`:slug`),types:n,richResults:t.pages?cn(e.catalog,n):[]}})}function un(e){return e==null?null:typeof e==`string`?e:JSON.stringify(e)}function dn(e){return e.enum?`enum`:e.format===`uri`?`url`:e.format===`email`?`email`:String(e.type??`string`)}function fn(e,t){let n=new Set(e.schema.required??[]),r=Object.entries(e.schema.properties??{}).filter(([,e])=>!(Be(e)&&e._runtime)).map(([e,t])=>({name:e,type:dn(t),required:n.has(e),description:t.description??null,defaultValue:un(t.default),source:`code`,runtime:null})),i=t.map(e=>({name:e.name,type:e.type,required:e.required,description:e.description??null,defaultValue:un(e.default),source:`runtime`,runtime:e}));return[...r,...i]}var pn=[`string`,`textarea`,`number`,`boolean`,`date`,`enum`,`url`,`email`,`color`,`reference`],mn={string:`text (one line)`,textarea:`text (long)`,number:`number`,boolean:`yes/no`,date:`date`,enum:`choice`,url:`web address`,email:`email`,color:`color`,reference:`link to a page`,integer:`number`,array:`list`,object:`group`};function hn(e){return mn[e]??e}var q=e=>e==null?``:String(e);function gn(e){return{name:e?.name??``,type:e?.type??`string`,required:e?.required??!1,description:e?.description??``,defaultValue:q(e?.default),enumValues:e?.enumValues?.join(`, `)??``,refCollection:e?.refCollection??``,min:q(e?.min),max:q(e?.max),pattern:e?.pattern??``}}function J(e){return e===`string`||e===`textarea`||e===`number`}function _n(e){let t=e.defaultValue.trim();if(t)return e.type===`number`?Number(t):e.type===`boolean`?t===`true`:t}function Y(e){return e.enumValues.split(`,`).map(e=>e.trim()).filter(Boolean)}function vn(e){let t=e.defaultValue.trim();return t?e.type===`number`&&!Number.isFinite(Number(t))?`The default is a number.`:e.type===`boolean`&&t!==`true`&&t!==`false`?`The default is true or false.`:e.type===`enum`&&!Y(e).includes(t)?`The default is one of the values.`:null:null}function yn(e){if(!J(e.type))return null;let[t,n]=[e.min.trim(),e.max.trim()];return[t,n].some(e=>e&&!Number.isFinite(Number(e)))?`Minimum and maximum are numbers.`:t&&n&&Number(t)>Number(n)?`The minimum is not above the maximum.`:null}function bn(e){let t=e.pattern.trim();if(e.type!==`string`||!t)return null;try{return new RegExp(t),null}catch{return`The pattern is not a valid regular expression.`}}function xn(e){let t=e.name.trim();return t?/^[a-z][a-z0-9_-]*$/i.test(t)?e.type===`reference`&&!e.refCollection?`Choose the collection it refers to.`:e.type===`enum`&&new Set(Y(e)).size<2?`Give the enum two different values or more.`:yn(e)??bn(e)??vn(e):`A name starts with a letter and holds only letters, digits, hyphens and underscores.`:`A field needs a name.`}function Sn(e){let t=Y(e),n={name:e.name.trim(),type:e.type,required:e.required},r=_n(e);return r!==void 0&&(n.default=r),e.description.trim()&&(n.description=e.description.trim()),e.type===`enum`&&t.length>0&&(n.enumValues=t),e.type===`reference`&&(n.refCollection=e.refCollection),J(e.type)&&e.min.trim()&&(n.min=Number(e.min)),J(e.type)&&e.max.trim()&&(n.max=Number(e.max)),e.type===`string`&&e.pattern.trim()&&(n.pattern=e.pattern.trim()),n}var Cn=pn.map(e=>({value:e,label:hn(e)}));function wn({form:e,set:t}){let n=e.type===`number`;return(0,I.jsxs)(`div`,{className:`setup-field-row`,children:[(0,I.jsx)(z,{label:n?`Minimum`:`Minimum length`,type:`number`,value:e.min,onChange:t(`min`)}),(0,I.jsx)(z,{label:n?`Maximum`:`Maximum length`,type:`number`,value:e.max,onChange:t(`max`)})]})}function Tn(e){let{form:t,set:n,collections:r}=e,i=[{value:``,label:`Choose a collection`},...r.map(e=>({value:e.name,label:D(e.name)}))];return(0,I.jsxs)(I.Fragment,{children:[t.type===`enum`&&(0,I.jsx)(z,{label:`Values`,value:t.enumValues,onChange:n(`enumValues`),hint:`Separated by commas`}),t.type===`reference`&&(0,I.jsx)(B,{label:`Refers to`,value:t.refCollection,options:i,onChange:n(`refCollection`)}),J(t.type)&&(0,I.jsx)(wn,{form:t,set:n}),t.type===`string`&&(0,I.jsx)(z,{label:`Pattern`,value:t.pattern,onChange:n(`pattern`),hint:`A regular expression the value must match`})]})}function En({form:e,set:t,editing:n,collections:r}){let i=n?`A field keeps its name`:`The key documents store its value under`;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(z,{label:`Name`,value:e.name,onChange:t(`name`),disabled:n,hint:i}),(0,I.jsx)(B,{label:`Type`,value:e.type,options:Cn,onChange:t(`type`),disabled:n,hint:n?`A field keeps its type`:void 0}),(0,I.jsx)(kt,{label:`Required`,checked:e.required,onChange:t(`required`)}),(0,I.jsx)(z,{label:`Description`,value:e.description,onChange:t(`description`),hint:`Shown to editors under the field`}),(0,I.jsx)(z,{label:`Default`,value:e.defaultValue,onChange:t(`defaultValue`)}),(0,I.jsx)(Tn,{form:e,set:t,collections:r})]})}function Dn(e){let{collection:t,field:n,collections:r,onSave:i,onClose:a}=e,o=(0,j.useId)(),[s,c]=(0,j.useState)(()=>gn(n)),l=e=>t=>c(n=>({...n,[e]:t})),{busy:u,error:d,setError:f,run:p}=F();function m(e){e.preventDefault();let t=xn(s);t?f(t):p(()=>i(Sn(s)),`The field could not be saved`)}let ee=n?`Edit ${n.name}`:`Add a runtime field to ${D(t)}`;return(0,I.jsx)(h,{title:ee,onClose:a,actions:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(S,{onClick:a,children:`Cancel`}),(0,I.jsx)(S,{variant:`primary`,type:`submit`,form:o,"aria-disabled":u,children:u?`Saving…`:`Save field`})]}),busy:u,children:(0,I.jsxs)(`form`,{id:o,className:`setup-form`,onSubmit:m,children:[d&&(0,I.jsx)(R,{text:d}),(0,I.jsx)(En,{form:s,set:l,editing:n!==null,collections:r})]})})}function On(e){let t=g();return async()=>{if(e!==null)try{await navigator.clipboard.writeText(e),t({text:`Copied the Zod schema.`})}catch{t({text:`The browser did not allow copying; select the code instead.`,tone:`error`})}}}function kn({collection:e,onClose:t}){let n=(0,j.useCallback)(async()=>(await p(e)).code,[e]),{loaded:r,reload:i}=x(n,`The schema could not be exported`),a=r.state===`ready`?r.data:null,o=On(a),s=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(S,{onClick:t,children:`Close`}),(0,I.jsx)(S,{variant:`primary`,icon:Ue,"aria-disabled":a===null,onClick:()=>void o(),children:`Copy`})]});return(0,I.jsxs)(h,{title:`${D(e)} as Zod`,onClose:t,actions:s,children:[(0,I.jsxs)(`p`,{className:`setup-note`,children:[`The code fields and the runtime fields as one Zod schema. Paste it into`,` `,(0,I.jsx)(`code`,{children:`krantho.collections.ts`}),` to make the runtime fields part of the code; code always wins over a runtime field of the same name.`]}),r.state===`loading`&&(0,I.jsx)(W,{what:`the schema`}),r.state===`error`&&(0,I.jsx)(G,{message:r.message,onRetry:i}),a!==null&&(0,I.jsx)(`section`,{className:`setup-code`,"aria-label":`Zod schema`,tabIndex:0,children:(0,I.jsx)(`pre`,{children:(0,I.jsx)(`code`,{children:a})})})]})}function An({field:e,onDialog:t}){return(0,I.jsxs)(`span`,{className:`setup-row-actions`,children:[(0,I.jsx)(S,{size:`sm`,icon:He,"aria-label":`Edit ${e.name}`,onClick:()=>t({kind:`edit`,field:e}),children:`Edit`}),(0,I.jsx)(S,{size:`sm`,variant:`ghost`,icon:w,"aria-label":`Delete ${e.name}`,onClick:()=>t({kind:`delete`,field:e}),children:`Delete`})]})}function jn({field:e,admin:t,onDialog:n}){return e.runtime?t?(0,I.jsx)(An,{field:e.runtime,onDialog:n}):(0,I.jsx)(`span`,{className:`setup-muted`,children:`Admins edit runtime fields`}):(0,I.jsxs)(`span`,{className:`setup-locked`,children:[(0,I.jsx)(ce,{"aria-hidden":`true`}),`Defined in code, change it in `,(0,I.jsx)(`code`,{children:`krantho.collections.ts`}),`; code always wins`]})}function Mn(e,t){return[{id:`field`,header:`Field`,primary:!0,cell:e=>(0,I.jsxs)(`span`,{className:`setup-name`,children:[(0,I.jsx)(`code`,{children:e.name}),e.description&&(0,I.jsx)(`span`,{className:`setup-muted`,children:e.description})]})},{id:`type`,header:`Type`,cell:e=>hn(e.type)},{id:`required`,header:`Required`,cell:e=>e.required?`Required`:`Optional`},{id:`default`,header:`Default`,cell:e=>e.defaultValue?(0,I.jsx)(`code`,{children:e.defaultValue}):`—`},{id:`source`,header:`Source`,cell:e=>e.source===`code`?(0,I.jsx)(y,{icon:ce,children:`Code`}):(0,I.jsx)(y,{tone:`accent`,children:`Runtime`})},{id:`edit`,header:`Edit`,cell:n=>(0,I.jsx)(jn,{field:n,admin:e,onDialog:t})}]}function Nn(e){let t=(0,j.useCallback)(async()=>{let[t,n]=await Promise.all([c(e),ne(e)]);return fn(t,n.fields)},[e]);return x(t,`The fields could not be read`)}function Pn({admin:e,onDialog:t}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(S,{icon:Ze,onClick:()=>t({kind:`export`}),children:`Export as Zod`}),e&&(0,I.jsx)(S,{variant:`primary`,icon:me,onClick:()=>t({kind:`edit`,field:null}),children:`Add runtime field`})]})}function Fn({collection:e,collections:t,admin:n}){let{loaded:r,reload:i}=Nn(e),[a,o]=(0,j.useState)(null),s=D(e),c=(0,I.jsx)(Pn,{admin:n,onDialog:o});return(0,I.jsxs)(H,{title:`Fields of ${s}`,actions:c,sources:(0,I.jsx)(In,{}),children:[r.state===`loading`&&(0,I.jsx)(W,{what:`the fields`}),r.state===`error`&&(0,I.jsx)(G,{message:r.message,onRetry:i}),r.state===`ready`&&(0,I.jsx)(O,{caption:`Fields of ${s}`,columns:Mn(n,o),rows:r.data,rowKey:e=>`${e.source}:${e.name}`}),a&&(0,I.jsx)(Rn,{collection:e,collections:t,dialog:a,onClose:()=>o(null),onChanged:i})]})}function In(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(V,{source:`config`,children:[`Code fields come from the collection's Zod schema in `,(0,I.jsx)(`code`,{children:`krantho.collections.ts`}),`, read-only here.`]}),(0,I.jsx)(V,{source:`database`,children:`Runtime fields are stored in the site's database: added, edited and deleted here, and added to the collection's form at once.`})]})}function Ln({collection:e,name:t,onDone:n,onClose:r}){return(0,I.jsxs)(L,{title:`Delete the field ${t}?`,confirmLabel:`Delete field`,danger:!0,onConfirm:async()=>{await l(e,t),n(`Deleted the runtime field ${t}.`)},onClose:r,children:[(0,I.jsxs)(`p`,{children:[`The runtime field `,(0,I.jsx)(`code`,{children:t}),` is removed from `,D(e),`'s schema, so its form no longer shows it.`]}),(0,I.jsx)(`p`,{children:`Only the schema changes. Documents keep the values they already hold in the field; the form no longer shows them.`})]})}function Rn(e){let{collection:t,collections:n,dialog:r,onClose:i,onChanged:a}=e,o=g(),s=e=>{o({text:e}),i(),a()};return r.kind===`export`?(0,I.jsx)(kn,{collection:t,onClose:i}):r.kind===`delete`?(0,I.jsx)(Ln,{collection:t,name:r.field.name,onDone:s,onClose:i}):(0,I.jsx)(Dn,{collection:t,field:r.field,collections:n,onSave:async e=>{await ie(t,e),s(`Saved the runtime field ${e.name}.`)},onClose:i})}var X=`collection`;function zn({names:e,none:t}){return e===null?(0,I.jsx)(`span`,{className:`setup-muted`,children:`Not read`}):e.length===0?(0,I.jsx)(`span`,{className:`setup-muted`,children:t}):(0,I.jsx)(`span`,{className:`setup-chips`,children:e.map(e=>(0,I.jsx)(y,{children:e},e))})}function Bn({name:e}){return(0,I.jsxs)(`span`,{className:`setup-name`,children:[D(e),(0,I.jsx)(`code`,{className:`setup-muted`,children:e})]})}function Vn({name:e,open:t,onFields:n}){return(0,I.jsx)(S,{size:`sm`,icon:tt,variant:t?`primary`:`secondary`,"aria-label":`Fields of ${D(e)}`,"aria-pressed":t,onClick:()=>n(e),children:`Fields`})}function Hn(e,t){return[{id:`collection`,header:`Collection`,primary:!0,cell:e=>(0,I.jsx)(Bn,{name:e.collection.name})},{id:`renders`,header:`Renders at`,cell:e=>e.rendersAt?(0,I.jsx)(`code`,{children:e.rendersAt}):(0,I.jsx)(`span`,{className:`setup-muted`,children:`No pages`})},{id:`types`,header:`Schema.org types`,cell:e=>(0,I.jsx)(zn,{names:e.types,none:`None set`})},{id:`rich`,header:`Rich results`,cell:e=>(0,I.jsx)(zn,{names:e.richResults,none:`None`})},{id:`fields`,header:`Fields`,cell:n=>(0,I.jsx)(Vn,{name:n.collection.name,open:e===n.collection.name,onFields:t})}]}function Un({seo:e}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(V,{source:`config`,children:[`The collections and where they render come from `,(0,I.jsx)(`code`,{children:`krantho.collections.ts`}),`, read-only here.`]}),e&&(0,I.jsxs)(V,{source:`database`,children:[`The Schema.org types are each collection's archetype, set in`,` `,(0,I.jsx)(ze,{to:f(`collection`),children:`Structure › Scopes & archetypes`}),`. The rich results are what the catalog says those types are eligible for.`]})]})}function Wn(){let[e,t]=Re(),n=e.get(X),r=(0,j.useRef)(null),i=(0,j.useRef)(!1);return(0,j.useEffect)(()=>{n&&i.current&&r.current?.focus(),i.current=!1},[n]),{open:n,onFields:(0,j.useCallback)(e=>{i.current=!0,t({[X]:e},{replace:!0})},[t]),ref:r}}function Gn(){let e=Ie(Ne(),`seo`),t=b().hasRole(`admin`),n=(0,j.useCallback)(()=>on(e),[e]),{loaded:r,reload:i}=x(n,`The collections could not be read`),{open:a,onFields:o,ref:s}=Wn(),c=r.state===`ready`?r.data.collections:[],l=c.some(e=>e.name===a);return(0,I.jsxs)(`div`,{className:`setup-stack`,children:[(0,I.jsxs)(H,{title:`Collections & schema`,sources:(0,I.jsx)(Un,{seo:e}),children:[r.state===`loading`&&(0,I.jsx)(W,{what:`the collections`}),r.state===`error`&&(0,I.jsx)(G,{message:r.message,onRetry:i}),r.state===`ready`&&(0,I.jsx)(O,{caption:`Collections`,columns:Hn(a,o),rows:ln(r.data),rowKey:e=>e.collection.name})]}),a&&r.state===`ready`&&!l&&(0,I.jsxs)(U,{children:[`No collection is named `,a,`.`]}),a&&l&&(0,I.jsx)(`div`,{ref:s,tabIndex:-1,className:`setup-focus-target`,children:(0,I.jsx)(Fn,{collection:a,collections:c,admin:t},a)})]})}function Kn(e){return e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}function qn(e){let t=[],n=Pe(e);n&&t.push({name:`Framework`,value:n}),t.push({name:`Persistence`,value:e.persistence},{name:`Auth`,value:e.authMode}),e.schemaVersion!==null&&t.push({name:`Schema version`,value:`v${String(e.schemaVersion).padStart(3,`0`)}`});for(let[n,r]of Object.entries(e.features))t.push({name:Kn(n),value:r});return t}function Jn({value:e}){return(0,I.jsx)(y,{tone:e===`disabled`||e===`none`?`neutral`:`success`,children:e})}var Yn=[{id:`name`,header:`Capability`,primary:!0,cell:e=>e.name},{id:`value`,header:`Value`,cell:e=>(0,I.jsx)(Jn,{value:e.value})}];function Xn(){let e=Ne();return(0,I.jsx)(H,{title:`Environment`,sources:(0,I.jsxs)(V,{source:`server`,children:[`What the running server reports (`,(0,I.jsx)(`code`,{children:`GET /api/capabilities`}),`), read-only. It follows the configuration and the persistence the server started with.`]}),children:(0,I.jsx)(O,{caption:`What the server reports`,columns:Yn,rows:qn(e),rowKey:e=>e.name})})}var Zn=[{id:`all`,label:`All`},{id:`pending`,label:`Pending`},{id:`delivered`,label:`Delivered`},{id:`failed`,label:`Failed`}];function Qn(e){return e.deliveredAt?`delivered`:e.attempts>=5?`failed`:`pending`}function $n(e){return e===null?`—`:e===0?`Network error`:String(e)}function er(e){switch(e){case`pending`:return`No delivery is waiting for another attempt.`;case`delivered`:return`No delivery has reached its webhook yet.`;case`failed`:return`No delivery has failed.`;default:return`Nothing has been sent yet.`}}function tr(e,t){let n=Math.ceil(t/25);return n>1?`Page ${e+1} of ${n}`:null}var nr={delivered:(0,I.jsx)(y,{tone:`success`,icon:he,children:`Delivered`}),pending:(0,I.jsx)(y,{tone:`warning`,icon:We,children:`Pending`}),failed:(0,I.jsx)(y,{tone:`danger`,icon:ue,children:`Failed`})};function rr(e,t){return[{id:`event`,header:`Event`,primary:!0,cell:e=>(0,I.jsx)(`code`,{children:e.event})},{id:`url`,header:`URL`,cell:e=>(0,I.jsx)(`span`,{className:`setup-url`,children:e.url})},{id:`state`,header:`State`,cell:e=>nr[Qn(e)]},{id:`http`,header:`HTTP`,numeric:!0,cell:e=>$n(e.status)},{id:`attempts`,header:`Attempts`,numeric:!0,cell:e=>`${e.attempts} / 5`},{id:`created`,header:`Created`,cell:e=>E(e.createdAt)},{id:`delivered`,header:`Delivered`,cell:e=>e.deliveredAt?E(e.deliveredAt):`—`},{id:`retry`,header:`Retry`,cell:n=>Qn(n)===`failed`?(0,I.jsx)(S,{size:`sm`,icon:Ge,"aria-disabled":e!==null,"aria-label":`Retry delivery ${n.id} of ${n.event}`,onClick:e===null?()=>t(n):void 0,children:e===n.id?`Retrying…`:`Retry`}):null}]}function ir({filter:e,onFilter:t}){return(0,I.jsxs)(`fieldset`,{className:`setup-segmented`,children:[(0,I.jsx)(`legend`,{className:`visually-hidden`,children:`Show deliveries`}),Zn.map(n=>(0,I.jsx)(S,{size:`sm`,variant:e===n.id?`primary`:`secondary`,"aria-pressed":e===n.id,onClick:()=>t(n.id),children:n.label},n.id))]})}function ar(e){let t=g(),[n,r]=(0,j.useState)(null),i=(0,j.useRef)(null);return{retrying:n,retry:(0,j.useCallback)(n=>{i.current===null&&(i.current=n.id,r(n.id),re(n.id).then(()=>t({text:`Sent delivery ${n.id} again. It shows as pending until the webhook answers.`})).catch(e=>t({text:_(e,`The delivery could not be retried`),tone:`error`})).finally(()=>{i.current=null,r(null),e()}))},[e,t])}}function or({page:e,total:t,onPage:n}){let r=tr(e,t);if(!r)return null;let i=Math.ceil(t/25)-1;return(0,I.jsxs)(`nav`,{"aria-label":`Pages of deliveries`,className:`setup-row`,children:[(0,I.jsx)(S,{size:`sm`,"aria-disabled":e===0,onClick:e===0?void 0:()=>n(e-1),children:`Previous`}),(0,I.jsx)(`span`,{className:`setup-muted`,children:r}),(0,I.jsx)(S,{size:`sm`,"aria-disabled":e>=i,onClick:e>=i?void 0:()=>n(e+1),children:`Next`})]})}async function sr(e,t){let n=e===`all`?void 0:e;try{return await ge({limit:25,offset:t*25,status:n})}catch(e){if(e instanceof Ke&&e.status===403)return null;throw e}}function cr({filter:e,page:t,revision:n,onPage:r}){let i=(0,j.useCallback)(()=>sr(e,t),[e,t]),{loaded:a,reload:o}=x(i,`The deliveries could not be read`),s=(0,j.useRef)(n);(0,j.useEffect)(()=>{s.current!==n&&(s.current=n,o())},[n,o]);let{retrying:c,retry:l}=ar(o);if(a.state===`loading`)return(0,I.jsx)(W,{what:`the deliveries`});if(a.state===`error`)return(0,I.jsx)(G,{message:a.message,onRetry:o});if(a.data===null)return(0,I.jsx)(U,{children:`Only admins see webhook deliveries.`});let{deliveries:u,total:d}=a.data;return u.length===0?(0,I.jsx)(lr,{filter:e}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`setup-muted`,children:d===1?`1 delivery`:`${d} deliveries`}),(0,I.jsx)(O,{caption:`Webhook deliveries`,columns:rr(c,l),rows:u,rowKey:e=>String(e.id)}),(0,I.jsx)(or,{page:t,total:d,onPage:r})]})}function lr({filter:e}){return(0,I.jsxs)(Le,{icon:fe,title:`No webhook deliveries`,children:[er(e),` `,e===`all`&&(0,I.jsxs)(I.Fragment,{children:[`Each webhook the API is created with (`,(0,I.jsxs)(`code`,{children:[`createApiHandlers(`,`{ webhooks }`,`)`]}),`) logs a delivery here when content is created, updated, published or deleted.`]})]})}function ur(){let[e,t]=(0,j.useState)(`all`),[n,r]=(0,j.useState)(0),[i,a]=(0,j.useState)(0);return(0,I.jsxs)(H,{title:`Webhook deliveries`,actions:(0,I.jsx)(S,{size:`sm`,icon:we,onClick:()=>a(e=>e+1),children:`Refresh`}),sources:(0,I.jsx)(V,{source:`database`,children:`The delivery log in the site's database: every webhook sent, its answer and its attempts. Delivery logging runs on SQLite only.`}),children:[(0,I.jsx)(ir,{filter:e,onFilter:e=>{t(e),r(0)}}),(0,I.jsx)(cr,{filter:e,page:n,revision:i,onPage:r})]})}var Z=e=>`${e.collection}/${e.slug}/${e.locale}`;function dr({version:e,item:t,defaultLocale:n,canCreate:r,created:i,busy:a,onCreate:o}){let{collection:s,slug:c,locale:l}=e;return t.locales.includes(l)?(0,I.jsx)(y,{tone:`success`,icon:xe,children:`Exists`}):i.has(Z(e))?(0,I.jsxs)(ze,{to:ee(s,c,l),children:[`Open the `,l,` draft`]}):!r||!t.locales.includes(n)?(0,I.jsx)(y,{tone:`warning`,children:`Missing`}):(0,I.jsx)(S,{size:`sm`,icon:le,"aria-disabled":a!==null,"aria-label":`Create the ${l} draft of ${c}`,onClick:a===null?()=>o(e):void 0,children:a===Z(e)?`Creating…`:`Create draft`})}function fr(e,t,n){return[{id:`slug`,header:`Document`,primary:!0,cell:e=>(0,I.jsx)(`code`,{children:e.slug})},...e.map(e=>({id:`locale-${e}`,header:e===t.defaultLocale?`${e} (default)`:e,cell:r=>(0,I.jsx)(dr,{...t,item:r,version:{collection:n,slug:r.slug,locale:e}})}))]}function pr(e){let t=g(),[n,r]=(0,j.useState)(new Set),[i,a]=(0,j.useState)(null);return{created:n,busy:i,onCreate:(0,j.useCallback)(n=>{a(Z(n)),qe(n.collection,n.slug,n.locale,e).then(()=>{r(e=>new Set([...e,Z(n)])),t({text:`Created the ${n.locale} draft of ${n.slug}, copied from ${e}.`})}).catch(e=>t({text:_(e,`The draft could not be created`),tone:`error`})).finally(()=>a(null))},[e,t])}}function mr({status:e,locales:t,cell:n}){let r=D(e.collection);return(0,I.jsxs)(`div`,{className:`setup-coverage`,children:[(0,I.jsx)(`h3`,{className:`setup-subtitle`,children:r}),e.items.length===0?(0,I.jsx)(`p`,{className:`setup-muted`,children:`No documents.`}):(0,I.jsx)(O,{caption:`${r}: versions per locale`,columns:fr(t,n,e.collection),rows:e.items,rowKey:e=>e.slug})]})}function hr({settings:e}){let t=b().hasRole(`editor`),n=`${e.defaultLocale}:${e.supportedLocales.join(`,`)}`,r=(0,j.useCallback)(()=>u(),[n]),{loaded:i,reload:a}=x(r,`Translation coverage could not be read`),o={...pr(e.defaultLocale),defaultLocale:e.defaultLocale,canCreate:t};return(0,I.jsxs)(H,{title:`Translation coverage`,sources:(0,I.jsxs)(V,{source:`database`,children:[`Each document's versions as the site's database holds them. Create draft copies the`,` `,e.defaultLocale,` version's fields and body into a new draft in that locale; it is not live until it is published.`]}),children:[i.state===`loading`&&(0,I.jsx)(W,{what:`translation coverage`}),i.state===`error`&&(0,I.jsx)(G,{message:i.message,onRetry:a}),i.state===`ready`&&i.data.collections.map(e=>(0,I.jsx)(mr,{status:e,locales:i.data.supportedLocales,cell:o},e.collection))]})}function gr(e){return e.configuredLocales.filter(t=>!e.supportedLocales.includes(t))}function _r(e,t){return[...e.supportedLocales,t]}function vr(e,t){return t===e.defaultLocale?e.supportedLocales:e.supportedLocales.filter(e=>e!==t)}function yr(){let{loaded:e,reload:t}=x(s,`The locales could not be read`),[n,r]=(0,j.useState)(null),i=(0,j.useCallback)(e=>r(e),[]);return n&&e.state===`ready`?{loaded:{state:`ready`,data:n},reload:t,set:i}:{loaded:e,reload:t,set:i}}function br({settings:e}){return e.source===`database`?(0,I.jsxs)(V,{source:`database`,children:[`The active locales are chosen here among the configured ones and stored in the site's database. The default locale is `,(0,I.jsx)(`code`,{children:`site.defaultLocale`}),` in the configuration.`]}):(0,I.jsxs)(V,{source:`config`,children:[`The locales are `,(0,I.jsx)(`code`,{children:`site.supportedLocales`}),` and the default locale is`,` `,(0,I.jsx)(`code`,{children:`site.defaultLocale`}),`, in `,(0,I.jsx)(`code`,{children:`krantho.config.ts`}),` or the environment. Setup chooses which of the configured locales are active; the default is set only in the configuration.`]})}function xr(e,t,n){return[{id:`locale`,header:`Locale`,primary:!0,cell:e=>(0,I.jsx)(`code`,{children:e.code})},{id:`default`,header:`Default`,cell:e=>e.isDefault?(0,I.jsx)(y,{tone:`accent`,children:`Default`}):null},{id:`actions`,header:`Actions`,cell:r=>e&&!r.isDefault?(0,I.jsx)(`span`,{className:`setup-row-actions`,children:(0,I.jsx)(S,{size:`sm`,variant:`ghost`,icon:w,"aria-disabled":t,"aria-label":`Remove ${r.code}`,onClick:()=>n(r.code),children:`Remove`})}):null}]}function Sr({settings:e,busy:t,change:n}){let r=gr(e),[i,a]=(0,j.useState)(``),o=r.includes(i)?i:r[0];return o===void 0?(0,I.jsx)(U,{children:`Every locale in the configuration is active.`}):(0,I.jsxs)(`form`,{className:`setup-inline-form`,onSubmit:r=>{r.preventDefault(),t||n(_r(e,o),`Added ${o}.`)},children:[(0,I.jsx)(B,{label:`Configured locale`,value:o,onChange:a,hint:`A locale in site.supportedLocales that is not active`,options:r.map(e=>({value:e,label:e}))}),(0,I.jsx)(S,{type:`submit`,variant:`primary`,icon:me,"aria-disabled":t,children:`Add locale`})]})}function Cr(e){let t=g(),{busy:n,once:r}=P();return{busy:n,change:(n,i)=>{r(async()=>{try{e(await o(n)),t({text:i})}catch(e){t({text:_(e,`The locales could not be saved`),tone:`error`})}})}}}function wr({code:e,settings:t,onSaved:n,onClose:r}){let i=g();async function a(){n(await o(vr(t,e))),i({text:`Removed ${e}.`}),r()}return(0,I.jsx)(L,{title:`Remove the locale ${e}?`,confirmLabel:`Remove locale`,danger:!0,onConfirm:a,onClose:r,children:(0,I.jsxs)(`p`,{children:[`The site stops serving `,(0,I.jsx)(`code`,{children:e}),`. Documents already in that locale are kept, not deleted. Only the list of locales changes.`]})})}function Tr({settings:e,set:t}){let n=b().hasRole(`admin`),{busy:r,change:i}=Cr(t),[a,o]=(0,j.useState)(null),s=e.supportedLocales.map(t=>({code:t,isDefault:t===e.defaultLocale}));return(0,I.jsxs)(H,{title:`Locales`,sources:(0,I.jsx)(br,{settings:e}),children:[(0,I.jsx)(O,{caption:`Locales`,columns:xr(n,r,o),rows:s,rowKey:e=>e.code}),n?(0,I.jsx)(Sr,{settings:e,busy:r,change:i}):(0,I.jsx)(U,{children:`Only admins change the locales.`}),a&&(0,I.jsx)(wr,{code:a,settings:e,onSaved:t,onClose:()=>o(null)})]})}function Er(){let{loaded:e,reload:t,set:n}=yr();if(e.state===`loading`)return(0,I.jsx)(W,{what:`the locales`});if(e.state===`error`)return(0,I.jsx)(G,{message:e.message,onRetry:t});let r=e.data;return(0,I.jsxs)(`div`,{className:`setup-stack`,children:[(0,I.jsx)(Tr,{settings:r,set:n}),r.supportedLocales.length>1&&(0,I.jsx)(hr,{settings:r})]})}var Dr=[{value:`admin`,label:`Admin`,can:`everything, including Setup and people`},{value:`editor`,label:`Editor`,can:`writes, publishes and takes checkpoints`},{value:`viewer`,label:`Viewer`,can:`reads`}];function Q(e){return e.roles[0]??`viewer`}function $(e){return e.name||e.email||e.id}var Or=Dr.map(e=>({value:e.value,label:`${e.label} — ${e.can}`}));function kr({form:e,setForm:t,editing:n}){let r=n?`An account keeps its email`:`They sign in with this address`;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(z,{label:`Email`,type:`email`,value:e.email,disabled:n,onChange:n=>t({...e,email:n}),hint:r}),(0,I.jsx)(z,{label:`Name`,value:e.name,onChange:n=>t({...e,name:n})}),(0,I.jsx)(B,{label:`Role`,value:e.role,options:Or,onChange:n=>t({...e,role:n}),hint:`Roles are site-wide: admin > editor > viewer`})]})}function Ar({user:e,onSave:t,onClose:n}){let r=(0,j.useId)(),[i,a]=(0,j.useState)(()=>({email:e?.email??``,name:e?.name??``,role:e?Q(e):`viewer`})),{busy:o,error:s,setError:c,run:l}=F();function u(n){if(n.preventDefault(),!e&&!i.email.trim()){c(`An account needs an email.`);return}let r={...i,email:i.email.trim(),name:i.name.trim()};l(()=>t(r),`The account could not be saved`)}let d=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(S,{onClick:n,children:`Cancel`}),(0,I.jsx)(S,{variant:`primary`,type:`submit`,form:r,"aria-disabled":o,children:o?`Saving…`:e?`Save`:`Create user`})]}),f=e?`Edit ${$(e)}`:`Create user`;return(0,I.jsx)(h,{title:f,onClose:n,actions:d,busy:o,children:(0,I.jsxs)(`form`,{id:r,className:`setup-form`,onSubmit:u,children:[s&&(0,I.jsx)(R,{text:s}),(0,I.jsx)(kr,{form:i,setForm:a,editing:e!==null})]})})}var jr=e=>Dr.find(t=>t.value===Q(e))?.label??Q(e);function Mr(e,t){let n={kind:`edit`,label:`Edit`,icon:He,variant:`secondary`};return t?[n]:[n,{kind:`active`,label:e.isActive?`Deactivate`:`Activate`,icon:at,variant:`ghost`},{kind:`delete`,label:`Delete`,icon:w,variant:`ghost`}]}function Nr({user:e,self:t,onDialog:n}){let r=$(e),i=Mr(e,t);return(0,I.jsx)(`span`,{className:`setup-row-actions`,children:i.map(t=>(0,I.jsx)(S,{size:`sm`,variant:t.variant,icon:t.icon,"aria-label":`${t.label} ${r}`,onClick:()=>n({kind:t.kind,user:e}),children:t.label},t.kind))})}function Pr(e,t){return[{id:`name`,header:`Person`,primary:!0,cell:e=>e.name||(0,I.jsx)(`span`,{className:`setup-muted`,children:`No name`})},{id:`email`,header:`Email`,cell:e=>e.email??`—`},{id:`role`,header:`Role`,cell:e=>(0,I.jsx)(y,{tone:Q(e)===`admin`?`accent`:`neutral`,children:jr(e)})},{id:`status`,header:`Status`,cell:e=>e.isActive?(0,I.jsx)(y,{tone:`success`,children:`Active`}):(0,I.jsx)(y,{children:`Deactivated`})},{id:`sign-in`,header:`Signs in with`,cell:e=>e.oidcIssuer?`OIDC provider`:`Studio`},{id:`created`,header:`Created`,cell:e=>Fe(e.createdAt)},{id:`actions`,header:`Actions`,cell:n=>(0,I.jsx)(Nr,{user:n,self:n.id===e,onDialog:t})}]}async function Fr(e,t){return e?(await A(e.id,{name:t.name,role:t.role}),`Saved ${$(e)}: ${t.role}.`):`Created ${$(await dt({email:t.email,name:t.name||void 0,role:t.role}))} as ${t.role}.`}async function Ir(e,t){return e===`delete`?(await ft(t.id),`Deleted ${$(t)}.`):(await A(t.id,{isActive:!t.isActive}),`${t.isActive?`Deactivated`:`Activated`} ${$(t)}.`)}function Lr({user:e,onConfirm:t,onClose:n}){let r=e.isActive,i=r?`Deactivate`:`Activate`;return(0,I.jsx)(L,{title:`${i} ${$(e)}?`,confirmLabel:i,danger:r,onConfirm:t,onClose:n,children:(0,I.jsx)(`p`,{children:r?`They can no longer sign in, and their sessions can no longer be renewed; a session already open lasts until its access token expires.`:`They can sign in again, with their role.`})})}function Rr({dialog:e,onClose:t,onDone:n}){if(e.kind===`create`||e.kind===`edit`){let r=e.kind===`edit`?e.user:null;return(0,I.jsx)(Ar,{user:r,onSave:async e=>n(await Fr(r,e)),onClose:t})}let{kind:r,user:i}=e,a=async()=>n(await Ir(r,i));return r===`active`?(0,I.jsx)(Lr,{user:i,onConfirm:a,onClose:t}):(0,I.jsx)(L,{title:`Delete ${$(i)}?`,confirmLabel:`Delete account`,danger:!0,onConfirm:a,onClose:t,children:(0,I.jsx)(`p`,{children:`The account is removed from the site's database.`})})}function zr(){let e=g(),t=b().user?.id,{loaded:n,reload:r}=x(ut,`The accounts could not be read`),[i,a]=(0,j.useState)(null);return(0,I.jsxs)(H,{title:`People`,sources:(0,I.jsx)(V,{source:`database`,children:`The accounts in the site's database. Roles are site-wide: admin > editor > viewer. The API does not record when someone was last active.`}),actions:(0,I.jsx)(S,{variant:`primary`,icon:lt,onClick:()=>a({kind:`create`}),children:`Create user`}),children:[n.state===`loading`&&(0,I.jsx)(W,{what:`the accounts`}),n.state===`error`&&(0,I.jsx)(G,{message:n.message,onRetry:r}),n.state===`ready`&&(0,I.jsx)(O,{caption:`People`,columns:Pr(t,a),rows:n.data,rowKey:e=>e.id}),i&&(0,I.jsx)(Rr,{dialog:i,onClose:()=>a(null),onDone:t=>{a(null),e({text:t}),r()}})]})}function Br({tab:e}){switch(e){case`collections`:return(0,I.jsx)(Gn,{});case`locales`:return(0,I.jsx)(Er,{});case`ai`:return(0,I.jsx)(Zt,{});case`integrations`:return(0,I.jsx)(ur,{});case`checkpoints`:return(0,I.jsx)(an,{});case`people`:return(0,I.jsx)(zr,{});case`environment`:return(0,I.jsx)(Xn,{})}}function Vr({tab:e,tabs:t}){let n=(0,j.useId)(),i=(0,j.useCallback)(e=>`${n}-tab-${e}`,[n]);return(0,I.jsxs)(`div`,{className:`setup`,children:[(0,I.jsxs)(`header`,{className:`setup-header`,children:[(0,I.jsx)(`h1`,{className:`setup-title`,children:`Setup`}),(0,I.jsxs)(`p`,{className:`setup-lead`,children:[`How the site is configured. Each tab says where its values come from: the configuration —`,` `,(0,I.jsx)(`code`,{children:`krantho.config.ts`}),`, `,(0,I.jsx)(`code`,{children:`krantho.collections.ts`}),` and the environment, read-only here — the site's database, changed here, or what the running server reports.`]})]}),(0,I.jsx)(r,{label:`Setup`,tabs:t,current:e,tabId:i,panelId:`${n}-panel`}),(0,I.jsx)(`div`,{id:`${n}-panel`,role:`tabpanel`,"aria-labelledby":i(e),className:`setup-panel`,children:(0,I.jsx)(Br,{tab:e})})]})}export{Vr as SetupPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{t as r}from"./vendor-router-B4czwg8X.js";import{r as i,u as a}from"./format-C3ZX9yGM.js";import{n as o}from"./use-loaded-DFUDFVFt.js";import{t as s}from"./circle-dashed-cuYrILNo.js";import{t as c}from"./circle-x-peGpq98w.js";import{t as l}from"./corner-down-right-BpwOGRFR.js";import{t as u}from"./external-link-Dh7p8Ii6.js";import{f as d}from"./api-seo-Cjv4a9Y_.js";import{C as f,D as p,K as m,S as h,St as g,Tt as _,V as v,ft as y,j as b,x,z as S}from"./index-qiIlvPyv.js";import{a as C,u as w}from"./site-model-CoSgHHeY.js";import{t as T}from"./source-CGZGd3Xy.js";var E=t();function D(e,t){return _(e.collection,e.slug,e.locale===t?void 0:e.locale)}function O({row:e,baseUrl:t}){return e.path===null?null:e.liveVersion===null?(0,E.jsx)(`span`,{className:`site-url`,title:`Not published yet`,children:e.path}):(0,E.jsxs)(`a`,{className:`site-url site-url--link`,href:C(t,e.path),target:`_blank`,rel:`noreferrer`,"aria-label":`${e.path} on the site (opens in a new tab)`,children:[e.path,(0,E.jsx)(u,{className:`site-url-icon`,"aria-hidden":`true`})]})}function k({row:e,context:t}){return(0,E.jsxs)(`div`,{className:`site-page`,children:[(0,E.jsx)(x,{status:e.status,decorative:!0}),(0,E.jsxs)(`div`,{className:`site-page-text`,children:[(0,E.jsx)(r,{to:D(e,t.defaultLocale),className:`site-title`,children:e.title}),e.path===null?(0,E.jsx)(`span`,{className:`site-url`,children:`no URL, shared`}):(0,E.jsx)(O,{row:e,baseUrl:t.baseUrl})]})]})}function A({row:e,context:t}){return(0,E.jsxs)(`div`,{className:`site-page-text`,children:[(0,E.jsx)(r,{to:D(e,t.defaultLocale),className:`site-slug`,children:e.slug}),(0,E.jsx)(`span`,{className:`site-links`,children:(0,E.jsx)(O,{row:e,baseUrl:t.baseUrl})})]})}function j({row:e}){return(0,E.jsxs)(`span`,{className:`site-status site-status--${e.status}`,children:[(0,E.jsx)(x,{status:e.status,decorative:!0}),b[e.status]]})}function M({row:e}){return e.liveVersion===null?(0,E.jsxs)(`span`,{className:`site-muted`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,children:`—`}),(0,E.jsx)(`span`,{className:`visually-hidden`,children:`Not published`})]}):(0,E.jsxs)(`span`,{children:[`v`,e.liveVersion]})}function N({row:e}){return(0,E.jsx)(`time`,{dateTime:e.updatedAt,title:new Date(e.updatedAt).toLocaleString(),children:i(e.updatedAt)})}var P={covered:{icon:o,tone:`good`,text:`Own meta description`},fallback:{icon:l,tone:`muted`,text:`Falls back to description`},missing:{icon:y,tone:`warn`,text:`No meta description`}};function F(e,t){switch(e){case`valid`:return{icon:o,tone:`good`,text:`Structured data valid`};case`errors`:return{icon:c,tone:`bad`,text:`Structured data has errors`};case`not-live`:return{icon:s,tone:`muted`,text:`Structured data checked once live`};case`default-locale-only`:return{icon:s,tone:`muted`,text:`Structured data checked in ${t}`};case`failed`:return{icon:s,tone:`muted`,text:`Structured data unavailable`};case`off`:return null}}function I({line:e}){let t=e.icon;return(0,E.jsxs)(`span`,{className:`site-finding site-finding--${e.tone}`,children:[(0,E.jsx)(t,{className:`site-finding-icon`,"aria-hidden":`true`}),e.text]})}function L({row:e,context:t}){if(e.meta===null){let t=e.collection===g;return(0,E.jsx)(`span`,{className:`site-muted`,children:t?`Read by every page`:`No page`})}let n=e.graph===null?null:F(e.graph,t.defaultLocale);return(0,E.jsxs)(`span`,{className:`site-findability`,children:[(0,E.jsx)(I,{line:P[e.meta]}),n&&(0,E.jsx)(I,{line:n})]})}function R({row:e}){let{locales:t}=e;return t.state===`failed`?(0,E.jsx)(`span`,{className:`site-muted`,children:`Unavailable`}):t.state===`off`?(0,E.jsxs)(`span`,{className:`site-muted`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,children:`—`}),(0,E.jsx)(`span`,{className:`visually-hidden`,children:`Locale versions not tracked`})]}):(0,E.jsxs)(`span`,{className:`site-locales`,children:[t.present.map(e=>(0,E.jsx)(`code`,{className:`site-locale`,children:e},e)),t.missing.map(e=>(0,E.jsxs)(`code`,{className:`site-locale site-locale--missing`,title:`No ${e} version`,children:[e,(0,E.jsx)(`span`,{className:`visually-hidden`,children:` missing`})]},e))]})}function z(e){return e?[{id:`locales`,header:`Locales`,cell:e=>(0,E.jsx)(R,{row:e})}]:[]}var B={id:`status`,header:`Status`,width:`11rem`,cell:e=>(0,E.jsx)(j,{row:e})},V={id:`updated`,header:`Updated`,numeric:!0,width:`9.5rem`,cell:e=>(0,E.jsx)(N,{row:e})};function H(e,t){return[{id:`page`,header:`Page`,primary:!0,cell:t=>(0,E.jsx)(k,{row:t,context:e})},B,{id:`findability`,header:`Findability`,cell:t=>(0,E.jsx)(L,{row:t,context:e})},...z(t),V]}function U(e,t){return[{id:`slug`,header:`Slug`,primary:!0,cell:t=>(0,E.jsx)(A,{row:t,context:e})},B,{id:`live`,header:`Live`,numeric:!0,width:`4.5rem`,cell:e=>(0,E.jsx)(M,{row:e})},{id:`seo`,header:`SEO`,cell:t=>(0,E.jsx)(L,{row:t,context:e})},...z(t),V]}async function W(e){let[t,n,r]=await Promise.all([p(),v(),f()]),[i,o]=await Promise.all([T(a(e,`seo`),async()=>(await d()).pages),T(h(r),m)]);return{site:t,locales:r,collections:n,findings:i,translations:o}}function G(e,t){return e.map(e=>w(e,t))}function K(e,t){return{collection:e,defaultLocale:t.locales.defaultLocale,findings:t.findings,translations:t.translations}}async function q(e){let t=await W(e),n=t.locales.defaultLocale,r=await S({locale:n}),i=[],a=null;for(let e of t.collections){let n=G(r.filter(t=>t.meta.collection===e.name),K(e,t));e.name===`globals`?a=n:i.push({collection:e,rows:n})}let o=t.translations.state!==`off`;return{site:t.site,locales:t.locales,sections:i,layout:a,localization:o}}async function J(e,t,n){let r=await W(e),{supportedLocales:i,defaultLocale:a}=r.locales,o=n&&i.includes(n)?n:a,s=r.translations.state!==`off`,c=r.collections.find(e=>e.name===t&&e.name!==`globals`)??null,l={site:r.site,locales:r.locales,collection:c,locale:o,localization:s};if(!c)return{...l,rows:[]};let u=await S({collections:[c.name],locale:o});return{...l,rows:G(u,K(c,r))}}var Y=e(n(),1);function X(e,t){let[n,r]=(0,Y.useState)(0),i=(0,Y.useRef)(0),{ready:a,error:o}=t;return(0,Y.useEffect)(()=>{n!==i.current&&e!==`loading`&&(i.current=n,(e===`error`?o:a).current?.focus())},[n,e,a,o]),(0,Y.useCallback)(()=>r(e=>e+1),[])}export{H as a,U as i,J as n,D as o,q as r,X as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{n as r}from"./createLucideIcon-BklFHeMd.js";import{i,n as a,r as o}from"./findability-BrhtZ2yD.js";import{y as s}from"./api-seo-Cjv4a9Y_.js";import{t as c}from"./triangle-exclamation-point-ttN5lZI0.js";import{M as l,o as u}from"./index-qiIlvPyv.js";import{t as d}from"./empty-state-CeUZocHx.js";var f=e(n(),1),p=t();function m({title:e,message:t,onRetry:n,panelRef:i}){let a=(0,f.useId)();return(0,p.jsx)(`div`,{ref:i,className:`site-panel site-focus-target`,role:`alert`,"aria-labelledby":a,tabIndex:-1,children:(0,p.jsx)(d,{icon:c,title:e,titleId:a,action:(0,p.jsx)(r,{icon:s,onClick:n,children:`Try again`}),children:t})})}function h(e,t){if(!t.collection.pages)return null;let{findings:n,defaultLocale:r}=t;if(n.state!==`ok`)return n.state;if(e.meta.locale!==r)return`default-locale-only`;let i=n.value.find(t=>t.collection===e.meta.collection&&t.slug===e.meta.slug);return i?o(i)?`valid`:`errors`:`not-live`}function g(e,t){let{translations:n,collection:r}=t;if(n.state!==`ok`)return n;let i=n.value.collections.find(e=>e.collection===r.name)?.items.find(t=>t.slug===e.slug),a=new Set([...i?.locales??[],e.locale]),o=n.value.supportedLocales;return{state:`ok`,present:o.filter(e=>a.has(e)),missing:o.filter(e=>!a.has(e))}}function _(e,t){let{meta:n,fields:r}=e,o=r.title,s=t.collection.pages;return{collection:n.collection,slug:n.slug,locale:n.locale,title:a(o)?String(o):n.slug,status:l(n),version:n.version,liveVersion:n.liveVersion,updatedAt:n.createdAt,path:s?u(t.collection,n.slug):null,meta:s?i(r):null,graph:h(e,t),locales:g(n,t)}}var v=[`all`,`live`,`ahead`,`draft`],y=[`updated`,`slug`];function b(e){return v.some(t=>t===e)}function x(e){return y.some(t=>t===e)}function S(e){return e===`slug`?(e,t)=>e.slug.localeCompare(t.slug):(e,t)=>t.updatedAt.localeCompare(e.updatedAt)||e.slug.localeCompare(t.slug)}function C(e,t,n){return e.filter(e=>t===`all`||e.status===t).sort(S(n))}function w(e){let t=t=>e.filter(e=>e.status===t).length;return{total:e.length,live:t(`live`),ahead:t(`ahead`),draft:t(`draft`)}}function T(e,t){return`${e} of ${t}`}function E(e,t){return`${e.replace(/\/+$/,``)}${t}`}function D(e,t){return t.length>0&&t.every(t=>e.has(t))?new Set:new Set(t)}function O(e,t){return t.filter(t=>e.has(t))}export{E as a,C as c,D as d,m as f,b as i,w as l,v as n,O as o,x as r,T as s,y as t,_ as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{Ct as t,a as n,ut as r,x as i}from"./index-qiIlvPyv.js";import{a}from"./findability-BrhtZ2yD.js";import{t as o}from"./createLucideIcon-BklFHeMd.js";import{o as s,s as c}from"./vendor-diff-DGCTJYJ4.js";import{t as l,u}from"./vendor-router-B4czwg8X.js";import{d,t as f}from"./format-C3ZX9yGM.js";import{n as p,t as m}from"./data-table-B1kqxrEw.js";import{t as h}from"./empty-state-CeUZocHx.js";import{f as g,l as _}from"./site-model-CoSgHHeY.js";import{a as v,o as y,r as b,t as x}from"./site-BfbIKOk1.js";import{t as S}from"./use-loaded-DFUDFVFt.js";var C={name:`layout-template`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]};C.node;var w=o(C),T=e(c(),1),E=s(),D={live:`live`,ahead:`draft ahead`,draft:`draft`},O=[`live`,`ahead`,`draft`];function k({counts:e}){let t=O.filter(t=>e[t]>0);return(0,E.jsxs)(`p`,{className:`site-summary`,children:[t.length===0&&(0,E.jsx)(`span`,{children:`No documents`}),t.map(t=>(0,E.jsxs)(`span`,{className:`site-summary-item`,children:[(0,E.jsx)(i,{status:t,decorative:!0}),(0,E.jsx)(`span`,{className:`site-summary-number`,children:e[t]}),` `,D[t]]},t))]})}function A({caption:e,rows:t,context:n,localization:r}){let i=u(),a=(0,T.useMemo)(()=>v(n,r),[n,r]);return(0,E.jsx)(m,{caption:e,columns:a,rows:t,rowKey:e=>e.slug,onRowClick:e=>i(y(e,n.defaultLocale))})}function j({section:e,context:r,localization:i}){let o=(0,T.useId)(),{collection:s,rows:c}=e,u=f(s.name),d=n(s);return(0,E.jsxs)(`section`,{className:`site-panel`,"aria-labelledby":o,children:[(0,E.jsxs)(`div`,{className:`site-panel-head`,children:[(0,E.jsxs)(`div`,{className:`site-panel-title`,children:[(0,E.jsx)(`h2`,{id:o,children:(0,E.jsx)(l,{to:t(s.name),children:u})}),(0,E.jsx)(`code`,{className:`site-pattern`,children:d??`no pages`})]}),(0,E.jsx)(k,{counts:_(c)})]}),c.length===0?(0,E.jsx)(h,{icon:a,title:`No ${u.toLowerCase()} yet`,children:`Documents you create in this collection show up here.`}):(0,E.jsx)(A,{caption:u,rows:c,context:r,localization:i})]})}function M({rows:e,context:t,localization:n}){let r=(0,T.useId)();return(0,E.jsxs)(`section`,{className:`site-panel`,"aria-labelledby":r,children:[(0,E.jsxs)(`div`,{className:`site-panel-head`,children:[(0,E.jsxs)(`div`,{className:`site-panel-title`,children:[(0,E.jsx)(`h2`,{id:r,children:`Layout`}),(0,E.jsx)(`span`,{className:`site-pattern-note`,children:`no URL, shared · read by every page`})]}),(0,E.jsx)(k,{counts:_(e)})]}),e.length===0?(0,E.jsx)(h,{icon:w,title:`No globals yet`,children:`Globals hold the frame every page shares: header, footer, contact.`}):(0,E.jsx)(A,{caption:`Layout`,rows:e,context:t,localization:n})]})}function N({data:e}){let{site:t}=e.site,n=(0,T.useMemo)(()=>({baseUrl:t.baseUrl,defaultLocale:e.locales.defaultLocale}),[t.baseUrl,e.locales.defaultLocale]);return(0,E.jsxs)(E.Fragment,{children:[e.sections.map(t=>(0,E.jsx)(j,{section:t,context:n,localization:e.localization},t.collection.name)),e.layout&&(0,E.jsx)(M,{rows:e.layout,context:n,localization:e.localization})]})}function P(){return(0,E.jsxs)(`div`,{className:`site-panel`,"aria-hidden":`true`,children:[(0,E.jsx)(`div`,{className:`site-panel-head`,children:(0,E.jsx)(`span`,{className:`site-skeleton-title`})}),(0,E.jsx)(p,{})]})}function F({headingRef:e,defaultLocale:t}){return(0,E.jsxs)(`header`,{className:`site-header`,children:[(0,E.jsx)(`h1`,{ref:e,className:`site-heading site-focus-target`,tabIndex:-1,children:`Site`}),(0,E.jsxs)(`p`,{className:`site-lede`,children:[`What you are editing: each collection's documents`,t&&(0,E.jsxs)(E.Fragment,{children:[` `,`in `,(0,E.jsx)(`code`,{children:t})]}),`, and the Layout every page shares.`]})]})}function I(){return(0,E.jsx)(`div`,{className:`site-panel`,children:(0,E.jsxs)(h,{icon:r,title:`No collections`,children:[`Collections are defined in code, in `,(0,E.jsx)(`code`,{children:`krantho.collections.ts`}),`.`]})})}function L(){let e=d(),t=(0,T.useCallback)(()=>b(e),[e]),{loaded:n,reload:r}=S(t,`The site could not load`),i=(0,T.useRef)(null),a=(0,T.useRef)(null),o=x(n.state,{ready:i,error:a}),s=()=>{r(),o()},c=n.state===`ready`?n.data:null;return(0,E.jsxs)(`div`,{className:`site`,"aria-busy":n.state===`loading`,children:[(0,E.jsx)(F,{headingRef:i,defaultLocale:c?.locales.defaultLocale??null}),n.state===`loading`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`visually-hidden`,role:`status`,children:`Loading the site…`}),(0,E.jsx)(P,{})]}),n.state===`error`&&(0,E.jsx)(g,{title:`The site could not load`,message:n.message,onRetry:s,panelRef:a}),c&&(0,E.jsx)(N,{data:c}),c&&c.sections.length===0&&(0,E.jsx)(I,{})]})}export{L as SiteOverview};
|