@symbo.ls/brender 3.14.679 → 3.14.681

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @symbo.ls/brender
2
2
 
3
+ ## 3.14.681
4
+
5
+ ### Patch Changes
6
+
7
+ - 849f8c1: frank writes an app's lang map once. An app whose polyglot reads its design system's lang map (`polyglot: { translations: lang }`, `lang` imported from `designSystem/lang.js` — the workspace apps' pattern) shipped the map twice: frank keeps the shared reference, and JSON writes a shared object at each place it occurs (a commerce app's payload: +102,603 bytes, +17.6 %). `frank.toJSON` now keeps the map in `designSystem.lang` (where the workspace shell reads a module's copy) and writes the polyglot config with `translationsFrom: 'designSystem.lang'` in the place of `translations` — only when the translations ARE that map (the same object, or a copy with the same content). Every reader puts the map back before it reads the config: `@symbo.ls/utils` adds `polyglotTranslations(project, polyglot)` (a read), `resolvePolyglotTranslations(project)` (in place — `smbls` `prepareContext` resolves the runtime's context before the shared libraries merge in) and `withPolyglotTranslations(project)` (a view — `@symbo.ls/brender` `render`/`renderPage`, `@symbo.ls/mermaid` `renderProjectHtml`'s start-up script and language, each shared library merge; the payload a server also serves is never written, so it keeps the map once); utils `getPageMetadata` resolves head labels from the pointer; `@symbo.ls/sync` resolves a livesync snapshot before it applies it (`resolveSnapshotTranslations`), so an edited copy reaches the page with the snapshot. A config with `translations` as well gets the named map with its own labels over it, per language. `@symbo.ls/polyglot`: the README documents `translationsFrom`. A runtime older than this release reads such a payload as a polyglot without static strings (the keys show): release the runtime packages and the mermaid-server pin before apps push with this frank.
8
+ - 71f56ce: `@symbo.ls/fetch` ships a built-in `symbols` adapter (`adapters/symbols.js`, also `@symbo.ls/fetch/symbols`): a published site reads and writes through the platform SDK, signed out, with `fetch: { adapter: 'symbols', load: () => import('@symbo.ls/sdk') }` in its config. The adapter loads the SDK on the first query only (frank publishes the literal import() as the lazy host-package marker, so the page declares the SDK file instead of inlining it), builds ONE SDK per page (memory tokens, the SDK's own telemetry off, the API base from `window.__SYMBOLS_ENV__`), and maps every op the way the hosts' 'sdk' adapter does (`select → list`, `insert → create`, …; every answer `{ data, error }`). It has no session surface. It is built in under its own name: a built-in 'sdk' would answer a host's first elements before the host's own late `registerAdapter('sdk')` (measured; `sdkAdapterShellRace.test.js`), so 'sdk' stays the hosts'. `resolveDb(config, env)` hands `env` (`{ serverRender }`, set from a context's `isolateFetchCache`) to `setup(options, env)`; the `symbols` adapter answers `null` in a server render, so the query is skipped there and the server never loads the SDK or calls the API. `@symbo.ls/brender` `createSSRAdapter` passes `{ serverRender: true }`. `smbls`: the full esm build keeps the new adapter import static (no `__esm` initializer), the core build gates it as kit `symbols` (`build.treeShakeFeatures`), and the bundles carry the new adapter.
9
+ - Updated dependencies [ed88d4e]
10
+ - Updated dependencies [849f8c1]
11
+ - Updated dependencies [71f56ce]
12
+ - @symbo.ls/fetch@3.14.679
13
+ - smbls@3.14.872
14
+ - @symbo.ls/utils@3.14.860
15
+
16
+ ## 3.14.680
17
+
18
+ ### Patch Changes
19
+
20
+ - 74ce537: A page's agent view is rendered ahead for AI crawlers (S1). AI crawlers read only the served HTML, and a page's agent view (the landing's `?view=agent`, which its app shows at init) existed in the browser only: every publish-time render was made at the route's address with no query, so `/pricing` and `/pricing?view=agent` served the same bytes.
21
+
22
+ - brender: `render()`, `renderRoute()` and `renderPage()` take `search`, the query of the address the page is rendered at. The render's `location.search` and `location.href` carry it, so a page that reads its query renders that view; the head stays the page's own. `''`, `'?'`, `null` or none render as before, byte for byte; each render owns its location, so the next render never inherits a query. A value that is not a string, or that holds a `#`, throws a TypeError that names the option.
23
+ - utils (`@symbo.ls/utils/server`): `agentViewOf(data)` reads config.js `agentView: { param: 'view', on: 'agent', off: 'human' }` (`true`, `{}` or a missing field take these defaults) under the platform render worker's rules (`param` a letter, then up to 31 letters, digits, `_` or `-`, not `__smbls…`; `on` / `off` 1–32 of those, and different), and throws a TypeError that names the shape for a declaration outside them; null without one. It reads a project payload where the renderer reads `polyglot`: under `data.config` (else `data.settings`) when the payload keeps config nested, else at its top level, where frank spreads config.js — a served `/get` payload has no `config`, and its `settings` is the platform's own. `renderVariantsOf(data)` gives the renders a publish makes beside each page: `[{ name: 'agent', search: '?view=agent' }]`, or `[]`. `AGENT_VIEW_DEFAULTS` is exported.
24
+ - mermaid: `renderProjectHtml` takes `search` (a live render at that query; never the visitor's own query). `@symbo.ls/mermaid/render` exports `renderVariants(data)` — the variant list, read with that lookup — which the platform's publish feature-checks: it then renders each page once more per variant and stores it under `<route><search>`.
25
+ - cli: `smbls publish --ssr` renders each stored route once more per variant, after every page (in page order, `/` first) and within the same time budget, and stores it in the same `PUT /core/projects/:projectId/prerender` under `<route>?<param>=<on>` (`/pricing?view=agent`, `/?view=agent`), the key the platform serves crawlers from. The variants have size budgets of their own, so a site whose pages fill the pages' 16 MB still gets its agent views and a page never loses its place to one: 8 MB for all of them (`--ssr-variant-budget <MB>`, or `symbols.json` `brender.variantBudgetMB`) and 1 MB for one (`--ssr-variant-route-cap <KB>`, or `brender.variantRouteKB`; 1024 is also the most, the platform's cap per stored row — a page keeps its own 512 KB). A flag wins over symbols.json; a value that is not a number above 0, or that passes the platform's cap, stops the publish with a message that names it. A publish keeps within the platform's caps per version, which refuse a larger write as a whole: at most 500 routes, variants included (`maxRoutes`), and 20 MB with the styles, which the variants stop short of. A variant never takes a page's place; a route whose own render was not stored gets none. The publish report lists them apart (`N of M static routes stored and K of L variant renders (?view=agent; X KB)`), and a variant render that was not stored gives one warning with the count, the first route it missed and the reasons (`⚠ 12 of 57 variant renders not stored, from /pricing?view=agent: 12 variant budget spent (8 MB)`). A declaration it cannot use is printed (`agent view not pre-rendered: …`) and the publish stores the pages alone. Without `agentView` a publish renders and stores what it did before.
26
+
27
+ - Updated dependencies [8eb4239]
28
+ - Updated dependencies [b6a3cd6]
29
+ - Updated dependencies [74ce537]
30
+ - Updated dependencies [a271b1b]
31
+ - Updated dependencies [4537877]
32
+ - Updated dependencies [6da9c79]
33
+ - @symbo.ls/default-config@3.14.794
34
+ - @symbo.ls/scratch@3.14.799
35
+ - @symbo.ls/element@3.14.823
36
+ - smbls@3.14.869
37
+ - @symbo.ls/utils@3.14.859
38
+ - @symbo.ls/fetch@3.14.678
39
+
3
40
  ## 3.14.679
4
41
 
5
42
  ### Patch Changes
package/README.md CHANGED
@@ -147,6 +147,7 @@ Options:
147
147
  | Option | Default | What it does |
148
148
  |--------|---------|--------------|
149
149
  | `pathname` | the route | The address the page is rendered at. The router matches it, and `location` (canonical, og:url) reads it. A route with parameters needs one (`renderPage(data, '/:lang/about', { pathname: '/en/about' })`); the not-found page `/*` is rendered at `/404` by `smbls build`. |
150
+ | `search` | — | The query of the address the page is rendered at (`'?view=agent'`; the `?` is added when missing). The render's `location.search` and `location.href` carry it, as a browser's do at that address, so a page that reads its query (an agent view its app shows at init) renders that view; the head is the page's own. `render()` and `renderRoute()` take it too. `''`, `'?'`, `null` or none: no query, and the render is the same as before, byte for byte. A value that is not a string, or that holds a `#`, throws a TypeError that names the option. |
150
151
  | `shell` | — | A built app document (e.g. `dist/index.html`) to render INTO. |
151
152
  | `preloadScripts` | `true` | With `shell`: a high-priority `modulepreload` (`preload as=script` for a classic script) in `<head>` for each script the shell boots from, so the pre-rendered images do not take its bandwidth. `async` and `nomodule` scripts are left alone. |
152
153
  | `eagerImages` | `2` | Images past the first `eagerImages` in the markup get `loading="lazy"`, unless they name their own `loading`. `false` turns it off. |
@@ -1 +1 @@
1
- const l=t=>typeof t=="function",A=t=>Array.isArray(t),y=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),_=(t,n)=>{if(t){if(l(t))try{return t({state:n||{},call:()=>{},__ref:{}},n||{})}catch{return}return t}},j=t=>A(t)?t.length===0||t.includes("create")||!t.some(n=>typeof n=="string"&&n):!t||t==="create",k=(t,n)=>{if(!t)return null;if(typeof t=="string")return{from:t,method:"select"};const r=l(t)?null:{...t};return!r||(r.method||(r.method="select"),l(r.params)&&(r.params=_(r.params,n)),r.method==="insert"||r.method==="update"||r.method==="upsert"||r.method==="delete")||!j(r.on)?null:r},S=(t,n="")=>{if(!t||typeof t!="object")return[];if(l(t))return[];const r=[],s=t.state||{};if(t.fetch){const e=A(t.fetch)?t.fetch:[t.fetch];for(const c of e){const o=k(c,s);o&&r.push({config:o,stateKey:o.as,path:n,elementState:s})}}for(const e in t)e==="fetch"||e==="state"||e==="props"||e==="attr"||e==="on"||e==="define"||e==="childExtends"||e==="childProps"||e==="childrenAs"||e.charAt(0)>="A"&&e.charAt(0)<="Z"&&y(t[e])&&r.push(...S(t[e],n?`${n}.${e}`:e));return r},M=["rest","local"],w=new WeakMap,b=async t=>{if(!t)return null;if(y(t)&&(l(t.select)||l(t.rpc)))return t;const n=typeof t=="string"?{adapter:t}:t;if(!y(n)||typeof n.adapter!="string")return null;if(w.has(n))return w.get(n);const r=(async()=>{let s;try{s=await import("@symbo.ls/fetch")}catch{return null}if(!(l(s.hasAdapter)?s.hasAdapter(n.adapter):M.includes(n.adapter)))return null;try{return await s.resolveDb(n)}catch(c){return console.warn(`[brender] SSR adapter "${n.adapter}" unavailable: ${c.message}`),null}})();return w.set(n,r),r},P=async(t,n)=>{try{const{method:r,from:s,params:e,transform:c,limit:o,offset:f,order:u,single:p,headers:h,baseUrl:g}=n;let i;if(r==="rpc"){if(!l(t.rpc))return null;i=await t.rpc({from:s,params:e,headers:h,baseUrl:g})}else{if(!l(t.select))return null;i=await t.select({from:s,select:n.select,params:e,limit:o,offset:f,order:u,single:p,headers:h,baseUrl:g})}let a=i?.data??null;if(i?.error)return null;if(a&&c&&l(c))try{a=c(a)}catch{}return a}catch{return null}},x=async(t,n="/",r={})=>{const e=(t.pages||{})[n];if(!e)return new Map;const c=t.config||t.settings||{},o=c.fetch||t.fetch||c.db||t.db;if(!o)return new Map;const f=await b(o);if(!f)return new Map;const u=S(e);if(!u.length)return new Map;const p=new Map,h=await Promise.allSettled(u.map(async({config:g,stateKey:i,path:a})=>{const d=await P(f,g);if(d!==null){const m=p.get(a)||{};i?m[i]=d:y(d)&&Object.assign(m,d),p.set(a,m)}}));return p},D=async t=>{const n=t.config||{},r=n.polyglot||t.polyglot;if(!r?.fetch||typeof r.fetch=="function")return null;const s=n.fetch||t.fetch||n.db||t.db;if(!s)return null;const e=await b(s);if(!e)return null;const c=r.fetch,o=c.rpc||c.from||"get_translations_if_changed",f=await import("@symbo.ls/utils"),u=f.polyglotLanguages(r,!1),p=u.length?u:[f.polyglotFallbackLang(void 0,r)],h={},g=await Promise.allSettled(p.map(async i=>{try{if(!l(e.rpc))return;const a=await e.rpc({from:o,params:{p_lang:i,p_cached_version:0}});if(a.error||!a.data)return;const d=a.data;d.translations&&(h[i]=d.translations)}catch(a){console.warn("[brender] SSR translation fetch failed:",a.message)}}));return Object.keys(h).length?h:null},E=(t,n)=>{if(!(!n||!n.size))for(const[r,s]of n){let e=t;if(r){const c=r.split(".");for(const o of c){if(!e||typeof e!="object")break;e=e[o]}}e&&typeof e=="object"&&((!e.state||typeof e.state!="object")&&(e.state={}),Object.assign(e.state,s))}};export{b as createSSRAdapter,D as fetchSSRTranslations,E as injectPrefetchedState,x as prefetchPageData};
1
+ const l=t=>typeof t=="function",A=t=>Array.isArray(t),y=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),_=(t,n)=>{if(t){if(l(t))try{return t({state:n||{},call:()=>{},__ref:{}},n||{})}catch{return}return t}},j=t=>A(t)?t.length===0||t.includes("create")||!t.some(n=>typeof n=="string"&&n):!t||t==="create",k=(t,n)=>{if(!t)return null;if(typeof t=="string")return{from:t,method:"select"};const r=l(t)?null:{...t};return!r||(r.method||(r.method="select"),l(r.params)&&(r.params=_(r.params,n)),r.method==="insert"||r.method==="update"||r.method==="upsert"||r.method==="delete")||!j(r.on)?null:r},S=(t,n="")=>{if(!t||typeof t!="object")return[];if(l(t))return[];const r=[],s=t.state||{};if(t.fetch){const e=A(t.fetch)?t.fetch:[t.fetch];for(const c of e){const o=k(c,s);o&&r.push({config:o,stateKey:o.as,path:n,elementState:s})}}for(const e in t)e==="fetch"||e==="state"||e==="props"||e==="attr"||e==="on"||e==="define"||e==="childExtends"||e==="childProps"||e==="childrenAs"||e.charAt(0)>="A"&&e.charAt(0)<="Z"&&y(t[e])&&r.push(...S(t[e],n?`${n}.${e}`:e));return r},M=["rest","local"],w=new WeakMap,b=async t=>{if(!t)return null;if(y(t)&&(l(t.select)||l(t.rpc)))return t;const n=typeof t=="string"?{adapter:t}:t;if(!y(n)||typeof n.adapter!="string")return null;if(w.has(n))return w.get(n);const r=(async()=>{let s;try{s=await import("@symbo.ls/fetch")}catch{return null}if(!(l(s.hasAdapter)?s.hasAdapter(n.adapter):M.includes(n.adapter)))return null;try{return await s.resolveDb(n,{serverRender:!0})}catch(c){return console.warn(`[brender] SSR adapter "${n.adapter}" unavailable: ${c.message}`),null}})();return w.set(n,r),r},P=async(t,n)=>{try{const{method:r,from:s,params:e,transform:c,limit:o,offset:f,order:u,single:p,headers:h,baseUrl:g}=n;let i;if(r==="rpc"){if(!l(t.rpc))return null;i=await t.rpc({from:s,params:e,headers:h,baseUrl:g})}else{if(!l(t.select))return null;i=await t.select({from:s,select:n.select,params:e,limit:o,offset:f,order:u,single:p,headers:h,baseUrl:g})}let a=i?.data??null;if(i?.error)return null;if(a&&c&&l(c))try{a=c(a)}catch{}return a}catch{return null}},x=async(t,n="/",r={})=>{const e=(t.pages||{})[n];if(!e)return new Map;const c=t.config||t.settings||{},o=c.fetch||t.fetch||c.db||t.db;if(!o)return new Map;const f=await b(o);if(!f)return new Map;const u=S(e);if(!u.length)return new Map;const p=new Map,h=await Promise.allSettled(u.map(async({config:g,stateKey:i,path:a})=>{const d=await P(f,g);if(d!==null){const m=p.get(a)||{};i?m[i]=d:y(d)&&Object.assign(m,d),p.set(a,m)}}));return p},D=async t=>{const n=t.config||{},r=n.polyglot||t.polyglot;if(!r?.fetch||typeof r.fetch=="function")return null;const s=n.fetch||t.fetch||n.db||t.db;if(!s)return null;const e=await b(s);if(!e)return null;const c=r.fetch,o=c.rpc||c.from||"get_translations_if_changed",f=await import("@symbo.ls/utils"),u=f.polyglotLanguages(r,!1),p=u.length?u:[f.polyglotFallbackLang(void 0,r)],h={},g=await Promise.allSettled(p.map(async i=>{try{if(!l(e.rpc))return;const a=await e.rpc({from:o,params:{p_lang:i,p_cached_version:0}});if(a.error||!a.data)return;const d=a.data;d.translations&&(h[i]=d.translations)}catch(a){console.warn("[brender] SSR translation fetch failed:",a.message)}}));return Object.keys(h).length?h:null},R=(t,n)=>{if(!(!n||!n.size))for(const[r,s]of n){let e=t;if(r){const c=r.split(".");for(const o of c){if(!e||typeof e!="object")break;e=e[o]}}e&&typeof e=="object"&&((!e.state||typeof e.state!="object")&&(e.state={}),Object.assign(e.state,s))}};export{b as createSSRAdapter,D as fetchSSRTranslations,R as injectPrefetchedState,x as prefetchPageData};
@@ -1,22 +1,22 @@
1
- import{resolve as d,join as tt,dirname as j}from"path";import{existsSync as S,unlinkSync as ot,readFileSync as J,realpathSync as nt}from"fs";import{resolvePackageEntry as st}from"./packageEntry.js";import{tmpdir as rt}from"os";import{randomBytes as ct}from"crypto";import{createRequire as ge}from"module";import{pathToFileURL as it}from"url";import{createEnv as je}from"./env.js";import{resetKeys as Te,assignKeys as ve,mapKeysToElements as Le}from"./keys.js";import{extractMetadata as he,generateHeadHtml as lt}from"./metadata.js";import"./hydrate.js";import{composeIntoShell as at}from"./shell.js";import{trimSpriteToPage as ft,classRulesForPage as pt,markupClasses as ut,trimVariablesToPage as mt}from"./pageWeight.js";import{facesSheetTag as dt}from"./faces.js";import{fetchSSRTranslations as gt}from"./prefetch.js";import{createEarlySeedScript as ht}from"@symbo.ls/fetch";import{headerEntries as yt}from"@symbo.ls/fetch/rest";import{brenderStampMeta as bt,brenderLazyMeta as Ae,escapeRegExp as St,jsonForScript as Rt,libraryPackageSpecs as wt,polyglotFallbackLang as ye,polyglotLangStorageKey as kt,polyglotAddressLang as xt,polyglotStartupScript as _t}from"@symbo.ls/utils";import{brenderRegistryBlock as Et,brenderRegistryTreeBlock as jt}from"@symbo.ls/utils/server";import*as Tt from"@symbo.ls/utils/server";let ce=null;const vt=async()=>{if(ce)return ce;try{return ce=(await import("@symbo.ls/funcql")).funcqlPlugin,ce}catch{return null}};import"linkedom";import{createEarlySeedBlock as Lt,fetchRunsOf as At}from"@symbo.ls/fetch";import{reset as $t}from"@symbo.ls/css";const ie=(e,t)=>{if(!e||!t)return;if(e[t]!==void 0)return e[t];const o=t.split(".");let n=e;for(const s of o){if(n==null||typeof n!="object")return;n=n[s]}return n},le=(e,t)=>ye(e?.lang,t),Dt=e=>{const t=Tt.revivePolyglotDefaultLang;if(typeof t!="function"||!e||typeof e!="object")return e;const o=e.polyglot?t(e.polyglot):e.polyglot,n=e.config&&e.config.polyglot,s=n&&t(n);if(o===e.polyglot&&s===n)return e;const r={...e};return o!==e.polyglot&&(r.polyglot=o),s!==n&&(r.config={...e.config,polyglot:s}),r},$e=(e,t,o,n)=>{if(o?.translations){const r=o.translations[t];if(r){const i=ie(r,e);if(i!==void 0)return i}}if(n?.translations){const r=n.translations[t];if(r){const i=ie(r,e);if(i!==void 0)return i}}const s=ye(void 0,o);if(s!==t&&o?.translations){const r=o.translations[s];if(r){const i=ie(r,e);if(i!==void 0)return i}}},Ct=function(e,t){if(!e)return"";const o=this?.context,n=o?.polyglot,s=this?.state?.root||o?.state?.root,r=$e(e,t||le(s,n),n,s);if(r!==void 0)return r;const i=we(Re);return n&&i&&i.labelKeys.add(e),e},De=function(){return le(this?.state?.root,this?.context?.polyglot)},L=(e,t=new WeakMap)=>{if(e===null||typeof e!="object")return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){const n=[];t.set(e,n);for(const s of e)n.push(typeof s=="object"&&s!==null?L(s,t):s);return n}const o={};t.set(e,o);for(const n of Object.keys(e)){const s=e[n];o[n]=typeof s=="object"&&s!==null?L(s,t):s}return o};let q=null;try{import.meta.url&&(q=ge(import.meta.url))}catch{}const Mt=()=>{if(!import.meta.url||!q)return{isMonorepo:!1,monorepoRoot:null,resolvePackage:a=>a};const e=nt(new URL(".",import.meta.url).pathname),t=d(e,"../..");if(S(d(t,"packages","smbls","src","createDomql.js")))return{isMonorepo:!0,monorepoRoot:t};let n;try{const a=q.resolve("smbls/package.json");n=j(a)}catch{let a=e;for(;a!==j(a);){const g=d(a,"node_modules","smbls");if(S(d(g,"package.json"))){n=g;break}a=j(a)}}let s=q;if(n)try{s=ge(d(n,"package.json"))}catch{}let r,i=process.cwd();for(;i!==j(i);){if(S(d(i,"package.json"))){r=i;break}i=j(i)}let u=s;if(r)try{u=ge(d(r,"package.json"))}catch{}return{isMonorepo:!1,smblsRoot:n,brenderDir:e,projectRoot:r,_smblsRequire:s,_projectRequire:u}},H=(e,t)=>{const o=e.isMonorepo?[q]:[e._smblsRequire,e._projectRequire,q].filter(Boolean);for(const n of o)try{return n.resolve(t)}catch{}return null},on=(e,t,...o)=>{if(e.isMonorepo)return d(e.monorepoRoot,"packages",t,...o);const n=H(e,`${t}/package.json`);return n?d(j(n),...o):null},nn=(e,t,...o)=>{if(e.isMonorepo)return d(e.monorepoRoot,"plugins",t,...o);const n=H(e,`@symbo.ls/${t}/package.json`);return n?d(j(n),...o):null},be=(e,t,...o)=>{if(e.isMonorepo){for(const s of["packages","plugins"]){const r=d(e.monorepoRoot,s,t,...o);if(S(r))return r}return null}const n=H(e,`@symbo.ls/${t}/package.json`);return n?d(j(n),...o):null},Ce=(e,t,...o)=>{if(e.isMonorepo)return d(e.monorepoRoot,"packages","domql","packages",t,...o);const n=H(e,`@symbo.ls/${t}/package.json`);return n?d(j(n),...o):null};let ae=null;const Me="smbls/ssr",Ot=async()=>{const e=await import("smbls/ssr");if(typeof e?.createDomqlElement!="function")throw new Error("smbls/ssr does not export createDomqlElement");return e},Oe=()=>(ae||(ae=qt().catch(e=>{throw ae=null,e})),ae),qt=async()=>{const e=Mt();let t;if(q&&e.isMonorepo)t=d(e.monorepoRoot,"packages","smbls","src","createDomql.js");else{let f;try{return await Ot()}catch(l){f=l}if(!q)throw new Error(`brender: ${Me} is not available in this bundled runtime (${f.message}). Bundle smbls \u2265 the release that adds the smbls/ssr export alongside @symbo.ls/brender.`);const c=e.smblsRoot&&d(e.smblsRoot,"src","createDomql.js");if(c&&S(c))t=c;else throw new Error(`brender: cannot load ${Me} (${f.message}). Server rendering needs smbls installed in this project, at a release that exports smbls/ssr`+(e.smblsRoot?` (found smbls at ${e.smblsRoot}).`:" (no smbls package found)."))}const o=await import("esbuild"),n=tt(rt(),`br_createDomql_${ct(6).toString("hex")}.mjs`),s=st,r=e.isMonorepo?await import(it(d(e.monorepoRoot,"scripts","vite-workspace-source.mjs")).href):null,i=r?new Set(r.workspacePackageRoots().map(f=>r.workspacePackageAt(f).name)):null,u=/^(?:smbls(?:\/.*)?|domql|css-in-props(?:\/.*)?|@symbo\.ls\/[^/]+)$/,a={name:"workspace-resolve",setup(f){r&&(f.onResolve({filter:/^[^./]/},c=>{if(u.test(c.path))return;const l=c.path.split("/"),p=c.path.startsWith("@")?l.slice(0,2).join("/"):l[0];if(!i.has(p))return;const h=r.resolveWorkspaceSource(c.path,c.importer||t);return h?{path:h}:{errors:[{text:`"${c.path}" names no source file in the workspace`}]}}),f.onLoad({filter:/[\\/]dist[\\/]/},c=>r.isWorkspaceDist(c.path)?{errors:[{text:`${c.path} is a BUILD of a workspace package \u2014 the render bundles source`}]}:void 0)),f.onResolve({filter:/^smbls/},c=>{const l=c.path.replace(/^smbls\/?/,""),p=e.isMonorepo?d(e.monorepoRoot,"packages","smbls"):e.smblsRoot;if(!p)return;if(!l){const k=s(p);return k?{path:k}:void 0}const h=d(p,l);if(S(h))return{path:h};if(S(h+".js"))return{path:h+".js"};const R=d(h,"index.js");if(S(R))return{path:R}}),f.onResolve({filter:/^domql$/},c=>{if(e.isMonorepo){const l=d(e.monorepoRoot,"packages","domql","src","index.js");if(S(l))return{path:l};const p=d(e.monorepoRoot,"packages","domql","index.js");if(S(p))return{path:p}}else try{const l=_require.resolve("domql/package.json"),p=s(j(l));if(p)return{path:p}}catch{}}),f.onResolve({filter:/^@symbo\.ls\//},c=>{const l=c.path.replace("@symbo.ls/","");if(l==="sync")return{path:"sync-stub",namespace:"brender-stub"};if(e.isMonorepo){for(const h of["packages","plugins"]){const R=d(e.monorepoRoot,h,l,"src","index.js");if(S(R))return{path:R};const k=d(e.monorepoRoot,h,l,"index.js");if(S(k))return{path:k}}const p=d(e.monorepoRoot,"packages","default-config","blank","index.js");if(l==="default-config"&&S(p))return{path:p}}else{const p=be(e,l,"src","index.js");if(p&&S(p))return{path:p};const h=be(e,l,"index.js");if(h&&S(h))return{path:h};if(l==="default-config"){const R=be(e,"default-config","blank","index.js");if(R&&S(R))return{path:R}}}}),f.onResolve({filter:/^@domql\//},c=>{const l=c.path.replace("@symbo.ls/","");if(e.isMonorepo){const p=d(e.monorepoRoot,"packages","domql","packages",l,"src","index.js");if(S(p))return{path:p};const h=d(e.monorepoRoot,"packages","domql","packages",l,"index.js");if(S(h))return{path:h}}else{const p=Ce(e,l,"src","index.js");if(p&&S(p))return{path:p};const h=Ce(e,l,"index.js");if(h&&S(h))return{path:h}}}),f.onResolve({filter:/^css-in-props/},c=>{let l;if(e.isMonorepo)l=d(e.monorepoRoot,"packages","css-in-props");else{const R=H(e,"css-in-props/package.json");R&&(l=j(R))}if(!l)return;const p=c.path.replace(/^css-in-props\/?/,"");if(p){const R=d(l,p),k=d(R,"index.js");if(S(k))return{path:k};if(S(R+".js"))return{path:R+".js"};if(S(R))return{path:R}}const h=s(l);if(h)return{path:h}}),f.onResolve({filter:/^@emotion\//},c=>{let l;if(e.isMonorepo)l=d(e.monorepoRoot,"node_modules",c.path);else{const p=H(e,`${c.path}/package.json`);if(!p)return;l=j(p)}if(S(l)){const p=d(l,"package.json");if(S(p))try{const h=JSON.parse(J(p,"utf8")),R=h.module||h.main||"dist/emotion-css.esm.js";return{path:d(l,R)}}catch{}return{path:l}}}),f.onResolve({filter:/\.json$/},c=>{if(c.resolveDir){const l=d(c.resolveDir,c.path);if(S(l))return{path:l}}}),f.onLoad({filter:/smbls\/.*options\.js$/},async c=>{if(!c.path.includes("smbls/")||!c.path.endsWith("options.js"))return;let l=J(c.path,"utf8");return l=l.replace(/import\s*\{[^}]*version[^}]*\}\s*from\s*['"][^'"]*package\.json['"][^;\n]*/,"const version = '0.0.0'"),l=l.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:l,loader:"js"}}),f.onLoad({filter:/smbls\/.*init\.js$/},async c=>{if(!c.path.includes("smbls/")||!c.path.endsWith("init.js"))return;let l=J(c.path,"utf8");return l=l.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:l,loader:"js"}}),f.onLoad({filter:/.*/,namespace:"brender-stub"},()=>({contents:"export const SyncComponent = {}; export const Inspect = {}; export const Notifications = {}; export const syncPlugin = () => ({}); export const notificationsPlugin = () => ({}); export const seedRawDesignSystem = () => {}; export const inspectPlugin = () => ({}); export default {}",loader:"js"})),f.onLoad({filter:/smbls\/src\/router\.js$/},async c=>{let l=J(c.path,"utf8");return l=l.replace(/import\s*\{\s*Link\s*\}\s*from\s*['"]smbls['"]/,"const Link = { tag: 'a', attr: { href: (el) => el.href } }"),{contents:l,loader:"js"}}),f.onLoad({filter:/fetchOnCreate\.js$/},async c=>{if(!c.path.includes("smbls/"))return;let l=J(c.path,"utf8");return l=l.replace(/window\s*&&\s*window\.location\s*\?\s*window\.location\.host\.includes/g,"window && window.location && window.location.host ? window.location.host.includes"),{contents:l,loader:"js"}})}};await o.build({entryPoints:[t],bundle:!0,format:"esm",platform:"node",outfile:n,write:!0,logLevel:"warning",plugins:[a],nodePaths:e.isMonorepo?[d(e.monorepoRoot,"node_modules")]:[...e.smblsRoot?[d(e.smblsRoot,"node_modules")]:[],...e.projectRoot?[d(e.projectRoot,"node_modules")]:[],...e.smblsRoot?[d(e.smblsRoot,"..","..","node_modules")]:[]].filter(f=>S(f)),supported:{"import-attributes":!1},external:["fs","path","os","crypto","url","http","https","stream","util","events","buffer","child_process","worker_threads","net","tls","dns","dgram","zlib","assert","querystring","string_decoder","readline","perf_hooks","async_hooks","v8","vm","cluster","inspector","module","process","tty","color-contrast-checker","linkedom"]});const g=await import(`file://${n}`);if(process.env.BRENDER_DEBUG)console.log("[brender] Bundle saved:",n);else try{ot(n)}catch{}return g},Pt={Box:{},Focusable:{},Block:{display:"block"},Inline:{display:"inline"},Flex:{display:"flex"},InlineFlex:{display:"inline-flex"},Grid:{display:"grid"},InlineGrid:{display:"inline-grid"},Link:{tag:"a",attr:{href:e=>e.href,target:e=>e.target,rel:e=>e.rel}},A:{extends:"Link"},RouteLink:{extends:"Link"},Img:{tag:"img",attr:{src:e=>{let t=e.src;return typeof t=="string"&&t.includes("{{")&&(t=e.call("replaceLiteralsWithObjectFields",t,e.state)),t},alt:e=>e.alt,loading:e=>e.loading}},Image:{extends:"Img"},Button:{tag:"button"},FocusableComponent:{tag:"button"},Form:{tag:"form"},Input:{tag:"input"},TextArea:{tag:"textarea"},Textarea:{tag:"textarea"},Select:{tag:"select"},Label:{tag:"label"},Iframe:{tag:"iframe"},Video:{tag:"video"},Audio:{tag:"audio"},Canvas:{tag:"canvas"},Span:{tag:"span"},P:{tag:"p"},H1:{tag:"h1"},H2:{tag:"h2"},H3:{tag:"h3"},H4:{tag:"h4"},H5:{tag:"h5"},H6:{tag:"h6"},Svg:{tag:"svg",attr:{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},Text:{tag:"span"}},It=(e,t)=>{const o={};return qe(e,(n,s)=>{if(!s.__brKey)return;const r=t(n);o[r===""?"__root":r]=s.__brKey}),o},qe=(e,t)=>{const o=n=>{const s=n&&n.__ref;if(s&&(t(n,s),s.__children))for(const r of s.__children)o(n[r])};o(e)},Ft=new Set(["app","config","pages","components","state","snippets","designSystem","dependencies","functions","methods","files","sharedLibraries"]);let z=0;const Pe=Symbol.for("brender.fetchTracked"),Se=()=>z,Gt=256*1024,Bt=1024*1024,Kt=new Set(["accept-language","accept"]),Ie={renders:0,record:null},Nt=50,Re={renders:0,record:null},Fe=(e,t)=>{e.renders++,e.renders===1?e.record=t():e.record&&(e.record.tainted=!0);const o=e.record;return{record:o,close:()=>{e.renders--,e.record===o&&(e.record=null)}}},we=e=>e.record&&!e.record.tainted?e.record:null,Ht=e=>{try{const t=new URL(e);return t.origin+t.pathname}catch{return String(e).split("?")[0]}},ke=(e,t,o)=>{!e||e.tainted||e.failures.length>=Nt||e.failures.push({url:Ht(t),reason:o})},Ge=e=>e&&typeof e=="object"&&typeof e.url=="string"?e.url:String(e),zt=e=>{const[t,o]=e,n=t&&typeof t=="object"&&typeof t.url=="string",s=Ge(t),r=String(o&&o.method||n&&t.method||"GET").toUpperCase(),i={},u=a=>{if(!a)return;const g=!Array.isArray(a)&&typeof a.entries!="function";for(const[f,c]of yt(a))g&&c==null||(i[String(f).toLowerCase()]=String(c))};return n&&u(t.headers),o&&u(o.headers),{url:s,method:r,headers:i}},Wt=(e,t,o,n)=>{if(!o||!o.ok||typeof o.clone!="function")return;const s=o.headers&&o.headers.get&&o.headers.get("content-type")||"";if(!/json|^text\//i.test(s))return;let r;try{r=o.clone()}catch{return}n(r.text().then(i=>{e.tainted||i.length>Gt||e.bytes+i.length>Bt||(e.bytes+=i.length,e.entries.push({url:t.url,lang:t.headers["accept-language"]||"",status:o.status,type:s,body:i}))},()=>{}))},Ut=()=>{const e=globalThis.fetch;if(typeof e!="function"||e[Pe])return;const t=function(...o){z++;let n=!1;const s=()=>{n||(n=!0,z--)},r=c=>{z++,c.then(()=>{z--},()=>{z--})},i=we(Ie),u=we(Re);let a=null;if(i)try{a=zt(o),(a.method!=="GET"||!/^https?:/i.test(a.url)||Object.keys(a.headers).some(c=>!Kt.has(c)))&&(a=null)}catch{a=null}const g=()=>Ge(o[0]);let f;try{f=e.apply(this,o)}catch(c){throw ke(u,g(),c&&c.message||"failed"),s(),c}return f&&typeof f.then=="function"?f.then(c=>{a&&Wt(i,a,c,r),u&&c&&c.ok===!1&&ke(u,g(),"HTTP "+c.status),s()},c=>{ke(u,g(),c&&c.message||"network error"),s()}):s(),f};t[Pe]=!0,globalThis.fetch=t},sn=({brRegistry:e,fetchSeed:t,hydrateFlag:o=!0}={})=>{if(!e||!Object.keys(e).length)return"";const n=Rt(e);return o?`<script>window.__BR_REGISTRY__=${n};window.__BRENDER_HYDRATE__=true<\/script>`+(t&&t.length?`
2
- `+ht(t):""):`<script>window.__BR_REGISTRY__=${n}<\/script>`},Vt=e=>{const t=globalThis.__SMBLS_PKGS__,o=new Set(t&&typeof t=="object"?Object.getOwnPropertyNames(t):[]);return()=>{const n=globalThis.__SMBLS_PKGS__;if(!n||typeof n!="object")return;let s;try{s=wt(e())}catch{return}for(const[r]of s)!o.has(r)&&Object.prototype.hasOwnProperty.call(n,r)&&Reflect.deleteProperty(n,r)}},Jt=3e4,Yt=2147483647;let Be=Promise.resolve();const Ke=()=>{},Xt=e=>{const t=Be.then(e);return Be=t.then(Ke,Ke),t},Qt=e=>{if(e===void 0)return Jt;if(e===0||e===!1||e===1/0)return 0;if(typeof e!="number"||!(e>0))throw new TypeError(`brender: options.timeout is a number of milliseconds, or 0 / false for no limit \u2014 not ${JSON.stringify(e)}`);return Math.min(e,Yt)},Zt=(e,t)=>{const o=e.route||"/",n=e.pathname||o,s=n===o?o:`${n} (route ${o})`,r=new Error(`brender: the render of ${s} did not finish within ${t} ms and was abandoned, so the renders after it can run (options.timeout)`);return r.code="BRENDER_RENDER_TIMEOUT",r.route=o,r.pathname=n,r.timeout=t,r},eo=e=>{e.closed=!0;for(const t of e.undo.splice(0))t()},to=e=>{let t=!1;return()=>{t||(t=!0,e())}},Ne=(e,t={})=>{let o;try{o=Qt(t.timeout)}catch(n){return Promise.reject(n)}return Xt(()=>oo(e,t,o))},oo=async(e,t,o)=>{await Oe();const n={closed:!1,undo:[]},s=no(e,t,n);if(!o)return s;let r;const i=new Promise((u,a)=>{r=setTimeout(()=>{eo(n),a(Zt(t,o))},o)});try{return await Promise.race([s,i])}finally{clearTimeout(r)}},no=async(e,t,o)=>{const{route:n="/",pathname:s,state:r,context:i,prefetch:u=!1,lazyGroups:a}=t,g=s||n;Ut();const f=Fe(Re,()=>({failures:[],labelKeys:new Set,tainted:!1}));try{return await so(Dt(e),{route:n,locationPath:g,stateOverrides:r,contextOverrides:i,prefetch:u,lazyGroups:a},f.record,o)}finally{f.close()}},so=async(e,{route:t,locationPath:o,stateOverrides:n,contextOverrides:s,prefetch:r,lazyGroups:i},u,a)=>{const g=()=>{if(a.closed)throw new Error("brender: this render was abandoned at its timeout")};let f;if(r){try{f=await gt(e)}catch(k){a.closed||console.warn("[brender] SSR translation fetch failed:",k.message)}g()}const{window:c,document:l}=je(),p=l.body;c.location.pathname=o;let h=null;const R=[fe("document",l),fe("location",c.location),fe("localStorage",c.localStorage),fe("sessionStorage",c.sessionStorage),Vt(()=>h&&h.sharedLibraries)].map(to);a.undo.push(...R);try{const{createDomqlElement:k,PRERENDER_REGISTRY_FORMATS:Y}=await Oe();g();const me=L(e.app||{}),_={...e.config||{}};e.polyglot&&!_.polyglot&&(_.polyglot=e.polyglot),e.fetch&&!_.fetch&&(_.fetch=e.fetch),e.router&&!_.router&&(_.router=e.router);for(const m of po)e[m]!=null&&_[m]==null&&(_[m]=e[m]);const E=_.polyglot?{..._.polyglot,prefetch:!1}:void 0,X=xt(o,E);X&&c.localStorage.setItem(kt(E),X),f&&E&&(E.translations={...E.translations||{},...f});const Q=L(e.state||{});$t();const P={};for(const m in e){if(Ft.has(m))continue;const b=e[m];P[m]=b&&typeof b=="object"?L(b):b}const x={...P,state:Q,...n?{state:{...Q,...n}}:{},dependencies:L(e.dependencies||{}),components:L(e.components||{}),snippets:L(e.snippets||{}),pages:L(e.pages||{}),functions:{...e.functions||{},polyglot:Ct,getActiveLang:De,getLang:De},methods:e.methods||{},designSystem:L(e.designSystem||{}),files:e.files||{},sharedLibraries:e.sharedLibraries||[],..._,...E?{polyglot:E}:{},document:l,window:c,parent:{node:p},initOptions:{},domqlOptions:{sourcemap:!1},firstRender:!1,sync:!1,inspect:!1,notifications:!1,afterFirstView:null,isolateDesignSystem:!0,isolateFetchCache:!0,captureDesignSystem:!0,...ro(i),...s||{},ssr:!0};h=x;const Z=await vt();g(),Z&&(x.plugins=x.plugins||[],x.plugins.some(m=>m.name==="funcql")||x.plugins.push(Z)),Te();const B=Fe(Ie,()=>({entries:[],bytes:0,tainted:!1})),y=B.record;let w;try{if(w=await k(me,x),g(),x.lazyFirstView){const D=(w&&w.context||x).__firstNavigation;if(D&&typeof D.then=="function"){try{await D}catch{}g()}}const m=Date.now(),b=r?2e3:50,T=D=>new Promise(re=>setTimeout(re,D));for(await T(Math.min(50,b));r&&!a.closed&&Se()>0&&Date.now()-m<b;)await T(10),Se()===0&&await T(Math.max(0,Math.min(50,b-(Date.now()-m))));if(g(),r&&await co(w,E)){g();const D=Date.now();for(await T(Math.min(50,b));!a.closed&&Se()>0&&Date.now()-D<b;)await T(10);g()}}finally{B.close()}const W=y&&!y.tainted&&!(_.fetch&&_.fetch.seed===!1)?y.entries.slice():[];ve(p);const A=Le(w),{elementPath:K}=await import("@symbo.ls/element");g();const ee=It(w,K),te=W.length?At(w&&w.context||x,K):{},U=w?.context?.routerOptions?.contentElementKey||"content",I=w&&w[U],C=I&&typeof I=="object"&&I.__ref?I:void 0,Ee=he(e,t,w,w?.state,C),M=[],V=l.head||l.querySelector("head");if(V)for(const m of V.querySelectorAll("style")){if(m.sheet&&m.sheet.cssRules)for(const b of m.sheet.cssRules)b.cssText&&M.push(b);if(!M.length){const b=m.textContent||"";b&&M.push({cssText:b})}}const oe=M.map(m=>m.cssText),{globalCSS:ne,classRules:de}=bo(M);let v=We(p.innerHTML);const F=w?.state?.root,G=le(F,E),O=io(f,F);O&&(v=ze(v,He(O,G,E)));const N=u&&!u.tainted?{failedRequests:u.failures.slice(),rawLabelKeys:fo(u.labelKeys,v,G,E,F)}:null,$=(w&&w.context||x).__lazyFirstViews,se=$&&typeof $.forEach=="function"?[...$]:[];return{html:v,metadata:Ee,registry:A,brRegistry:ee,element:w,emotionCSS:oe,lazyGroups:se,globalCSS:ne,classRules:de,fetchSeed:W,fetchRuns:te,document:l,window:c,ssrTranslations:O||void 0,activeLang:G,diagnostics:N,preparedDesignSystem:x.preparedDesignSystem||null,registryFormats:Array.isArray(Y)?Y.slice():["paths"]}}finally{for(const k of R)k()}},ro=e=>{if(e==="load"||e===!0)return{lazyFirstView:!0};if(Array.isArray(e)){const t=e.filter(o=>typeof o=="string"&&o);return t.length?{lazyFirstView:t}:{}}return{}},fe=(e,t)=>{const o=Object.getOwnPropertyDescriptor(globalThis,e);return o&&!o.configurable?!o.writable&&!o.set?()=>{}:(globalThis[e]=t,()=>{}):(Object.defineProperty(globalThis,e,{value:t,writable:!0,configurable:!0,enumerable:!0}),()=>{o?Object.defineProperty(globalThis,e,o):delete globalThis[e]})},co=async(e,t)=>{if(!t||!t.fetch||!e||typeof e.call!="function")return!1;const o=e.state&&e.state.root;if(!o)return!1;const n=le(o,t),s=o.translations&&o.translations[n];if(s&&typeof s=="object"&&Object.keys(s).length||t.translations&&t.translations[n])return!1;try{await e.call("loadTranslations",n,{inFlight:!0})}catch{}return!0},xe=/\{\{\s*([^|{}]+?)\s*\|\s*polyglot\s*\}\}/g,_e=e=>e&&typeof e.parse=="function"?e.parse():e,io=(e,t)=>{const o=_e(t?.translations),n={};for(const s of[e,o])if(!(!s||typeof s!="object"))for(const r in s){const i=_e(s[r]);i&&typeof i=="object"&&(n[r]={...n[r]||{},...i})}return Object.keys(n).length?n:null},He=(e,t,o)=>e[t]||e[ye(void 0,o)]||Object.values(e)[0]||{},ze=(e,t)=>e.replace(xe,(o,n)=>ie(t,n.trim())??o),lo=/<script\b[^>]*\btype\s*=\s*["']?application\/json["']?[^>]*>[\s\S]*?<\/script\s*>/gi,ao=(e,t)=>new RegExp(`(?:^|[^\\w.-])${St(t)}(?![\\w-]|\\.\\w)`).test(e),fo=(e,t,o,n,s)=>{const r=new Set,i=t.replace(lo,"");for(const u of e)/\s/.test(u)||$e(u,o,n,s)===void 0&&ao(i,u)&&r.add(u);for(const u of i.matchAll(xe))r.add(u[1].trim());return[...r]},rn=async(e,t={})=>{const{context:o={}}=t,{window:n,document:s}=je(),r=s.body,{create:i}=await import("@symbo.ls/element"),u=await import("@symbo.ls/utils"),a={...Pt,...o.components||{}},g={...u,...o.utils||{},...o.functions||{}};Te();let f;try{f=i(e,{node:r},"root",{context:{document:s,window:n,...o,components:a,utils:g,ssr:!0}})}catch{}ve(r);const c=f?Le(f):{};return{html:We(r.innerHTML),registry:c,element:f}},We=e=>e.replace(/(<svg\b[^>]*>)([\s\S]*?)(<\/svg>)/gi,(t,o,n,s)=>{if(n.includes("&lt;")){const r=n.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'");return o+r+s}return t}),po=["globalTheme","themeStorageKey","themeRoot","useReset","useVariable","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultConfig","useDefaultIcons","useThemeSuffixedVars","verbose","semanticIcons"],uo=new Set(["auto","system"]),Ue=e=>{if(!e||typeof e!="object")return null;const t=e.config&&typeof e.config=="object"?e.config:{};if((t.themeRoot!=null?t.themeRoot:e.themeRoot)!=null)return null;const n=t.globalTheme!=null?t.globalTheme:e.globalTheme;if(typeof n!="string")return null;const s=n.trim();return!s||uo.has(s)?null:s},mo=e=>String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;"),go=/\.[A-Za-z_\\-]/,ho=e=>{if(typeof e!="string"||!e)return!1;const t=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,'""').replace(/\[[^\]]*\]/g,"[]");return!go.test(t)},yo=/^\s*(:root|\[data-theme|\[data-skin)/,Ve=e=>{const t=e&&e.cssText;if(typeof t!="string")return null;if(/^@(-webkit-)?keyframes\b/.test(t))return"keyframes";if(t.startsWith("@font-face"))return null;if(typeof e.selectorText=="string")return ho(e.selectorText)?yo.test(e.selectorText)?"root":"reset":null;const o=e.cssRules&&Array.from(e.cssRules);if(o&&o.length&&/^@(media|supports|container)\b/.test(t)){const n=new Set(o.map(Ve));return n.has(null)||n.size!==1?n.has(null)?null:"reset":[...n][0]}return null},Je=e=>typeof e=="string"&&/^\s*@font-face\b/i.test(e),bo=e=>{const t={root:[],reset:[],keyframes:[]},o=[];for(const n of e||[]){const s=Ve(n);s?t[s].push(n.cssText):n&&n.cssText&&o.push(n.cssText)}return{globalCSS:{rootRule:t.root.join(`
1
+ import{resolve as g,join as rt,dirname as j}from"path";import{existsSync as b,unlinkSync as ct,readFileSync as Y,realpathSync as it}from"fs";import{resolvePackageEntry as at}from"./packageEntry.js";import{tmpdir as lt}from"os";import{randomBytes as ft}from"crypto";import{createRequire as ye}from"module";import{pathToFileURL as pt}from"url";import{createEnv as je}from"./env.js";import{resetKeys as ve,assignKeys as Le,mapKeysToElements as Ae}from"./keys.js";import{extractMetadata as be,generateHeadHtml as ut}from"./metadata.js";import"./hydrate.js";import{composeIntoShell as dt}from"./shell.js";import{trimSpriteToPage as mt,classRulesForPage as gt,markupClasses as ht,trimVariablesToPage as yt}from"./pageWeight.js";import{facesSheetTag as bt}from"./faces.js";import{fetchSSRTranslations as St}from"./prefetch.js";import{createEarlySeedScript as Rt}from"@symbo.ls/fetch";import{headerEntries as wt}from"@symbo.ls/fetch/rest";import{brenderStampMeta as kt,brenderLazyMeta as $e,escapeRegExp as xt,jsonForScript as _t,libraryPackageSpecs as Et,polyglotFallbackLang as Se,polyglotLangStorageKey as Tt,polyglotAddressLang as jt,polyglotStartupScript as vt}from"@symbo.ls/utils";import{brenderRegistryBlock as Lt,brenderRegistryTreeBlock as At}from"@symbo.ls/utils/server";import*as $t from"@symbo.ls/utils/server";import*as Dt from"@symbo.ls/utils";let le=null;const Ct=async()=>{if(le)return le;try{return le=(await import("@symbo.ls/funcql")).funcqlPlugin,le}catch{return null}};import"linkedom";import{createEarlySeedBlock as Ot,fetchRunsOf as Mt}from"@symbo.ls/fetch";import{reset as qt}from"@symbo.ls/css";const fe=(e,t)=>{if(!e||!t)return;if(e[t]!==void 0)return e[t];const o=t.split(".");let n=e;for(const s of o){if(n==null||typeof n!="object")return;n=n[s]}return n},pe=(e,t)=>Se(e?.lang,t),Pt=e=>{const t=$t.revivePolyglotDefaultLang;if(typeof t!="function"||!e||typeof e!="object")return e;const o=e.polyglot?t(e.polyglot):e.polyglot,n=e.config&&e.config.polyglot,s=n&&t(n);if(o===e.polyglot&&s===n)return e;const r={...e};return o!==e.polyglot&&(r.polyglot=o),s!==n&&(r.config={...e.config,polyglot:s}),r},De=e=>{const t=Dt.withPolyglotTranslations;return typeof t=="function"?t(e):e},Ce=(e,t,o,n)=>{if(o?.translations){const r=o.translations[t];if(r){const a=fe(r,e);if(a!==void 0)return a}}if(n?.translations){const r=n.translations[t];if(r){const a=fe(r,e);if(a!==void 0)return a}}const s=Se(void 0,o);if(s!==t&&o?.translations){const r=o.translations[s];if(r){const a=fe(r,e);if(a!==void 0)return a}}},It=function(e,t){if(!e)return"";const o=this?.context,n=o?.polyglot,s=this?.state?.root||o?.state?.root,r=Ce(e,t||pe(s,n),n,s);if(r!==void 0)return r;const a=xe(ke);return n&&a&&a.labelKeys.add(e),e},Oe=function(){return pe(this?.state?.root,this?.context?.polyglot)},L=(e,t=new WeakMap)=>{if(e===null||typeof e!="object")return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){const n=[];t.set(e,n);for(const s of e)n.push(typeof s=="object"&&s!==null?L(s,t):s);return n}const o={};t.set(e,o);for(const n of Object.keys(e)){const s=e[n];o[n]=typeof s=="object"&&s!==null?L(s,t):s}return o};let O=null;try{import.meta.url&&(O=ye(import.meta.url))}catch{}const Ft=()=>{if(!import.meta.url||!O)return{isMonorepo:!1,monorepoRoot:null,resolvePackage:p=>p};const e=it(new URL(".",import.meta.url).pathname),t=g(e,"../..");if(b(g(t,"packages","smbls","src","createDomql.js")))return{isMonorepo:!0,monorepoRoot:t};let n;try{const p=O.resolve("smbls/package.json");n=j(p)}catch{let p=e;for(;p!==j(p);){const m=g(p,"node_modules","smbls");if(b(g(m,"package.json"))){n=m;break}p=j(p)}}let s=O;if(n)try{s=ye(g(n,"package.json"))}catch{}let r,a=process.cwd();for(;a!==j(a);){if(b(g(a,"package.json"))){r=a;break}a=j(a)}let f=s;if(r)try{f=ye(g(r,"package.json"))}catch{}return{isMonorepo:!1,smblsRoot:n,brenderDir:e,projectRoot:r,_smblsRequire:s,_projectRequire:f}},z=(e,t)=>{const o=e.isMonorepo?[O]:[e._smblsRequire,e._projectRequire,O].filter(Boolean);for(const n of o)try{return n.resolve(t)}catch{}return null},an=(e,t,...o)=>{if(e.isMonorepo)return g(e.monorepoRoot,"packages",t,...o);const n=z(e,`${t}/package.json`);return n?g(j(n),...o):null},ln=(e,t,...o)=>{if(e.isMonorepo)return g(e.monorepoRoot,"plugins",t,...o);const n=z(e,`@symbo.ls/${t}/package.json`);return n?g(j(n),...o):null},Re=(e,t,...o)=>{if(e.isMonorepo){for(const s of["packages","plugins"]){const r=g(e.monorepoRoot,s,t,...o);if(b(r))return r}return null}const n=z(e,`@symbo.ls/${t}/package.json`);return n?g(j(n),...o):null},Me=(e,t,...o)=>{if(e.isMonorepo)return g(e.monorepoRoot,"packages","domql","packages",t,...o);const n=z(e,`@symbo.ls/${t}/package.json`);return n?g(j(n),...o):null};let ue=null;const qe="smbls/ssr",Gt=async()=>{const e=await import("smbls/ssr");if(typeof e?.createDomqlElement!="function")throw new Error("smbls/ssr does not export createDomqlElement");return e},Pe=()=>(ue||(ue=Bt().catch(e=>{throw ue=null,e})),ue),Bt=async()=>{const e=Ft();let t;if(O&&e.isMonorepo)t=g(e.monorepoRoot,"packages","smbls","src","createDomql.js");else{let l;try{return await Gt()}catch(c){l=c}if(!O)throw new Error(`brender: ${qe} is not available in this bundled runtime (${l.message}). Bundle smbls \u2265 the release that adds the smbls/ssr export alongside @symbo.ls/brender.`);const i=e.smblsRoot&&g(e.smblsRoot,"src","createDomql.js");if(i&&b(i))t=i;else throw new Error(`brender: cannot load ${qe} (${l.message}). Server rendering needs smbls installed in this project, at a release that exports smbls/ssr`+(e.smblsRoot?` (found smbls at ${e.smblsRoot}).`:" (no smbls package found)."))}const o=await import("esbuild"),n=rt(lt(),`br_createDomql_${ft(6).toString("hex")}.mjs`),s=at,r=e.isMonorepo?await import(pt(g(e.monorepoRoot,"scripts","vite-workspace-source.mjs")).href):null,a=r?new Set(r.workspacePackageRoots().map(l=>r.workspacePackageAt(l).name)):null,f=/^(?:smbls(?:\/.*)?|domql|css-in-props(?:\/.*)?|@symbo\.ls\/[^/]+)$/,p={name:"workspace-resolve",setup(l){r&&(l.onResolve({filter:/^[^./]/},i=>{if(f.test(i.path))return;const c=i.path.split("/"),u=i.path.startsWith("@")?c.slice(0,2).join("/"):c[0];if(!a.has(u))return;const y=r.resolveWorkspaceSource(i.path,i.importer||t);return y?{path:y}:{errors:[{text:`"${i.path}" names no source file in the workspace`}]}}),l.onLoad({filter:/[\\/]dist[\\/]/},i=>r.isWorkspaceDist(i.path)?{errors:[{text:`${i.path} is a BUILD of a workspace package \u2014 the render bundles source`}]}:void 0)),l.onResolve({filter:/^smbls/},i=>{const c=i.path.replace(/^smbls\/?/,""),u=e.isMonorepo?g(e.monorepoRoot,"packages","smbls"):e.smblsRoot;if(!u)return;if(!c){const _=s(u);return _?{path:_}:void 0}const y=g(u,c);if(b(y))return{path:y};if(b(y+".js"))return{path:y+".js"};const S=g(y,"index.js");if(b(S))return{path:S}}),l.onResolve({filter:/^domql$/},i=>{if(e.isMonorepo){const c=g(e.monorepoRoot,"packages","domql","src","index.js");if(b(c))return{path:c};const u=g(e.monorepoRoot,"packages","domql","index.js");if(b(u))return{path:u}}else try{const c=_require.resolve("domql/package.json"),u=s(j(c));if(u)return{path:u}}catch{}}),l.onResolve({filter:/^@symbo\.ls\//},i=>{const c=i.path.replace("@symbo.ls/","");if(c==="sync")return{path:"sync-stub",namespace:"brender-stub"};if(e.isMonorepo){for(const y of["packages","plugins"]){const S=g(e.monorepoRoot,y,c,"src","index.js");if(b(S))return{path:S};const _=g(e.monorepoRoot,y,c,"index.js");if(b(_))return{path:_}}const u=g(e.monorepoRoot,"packages","default-config","blank","index.js");if(c==="default-config"&&b(u))return{path:u}}else{const u=Re(e,c,"src","index.js");if(u&&b(u))return{path:u};const y=Re(e,c,"index.js");if(y&&b(y))return{path:y};if(c==="default-config"){const S=Re(e,"default-config","blank","index.js");if(S&&b(S))return{path:S}}}}),l.onResolve({filter:/^@domql\//},i=>{const c=i.path.replace("@symbo.ls/","");if(e.isMonorepo){const u=g(e.monorepoRoot,"packages","domql","packages",c,"src","index.js");if(b(u))return{path:u};const y=g(e.monorepoRoot,"packages","domql","packages",c,"index.js");if(b(y))return{path:y}}else{const u=Me(e,c,"src","index.js");if(u&&b(u))return{path:u};const y=Me(e,c,"index.js");if(y&&b(y))return{path:y}}}),l.onResolve({filter:/^css-in-props/},i=>{let c;if(e.isMonorepo)c=g(e.monorepoRoot,"packages","css-in-props");else{const S=z(e,"css-in-props/package.json");S&&(c=j(S))}if(!c)return;const u=i.path.replace(/^css-in-props\/?/,"");if(u){const S=g(c,u),_=g(S,"index.js");if(b(_))return{path:_};if(b(S+".js"))return{path:S+".js"};if(b(S))return{path:S}}const y=s(c);if(y)return{path:y}}),l.onResolve({filter:/^@emotion\//},i=>{let c;if(e.isMonorepo)c=g(e.monorepoRoot,"node_modules",i.path);else{const u=z(e,`${i.path}/package.json`);if(!u)return;c=j(u)}if(b(c)){const u=g(c,"package.json");if(b(u))try{const y=JSON.parse(Y(u,"utf8")),S=y.module||y.main||"dist/emotion-css.esm.js";return{path:g(c,S)}}catch{}return{path:c}}}),l.onResolve({filter:/\.json$/},i=>{if(i.resolveDir){const c=g(i.resolveDir,i.path);if(b(c))return{path:c}}}),l.onLoad({filter:/smbls\/.*options\.js$/},async i=>{if(!i.path.includes("smbls/")||!i.path.endsWith("options.js"))return;let c=Y(i.path,"utf8");return c=c.replace(/import\s*\{[^}]*version[^}]*\}\s*from\s*['"][^'"]*package\.json['"][^;\n]*/,"const version = '0.0.0'"),c=c.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:c,loader:"js"}}),l.onLoad({filter:/smbls\/.*init\.js$/},async i=>{if(!i.path.includes("smbls/")||!i.path.endsWith("init.js"))return;let c=Y(i.path,"utf8");return c=c.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:c,loader:"js"}}),l.onLoad({filter:/.*/,namespace:"brender-stub"},()=>({contents:"export const SyncComponent = {}; export const Inspect = {}; export const Notifications = {}; export const syncPlugin = () => ({}); export const notificationsPlugin = () => ({}); export const seedRawDesignSystem = () => {}; export const inspectPlugin = () => ({}); export default {}",loader:"js"})),l.onLoad({filter:/smbls\/src\/router\.js$/},async i=>{let c=Y(i.path,"utf8");return c=c.replace(/import\s*\{\s*Link\s*\}\s*from\s*['"]smbls['"]/,"const Link = { tag: 'a', attr: { href: (el) => el.href } }"),{contents:c,loader:"js"}}),l.onLoad({filter:/fetchOnCreate\.js$/},async i=>{if(!i.path.includes("smbls/"))return;let c=Y(i.path,"utf8");return c=c.replace(/window\s*&&\s*window\.location\s*\?\s*window\.location\.host\.includes/g,"window && window.location && window.location.host ? window.location.host.includes"),{contents:c,loader:"js"}})}};await o.build({entryPoints:[t],bundle:!0,format:"esm",platform:"node",outfile:n,write:!0,logLevel:"warning",plugins:[p],nodePaths:e.isMonorepo?[g(e.monorepoRoot,"node_modules")]:[...e.smblsRoot?[g(e.smblsRoot,"node_modules")]:[],...e.projectRoot?[g(e.projectRoot,"node_modules")]:[],...e.smblsRoot?[g(e.smblsRoot,"..","..","node_modules")]:[]].filter(l=>b(l)),supported:{"import-attributes":!1},external:["fs","path","os","crypto","url","http","https","stream","util","events","buffer","child_process","worker_threads","net","tls","dns","dgram","zlib","assert","querystring","string_decoder","readline","perf_hooks","async_hooks","v8","vm","cluster","inspector","module","process","tty","color-contrast-checker","linkedom"]});const m=await import(`file://${n}`);if(process.env.BRENDER_DEBUG)console.log("[brender] Bundle saved:",n);else try{ct(n)}catch{}return m},Kt={Box:{},Focusable:{},Block:{display:"block"},Inline:{display:"inline"},Flex:{display:"flex"},InlineFlex:{display:"inline-flex"},Grid:{display:"grid"},InlineGrid:{display:"inline-grid"},Link:{tag:"a",attr:{href:e=>e.href,target:e=>e.target,rel:e=>e.rel}},A:{extends:"Link"},RouteLink:{extends:"Link"},Img:{tag:"img",attr:{src:e=>{let t=e.src;return typeof t=="string"&&t.includes("{{")&&(t=e.call("replaceLiteralsWithObjectFields",t,e.state)),t},alt:e=>e.alt,loading:e=>e.loading}},Image:{extends:"Img"},Button:{tag:"button"},FocusableComponent:{tag:"button"},Form:{tag:"form"},Input:{tag:"input"},TextArea:{tag:"textarea"},Textarea:{tag:"textarea"},Select:{tag:"select"},Label:{tag:"label"},Iframe:{tag:"iframe"},Video:{tag:"video"},Audio:{tag:"audio"},Canvas:{tag:"canvas"},Span:{tag:"span"},P:{tag:"p"},H1:{tag:"h1"},H2:{tag:"h2"},H3:{tag:"h3"},H4:{tag:"h4"},H5:{tag:"h5"},H6:{tag:"h6"},Svg:{tag:"svg",attr:{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},Text:{tag:"span"}},Nt=(e,t)=>{const o={};return Ie(e,(n,s)=>{if(!s.__brKey)return;const r=t(n);o[r===""?"__root":r]=s.__brKey}),o},Ie=(e,t)=>{const o=n=>{const s=n&&n.__ref;if(s&&(t(n,s),s.__children))for(const r of s.__children)o(n[r])};o(e)},Ht=new Set(["app","config","pages","components","state","snippets","designSystem","dependencies","functions","methods","files","sharedLibraries"]);let W=0;const Fe=Symbol.for("brender.fetchTracked"),we=()=>W,zt=256*1024,Wt=1024*1024,Ut=new Set(["accept-language","accept"]),Ge={renders:0,record:null},Vt=50,ke={renders:0,record:null},Be=(e,t)=>{e.renders++,e.renders===1?e.record=t():e.record&&(e.record.tainted=!0);const o=e.record;return{record:o,close:()=>{e.renders--,e.record===o&&(e.record=null)}}},xe=e=>e.record&&!e.record.tainted?e.record:null,Jt=e=>{try{const t=new URL(e);return t.origin+t.pathname}catch{return String(e).split("?")[0]}},_e=(e,t,o)=>{!e||e.tainted||e.failures.length>=Vt||e.failures.push({url:Jt(t),reason:o})},Ke=e=>e&&typeof e=="object"&&typeof e.url=="string"?e.url:String(e),Yt=e=>{const[t,o]=e,n=t&&typeof t=="object"&&typeof t.url=="string",s=Ke(t),r=String(o&&o.method||n&&t.method||"GET").toUpperCase(),a={},f=p=>{if(!p)return;const m=!Array.isArray(p)&&typeof p.entries!="function";for(const[l,i]of wt(p))m&&i==null||(a[String(l).toLowerCase()]=String(i))};return n&&f(t.headers),o&&f(o.headers),{url:s,method:r,headers:a}},Xt=(e,t,o,n)=>{if(!o||!o.ok||typeof o.clone!="function")return;const s=o.headers&&o.headers.get&&o.headers.get("content-type")||"";if(!/json|^text\//i.test(s))return;let r;try{r=o.clone()}catch{return}n(r.text().then(a=>{e.tainted||a.length>zt||e.bytes+a.length>Wt||(e.bytes+=a.length,e.entries.push({url:t.url,lang:t.headers["accept-language"]||"",status:o.status,type:s,body:a}))},()=>{}))},Qt=()=>{const e=globalThis.fetch;if(typeof e!="function"||e[Fe])return;const t=function(...o){W++;let n=!1;const s=()=>{n||(n=!0,W--)},r=i=>{W++,i.then(()=>{W--},()=>{W--})},a=xe(Ge),f=xe(ke);let p=null;if(a)try{p=Yt(o),(p.method!=="GET"||!/^https?:/i.test(p.url)||Object.keys(p.headers).some(i=>!Ut.has(i)))&&(p=null)}catch{p=null}const m=()=>Ke(o[0]);let l;try{l=e.apply(this,o)}catch(i){throw _e(f,m(),i&&i.message||"failed"),s(),i}return l&&typeof l.then=="function"?l.then(i=>{p&&Xt(a,p,i,r),f&&i&&i.ok===!1&&_e(f,m(),"HTTP "+i.status),s()},i=>{_e(f,m(),i&&i.message||"network error"),s()}):s(),l};t[Fe]=!0,globalThis.fetch=t},fn=({brRegistry:e,fetchSeed:t,hydrateFlag:o=!0}={})=>{if(!e||!Object.keys(e).length)return"";const n=_t(e);return o?`<script>window.__BR_REGISTRY__=${n};window.__BRENDER_HYDRATE__=true<\/script>`+(t&&t.length?`
2
+ `+Rt(t):""):`<script>window.__BR_REGISTRY__=${n}<\/script>`},Zt=e=>{const t=globalThis.__SMBLS_PKGS__,o=new Set(t&&typeof t=="object"?Object.getOwnPropertyNames(t):[]);return()=>{const n=globalThis.__SMBLS_PKGS__;if(!n||typeof n!="object")return;let s;try{s=Et(e())}catch{return}for(const[r]of s)!o.has(r)&&Object.prototype.hasOwnProperty.call(n,r)&&Reflect.deleteProperty(n,r)}},eo=3e4,to=2147483647;let Ne=Promise.resolve();const He=()=>{},oo=e=>{const t=Ne.then(e);return Ne=t.then(He,He),t},no=e=>{if(e===void 0)return eo;if(e===0||e===!1||e===1/0)return 0;if(typeof e!="number"||!(e>0))throw new TypeError(`brender: options.timeout is a number of milliseconds, or 0 / false for no limit \u2014 not ${JSON.stringify(e)}`);return Math.min(e,to)},ze=e=>{if(e==null||e===""||e==="?")return"";if(typeof e!="string"||e.includes("#"))throw new TypeError(`brender: options.search is a query string ('?view=agent'), without a hash \u2014 not ${JSON.stringify(e)}`);return e.charAt(0)==="?"?e:"?"+e},so=(e,t)=>{const o=e.route||"/",n=e.pathname||o,s=n===o?o:`${n} (route ${o})`,r=new Error(`brender: the render of ${s} did not finish within ${t} ms and was abandoned, so the renders after it can run (options.timeout)`);return r.code="BRENDER_RENDER_TIMEOUT",r.route=o,r.pathname=n,r.timeout=t,r},ro=e=>{e.closed=!0;for(const t of e.undo.splice(0))t()},co=e=>{let t=!1;return()=>{t||(t=!0,e())}},We=(e,t={})=>{let o;try{o=no(t.timeout),ze(t.search)}catch(n){return Promise.reject(n)}return oo(()=>io(De(e),t,o))},io=async(e,t,o)=>{await Pe();const n={closed:!1,undo:[]},s=ao(e,t,n);if(!o)return s;let r;const a=new Promise((f,p)=>{r=setTimeout(()=>{ro(n),p(so(t,o))},o)});try{return await Promise.race([s,a])}finally{clearTimeout(r)}},ao=async(e,t,o)=>{const{route:n="/",pathname:s,state:r,context:a,prefetch:f=!1,lazyGroups:p}=t,m=s||n,l=ze(t.search);Qt();const i=Be(ke,()=>({failures:[],labelKeys:new Set,tainted:!1}));try{return await lo(Pt(e),{route:n,locationPath:m,locationSearch:l,stateOverrides:r,contextOverrides:a,prefetch:f,lazyGroups:p},i.record,o)}finally{i.close()}},lo=async(e,{route:t,locationPath:o,locationSearch:n,stateOverrides:s,contextOverrides:r,prefetch:a,lazyGroups:f},p,m)=>{const l=()=>{if(m.closed)throw new Error("brender: this render was abandoned at its timeout")};let i;if(a){try{i=await St(e)}catch(M){m.closed||console.warn("[brender] SSR translation fetch failed:",M.message)}l()}const{window:c,document:u}=je(),y=u.body;c.location.pathname=o,n&&(c.location.search=n,c.location.href=c.location.origin+o+n);let S=null;const _=[de("document",u),de("location",c.location),de("localStorage",c.localStorage),de("sessionStorage",c.sessionStorage),Zt(()=>S&&S.sharedLibraries)].map(co);m.undo.push(..._);try{const{createDomqlElement:M,PRERENDER_REGISTRY_FORMATS:X}=await Pe();l();const he=L(e.app||{}),x={...e.config||{}};e.polyglot&&!x.polyglot&&(x.polyglot=e.polyglot),e.fetch&&!x.fetch&&(x.fetch=e.fetch),e.router&&!x.router&&(x.router=e.router);for(const R of yo)e[R]!=null&&x[R]==null&&(x[R]=e[R]);const E=x.polyglot?{...x.polyglot,prefetch:!1}:void 0,U=jt(o,E);U&&c.localStorage.setItem(Tt(E),U),i&&E&&(E.translations={...E.translations||{},...i});const Q=L(e.state||{});qt();const Z={};for(const R in e){if(Ht.has(R))continue;const h=e[R];Z[R]=h&&typeof h=="object"?L(h):h}const w={...Z,state:Q,...s?{state:{...Q,...s}}:{},dependencies:L(e.dependencies||{}),components:L(e.components||{}),snippets:L(e.snippets||{}),pages:L(e.pages||{}),functions:{...e.functions||{},polyglot:It,getActiveLang:Oe,getLang:Oe},methods:e.methods||{},designSystem:L(e.designSystem||{}),files:e.files||{},sharedLibraries:e.sharedLibraries||[],...x,...E?{polyglot:E}:{},document:u,window:c,parent:{node:y},initOptions:{},domqlOptions:{sourcemap:!1},firstRender:!1,sync:!1,inspect:!1,notifications:!1,afterFirstView:null,isolateDesignSystem:!0,isolateFetchCache:!0,captureDesignSystem:!0,...fo(f),...r||{},ssr:!0};S=w;const q=await Ct();l(),q&&(w.plugins=w.plugins||[],w.plugins.some(R=>R.name==="funcql")||w.plugins.push(q)),ve();const ee=Be(Ge,()=>({entries:[],bytes:0,tainted:!1})),P=ee.record;let d;try{if(d=await M(he,w),l(),w.lazyFirstView){const T=(d&&d.context||w).__firstNavigation;if(T&&typeof T.then=="function"){try{await T}catch{}l()}}const R=Date.now(),h=a?2e3:50,k=T=>new Promise(ae=>setTimeout(ae,T));for(await k(Math.min(50,h));a&&!m.closed&&we()>0&&Date.now()-R<h;)await k(10),we()===0&&await k(Math.max(0,Math.min(50,h-(Date.now()-R))));if(l(),a&&await po(d,E)){l();const T=Date.now();for(await k(Math.min(50,h));!m.closed&&we()>0&&Date.now()-T<h;)await k(10);l()}}finally{ee.close()}const I=P&&!P.tainted&&!(x.fetch&&x.fetch.seed===!1)?P.entries.slice():[];Le(y);const te=Ae(d),{elementPath:v}=await import("@symbo.ls/element");l();const V=Nt(d,v),oe=I.length?Mt(d&&d.context||w,v):{},ne=d?.context?.routerOptions?.contentElementKey||"content",$=d&&d[ne],se=$&&typeof $=="object"&&$.__ref?$:void 0,D=be(e,t,d,d?.state,se),K=[],J=u.head||u.querySelector("head");if(J)for(const R of J.querySelectorAll("style")){if(R.sheet&&R.sheet.cssRules)for(const h of R.sheet.cssRules)h.cssText&&K.push(h);if(!K.length){const h=R.textContent||"";h&&K.push({cssText:h})}}const re=K.map(R=>R.cssText),{globalCSS:ce,classRules:ie}=xo(K);let N=Je(y.innerHTML);const A=d?.state?.root,F=pe(A,E),G=uo(i,A);G&&(N=Ve(N,Ue(G,F,E)));const H=p&&!p.tainted?{failedRequests:p.failures.slice(),rawLabelKeys:ho(p.labelKeys,N,F,E,A)}:null,C=(d&&d.context||w).__lazyFirstViews,B=C&&typeof C.forEach=="function"?[...C]:[];return{html:N,metadata:D,registry:te,brRegistry:V,element:d,emotionCSS:re,lazyGroups:B,globalCSS:ce,classRules:ie,fetchSeed:I,fetchRuns:oe,document:u,window:c,ssrTranslations:G||void 0,activeLang:F,diagnostics:H,preparedDesignSystem:w.preparedDesignSystem||null,registryFormats:Array.isArray(X)?X.slice():["paths"]}}finally{for(const M of _)M()}},fo=e=>{if(e==="load"||e===!0)return{lazyFirstView:!0};if(Array.isArray(e)){const t=e.filter(o=>typeof o=="string"&&o);return t.length?{lazyFirstView:t}:{}}return{}},de=(e,t)=>{const o=Object.getOwnPropertyDescriptor(globalThis,e);return o&&!o.configurable?!o.writable&&!o.set?()=>{}:(globalThis[e]=t,()=>{}):(Object.defineProperty(globalThis,e,{value:t,writable:!0,configurable:!0,enumerable:!0}),()=>{o?Object.defineProperty(globalThis,e,o):delete globalThis[e]})},po=async(e,t)=>{if(!t||!t.fetch||!e||typeof e.call!="function")return!1;const o=e.state&&e.state.root;if(!o)return!1;const n=pe(o,t),s=o.translations&&o.translations[n];if(s&&typeof s=="object"&&Object.keys(s).length||t.translations&&t.translations[n])return!1;try{await e.call("loadTranslations",n,{inFlight:!0})}catch{}return!0},Ee=/\{\{\s*([^|{}]+?)\s*\|\s*polyglot\s*\}\}/g,Te=e=>e&&typeof e.parse=="function"?e.parse():e,uo=(e,t)=>{const o=Te(t?.translations),n={};for(const s of[e,o])if(!(!s||typeof s!="object"))for(const r in s){const a=Te(s[r]);a&&typeof a=="object"&&(n[r]={...n[r]||{},...a})}return Object.keys(n).length?n:null},Ue=(e,t,o)=>e[t]||e[Se(void 0,o)]||Object.values(e)[0]||{},Ve=(e,t)=>e.replace(Ee,(o,n)=>fe(t,n.trim())??o),mo=/<script\b[^>]*\btype\s*=\s*["']?application\/json["']?[^>]*>[\s\S]*?<\/script\s*>/gi,go=(e,t)=>new RegExp(`(?:^|[^\\w.-])${xt(t)}(?![\\w-]|\\.\\w)`).test(e),ho=(e,t,o,n,s)=>{const r=new Set,a=t.replace(mo,"");for(const f of e)/\s/.test(f)||Ce(f,o,n,s)===void 0&&go(a,f)&&r.add(f);for(const f of a.matchAll(Ee))r.add(f[1].trim());return[...r]},pn=async(e,t={})=>{const{context:o={}}=t,{window:n,document:s}=je(),r=s.body,{create:a}=await import("@symbo.ls/element"),f=await import("@symbo.ls/utils"),p={...Kt,...o.components||{}},m={...f,...o.utils||{},...o.functions||{}};ve();let l;try{l=a(e,{node:r},"root",{context:{document:s,window:n,...o,components:p,utils:m,ssr:!0}})}catch{}Le(r);const i=l?Ae(l):{};return{html:Je(r.innerHTML),registry:i,element:l}},Je=e=>e.replace(/(<svg\b[^>]*>)([\s\S]*?)(<\/svg>)/gi,(t,o,n,s)=>{if(n.includes("&lt;")){const r=n.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'");return o+r+s}return t}),yo=["globalTheme","themeStorageKey","themeRoot","useReset","useVariable","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultConfig","useDefaultIcons","useThemeSuffixedVars","verbose","semanticIcons"],bo=new Set(["auto","system"]),Ye=e=>{if(!e||typeof e!="object")return null;const t=e.config&&typeof e.config=="object"?e.config:{};if((t.themeRoot!=null?t.themeRoot:e.themeRoot)!=null)return null;const n=t.globalTheme!=null?t.globalTheme:e.globalTheme;if(typeof n!="string")return null;const s=n.trim();return!s||bo.has(s)?null:s},So=e=>String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;"),Ro=/\.[A-Za-z_\\-]/,wo=e=>{if(typeof e!="string"||!e)return!1;const t=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,'""').replace(/\[[^\]]*\]/g,"[]");return!Ro.test(t)},ko=/^\s*(:root|\[data-theme|\[data-skin)/,Xe=e=>{const t=e&&e.cssText;if(typeof t!="string")return null;if(/^@(-webkit-)?keyframes\b/.test(t))return"keyframes";if(t.startsWith("@font-face"))return null;if(typeof e.selectorText=="string")return wo(e.selectorText)?ko.test(e.selectorText)?"root":"reset":null;const o=e.cssRules&&Array.from(e.cssRules);if(o&&o.length&&/^@(media|supports|container)\b/.test(t)){const n=new Set(o.map(Xe));return n.has(null)||n.size!==1?n.has(null)?null:"reset":[...n][0]}return null},Qe=e=>typeof e=="string"&&/^\s*@font-face\b/i.test(e),xo=e=>{const t={root:[],reset:[],keyframes:[]},o=[];for(const n of e||[]){const s=Xe(n);s?t[s].push(n.cssText):n&&n.cssText&&o.push(n.cssText)}return{globalCSS:{rootRule:t.root.join(`
3
3
  `),resetRules:t.reset.join(`
4
4
  `),keyframeRules:t.keyframes.join(`
5
- `),fontFaceCSS:""},classRules:o}};let pe=new Set;const cn=()=>{pe=new Set},ln=()=>Array.from(pe).join(`
6
- `),an=(e,t)=>e.replace(/<style data-emotion="smbls">[\s\S]*?<\/style>/,t?`<style data-emotion="smbls">
5
+ `),fontFaceCSS:""},classRules:o}};let me=new Set;const un=()=>{me=new Set},dn=()=>Array.from(me).join(`
6
+ `),mn=(e,t)=>e.replace(/<style data-emotion="smbls">[\s\S]*?<\/style>/,t?`<style data-emotion="smbls">
7
7
  ${t}
8
- </style>`:""),fn=async(e,t={})=>{const{route:o="/",pathname:n,prefetch:s=!0,timeout:r}=t,i=await Ne(e,{route:o,pathname:n,prefetch:s,timeout:r});if(!i)return null;const u=e.designSystem||{},a=i.globalCSS;let g=null;try{const c=So(i.element);Object.keys(c).length&&(g=c)}catch{}const f=i.activeLang;return{html:i.html,css:i.classRules.join(`
9
- `),classRules:i.classRules.slice(),globalCSS:a,resetCss:a.resetRules,fontLinks:et(u),metadata:i.metadata||he(e,o),brKeyCount:i.registry?Object.keys(i.registry).length:0,brRegistry:i.brRegistry||{},fetchSeed:i.fetchSeed||[],fetchRuns:i.fetchRuns||{},ssrTranslations:i.ssrTranslations,prefetchedState:g,activeLang:f,theme:Ue(e),diagnostics:i.diagnostics,preparedDesignSystem:i.preparedDesignSystem||null}},So=e=>{const t={};return qe(e,o=>{const n=o.fetch;if(!(!n||typeof n!="object"||!o.state))for(const s of Array.isArray(n)?n:[n]){const r=s&&typeof s=="object"&&typeof s.as=="string"?s.as:null;if(!r)continue;const i=r.startsWith("~/"),u=i?r.slice(2):r,a=i?o.state.root:o.state,g=_e(a&&a[u]);u&&g!=null&&typeof g!="function"&&(t[u]=g)}}),t},pn=async(e,t="/",o={})=>{const{lang:n,themeColor:s,isr:r,hydrate:i=!0,prefetch:u=!0,shell:a,adoptDom:g=!1,pathname:f,eagerImages:c=Ze,preloadScripts:l=!0,nonce:p,timeout:h,stamp:R,time:k,spriteIcons:Y="all",cssClasses:me="all",cssVariables:_="all",registryFormat:E="paths",lazyGroups:X,paint:Q}=o,P=Ro(Q),x=vo(p),Z=n||e.state?.lang||e.app?.metadata?.lang||"en",B=Ue(e),y=await Ne(e,{route:t,pathname:f,prefetch:u,timeout:h,lazyGroups:X});if(!y)return null;const w={...y.metadata};if(s&&(w["theme-color"]=s),typeof a=="string"&&!e.name){const m="\0brender-undeclared-title\0";if(he({...e,name:m},t,y.element,y.element?.state).title===m)for(const T of["title","og:title","twitter:title"])w[T]===y.metadata.title&&delete w[T]}const W=lt(w);for(const m of y.classRules)m&&pe.add(m);let A=Eo(y.html,c);Y==="page"&&(A=ft(A,typeof a=="string"?a:"").html);const K=Array.from(pe),ee=K.filter(Je),te=ee.length?K.filter(m=>!Je(m)):K,U=me==="page"?pt(te,ut(A,typeof a=="string"?a:"")).join(`
10
- `):te.join(`
11
- `),I=dt(ee),C=y.globalCSS,M=`<style data-brender>
12
- ${(_==="page"?mt(C.rootRule||"",C.resetRules,C.keyframeRules,U,A,typeof a=="string"?a:"").css:C.rootRule)||""}
13
- ${C.resetRules||""}
14
- ${C.keyframeRules||""}
15
- </style>`,V=U?`<style data-emotion="smbls">
16
- ${U}
17
- </style>`:"",oe=et(e.designSystem||{}),ne=Object.keys(y.registry).length,de=E==="tree"||E==="auto"&&(y.registryFormats||[]).includes("tree"),v=jo({brRegistry:y.brRegistry,fetchSeed:y.fetchSeed,fetchRuns:y.fetchRuns,adoptDom:g,stamp:R,time:k,registryFormat:de?"tree":"paths",lazyGroups:y.lazyGroups});let F="";if(r&&r.clientScript){const m=Number.isInteger(o.depth)?o.depth:t==="/"?0:t.replace(/^\/|\/$/g,"").split("/").length,b=m>0?"../".repeat(m):"./";if(i){const T=_t({polyglot:e.polyglot||e.config?.polyglot,translations:y.ssrTranslations,lang:y.activeLang,pathname:f||t,attrs:x}),D=T?T+`
18
- `:"",re=v.blocks?v.blocks+`
19
- `:"";F=`${D}${re}<script type="module" src="${b}${r.clientScript}"${x}><\/script>`}else F=`<script type="module"${x}>
8
+ </style>`:""),gn=async(e,t={})=>{const{route:o="/",pathname:n,search:s,prefetch:r=!0,timeout:a}=t,f=await We(e,{route:o,pathname:n,search:s,prefetch:r,timeout:a});if(!f)return null;const p=e.designSystem||{},m=f.globalCSS;let l=null;try{const c=_o(f.element);Object.keys(c).length&&(l=c)}catch{}const i=f.activeLang;return{html:f.html,css:f.classRules.join(`
9
+ `),classRules:f.classRules.slice(),globalCSS:m,resetCss:m.resetRules,fontLinks:nt(p),metadata:f.metadata||be(e,o),brKeyCount:f.registry?Object.keys(f.registry).length:0,brRegistry:f.brRegistry||{},fetchSeed:f.fetchSeed||[],fetchRuns:f.fetchRuns||{},ssrTranslations:f.ssrTranslations,prefetchedState:l,activeLang:i,theme:Ye(e),diagnostics:f.diagnostics,preparedDesignSystem:f.preparedDesignSystem||null}},_o=e=>{const t={};return Ie(e,o=>{const n=o.fetch;if(!(!n||typeof n!="object"||!o.state))for(const s of Array.isArray(n)?n:[n]){const r=s&&typeof s=="object"&&typeof s.as=="string"?s.as:null;if(!r)continue;const a=r.startsWith("~/"),f=a?r.slice(2):r,p=a?o.state.root:o.state,m=Te(p&&p[f]);f&&m!=null&&typeof m!="function"&&(t[f]=m)}}),t},hn=async(e,t="/",o={})=>{const n=De(e),{lang:s,themeColor:r,isr:a,hydrate:f=!0,prefetch:p=!0,shell:m,adoptDom:l=!1,pathname:i,search:c,eagerImages:u=ot,preloadScripts:y=!0,nonce:S,timeout:_,stamp:M,time:X,spriteIcons:he="all",cssClasses:x="all",cssVariables:E="all",registryFormat:U="paths",lazyGroups:Q,paint:Z}=o,w=Eo(Z),q=Co(S),ee=s||n.state?.lang||n.app?.metadata?.lang||"en",P=Ye(n),d=await We(n,{route:t,pathname:i,search:c,prefetch:p,timeout:_,lazyGroups:Q});if(!d)return null;const I={...d.metadata};if(r&&(I["theme-color"]=r),typeof m=="string"&&!n.name){const h="\0brender-undeclared-title\0";if(be({...n,name:h},t,d.element,d.element?.state).title===h)for(const T of["title","og:title","twitter:title"])I[T]===d.metadata.title&&delete I[T]}const te=ut(I);for(const h of d.classRules)h&&me.add(h);let v=Ao(d.html,u);he==="page"&&(v=mt(v,typeof m=="string"?m:"").html);const V=Array.from(me),oe=V.filter(Qe),ne=oe.length?V.filter(h=>!Qe(h)):V,$=x==="page"?gt(ne,ht(v,typeof m=="string"?m:"")).join(`
10
+ `):ne.join(`
11
+ `),se=bt(oe),D=d.globalCSS,J=`<style data-brender>
12
+ ${(E==="page"?yt(D.rootRule||"",D.resetRules,D.keyframeRules,$,v,typeof m=="string"?m:"").css:D.rootRule)||""}
13
+ ${D.resetRules||""}
14
+ ${D.keyframeRules||""}
15
+ </style>`,re=$?`<style data-emotion="smbls">
16
+ ${$}
17
+ </style>`:"",ce=nt(n.designSystem||{}),ie=Object.keys(d.registry).length,N=U==="tree"||U==="auto"&&(d.registryFormats||[]).includes("tree"),A=$o({brRegistry:d.brRegistry,fetchSeed:d.fetchSeed,fetchRuns:d.fetchRuns,adoptDom:l,stamp:M,time:X,registryFormat:N?"tree":"paths",lazyGroups:d.lazyGroups});let F="";if(a&&a.clientScript){const h=Number.isInteger(o.depth)?o.depth:t==="/"?0:t.replace(/^\/|\/$/g,"").split("/").length,k=h>0?"../".repeat(h):"./";if(f){const T=vt({polyglot:n.polyglot||n.config?.polyglot,translations:d.ssrTranslations,lang:d.activeLang,pathname:i||t,attrs:q}),ae=T?T+`
18
+ `:"",st=A.blocks?A.blocks+`
19
+ `:"";F=`${ae}${st}<script type="module" src="${k}${a.clientScript}"${q}><\/script>`}else F=`<script type="module"${q}>
20
20
  {
21
21
  const brEls = document.querySelectorAll('body > :not(script):not(style)')
22
22
  const observer = new MutationObserver((mutations) => {
@@ -33,29 +33,29 @@ ${U}
33
33
  observer.observe(document.body, { childList: true })
34
34
  }
35
35
  <\/script>
36
- <script type="module" src="${b}${r.clientScript}"${x}><\/script>`}const G={...e.config||{}};e.polyglot&&!G.polyglot&&(G.polyglot=e.polyglot);const O=G.polyglot;let N=W;if(O){const m={...O.translations||{}};for(const b in y.ssrTranslations||{})m[b]={...m[b]||{},...y.ssrTranslations[b]};N=ze(W,He(m,y.activeLang,O))}const $=y.diagnostics;if($)for(const m of N.matchAll(xe)){const b=m[1].trim();$.rawLabelKeys.includes(b)||$.rawLabelKeys.push(b)}if(typeof a=="string"){const m=at(a,{headTags:`${N}
37
- ${v.meta}`,headEnd:[oe,I,M,V].filter(Boolean).join(`
38
- `),body:P?A+`
39
- `+Xe:A,depth:Number.isInteger(o.depth)?o.depth:0,bootScripts:v.blocks,lang:n||(O?y.activeLang:void 0),theme:B,preloadScripts:l});return{html:P?Qe(m):m,route:t,brKeyCount:ne,shell:!0,diagnostics:$,preparedDesignSystem:y.preparedDesignSystem||null,lazyGroups:y.lazyGroups||[]}}const se=`<!DOCTYPE html>
40
- <html lang="${Z}"${B?` data-theme="${mo(B)}"`:""}>
36
+ <script type="module" src="${k}${a.clientScript}"${q}><\/script>`}const G={...n.config||{}};n.polyglot&&!G.polyglot&&(G.polyglot=n.polyglot);const H=G.polyglot;let C=te;if(H){const h={...H.translations||{}};for(const k in d.ssrTranslations||{})h[k]={...h[k]||{},...d.ssrTranslations[k]};C=Ve(te,Ue(h,d.activeLang,H))}const B=d.diagnostics;if(B)for(const h of C.matchAll(Ee)){const k=h[1].trim();B.rawLabelKeys.includes(k)||B.rawLabelKeys.push(k)}if(typeof m=="string"){const h=dt(m,{headTags:`${C}
37
+ ${A.meta}`,headEnd:[ce,se,J,re].filter(Boolean).join(`
38
+ `),body:w?v+`
39
+ `+et:v,depth:Number.isInteger(o.depth)?o.depth:0,bootScripts:A.blocks,lang:s||(H?d.activeLang:void 0),theme:P,preloadScripts:y});return{html:w?tt(h):h,route:t,brKeyCount:ie,shell:!0,diagnostics:B,preparedDesignSystem:d.preparedDesignSystem||null,lazyGroups:d.lazyGroups||[]}}const R=`<!DOCTYPE html>
40
+ <html lang="${ee}"${P?` data-theme="${So(P)}"`:""}>
41
41
  <head>
42
- ${N}${r&&r.clientScript&&i?`
43
- ${v.meta}`:""}
44
- ${oe}
45
- ${I}
46
- ${M}
47
- ${V}
42
+ ${C}${a&&a.clientScript&&f?`
43
+ ${A.meta}`:""}
44
+ ${ce}
45
+ ${se}
46
+ ${J}
47
+ ${re}
48
48
  </head>
49
49
  <body>
50
- ${A}${P?`
51
- ${Xe}`:""}
50
+ ${v}${w?`
51
+ ${et}`:""}
52
52
  ${F}
53
53
  </body>
54
- </html>`;return{html:P?Qe(se):se,route:t,brKeyCount:ne,diagnostics:$,preparedDesignSystem:y.preparedDesignSystem||null,lazyGroups:y.lazyGroups||[]}},Ye="smbls-whole",Xe=`<template id="${Ye}"></template>`,ue=`<link rel="expect" href="#${Ye}" blocking="render">`,Ro=e=>!!(e&&typeof e=="object"&&e.whole===!0),wo=/<meta\b[^>]*\bcharset\s*=[^>]*>/i,ko=[/<head\b[^>]*>/i,/<html\b[^>]*>/i,/^\s*<!doctype\b[^>]*>/i],Qe=e=>{if(typeof e!="string"||e.includes(ue))return e;const t=wo.exec(e.slice(0,1024));if(t){const o=t.index+t[0].length;return e.slice(0,o)+`
55
- `+ue+e.slice(o)}for(const o of ko){const n=o.exec(e);if(n)return e.slice(0,n.index+n[0].length)+`
56
- `+ue+e.slice(n.index+n[0].length)}return ue+`
57
- `+e},Ze=2,xo=/<img\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,_o=/\sloading\s*=/i,Eo=(e,t=Ze)=>{if(t===!1||t==null||typeof e!="string")return e;const o=Math.max(0,Number(t)||0);let n=0;return e.replace(xo,s=>n++<o||_o.test(s)?s:s.replace(/^<img\b/i,'<img loading="lazy"'))},et=e=>{if(!e)return"";const t=e.font_family||e.fontFamily||{},o=new Set;for(const s of Object.values(t)){if(typeof s!="string")continue;const r=s.match(/'([^']+)'/);r&&o.add(r[1])}return o.size?['<link rel="preconnect" href="https://fonts.googleapis.com">','<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>',`<link href="https://fonts.googleapis.com/css2?${[...o].map(s=>`family=${s.replace(/\s+/g,"+")}:wght@300;400;500;600;700`).join("&")}&display=swap" rel="stylesheet">`].join(`
58
- `):""},jo=({brRegistry:e,fetchSeed:t,fetchRuns:o,adoptDom:n=!1,stamp:s,time:r,registryFormat:i="paths",lazyGroups:u}={})=>{const g=n&&e&&Object.keys(e).length?i==="tree"&&jt(e)||Et(e):"",f=Lt(t,o);return{meta:`<meta name="brender" content="${g?"hydrate":"replace"}">
59
- `+bt(To(s,r))+(Ae(u)?`
60
- `+Ae(u):""),blocks:[g,f].filter(Boolean).join(`
61
- `)}},To=(e,t)=>{const o=typeof t=="number"&&isFinite(t)?Math.round(t):Date.now();return{stamp:e!=null&&e!==""?String(e):new Date(o).toISOString(),time:o}},vo=e=>{if(e==null||e==="")return"";const t=String(e);if(!/^[A-Za-z0-9+/=_-]+$/.test(t))throw new Error("brender: a nonce is base64 or base64url text");return` nonce="${t}"`};export{Ze as EAGER_IMAGES_DEFAULT,Me as SMBLS_SSR_SPECIFIER,Ye as WHOLE_MARKER_ID,sn as adoptionScripts,To as buildStamp,Ue as fixedThemeOf,ln as getAccumulatedEmotionCSS,Eo as markLazyImages,Ro as paintsWhole,jo as prerenderParts,Ne as render,rn as renderElement,pn as renderPage,fn as renderRoute,an as replaceEmotionCSS,cn as resetGlobalCSSCache,bo as splitCapturedCSS,Qe as withWholePaint};
54
+ </html>`;return{html:w?tt(R):R,route:t,brKeyCount:ie,diagnostics:B,preparedDesignSystem:d.preparedDesignSystem||null,lazyGroups:d.lazyGroups||[]}},Ze="smbls-whole",et=`<template id="${Ze}"></template>`,ge=`<link rel="expect" href="#${Ze}" blocking="render">`,Eo=e=>!!(e&&typeof e=="object"&&e.whole===!0),To=/<meta\b[^>]*\bcharset\s*=[^>]*>/i,jo=[/<head\b[^>]*>/i,/<html\b[^>]*>/i,/^\s*<!doctype\b[^>]*>/i],tt=e=>{if(typeof e!="string"||e.includes(ge))return e;const t=To.exec(e.slice(0,1024));if(t){const o=t.index+t[0].length;return e.slice(0,o)+`
55
+ `+ge+e.slice(o)}for(const o of jo){const n=o.exec(e);if(n)return e.slice(0,n.index+n[0].length)+`
56
+ `+ge+e.slice(n.index+n[0].length)}return ge+`
57
+ `+e},ot=2,vo=/<img\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,Lo=/\sloading\s*=/i,Ao=(e,t=ot)=>{if(t===!1||t==null||typeof e!="string")return e;const o=Math.max(0,Number(t)||0);let n=0;return e.replace(vo,s=>n++<o||Lo.test(s)?s:s.replace(/^<img\b/i,'<img loading="lazy"'))},nt=e=>{if(!e)return"";const t=e.font_family||e.fontFamily||{},o=new Set;for(const s of Object.values(t)){if(typeof s!="string")continue;const r=s.match(/'([^']+)'/);r&&o.add(r[1])}return o.size?['<link rel="preconnect" href="https://fonts.googleapis.com">','<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>',`<link href="https://fonts.googleapis.com/css2?${[...o].map(s=>`family=${s.replace(/\s+/g,"+")}:wght@300;400;500;600;700`).join("&")}&display=swap" rel="stylesheet">`].join(`
58
+ `):""},$o=({brRegistry:e,fetchSeed:t,fetchRuns:o,adoptDom:n=!1,stamp:s,time:r,registryFormat:a="paths",lazyGroups:f}={})=>{const m=n&&e&&Object.keys(e).length?a==="tree"&&At(e)||Lt(e):"",l=Ot(t,o);return{meta:`<meta name="brender" content="${m?"hydrate":"replace"}">
59
+ `+kt(Do(s,r))+($e(f)?`
60
+ `+$e(f):""),blocks:[m,l].filter(Boolean).join(`
61
+ `)}},Do=(e,t)=>{const o=typeof t=="number"&&isFinite(t)?Math.round(t):Date.now();return{stamp:e!=null&&e!==""?String(e):new Date(o).toISOString(),time:o}},Co=e=>{if(e==null||e==="")return"";const t=String(e);if(!/^[A-Za-z0-9+/=_-]+$/.test(t))throw new Error("brender: a nonce is base64 or base64url text");return` nonce="${t}"`};export{ot as EAGER_IMAGES_DEFAULT,qe as SMBLS_SSR_SPECIFIER,Ze as WHOLE_MARKER_ID,fn as adoptionScripts,Do as buildStamp,Ye as fixedThemeOf,dn as getAccumulatedEmotionCSS,Ao as markLazyImages,Eo as paintsWhole,$o as prerenderParts,We as render,pn as renderElement,hn as renderPage,gn as renderRoute,mn as replaceEmotionCSS,un as resetGlobalCSSCache,xo as splitCapturedCSS,tt as withWholePaint};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/brender",
3
- "version": "3.14.679",
3
+ "version": "3.14.681",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -57,17 +57,17 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@symbo.ls/css": "^3.14.782",
60
- "@symbo.ls/default-config": "^3.14.789",
61
- "@symbo.ls/element": "^3.14.819",
62
- "@symbo.ls/fetch": "^3.14.675",
60
+ "@symbo.ls/default-config": "^3.14.794",
61
+ "@symbo.ls/element": "^3.14.823",
62
+ "@symbo.ls/fetch": "^3.14.679",
63
63
  "@symbo.ls/helmet": "^3.14.674",
64
- "@symbo.ls/scratch": "^3.14.796",
65
- "@symbo.ls/utils": "^3.14.855",
64
+ "@symbo.ls/scratch": "^3.14.799",
65
+ "@symbo.ls/utils": "^3.14.860",
66
66
  "esbuild": "^0.28.1",
67
67
  "linkedom": "^0.16.8"
68
68
  },
69
69
  "peerDependencies": {
70
- "smbls": "^3.14.862"
70
+ "smbls": "^3.14.872"
71
71
  },
72
72
  "optionalDependencies": {
73
73
  "@symbo.ls/funcql": "^3.14.0"
package/prefetch.js CHANGED
@@ -124,12 +124,15 @@ const collectFetchDeclarations = (def, path = '') => {
124
124
  * sub-problem 2): the Supabase SSR path had been removed, nothing replaced it,
125
125
  * so server renders never had data or fetched translations.
126
126
  *
127
- * Not every adapter can run on the server: the platform's 'sdk' adapter is
128
- * registered by the page runtime, which a server render does not have. For a
127
+ * Not every adapter can run on the server: a host's 'sdk' adapter is
128
+ * registered by the host page, which a server render does not have. For a
129
129
  * name @symbo.ls/fetch cannot resolve right now (`hasAdapter`), this returns
130
130
  * null at once — the page renders without prefetched data and the client's
131
131
  * fetch loads it — instead of letting resolveDb wait for a registration that
132
- * never comes.
132
+ * never comes. A built-in that must not run here (`symbols`, the platform
133
+ * SDK of a published site) is told so — resolveDb's `{ serverRender: true }`
134
+ * — and answers null at once: the server never loads the SDK and never calls
135
+ * the API.
133
136
  */
134
137
  const BUILTIN_ADAPTER_NAMES = ['rest', 'local'] // @symbo.ls/fetch without hasAdapter()
135
138
  const _adapterCache = new WeakMap()
@@ -153,7 +156,7 @@ const createSSRAdapter = async (dbConfig) => {
153
156
  : BUILTIN_ADAPTER_NAMES.includes(config.adapter)
154
157
  if (!known) return null
155
158
  try {
156
- return await fetchPkg.resolveDb(config)
159
+ return await fetchPkg.resolveDb(config, { serverRender: true })
157
160
  } catch (e) {
158
161
  console.warn(`[brender] SSR adapter "${config.adapter}" unavailable: ${e.message}`)
159
162
  return null
package/render.js CHANGED
@@ -21,6 +21,8 @@ import { brenderRegistryBlock, brenderRegistryTreeBlock } from '@symbo.ls/utils/
21
21
  // than this package's utils floor (a named import of a missing export fails
22
22
  // the module at link time).
23
23
  import * as utilsServer from '@symbo.ls/utils/server'
24
+ // The same, for withPolyglotTranslations (withTranslations below).
25
+ import * as utilsIndex from '@symbo.ls/utils'
24
26
 
25
27
  // funcql plugin — enables evaluation of funcql schemas as property values
26
28
  // during SSR. Async-imported to avoid polluting non-funcql codepaths.
@@ -82,6 +84,20 @@ const withRevivedDefaultLang = (data) => {
82
84
  return out
83
85
  }
84
86
 
87
+ // The payload as frank writes an app whose polyglot reads its design
88
+ // system's lang map: `polyglot.translationsFrom: 'designSystem.lang'` and no
89
+ // `translations` — the map once (FW-FRANK-LANG-MAP-ONCE, @symbo.ls/utils
90
+ // polyglotLang.js). A render reads a VIEW whose polyglot holds that map as
91
+ // its `translations` — for the languages (the address's language), the
92
+ // labels, the fetched labels merged over them, the head — and never writes
93
+ // the caller's payload: mermaid also serves it, and a resolved payload would
94
+ // carry the map twice again. Older utils (below this package's floor): the
95
+ // payload as it is.
96
+ const withTranslations = (data) => {
97
+ const view = utilsIndex.withPolyglotTranslations
98
+ return typeof view === 'function' ? view(data) : data
99
+ }
100
+
85
101
  // One label lookup, the order the client's translate() reads: static
86
102
  // translations, then the labels loaded into the root state, then the
87
103
  // default language's static ones. `undefined` when no table has the key.
@@ -1063,6 +1079,19 @@ const renderTimeoutOf = (value) => {
1063
1079
  return Math.min(value, TIMER_MAX)
1064
1080
  }
1065
1081
 
1082
+ // `options.search`: the query of the address the page is rendered at (S1,
1083
+ // final-landing 2026-10-28: the landing's agent view, `?view=agent`, read by
1084
+ // its app at init). '?a=b', or 'a=b'; undefined, null, '' or '?' for none —
1085
+ // then the location is as it was before the option, byte for byte. A hash
1086
+ // is no part of it.
1087
+ const renderSearchOf = (value) => {
1088
+ if (value === undefined || value === null || value === '' || value === '?') return ''
1089
+ if (typeof value !== 'string' || value.includes('#')) {
1090
+ throw new TypeError(`brender: options.search is a query string ('?view=agent'), without a hash — not ${JSON.stringify(value)}`)
1091
+ }
1092
+ return value.charAt(0) === '?' ? value : '?' + value
1093
+ }
1094
+
1066
1095
  const renderTimeoutError = (options, timeout) => {
1067
1096
  const route = options.route || '/'
1068
1097
  const pathname = options.pathname || route
@@ -1105,6 +1134,8 @@ const once = (fn) => {
1105
1134
  * @param {object} [options]
1106
1135
  * @param {string} [options.route='/'] - The route/page to render
1107
1136
  * @param {string} [options.pathname] - The address the page is rendered at (default: the route)
1137
+ * @param {string} [options.search] - That address's query ('?view=agent'): the
1138
+ * render's location.search (and href); none by default
1108
1139
  * @param {object} [options.state] - State overrides
1109
1140
  * @param {object} [options.context] - Additional context overrides
1110
1141
  * @param {boolean} [options.prefetch=false] - Fetch table/RPC labels first and wait for the page's requests
@@ -1116,10 +1147,11 @@ export const render = (data, options = {}) => {
1116
1147
  let timeout
1117
1148
  try {
1118
1149
  timeout = renderTimeoutOf(options.timeout)
1150
+ renderSearchOf(options.search)
1119
1151
  } catch (err) {
1120
1152
  return Promise.reject(err)
1121
1153
  }
1122
- return inRenderQueue(() => renderInTurn(data, options, timeout))
1154
+ return inRenderQueue(() => renderInTurn(withTranslations(data), options, timeout))
1123
1155
  }
1124
1156
 
1125
1157
  const renderInTurn = async (data, options, timeout) => {
@@ -1148,18 +1180,20 @@ const renderOnce = async (data, options, turn) => {
1148
1180
  const { route = '/', pathname, state: stateOverrides, context: contextOverrides, prefetch = false, lazyGroups } = options
1149
1181
  // pathname is the actual URL path (e.g. /podcast/abc-123), route is the page pattern (e.g. /podcast/:id)
1150
1182
  const locationPath = pathname || route
1183
+ // its query ('' for none; checked in render())
1184
+ const locationSearch = renderSearchOf(options.search)
1151
1185
 
1152
1186
  // This render's diagnostics (see `DIAG`), open before its first request.
1153
1187
  trackFetches()
1154
1188
  const diag = openRenderRecord(DIAG, () => ({ failures: [], labelKeys: new Set(), tainted: false }))
1155
1189
  try {
1156
- return await renderWithDiagnostics(withRevivedDefaultLang(data), { route, locationPath, stateOverrides, contextOverrides, prefetch, lazyGroups }, diag.record, turn)
1190
+ return await renderWithDiagnostics(withRevivedDefaultLang(data), { route, locationPath, locationSearch, stateOverrides, contextOverrides, prefetch, lazyGroups }, diag.record, turn)
1157
1191
  } finally {
1158
1192
  diag.close()
1159
1193
  }
1160
1194
  }
1161
1195
 
1162
- const renderWithDiagnostics = async (data, { route, locationPath, stateOverrides, contextOverrides, prefetch, lazyGroups }, diag, turn) => {
1196
+ const renderWithDiagnostics = async (data, { route, locationPath, locationSearch, stateOverrides, contextOverrides, prefetch, lazyGroups }, diag, turn) => {
1163
1197
  // After every wait: a render abandoned at its timeout stops here (see
1164
1198
  // "One render at a time").
1165
1199
  const live = () => {
@@ -1199,6 +1233,13 @@ const renderWithDiagnostics = async (data, { route, locationPath, stateOverrides
1199
1233
 
1200
1234
  // Set route on location so the router picks it up
1201
1235
  window.location.pathname = locationPath
1236
+ // The address's query (`options.search`): page code reads it as in a
1237
+ // browser at that address — location.search, and href with it. None: the
1238
+ // location as before (href stays the origin's).
1239
+ if (locationSearch) {
1240
+ window.location.search = locationSearch
1241
+ window.location.href = window.location.origin + locationPath + locationSearch
1242
+ }
1202
1243
 
1203
1244
  // globalThis.document/location for the bundled smbls code (which uses
1204
1245
  // `window = globalThis`) during SSR, and the render's own storage behind
@@ -1894,6 +1935,7 @@ export const replaceEmotionCSS = (html, newCSS) => {
1894
1935
  * @param {object} data - Full project data
1895
1936
  * @param {object} [options]
1896
1937
  * @param {string} [options.route='/'] - Route to render
1938
+ * @param {string} [options.search] - The query of the address (see render())
1897
1939
  * @param {number|false} [options.timeout] - render()'s time limit (30 s by default)
1898
1940
  * @returns {Promise<{ html: string, css: string, resetCss: string, fontLinks: string, metadata: object, brKeyCount: number }>}
1899
1941
  */
@@ -1901,11 +1943,11 @@ export const renderRoute = async (data, options = {}) => {
1901
1943
  // `prefetch: false` fetches no table/RPC labels first and does not wait for
1902
1944
  // the page's requests — the publish-time pre-render (smbls publish →
1903
1945
  // ssrCache) renders data-free.
1904
- const { route = '/', pathname, prefetch = true, timeout } = options
1946
+ const { route = '/', pathname, search, prefetch = true, timeout } = options
1905
1947
 
1906
1948
  // Use the full render pipeline which handles polyglot, prefetch, emotion, etc.
1907
1949
  // Pass pathname so the virtual DOM location reflects the actual URL (for dynamic routes)
1908
- const result = await render(data, { route, pathname, prefetch, timeout })
1950
+ const result = await render(data, { route, pathname, search, prefetch, timeout })
1909
1951
  if (!result) return null
1910
1952
 
1911
1953
  const ds = data.designSystem || {}
@@ -1985,7 +2027,7 @@ const collectFetchedState = (element) => {
1985
2027
  *
1986
2028
  * Includes head, metadata, fonts, reset CSS, component CSS, and body.
1987
2029
  *
1988
- * @param {object} data - Full project data (from loadProject)
2030
+ * @param {object} payload - Full project data (from loadProject); not written to
1989
2031
  * @param {string} route - Route to render (e.g. '/', '/about')
1990
2032
  * @param {object} [options]
1991
2033
  * @param {string} [options.lang='en'] - HTML lang attribute
@@ -2011,6 +2053,8 @@ const collectFetchedState = (element) => {
2011
2053
  * The result then carries `shell: true`.
2012
2054
  * @param {number|false} [options.timeout] - render()'s time limit (30 s by
2013
2055
  * default; 0 or false: none) — see render()
2056
+ * @param {string} [options.search] - The query of the address the page is
2057
+ * rendered at ('?view=agent'; see render()); none by default
2014
2058
  * @param {string|number} [options.stamp] - The build's data stamp, written into
2015
2059
  * the page (see buildStamp); default: the render time as an ISO string
2016
2060
  * @param {number} [options.time] - The build time in ms (see buildStamp);
@@ -2038,8 +2082,10 @@ const collectFetchedState = (element) => {
2038
2082
  * paint waits until the page's markup is in (see withWholePaint)
2039
2083
  * @returns {Promise<{ html: string, route: string, brKeyCount: number, shell?: true }>}
2040
2084
  */
2041
- export const renderPage = async (data, route = '/', options = {}) => {
2042
- const { lang, themeColor, isr, hydrate = true, prefetch = true, shell, adoptDom = false, pathname, eagerImages = EAGER_IMAGES_DEFAULT, preloadScripts = true, nonce, timeout, stamp, time, spriteIcons = 'all', cssClasses = 'all', cssVariables = 'all', registryFormat = 'paths', lazyGroups, paint } = options
2085
+ export const renderPage = async (payload, route = '/', options = {}) => {
2086
+ // the strings of a polyglot that names them by pointer (withTranslations)
2087
+ const data = withTranslations(payload)
2088
+ const { lang, themeColor, isr, hydrate = true, prefetch = true, shell, adoptDom = false, pathname, search, eagerImages = EAGER_IMAGES_DEFAULT, preloadScripts = true, nonce, timeout, stamp, time, spriteIcons = 'all', cssClasses = 'all', cssVariables = 'all', registryFormat = 'paths', lazyGroups, paint } = options
2043
2089
  const whole = paintsWhole(paint)
2044
2090
  const nonceAttr = nonceAttribute(nonce)
2045
2091
 
@@ -2054,7 +2100,7 @@ export const renderPage = async (data, route = '/', options = {}) => {
2054
2100
  // canonical/og:url built from it read it. Without it a route was rendered
2055
2101
  // at its own pattern: the `/*` page wrote a `/*` canonical into 404.html
2056
2102
  // (xma.info report, brender build item 7).
2057
- const result = await render(data, { route, pathname, prefetch, timeout, lazyGroups })
2103
+ const result = await render(data, { route, pathname, search, prefetch, timeout, lazyGroups })
2058
2104
  if (!result) return null
2059
2105
 
2060
2106
  const metadata = { ...result.metadata }