import{au as x}from"./C6MRUCyE.js";import{d as s,u as m}from"./Dq6RPvr_.js";const p=200,E=80,M=30,b=60;function w(t){if(!t)return{hasLongHeaders:!1,longHeaders:[]};const e=t.replace(/```[\s\S]*?```/g,"").replace(/`[^`]*`/g,""),i=/^(#{1,3})\s+(.+)$/gm,n=[...e.matchAll(i)],a=[];return n.forEach(c=>{const o=c[2].trim(),r=/[.!?]+/g,l=o.split(r).filter(g=>g.trim().length>0),d=o.length>E,h=l.length>1;(d||h)&&a.push(o)}),{hasLongHeaders:a.length>0,longHeaders:a}}function S(t){if(!t)return{imageHeavy:!1,hasEmptyAltText:!1};const e=t.replace(/```[\s\S]*?```/g,"").replace(/`[^`]*`/g,""),i=/!\[([^\]]*)\]\([^)]+\)/g,n=[...e.matchAll(i)],a=/]*>/gi,c=[...e.matchAll(a)],o=n.length+c.length;if(o===0)return{imageHeavy:!1,hasEmptyAltText:!1};const r=f(e),l=b*o,d=l>p&&r{var u;return!((u=g[1])!=null&&u.trim())})||c.some(g=>{var y;const u=g[0].match(/alt\s*=\s*["']([^"']*)["']/i);return!u||!((y=u[1])!=null&&y.trim())});return{imageHeavy:d,hasEmptyAltText:h}}function f(t){if(!t)return 0;const e=i=>i.replace(/```[\s\S]*?```/g,"").replace(/`[^`]*`/g,"").replace(/!\[[^\]]*]\([^)]+\)/g," ").replace(/\[[^\]]*]\([^)]+\)/g," ").replace(/<[^>]+>/g," ").replace(/^>{1}\s?.*$/gm," ").replace(/^#{1,6}\s+/gm," ").replace(/[*_~`>-]/g," ").replace(/\|/g," ").replace(/\s+/g," ").trim().length;if(typeof window>"u"||typeof globalThis.DOMParser>"u")return console.warn("[Moderation] SSR: no window/DOMParser, falling back for countText"),e(t);try{const i=x(t),a=new DOMParser().parseFromString(i,"text/html"),c=a.createTreeWalker(a.body||a,NodeFilter.SHOW_TEXT),o=[];let r=c.nextNode();for(;r;)r.textContent&&o.push(r.textContent),r=c.nextNode();return o.join(" ").replace(/\s+/g," ").trim().length}catch{return e(t)}}const A=[{id:"description-too-short",title:s({id:"nags.description-too-short.title",defaultMessage:"Expand the description"}),description:t=>{const{formatMessage:e}=m(),i=f(t.project.body||"");return e(s({id:"nags.description-too-short.description",defaultMessage:"Your description is {length} readable characters. At least {minChars} characters is recommended to create a clear and informative description."}),{length:i,minChars:p})},status:"warning",shouldShow:t=>{const e=f(t.project.body||"");return e0},link:{path:"settings/description",title:s({id:"nags.edit-description.title",defaultMessage:"Edit description"}),shouldShow:t=>t.currentRoute!=="type-id-settings-description"}},{id:"long-headers",title:s({id:"nags.long-headers.title",defaultMessage:"Shorten headers"}),description:t=>{const{formatMessage:e}=m(),{longHeaders:i}=w(t.project.body||""),n=i.length;return e(s({id:"nags.long-headers.description",defaultMessage:"{count, plural, one {# header} other {# headers}} in your description {count, plural, one {is} other {are}} too long. Headers should be concise and act as section titles, not full sentences."}),{count:n})},status:"warning",shouldShow:t=>{const{hasLongHeaders:e}=w(t.project.body||"");return e},link:{path:"settings/description",title:s({id:"nags.edit-description.title",defaultMessage:"Edit description"}),shouldShow:t=>t.currentRoute!=="type-id-settings-description"}},{id:"summary-too-short",title:s({id:"nags.summary-too-short.title",defaultMessage:"Expand the summary"}),description:t=>{var i;const{formatMessage:e}=m();return e(s({id:"nags.summary-too-short.description",defaultMessage:"Your summary is {length} characters. At least {minChars} characters is recommended to create an informative and enticing summary."}),{length:((i=t.project.description)==null?void 0:i.length)||0,minChars:M})},status:"warning",shouldShow:t=>{var i,n;const e=((n=(i=t.project.description)==null?void 0:i.trim())==null?void 0:n.length)||0;return et.currentRoute!=="type-id-settings"}},{id:"summary-special-formatting",title:s({id:"nags.summary-special-formatting.title",defaultMessage:"Clear up the summary"}),description:s({id:"nags.summary-special-formatting.description",defaultMessage:"Your summary should not contain formatting, line breaks, special characters, or links, since the summary will only display plain text."}),status:"warning",shouldShow:t=>{var i;const e=((i=t.project.description)==null?void 0:i.trim())||"";return!!(e.match(/https:\/\//g)||e.match(/http:\/\//g)||e.match(/# .*/g)||e.match(/---/g)||e.match(/\n/g)||e.match(/\[.*\]\(.*\)/g)||e.match(/!\[.*\]/g)||e.match(/`.*`/g)||e.match(/\*.*\*/g)||e.match(/_.*_/g)||e.match(/~~.*~~/g)||e.match(/```/g)||e.match(/> /g))},link:{path:"settings",title:s({id:"nags.edit-summary.title",defaultMessage:"Edit summary"}),shouldShow:t=>t.currentRoute!=="type-id-settings"}},{id:"minecraft-title-clause",title:s({id:"nags.minecraft-title-clause.title",defaultMessage:"Avoid brand infringement"}),description:s({id:"nags.minecraft-title-clause.description",defaultMessage:`Projects must not use Minecraft's branding or include "Minecraft" as a significant part of the name.`}),status:"warning",shouldShow:t=>{var n;const e=((n=t.project.title)==null?void 0:n.toLowerCase())||"",i=e.split(" ").filter(a=>a.length>0);return e.includes("minecraft")&&e.length>0&&i.length<=3},link:{path:"settings",title:s({id:"nags.edit-title.title",defaultMessage:"Edit title"}),shouldShow:t=>t.currentRoute!=="type-id-settings"}},{id:"title-contains-technical-info",title:s({id:"nags.title-contains-technical-info.title",defaultMessage:"Clean up the name"}),description:s({id:"nags.title-contains-technical-info.description",defaultMessage:"Keeping your project's Name clean and makes it memorable easier to find. Version and loader information is automatically displayed alongside your project."}),status:"warning",shouldShow:t=>{var o,r;const e=((o=t.project.title)==null?void 0:o.toLowerCase())||"";if(!e)return!1;const n=(((r=t.tags.loaders)==null?void 0:r.map(l=>{var d;return(d=l.name)==null?void 0:d.toLowerCase()}))||[]).some(l=>l&&e.includes(l.toLowerCase())),c=[/\b1\.\d+(\.\d+)?\b/].some(l=>l.test(e));return n||c},link:{path:"settings",title:s({id:"nags.edit-title.title",defaultMessage:"Edit title"}),shouldShow:t=>t.currentRoute!=="type-id-settings"}},{id:"summary-same-as-title",title:s({id:"nags.summary-same-as-title.title",defaultMessage:"Make the summary unique"}),description:s({id:"nags.summary-same-as-title.description",defaultMessage:"Your summary can not be the same as your project's Name. It's important to create an informative and enticing Summary."}),status:"required",shouldShow:t=>{var n,a;const e=((n=t.project.title)==null?void 0:n.trim())||"",i=((a=t.project.description)==null?void 0:a.trim())||"";return e===i&&e.length>0&&i.length>0},link:{path:"settings",title:s({id:"nags.edit-summary.title",defaultMessage:"Edit summary"}),shouldShow:t=>t.currentRoute!=="type-id-settings"}},{id:"image-heavy-description",title:s({id:"nags.image-heavy-description.title",defaultMessage:"Ensure accessibility"}),description:s({id:"nags.image-heavy-description.description",defaultMessage:"Your Description should contain sufficient plain text or image alt-text, keeping it accessible to those using screen readers or with slow internet connections."}),status:"warning",shouldShow:t=>{const{imageHeavy:e}=S(t.project.body||"");return e},link:{path:"settings/description",title:s({id:"nags.edit-description.title",defaultMessage:"Edit description"}),shouldShow:t=>t.currentRoute!=="type-id-settings-description"}},{id:"missing-alt-text",title:s({id:"nags.missing-alt-text.title",defaultMessage:"Add image alt text"}),description:s({id:"nags.missing-alt-text.description",defaultMessage:"Some of your images are missing alt text, which is important for accessibility, especially for visually impaired users."}),status:"warning",shouldShow:t=>{const{hasEmptyAltText:e}=S(t.project.body||"");return e},link:{path:"settings/description",title:s({id:"nags.edit-description.title",defaultMessage:"Edit description"}),shouldShow:t=>t.currentRoute!=="type-id-settings-description"}}];export{p as M,M as a,f as c,A as d};