Files
skills-here-run-place/dist/client/_astro/SkillEditor.DYeR1V3X.js
Alejandro Martinez aa477a553b Add author auth, forking, tags, and stats tracking
Introduce token-based author authentication (register/verify API),
   skill forking with EditGate protection, tag metadata on skills,
   and download/push stats. Enhanced push scripts with token auth
   and per-skill filtering. Updated UI with stats, tags, and
   author info on skill cards.
2026-02-12 14:37:40 +01:00

67 lines
59 KiB
JavaScript

import{c as v,a as o,w as A,v as P,b as q,d as M,n as j,t as L,F as te,r as re,e as ge,f as Le,g as fe,h as lt,i as m,j as it,k as Q,o as S}from"./runtime-dom.esm-bundler.A7MyAQcw.js";import{_ as at}from"./_plugin-vue_export-helper.DlAUqK2U.js";function me(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var H=me();function _e(s){H=s}var D={exec:()=>null};function f(s,e=""){let t=typeof s=="string"?s:s.source,n={replace:(r,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(T.caret,"$1"),t=t.replace(r,l),n},getRegex:()=>new RegExp(t,e)};return n}var ot=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),T={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}>`)},ct=/^(?:[ \t]*(?:\n|$))+/,ut=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,pt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,X=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ht=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,we=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,qe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,De=f(qe).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),dt=f(qe).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,gt=/^[^\n]+/,ve=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ft=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ve).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kt=f(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,we).getRegex(),ae="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Se=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,xt=f("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Se).replace("tag",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ne=f(ye).replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),bt=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ne).getRegex(),Te={blockquote:bt,code:ut,def:ft,fences:pt,heading:ht,hr:X,html:xt,lheading:De,list:kt,newline:ct,paragraph:Ne,table:D,text:gt},Ie=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),mt={...Te,lheading:dt,table:Ie,paragraph:f(ye).replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ie).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex()},wt={...Te,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Se).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:D,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(ye).replace("hr",X).replace("heading",` *#{1,6} *[^
]`).replace("lheading",De).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,He=/^( {2,}|\\)\n(?!\s*$)/,St=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,oe=/[\p{P}\p{S}]/u,Re=/[\s\p{P}\p{S}]/u,Ze=/[^\s\p{P}\p{S}]/u,Tt=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Re).getRegex(),je=/(?!~)[\p{P}\p{S}]/u,Rt=/(?!~)[\s\p{P}\p{S}]/u,At=/(?:[^\s\p{P}\p{S}]|~)/u,Fe=/(?![*_])[\p{P}\p{S}]/u,zt=/(?![*_])[\s\p{P}\p{S}]/u,Ct=/(?:[^\s\p{P}\p{S}]|[*_])/u,$t=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ot?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ve=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Lt=f(Ve,"u").replace(/punct/g,oe).getRegex(),It=f(Ve,"u").replace(/punct/g,je).getRegex(),Ue="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Bt=f(Ue,"gu").replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Re).replace(/punct/g,oe).getRegex(),Et=f(Ue,"gu").replace(/notPunctSpace/g,At).replace(/punctSpace/g,Rt).replace(/punct/g,je).getRegex(),Pt=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Re).replace(/punct/g,oe).getRegex(),Mt=f(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Fe).getRegex(),Ot="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",_t=f(Ot,"gu").replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,zt).replace(/punct/g,Fe).getRegex(),qt=f(/\\(punct)/,"gu").replace(/punct/g,oe).getRegex(),Dt=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Nt=f(Se).replace("(?:-->|$)","-->").getRegex(),Ht=f("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Nt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),se=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Zt=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",se).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Qe=f(/^!?\[(label)\]\[(ref)\]/).replace("label",se).replace("ref",ve).getRegex(),Ge=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",ve).getRegex(),jt=f("reflink|nolink(?!\\()","g").replace("reflink",Qe).replace("nolink",Ge).getRegex(),Be=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ae={_backpedal:D,anyPunctuation:qt,autolink:Dt,blockSkip:$t,br:He,code:vt,del:D,delLDelim:D,delRDelim:D,emStrongLDelim:Lt,emStrongRDelimAst:Bt,emStrongRDelimUnd:Pt,escape:yt,link:Zt,nolink:Ge,punctuation:Tt,reflink:Qe,reflinkSearch:jt,tag:Ht,text:St,url:D},Ft={...Ae,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",se).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se).getRegex()},ke={...Ae,emStrongRDelimAst:Et,emStrongLDelim:It,delLDelim:Mt,delRDelim:_t,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Be).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:f(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Be).getRegex()},Vt={...ke,br:f(He).replace("{2,}","*").getRegex(),text:f(ke.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ne={normal:Te,gfm:mt,pedantic:wt},G={normal:Ae,gfm:ke,breaks:Vt,pedantic:Ft},Ut={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ee=s=>Ut[s];function E(s,e){if(e){if(T.escapeTest.test(s))return s.replace(T.escapeReplace,Ee)}else if(T.escapeTestNoEncode.test(s))return s.replace(T.escapeReplaceNoEncode,Ee);return s}function Pe(s){try{s=encodeURI(s).replace(T.percentDecode,"%")}catch{return null}return s}function Me(s,e){let t=s.replace(T.findPipe,(i,l,c)=>{let a=!1,p=l;for(;--p>=0&&c[p]==="\\";)a=!a;return a?"|":" |"}),n=t.split(T.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(T.slashPipe,"|");return n}function J(s,e,t){let n=s.length;if(n===0)return"";let r=0;for(;r<n&&s.charAt(n-r-1)===e;)r++;return s.slice(0,n-r)}function Qt(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function Gt(s,e=0){let t=e,n="";for(let r of s)if(r===" "){let i=4-t%4;n+=" ".repeat(i),t+=i}else n+=r,t++;return n}function Oe(s,e,t,n,r){let i=e.href,l=e.title||null,c=s[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let a={type:s[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:l,text:c,tokens:n.inlineTokens(c)};return n.state.inLink=!1,a}function Jt(s,e,t){let n=s.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
`).map(i=>{let l=i.match(t.other.beginningSpace);if(l===null)return i;let[c]=l;return c.length>=r.length?i.slice(r.length):i}).join(`
`)}var le=class{options;rules;lexer;constructor(s){this.options=s||H}space(s){let e=this.rules.block.newline.exec(s);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(s){let e=this.rules.block.code.exec(s);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:J(t,`
`)}}}fences(s){let e=this.rules.block.fences.exec(s);if(e){let t=e[0],n=Jt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(s){let e=this.rules.block.heading.exec(s);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=J(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(s){let e=this.rules.block.hr.exec(s);if(e)return{type:"hr",raw:J(e[0],`
`)}}blockquote(s){let e=this.rules.block.blockquote.exec(s);if(e){let t=J(e[0],`
`).split(`
`),n="",r="",i=[];for(;t.length>0;){let l=!1,c=[],a;for(a=0;a<t.length;a++)if(this.rules.other.blockquoteStart.test(t[a]))c.push(t[a]),l=!0;else if(!l)c.push(t[a]);else break;t=t.slice(a);let p=c.join(`
`),u=p.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
${p}`:p,r=r?`${r}
${u}`:u;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=g,t.length===0)break;let d=i.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let w=d,b=w.raw+`
`+t.join(`
`),y=this.blockquote(b);i[i.length-1]=y,n=n.substring(0,n.length-w.raw.length)+y.raw,r=r.substring(0,r.length-w.text.length)+y.text;break}else if(d?.type==="list"){let w=d,b=w.raw+`
`+t.join(`
`),y=this.list(b);i[i.length-1]=y,n=n.substring(0,n.length-d.raw.length)+y.raw,r=r.substring(0,r.length-w.raw.length)+y.raw,t=b.substring(i.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(s){let e=this.rules.block.list.exec(s);if(e){let t=e[1].trim(),n=t.length>1,r={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let i=this.rules.other.listItemRegex(t),l=!1;for(;s;){let a=!1,p="",u="";if(!(e=i.exec(s))||this.rules.block.hr.test(s))break;p=e[0],s=s.substring(p.length);let g=Gt(e[2].split(`
`,1)[0],e[1].length),d=s.split(`
`,1)[0],w=!g.trim(),b=0;if(this.options.pedantic?(b=2,u=g.trimStart()):w?b=e[1].length+1:(b=g.search(this.rules.other.nonSpaceChar),b=b>4?1:b,u=g.slice(b),b+=e[1].length),w&&this.rules.other.blankLine.test(d)&&(p+=d+`
`,s=s.substring(d.length+1),a=!0),!a){let y=this.rules.other.nextBulletRegex(b),I=this.rules.other.hrRegex(b),F=this.rules.other.fencesBeginRegex(b),V=this.rules.other.headingBeginRegex(b),U=this.rules.other.htmlBeginRegex(b),Z=this.rules.other.blockquoteBeginRegex(b);for(;s;){let O=s.split(`
`,1)[0],B;if(d=O,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),B=d):B=d.replace(this.rules.other.tabCharGlobal," "),F.test(d)||V.test(d)||U.test(d)||Z.test(d)||y.test(d)||I.test(d))break;if(B.search(this.rules.other.nonSpaceChar)>=b||!d.trim())u+=`
`+B.slice(b);else{if(w||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||F.test(g)||V.test(g)||I.test(g))break;u+=`
`+d}w=!d.trim(),p+=O+`
`,s=s.substring(O.length+1),g=B.slice(b)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(l=!0)),r.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=p}let c=r.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(a.raw);if(p){let u={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};a.checked=u.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=u.raw+a.tokens[0].raw,a.tokens[0].text=u.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(u)):a.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):a.tokens.unshift(u)}}if(!r.loose){let p=a.tokens.filter(g=>g.type==="space"),u=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));r.loose=u}}if(r.loose)for(let a of r.items){a.loose=!0;for(let p of a.tokens)p.type==="text"&&(p.type="paragraph")}return r}}html(s){let e=this.rules.block.html.exec(s);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(s){let e=this.rules.block.def.exec(s);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:r}}}table(s){let e=this.rules.block.table.exec(s);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Me(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let l of n)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of r)i.rows.push(Me(l,i.header.length).map((c,a)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[a]})));return i}}lheading(s){let e=this.rules.block.lheading.exec(s);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(s){let e=this.rules.block.paragraph.exec(s);if(e){let t=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(s){let e=this.rules.block.text.exec(s);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(s){let e=this.rules.inline.escape.exec(s);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(s){let e=this.rules.inline.tag.exec(s);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(s){let e=this.rules.inline.link.exec(s);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=J(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=Qt(e[2],"()");if(i===-2)return;if(i>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),Oe(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(s,e){let t;if((t=this.rules.inline.reflink.exec(s))||(t=this.rules.inline.nolink.exec(s))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return Oe(t,r,t[0],this.lexer,this.rules)}}emStrong(s,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(s);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let r=[...n[0]].length-1,i,l,c=r,a=0,p=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*s.length+r);(n=p.exec(e))!=null;){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i)continue;if(l=[...i].length,n[3]||n[4]){c+=l;continue}else if((n[5]||n[6])&&r%3&&!((r+l)%3)){a+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+a);let u=[...n[0]][0].length,g=s.slice(0,r+n.index+u+l);if(Math.min(r,l)%2){let w=g.slice(1,-1);return{type:"em",raw:g,text:w,tokens:this.lexer.inlineTokens(w)}}let d=g.slice(2,-2);return{type:"strong",raw:g,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(s){let e=this.rules.inline.code.exec(s);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(s){let e=this.rules.inline.br.exec(s);if(e)return{type:"br",raw:e[0]}}del(s,e,t=""){let n=this.rules.inline.delLDelim.exec(s);if(n&&(!n[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...n[0]].length-1,i,l,c=r,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*s.length+r);(n=a.exec(e))!=null;){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i||(l=[...i].length,l!==r))continue;if(n[3]||n[4]){c+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c);let p=[...n[0]][0].length,u=s.slice(0,r+n.index+p+l),g=u.slice(r,-r);return{type:"del",raw:u,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(s){let e=this.rules.inline.autolink.exec(s);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(s){let e;if(e=this.rules.inline.url.exec(s)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(s){let e=this.rules.inline.text.exec(s);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},z=class xe{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||H,this.options.tokenizer=this.options.tokenizer||new le,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:T,block:ne.normal,inline:G.normal};this.options.pedantic?(t.block=ne.pedantic,t.inline=G.pedantic):this.options.gfm&&(t.block=ne.gfm,this.options.breaks?t.inline=G.breaks:t.inline=G.gfm),this.tokenizer.rules=t}static get rules(){return{block:ne,inline:G}}static lex(e,t){return new xe(t).lex(e)}static lexInline(e,t){return new xe(t).inlineTokens(e)}lex(e){e=e.replace(T.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(T.tabCharGlobal," ").replace(T.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(l=>(r=l.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let l=t.at(-1);r.raw.length===1&&l!==void 0?l.raw+=`
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
`)?"":`
`)+r.raw,l.text+=`
`+r.text,this.inlineQueue.at(-1).src=l.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
`)?"":`
`)+r.raw,l.text+=`
`+r.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let l=1/0,c=e.slice(1),a;this.options.extensions.startBlock.forEach(p=>{a=p.call({lexer:this},c),typeof a=="number"&&a>=0&&(l=Math.min(l,a))}),l<1/0&&l>=0&&(i=e.substring(0,l+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let l=t.at(-1);n&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`
`)?"":`
`)+r.raw,l.text+=`
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let l=t.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
`)?"":`
`)+r.raw,l.text+=`
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(r);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)a.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let l=!1,c="";for(;e;){l||(c=""),l=!1;let a;if(this.options.extensions?.inline?.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let u=t.at(-1);a.type==="text"&&u?.type==="text"?(u.raw+=a.raw,u.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,n,c)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,n,c)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let p=e;if(this.options.extensions?.startInline){let u=1/0,g=e.slice(1),d;this.options.extensions.startInline.forEach(w=>{d=w.call({lexer:this},g),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(p=e.substring(0,u+1))}if(a=this.tokenizer.inlineText(p)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(c=a.raw.slice(-1)),l=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=a.raw,u.text+=a.text):t.push(a);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},ie=class{options;parser;constructor(s){this.options=s||H}space(s){return""}code({text:s,lang:e,escaped:t}){let n=(e||"").match(T.notSpaceStart)?.[0],r=s.replace(T.endingNewline,"")+`
`;return n?'<pre><code class="language-'+E(n)+'">'+(t?r:E(r,!0))+`</code></pre>
`:"<pre><code>"+(t?r:E(r,!0))+`</code></pre>
`}blockquote({tokens:s}){return`<blockquote>
${this.parser.parse(s)}</blockquote>
`}html({text:s}){return s}def(s){return""}heading({tokens:s,depth:e}){return`<h${e}>${this.parser.parseInline(s)}</h${e}>
`}hr(s){return`<hr>
`}list(s){let e=s.ordered,t=s.start,n="";for(let l=0;l<s.items.length;l++){let c=s.items[l];n+=this.listitem(c)}let r=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+r+i+`>
`+n+"</"+r+`>
`}listitem(s){return`<li>${this.parser.parse(s.tokens)}</li>
`}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
`}table(s){let e="",t="";for(let r=0;r<s.header.length;r++)t+=this.tablecell(s.header[r]);e+=this.tablerow({text:t});let n="";for(let r=0;r<s.rows.length;r++){let i=s.rows[r];t="";for(let l=0;l<i.length;l++)t+=this.tablecell(i[l]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+n+`</table>
`}tablerow({text:s}){return`<tr>
${s}</tr>
`}tablecell(s){let e=this.parser.parseInline(s.tokens),t=s.header?"th":"td";return(s.align?`<${t} align="${s.align}">`:`<${t}>`)+e+`</${t}>
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${E(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:e,tokens:t}){let n=this.parser.parseInline(t),r=Pe(s);if(r===null)return n;s=r;let i='<a href="'+s+'"';return e&&(i+=' title="'+E(e)+'"'),i+=">"+n+"</a>",i}image({href:s,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let r=Pe(s);if(r===null)return E(t);s=r;let i=`<img src="${s}" alt="${t}"`;return e&&(i+=` title="${E(e)}"`),i+=">",i}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:E(s.text)}},ze=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},C=class be{options;renderer;textRenderer;constructor(e){this.options=e||H,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ze}static parse(e,t){return new be(t).parse(e)}static parseInline(e,t){return new be(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let l=r,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=c||"";continue}}let i=r;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=c||"";continue}}let l=i;switch(l.type){case"escape":{n+=t.text(l);break}case"html":{n+=t.html(l);break}case"link":{n+=t.link(l);break}case"image":{n+=t.image(l);break}case"checkbox":{n+=t.checkbox(l);break}case"strong":{n+=t.strong(l);break}case"em":{n+=t.em(l);break}case"codespan":{n+=t.codespan(l);break}case"br":{n+=t.br(l);break}case"del":{n+=t.del(l);break}case"text":{n+=t.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},W=class{options;block;constructor(s){this.options=s||H}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(){return this.block?z.lex:z.lexInline}provideParser(){return this.block?C.parse:C.parseInline}},Wt=class{defaults=me();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=C;Renderer=ie;TextRenderer=ze;Lexer=z;Tokenizer=le;Hooks=W;constructor(...s){this.use(...s)}walkTokens(s,e){let t=[];for(let n of s)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let r=n;for(let i of r.header)t=t.concat(this.walkTokens(i.tokens,e));for(let i of r.rows)for(let l of i)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{let r=n;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=n;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let l=r[i].flat(1/0);t=t.concat(this.walkTokens(l,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...s){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...l){let c=r.renderer.apply(this,l);return c===!1&&(c=i.apply(this,l)),c}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),n.extensions=e),t.renderer){let r=this.defaults.renderer||new ie(this.defaults);for(let i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,c=t.renderer[l],a=r[l];r[l]=(...p)=>{let u=c.apply(r,p);return u===!1&&(u=a.apply(r,p)),u||""}}n.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new le(this.defaults);for(let i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,c=t.tokenizer[l],a=r[l];r[l]=(...p)=>{let u=c.apply(r,p);return u===!1&&(u=a.apply(r,p)),u}}n.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new W;for(let i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,c=t.hooks[l],a=r[l];W.passThroughHooks.has(i)?r[l]=p=>{if(this.defaults.async&&W.passThroughHooksRespectAsync.has(i))return(async()=>{let g=await c.call(r,p);return a.call(r,g)})();let u=c.call(r,p);return a.call(r,u)}:r[l]=(...p)=>{if(this.defaults.async)return(async()=>{let g=await c.apply(r,p);return g===!1&&(g=await a.apply(r,p)),g})();let u=c.apply(r,p);return u===!1&&(u=a.apply(r,p)),u}}n.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;n.walkTokens=function(l){let c=[];return c.push(i.call(this,l)),r&&(c=c.concat(r.call(this,l))),c}}this.defaults={...this.defaults,...n}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,e){return z.lex(s,e??this.defaults)}parser(s,e){return C.parse(s,e??this.defaults)}parseMarkdown(s){return(e,t)=>{let n={...t},r={...this.defaults,...n},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=s),r.async)return(async()=>{let l=r.hooks?await r.hooks.preprocess(e):e,c=await(r.hooks?await r.hooks.provideLexer():s?z.lex:z.lexInline)(l,r),a=r.hooks?await r.hooks.processAllTokens(c):c;r.walkTokens&&await Promise.all(this.walkTokens(a,r.walkTokens));let p=await(r.hooks?await r.hooks.provideParser():s?C.parse:C.parseInline)(a,r);return r.hooks?await r.hooks.postprocess(p):p})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let l=(r.hooks?r.hooks.provideLexer():s?z.lex:z.lexInline)(e,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let c=(r.hooks?r.hooks.provideParser():s?C.parse:C.parseInline)(l,r);return r.hooks&&(c=r.hooks.postprocess(c)),c}catch(l){return i(l)}}}onError(s,e){return t=>{if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,s){let n="<p>An error occurred:</p><pre>"+E(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},N=new Wt;function x(s,e){return N.parse(s,e)}x.options=x.setOptions=function(s){return N.setOptions(s),x.defaults=N.defaults,_e(x.defaults),x};x.getDefaults=me;x.defaults=H;x.use=function(...s){return N.use(...s),x.defaults=N.defaults,_e(x.defaults),x};x.walkTokens=function(s,e){return N.walkTokens(s,e)};x.parseInline=N.parseInline;x.Parser=C;x.parser=C.parse;x.Renderer=ie;x.TextRenderer=ze;x.Lexer=z;x.lexer=z.lex;x.Tokenizer=le;x.Hooks=W;x.parse=x;x.options;x.setOptions;x.use;x.walkTokens;x.parseInline;C.parse;z.lex;const Xt=lt({__name:"SkillEditor",props:{mode:{},slug:{},forkOf:{},initialName:{},initialDescription:{},initialAllowedTools:{},initialArgumentHint:{},initialModel:{},initialUserInvocable:{type:Boolean},initialDisableModelInvocation:{type:Boolean},initialContext:{},initialAgent:{},initialHooks:{},initialBody:{},initialAuthor:{},initialAuthorEmail:{},initialTags:{},availableTools:{},availableModels:{},availableTags:{}},setup(s,{expose:e}){e();const t=s,n=t.availableTools??["Bash","Read","Write","Edit","Glob","Grep","WebFetch","WebSearch","Task","NotebookEdit"],r=t.availableModels??[{id:"claude-opus-4-6",display_name:"Claude Opus 4.6"},{id:"claude-sonnet-4-5-20250929",display_name:"Claude Sonnet 4.5"},{id:"claude-haiku-4-5-20251001",display_name:"Claude Haiku 4.5"}],i=Q(()=>!!t.forkOf),l=m(t.initialName||""),c=m(t.initialDescription||""),a=m(t.initialArgumentHint||""),p=m(t.initialModel||""),u=m(t.initialUserInvocable??!0),g=m(t.initialDisableModelInvocation??!1),d=m(t.initialContext||""),w=m(t.initialAgent||""),b=m(t.initialHooks||""),y=m(t.initialTags?t.initialTags.split(",").map(h=>h.trim()).filter(Boolean):[]),I=m(""),F=m(!1),V=m(),U=t.availableTags?t.availableTags.split(",").map(h=>h.trim()).filter(Boolean):[],Z=m(t.initialBody||""),O=m(!1),B=m(""),ce=m(""),ue=m(""),pe=m(typeof localStorage<"u"&&localStorage.getItem("skillshere-token")||""),_=m(new Set(t.initialAllowedTools?t.initialAllowedTools.split(",").map(h=>h.trim()).filter(Boolean):[]));function Je(h){_.value.has(h)?_.value.delete(h):_.value.add(h),_.value=new Set(_.value)}const We=Q(()=>{const h=I.value.toLowerCase().trim(),k=new Set(y.value.map($=>$.toLowerCase())),R=U.filter($=>!k.has($.toLowerCase())&&(!h||$.toLowerCase().includes(h)));return h&&!k.has(h)&&!R.some($=>$.toLowerCase()===h)&&R.push(h),R}),Xe=h=>!U.some(k=>k.toLowerCase()===h.toLowerCase());function he(h){const k=h.trim().toLowerCase();k&&!y.value.some(R=>R.toLowerCase()===k)&&y.value.push(k),I.value="",V.value?.focus()}function Ke(h){y.value.splice(h,1)}function Ye(h){h.key==="Enter"||h.key===","?(h.preventDefault(),I.value.trim()&&he(I.value)):h.key==="Backspace"&&!I.value&&y.value.length&&y.value.pop()}let K;function et(){K=setTimeout(()=>{F.value=!1},200)}function tt(h){clearTimeout(K),he(h)}const Y=Q(()=>t.mode==="edit"&&t.slug?t.slug:l.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"my-skill"),rt=Q(()=>t.forkOf?Y.value===t.forkOf:!1),nt=Q(()=>Z.value.split(`
`).length);let de=m(""),ee;it(Z,h=>{clearTimeout(ee),ee=setTimeout(async()=>{de.value=await x(h||"")},300)},{immediate:!0});function Ce(){const h=[..._.value],k=["---"];if(k.push(`name: ${l.value}`),c.value&&k.push(`description: ${c.value}`),i.value?(ce.value&&k.push(`author: ${ce.value}`),ue.value&&k.push(`author-email: ${ue.value}`),k.push(`fork-of: ${t.forkOf}`)):(t.initialAuthor&&k.push(`author: ${t.initialAuthor}`),t.initialAuthorEmail&&k.push(`author-email: ${t.initialAuthorEmail}`)),a.value&&k.push(`argument-hint: ${a.value}`),h.length>0&&k.push(`allowed-tools: ${h.join(", ")}`),y.value.length>0&&k.push(`tags: ${y.value.join(", ")}`),p.value&&k.push(`model: ${p.value}`),u.value===!1&&k.push("user-invocable: false"),g.value&&k.push("disable-model-invocation: true"),d.value&&k.push(`context: ${d.value}`),w.value&&k.push(`agent: ${w.value}`),b.value.trim())try{const R=JSON.parse(b.value.trim());k.push(`hooks: ${JSON.stringify(R)}`)}catch{}return k.push("---"),k.join(`
`)+`
`+Z.value.trim()+`
`}async function st(){O.value=!0,B.value="";try{const h=Ce(),k={"Content-Type":"application/json"};if(!i.value&&pe.value&&(k.Authorization=`Bearer ${pe.value}`),t.mode==="create"){const R=await fetch("/api/skills",{method:"POST",headers:k,body:JSON.stringify({slug:Y.value,content:h})});if(!R.ok){const $=await R.json();throw new Error($.error||"Failed to create skill")}window.location.href=`/${Y.value}`}else{const R=await fetch(`/api/skills/${t.slug}`,{method:"PUT",headers:k,body:JSON.stringify({content:h})});if(!R.ok){const $=await R.json();throw new Error($.error||"Failed to update skill")}window.location.href=`/${t.slug}`}}catch(h){B.value=h instanceof Error?h.message:"Something went wrong"}finally{O.value=!1}}const $e={props:t,AVAILABLE_TOOLS:n,AVAILABLE_MODELS:r,isFork:i,name:l,description:c,argumentHint:a,model:p,userInvocable:u,disableModelInvocation:g,context:d,agent:w,hooksJson:b,tags:y,tagQuery:I,tagSuggestionsOpen:F,tagInputEl:V,knownTags:U,body:Z,saving:O,error:B,forkAuthorName:ce,forkAuthorEmail:ue,authorToken:pe,selectedTools:_,toggleTool:Je,tagSuggestions:We,isNewTag:Xe,addTag:he,removeTag:Ke,onTagKeydown:Ye,get tagBlurTimer(){return K},set tagBlurTimer(h){K=h},onTagBlur:et,onTagSuggestionClick:tt,computedSlug:Y,slugMatchesOriginal:rt,bodyLines:nt,get previewHtml(){return de},set previewHtml(h){de=h},get debounceTimer(){return ee},set debounceTimer(h){ee=h},buildContent:Ce,save:st};return Object.defineProperty($e,"__isScriptSetup",{enumerable:!1,value:!0}),$e}}),Kt={key:0,class:"rounded-xl border border-[var(--color-accent-500)]/20 bg-[var(--color-accent-500)]/5 p-4 space-y-3"},Yt={class:"grid gap-3 sm:grid-cols-2"},er={key:1,class:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-4"},tr={class:"grid gap-4 sm:grid-cols-2"},rr={class:"mt-1.5 text-xs text-gray-600 flex justify-between"},nr={class:"relative"},sr=["onClick"],lr={key:0,class:"absolute z-10 mt-1 w-full max-h-40 overflow-auto rounded-xl border border-white/[0.08] bg-[var(--color-surface-200)] shadow-xl"},ir=["onMousedown"],ar={key:0,class:"text-[var(--color-accent-500)] text-xs"},or={key:1,class:"text-xs text-gray-600"},cr={class:"flex flex-wrap gap-1.5 rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-3 py-2.5 min-h-[42px]"},ur=["onClick"],pr={class:"grid gap-4 sm:grid-cols-3"},hr=["value"],dr={class:"flex flex-wrap gap-6"},gr={class:"flex items-center gap-2.5 cursor-pointer group"},fr={class:"flex items-center gap-2.5 cursor-pointer group"},kr={class:"group"},xr={class:"mt-3"},br={class:"grid gap-4 lg:grid-cols-2"},mr={class:"flex justify-between text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},wr=["innerHTML"],yr={class:"flex items-center gap-4 pt-2"},vr=["disabled","title"],Sr={key:0,class:"h-4 w-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},Tr={key:0,class:"text-sm text-red-400"};function Rr(s,e,t,n,r,i){return S(),v("form",{onSubmit:fe(n.save,["prevent"]),class:"space-y-6"},[n.isFork?(S(),v("div",Kt,[e[19]||(e[19]=o("p",{class:"text-sm text-[var(--color-accent-400)]"},"Claim this fork as yours. It will stay open for editing until you push from CLI, which registers a token and locks it to you.",-1)),o("div",Yt,[o("div",null,[e[17]||(e[17]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1"},"Your Name",-1)),A(o("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>n.forkAuthorName=l),type:"text",placeholder:"Jane Doe",class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all"},null,512),[[P,n.forkAuthorName]])]),o("div",null,[e[18]||(e[18]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1"},"Your Email",-1)),A(o("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>n.forkAuthorEmail=l),type:"email",placeholder:"jane@example.com",class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all"},null,512),[[P,n.forkAuthorEmail]])])])])):q("",!0),n.isFork&&n.slugMatchesOriginal?(S(),v("div",er,[...e[20]||(e[20]=[o("p",{class:"text-sm text-amber-400"},[M("Change the "),o("strong",null,"name"),M(" to generate a different slug. You can't save a fork with the same slug as the original.")],-1)])])):q("",!0),o("div",tr,[o("div",null,[e[22]||(e[22]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Name",-1)),A(o("input",{"onUpdate:modelValue":e[2]||(e[2]=l=>n.name=l),type:"text",required:"",maxlength:"64",placeholder:"My Awesome Skill",class:j(["w-full rounded-xl border px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:outline-none focus:ring-1 transition-all",n.isFork&&n.slugMatchesOriginal?"border-amber-500/30 bg-[var(--color-surface-100)] focus:border-amber-500/50 focus:ring-amber-500/20":"border-white/[0.06] bg-[var(--color-surface-100)] focus:border-[var(--color-accent-500)]/50 focus:ring-[var(--color-accent-500)]/20"])},null,2),[[P,n.name]]),o("p",rr,[o("span",null,[e[21]||(e[21]=M("Slug: ",-1)),o("code",{class:j(["font-mono",n.isFork&&n.slugMatchesOriginal?"text-amber-500":"text-gray-500"])},L(n.computedSlug),3)]),o("span",{class:j(n.name.length>58?"text-amber-500":"")},L(n.name.length)+"/64",3)])]),o("div",null,[e[23]||(e[23]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Description",-1)),A(o("input",{"onUpdate:modelValue":e[3]||(e[3]=l=>n.description=l),type:"text",maxlength:"200",placeholder:"Brief description of what this skill does",class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all"},null,512),[[P,n.description]]),o("p",{class:j(["mt-1.5 text-xs text-gray-600 text-right",n.description.length>180?"text-amber-500":""])},L(n.description.length)+"/200",3)])]),o("div",nr,[e[25]||(e[25]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Tags",-1)),o("div",{class:"flex flex-wrap items-center gap-1.5 rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-3 py-2 min-h-[42px] cursor-text focus-within:border-[var(--color-accent-500)]/50 focus-within:ring-1 focus-within:ring-[var(--color-accent-500)]/20 transition-all",onClick:e[8]||(e[8]=l=>n.tagInputEl?.focus())},[(S(!0),v(te,null,re(n.tags,(l,c)=>(S(),v("span",{key:l,class:"inline-flex items-center gap-1 rounded-full bg-[var(--color-accent-500)]/15 border border-[var(--color-accent-500)]/25 pl-2.5 pr-1.5 py-0.5 text-xs font-medium text-[var(--color-accent-400)]"},[M(L(l)+" ",1),o("button",{type:"button",onClick:fe(a=>n.removeTag(c),["stop"]),class:"rounded-full p-0.5 hover:bg-[var(--color-accent-500)]/30 transition-colors"},[...e[24]||(e[24]=[o("svg",{class:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2.5"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"})],-1)])],8,sr)]))),128)),A(o("input",{ref:"tagInputEl","onUpdate:modelValue":e[4]||(e[4]=l=>n.tagQuery=l),type:"text",placeholder:"Add tag...",class:"flex-1 min-w-[80px] bg-transparent text-sm text-white placeholder-gray-600 outline-none",onKeydown:n.onTagKeydown,onFocus:e[5]||(e[5]=l=>n.tagSuggestionsOpen=!0),onClick:e[6]||(e[6]=l=>n.tagSuggestionsOpen=!0),onInput:e[7]||(e[7]=l=>n.tagSuggestionsOpen=!0),onBlur:n.onTagBlur},null,544),[[P,n.tagQuery]])]),n.tagSuggestionsOpen&&n.tagSuggestions.length>0?(S(),v("div",lr,[(S(!0),v(te,null,re(n.tagSuggestions,l=>(S(),v("button",{key:l,type:"button",onMousedown:fe(c=>n.onTagSuggestionClick(l),["prevent"]),class:"flex w-full items-center gap-2 px-4 py-2 text-sm text-gray-300 hover:bg-white/[0.06] hover:text-white transition-colors text-left"},[n.isNewTag(l)?(S(),v("span",ar,"+")):q("",!0),M(" "+L(l)+" ",1),n.isNewTag(l)?(S(),v("span",or,"(new)")):q("",!0)],40,ir))),128))])):q("",!0),e[26]||(e[26]=o("p",{class:"mt-1.5 text-xs text-gray-600"},"Type and press Enter or comma. Click suggestions to add.",-1))]),o("div",null,[e[27]||(e[27]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Allowed Tools",-1)),o("div",cr,[(S(!0),v(te,null,re(n.AVAILABLE_TOOLS,l=>(S(),v("button",{key:l,type:"button",onClick:c=>n.toggleTool(l),class:j(["rounded-md px-2.5 py-1 text-xs font-medium transition-all",n.selectedTools.has(l)?"bg-[var(--color-accent-500)] text-white shadow-sm":"bg-white/[0.04] border border-white/[0.06] text-gray-500 hover:text-gray-300 hover:bg-white/[0.08]"])},L(l),11,ur))),128))])]),o("div",pr,[o("div",null,[e[29]||(e[29]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Model",-1)),A(o("select",{"onUpdate:modelValue":e[9]||(e[9]=l=>n.model=l),class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-2.5 text-sm text-white focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all"},[e[28]||(e[28]=o("option",{value:""},"Default",-1)),(S(!0),v(te,null,re(n.AVAILABLE_MODELS,l=>(S(),v("option",{key:l.id,value:l.id},L(l.display_name),9,hr))),128))],512),[[ge,n.model]])]),o("div",null,[e[30]||(e[30]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Argument Hint",-1)),A(o("input",{"onUpdate:modelValue":e[10]||(e[10]=l=>n.argumentHint=l),type:"text",placeholder:"e.g. <file-path>",class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all"},null,512),[[P,n.argumentHint]])]),o("div",null,[e[32]||(e[32]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Agent",-1)),A(o("select",{"onUpdate:modelValue":e[11]||(e[11]=l=>n.agent=l),class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-2.5 text-sm text-white focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all"},[...e[31]||(e[31]=[o("option",{value:""},"general-purpose (default)",-1),o("option",{value:"Explore"},"Explore",-1),o("option",{value:"Plan"},"Plan",-1)])],512),[[ge,n.agent]])])]),o("div",dr,[o("label",gr,[A(o("input",{type:"checkbox","onUpdate:modelValue":e[12]||(e[12]=l=>n.userInvocable=l),class:"sr-only peer"},null,512),[[Le,n.userInvocable]]),e[33]||(e[33]=o("div",{class:"h-5 w-9 rounded-full bg-white/[0.06] border border-white/[0.06] peer-checked:bg-[var(--color-accent-500)] peer-checked:border-[var(--color-accent-500)] relative transition-all after:content-[''] after:absolute after:top-0.5 after:left-0.5 after:h-4 after:w-4 after:rounded-full after:bg-gray-400 after:transition-all peer-checked:after:translate-x-4 peer-checked:after:bg-white"},null,-1)),e[34]||(e[34]=o("span",{class:"text-xs text-gray-500 group-hover:text-gray-300 transition-colors"},[M("User Invocable "),o("span",{class:"text-gray-600"},"(show in /menu)")],-1))]),o("label",fr,[A(o("input",{type:"checkbox","onUpdate:modelValue":e[13]||(e[13]=l=>n.disableModelInvocation=l),class:"sr-only peer"},null,512),[[Le,n.disableModelInvocation]]),e[35]||(e[35]=o("div",{class:"h-5 w-9 rounded-full bg-white/[0.06] border border-white/[0.06] peer-checked:bg-[var(--color-accent-500)] peer-checked:border-[var(--color-accent-500)] relative transition-all after:content-[''] after:absolute after:top-0.5 after:left-0.5 after:h-4 after:w-4 after:rounded-full after:bg-gray-400 after:transition-all peer-checked:after:translate-x-4 peer-checked:after:bg-white"},null,-1)),e[36]||(e[36]=o("span",{class:"text-xs text-gray-500 group-hover:text-gray-300 transition-colors"},[M("Disable Model Invocation "),o("span",{class:"text-gray-600"},"(manual only)")],-1))])]),o("div",null,[e[38]||(e[38]=o("label",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Context",-1)),A(o("select",{"onUpdate:modelValue":e[14]||(e[14]=l=>n.context=l),class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-2.5 text-sm text-white focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all"},[...e[37]||(e[37]=[o("option",{value:""},"Inline (default)",-1),o("option",{value:"fork"},"Fork (run in subagent)",-1)])],512),[[ge,n.context]]),e[39]||(e[39]=o("p",{class:"mt-1.5 text-xs text-gray-600"},"Fork runs the skill in an isolated subagent context",-1))]),o("details",kr,[e[41]||(e[41]=o("summary",{class:"text-xs font-medium uppercase tracking-wider text-gray-500 cursor-pointer hover:text-gray-400 transition-colors"},"Hooks (advanced)",-1)),o("div",xr,[A(o("textarea",{"onUpdate:modelValue":e[15]||(e[15]=l=>n.hooksJson=l),rows:"4",placeholder:'{ "preToolExecution": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "echo pre" }] }] }',class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-3 font-mono text-xs text-white placeholder-gray-700 focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all resize-y"},null,512),[[P,n.hooksJson]]),e[40]||(e[40]=o("p",{class:"mt-1.5 text-xs text-gray-600"},"JSON object. Leave empty to omit.",-1))])]),o("div",br,[o("div",null,[o("label",mr,[e[42]||(e[42]=o("span",null,"Skill Body",-1)),o("span",{class:j(n.bodyLines>400?"text-amber-500":"")},L(n.bodyLines)+"/500 lines",3)]),A(o("textarea",{"onUpdate:modelValue":e[16]||(e[16]=l=>n.body=l),rows:"20",placeholder:`# My Skill
Instructions for Claude...`,class:"w-full rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] px-4 py-3 font-mono text-sm text-white placeholder-gray-600 focus:border-[var(--color-accent-500)]/50 focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-500)]/20 transition-all resize-y leading-relaxed"},null,512),[[P,n.body]])]),o("div",null,[e[43]||(e[43]=o("p",{class:"block text-xs font-medium uppercase tracking-wider text-gray-500 mb-1.5"},"Preview",-1)),o("div",{class:"skill-prose rounded-xl border border-white/[0.06] bg-[var(--color-surface-100)] p-5 min-h-[20rem] overflow-auto",innerHTML:n.previewHtml},null,8,wr)])]),o("div",yr,[o("button",{type:"submit",disabled:n.saving||n.isFork&&n.slugMatchesOriginal,title:n.isFork&&n.slugMatchesOriginal?"Change the name to generate a different slug":"",class:"inline-flex items-center gap-2 rounded-xl bg-[var(--color-accent-500)] px-6 py-2.5 text-sm font-semibold text-white shadow-lg shadow-[var(--color-accent-500)]/20 hover:bg-[var(--color-accent-600)] hover:shadow-[var(--color-accent-500)]/30 disabled:opacity-50 active:scale-[0.97] transition-all"},[n.saving?(S(),v("svg",Sr,[...e[44]||(e[44]=[o("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),o("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},null,-1)])])):q("",!0),M(" "+L(n.saving?"Saving...":n.isFork?"Create Fork":t.mode==="create"?"Create Skill":"Save Changes"),1)],8,vr),e[45]||(e[45]=o("a",{href:"/",class:"text-sm text-gray-600 hover:text-gray-300 transition-colors"},"Cancel",-1)),n.error?(S(),v("p",Tr,L(n.error),1)):q("",!0)])],32)}const Cr=at(Xt,[["render",Rr]]);export{Cr as default};