import{B as e,Bt as t,F as n,L as r,N as i,Nt as a,Pt as o,Vt as s,X as c,Y as l,_t as u,a as d,at as ee,ft as f,g as p,ht as m,it as h,o as g,ot as te,u as ne,vt as _}from"./xY0c-UfG.js";import"./xihTtKlq.js";import"./9K8VREGP.js";import{o as v}from"./yKN1F5Ua2.js";function y(e){return`${e.repo}/${e.entityType}/${e.entityId}/${e.filename}`}function b(e){let t=new Map;for(let n of e){let e=y(n),r=t.get(e);(!r||r.assetId==null&&n.assetId!=null)&&t.set(e,n)}return[...t.values()]}function x(e){return e.split(/[-_/]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function S(e){return e.displayName?.trim()||x(e.repo)}function C(e){return new Map(e.map(e=>[e.repo,e]))}function w(e,t){return t.get(e)?.workspaceWide?`workspace`:`folder`}var T=[`image`,`document`,`font`,`video`,`audio`,`design`,`archive`,`data`,`text`,`other`],E={image:`Images`,document:`Documents`,font:`Fonts`,video:`Videos`,audio:`Audio`,design:`Design files`,archive:`Archives`,data:`Data`,text:`Text`,other:`Other`};function D(e){return E[e]??e}function re(e){let t=new Set(e.map(e=>e.mediaType));return T.filter(e=>t.has(e))}function O(e){return e.replace(/^\d+-/,``)}var k=new Set([`woff2`,`woff`,`ttf`,`otf`]),A={woff2:`woff2`,woff:`woff`,ttf:`truetype`,otf:`opentype`},j=[[/\b(thin|hairline)\b/i,100],[/\b(extra\s*light|extralight|ultra\s*light|ultralight)\b/i,200],[/\blight\b/i,300],[/\b(regular|book|normal|roman)\b/i,400],[/\bmedium\b/i,500],[/\b(semi\s*bold|semibold|demi\s*bold|demibold)\b/i,600],[/\b(extra\s*bold|extrabold|ultra\s*bold|ultrabold)\b/i,800],[/\bbold\b/i,700],[/\b(black|heavy)\b/i,900],[/\bsuper\b/i,1e3]],M=/\b(italic|oblique)\b/i;function N(e){let t=O(e).toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n+1):``}var ie={image:`Image`,document:`Document`,font:`Font`,video:`Video`,audio:`Audio`,design:`Design file`,archive:`Archive`,data:`Data`,text:`Text`,other:`Other`};function ae(e){return L(e)?`Font`:ie[e.mediaType]??D(e.mediaType)}function P(e){return O(e).replace(/\.[^.]+$/,``)}function F(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).split(/\s+/).map(e=>e.trim()).filter(Boolean)}function I(e){return e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}function L(e){return e.mediaType===`font`||e.contentType.startsWith(`font/`)||k.has(N(e.filename))}function oe(e){return A[N(e)]??`opentype`}function R(e){return M.test(F(P(e)).join(` `))?`italic`:`normal`}function z(e){let t=F(P(e)).join(` `);for(let[e,n]of j)if(e.test(t))return n;return 400}function B(e){let t=F(P(e)),n=t.filter(e=>{let t=e.toLowerCase();return![`thin`,`hairline`,`extra`,`ultra`,`light`,`regular`,`book`,`extralight`,`ultralight`,`normal`,`roman`,`medium`,`semi`,`semibold`,`demi`,`demibold`,`bold`,`extrabold`,`ultrabold`,`black`,`heavy`,`super`,`italic`,`oblique`].includes(t)});return(n.length?n:t).join(` `)||`Artifact Font`}function V(e){let t=B(e.filename),n=oe(e.filename),r=z(e.filename),i=R(e.filename);return[`@font-face {`,`  font-family: '${I(t)}';`,`  src: url('${I(e.url)}') format('${n}');`,`  font-weight: ${r};`,`  font-style: ${i};`,`  font-display: swap;`,`}`].join(`
`)}function H(e,t){let n=e.filter(L),r=n.map(V).join(`

`),i=Array.from(new Set(n.map(e=>B(e.filename)))),a=i.length===1?i[0]:i.join(`, `),o=n.map(e=>`[${O(e.filename)}](${e.url})`).join(`

`);return[`## Font Family`,``,a||t,``,`## Faces`,``,o||`- No font files selected.`,``,`## CSS`,``,"```css",r,"```",``,`## Usage`,``,`When a skill uses [[${U(t)}]], include the CSS above before the artifact template CSS.`,i.length===1?`Use \`font-family: '${i[0]}', sans-serif;\`.`:`Use the family names defined in the CSS above.`,``].join(`
`)}function U(e){return`${e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`font-kit`}`}function W(e,t){let n=t.search.trim().toLowerCase(),r=t.folders.length?new Set(t.folders):null,i=t.media.length?new Set(t.media):null;return e.filter(e=>r&&!r.has(e.repo)||i&&!i.has(e.mediaType)?!1:n?O(e.filename).toLowerCase().includes(n)||(e.entityName??``).toLowerCase().includes(n):!0)}function G(e){let t=new Map;for(let n of e)t.set(n.repo,(t.get(n.repo)??0)+1);return t}function K(e){let t=new Map;for(let n of e)t.set(n.mediaType,(t.get(n.mediaType)??0)+1);return t}function se(e,t){return e.workspaceWide===t.workspaceWide?S(e).localeCompare(S(t)):e.workspaceWide?-1:1}function ce(e,t,n){let r=n?1:-1,i=[...e];return t===`name`?i.sort((e,t)=>O(e.filename).localeCompare(O(t.filename),void 0,{numeric:!0,sensitivity:`base`})*r):i.sort((e,t)=>{let n=e.createdAt,i=t.createdAt;return!n&&!i?0:n?i?(n<i?-1:+(n>i))*r:-1:1}),i}function le(e,t){let n=new Set(t.map(e=>e.repo));return e.filter(e=>n.has(e.repo)).sort(se)}function q(e){return e.entityType===`asset`}function J(e){return e.ownerType===`folder`||e.ownerType===`workspace`}function ue(e){return q(e)||J(e)}function Y(e){return q(e)?`entity`:e.assetId?`by-id`:`legacy`}var X=m({folders:[],assets:[],loaded:!1,error:null}),Z=null,Q=!1;function $(){return Z?(Q=!0,Z):(Z=v().then(e=>{X.folders=e.folders,X.assets=b(e.assets),X.loaded=!0,X.error=null}).catch(e=>{X.error=e?.message??`Failed to load assets`}).finally(()=>{Z=null,Q&&(Q=!1,$())}),Z)}function de(){return X.loaded?($(),Promise.resolve()):$()}var fe=e(`<title> </title>`),pe=e(`<svg><!><path d="M6 18 7.41 19.41 15 11.83 15 30 17 30 17 11.83 24.59 19.41 26 18 16 8 6 18z"></path><path d="M6,8V4H26V8h2V4a2,2,0,0,0-2-2H6A2,2,0,0,0,4,4V8Z"></path></svg>`);function me(e,m){let v=d(m,[`children`,`$$slots`,`$$events`,`$$legacy`]),y=d(v,[`size`,`title`]);o(m,!1);let b=u(),x=u(),S=g(m,`size`,8,16),C=g(m,`title`,8,void 0);h(()=>(l(v),l(C())),()=>{_(b,v[`aria-label`]||v[`aria-labelledby`]||C())}),h(()=>(c(b),l(v)),()=>{_(x,{"aria-hidden":c(b)?void 0:!0,role:c(b)?`img`:void 0,focusable:Number(v.tabindex)===0?!0:void 0})}),ee(),ne();var w=pe();p(w,()=>({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,fill:`currentColor`,preserveAspectRatio:`xMidYMid meet`,width:S(),height:S(),...c(x),...y}));var T=f(w),E=e=>{var t=fe(),i=f(t,!0);s(t),te(()=>n(i,C())),r(e,t)};i(T,e=>{C()&&e(E)}),t(2),s(w),r(e,w),a()}export{D as C,w as D,ce as E,J as S,U as T,B as _,ae as a,C as b,H as c,G as d,O as f,V as g,le as h,$ as i,ue as l,S as m,de as n,Y as o,W as p,X as r,y as s,me as t,K as u,R as v,re as w,L as x,z as y};