UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) • 1.3 kB
import{o as $,m as f}from"./section-array-field-uECXIzc8.js";const v="x-deco-matchers-override";function h({pageKey:n,prefix:r,variants:t,selectedIndex:a,decofile:i,meta:s}){if(!n||a<0||a>=t.length)return[];const o=[];for(let e=0;e<=a;e++){const u=t[e];if(!u)continue;const c=u.rule,l=e===a?"1":"0",d=($(c,i,s)?f(c,i,s):null)??`${n}@${r}.${e}.rule`;o.push(`${d}=${l}`)}return o}function p(n,r,t,a){return!r.multivariate||r.variants.length<=1?[]:h({pageKey:n,prefix:"sections.variants",variants:r.variants,selectedIndex:r.index,decofile:t,meta:a})}function x({pageKey:n,page:r,sectionIndex:t,sectionLazy:a,mvObj:i,selectedVariantIndex:s,decofile:o,meta:e}){if(t<0)return[];const c=`${r.multivariate?`sections.variants.${r.index}.value${r.lazyValues?".value":""}`:"sections"}.${t}${a?".section":""}.variants`,l=Array.isArray(i.variants)?i.variants:[];return h({pageKey:n,prefix:c,variants:l,selectedIndex:s,decofile:o,meta:e})}function y(n,r){const t=`${r}@`;return n.map(a=>a.startsWith(t)?`props.${a.slice(t.length)}`:a)}function B(n,r){if(r.length===0)return n;try{const t=new URL(n,"http://local");t.searchParams.delete(v);for(const a of r)t.searchParams.append(v,a);return n.startsWith("http")?t.toString():`${t.pathname}${t.search}${t.hash}`}catch{return n}}export{x as a,p as b,y as i,B as w};