@uniweb/runtime 0.8.1 → 0.8.3

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.
@@ -1,2 +1,2 @@
1
- import{B as h,P as g,U as p,W as _,c as f,g as d}from"../assets/index-C6EFXW_H.js";const a=[50,100,200,300,400,500,600,700,800,900,950],r=["light","medium","dark"],n={light:{bg:"var(--neutral-50)",text:"var(--neutral-950)",heading:"var(--neutral-900)",link:"var(--primary-600)"},medium:{bg:"var(--neutral-100)",text:"var(--neutral-950)",heading:"var(--neutral-900)",link:"var(--primary-600)"},dark:{bg:"var(--neutral-900)",text:"var(--neutral-50)",heading:"white",link:"var(--primary-400)"}};class i{constructor(t={}){this._data=t,this._palettes=t.palettes||t.colors||{},this._rawColors=t.colors||{},this._contexts=t.contexts||{},this._fonts=t.fonts||{},this._appearance=t.appearance||{default:"light"},this._foundationVars=t.foundationVars||{},this._css=t.css||null,Object.seal(this)}get css(){return this._css}get data(){return this._data}getColor(t,e=500){const s=this._palettes[t];return s&&s[e]||null}getPalette(t){return this._palettes[t]||null}getPaletteNames(){return Object.keys(this._palettes)}hasPalette(t){return t in this._palettes}getColorVar(t,e=500){return`var(--${t}-${e})`}getContextToken(t,e){const s=this._contexts[t];return s&&s[e]?s[e]:n[t]?.[e]||null}getContextTokens(t){const e=n[t]||{},s=this._contexts[t]||{};return{...e,...s}}getContextClass(t){return r.includes(t)?`context-${t}`:(console.warn(`Invalid context: ${t}. Using 'light'.`),"context-light")}isValidContext(t){return r.includes(t)}getValidContexts(){return[...r]}getAppearance(){return{default:this._appearance.default||"light",allowToggle:this._appearance.allowToggle||!1,respectSystemPreference:this._appearance.respectSystemPreference??!0,schemes:this._appearance.schemes||["light"]}}getDefaultScheme(){return this._appearance.default||"light"}supportsScheme(t){return(this._appearance.schemes||["light"]).includes(t)}hasSchemeToggle(){return this._appearance.allowToggle===!0}getSchemeClass(t){return`scheme-${t}`}getFonts(){return{...this._fonts}}getFont(t){return this._fonts[t]||null}getFontVar(t){return`var(--font-${t})`}getFoundationVar(t){const e=this._foundationVars[t];return e?typeof e=="object"?e.default:e:null}getFoundationVars(){const t={};for(const[e,s]of Object.entries(this._foundationVars))t[e]=typeof s=="object"?s.default:s;return t}getFoundationVarRef(t){return`var(--${t})`}getShadeLevels(){return[...a]}hasCustomization(){return Object.keys(this._palettes).length>0||Object.keys(this._contexts).length>0||Object.keys(this._fonts).length>0}toJSON(){return{palettes:this._palettes,colors:this._rawColors,contexts:this._contexts,fonts:this._fonts,appearance:this._appearance,foundationVars:this._foundationVars}}}export{h as Block,g as Page,i as Theme,p as Uniweb,_ as Website,f as createUniweb,d as getUniweb};
1
+ import{B as h,P as g,U as p,W as _,c as f,g as d}from"../assets/index-DFtjIARq.js";const a=[50,100,200,300,400,500,600,700,800,900,950],r=["light","medium","dark"],n={light:{bg:"var(--neutral-50)",text:"var(--neutral-950)",heading:"var(--neutral-900)",link:"var(--primary-600)"},medium:{bg:"var(--neutral-100)",text:"var(--neutral-950)",heading:"var(--neutral-900)",link:"var(--primary-600)"},dark:{bg:"var(--neutral-900)",text:"var(--neutral-50)",heading:"white",link:"var(--primary-400)"}};class i{constructor(t={}){this._data=t,this._palettes=t.palettes||t.colors||{},this._rawColors=t.colors||{},this._contexts=t.contexts||{},this._fonts=t.fonts||{},this._appearance=t.appearance||{default:"light"},this._foundationVars=t.foundationVars||{},this._css=t.css||null,Object.seal(this)}get css(){return this._css}get data(){return this._data}getColor(t,e=500){const s=this._palettes[t];return s&&s[e]||null}getPalette(t){return this._palettes[t]||null}getPaletteNames(){return Object.keys(this._palettes)}hasPalette(t){return t in this._palettes}getColorVar(t,e=500){return`var(--${t}-${e})`}getContextToken(t,e){const s=this._contexts[t];return s&&s[e]?s[e]:n[t]?.[e]||null}getContextTokens(t){const e=n[t]||{},s=this._contexts[t]||{};return{...e,...s}}getContextClass(t){return r.includes(t)?`context-${t}`:(console.warn(`Invalid context: ${t}. Using 'light'.`),"context-light")}isValidContext(t){return r.includes(t)}getValidContexts(){return[...r]}getAppearance(){return{default:this._appearance.default||"light",allowToggle:this._appearance.allowToggle||!1,respectSystemPreference:this._appearance.respectSystemPreference??!0,schemes:this._appearance.schemes||["light"]}}getDefaultScheme(){return this._appearance.default||"light"}supportsScheme(t){return(this._appearance.schemes||["light"]).includes(t)}hasSchemeToggle(){return this._appearance.allowToggle===!0}getSchemeClass(t){return`scheme-${t}`}getFonts(){return{...this._fonts}}getFont(t){return this._fonts[t]||null}getFontVar(t){return`var(--font-${t})`}getFoundationVar(t){const e=this._foundationVars[t];return e?typeof e=="object"?e.default:e:null}getFoundationVars(){const t={};for(const[e,s]of Object.entries(this._foundationVars))t[e]=typeof s=="object"?s.default:s;return t}getFoundationVarRef(t){return`var(--${t})`}getShadeLevels(){return[...a]}hasCustomization(){return Object.keys(this._palettes).length>0||Object.keys(this._contexts).length>0||Object.keys(this._fonts).length>0}toJSON(){return{palettes:this._palettes,colors:this._rawColors,contexts:this._contexts,fonts:this._fonts,appearance:this._appearance,foundationVars:this._foundationVars}}}export{h as Block,g as Page,i as Theme,p as Uniweb,_ as Website,f as createUniweb,d as getUniweb};
2
2
  //# sourceMappingURL=@uniweb-core.js.map
@@ -128,6 +128,6 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
128
128
  `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
129
129
  `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const s=!this.onKeyLine&&this.indent===e.indent,i=s&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let r=[];if(i&&t.sep&&!t.value){const o=[];for(let a=0;a<t.sep.length;++a){const l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(H(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Ks(t.key)&&!H(t.sep,"newline")){const o=ee(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(H(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const o=ee(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):H(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!H(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||H(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const i=Ee(s),r=ee(i);Yt(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
130
130
  `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
131
- `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Ee(e),s=ee(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Ee(e),s=ee(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Zn(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new Qn||null,prettyErrors:e}}function ei(n,e={}){const{lineCounter:t,prettyErrors:s}=Zn(e),i=new Xn(t?.addNewLine),r=new Wn(e);let o=null;for(const a of r.compose(i.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new ge(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(o.errors.forEach(Ht(n,t)),o.warnings.forEach(Ht(n,t))),o}function ti(n,e,t){let s;const i=ei(n,t);if(!i)return null;if(i.warnings.forEach(r=>ps(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},t))}function si(n,e){const{language:t,tag:s,data:i}=e||{};if(!s)return n;if(i!==void 0)return i;const r=(t||"").toLowerCase();if(r==="json")try{return JSON.parse(n)}catch{return n}if(r==="yaml"||r==="yml")try{return ti(n)}catch{return n}return n}function Ie(n){return n.type==="UniwebIcon"||n.type==="image"&&n.attrs?.role==="icon"}function kt(n,e={}){const t=[];return ni(n,t,e),t}function ni(n,e,t){n.content&&Array.isArray(n.content)&&n.content?.forEach(s=>{const i=ii(s,t);i&&(Array.isArray(i)?e.push(...i):e.push(i))})}function ii(n,e={}){const t=n.attrs,s=n.content,i=hi(n);if(i)return{type:"link",attrs:i};const r=di(n);if(r)return r;const o=pi(n);if(o)return o;switch(n.type){case"heading":return{type:"heading",level:n.attrs.level,text:te(s,e),children:we(s),attrs:t};case"paragraph":return{type:"paragraph",text:te(s,e),children:we(s),attrs:t};case"blockquote":return{type:"blockquote",children:kt({content:s}),attrs:t};case"dataBlock":return{type:"dataBlock",data:t.data,tag:t.tag};case"codeBlock":{const l=te(s,e);return t?.tag?{type:"dataBlock",tag:t.tag,data:si(l,t)}:{type:"codeBlock",text:l,attrs:t}}case"inset_placeholder":return{type:"inset",refId:t.refId};case"ImageBlock":return{type:"image",attrs:ci(t)};case"image":return{type:"image",attrs:t||{}};case"Video":return{type:"video",attrs:fi(t)};case"bulletList":case"orderedList":{const l=s.map(c=>c.type==="listItem"&&c.content?c.content:null).filter(Boolean);return{type:"list",style:n.type==="bulletList"?"bullet":"ordered",children:l.map(c=>kt({content:c})),attrs:t}}case"DividerBlock":case"horizontalRule":return{type:"divider"};case"card-group":return{type:"card-group",cards:n.content?.filter(l=>l.type==="card"&&!l.attrs?.hidden).map(l=>oi(l.attrs))||[]};case"document-group":return{type:"document-group",documents:n.content?.filter(l=>l.type==="document").map(l=>ai(l.attrs))||[]};case"FormBlock":let a=t?.data;if(typeof a=="string")try{a=JSON.parse(a)}catch{}return{type:"form",data:a,attrs:t};case"button":{let l=te(s,e);return l?{type:"button",text:l,children:we(s),attrs:t}:null}case"UniwebIcon":return{type:"icon",attrs:et(t)};case"Icon":return{type:"icon",attrs:li(t)};default:return{type:n.type,content:te(s,e)}}}function te(n,e={}){return n?n.reduce((t,s)=>{const{type:i,marks:r=[],text:o}=s;if(i==="text"){let a=o||"";if(r.some(l=>l.type==="textStyle")){const l=r.find(c=>c.type==="textStyle")?.attrs?.color;l&&(a=`<span style="color: var(--${l})">${a}</span>`)}if(r.some(l=>l.type==="highlight")&&(a=`<span style="background-color: var(--highlight)">${a}</span>`),r.some(l=>l.type==="span")){const c=r.find(d=>d.type==="span")?.attrs||{},f=[],u=[];c.class&&f.push(`class="${c.class}"`),c.id&&f.push(`id="${c.id}"`);for(const[d,m]of Object.entries(c))d==="class"||d==="id"||(d==="color"?u.push(`color: ${m}`):d==="bg"?u.push(`background: ${m}`):f.push(`${d}="${m}"`));u.length>0&&f.push(`style="${u.join("; ")}"`),a=`<span${f.length>0?` ${f.join(" ")}`:""}>${a}</span>`}if(r.some(l=>l.type==="bold")&&(a=`<strong>${a}</strong>`),r.some(l=>l.type==="italic")&&(a=`<em>${a}</em>`),r.some(l=>l.type==="link")){const l=r.find(m=>m.type==="link"),c=l.attrs.href,f=l.attrs.target||"_self",u=["pdf","doc","docx","xls","xlsx","ppt","pptx","jpg","jpeg","png","webp","gif","svg","mp4","mp3","wav","mov","zip"],h=c.split(".").pop()?.toLowerCase(),d=u.includes(h);a=`<a href="${c}" target="${f}"${d?" download":""}>${a}</a>`}return t+a}else return i==="hardBreak"?t+"<br>":t},"").trim():""}function we(n){if(!n)return[];const e=[];for(const t of n)if(Ie(t))e.push({type:"icon",attrs:et(t.attrs)});else if(t.type==="math-inline")e.push(t);else if(t.type==="text"&&t.marks){const s=t.marks.find(i=>i.type==="link");s&&e.push({type:"link",attrs:{...s.attrs,label:t.text||""}})}return e}const ri="https://assets.uniweb.app/";function Us(n){if(!n||typeof n!="string")return"";const[e,t]=n.split("/");if(!t)return"";const s=t.substring(t.lastIndexOf(".")+1);return`${ri}dist/${e}/base.${s}`}function ve(n){const e=n?.src||n?.url||"";return e||(n?.identifier?Us(n.identifier):"")}function oi(n){const{address:e,...t}=n;let s=null;try{e&&(s=JSON.parse(e))}catch{}const{coverImg:i=null,icon:r}=t;return r&&(t.icon=et(r)),{...t,address:s,coverImg:ve(i)}}function ai(n){const{src:e,info:t={},coverImg:s=null,...i}=n;let r={...i,coverImg:ve(s)};if(e)r.href=e;else{const{identifier:o=""}=t;o&&(r.downloadUrl=Us(o))}return r}function et(n){const{svg:e,url:t,size:s,color:i,preserveColors:r,href:o,target:a,library:l,name:c}=n||{},f={};return e&&(f.svg=e),t&&(f.url=t),s&&(f.size=s),i&&(f.color=i),r&&(f.preserveColors=r),o&&(f.href=o),a&&(f.target=a),l&&(f.library=l),c&&(f.name=c),f}function li(n){let{svg:e}=n;return e}function ci(n){let{info:e,targetId:t,caption:s="",direction:i,filter:r,alt:o="",url:a,href:l="",target:c="",theme:f,role:u,credit:h=""}=n,{contentType:d,viewType:m,contentId:p,identifier:g}=e||{};const b={center:"basic",wide:"lg",fill:"full"};return s=ui(s),g&&(a=ve(e)),{contentType:d,viewType:m,contentId:t||p,url:a,value:g||"",alt:o||s,caption:s,direction:i,filter:r,imgPos:i==="left"||i==="right"?i:"",size:b[i]||"basic",href:l,target:c,theme:f,role:u,credit:h}}function fi(n){let{src:e,caption:t="",direction:s,info:i={},coverImg:r={},alt:o,href:a="",target:l=""}=n;return{src:ve({src:e,...i}),caption:t,direction:s,coverImg:ve(r),alt:o,href:a,target:l}}function ui(n){if(!n||typeof n!="string")return"";const e=n.replace(/<[^>]*>/g,"");return new DOMParser().parseFromString(e,"text/html").body.textContent}function hi(n){if(["paragraph","heading"].includes(n.type)){const e=n?.content||[],t=e.filter(s=>Ie(s)?!1:s.type==="text"?(s.text||"").trim()!=="":!0);if(t.length===1){let s=t[0],i=s?.marks||[];for(let r=0;r<i.length;r++){let o=i[r];if(o?.type==="link"){const a=e.findIndex(f=>f.type==="text"&&f.text===s.text);let l=null,c=null;for(let f=0;f<e.length;f++)if(Ie(e[f])){const u=et(e[f].attrs);f<a?l=u:f>a&&(c||(c=u))}return{...o?.attrs,label:s?.text||"",iconBefore:l,iconAfter:c,children:we(e)}}}}}return!1}function di(n){if(n.type!=="paragraph")return!1;const e=n?.content||[];if(!e.length)return!1;const t=e.filter(i=>!(Ie(i)||i.type==="text"&&!(i.text||"").trim()));return t.length<2||!t.every(i=>i.type!=="text"?!1:i.marks?.some(o=>o.type==="link"))?!1:t.map(i=>({type:"link",attrs:{...i.marks.find(o=>o.type==="link")?.attrs,label:i.text||""}}))}function pi(n){if(!["paragraph","heading"].includes(n.type))return!1;let e=n?.content||[];if(!e.length)return!1;e=e.filter(a=>!Ie(a));let t=e[0]?.marks?.find(a=>a.type==="link"&&a.attrs);if(!t||!e.every(a=>a?.marks?.some(l=>l.type==="link"&&l.attrs?.href===t.attrs?.href)||!1))return!1;const{href:s,target:i}=t.attrs,r=e.map(a=>{const l=a.marks?.filter(c=>c.type!=="link")||[];return{...a,marks:l}});let o=te(r);return o?{type:"paragraph",children:we(n.content),text:`<a target="${i}" href="${s}">${o}</a>`,attrs:n.attrs}:!1}function Qt(n){return n?{title:n.header.title||"",pretitle:n.header.pretitle||"",subtitle:n.header.subtitle||"",paragraphs:n.body.paragraphs||[],links:n.body.links||[],images:n.body.images||[],icons:n.body.icons||[],lists:n.body.lists||[],videos:n.body.videos||[],insets:n.body.insets||[],snippets:n.body.snippets||[],data:n.body.data||{},quotes:n.body.quotes||[],headings:n.body.headings||[]}:null}function gi(n,e={}){if(!n.length)return{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],snippets:[],data:{},quotes:[],headings:[],items:[]};const s=mi(n).map(c=>St(c));let i=null,r=[];ki(s)?(i=s[0],r=s.slice(1)):r=s;const a=Qt(i)||{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],data:{},quotes:[],headings:[]},l=r.map(Qt);return{...a,items:l}}function mi(n){const e=[];let t=[];for(let s=0;s<n.length;s++){const i=n[s];if(i.type==="divider"){t.length>0&&(e.push(t),t=[]);continue}if(i.type==="heading"){const r=s===1&&bi(n,0);t.length>0&&!r&&(e.push(t),t=[]);const o=wi(n,s);t.push(...o),s+=o.length-1}else t.push(i)}return t.length>0&&e.push(t),e}function yi(n,e){return e+1<n.length&&n[e].type==="heading"&&n[e+1].type==="heading"&&n[e].level>n[e+1].level}function bi(n,e){return e+1<n.length&&n[e].type==="image"&&(n[e].role==="banner"||n[e+1].type==="heading")}function wi(n,e){const t=[n[e]];let s=!1;for(let i=e+1;i<n.length;i++){const r=n[i],o=t[t.length-1];if(r.type!=="heading")break;if(r.level-o.level===1){s=!0,t.push(r);continue}if(t.length===1&&r.level<o.level){t.push(r);continue}if(r.level===o.level&&!s){t.push(r);continue}break}return t}function St(n){const e={pretitle:"",title:"",subtitle:""},t={images:[],icons:[],videos:[],insets:[],snippets:[],paragraphs:[],links:[],lists:[],data:{},quotes:[],headings:[]},s={level:null,contentTypes:new Set};if(!n)return{header:e,body:t,metadata:s};let i=null,r=null;for(let o=0;o<n.length;o++){yi(n,o)&&!e.pretitle&&(e.pretitle=n[o].text,o++);const a=n[o];if(a.type==="heading"){if(a.children&&Array.isArray(a.children)&&lt(a.children,t),s.level??=a.level,r!==null&&a.level===r&&i){const l=e[i];Array.isArray(l)?l.push(a.text):e[i]=[l,a.text]}else e.title?e.subtitle?(t.headings.push(a.text),i=null):(e.subtitle=a.text,i="subtitle"):(e.title=a.text,i="title");r=a.level}else if(a.type==="list"){const l=a.children;t.lists.push(l.map(c=>St(c).body))}else{let l={...a.attrs};switch(a.type){case"paragraph":a.children&&Array.isArray(a.children)&&lt(a.children,t),a.text&&t.paragraphs.push(a.text);break;case"image":a.attrs?.role==="icon"?t.icons.push(a.attrs):t.images.push(l);break;case"video":t.videos.push(l);break;case"link":a.children&&Array.isArray(a.children)&&lt(a.children,t),t.links.push(l);break;case"icon":t.icons.push(a.attrs);break;case"button":t.links.push({href:a.attrs?.href||"",label:a.text||"",role:a.attrs?.variant?`button-${a.attrs.variant}`:"button",variant:a.attrs?.variant||"primary",size:a.attrs?.size,icon:a.attrs?.icon,target:a.attrs?.target,class:a.attrs?.class});break;case"blockquote":const c=St(a.children);t.quotes.push(c.body);break;case"dataBlock":t.data[a.tag]=a.data;break;case"codeBlock":t.snippets.push({language:a.attrs?.language||"",code:typeof a.text=="string"?a.text:""});break;case"inset":t.insets.push({refId:a.refId});break;case"form":t.data.form=a.data||a.attrs;break;case"card-group":(a.cards||[]).forEach(f=>{const u=f.cardType||"card";t.data[u]||(t.data[u]=[]);const{cardType:h,...d}=f;t.data[u].push(d)});break;case"document-group":a.documents.forEach(f=>{t.links.push({href:f.href||f.downloadUrl||"",label:f.title||"",role:"document",download:!0,preview:f.coverImg,fileType:f.fileType})});break}}}return{header:e,body:t,metadata:s}}function ki(n){if(n.length===0)return!1;if(n.length===1)return!0;const e=n[0].metadata.level,t=n[1].metadata.level;return!!(e&&(!t||e<t)||!e&&t)}function lt(n,e){n.forEach(t=>{t.type==="icon"?e.icons.push(t.attrs):t.type==="link"&&e.links.push(t.attrs)})}function Si(n,e={}){const t={...e},s=kt(n,t),i=gi(s,t);return{raw:n,sequence:s,...i}}const Ke=[50,100,200,300,400,500,600,700,800,900,950],M={50:.97,100:.93,200:.87,300:.78,400:.68,500:.55,600:.48,700:.4,800:.32,900:.24,950:.14},Ii={50:.15,100:.25,200:.4,300:.65,400:.85,500:1,600:.95,700:.85,800:.75,900:.6,950:.45},vi=M[50]-M[500],Ni=M[500]-M[950],Ue={};for(const n of Ke)n<500?Ue[n]=(M[n]-M[500])/vi:n>500&&(Ue[n]=(M[500]-M[n])/Ni);const Xt={fixed:{hueShift:{light:0,dark:0},chromaBoost:1,lightEndChroma:.15,darkEndChroma:.45},natural:{hueShift:{light:5,dark:-15},chromaBoost:1.1,lightEndChroma:.2,darkEndChroma:.4},vivid:{hueShift:{light:3,dark:-10},chromaBoost:1.4,lightEndChroma:.35,darkEndChroma:.55}};function Li(n){if(!n||typeof n!="string")throw new Error(`Invalid color: ${n}`);const e=n.trim().toLowerCase();if(e.startsWith("oklch("))return Ai(e);if(e.startsWith("#"))return Zt(e);if(e.startsWith("rgb"))return Ci(e);if(e.startsWith("hsl"))return Ti(e);if(/^[0-9a-f]{3,8}$/i.test(e))return Zt("#"+e);throw new Error(`Unsupported color format: ${n}`)}function Ai(n){const e=n.match(/oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)(deg)?\s*\)/);if(!e)throw new Error(`Invalid oklch format: ${n}`);let t=parseFloat(e[1]);e[2]==="%"&&(t/=100);const s=parseFloat(e[3]),i=parseFloat(e[4]);return{l:t,c:s,h:i}}function Zt(n){const e=Oi(n);return jt(e.r,e.g,e.b)}function Oi(n){let e=n.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.length===4&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e.slice(0,6),16);return{r:t>>16&255,g:t>>8&255,b:t&255}}function Ci(n){const e=n.match(/rgba?\(\s*([0-9.]+)[\s,]+([0-9.]+)[\s,]+([0-9.]+)/);if(!e)throw new Error(`Invalid rgb format: ${n}`);const t=parseFloat(e[1]),s=parseFloat(e[2]),i=parseFloat(e[3]);return jt(t,s,i)}function Ti(n){const e=n.match(/hsla?\(\s*([0-9.]+)(deg)?[\s,]+([0-9.]+)%[\s,]+([0-9.]+)%/);if(!e)throw new Error(`Invalid hsl format: ${n}`);const t=parseFloat(e[1]),s=parseFloat(e[3])/100,i=parseFloat(e[4])/100,r=_i(t,s,i);return jt(r.r*255,r.g*255,r.b*255)}function _i(n,e,t){const s=n/360;let i,r,o;if(e===0)i=r=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;i=ct(l,a,s+1/3),r=ct(l,a,s),o=ct(l,a,s-1/3)}return{r:i,g:r,b:o}}function ct(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function jt(n,e,t){n/=255,e/=255,t/=255,n=ft(n),e=ft(e),t=ft(t);const s=.4122214708*n+.5363325363*e+.0514459929*t,i=.2119034982*n+.6806995451*e+.1073969566*t,r=.0883024619*n+.2817188376*e+.6299787005*t,o=Math.cbrt(s),a=Math.cbrt(i),l=Math.cbrt(r),c=.2104542553*o+.793617785*a-.0040720468*l,f=1.9779984951*o-2.428592205*a+.4505937099*l,u=.0259040371*o+.7827717662*a-.808675766*l,h=Math.sqrt(f*f+u*u);let d=Math.atan2(u,f)*(180/Math.PI);return d<0&&(d+=360),{l:c,c:h,h:d}}function ft(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function ut(n){return n<=.0031308?12.92*n:1.055*Math.pow(n,1/2.4)-.055}function tt(n,e,t){const s=t*(Math.PI/180),i=e*Math.cos(s),r=e*Math.sin(s),o=n+.3963377774*i+.2158037573*r,a=n-.1055613458*i-.0638541728*r,l=n-.0894841775*i-1.291485548*r,c=o*o*o,f=a*a*a,u=l*l*l;let h=4.0767416621*c-3.3077115913*f+.2309699292*u,d=-1.2684380046*c+2.6097574011*f-.3413193965*u,m=-.0041960863*c-.7034186147*f+1.707614701*u;return h=Math.round(Math.max(0,Math.min(1,ut(h)))*255),d=Math.round(Math.max(0,Math.min(1,ut(d)))*255),m=Math.round(Math.max(0,Math.min(1,ut(m)))*255),{r:h,g:d,b:m}}function $i(n,e,t){return n>=-.5&&n<=255.5&&e>=-.5&&e<=255.5&&t>=-.5&&t<=255.5}function qs(n,e,t){let s=0,i=t,r=0;for(let o=0;o<8;o++){const a=(s+i)/2,l=tt(n,a,e);$i(l.r,l.g,l.b)?(r=a,s=a):i=a}return r}function es(n,e,t,s){const i=1-s;return i*i*n+2*i*s*e+s*s*t}function Be(n,e,t){return n+(e-n)*t}function ht(n){return n=n%360,n<0?n+360:n}function Ei(n){return n>=0&&n<120||n>300}function qe(n,e,t){const s=(n*100).toFixed(1),i=e.toFixed(4),r=t.toFixed(1);return`oklch(${s}% ${i} ${r})`}function Rt(n,e,t){const s=i=>i.toString(16).padStart(2,"0");return`#${s(n)}${s(e)}${s(t)}`}function ts(n,e={}){const{format:t="oklch",mode:s="fixed",exactMatch:i}=e,r=Li(n),o=Xt[s]||Xt.fixed;return s==="fixed"?Bi(r,n,t,i):Mi(r,n,t,o,i)}function Bi(n,e,t,s){const i={},r=s!==!1;for(const o of Ke){if(r&&o===500){t==="hex"?i[o]=e.startsWith("#")?e:Vs(n):i[o]=qe(n.l,n.c,n.h);continue}let a;r?o<500?a=n.l+Ue[o]*(M[50]-n.l):a=n.l-Ue[o]*(n.l-M[950]):a=M[o];const l=Ii[o],c=n.c*l,f=qs(a,n.h,c);if(t==="hex"){const u=tt(a,f,n.h);i[o]=Rt(u.r,u.g,u.b)}else i[o]=qe(a,f,n.h)}return i}function Mi(n,e,t,s,i){const r={},o=Ei(n.h),a=o?s.hueShift.light:-s.hueShift.light,l=o?s.hueShift.dark:-s.hueShift.dark,c={l:M[50],c:n.c*s.lightEndChroma,h:ht(n.h+a)},f={l:M[950],c:n.c*s.darkEndChroma,h:ht(n.h+l)},u=n.c*s.chromaBoost;for(let h=0;h<Ke.length;h++){const d=Ke[h];if(i!==!1&&d===500){t==="hex"?r[d]=e.startsWith("#")?e:Vs(n):r[d]=qe(n.l,n.c,n.h);continue}let m,p,g;if(h<=5){const y=h/5;m=Be(c.l,n.l,y),g=Be(c.h,n.h,y);const k=(c.c+u)/2;p=es(c.c,k,u,y)}else{const y=(h-5)/5;m=Be(n.l,f.l,y),g=Be(n.h,f.h,y);const k=(u+f.c)/2;p=es(u,k,f.c,y)}g=ht(g);const b=qs(m,g,p);if(t==="hex"){const y=tt(m,b,g);r[d]=Rt(y.r,y.g,y.b)}else r[d]=qe(m,b,g)}return r}function Vs(n){const e=tt(n.l,n.c,n.h);return Rt(e.r,e.g,e.b)}function Ui(n,e={}){const t={};for(const[s,i]of Object.entries(n)){if(typeof i=="object"&&i!==null&&!i.base&&Object.keys(i).some(o=>!isNaN(parseInt(o)))){t[s]=i;continue}if(typeof i=="object"&&i!==null&&i.base){const{base:r,...o}=i;t[s]=ts(r,{...e,...o})}else typeof i=="string"&&(t[s]=ts(i,e))}return t}const ss=new Set([50,100,200,300,400,500,600,700,800,900,950]),ns=/^([a-z][a-z0-9]*)-(\d+)$/,Pi=/^([a-z][a-z0-9]*-\d+)\/(\d+)$/,xi=/^rgba\(\s*(var\(--[^)]+\))\s*\/\s*([\d.]+)\s*\)$/;function is(n){if(typeof n!="string")return n;const e=n.match(xi);if(e){const r=e[1],o=parseFloat(e[2]);return o>=.999?r:`color-mix(in srgb, ${r} ${Math.round(o*100)}%, transparent)`}if(n.includes("(")||n.startsWith("#"))return n;const t=n.replace(/^-{0,2}/,""),s=t.match(Pi);if(s){const r=s[1],o=parseInt(s[2],10),a=r.match(ns);if(a&&ss.has(parseInt(a[2],10)))return o>=100?`var(--${r})`:`color-mix(in srgb, var(--${r}) ${o}%, transparent)`}const i=t.match(ns);if(i){const r=parseInt(i[2],10);if(ss.has(r))return`var(--${t})`}return n}class K{constructor(e,t,s){this.id=t,this.stableId=e.stableId||null,this.page=s,this.website=s.website,this.type=e.type||this.website.getDefaultBlockType(),this.Component=null,this.rawContent=e.content||{},this.parsedContent=this.parseContent(e.content),e.parsedContent?.data&&(this.parsedContent.data={...this.parsedContent.data||{},...e.parsedContent.data}),this.items=this.parsedContent.items||[];const i=e.params||e.config||{};this.preset=e.preset;const r=i.theme;if(r&&typeof r=="object"){const{mode:l,...c}=r;if(this.themeName=l||"",Object.keys(c).length>0){for(const f of Object.keys(c))c[f]=is(c[f]);this.contextOverrides=c}else this.contextOverrides=null}else this.themeName=r??"",this.contextOverrides=null;this.standardOptions=i.standardOptions||{},this.properties=i.properties||i,this.properties.theme&&typeof this.properties.theme=="object"&&(this.properties={...this.properties,theme:this.themeName});const o=i.background;o&&!this.standardOptions.background&&(this.standardOptions={...this.standardOptions,background:K.normalizeBackground(o)}),this.childBlocks=e.subsections?e.subsections.map((l,c)=>new K(l,`${t}_${c}`,this.page)):[],this.insets=[];const a=e.insets;if(a?.length>0)for(let l=0;l<a.length;l++){const c=a[l],f=c.title||"",u=new K({type:c.type,params:c.params||{},content:{title:f},stableId:c.refId,refId:c.refId},`${t}_inset_${l}`,this.page);this.insets.push(u)}this.fetch=e.fetch||null,this.dataLoading=!1,this.hasBackground=!1,this.refId=e.refId||null,this.dynamicContext=e.dynamicContext||null,this.startState=null,this.state=null,this.resetStateHook=null,this.context=null,this.componentVars=null,Object.seal(this)}get path(){return this.page.getNavRoute()}get key(){return`${this.path}-${this.id}`}get parentPath(){return this.dynamicContext?.templateRoute?this.dynamicContext.templateRoute.split("/").slice(0,-1).join("/")||"/":this.path.split("/").slice(0,-1).join("/")||"/"}parseContent(e){return e?.groups?e.groups:e?.type==="doc"?this.extractFromProseMirror(e):e?.doc?.type==="doc"?this.extractFromProseMirror(e.doc):e&&typeof e=="object"&&!Array.isArray(e)?e:{title:"",paragraphs:[],items:[],sequence:[]}}extractFromProseMirror(e){try{return Si(e)}catch(t){return console.warn("[Block] Semantic parser error, using fallback:",t.message),this.extractFromProseMirrorFallback(e)}}extractFromProseMirrorFallback(e){const t={title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],lists:[],icons:[],items:[],sequence:[]};if(!e.content)return t;for(const s of e.content)if(s.type==="heading"){const i=this.extractText(s);s.attrs?.level===1?t.title=i:s.attrs?.level===2&&(t.subtitle=i)}else if(s.type==="paragraph"){const i=this.extractText(s);t.paragraphs.push(i)}return t}extractText(e){return e.content?e.content.filter(t=>t.type==="text").map(t=>t.text).join(""):""}initComponent(){if(this.Component)return this.Component;if(this.Component=globalThis.uniweb?.getComponent(this.type),!this.Component)return console.warn(`[Block] Component not found: ${this.type}`),null;const e=globalThis.uniweb?.getComponentMeta(this.type)||{},t=e.initialState;return this.startState=t?{...t}:null,this.initState(),this.context=e.context?{...e.context}:null,e.vars&&(this.componentVars=K.mergeComponentVars(e.vars,this.properties.vars)),this.Component}getBlockProperties(){return this.properties}getInset(e){return this.insets.find(t=>t.refId===e)||null}getChildBlockRenderer(){return globalThis.uniweb.childBlockRenderer}getBlockLinks(e={}){const t=globalThis.uniweb?.activeWebsite,s=this.parsedContent||{};if(e.nested){const o=(s.lists||[])[0];return K.parseNestedLinks(o,t)}return(s.links||[]).map(r=>({route:t?.makeHref(r.href)||r.href,label:r.label}))}initState(){this.state=this.startState,this.resetStateHook&&this.resetStateHook()}getIndex(){return this.page?this.page.getBlockIndex(this):-1}getBlockInfo(){return{type:this.type,theme:this.themeName,contextOverrides:this.contextOverrides,state:this.state,context:this.context}}getNextBlockInfo(){const e=this.getIndex();return e<0||!this.page?null:this.page.getBlockInfo(e+1)}getPrevBlockInfo(){const e=this.getIndex();return e<=0||!this.page?null:this.page.getBlockInfo(e-1)}useBlockState(e,t){t!==void 0&&this.startState===null?(this.startState=t,this.state=t):t=this.startState;const[s,i]=e(t);return this.resetStateHook=()=>i(t),[s,r=>i(this.state=r)]}getDynamicContext(){return this.dynamicContext}static mergeComponentVars(e,t={}){const s={};for(const[i,r]of Object.entries(e)){const o=typeof r=="string"?r:r?.default;o!=null&&(s[i]=o)}if(t&&typeof t=="object")for(const[i,r]of Object.entries(t))r!=null&&i in e&&(s[i]=String(r));return Object.keys(s).length>0?s:null}static normalizeBackground(e){if(typeof e=="string"){if(/^(\/|\.\/|\.\.\/|https?:\/\/)/.test(e)||/\.(jpe?g|png|webp|gif|svg|avif|mp4|webm|ogv|ogg)$/i.test(e)){const t=e.split(".").pop()?.toLowerCase();return["mp4","webm","ogv","ogg"].includes(t)?{mode:"video",video:{src:e}}:{mode:"image",image:{src:e}}}return/^(linear|radial|conic)-gradient\(/.test(e)?{mode:"gradient",gradient:e}:{mode:"color",color:is(e)}}if(e.mode)return e;if(typeof e.overlay=="number"&&(e={...e,overlay:{enabled:!0,type:"dark",opacity:e.overlay}}),e.video||e.sources)return{mode:"video",...e};if(e.image||e.src){if(e.src){const{src:t,position:s,size:i,lazy:r,...o}=e;return{mode:"image",image:{src:t,position:s,size:i,lazy:r},...o}}if(typeof e.image=="string"){const{image:t,...s}=e;return{mode:"image",image:{src:t},...s}}return{mode:"image",...e}}return e.gradient?{mode:"gradient",...e}:e.color?{mode:"color",...e}:e}static parseNestedLinks(e,t){const s=[];if(!e?.length)return s;for(const i of e){const{links:r=[],lists:o=[],paragraphs:a=[]}=i,l=r[0],c=o[0],f=a[0];let u="",h="",d=[],m=!0;l?(u=l.label,h=l.href,c&&(d=K.parseNestedLinks(c,t))):(u=f,m=!1,c&&(d=K.parseNestedLinks(c,t))),s.push({label:u,route:t?.makeHref(h)||h,child_items:d,hasData:m})}return s}}class Me{constructor(e,t,s){this.id=t,this.stableId=e.id||null,this.route=e.route,this.sourcePath=e.sourcePath||null,this.isIndex=e.isIndex||!1,this.parentRoute=e.parent||null,this.title=e.title||"",this.description=e.description||"",this.label=e.label||null,this.keywords=e.keywords||null,this.lastModified=e.lastModified||null,this.redirect=e.redirect||null,this.rewrite=e.rewrite||null,this.hidden=e.hidden||!1,this.hideInHeader=e.hideInHeader||!1,this.hideInFooter=e.hideInFooter||!1,this.layout={name:e.layout?.name||null,hide:e.layout?.hide||[],params:e.layout?.params||{}},this.seo={noindex:e.seo?.noindex||!1,image:e.seo?.image||null,ogTitle:e.seo?.ogTitle||null,ogDescription:e.seo?.ogDescription||null,canonical:e.seo?.canonical||null,changefreq:e.seo?.changefreq||null,priority:e.seo?.priority||null},this.parent=null,this.children=[],this.website=s,this.scrollY=0,this.fetch=e.fetch||null,this.dynamicContext=e.dynamicContext||null,this.version=e.version||null,this.versionMeta=e.versionMeta||null,this.versionScope=e.versionScope||null,this._hasContent=e.hasContent??e.sections?.length>0,this._bodySections=e.sections,this._bodyBlocks=null,this._loadingContent=null,Object.seal(this)}get bodyBlocks(){if(!this._bodyBlocks){if(this._bodySections===void 0)return[];this._bodyBlocks=(this._bodySections||[]).map((e,t)=>new K(e,t,this))}return this._bodyBlocks}getHeadMeta(){const e=this.getTitle();return{title:e,description:this.description,keywords:this.keywords,canonical:this.seo.canonical,robots:this.seo.noindex?"noindex, nofollow":null,og:{title:this.seo.ogTitle||e,description:this.seo.ogDescription||this.description,image:this.seo.image,url:this.route}}}isDynamicPage(){return this.dynamicContext!==null}getDynamicContext(){return this.dynamicContext}getDynamicParam(){return this.dynamicContext?.paramValue||null}getLayoutName(){return this.layout.name||this.website?.getDefaultLayoutName()||null}getBlockGroups(){return{body:this.bodyBlocks,...this.getLayoutAreas()}}getBlockIndex(e){return this.getPageBlocks().indexOf(e)}getBlockInfo(e){return this.getPageBlocks()[e]?.getBlockInfo()||null}getFirstBodyBlockInfo(){return this.bodyBlocks?.[0]?.getBlockInfo()||null}getPageBlocks(){const e=[],t=this.getLayoutAreas(),s=t.header,i=t.footer;return s&&e.push(...s),e.push(...this.bodyBlocks),i&&e.push(...i),e}getBodyBlocks(){return this.bodyBlocks}getAreaBlocks(e){return this.layout.hide.includes(e)?null:this.website.getAreaBlocks(e,this.getLayoutName())}getLayoutAreas(){const e=this.website.getLayoutAreas(this.getLayoutName()),t={};for(const[s,i]of Object.entries(e))this.layout.hide.includes(s)||(t[s]=i);return t}getLayoutParams(){return this.layout.params}resetBlockStates(){const e=this.getLayoutAreas(),t=[...this.bodyBlocks,...Object.values(e).flat()];for(const s of t)typeof s.initState=="function"&&s.initState()}getNavRoute(){return this.isIndex&&this.route.endsWith("/index")?this.route.slice(0,-6)||"/":this.route}getTitle(){if(this.isIndex&&this.route.endsWith("/index")){const e=this.title?.trim();if(!e||e.toLowerCase()==="index")return this.parent?.title||e||""}return this.title}getLabel(){return this.label||this.getTitle()}isHidden(){return this.hidden}showInHeader(){return!this.hidden&&!this.hideInHeader}showInFooter(){return!this.hidden&&!this.hideInFooter}hasChildren(){return this.children.length>0}hasContent(){return this._hasContent}isContentLoaded(){return this._bodySections!==void 0}async loadContent(){if(this._bodySections===void 0)return this._loadingContent?this._loadingContent:(this._loadingContent=(async()=>{try{const e=this.website.basePath||"",t=this.website.activeLocale!==this.website.defaultLocale?`/${this.website.activeLocale}`:"",s=this.route==="/"?"/index":this.route,i=await fetch(`${e}${t}/_pages${s}.json`);if(!i.ok){console.warn(`[Page] Failed to load content for ${this.route}: ${i.status}`),this._bodySections=[];return}const r=await i.json();this._bodySections=r.sections||[],this._bodyBlocks=null}finally{this._loadingContent=null}})(),this._loadingContent)}getNavigableRoute(){if(this.hasContent())return this.route;const e=this.children||[];if(e.find(s=>s.isIndex))return this.route;for(const s of e){const i=s.getNavigableRoute();if(i)return i}return this.route}getNormalizedRoute(){return this.website.normalizeRoute(this.route)}isActiveFor(e){return this.website.isRouteActive(this.route,e)}isActiveOrAncestor(e){if(this.website.isRouteActive(this.route,e))return!0;const t=this.sourcePath||this.route;return this.website.isRouteActiveOrAncestor(t,e)}isVersioned(){return this.version!==null}getVersion(){return this.version}getVersions(){return this.versionMeta?.versions||[]}isLatestVersion(){return this.version?.latest===!0}isDeprecatedVersion(){return this.version?.deprecated===!0}getVersionUrl(e){return this.isVersioned()?this.website.getVersionUrl(e,this.route):null}}function Pe(n){const{path:e,url:t,schema:s,transform:i}=n;return JSON.stringify({path:e,url:t,schema:s,transform:i})}class ji{constructor(){this._cache=new Map,this._inflight=new Map,this._fetcher=null,this._transforms=new Map,this._listeners=new Set,Object.seal(this)}onUpdate(e){return this._listeners.add(e),()=>this._listeners.delete(e)}registerFetcher(e){this._fetcher=e}registerTransform(e,t){this._transforms.set(e,t)}has(e){return this._cache.has(Pe(e))}get(e){const t=Pe(e);return this._cache.has(t)?this._cache.get(t):null}set(e,t){this._cache.set(Pe(e),t),this._listeners.forEach(s=>s())}async fetch(e){if(!this._fetcher)throw new Error("DataStore: no fetcher registered. Call registerFetcher() first.");const t=Pe(e);if(this._cache.has(t))return{data:this._cache.get(t)};if(this._inflight.has(t))return this._inflight.get(t);const s=this._fetcher(e).then(i=>{this._inflight.delete(t);let r=i.data;return r!=null&&e.transform&&this._transforms.has(e.transform)&&(r=this._transforms.get(e.transform)(r,e)),r!=null&&(this._cache.set(t,r),this._listeners.forEach(o=>o())),{...i,data:r}});return this._inflight.set(t,s),s}clear(){this._cache.clear(),this._inflight.clear(),this._transforms.clear()}}function me(n){if(!n)return n;const e={people:"person",children:"child",men:"men",women:"woman",series:"series"};if(e[n])return e[n];if(n.endsWith("ies"))return n.slice(0,-3)+"y";if(n.endsWith("es")){const t=n.slice(0,-2),s=t.slice(-1);return["s","x","z"].includes(s)||t.endsWith("ch")||t.endsWith("sh")?t:n.slice(0,-1)}return n.endsWith("s")?n.slice(0,-1):n}class Ri{constructor({dataStore:e}){this.dataStore=e,Object.seal(this)}_shouldInheritDetail(e,t){const s=t?.fetch;return s?.inherit===!0&&s?.detail!==void 0?s.detail!==!1:e?e.inheritDetail!==!1:!0}_inheritLimit(e,t){const s=t?.fetch;return s?.inherit===!0&&s?.limit>0?s.limit:e?.inheritLimit>0?e.inheritLimit:null}_inheritOrder(e){const t=e?.fetch;return t?.inherit===!0&&t?.order?.orderBy?t.order:null}_sortItems(e,t){if(!t?.orderBy||!Array.isArray(e)||e.length===0)return e;const{orderBy:s,sortOrder:i="ASC"}=t,r=i==="DESC";return[...e].sort((o,a)=>{const l=o[s]??"",c=a[s]??"",f=typeof l=="string"&&typeof c=="string"?l.localeCompare(c):l>c?1:l<c?-1:0;return r?-f:f})}_getRequestedSchemas(e){if(!e)return null;const t=e.inheritData;return t?Array.isArray(t)?t.length>0?t:null:t===!0?[]:null:null}_localizeConfig(e,t){if(!e.path||!t)return e;const s=t.getActiveLocale(),i=t.getDefaultLocale();return!s||s===i||!e.path.startsWith("/data/")?e:{...e,path:`/${s}${e.path}`}}_findFetchConfigs(e,t){const s=new Map,i=t.length===0,r=[];e.fetch&&!e.fetch.inherit&&r.push(e.fetch);const o=e.page;o?.fetch&&r.push(o.fetch),o?.parent?.fetch&&r.push(o.parent.fetch);const a=e.website?.config?.fetch;a&&r.push(a);const l=e.website;for(const c of r){const f=Array.isArray(c)?c:[c];for(const u of f)u.schema&&(s.has(u.schema)||(i||t.includes(u.schema))&&s.set(u.schema,this._localizeConfig(u,l)))}return s}_buildDetailConfig(e,t){const{detail:s}=e;if(!s)return null;const{paramName:i,paramValue:r}=t;if(!i||r===void 0)return null;const o=e.url||e.path;if(!o)return null;let a;if(s==="rest"){const[c,f]=o.split("?"),u=c.replace(/\/$/,"");a=f?`${u}/${encodeURIComponent(r)}?${f}`:`${u}/${encodeURIComponent(r)}`}else if(s==="query"){const c=o.includes("?")?"&":"?";a=`${o}${c}${i}=${encodeURIComponent(r)}`}else a=s.replace(/\{(\w+)\}/g,(c,f)=>f===i?encodeURIComponent(r):`{${f}}`);return{...!!e.path&&!e.url?{path:a}:{url:a},schema:me(e.schema)||e.schema,transform:e.transform}}_resolveSingularItem(e,t){if(!t)return e;const{paramName:s,paramValue:i,schema:r}=t;if(!r||!s||i===void 0)return e;const o=e[r];if(!Array.isArray(o))return e;const a=me(r),l=o.find(c=>String(c[s])===String(i));return l&&a?{...e,[a]:l}:e}resolve(e,t){let s=this._getRequestedSchemas(t);if(s===null&&e.fetch){const h=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(d=>d.schema).map(d=>d.schema);h.length>0&&(s=h)}if(s===null)return{status:"none",data:null};const i=this._findFetchConfigs(e,s);if(i.size===0)return{status:"none",data:null};const r=e.dynamicContext||e.page?.dynamicContext,o=this._shouldInheritDetail(t,e),a=this._inheritLimit(t,e),l=this._inheritOrder(e),c={};let f=!0;for(const[u,h]of i)if(r&&h.detail&&!o)if(this.dataStore.has(h)){const{paramName:d,paramValue:m}=r,p=this.dataStore.get(h);let g=Array.isArray(p)?p.filter(b=>String(b[d])!==String(m)):p;l&&(g=this._sortItems(g,l)),c[u]=a&&Array.isArray(g)?g.slice(0,a):g}else f=!1;else if(r&&h.detail)if(this.dataStore.has(h)){const d=this.dataStore.get(h),{paramName:m,paramValue:p}=r,g=me(u)||u,b=Array.isArray(d)?d.find(y=>String(y[m])===String(p)):null;if(!b)c[g]=null;else{const y=this._buildDetailConfig(h,r);y&&this.dataStore.has(y)?c[g]=this.dataStore.get(y):y?f=!1:c[g]=b}}else f=!1;else if(this.dataStore.has(h)){const d=this.dataStore.get(h);c[u]=l?this._sortItems(d,l):d}else f=!1;return f?{status:"ready",data:this._resolveSingularItem(c,r)}:{status:"pending",data:null}}async fetch(e,t){let s=this._getRequestedSchemas(t);if(s===null&&e.fetch){const d=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(m=>m.schema).map(m=>m.schema);d.length>0&&(s=d)}if(s===null)return{data:null};const i=this._findFetchConfigs(e,s);if(i.size===0)return{data:null};const r=e.dynamicContext||e.page?.dynamicContext,o=this._shouldInheritDetail(t,e),a=this._inheritLimit(t,e),l=this._inheritOrder(e),c={},f=[];for(const[h,d]of i)if(r&&d.detail&&!o){let m=this.dataStore.has(d)?this.dataStore.get(d):null;if(m===null){const y=await this.dataStore.fetch(d);m=Array.isArray(y.data)?y.data:null}const{paramName:p,paramValue:g}=r;let b=Array.isArray(m)?m.filter(y=>String(y[p])!==String(g)):m??[];l&&(b=this._sortItems(b,l)),c[h]=a&&Array.isArray(b)?b.slice(0,a):b}else if(r&&d.detail){const{paramName:m,paramValue:p}=r,g=me(h)||h;let b=this.dataStore.has(d)?this.dataStore.get(d):null;if(b===null){const S=await this.dataStore.fetch(d);b=Array.isArray(S.data)?S.data:null}const y=b?.find(S=>String(S[m])===String(p))??null;if(!y){c[g]=null;continue}const k=this._buildDetailConfig(d,r);k?f.push(this.dataStore.fetch(k).then(S=>{c[g]=S.data!==void 0&&S.data!==null?S.data:y})):c[g]=y}else f.push(this.dataStore.fetch(d).then(m=>{m.data!==void 0&&m.data!==null&&(c[h]=m.data)}));return f.length>0&&await Promise.all(f),{data:this._resolveSingularItem(c,r)}}}class Fi{constructor(e){const{pages:t=[],theme:s={},config:i={},layouts:r,notFound:o,versionedScopes:a={}}=e;if(this.name=i.name||"",this.description=i.description||"",this.url=i.url||"",this._layoutSets={},r&&typeof r=="object")for(const[f,u]of Object.entries(r)){this._layoutSets[f]={};for(const[h,d]of Object.entries(u))d&&(this._layoutSets[f][h]=new Me(d,`layout-${f}-${h}`,this))}const l=o||t.find(f=>f.route==="/404")||null;this.notFoundPage=l?new Me(l,"notFound",this):null;const c=t.filter(f=>f.route!=="/404");this._dynamicPageData=new Map;for(const f of c)(f.isDynamic||f.route?.includes(":"))&&this._dynamicPageData.set(f.route,f);this._dynamicPageCache=new Map,this.pages=c.map((f,u)=>new Me(f,u,this)),this.buildPageHierarchy(),this.activePage=this.pages.find(f=>f.isIndex&&f.getNavRoute()==="/")||this.pages[0],this.pageRoutes=this.pages.map(f=>f.route),this.themeData=s,this.config=i,this.siteDefaultLocale=i.defaultLanguage||"en",this.defaultLocale=i.domainLocale||this.siteDefaultLocale,this.activeLocale=i.activeLocale||this.defaultLocale,this.locales=this.buildLocalesList(i),this.activeLang=this.activeLocale,this.langs=this.locales.map(f=>({label:f.label||f.code,value:f.code})),this._routeTranslations=this._buildRouteTranslations(i),this.basePath="",this.dataStore=new ji,this.entityStore=new Ri({dataStore:this.dataStore}),this.versionedScopes=a,Object.seal(this)}buildLocalesList(e){const t=e.defaultLanguage||"en",s=e.languages||[],i=o=>typeof o=="string"?{code:o}:{code:o.code,...o.label&&{label:o.label}},r=new Map;r.set(t,{code:t});for(const o of s){const a=i(o);if(r.has(a.code)){const l=r.get(a.code);r.set(a.code,{...l,...a})}else r.set(a.code,a)}return Array.from(r.values()).map(o=>({...o,isDefault:o.code===t}))}_buildRouteTranslations(e){const t=e.i18n?.routeTranslations||{},s={};for(const[i,r]of Object.entries(t)){const o=new Map,a=new Map;for(const[l,c]of Object.entries(r))o.set(l,c),a.set(c,l);s[i]={forward:o,reverse:a}}return s}translateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const s=this._routeTranslations[t];if(!s)return e;const i=s.forward.get(e);if(i)return i;for(const[r,o]of s.forward)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}reverseTranslateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const s=this._routeTranslations[t];if(!s)return e;const i=s.reverse.get(e);if(i)return i;for(const[r,o]of s.reverse)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}buildPageHierarchy(){const e=new Map;for(const t of this.pages)e.set(t.route,t);for(const t of this.pages)if(t.parentRoute){const s=e.get(t.parentRoute);s&&(s.children.push(t),t.parent=s)}for(const t of this.pages){if(t.parent||t.route==="/")continue;const s=t.route.replace(/\/[^/]+$/,"");if(!s||s==="/"||s===t.route)continue;const i=e.get(s);i&&(i.children.push(t),t.parent=i)}this._pageIdMap=new Map;for(const t of this.pages){t.stableId&&this._pageIdMap.set(t.stableId,t);const s=this.normalizeRoute(t.route);if(s&&!this._pageIdMap.has(s)&&this._pageIdMap.set(s,t),t.sourcePath){const i=t.sourcePath.replace(/^\//,"").replace(/\/$/,"");i&&!this._pageIdMap.has(i)&&this._pageIdMap.set(i,t)}}}getPage(e){let t=e;if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const l=`/${this.activeLocale}`;t===l||t===`${l}/`?t="/":t.startsWith(`${l}/`)&&(t=t.slice(l.length))}const s=t==="/"?"/":t.replace(/\/$/,""),i=this.pages.find(l=>l.route===s);if(i){const l=i.children.find(c=>c.isIndex);return l||i}t=this.reverseTranslateRoute(t);const r=t==="/"?"/":t.replace(/\/$/,""),o=this.pages.find(l=>l.route===r);if(o){const l=o.children.find(c=>c.isIndex);return l||o}const a=this.pages.find(l=>l.isIndex&&l.getNavRoute()===r);if(a)return a;if(this._dynamicPageCache.has(r))return this._dynamicPageCache.get(r);for(const l of this.pages){if(!l.route.includes(":"))continue;const c=this._matchDynamicRoute(l.route,r);if(c){const f=this._createDynamicPage(l,r,c.params);if(f){const{page:u,collectionLoaded:h}=f;return h&&this._dynamicPageCache.set(r,u),u}}}}_matchDynamicRoute(e,t){const s=[],i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:(\w+)/g,(l,c)=>(s.push(c),"([^/]+)")),r=new RegExp(`^${i}$`),o=t.match(r);if(!o)return null;const a={};return s.forEach((l,c)=>{a[l]=decodeURIComponent(o[c+1])}),{params:a}}_createDynamicPage(e,t,s){const i=this._dynamicPageData.get(e.route);if(!i)return null;const r=JSON.parse(JSON.stringify(i));r.route=t,r.isDynamic=!1;const o=Object.keys(s)[0],a=Object.values(s)[0],l=i.parentSchema,c=this._singularize(l);if(r.dynamicContext={templateRoute:e.route,params:s,paramName:o,paramValue:a,schema:l,singularSchema:c},r.sections&&Array.isArray(r.sections))for(const d of r.sections)d.dynamicContext=r.dynamicContext;const f=e.route.replace(/\/:[\w]+$/,"")||"/",u=this.pages.find(d=>d.route===f||d.getNavRoute()===f);if(u&&l){const d=u.fetch;let m=[];if(d){const g=Array.isArray(d)?d.find(b=>b.schema===l):d.schema===l?d:null;g&&(m=this.dataStore.get(g)||[])}const p=m.find(g=>String(g[o])===String(a));p?(p.title&&(r.title=p.title),(p.description||p.excerpt)&&(r.description=p.description||p.excerpt)):m.length>0&&(r.title="Not found",r.notFound=!0),r.dynamicContext.currentItem=p||null,r.dynamicContext.allItems=m,r._collectionLoaded=m.length>0}const h=new Me(r,`dynamic-${t}`,this);return h.parent=e.parent,{page:h,collectionLoaded:r._collectionLoaded??!0}}_singularize(e){return me(e)}setActivePage(e){const t=this.getPage(e);t&&(this.activePage=t)}setBasePath(e){!e||e==="/"?this.basePath="":this.basePath=e.endsWith("/")?e.slice(0,-1):e}getRemoteLayout(e){const t=globalThis.uniweb?.foundationConfig;return t?.layouts&&e&&t.layouts[e]?t.layouts[e]:null}getDefaultLayoutName(){return globalThis.uniweb?.foundationConfig?.defaultLayout||null}getDefaultBlockType(){return globalThis.uniweb?.foundationConfig?.defaultSection||"Section"}getAreaBlocks(e,t){return t&&this._layoutSets[t]?this._layoutSets[t][e]?.bodyBlocks||null:this._layoutSets.default&&this._layoutSets.default[e]?.bodyBlocks||null}getLayoutAreas(e){const t=e||"default",s=this._layoutSets[t]||this._layoutSets.default;if(!s)return{};const i={};for(const[r,o]of Object.entries(s))o?.bodyBlocks&&(i[r]=o.bodyBlocks);return i}getLayoutMeta(e){return globalThis.uniweb?.foundationConfig?.layoutMeta?.[e]||null}get viewTransitions(){return globalThis.uniweb.foundationConfig?.viewTransitions!==!1}getRemoteProps(){return globalThis.uniweb?.foundationConfig?.props||null}getRoutingComponents(){return globalThis.uniweb?.routingComponents||{}}makeHref(e){if(!e)return e;let t;if(e.startsWith("page:"))t=e.slice(5);else if(e.startsWith("topic:"))t=e.slice(6);else return e;const[s,i]=t.split("#"),r=this._pageIdMap?.get(s);if(!r)return e;let o=r.route;return i&&(o+=`#section-${i}`),o}getLanguages(){return this.langs}getLanguage(){return this.activeLang}getLocales(){return this.locales}getActiveLocale(){return this.activeLocale}getDefaultLocale(){return this.defaultLocale}hasMultipleLocales(){return this.locales.length>1}setActiveLocale(e){this.locales.find(s=>s.code===e)&&(this.activeLocale=e,this.activeLang=e)}getLocaleUrl(e,t=null){let s=t||this.activePage.getNavRoute();if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const o=`/${this.activeLocale}`;s===o||s===`${o}/`?s="/":s.startsWith(`${o}/`)&&(s=s.slice(o.length))}s=this.reverseTranslateRoute(s);const i=this.config?.domainLocales;if(i){const o=Object.entries(i).find(([,a])=>a===e);if(o){const a=o[0],l=this.translateRoute(s,e);return`https://${a}${l==="/"?"/":l}`}}if(e===this.defaultLocale)return s;const r=this.translateRoute(s,e);return r==="/"?`/${e}/`:`/${e}${r}`}getLocale(e){return this.locales.find(t=>t.code===e)}localize(e,t="",s="",i=!1){const r=s||this.activeLang,o=this.langs[0]?.value||"en";if(typeof e=="object"&&!Array.isArray(e))return i?e?.[r]||e?.[o]||t:e?.[r]||t;if(typeof e=="string"){if(!e.startsWith("{")&&!e.startsWith('"'))return e;try{const a=JSON.parse(e);return typeof a=="object"?i?a?.[r]||a?.[o]||t:a?.[r]||t:a}catch{return e}}return t}isSearchEnabled(){return this.config?.search?.enabled!==!1}getSearchConfig(){const e=this.config?.search||{};return{enabled:this.isSearchEnabled(),indexUrl:this.getSearchIndexUrl(),locale:this.getActiveLocale(),include:{pages:e.include?.pages!==!1,sections:e.include?.sections!==!1,headings:e.include?.headings!==!1,paragraphs:e.include?.paragraphs!==!1,links:e.include?.links!==!1,lists:e.include?.lists!==!1},exclude:{routes:e.exclude?.routes||[],components:e.exclude?.components||[]}}}getSearchIndexUrl(){const e=this.getActiveLocale();return e===this.getDefaultLocale()?"/search-index.json":`/${e}/search-index.json`}getSearchData(){return this.pages.map(e=>({id:e.id,title:e.title,href:e.route,route:e.route,description:e.description,content:e.getPageBlocks().map(t=>t.title).filter(Boolean).join(`
131
+ `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Ee(e),s=ee(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Ee(e),s=ee(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Zn(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new Qn||null,prettyErrors:e}}function ei(n,e={}){const{lineCounter:t,prettyErrors:s}=Zn(e),i=new Xn(t?.addNewLine),r=new Wn(e);let o=null;for(const a of r.compose(i.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new ge(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(o.errors.forEach(Ht(n,t)),o.warnings.forEach(Ht(n,t))),o}function ti(n,e,t){let s;const i=ei(n,t);if(!i)return null;if(i.warnings.forEach(r=>ps(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},t))}function si(n,e){const{language:t,tag:s,data:i}=e||{};if(!s)return n;if(i!==void 0)return i;const r=(t||"").toLowerCase();if(r==="json")try{return JSON.parse(n)}catch{return n}if(r==="yaml"||r==="yml")try{return ti(n)}catch{return n}return n}function Ie(n){return n.type==="UniwebIcon"||n.type==="image"&&n.attrs?.role==="icon"}function kt(n,e={}){const t=[];return ni(n,t,e),t}function ni(n,e,t){n.content&&Array.isArray(n.content)&&n.content?.forEach(s=>{const i=ii(s,t);i&&(Array.isArray(i)?e.push(...i):e.push(i))})}function ii(n,e={}){const t=n.attrs,s=n.content,i=hi(n);if(i)return{type:"link",attrs:i};const r=di(n);if(r)return r;const o=pi(n);if(o)return o;switch(n.type){case"heading":return{type:"heading",level:n.attrs.level,text:te(s,e),children:we(s),attrs:t};case"paragraph":return{type:"paragraph",text:te(s,e),children:we(s),attrs:t};case"blockquote":return{type:"blockquote",children:kt({content:s}),attrs:t};case"dataBlock":return{type:"dataBlock",data:t.data,tag:t.tag};case"codeBlock":{const l=te(s,e);return t?.tag?{type:"dataBlock",tag:t.tag,data:si(l,t)}:{type:"codeBlock",text:l,attrs:t}}case"inset_placeholder":return{type:"inset",refId:t.refId};case"ImageBlock":return{type:"image",attrs:ci(t)};case"image":return{type:"image",attrs:t||{}};case"Video":return{type:"video",attrs:fi(t)};case"bulletList":case"orderedList":{const l=s.map(c=>c.type==="listItem"&&c.content?c.content:null).filter(Boolean);return{type:"list",style:n.type==="bulletList"?"bullet":"ordered",children:l.map(c=>kt({content:c})),attrs:t}}case"DividerBlock":case"horizontalRule":return{type:"divider"};case"card-group":return{type:"card-group",cards:n.content?.filter(l=>l.type==="card"&&!l.attrs?.hidden).map(l=>oi(l.attrs))||[]};case"document-group":return{type:"document-group",documents:n.content?.filter(l=>l.type==="document").map(l=>ai(l.attrs))||[]};case"FormBlock":let a=t?.data;if(typeof a=="string")try{a=JSON.parse(a)}catch{}return{type:"form",data:a,attrs:t};case"button":{let l=te(s,e);return l?{type:"button",text:l,children:we(s),attrs:t}:null}case"UniwebIcon":return{type:"icon",attrs:et(t)};case"Icon":return{type:"icon",attrs:li(t)};default:return{type:n.type,content:te(s,e)}}}function te(n,e={}){return n?n.reduce((t,s)=>{const{type:i,marks:r=[],text:o}=s;if(i==="text"){let a=o||"";if(r.some(l=>l.type==="textStyle")){const l=r.find(c=>c.type==="textStyle")?.attrs?.color;l&&(a=`<span style="color: var(--${l})">${a}</span>`)}if(r.some(l=>l.type==="highlight")&&(a=`<span style="background-color: var(--highlight)">${a}</span>`),r.some(l=>l.type==="span")){const c=r.find(d=>d.type==="span")?.attrs||{},f=[],u=[];c.class&&f.push(`class="${c.class}"`),c.id&&f.push(`id="${c.id}"`);for(const[d,m]of Object.entries(c))d==="class"||d==="id"||(d==="color"?u.push(`color: ${m}`):d==="bg"?u.push(`background: ${m}`):f.push(`${d}="${m}"`));u.length>0&&f.push(`style="${u.join("; ")}"`),a=`<span${f.length>0?` ${f.join(" ")}`:""}>${a}</span>`}if(r.some(l=>l.type==="bold")&&(a=`<strong>${a}</strong>`),r.some(l=>l.type==="italic")&&(a=`<em>${a}</em>`),r.some(l=>l.type==="link")){const l=r.find(m=>m.type==="link"),c=l.attrs.href,f=l.attrs.target||"_self",u=["pdf","doc","docx","xls","xlsx","ppt","pptx","jpg","jpeg","png","webp","gif","svg","mp4","mp3","wav","mov","zip"],h=c.split(".").pop()?.toLowerCase(),d=u.includes(h);a=`<a href="${c}" target="${f}"${d?" download":""}>${a}</a>`}return t+a}else return i==="hardBreak"?t+"<br>":t},"").trim():""}function we(n){if(!n)return[];const e=[];for(const t of n)if(Ie(t))e.push({type:"icon",attrs:et(t.attrs)});else if(t.type==="math-inline")e.push(t);else if(t.type==="text"&&t.marks){const s=t.marks.find(i=>i.type==="link");s&&e.push({type:"link",attrs:{...s.attrs,label:t.text||""}})}return e}const ri="https://assets.uniweb.app/";function Us(n){if(!n||typeof n!="string")return"";const[e,t]=n.split("/");if(!t)return"";const s=t.substring(t.lastIndexOf(".")+1);return`${ri}dist/${e}/base.${s}`}function ve(n){const e=n?.src||n?.url||"";return e||(n?.identifier?Us(n.identifier):"")}function oi(n){const{address:e,...t}=n;let s=null;try{e&&(s=JSON.parse(e))}catch{}const{coverImg:i=null,icon:r}=t;return r&&(t.icon=et(r)),{...t,address:s,coverImg:ve(i)}}function ai(n){const{src:e,info:t={},coverImg:s=null,...i}=n;let r={...i,coverImg:ve(s)};if(e)r.href=e;else{const{identifier:o=""}=t;o&&(r.downloadUrl=Us(o))}return r}function et(n){const{svg:e,url:t,size:s,color:i,preserveColors:r,href:o,target:a,library:l,name:c}=n||{},f={};return e&&(f.svg=e),t&&(f.url=t),s&&(f.size=s),i&&(f.color=i),r&&(f.preserveColors=r),o&&(f.href=o),a&&(f.target=a),l&&(f.library=l),c&&(f.name=c),f}function li(n){let{svg:e}=n;return e}function ci(n){let{info:e,targetId:t,caption:s="",direction:i,filter:r,alt:o="",url:a,href:l="",target:c="",theme:f,role:u,credit:h=""}=n,{contentType:d,viewType:m,contentId:p,identifier:g}=e||{};const b={center:"basic",wide:"lg",fill:"full"};return s=ui(s),g&&(a=ve(e)),{contentType:d,viewType:m,contentId:t||p,url:a,value:g||"",alt:o||s,caption:s,direction:i,filter:r,imgPos:i==="left"||i==="right"?i:"",size:b[i]||"basic",href:l,target:c,theme:f,role:u,credit:h}}function fi(n){let{src:e,caption:t="",direction:s,info:i={},coverImg:r={},alt:o,href:a="",target:l=""}=n;return{src:ve({src:e,...i}),caption:t,direction:s,coverImg:ve(r),alt:o,href:a,target:l}}function ui(n){if(!n||typeof n!="string")return"";const e=n.replace(/<[^>]*>/g,"");return new DOMParser().parseFromString(e,"text/html").body.textContent}function hi(n){if(["paragraph","heading"].includes(n.type)){const e=n?.content||[],t=e.filter(s=>Ie(s)?!1:s.type==="text"?(s.text||"").trim()!=="":!0);if(t.length===1){let s=t[0],i=s?.marks||[];for(let r=0;r<i.length;r++){let o=i[r];if(o?.type==="link"){const a=e.findIndex(f=>f.type==="text"&&f.text===s.text);let l=null,c=null;for(let f=0;f<e.length;f++)if(Ie(e[f])){const u=et(e[f].attrs);f<a?l=u:f>a&&(c||(c=u))}return{...o?.attrs,label:s?.text||"",iconBefore:l,iconAfter:c,children:we(e)}}}}}return!1}function di(n){if(n.type!=="paragraph")return!1;const e=n?.content||[];if(!e.length)return!1;const t=e.filter(i=>!(Ie(i)||i.type==="text"&&!(i.text||"").trim()));return t.length<2||!t.every(i=>i.type!=="text"?!1:i.marks?.some(o=>o.type==="link"))?!1:t.map(i=>({type:"link",attrs:{...i.marks.find(o=>o.type==="link")?.attrs,label:i.text||""}}))}function pi(n){if(!["paragraph","heading"].includes(n.type))return!1;let e=n?.content||[];if(!e.length)return!1;e=e.filter(a=>!Ie(a));let t=e[0]?.marks?.find(a=>a.type==="link"&&a.attrs);if(!t||!e.every(a=>a?.marks?.some(l=>l.type==="link"&&l.attrs?.href===t.attrs?.href)||!1))return!1;const{href:s,target:i}=t.attrs,r=e.map(a=>{const l=a.marks?.filter(c=>c.type!=="link")||[];return{...a,marks:l}});let o=te(r);return o?{type:"paragraph",children:we(n.content),text:`<a target="${i}" href="${s}">${o}</a>`,attrs:n.attrs}:!1}function Qt(n){return n?{title:n.header.title||"",pretitle:n.header.pretitle||"",subtitle:n.header.subtitle||"",paragraphs:n.body.paragraphs||[],links:n.body.links||[],images:n.body.images||[],icons:n.body.icons||[],lists:n.body.lists||[],videos:n.body.videos||[],insets:n.body.insets||[],snippets:n.body.snippets||[],data:n.body.data||{},quotes:n.body.quotes||[],headings:n.body.headings||[]}:null}function gi(n,e={}){if(!n.length)return{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],snippets:[],data:{},quotes:[],headings:[],items:[]};const s=mi(n).map(c=>St(c));let i=null,r=[];ki(s)?(i=s[0],r=s.slice(1)):r=s;const a=Qt(i)||{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],data:{},quotes:[],headings:[]},l=r.map(Qt);return{...a,items:l}}function mi(n){const e=[];let t=[];for(let s=0;s<n.length;s++){const i=n[s];if(i.type==="divider"){t.length>0&&(e.push(t),t=[]);continue}if(i.type==="heading"){const r=s===1&&bi(n,0);t.length>0&&!r&&(e.push(t),t=[]);const o=wi(n,s);t.push(...o),s+=o.length-1}else t.push(i)}return t.length>0&&e.push(t),e}function yi(n,e){return e+1<n.length&&n[e].type==="heading"&&n[e+1].type==="heading"&&n[e].level>n[e+1].level}function bi(n,e){return e+1<n.length&&n[e].type==="image"&&(n[e].role==="banner"||n[e+1].type==="heading")}function wi(n,e){const t=[n[e]];let s=!1;for(let i=e+1;i<n.length;i++){const r=n[i],o=t[t.length-1];if(r.type!=="heading")break;if(r.level-o.level===1){s=!0,t.push(r);continue}if(t.length===1&&r.level<o.level){t.push(r);continue}if(r.level===o.level&&!s){t.push(r);continue}break}return t}function St(n){const e={pretitle:"",title:"",subtitle:""},t={images:[],icons:[],videos:[],insets:[],snippets:[],paragraphs:[],links:[],lists:[],data:{},quotes:[],headings:[]},s={level:null,contentTypes:new Set};if(!n)return{header:e,body:t,metadata:s};let i=null,r=null;for(let o=0;o<n.length;o++){yi(n,o)&&!e.pretitle&&(e.pretitle=n[o].text,o++);const a=n[o];if(a.type==="heading"){if(a.children&&Array.isArray(a.children)&&lt(a.children,t),s.level??=a.level,r!==null&&a.level===r&&i){const l=e[i];Array.isArray(l)?l.push(a.text):e[i]=[l,a.text]}else e.title?e.subtitle?(t.headings.push(a.text),i=null):(e.subtitle=a.text,i="subtitle"):(e.title=a.text,i="title");r=a.level}else if(a.type==="list"){const l=a.children;t.lists.push(l.map(c=>St(c).body))}else{let l={...a.attrs};switch(a.type){case"paragraph":a.children&&Array.isArray(a.children)&&lt(a.children,t),a.text&&t.paragraphs.push(a.text);break;case"image":a.attrs?.role==="icon"?t.icons.push(a.attrs):t.images.push(l);break;case"video":t.videos.push(l);break;case"link":a.children&&Array.isArray(a.children)&&lt(a.children,t),t.links.push(l);break;case"icon":t.icons.push(a.attrs);break;case"button":t.links.push({href:a.attrs?.href||"",label:a.text||"",role:a.attrs?.variant?`button-${a.attrs.variant}`:"button",variant:a.attrs?.variant||"primary",size:a.attrs?.size,icon:a.attrs?.icon,target:a.attrs?.target,class:a.attrs?.class});break;case"blockquote":const c=St(a.children);t.quotes.push(c.body);break;case"dataBlock":t.data[a.tag]=a.data;break;case"codeBlock":t.snippets.push({language:a.attrs?.language||"",code:typeof a.text=="string"?a.text:""});break;case"inset":t.insets.push({refId:a.refId});break;case"form":t.data.form=a.data||a.attrs;break;case"card-group":(a.cards||[]).forEach(f=>{const u=f.cardType||"card";t.data[u]||(t.data[u]=[]);const{cardType:h,...d}=f;t.data[u].push(d)});break;case"document-group":a.documents.forEach(f=>{t.links.push({href:f.href||f.downloadUrl||"",label:f.title||"",role:"document",download:!0,preview:f.coverImg,fileType:f.fileType})});break}}}return{header:e,body:t,metadata:s}}function ki(n){if(n.length===0)return!1;if(n.length===1)return!0;const e=n[0].metadata.level,t=n[1].metadata.level;return!!(e&&(!t||e<t)||!e&&t)}function lt(n,e){n.forEach(t=>{t.type==="icon"?e.icons.push(t.attrs):t.type==="link"&&e.links.push(t.attrs)})}function Si(n,e={}){const t={...e},s=kt(n,t),i=gi(s,t);return{raw:n,sequence:s,...i}}const Ke=[50,100,200,300,400,500,600,700,800,900,950],M={50:.97,100:.93,200:.87,300:.78,400:.68,500:.55,600:.48,700:.4,800:.32,900:.24,950:.14},Ii={50:.15,100:.25,200:.4,300:.65,400:.85,500:1,600:.95,700:.85,800:.75,900:.6,950:.45},vi=M[50]-M[500],Ni=M[500]-M[950],Ue={};for(const n of Ke)n<500?Ue[n]=(M[n]-M[500])/vi:n>500&&(Ue[n]=(M[500]-M[n])/Ni);const Xt={fixed:{hueShift:{light:0,dark:0},chromaBoost:1,lightEndChroma:.15,darkEndChroma:.45},natural:{hueShift:{light:5,dark:-15},chromaBoost:1.1,lightEndChroma:.2,darkEndChroma:.4},vivid:{hueShift:{light:3,dark:-10},chromaBoost:1.4,lightEndChroma:.35,darkEndChroma:.55}};function Li(n){if(!n||typeof n!="string")throw new Error(`Invalid color: ${n}`);const e=n.trim().toLowerCase();if(e.startsWith("oklch("))return Ai(e);if(e.startsWith("#"))return Zt(e);if(e.startsWith("rgb"))return Ci(e);if(e.startsWith("hsl"))return Ti(e);if(/^[0-9a-f]{3,8}$/i.test(e))return Zt("#"+e);throw new Error(`Unsupported color format: ${n}`)}function Ai(n){const e=n.match(/oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)(deg)?\s*\)/);if(!e)throw new Error(`Invalid oklch format: ${n}`);let t=parseFloat(e[1]);e[2]==="%"&&(t/=100);const s=parseFloat(e[3]),i=parseFloat(e[4]);return{l:t,c:s,h:i}}function Zt(n){const e=Oi(n);return jt(e.r,e.g,e.b)}function Oi(n){let e=n.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.length===4&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e.slice(0,6),16);return{r:t>>16&255,g:t>>8&255,b:t&255}}function Ci(n){const e=n.match(/rgba?\(\s*([0-9.]+)[\s,]+([0-9.]+)[\s,]+([0-9.]+)/);if(!e)throw new Error(`Invalid rgb format: ${n}`);const t=parseFloat(e[1]),s=parseFloat(e[2]),i=parseFloat(e[3]);return jt(t,s,i)}function Ti(n){const e=n.match(/hsla?\(\s*([0-9.]+)(deg)?[\s,]+([0-9.]+)%[\s,]+([0-9.]+)%/);if(!e)throw new Error(`Invalid hsl format: ${n}`);const t=parseFloat(e[1]),s=parseFloat(e[3])/100,i=parseFloat(e[4])/100,r=_i(t,s,i);return jt(r.r*255,r.g*255,r.b*255)}function _i(n,e,t){const s=n/360;let i,r,o;if(e===0)i=r=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;i=ct(l,a,s+1/3),r=ct(l,a,s),o=ct(l,a,s-1/3)}return{r:i,g:r,b:o}}function ct(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function jt(n,e,t){n/=255,e/=255,t/=255,n=ft(n),e=ft(e),t=ft(t);const s=.4122214708*n+.5363325363*e+.0514459929*t,i=.2119034982*n+.6806995451*e+.1073969566*t,r=.0883024619*n+.2817188376*e+.6299787005*t,o=Math.cbrt(s),a=Math.cbrt(i),l=Math.cbrt(r),c=.2104542553*o+.793617785*a-.0040720468*l,f=1.9779984951*o-2.428592205*a+.4505937099*l,u=.0259040371*o+.7827717662*a-.808675766*l,h=Math.sqrt(f*f+u*u);let d=Math.atan2(u,f)*(180/Math.PI);return d<0&&(d+=360),{l:c,c:h,h:d}}function ft(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function ut(n){return n<=.0031308?12.92*n:1.055*Math.pow(n,1/2.4)-.055}function tt(n,e,t){const s=t*(Math.PI/180),i=e*Math.cos(s),r=e*Math.sin(s),o=n+.3963377774*i+.2158037573*r,a=n-.1055613458*i-.0638541728*r,l=n-.0894841775*i-1.291485548*r,c=o*o*o,f=a*a*a,u=l*l*l;let h=4.0767416621*c-3.3077115913*f+.2309699292*u,d=-1.2684380046*c+2.6097574011*f-.3413193965*u,m=-.0041960863*c-.7034186147*f+1.707614701*u;return h=Math.round(Math.max(0,Math.min(1,ut(h)))*255),d=Math.round(Math.max(0,Math.min(1,ut(d)))*255),m=Math.round(Math.max(0,Math.min(1,ut(m)))*255),{r:h,g:d,b:m}}function $i(n,e,t){return n>=-.5&&n<=255.5&&e>=-.5&&e<=255.5&&t>=-.5&&t<=255.5}function qs(n,e,t){let s=0,i=t,r=0;for(let o=0;o<8;o++){const a=(s+i)/2,l=tt(n,a,e);$i(l.r,l.g,l.b)?(r=a,s=a):i=a}return r}function es(n,e,t,s){const i=1-s;return i*i*n+2*i*s*e+s*s*t}function Be(n,e,t){return n+(e-n)*t}function ht(n){return n=n%360,n<0?n+360:n}function Ei(n){return n>=0&&n<120||n>300}function qe(n,e,t){const s=(n*100).toFixed(1),i=e.toFixed(4),r=t.toFixed(1);return`oklch(${s}% ${i} ${r})`}function Rt(n,e,t){const s=i=>i.toString(16).padStart(2,"0");return`#${s(n)}${s(e)}${s(t)}`}function ts(n,e={}){const{format:t="oklch",mode:s="fixed",exactMatch:i}=e,r=Li(n),o=Xt[s]||Xt.fixed;return s==="fixed"?Bi(r,n,t,i):Mi(r,n,t,o,i)}function Bi(n,e,t,s){const i={},r=s!==!1;for(const o of Ke){if(r&&o===500){t==="hex"?i[o]=e.startsWith("#")?e:Vs(n):i[o]=qe(n.l,n.c,n.h);continue}let a;r?o<500?a=n.l+Ue[o]*(M[50]-n.l):a=n.l-Ue[o]*(n.l-M[950]):a=M[o];const l=Ii[o],c=n.c*l,f=qs(a,n.h,c);if(t==="hex"){const u=tt(a,f,n.h);i[o]=Rt(u.r,u.g,u.b)}else i[o]=qe(a,f,n.h)}return i}function Mi(n,e,t,s,i){const r={},o=Ei(n.h),a=o?s.hueShift.light:-s.hueShift.light,l=o?s.hueShift.dark:-s.hueShift.dark,c={l:M[50],c:n.c*s.lightEndChroma,h:ht(n.h+a)},f={l:M[950],c:n.c*s.darkEndChroma,h:ht(n.h+l)},u=n.c*s.chromaBoost;for(let h=0;h<Ke.length;h++){const d=Ke[h];if(i!==!1&&d===500){t==="hex"?r[d]=e.startsWith("#")?e:Vs(n):r[d]=qe(n.l,n.c,n.h);continue}let m,p,g;if(h<=5){const y=h/5;m=Be(c.l,n.l,y),g=Be(c.h,n.h,y);const k=(c.c+u)/2;p=es(c.c,k,u,y)}else{const y=(h-5)/5;m=Be(n.l,f.l,y),g=Be(n.h,f.h,y);const k=(u+f.c)/2;p=es(u,k,f.c,y)}g=ht(g);const b=qs(m,g,p);if(t==="hex"){const y=tt(m,b,g);r[d]=Rt(y.r,y.g,y.b)}else r[d]=qe(m,b,g)}return r}function Vs(n){const e=tt(n.l,n.c,n.h);return Rt(e.r,e.g,e.b)}function Ui(n,e={}){const t={};for(const[s,i]of Object.entries(n)){if(typeof i=="object"&&i!==null&&!i.base&&Object.keys(i).some(o=>!isNaN(parseInt(o)))){t[s]=i;continue}if(typeof i=="object"&&i!==null&&i.base){const{base:r,...o}=i;t[s]=ts(r,{...e,...o})}else typeof i=="string"&&(t[s]=ts(i,e))}return t}const ss=new Set([50,100,200,300,400,500,600,700,800,900,950]),ns=/^([a-z][a-z0-9]*)-(\d+)$/,Pi=/^([a-z][a-z0-9]*-\d+)\/(\d+)$/,xi=/^rgba\(\s*(var\(--[^)]+\))\s*\/\s*([\d.]+)\s*\)$/;function is(n){if(typeof n!="string")return n;const e=n.match(xi);if(e){const r=e[1],o=parseFloat(e[2]);return o>=.999?r:`color-mix(in srgb, ${r} ${Math.round(o*100)}%, transparent)`}if(n.includes("(")||n.startsWith("#"))return n;const t=n.replace(/^-{0,2}/,""),s=t.match(Pi);if(s){const r=s[1],o=parseInt(s[2],10),a=r.match(ns);if(a&&ss.has(parseInt(a[2],10)))return o>=100?`var(--${r})`:`color-mix(in srgb, var(--${r}) ${o}%, transparent)`}const i=t.match(ns);if(i){const r=parseInt(i[2],10);if(ss.has(r))return`var(--${t})`}return n}class K{constructor(e,t,s){this.id=t,this.stableId=e.stableId||null,this.page=s,this.website=s.website,this.type=e.type||this.website.getDefaultBlockType(),this.Component=null,this.rawContent=e.content||{},this.parsedContent=this.parseContent(e.content),e.parsedContent?.data&&(this.parsedContent.data={...this.parsedContent.data||{},...e.parsedContent.data}),this.items=this.parsedContent.items||[];const i=e.params||e.config||{};this.preset=e.preset;const r=i.theme;if(r&&typeof r=="object"){const{mode:l,...c}=r;if(this.themeName=l||"",Object.keys(c).length>0){for(const f of Object.keys(c))c[f]=is(c[f]);this.contextOverrides=c}else this.contextOverrides=null}else this.themeName=r??"",this.contextOverrides=null;this.standardOptions=i.standardOptions||{},this.properties=i.properties||i,this.properties.theme&&typeof this.properties.theme=="object"&&(this.properties={...this.properties,theme:this.themeName});const o=i.background;o&&!this.standardOptions.background&&(this.standardOptions={...this.standardOptions,background:K.normalizeBackground(o)}),this.childBlocks=e.subsections?e.subsections.map((l,c)=>new K(l,`${t}_${c}`,this.page)):[],this.insets=[];const a=e.insets;if(a?.length>0)for(let l=0;l<a.length;l++){const c=a[l],f=c.title||"",u=new K({type:c.type,params:c.params||{},content:{title:f},stableId:c.refId,refId:c.refId},`${t}_inset_${l}`,this.page);this.insets.push(u)}this.fetch=e.fetch||null,this.dataLoading=!1,this.hasBackground=!1,this.refId=e.refId||null,this.dynamicContext=e.dynamicContext||null,this.startState=null,this.state=null,this.resetStateHook=null,this.context=null,this.componentVars=null,Object.seal(this)}get path(){return this.page.getNavRoute()}get key(){return`${this.path}-${this.id}`}get parentPath(){return this.dynamicContext?.templateRoute?this.dynamicContext.templateRoute.split("/").slice(0,-1).join("/")||"/":this.path.split("/").slice(0,-1).join("/")||"/"}parseContent(e){if(e?.groups)return e.groups;const t=globalThis.uniweb?.foundationConfig?.handlers?.content;if(t&&typeof t=="function")try{const s=t(e,this);s!==void 0&&(e=s)}catch(s){console.error("Foundation content handler failed:",s)}return e?.type==="doc"?this.extractFromProseMirror(e):e?.doc?.type==="doc"?this.extractFromProseMirror(e.doc):e&&typeof e=="object"&&!Array.isArray(e)?e:{title:"",paragraphs:[],items:[],sequence:[]}}extractFromProseMirror(e){try{return Si(e)}catch(t){return console.warn("[Block] Semantic parser error, using fallback:",t.message),this.extractFromProseMirrorFallback(e)}}extractFromProseMirrorFallback(e){const t={title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],lists:[],icons:[],items:[],sequence:[]};if(!e.content)return t;for(const s of e.content)if(s.type==="heading"){const i=this.extractText(s);s.attrs?.level===1?t.title=i:s.attrs?.level===2&&(t.subtitle=i)}else if(s.type==="paragraph"){const i=this.extractText(s);t.paragraphs.push(i)}return t}extractText(e){return e.content?e.content.filter(t=>t.type==="text").map(t=>t.text).join(""):""}initComponent(){if(this.Component)return this.Component;if(this.Component=globalThis.uniweb?.getComponent(this.type),!this.Component)return console.warn(`[Block] Component not found: ${this.type}`),null;const e=globalThis.uniweb?.getComponentMeta(this.type)||{},t=e.initialState;return this.startState=t?{...t}:null,this.initState(),this.context=e.context?{...e.context}:null,e.vars&&(this.componentVars=K.mergeComponentVars(e.vars,this.properties.vars)),this.Component}getBlockProperties(){return this.properties}getInset(e){return this.insets.find(t=>t.refId===e)||null}getChildBlockRenderer(){return globalThis.uniweb.childBlockRenderer}getBlockLinks(e={}){const t=globalThis.uniweb?.activeWebsite,s=this.parsedContent||{};if(e.nested){const o=(s.lists||[])[0];return K.parseNestedLinks(o,t)}return(s.links||[]).map(r=>({route:t?.makeHref(r.href)||r.href,label:r.label}))}initState(){this.state=this.startState,this.resetStateHook&&this.resetStateHook()}getIndex(){return this.page?this.page.getBlockIndex(this):-1}getBlockInfo(){return{type:this.type,theme:this.themeName,contextOverrides:this.contextOverrides,state:this.state,context:this.context}}getNextBlockInfo(){const e=this.getIndex();return e<0||!this.page?null:this.page.getBlockInfo(e+1)}getPrevBlockInfo(){const e=this.getIndex();return e<=0||!this.page?null:this.page.getBlockInfo(e-1)}useBlockState(e,t){t!==void 0&&this.startState===null?(this.startState=t,this.state=t):t=this.startState;const[s,i]=e(t);return this.resetStateHook=()=>i(t),[s,r=>i(this.state=r)]}getDynamicContext(){return this.dynamicContext}static mergeComponentVars(e,t={}){const s={};for(const[i,r]of Object.entries(e)){const o=typeof r=="string"?r:r?.default;o!=null&&(s[i]=o)}if(t&&typeof t=="object")for(const[i,r]of Object.entries(t))r!=null&&i in e&&(s[i]=String(r));return Object.keys(s).length>0?s:null}static normalizeBackground(e){if(typeof e=="string"){if(/^(\/|\.\/|\.\.\/|https?:\/\/)/.test(e)||/\.(jpe?g|png|webp|gif|svg|avif|mp4|webm|ogv|ogg)$/i.test(e)){const t=e.split(".").pop()?.toLowerCase();return["mp4","webm","ogv","ogg"].includes(t)?{mode:"video",video:{src:e}}:{mode:"image",image:{src:e}}}return/^(linear|radial|conic)-gradient\(/.test(e)?{mode:"gradient",gradient:e}:{mode:"color",color:is(e)}}if(e.mode)return e;if(typeof e.overlay=="number"&&(e={...e,overlay:{enabled:!0,type:"dark",opacity:e.overlay}}),e.video||e.sources)return{mode:"video",...e};if(e.image||e.src){if(e.src){const{src:t,position:s,size:i,lazy:r,...o}=e;return{mode:"image",image:{src:t,position:s,size:i,lazy:r},...o}}if(typeof e.image=="string"){const{image:t,...s}=e;return{mode:"image",image:{src:t},...s}}return{mode:"image",...e}}return e.gradient?{mode:"gradient",...e}:e.color?{mode:"color",...e}:e}static parseNestedLinks(e,t){const s=[];if(!e?.length)return s;for(const i of e){const{links:r=[],lists:o=[],paragraphs:a=[]}=i,l=r[0],c=o[0],f=a[0];let u="",h="",d=[],m=!0;l?(u=l.label,h=l.href,c&&(d=K.parseNestedLinks(c,t))):(u=f,m=!1,c&&(d=K.parseNestedLinks(c,t))),s.push({label:u,route:t?.makeHref(h)||h,child_items:d,hasData:m})}return s}}class Me{constructor(e,t,s){this.id=t,this.stableId=e.id||null,this.route=e.route,this.sourcePath=e.sourcePath||null,this.isIndex=e.isIndex||!1,this.parentRoute=e.parent||null,this.title=e.title||"",this.description=e.description||"",this.label=e.label||null,this.keywords=e.keywords||null,this.lastModified=e.lastModified||null,this.redirect=e.redirect||null,this.rewrite=e.rewrite||null,this.hidden=e.hidden||!1,this.hideInHeader=e.hideInHeader||!1,this.hideInFooter=e.hideInFooter||!1,this.layout={name:e.layout?.name||null,hide:e.layout?.hide||[],params:e.layout?.params||{}},this.seo={noindex:e.seo?.noindex||!1,image:e.seo?.image||null,ogTitle:e.seo?.ogTitle||null,ogDescription:e.seo?.ogDescription||null,canonical:e.seo?.canonical||null,changefreq:e.seo?.changefreq||null,priority:e.seo?.priority||null},this.parent=null,this.children=[],this.website=s,this.scrollY=0,this.fetch=e.fetch||null,this.dynamicContext=e.dynamicContext||null,this.version=e.version||null,this.versionMeta=e.versionMeta||null,this.versionScope=e.versionScope||null,this._hasContent=e.hasContent??e.sections?.length>0,this._bodySections=e.sections,this._bodyBlocks=null,this._loadingContent=null,Object.seal(this)}get bodyBlocks(){if(!this._bodyBlocks){if(this._bodySections===void 0)return[];this._bodyBlocks=(this._bodySections||[]).map((e,t)=>new K(e,t,this))}return this._bodyBlocks}getHeadMeta(){const e=this.getTitle();return{title:e,description:this.description,keywords:this.keywords,canonical:this.seo.canonical,robots:this.seo.noindex?"noindex, nofollow":null,og:{title:this.seo.ogTitle||e,description:this.seo.ogDescription||this.description,image:this.seo.image,url:this.route}}}isDynamicPage(){return this.dynamicContext!==null}getDynamicContext(){return this.dynamicContext}getDynamicParam(){return this.dynamicContext?.paramValue||null}getLayoutName(){return this.layout.name||this.website?.getDefaultLayoutName()||null}getBlockGroups(){return{body:this.bodyBlocks,...this.getLayoutAreas()}}getBlockIndex(e){return this.getPageBlocks().indexOf(e)}getBlockInfo(e){return this.getPageBlocks()[e]?.getBlockInfo()||null}getFirstBodyBlockInfo(){return this.bodyBlocks?.[0]?.getBlockInfo()||null}getPageBlocks(){const e=[],t=this.getLayoutAreas(),s=t.header,i=t.footer;return s&&e.push(...s),e.push(...this.bodyBlocks),i&&e.push(...i),e}getBodyBlocks(){return this.bodyBlocks}getAreaBlocks(e){return this.layout.hide.includes(e)?null:this.website.getAreaBlocks(e,this.getLayoutName())}getLayoutAreas(){const e=this.website.getLayoutAreas(this.getLayoutName()),t={};for(const[s,i]of Object.entries(e))this.layout.hide.includes(s)||(t[s]=i);return t}getLayoutParams(){return this.layout.params}resetBlockStates(){const e=this.getLayoutAreas(),t=[...this.bodyBlocks,...Object.values(e).flat()];for(const s of t)typeof s.initState=="function"&&s.initState()}getNavRoute(){return this.isIndex&&this.route.endsWith("/index")?this.route.slice(0,-6)||"/":this.route}getTitle(){if(this.isIndex&&this.route.endsWith("/index")){const e=this.title?.trim();if(!e||e.toLowerCase()==="index")return this.parent?.title||e||""}return this.title}getLabel(){return this.label||this.getTitle()}isHidden(){return this.hidden}showInHeader(){return!this.hidden&&!this.hideInHeader}showInFooter(){return!this.hidden&&!this.hideInFooter}hasChildren(){return this.children.length>0}hasContent(){return this._hasContent}isContentLoaded(){return this._bodySections!==void 0}async loadContent(){if(this._bodySections===void 0)return this._loadingContent?this._loadingContent:(this._loadingContent=(async()=>{try{const e=this.website.basePath||"",t=this.website.activeLocale!==this.website.defaultLocale?`/${this.website.activeLocale}`:"",s=this.route==="/"?"/index":this.route,i=await fetch(`${e}${t}/_pages${s}.json`);if(!i.ok){console.warn(`[Page] Failed to load content for ${this.route}: ${i.status}`),this._bodySections=[];return}const r=await i.json();this._bodySections=r.sections||[],this._bodyBlocks=null}finally{this._loadingContent=null}})(),this._loadingContent)}getNavigableRoute(){if(this.hasContent())return this.route;const e=this.children||[];if(e.find(s=>s.isIndex))return this.route;for(const s of e){const i=s.getNavigableRoute();if(i)return i}return this.route}getNormalizedRoute(){return this.website.normalizeRoute(this.route)}isActiveFor(e){return this.website.isRouteActive(this.route,e)}isActiveOrAncestor(e){if(this.website.isRouteActive(this.route,e))return!0;const t=this.sourcePath||this.route;return this.website.isRouteActiveOrAncestor(t,e)}isVersioned(){return this.version!==null}getVersion(){return this.version}getVersions(){return this.versionMeta?.versions||[]}isLatestVersion(){return this.version?.latest===!0}isDeprecatedVersion(){return this.version?.deprecated===!0}getVersionUrl(e){return this.isVersioned()?this.website.getVersionUrl(e,this.route):null}}function Pe(n){const{path:e,url:t,schema:s,transform:i}=n;return JSON.stringify({path:e,url:t,schema:s,transform:i})}class ji{constructor(){this._cache=new Map,this._inflight=new Map,this._fetcher=null,this._transforms=new Map,this._listeners=new Set,Object.seal(this)}onUpdate(e){return this._listeners.add(e),()=>this._listeners.delete(e)}registerFetcher(e){this._fetcher=e}registerTransform(e,t){this._transforms.set(e,t)}has(e){return this._cache.has(Pe(e))}get(e){const t=Pe(e);return this._cache.has(t)?this._cache.get(t):null}set(e,t){this._cache.set(Pe(e),t),this._listeners.forEach(s=>s())}async fetch(e){if(!this._fetcher)throw new Error("DataStore: no fetcher registered. Call registerFetcher() first.");const t=Pe(e);if(this._cache.has(t))return{data:this._cache.get(t)};if(this._inflight.has(t))return this._inflight.get(t);const s=this._fetcher(e).then(i=>{this._inflight.delete(t);let r=i.data;return r!=null&&e.transform&&this._transforms.has(e.transform)&&(r=this._transforms.get(e.transform)(r,e)),r!=null&&(this._cache.set(t,r),this._listeners.forEach(o=>o())),{...i,data:r}});return this._inflight.set(t,s),s}clear(){this._cache.clear(),this._inflight.clear(),this._transforms.clear()}}function me(n){if(!n)return n;const e={people:"person",children:"child",men:"men",women:"woman",series:"series"};if(e[n])return e[n];if(n.endsWith("ies"))return n.slice(0,-3)+"y";if(n.endsWith("es")){const t=n.slice(0,-2),s=t.slice(-1);return["s","x","z"].includes(s)||t.endsWith("ch")||t.endsWith("sh")?t:n.slice(0,-1)}return n.endsWith("s")?n.slice(0,-1):n}class Ri{constructor({dataStore:e}){this.dataStore=e,Object.seal(this)}_shouldInheritDetail(e,t){const s=t?.fetch;return s?.inherit===!0&&s?.detail!==void 0?s.detail!==!1:e?e.inheritDetail!==!1:!0}_inheritLimit(e,t){const s=t?.fetch;return s?.inherit===!0&&s?.limit>0?s.limit:e?.inheritLimit>0?e.inheritLimit:null}_inheritOrder(e){const t=e?.fetch;return t?.inherit===!0&&t?.order?.orderBy?t.order:null}_sortItems(e,t){if(!t?.orderBy||!Array.isArray(e)||e.length===0)return e;const{orderBy:s,sortOrder:i="ASC"}=t,r=i==="DESC";return[...e].sort((o,a)=>{const l=o[s]??"",c=a[s]??"",f=typeof l=="string"&&typeof c=="string"?l.localeCompare(c):l>c?1:l<c?-1:0;return r?-f:f})}_getRequestedSchemas(e){if(!e)return null;const t=e.inheritData;return t?Array.isArray(t)?t.length>0?t:null:t===!0?[]:null:null}_localizeConfig(e,t){if(!e.path||!t)return e;const s=t.getActiveLocale(),i=t.getDefaultLocale();return!s||s===i||!e.path.startsWith("/data/")?e:{...e,path:`/${s}${e.path}`}}_findFetchConfigs(e,t){const s=new Map,i=t.length===0,r=[];e.fetch&&!e.fetch.inherit&&r.push(e.fetch);const o=e.page;o?.fetch&&r.push(o.fetch),o?.parent?.fetch&&r.push(o.parent.fetch);const a=e.website?.config?.fetch;a&&r.push(a);const l=e.website;for(const c of r){const f=Array.isArray(c)?c:[c];for(const u of f)u.schema&&(s.has(u.schema)||(i||t.includes(u.schema))&&s.set(u.schema,this._localizeConfig(u,l)))}return s}_buildDetailConfig(e,t){const{detail:s}=e;if(!s)return null;const{paramName:i,paramValue:r}=t;if(!i||r===void 0)return null;const o=e.url||e.path;if(!o)return null;let a;if(s==="rest"){const[c,f]=o.split("?"),u=c.replace(/\/$/,"");a=f?`${u}/${encodeURIComponent(r)}?${f}`:`${u}/${encodeURIComponent(r)}`}else if(s==="query"){const c=o.includes("?")?"&":"?";a=`${o}${c}${i}=${encodeURIComponent(r)}`}else a=s.replace(/\{(\w+)\}/g,(c,f)=>f===i?encodeURIComponent(r):`{${f}}`);return{...!!e.path&&!e.url?{path:a}:{url:a},schema:me(e.schema)||e.schema,transform:e.transform}}_resolveSingularItem(e,t){if(!t)return e;const{paramName:s,paramValue:i,schema:r}=t;if(!r||!s||i===void 0)return e;const o=e[r];if(!Array.isArray(o))return e;const a=me(r),l=o.find(c=>String(c[s])===String(i));return l&&a?{...e,[a]:l}:e}resolve(e,t){let s=this._getRequestedSchemas(t);if(s===null&&e.fetch){const h=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(d=>d.schema).map(d=>d.schema);h.length>0&&(s=h)}if(s===null)return{status:"none",data:null};const i=this._findFetchConfigs(e,s);if(i.size===0)return{status:"none",data:null};const r=e.dynamicContext||e.page?.dynamicContext,o=this._shouldInheritDetail(t,e),a=this._inheritLimit(t,e),l=this._inheritOrder(e),c={};let f=!0;for(const[u,h]of i)if(r&&h.detail&&!o)if(this.dataStore.has(h)){const{paramName:d,paramValue:m}=r,p=this.dataStore.get(h);let g=Array.isArray(p)?p.filter(b=>String(b[d])!==String(m)):p;l&&(g=this._sortItems(g,l)),c[u]=a&&Array.isArray(g)?g.slice(0,a):g}else f=!1;else if(r&&h.detail)if(this.dataStore.has(h)){const d=this.dataStore.get(h),{paramName:m,paramValue:p}=r,g=me(u)||u,b=Array.isArray(d)?d.find(y=>String(y[m])===String(p)):null;if(!b)c[g]=null;else{const y=this._buildDetailConfig(h,r);y&&this.dataStore.has(y)?c[g]=this.dataStore.get(y):y?f=!1:c[g]=b}}else f=!1;else if(this.dataStore.has(h)){const d=this.dataStore.get(h);c[u]=l?this._sortItems(d,l):d}else f=!1;return f?{status:"ready",data:this._resolveSingularItem(c,r)}:{status:"pending",data:null}}async fetch(e,t){let s=this._getRequestedSchemas(t);if(s===null&&e.fetch){const d=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(m=>m.schema).map(m=>m.schema);d.length>0&&(s=d)}if(s===null)return{data:null};const i=this._findFetchConfigs(e,s);if(i.size===0)return{data:null};const r=e.dynamicContext||e.page?.dynamicContext,o=this._shouldInheritDetail(t,e),a=this._inheritLimit(t,e),l=this._inheritOrder(e),c={},f=[];for(const[h,d]of i)if(r&&d.detail&&!o){let m=this.dataStore.has(d)?this.dataStore.get(d):null;if(m===null){const y=await this.dataStore.fetch(d);m=Array.isArray(y.data)?y.data:null}const{paramName:p,paramValue:g}=r;let b=Array.isArray(m)?m.filter(y=>String(y[p])!==String(g)):m??[];l&&(b=this._sortItems(b,l)),c[h]=a&&Array.isArray(b)?b.slice(0,a):b}else if(r&&d.detail){const{paramName:m,paramValue:p}=r,g=me(h)||h;let b=this.dataStore.has(d)?this.dataStore.get(d):null;if(b===null){const S=await this.dataStore.fetch(d);b=Array.isArray(S.data)?S.data:null}const y=b?.find(S=>String(S[m])===String(p))??null;if(!y){c[g]=null;continue}const k=this._buildDetailConfig(d,r);k?f.push(this.dataStore.fetch(k).then(S=>{c[g]=S.data!==void 0&&S.data!==null?S.data:y})):c[g]=y}else f.push(this.dataStore.fetch(d).then(m=>{m.data!==void 0&&m.data!==null&&(c[h]=m.data)}));return f.length>0&&await Promise.all(f),{data:this._resolveSingularItem(c,r)}}}class Fi{constructor(e){const{pages:t=[],theme:s={},config:i={},layouts:r,notFound:o,versionedScopes:a={}}=e;if(this.name=i.name||"",this.description=i.description||"",this.url=i.url||"",this._layoutSets={},r&&typeof r=="object")for(const[f,u]of Object.entries(r)){this._layoutSets[f]={};for(const[h,d]of Object.entries(u))d&&(this._layoutSets[f][h]=new Me(d,`layout-${f}-${h}`,this))}const l=o||t.find(f=>f.route==="/404")||null;this.notFoundPage=l?new Me(l,"notFound",this):null;const c=t.filter(f=>f.route!=="/404");this._dynamicPageData=new Map;for(const f of c)(f.isDynamic||f.route?.includes(":"))&&this._dynamicPageData.set(f.route,f);this._dynamicPageCache=new Map,this.pages=c.map((f,u)=>new Me(f,u,this)),this.buildPageHierarchy(),this.activePage=this.pages.find(f=>f.isIndex&&f.getNavRoute()==="/")||this.pages[0],this.pageRoutes=this.pages.map(f=>f.route),this.themeData=s,this.config=i,this.siteDefaultLocale=i.defaultLanguage||"en",this.defaultLocale=i.domainLocale||this.siteDefaultLocale,this.activeLocale=i.activeLocale||this.defaultLocale,this.locales=this.buildLocalesList(i),this.activeLang=this.activeLocale,this.langs=this.locales.map(f=>({label:f.label||f.code,value:f.code})),this._routeTranslations=this._buildRouteTranslations(i),this.basePath="",this.dataStore=new ji,this.entityStore=new Ri({dataStore:this.dataStore}),this.versionedScopes=a,Object.seal(this)}buildLocalesList(e){const t=e.defaultLanguage||"en",s=e.languages||[],i=o=>typeof o=="string"?{code:o}:{code:o.code,...o.label&&{label:o.label}},r=new Map;r.set(t,{code:t});for(const o of s){const a=i(o);if(r.has(a.code)){const l=r.get(a.code);r.set(a.code,{...l,...a})}else r.set(a.code,a)}return Array.from(r.values()).map(o=>({...o,isDefault:o.code===t}))}_buildRouteTranslations(e){const t=e.i18n?.routeTranslations||{},s={};for(const[i,r]of Object.entries(t)){const o=new Map,a=new Map;for(const[l,c]of Object.entries(r))o.set(l,c),a.set(c,l);s[i]={forward:o,reverse:a}}return s}translateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const s=this._routeTranslations[t];if(!s)return e;const i=s.forward.get(e);if(i)return i;for(const[r,o]of s.forward)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}reverseTranslateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const s=this._routeTranslations[t];if(!s)return e;const i=s.reverse.get(e);if(i)return i;for(const[r,o]of s.reverse)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}buildPageHierarchy(){const e=new Map;for(const t of this.pages)e.set(t.route,t);for(const t of this.pages)if(t.parentRoute){const s=e.get(t.parentRoute);s&&(s.children.push(t),t.parent=s)}for(const t of this.pages){if(t.parent||t.route==="/")continue;const s=t.route.replace(/\/[^/]+$/,"");if(!s||s==="/"||s===t.route)continue;const i=e.get(s);i&&(i.children.push(t),t.parent=i)}this._pageIdMap=new Map;for(const t of this.pages){t.stableId&&this._pageIdMap.set(t.stableId,t);const s=this.normalizeRoute(t.route);if(s&&!this._pageIdMap.has(s)&&this._pageIdMap.set(s,t),t.sourcePath){const i=t.sourcePath.replace(/^\//,"").replace(/\/$/,"");i&&!this._pageIdMap.has(i)&&this._pageIdMap.set(i,t)}}}getPage(e){let t=e;if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const l=`/${this.activeLocale}`;t===l||t===`${l}/`?t="/":t.startsWith(`${l}/`)&&(t=t.slice(l.length))}const s=t==="/"?"/":t.replace(/\/$/,""),i=this.pages.find(l=>l.route===s);if(i){const l=i.children.find(c=>c.isIndex);return l||i}t=this.reverseTranslateRoute(t);const r=t==="/"?"/":t.replace(/\/$/,""),o=this.pages.find(l=>l.route===r);if(o){const l=o.children.find(c=>c.isIndex);return l||o}const a=this.pages.find(l=>l.isIndex&&l.getNavRoute()===r);if(a)return a;if(this._dynamicPageCache.has(r))return this._dynamicPageCache.get(r);for(const l of this.pages){if(!l.route.includes(":"))continue;const c=this._matchDynamicRoute(l.route,r);if(c){const f=this._createDynamicPage(l,r,c.params);if(f){const{page:u,collectionLoaded:h}=f;return h&&this._dynamicPageCache.set(r,u),u}}}}_matchDynamicRoute(e,t){const s=[],i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:(\w+)/g,(l,c)=>(s.push(c),"([^/]+)")),r=new RegExp(`^${i}$`),o=t.match(r);if(!o)return null;const a={};return s.forEach((l,c)=>{a[l]=decodeURIComponent(o[c+1])}),{params:a}}_createDynamicPage(e,t,s){const i=this._dynamicPageData.get(e.route);if(!i)return null;const r=JSON.parse(JSON.stringify(i));r.route=t,r.isDynamic=!1;const o=Object.keys(s)[0],a=Object.values(s)[0],l=i.parentSchema,c=this._singularize(l);if(r.dynamicContext={templateRoute:e.route,params:s,paramName:o,paramValue:a,schema:l,singularSchema:c},r.sections&&Array.isArray(r.sections))for(const d of r.sections)d.dynamicContext=r.dynamicContext;const f=e.route.replace(/\/:[\w]+$/,"")||"/",u=this.pages.find(d=>d.route===f||d.getNavRoute()===f);if(u&&l){const d=u.fetch;let m=[];if(d){const g=Array.isArray(d)?d.find(b=>b.schema===l):d.schema===l?d:null;g&&(m=this.dataStore.get(g)||[])}const p=m.find(g=>String(g[o])===String(a));p?(p.title&&(r.title=p.title),(p.description||p.excerpt)&&(r.description=p.description||p.excerpt)):m.length>0&&(r.title="Not found",r.notFound=!0),r.dynamicContext.currentItem=p||null,r.dynamicContext.allItems=m,r._collectionLoaded=m.length>0}const h=new Me(r,`dynamic-${t}`,this);return h.parent=e.parent,{page:h,collectionLoaded:r._collectionLoaded??!0}}_singularize(e){return me(e)}setActivePage(e){const t=this.getPage(e);t&&(this.activePage=t)}setBasePath(e){!e||e==="/"?this.basePath="":this.basePath=e.endsWith("/")?e.slice(0,-1):e}getRemoteLayout(e){const t=globalThis.uniweb?.foundationConfig;return t?.layouts&&e&&t.layouts[e]?t.layouts[e]:null}getDefaultLayoutName(){return globalThis.uniweb?.foundationConfig?.defaultLayout||null}getDefaultBlockType(){return globalThis.uniweb?.foundationConfig?.defaultSection||"Section"}getAreaBlocks(e,t){return t&&this._layoutSets[t]?this._layoutSets[t][e]?.bodyBlocks||null:this._layoutSets.default&&this._layoutSets.default[e]?.bodyBlocks||null}getLayoutAreas(e){const t=e||"default",s=this._layoutSets[t]||this._layoutSets.default;if(!s)return{};const i={};for(const[r,o]of Object.entries(s))o?.bodyBlocks&&(i[r]=o.bodyBlocks);return i}getLayoutMeta(e){return globalThis.uniweb?.foundationConfig?.layoutMeta?.[e]||null}get viewTransitions(){return globalThis.uniweb.foundationConfig?.viewTransitions!==!1}getRemoteProps(){return globalThis.uniweb?.foundationConfig?.props||null}getRoutingComponents(){return globalThis.uniweb?.routingComponents||{}}makeHref(e){if(!e)return e;let t;if(e.startsWith("page:"))t=e.slice(5);else if(e.startsWith("topic:"))t=e.slice(6);else return e;const[s,i]=t.split("#"),r=this._pageIdMap?.get(s);if(!r)return e;let o=r.route;return i&&(o+=`#section-${i}`),o}getLanguages(){return this.langs}getLanguage(){return this.activeLang}getLocales(){return this.locales}getActiveLocale(){return this.activeLocale}getDefaultLocale(){return this.defaultLocale}hasMultipleLocales(){return this.locales.length>1}setActiveLocale(e){this.locales.find(s=>s.code===e)&&(this.activeLocale=e,this.activeLang=e)}getLocaleUrl(e,t=null){let s=t||this.activePage.getNavRoute();if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const o=`/${this.activeLocale}`;s===o||s===`${o}/`?s="/":s.startsWith(`${o}/`)&&(s=s.slice(o.length))}s=this.reverseTranslateRoute(s);const i=this.config?.domainLocales;if(i){const o=Object.entries(i).find(([,a])=>a===e);if(o){const a=o[0],l=this.translateRoute(s,e);return`https://${a}${l==="/"?"/":l}`}}if(e===this.defaultLocale)return s;const r=this.translateRoute(s,e);return r==="/"?`/${e}/`:`/${e}${r}`}getLocale(e){return this.locales.find(t=>t.code===e)}localize(e,t="",s="",i=!1){const r=s||this.activeLang,o=this.langs[0]?.value||"en";if(typeof e=="object"&&!Array.isArray(e))return i?e?.[r]||e?.[o]||t:e?.[r]||t;if(typeof e=="string"){if(!e.startsWith("{")&&!e.startsWith('"'))return e;try{const a=JSON.parse(e);return typeof a=="object"?i?a?.[r]||a?.[o]||t:a?.[r]||t:a}catch{return e}}return t}isSearchEnabled(){return this.config?.search?.enabled!==!1}getSearchConfig(){const e=this.config?.search||{};return{enabled:this.isSearchEnabled(),indexUrl:this.getSearchIndexUrl(),locale:this.getActiveLocale(),include:{pages:e.include?.pages!==!1,sections:e.include?.sections!==!1,headings:e.include?.headings!==!1,paragraphs:e.include?.paragraphs!==!1,links:e.include?.links!==!1,lists:e.include?.lists!==!1},exclude:{routes:e.exclude?.routes||[],components:e.exclude?.components||[]}}}getSearchIndexUrl(){const e=this.getActiveLocale();return e===this.getDefaultLocale()?"/search-index.json":`/${e}/search-index.json`}getSearchData(){return this.pages.map(e=>({id:e.id,title:e.title,href:e.route,route:e.route,description:e.description,content:e.getPageBlocks().map(t=>t.title).filter(Boolean).join(`
132
132
  `)}))}getPageHierarchy(e={}){const{nested:t=!0,for:s,includeHidden:i=!1,filter:r,sort:o}=e,a=f=>!(f.route.includes(":")||f.isIndex&&f.route.endsWith("/index")||!i&&(f.hidden||s==="header"&&f.hideInHeader||s==="footer"&&f.hideInFooter)||!f.hasContent()&&!f.children?.some(h=>h.isIndex)&&!f.children?.some(a)||r&&!r(f));let l=this.pages.filter(a);t&&(l=l.filter(f=>!f.parent&&!f.parentRoute)),o&&l.sort(o);const c=f=>{const u=f.getNavRoute();return{id:f.id,route:u,navigableRoute:f.getNavigableRoute(),translatedRoute:this.translateRoute(u),title:f.getTitle(),label:f.getLabel(),description:f.description,hasContent:f.hasContent(),version:f.version||null,children:t&&f.hasChildren()?f.children.filter(a).map(c):[]}};return l.map(c)}getHeaderPages(){return this.getPageHierarchy({for:"header"})}getFooterPages(){return this.getPageHierarchy({for:"footer"})}getAllPages(e=!1){return this.getPageHierarchy({nested:!1,includeHidden:e})}getNotFoundPage(){return this.notFoundPage}getActiveRoute(){return this.activePage.getNormalizedRoute()}getActiveRootSegment(){return this.getActiveRoute().split("/")[0]}normalizeRoute(e){let t=(e||"").replace(/^\/+/,"").replace(/\/+$/,"");if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const r=this.activeLocale;t===r?t="":t.startsWith(`${r}/`)&&(t=t.slice(r.length+1))}const s="/"+t;return t=this.reverseTranslateRoute(s).replace(/^\//,""),t}isRouteActive(e,t){return this.normalizeRoute(e)===this.normalizeRoute(t)}isRouteActiveOrAncestor(e,t){const s=this.normalizeRoute(e),i=this.normalizeRoute(t);return s===i?!0:s===""?!1:i.startsWith(s+"/")}getVersionedScopes(){return this.versionedScopes}hasVersionedContent(){return Object.keys(this.versionedScopes).length>0}getVersionScope(e){const t=e||"";for(const s of Object.keys(this.versionedScopes)){if(t===s)return s;if(s==="/"){if(t.startsWith("/")||t==="")return s}else if(t.startsWith(s+"/"))return s}return null}isVersionedRoute(e){return this.getVersionScope(e)!==null}getVersionMeta(e){return this.versionedScopes[e]||null}getPageVersion(e){return e?.version||null}getVersionsForRoute(e){const t=this.getVersionScope(e);return t?this.versionedScopes[t]?.versions||[]:[]}getVersionUrl(e,t){const s=this.getVersionScope(t);if(!s)return null;const i=this.versionedScopes[s];if(!i)return null;const r=i.versions.find(l=>l.id===e);if(!r)return null;const o=s==="/"?t:t.slice(s.length);let a=o;for(const l of i.versions){const c=`/${l.id}`;if(o.startsWith(c+"/")||o===c){a=o.slice(c.length);break}}return r.latest?s==="/"?a:s+a:s==="/"?"/"+e+a:s+"/"+e+a}getLatestVersion(e){return this.versionedScopes[e]?.latestId||null}}const dt=typeof window<"u"&&typeof document<"u";class Di{constructor(e={}){this.endpoint=e.endpoint||null,this.flushInterval=e.flushInterval||5e3,this.maxQueueSize=e.maxQueueSize||10,this.debug=e.debug||!1,this.queue=[],this.scrollMilestones=new Set,this.sessionId=this.generateSessionId(),this.sessionStart=Date.now(),this.flushIntervalId=null,dt&&this.isEnabled()&&(this.setupFlushInterval(),this.setupUnloadHandler()),Object.seal(this)}isEnabled(){return!!this.endpoint}generateSessionId(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}setupFlushInterval(){this.flushIntervalId=setInterval(()=>{this.flush()},this.flushInterval)}setupUnloadHandler(){const e=()=>{this.flush(!0)};window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e()}),window.addEventListener("pagehide",e)}addToQueue(e,t){if(!this.isEnabled()||!dt)return;const s={type:e,data:t,timestamp:Date.now(),sessionId:this.sessionId,url:window.location.href,referrer:document.referrer||null};this.queue.push(s),this.debug&&console.log("[Analytics] Event queued:",s),this.queue.length>=this.maxQueueSize&&this.flush()}trackPageView(e,t,s={}){this.scrollMilestones.clear(),this.addToQueue("pageview",{path:e,title:t,...s})}trackEvent(e,t={}){this.addToQueue("event",{name:e,...t})}trackScrollDepth(e){[25,50,75,100].includes(e)&&(this.scrollMilestones.has(e)||(this.scrollMilestones.add(e),this.addToQueue("scroll_depth",{depth:e})))}flush(e=!1){if(!this.isEnabled()||!dt||this.queue.length===0)return;const t=[...this.queue];this.queue=[];const s=JSON.stringify({events:t,sessionId:this.sessionId,sessionDuration:Date.now()-this.sessionStart});if(this.debug&&console.log("[Analytics] Flushing",t.length,"events"),e&&navigator.sendBeacon){const i=new Blob([s],{type:"application/json"});!navigator.sendBeacon(this.endpoint,i)&&this.debug&&console.warn("[Analytics] sendBeacon failed, events may be lost");return}fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:s,keepalive:!0}).catch(i=>{this.debug&&console.warn("[Analytics] Flush failed:",i),this.queue.unshift(...t)})}destroy(){this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flush(!0)}}class Ki{constructor(e){this.activeWebsite=new Fi(e),this.childBlockRenderer=null,this.routingComponents={},this.foundation=null,this.foundationConfig={},this.meta={},this.extensions=[],this.language="en",this.iconResolver=null,this.iconCache=new Map,this.analytics=new Di(e.analytics||{}),Object.seal(this)}async resolveIcon(e,t){return this.iconResolver?this.iconResolver(e,t):(console.warn("[Uniweb] No icon resolver configured"),null)}getIconSync(e,t){return this.iconCache.get(`${e}:${t}`)||null}setFoundation(e){this.foundation=e,e.default?.meta&&(this.meta=e.default.meta)}registerExtension(e){const t=e.default?.meta||{};this.extensions.push({foundation:e,meta:t})}getComponentMeta(e){const t=this.meta[e];if(t)return t;for(const s of this.extensions){const i=s.meta[e];if(i)return i}return null}getComponentDefaults(e){return this.getComponentMeta(e)?.defaults||{}}getComponent(e){if(!this.foundation){console.warn("[Runtime] No foundation loaded");return}const t=this.foundation[e];if(t)return t;for(const s of this.extensions){const i=s.foundation[e];if(i)return i}}listComponents(){const e=new Set;if(this.foundation)for(const t of Object.keys(this.foundation))t!=="default"&&e.add(t);for(const t of this.extensions)for(const s of Object.keys(t.foundation))s!=="default"&&e.add(s);return[...e]}setFoundationConfig(e){this.foundationConfig=e}}function qi(){return globalThis.uniweb}function Vi(n){const e=new Ki(n);return globalThis.uniweb=e,e}export{K as B,Me as P,Ki as U,Fi as W,Ui as a,Vi as c,qi as g,is as n};
133
- //# sourceMappingURL=index-C6EFXW_H.js.map
133
+ //# sourceMappingURL=index-DFtjIARq.js.map