@roxyapi/ui 0.27.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var B=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var m=(n,i,e,r)=>{for(var t=r>1?void 0:r?K(i,e):i,o=n.length-1,s;o>=0;o--)(s=n[o])&&(t=(r?s(i,e,t):s(t))||t);return r&&t&&B(i,e,t),t};import{css as ie,html as u,LitElement as ne,nothing as f}from"lit";import{customElement as oe,property as x,state as h}from"lit/decorators.js";import{ifDefined as L}from"lit/directives/if-defined.js";var q=["de","en","es","fr","hi","pt","ru","tr"];function U(n){if(n.lang)return n.lang;if(typeof document>"u")return;let i=n.closest?.("[lang]")?.getAttribute("lang");return i||document.documentElement.lang||void 0}function R(n){let i=U(n);if(!i)return;let e=i.toLowerCase().split("-")[0];return q.includes(e)?e:void 0}function E(n){return n.toLowerCase().replace(/[\s_-]+/g," ").trim()}function p(n){return n.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([a-z])([0-9])/g,"$1 $2").replace(/^\w/,i=>i.toUpperCase())}var V=(n,i)=>i?n[E(i)]:void 0;var Y={aries:"\u2648",taurus:"\u2649",gemini:"\u264A",cancer:"\u264B",leo:"\u264C",virgo:"\u264D",libra:"\u264E",scorpio:"\u264F",sagittarius:"\u2650",capricorn:"\u2651",aquarius:"\u2652",pisces:"\u2653"},T=n=>V(Y,n);var F=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"];import{css as Q}from"lit";var C=Q`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;import{css as Z,html as J}from"lit";function S(){return J`<svg class="roxy-chevron" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`}var z=Z`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;var X=12,A=["latitude","longitude","timezone"],O=["latitude","longitude"];function W(n){let i=n.match(/^(.+?)(Latitude|Longitude)$/);return i?{group:i[1],leaf:i[2].toLowerCase()}:null}var ee=F.map(n=>n.toLowerCase());function v(n,i){if(n){if("$ref"in n&&n.$ref){let e=n.$ref.split("/").pop();return e?i[e]:void 0}return n}}function I(n){let i=n.anyOf??n.oneOf;return!i||i.length===0?n:i.find(e=>Array.isArray(e.enum))??i.find(e=>w(e)&&w(e)!=="null")??i[0]??n}function w(n){if(typeof n.type=="string")return n.type;if(!Array.isArray(n.type))return;let i=n.type.filter(e=>e!=="null");return i.length===1?i[0]:void 0}function re(n){let i=I(n),e=w(i);return Array.isArray(i.enum)?i.enum.length<=X?"tiles":"select":e==="boolean"?"toggle":i.format==="date"?"date":i.format==="time"?"time":i.format==="date-time"?"datetime":e==="integer"||e==="number"?"number":e==="string"?"text":e==="array"?"array":null}function M(n){if(n.length!==12)return!1;let i=new Set(n.map(e=>e.toLowerCase()));return ee.every(e=>i.has(e))}function b(n,i,e){let r=I(i);return{key:e.key,name:n,group:e.group,inQuery:e.inQuery,kind:re(i)??"text",required:e.required,description:r.description??i.description,enum:r.enum,min:r.minimum,max:r.maximum,default:i.default??r.default,example:i.example??r.example}}function D(n,i,e){let r=[],t=!1,o=n.requestBody?.content?.["application/json"]?.schema,s=v(o,i);if(s?.properties){let a=new Set(s.required??[]);for(let[d,l]of Object.entries(s.properties)){let y=v(l,i)??{};if(y.type==="object"&&y.properties){let g=new Set(y.required??[]);for(let[$,j]of Object.entries(y.properties)){let H=v(j,i)??{};r.push(b($,H,{key:`${d}.${$}`,group:d,required:a.has(d)&&g.has($)}))}}else{let g=W(d);r.push(g?b(g.leaf,y,{key:d,group:g.group,required:a.has(d)}):b(d,y,{key:d,required:a.has(d)}))}}}for(let a of n.parameters??[]){if(a.in!=="path"&&a.in!=="query")continue;if(a.name==="lang"&&a.in==="query"){t=!0;continue}let d=v(a.schema,i)??{};r.push(b(a.name,d,{key:a.name,required:!!a.required,inQuery:a.in==="query"}))}return{title:te(n.summary,e),fields:r,hasLang:t}}function te(n,i){let e=n?.split(" - ")[0]?.trim();return e||p(i.split("/").pop()??"")}function P(n){let i=n.toLowerCase();return/compat|synastry|guna|connection|penta|composite/.test(i)?"Compare":/\bcast\b|\/draw|iching|hexagram|tarot/.test(i)?"Cast":/horoscope|dream|angel|nakshatra|crystal|meaning|reference/.test(i)?"Get reading":"Generate"}function G(n,i){let e=i.replace(/^\//,"").replace(/[{}]/g,"").replace(/\//g,"-");return`${n.toLowerCase()}--${e}.json`}var _="0.27.0";var N="https://roxyapi.com/api/v2/openapi.json",se=`https://cdn.jsdelivr.net/npm/@roxyapi/ui@${_}/dist/schemas`,k=new Map;function Ie(){k.clear()}async function ae(n){let i=k.get(n);return i||(i=fetch(n).then(async e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}).catch(e=>{throw k.delete(n),e}),k.set(n,i)),i}function le(){return globalThis.crypto?.randomUUID?.()??Math.random().toString(36).slice(2)}function de(n){let i=n.trim();if(!i)return[];try{let e=JSON.parse(i);if(Array.isArray(e))return e}catch{}return i.split(",").map(e=>e.trim()).filter(Boolean)}var c=class extends ne{constructor(){super(...arguments);this.endpoint="vedic-astrology/birth-chart";this.method="POST";this.specUrl="";this.submitLabel="";this.fields=[];this.formTitle="";this.hasLang=!1;this.values={};this.loaded=!1;this.specError=null;this.validationErrors=[];this.retryLoadSchema=()=>{this.loaded=!1,this.specError=null,this.loadSchema()};this.onSubmit=e=>{e.preventDefault(),this.submit()}}connectedCallback(){super.connectedCallback(),this.loadSchema()}async loadSchema(){this.specError=null;try{this.applyModel(await this.resolveModel())}catch(e){let r=e instanceof Error?e.message:String(e);this.specError=r,this.loaded=!0,this.dispatchEvent(new CustomEvent("roxy-spec-error",{detail:{url:this.specUrl||N,message:r},bubbles:!0,composed:!0}))}}async resolveModel(){return this.specUrl?this.modelFromSpec(this.specUrl):await this.tryLoadSlice()??this.modelFromSpec(N)}async modelFromSpec(e){let r=await ae(e),t=`/${this.endpoint.replace(/^\//,"")}`,o=r.paths?.[t]?.[this.method.toLowerCase()];if(!o)throw new Error(`Endpoint ${this.method} ${t} not found in OpenAPI spec`);return D(o,r.components?.schemas??{},this.endpoint)}async tryLoadSlice(){try{let e=await fetch(`${se}/${G(this.method,this.endpoint)}`);return e.ok?await e.json():null}catch{return null}}applyModel(e){this.fields=e.fields,this.formTitle=e.title,this.hasLang=e.hasLang;let r={};for(let t of e.fields){t.default!==void 0&&(r[t.key]=t.default);let o=t.group?this.initialValues?.[t.group]?.[t.name]:this.initialValues?.[t.name];o!==void 0&&(r[t.key]=o)}this.values=r,this.loaded=!0}setValue(e,r){this.values={...this.values,[e]:r}}roleOf(e){return e.name==="seed"?"seed":(e.name==="limit"||e.name==="offset")&&!e.required?"hidden-default":A.includes(e.name)&&this.groupHasLocation(e.group)||e.name==="timezone"&&this.locationGroups().some(r=>this.timezoneFieldFor(r)?.key===e.key)?"location":"normal"}isRendered(e){return this.roleOf(e)==="normal"}groupKeys(){let e=[];for(let r of this.fields)e.includes(r.group)||e.push(r.group);return e}groupHasLocation(e){let r=this.fields.filter(t=>t.group===e);return O.every(t=>r.some(o=>o.name===t))}locationGroups(){return this.groupKeys().filter(e=>this.groupHasLocation(e))}timezoneFieldFor(e){let r=this.fields.find(t=>t.group===e&&t.name==="timezone");if(r)return r;if(this.locationGroups()[0]===e)return this.fields.find(t=>t.group===void 0&&t.name==="timezone")}locationRequired(e){let r=this.fields.filter(t=>t.group===e);return A.some(t=>r.some(o=>o.name===t&&o.required))}groupIsRequired(e){return this.groupHasLocation(e)||this.fields.some(r=>r.group===e&&r.required)}get singleEnumField(){if(this.groupKeys().some(t=>this.groupHasLocation(t))||this.groupKeys().some(t=>t!==void 0))return null;let e=this.fields.filter(t=>t.required&&this.isRendered(t)),r=e[0];return e.length!==1||!r?null:r.kind==="tiles"||r.kind==="select"?r:null}effectiveSubmitLabel(){return this.submitLabel||P(this.endpoint)}effectiveLang(){return R(this)}onLocationFor(e){return r=>{let t=r.detail;if(!t)return;let o=y=>this.fields.find(g=>g.group===e&&g.name===y)?.key,s={...this.values},a=o("latitude"),d=o("longitude");a&&(s[a]=t.latitude),d&&(s[d]=t.longitude);let l=this.timezoneFieldFor(e);l&&(s[l.key]=t.timezone??t.utcOffset),this.values=s}}selectTile(e,r){this.setValue(e.key,r),this.singleEnumField?.key===e.key&&this.submit()}onTilesKeyDown(e){return r=>{let t=e.enum??[];if(t.length===0)return;let o=t.indexOf(this.values[e.key]),s;if(r.key==="Home")s=0;else if(r.key==="End")s=t.length-1;else if(r.key==="ArrowRight"||r.key==="ArrowDown")s=o===-1?0:(o+1)%t.length;else if(r.key==="ArrowLeft"||r.key==="ArrowUp")s=o===-1?t.length-1:(o-1+t.length)%t.length;else return;r.preventDefault();let a=t[s];if(a===void 0)return;this.selectTile(e,a);let d=r.currentTarget;requestAnimationFrame(()=>d.querySelector(`[data-tile='${s}']`)?.focus())}}submit(){let e=this.collectMissing();if(e.keys.length>0){this.validationErrors=e.labels,this.dispatchEvent(new CustomEvent("roxy-validation-error",{detail:{missing:e.keys},bubbles:!0,composed:!0}));return}this.validationErrors=[];let r={};for(let s of this.fields){let a=this.values[s.key];if(s.name==="seed"&&(a===void 0||a==="")&&(a=le()),!(a===void 0||a===""))if(s.kind==="array"&&typeof a=="string"&&(a=de(a)),s.group){let d=r[s.group]??{};d[s.name]=a,r[s.group]=d}else r[s.name]=a}let t=this.fields.filter(s=>s.inQuery).map(s=>s.name),o=this.effectiveLang();this.hasLang&&o&&(r.lang=o,t.push("lang")),this.dispatchEvent(new CustomEvent("roxy-submit",{detail:{endpoint:this.endpoint,values:r,queryKeys:t,sticky:this.singleEnumField!=null},bubbles:!0,composed:!0}))}collectMissing(){let e=[],r=[],t=new Set;for(let o of this.fields){if(!o.required)continue;let s=this.roleOf(o)==="location";if(!this.isRendered(o)&&!s)continue;let a=this.values[o.key];if(!(a!==void 0&&a!=="")){if(e.push(o.key),s){t.add(o.group);continue}r.push(o.group?`${p(o.group)} ${p(o.name)}`:p(o.name))}}for(let o of t)r.push(o?`${p(o)} location`:"Birth location");return{keys:e,labels:r}}reqMark(e){return e.required?u`<span class="req" aria-hidden="true">*</span>`:f}description(e){if(!e.description)return f;if(e.description.length<=120)return u`<small class="help">${e.description}</small>`;let r=e.description.split(". ")[0]??e.description;return u`<details class="help-details"><summary><span class="help-lead">${r}</span>${S()}</summary><small class="help help-full">${e.description}</small></details>`}renderTiles(e){let r=`roxy-form-${e.key}-label`,t=!!e.enum&&M(e.enum),o=e.enum??[],s=o.indexOf(this.values[e.key]),a=s===-1?0:s;return u`<div class="field tiles-field"><span class="label" id="${r}">${p(e.name)}${this.reqMark(e)}</span><div class="tiles" role="radiogroup" aria-labelledby="${r}" @keydown="${this.onTilesKeyDown(e)}">${o.map((d,l)=>{let y=this.values[e.key]===d,g=t?T(d):void 0;return u`<button type="button" class="tile" role="radio" data-tile="${l}" aria-checked="${y?"true":"false"}" tabindex="${l===a?"0":"-1"}" @click="${()=>this.selectTile(e,d)}">${g?u`<span class="tile-glyph" aria-hidden="true">${g}</span>`:f} <span class="tile-label">${p(d)}</span></button>`})}</div>${this.description(e)}</div>`}renderSelect(e){let r=`roxy-form-${e.key}`;return u`<div class="field"><label for="${r}">${p(e.name)}${this.reqMark(e)}</label> <select id="${r}" ?required="${e.required}" @change="${t=>this.setValue(e.key,t.target.value)}"><option value="">Choose</option>${(e.enum??[]).map(t=>u`<option value="${t}" ?selected="${this.values[e.key]===t}">${p(t)}</option>`)}</select> ${this.description(e)}</div>`}renderToggle(e){let r=`roxy-form-${e.key}`,t=this.values[e.key]===!0;return u`<div class="field"><div class="toggle-row"><button type="button" id="${r}" class="toggle" role="switch" aria-checked="${t?"true":"false"}" @click="${()=>this.setValue(e.key,!t)}"><span class="knob"></span></button> <label class="toggle-label" for="${r}">${p(e.name)}${this.reqMark(e)}</label></div>${this.description(e)}</div>`}renderInput(e){let r=`roxy-form-${e.key}`,t=e.kind==="datetime"?"datetime-local":e.kind==="number"?"number":e.kind,o=e.kind==="array"?"Comma separated":e.example!=null?String(e.example):"";return u`<div class="field"><label for="${r}">${p(e.name)}${this.reqMark(e)}</label> <input id="${r}" type="${e.kind==="array"?"text":t}" ?required="${e.required}" min="${L(e.min)}" max="${L(e.max)}" step="${e.kind==="number"?"any":f}" placeholder="${o||f}" .value="${this.values[e.key]??""}" @input="${s=>this.setValue(e.key,this.coerce(e.kind,s.target.value))}"> ${this.description(e)}</div>`}renderField(e){switch(e.kind){case"tiles":return this.renderTiles(e);case"select":return this.renderSelect(e);case"toggle":return this.renderToggle(e);default:return this.renderInput(e)}}locationFillList(e){let r=[...O];return this.timezoneFieldFor(e)&&r.push("timezone"),r.join(", ")}locationBlock(e){return u`<div class="location-block"><label>${e?`${p(e)} location`:"Birth location"}${this.locationRequired(e)?u`<span class="req" aria-hidden="true">*</span>`:f}</label><roxy-location-search publishable-key="${L(this.publishableKey)}" @roxy-location-select="${this.onLocationFor(e)}" placeholder="${e?`${p(e)} city`:"City of birth"}"></roxy-location-search><small class="help">Fills ${this.locationFillList(e)}. Pick a city to autofill.</small></div>`}groupCard(e){let r=this.fields.filter(t=>t.group===e&&this.isRendered(t));return u`<fieldset class="person-group"><legend>${p(e)}</legend>${this.groupHasLocation(e)?this.locationBlock(e):f}<div class="fields">${r.map(t=>this.renderField(t))}</div></fieldset>`}render(){if(!this.loaded)return u`<form><div class="roxy-skeleton" style="height:8rem"></div></form>`;if(this.specError)return u`<div class="spec-error" role="alert">Schema load failed: ${this.specError} <button type="button" class="submit" @click="${this.retryLoadSchema}">Retry</button></div>`;let e=this.fields.filter(l=>!l.group&&this.isRendered(l)),r=e.filter(l=>l.required),t=e.filter(l=>!l.required),o=this.groupKeys().filter(l=>l!==void 0),s=o.filter(l=>this.groupIsRequired(l)),a=o.filter(l=>!this.groupIsRequired(l)),d=t.length>0||a.length>0;return u`<form @submit="${this.onSubmit}"><h2 class="title">${this.formTitle}</h2>${this.validationErrors.length>0?u`<div class="validation-error" role="alert"><strong>Please complete:</strong> ${this.validationErrors.join(", ")}</div>`:f}<div class="fields">${r.map(l=>this.renderField(l))}</div>${this.groupHasLocation(void 0)?this.locationBlock(void 0):f} ${s.map(l=>this.groupCard(l))} ${d?u`<details class="advanced"><summary>Advanced${S()}</summary><div class="fields">${t.map(l=>this.renderField(l))}</div>${a.map(l=>this.groupCard(l))}</details>`:f} ${this.singleEnumField?f:u`<button class="submit" type="submit">${this.effectiveSubmitLabel()}</button>`}</form>`}coerce(e,r){if(r!==""){if(e==="number"){let t=Number(r);return Number.isFinite(t)?t:void 0}return r}}};c.styles=[C,z,ie`form{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.fields{align-items:start;gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));display:grid}.fields:empty{display:none}.person-group{background:var(--roxy-surface,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);min-inline-size:0;margin:0;display:grid}.person-group legend{padding:0 var(--roxy-space-xs,.25rem);font-weight:var(--roxy-weight-bold,600)}.field{gap:var(--roxy-space-xs,.25rem);flex-direction:column;min-width:0;display:flex}.tiles-field{grid-column:1/-1}label,.label{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569)}.req{color:var(--roxy-danger-fg,#991b1b);margin-left:4px}input,select{box-sizing:border-box;width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);font-family:inherit}input:focus,select:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.help{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}.help-details>summary{cursor:pointer;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);align-items:center;gap:4px;display:flex}.help-details .help-lead{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.help-details .help-full{margin-top:var(--roxy-space-xs,.25rem);display:block}.location-block{gap:var(--roxy-space-xs,.25rem);grid-column:1/-1;display:grid}.tiles{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(5.5rem,1fr));display:grid}.tile{min-height:44px;padding:var(--roxy-space-sm,.5rem);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease), background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-direction:column;justify-content:center;align-items:center;gap:2px;display:flex}.tile:hover{border-color:var(--roxy-accent,#f59e0b)}.tile[aria-checked=true]{border-color:var(--roxy-accent,#f59e0b);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 12%, transparent);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.tile:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.tile-glyph{font-size:1.35em;line-height:1}.toggle-row{align-items:center;gap:var(--roxy-space-sm,.5rem);display:flex}.toggle{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);background:var(--roxy-border,#e4e4e7);cursor:pointer;width:44px;height:26px;transition:background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0;padding:0;position:relative}.toggle[aria-checked=true]{background:var(--roxy-accent,#f59e0b);border-color:var(--roxy-accent,#f59e0b)}.toggle .knob{background:var(--roxy-bg,#fff);width:20px;height:20px;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);border-radius:50%;position:absolute;top:2px;left:2px}.toggle[aria-checked=true] .knob{transform:translate(18px)}.toggle:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.toggle-label{cursor:pointer}@media (prefers-reduced-motion:reduce){.tile,.toggle,.toggle .knob{transition:none}}.advanced{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.advanced>summary{cursor:pointer;font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-fg,#0a0a0a);align-items:center;gap:6px;display:flex}.advanced[open]>summary{margin-bottom:var(--roxy-space-md,1rem)}.advanced .fields,.advanced .person-group{margin-top:var(--roxy-space-md,1rem)}.validation-error{gap:var(--roxy-space-xs,.25rem);padding:var(--roxy-space-md,1rem);background:color-mix(in srgb, var(--roxy-danger,#dc2626) 8%, transparent);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);display:grid}button.submit{background:var(--roxy-accent-ink,#b45309);color:var(--roxy-bg,#fff);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-lg,1.5rem);font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600);cursor:pointer;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));border:0;justify-self:start}button.submit:hover{transform:scale(1.02)}button.submit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}@media (prefers-reduced-motion:reduce){button.submit{transition:none}}.spec-error{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}`],m([x({type:String,attribute:"data-endpoint"})],c.prototype,"endpoint",2),m([x({type:String})],c.prototype,"method",2),m([x({type:String,attribute:"spec-url"})],c.prototype,"specUrl",2),m([x({type:String,attribute:"submit-label"})],c.prototype,"submitLabel",2),m([x({type:String,attribute:"publishable-key"})],c.prototype,"publishableKey",2),m([x({attribute:!1})],c.prototype,"initialValues",2),m([h()],c.prototype,"fields",2),m([h()],c.prototype,"formTitle",2),m([h()],c.prototype,"hasLang",2),m([h()],c.prototype,"values",2),m([h()],c.prototype,"loaded",2),m([h()],c.prototype,"specError",2),m([h()],c.prototype,"validationErrors",2),c=m([oe("roxy-endpoint-form")],c);export{c as RoxyEndpointForm,Ie as resetSpecCache};
1
+ var B=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var m=(n,i,e,r)=>{for(var t=r>1?void 0:r?K(i,e):i,o=n.length-1,s;o>=0;o--)(s=n[o])&&(t=(r?s(i,e,t):s(t))||t);return r&&t&&B(i,e,t),t};import{css as ie,html as u,LitElement as ne,nothing as f}from"lit";import{customElement as oe,property as x,state as h}from"lit/decorators.js";import{ifDefined as L}from"lit/directives/if-defined.js";var q=["de","en","es","fr","hi","pt","ru","tr"];function U(n){if(n.lang)return n.lang;if(typeof document>"u")return;let i=n.closest?.("[lang]")?.getAttribute("lang");return i||document.documentElement.lang||void 0}function R(n){let i=U(n);if(!i)return;let e=i.toLowerCase().split("-")[0];return q.includes(e)?e:void 0}function E(n){return n.toLowerCase().replace(/[\s_-]+/g," ").trim()}function p(n){return n.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([a-z])([0-9])/g,"$1 $2").replace(/^\w/,i=>i.toUpperCase())}var V=(n,i)=>i?n[E(i)]:void 0;var Y={aries:"\u2648",taurus:"\u2649",gemini:"\u264A",cancer:"\u264B",leo:"\u264C",virgo:"\u264D",libra:"\u264E",scorpio:"\u264F",sagittarius:"\u2650",capricorn:"\u2651",aquarius:"\u2652",pisces:"\u2653"},T=n=>V(Y,n);var F=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"];import{css as Q}from"lit";var C=Q`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;import{css as Z,html as J}from"lit";function S(){return J`<svg class="roxy-chevron" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`}var z=Z`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;var X=12,A=["latitude","longitude","timezone"],O=["latitude","longitude"];function W(n){let i=n.match(/^(.+?)(Latitude|Longitude)$/);return i?{group:i[1],leaf:i[2].toLowerCase()}:null}var ee=F.map(n=>n.toLowerCase());function v(n,i){if(n){if("$ref"in n&&n.$ref){let e=n.$ref.split("/").pop();return e?i[e]:void 0}return n}}function I(n){let i=n.anyOf??n.oneOf;return!i||i.length===0?n:i.find(e=>Array.isArray(e.enum))??i.find(e=>w(e)&&w(e)!=="null")??i[0]??n}function w(n){if(typeof n.type=="string")return n.type;if(!Array.isArray(n.type))return;let i=n.type.filter(e=>e!=="null");return i.length===1?i[0]:void 0}function re(n){let i=I(n),e=w(i);return Array.isArray(i.enum)?i.enum.length<=X?"tiles":"select":e==="boolean"?"toggle":i.format==="date"?"date":i.format==="time"?"time":i.format==="date-time"?"datetime":e==="integer"||e==="number"?"number":e==="string"?"text":e==="array"?"array":null}function M(n){if(n.length!==12)return!1;let i=new Set(n.map(e=>e.toLowerCase()));return ee.every(e=>i.has(e))}function b(n,i,e){let r=I(i);return{key:e.key,name:n,group:e.group,inQuery:e.inQuery,kind:re(i)??"text",required:e.required,description:r.description??i.description,enum:r.enum,min:r.minimum,max:r.maximum,default:i.default??r.default,example:i.example??r.example}}function D(n,i,e){let r=[],t=!1,o=n.requestBody?.content?.["application/json"]?.schema,s=v(o,i);if(s?.properties){let a=new Set(s.required??[]);for(let[d,l]of Object.entries(s.properties)){let y=v(l,i)??{};if(y.type==="object"&&y.properties){let g=new Set(y.required??[]);for(let[$,j]of Object.entries(y.properties)){let H=v(j,i)??{};r.push(b($,H,{key:`${d}.${$}`,group:d,required:a.has(d)&&g.has($)}))}}else{let g=W(d);r.push(g?b(g.leaf,y,{key:d,group:g.group,required:a.has(d)}):b(d,y,{key:d,required:a.has(d)}))}}}for(let a of n.parameters??[]){if(a.in!=="path"&&a.in!=="query")continue;if(a.name==="lang"&&a.in==="query"){t=!0;continue}let d=v(a.schema,i)??{};r.push(b(a.name,d,{key:a.name,required:!!a.required,inQuery:a.in==="query"}))}return{title:te(n.summary,e),fields:r,hasLang:t}}function te(n,i){let e=n?.split(" - ")[0]?.trim();return e||p(i.split("/").pop()??"")}function P(n){let i=n.toLowerCase();return/compat|synastry|guna|connection|penta|composite/.test(i)?"Compare":/\bcast\b|\/draw|iching|hexagram|tarot/.test(i)?"Cast":/horoscope|dream|angel|nakshatra|crystal|meaning|reference/.test(i)?"Get reading":"Generate"}function G(n,i){let e=i.replace(/^\//,"").replace(/[{}]/g,"").replace(/\//g,"-");return`${n.toLowerCase()}--${e}.json`}var _="0.27.1";var N="https://roxyapi.com/api/v2/openapi.json",se=`https://cdn.jsdelivr.net/npm/@roxyapi/ui@${_}/dist/schemas`,k=new Map;function Ie(){k.clear()}async function ae(n){let i=k.get(n);return i||(i=fetch(n).then(async e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}).catch(e=>{throw k.delete(n),e}),k.set(n,i)),i}function le(){return globalThis.crypto?.randomUUID?.()??Math.random().toString(36).slice(2)}function de(n){let i=n.trim();if(!i)return[];try{let e=JSON.parse(i);if(Array.isArray(e))return e}catch{}return i.split(",").map(e=>e.trim()).filter(Boolean)}var c=class extends ne{constructor(){super(...arguments);this.endpoint="vedic-astrology/birth-chart";this.method="POST";this.specUrl="";this.submitLabel="";this.fields=[];this.formTitle="";this.hasLang=!1;this.values={};this.loaded=!1;this.specError=null;this.validationErrors=[];this.retryLoadSchema=()=>{this.loaded=!1,this.specError=null,this.loadSchema()};this.onSubmit=e=>{e.preventDefault(),this.submit()}}connectedCallback(){super.connectedCallback(),this.loadSchema()}async loadSchema(){this.specError=null;try{this.applyModel(await this.resolveModel())}catch(e){let r=e instanceof Error?e.message:String(e);this.specError=r,this.loaded=!0,this.dispatchEvent(new CustomEvent("roxy-spec-error",{detail:{url:this.specUrl||N,message:r},bubbles:!0,composed:!0}))}}async resolveModel(){return this.specUrl?this.modelFromSpec(this.specUrl):await this.tryLoadSlice()??this.modelFromSpec(N)}async modelFromSpec(e){let r=await ae(e),t=`/${this.endpoint.replace(/^\//,"")}`,o=r.paths?.[t]?.[this.method.toLowerCase()];if(!o)throw new Error(`Endpoint ${this.method} ${t} not found in OpenAPI spec`);return D(o,r.components?.schemas??{},this.endpoint)}async tryLoadSlice(){try{let e=await fetch(`${se}/${G(this.method,this.endpoint)}`);return e.ok?await e.json():null}catch{return null}}applyModel(e){this.fields=e.fields,this.formTitle=e.title,this.hasLang=e.hasLang;let r={};for(let t of e.fields){t.default!==void 0&&(r[t.key]=t.default);let o=t.group?this.initialValues?.[t.group]?.[t.name]:this.initialValues?.[t.name];o!==void 0&&(r[t.key]=o)}this.values=r,this.loaded=!0}setValue(e,r){this.values={...this.values,[e]:r}}roleOf(e){return e.name==="seed"?"seed":(e.name==="limit"||e.name==="offset")&&!e.required?"hidden-default":A.includes(e.name)&&this.groupHasLocation(e.group)||e.name==="timezone"&&this.locationGroups().some(r=>this.timezoneFieldFor(r)?.key===e.key)?"location":"normal"}isRendered(e){return this.roleOf(e)==="normal"}groupKeys(){let e=[];for(let r of this.fields)e.includes(r.group)||e.push(r.group);return e}groupHasLocation(e){let r=this.fields.filter(t=>t.group===e);return O.every(t=>r.some(o=>o.name===t))}locationGroups(){return this.groupKeys().filter(e=>this.groupHasLocation(e))}timezoneFieldFor(e){let r=this.fields.find(t=>t.group===e&&t.name==="timezone");if(r)return r;if(this.locationGroups()[0]===e)return this.fields.find(t=>t.group===void 0&&t.name==="timezone")}locationRequired(e){let r=this.fields.filter(t=>t.group===e);return A.some(t=>r.some(o=>o.name===t&&o.required))}groupIsRequired(e){return this.groupHasLocation(e)||this.fields.some(r=>r.group===e&&r.required)}get singleEnumField(){if(this.groupKeys().some(t=>this.groupHasLocation(t))||this.groupKeys().some(t=>t!==void 0))return null;let e=this.fields.filter(t=>t.required&&this.isRendered(t)),r=e[0];return e.length!==1||!r?null:r.kind==="tiles"||r.kind==="select"?r:null}effectiveSubmitLabel(){return this.submitLabel||P(this.endpoint)}effectiveLang(){return R(this)}onLocationFor(e){return r=>{let t=r.detail;if(!t)return;let o=y=>this.fields.find(g=>g.group===e&&g.name===y)?.key,s={...this.values},a=o("latitude"),d=o("longitude");a&&(s[a]=t.latitude),d&&(s[d]=t.longitude);let l=this.timezoneFieldFor(e);l&&(s[l.key]=t.timezone??t.utcOffset),this.values=s}}selectTile(e,r){this.setValue(e.key,r),this.singleEnumField?.key===e.key&&this.submit()}onTilesKeyDown(e){return r=>{let t=e.enum??[];if(t.length===0)return;let o=t.indexOf(this.values[e.key]),s;if(r.key==="Home")s=0;else if(r.key==="End")s=t.length-1;else if(r.key==="ArrowRight"||r.key==="ArrowDown")s=o===-1?0:(o+1)%t.length;else if(r.key==="ArrowLeft"||r.key==="ArrowUp")s=o===-1?t.length-1:(o-1+t.length)%t.length;else return;r.preventDefault();let a=t[s];if(a===void 0)return;this.selectTile(e,a);let d=r.currentTarget;requestAnimationFrame(()=>d.querySelector(`[data-tile='${s}']`)?.focus())}}submit(){let e=this.collectMissing();if(e.keys.length>0){this.validationErrors=e.labels,this.dispatchEvent(new CustomEvent("roxy-validation-error",{detail:{missing:e.keys},bubbles:!0,composed:!0}));return}this.validationErrors=[];let r={};for(let s of this.fields){let a=this.values[s.key];if(s.name==="seed"&&(a===void 0||a==="")&&(a=le()),!(a===void 0||a===""))if(s.kind==="array"&&typeof a=="string"&&(a=de(a)),s.group){let d=r[s.group]??{};d[s.name]=a,r[s.group]=d}else r[s.name]=a}let t=this.fields.filter(s=>s.inQuery).map(s=>s.name),o=this.effectiveLang();this.hasLang&&o&&(r.lang=o,t.push("lang")),this.dispatchEvent(new CustomEvent("roxy-submit",{detail:{endpoint:this.endpoint,values:r,queryKeys:t,sticky:this.singleEnumField!=null},bubbles:!0,composed:!0}))}collectMissing(){let e=[],r=[],t=new Set;for(let o of this.fields){if(!o.required)continue;let s=this.roleOf(o)==="location";if(!this.isRendered(o)&&!s)continue;let a=this.values[o.key];if(!(a!==void 0&&a!=="")){if(e.push(o.key),s){t.add(o.group);continue}r.push(o.group?`${p(o.group)} ${p(o.name)}`:p(o.name))}}for(let o of t)r.push(o?`${p(o)} location`:"Birth location");return{keys:e,labels:r}}reqMark(e){return e.required?u`<span class="req" aria-hidden="true">*</span>`:f}description(e){if(!e.description)return f;if(e.description.length<=120)return u`<small class="help">${e.description}</small>`;let r=e.description.split(". ")[0]??e.description;return u`<details class="help-details"><summary><span class="help-lead">${r}</span>${S()}</summary><small class="help help-full">${e.description}</small></details>`}renderTiles(e){let r=`roxy-form-${e.key}-label`,t=!!e.enum&&M(e.enum),o=e.enum??[],s=o.indexOf(this.values[e.key]),a=s===-1?0:s;return u`<div class="field tiles-field"><span class="label" id="${r}">${p(e.name)}${this.reqMark(e)}</span><div class="tiles" role="radiogroup" aria-labelledby="${r}" @keydown="${this.onTilesKeyDown(e)}">${o.map((d,l)=>{let y=this.values[e.key]===d,g=t?T(d):void 0;return u`<button type="button" class="tile" role="radio" data-tile="${l}" aria-checked="${y?"true":"false"}" tabindex="${l===a?"0":"-1"}" @click="${()=>this.selectTile(e,d)}">${g?u`<span class="tile-glyph" aria-hidden="true">${g}</span>`:f} <span class="tile-label">${p(d)}</span></button>`})}</div>${this.description(e)}</div>`}renderSelect(e){let r=`roxy-form-${e.key}`;return u`<div class="field"><label for="${r}">${p(e.name)}${this.reqMark(e)}</label> <select id="${r}" ?required="${e.required}" @change="${t=>this.setValue(e.key,t.target.value)}"><option value="">Choose</option>${(e.enum??[]).map(t=>u`<option value="${t}" ?selected="${this.values[e.key]===t}">${p(t)}</option>`)}</select> ${this.description(e)}</div>`}renderToggle(e){let r=`roxy-form-${e.key}`,t=this.values[e.key]===!0;return u`<div class="field"><div class="toggle-row"><button type="button" id="${r}" class="toggle" role="switch" aria-checked="${t?"true":"false"}" @click="${()=>this.setValue(e.key,!t)}"><span class="knob"></span></button> <label class="toggle-label" for="${r}">${p(e.name)}${this.reqMark(e)}</label></div>${this.description(e)}</div>`}renderInput(e){let r=`roxy-form-${e.key}`,t=e.kind==="datetime"?"datetime-local":e.kind==="number"?"number":e.kind,o=e.kind==="array"?"Comma separated":e.example!=null?String(e.example):"";return u`<div class="field"><label for="${r}">${p(e.name)}${this.reqMark(e)}</label> <input id="${r}" type="${e.kind==="array"?"text":t}" ?required="${e.required}" min="${L(e.min)}" max="${L(e.max)}" step="${e.kind==="number"?"any":f}" placeholder="${o||f}" .value="${this.values[e.key]??""}" @input="${s=>this.setValue(e.key,this.coerce(e.kind,s.target.value))}"> ${this.description(e)}</div>`}renderField(e){switch(e.kind){case"tiles":return this.renderTiles(e);case"select":return this.renderSelect(e);case"toggle":return this.renderToggle(e);default:return this.renderInput(e)}}locationFillList(e){let r=[...O];return this.timezoneFieldFor(e)&&r.push("timezone"),r.join(", ")}locationBlock(e){return u`<div class="location-block"><label>${e?`${p(e)} location`:"Birth location"}${this.locationRequired(e)?u`<span class="req" aria-hidden="true">*</span>`:f}</label><roxy-location-search publishable-key="${L(this.publishableKey)}" @roxy-location-select="${this.onLocationFor(e)}" placeholder="${e?`${p(e)} city`:"City of birth"}"></roxy-location-search><small class="help">Fills ${this.locationFillList(e)}. Pick a city to autofill.</small></div>`}groupCard(e){let r=this.fields.filter(t=>t.group===e&&this.isRendered(t));return u`<fieldset class="person-group"><legend>${p(e)}</legend>${this.groupHasLocation(e)?this.locationBlock(e):f}<div class="fields">${r.map(t=>this.renderField(t))}</div></fieldset>`}render(){if(!this.loaded)return u`<form><div class="roxy-skeleton" style="height:8rem"></div></form>`;if(this.specError)return u`<div class="spec-error" role="alert">Schema load failed: ${this.specError} <button type="button" class="submit" @click="${this.retryLoadSchema}">Retry</button></div>`;let e=this.fields.filter(l=>!l.group&&this.isRendered(l)),r=e.filter(l=>l.required),t=e.filter(l=>!l.required),o=this.groupKeys().filter(l=>l!==void 0),s=o.filter(l=>this.groupIsRequired(l)),a=o.filter(l=>!this.groupIsRequired(l)),d=t.length>0||a.length>0;return u`<form @submit="${this.onSubmit}"><h2 class="title">${this.formTitle}</h2>${this.validationErrors.length>0?u`<div class="validation-error" role="alert"><strong>Please complete:</strong> ${this.validationErrors.join(", ")}</div>`:f}<div class="fields">${r.map(l=>this.renderField(l))}</div>${this.groupHasLocation(void 0)?this.locationBlock(void 0):f} ${s.map(l=>this.groupCard(l))} ${d?u`<details class="advanced"><summary>Advanced${S()}</summary><div class="fields">${t.map(l=>this.renderField(l))}</div>${a.map(l=>this.groupCard(l))}</details>`:f} ${this.singleEnumField?f:u`<button class="submit" type="submit">${this.effectiveSubmitLabel()}</button>`}</form>`}coerce(e,r){if(r!==""){if(e==="number"){let t=Number(r);return Number.isFinite(t)?t:void 0}return r}}};c.styles=[C,z,ie`form{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.fields{align-items:start;gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));display:grid}.fields:empty{display:none}.person-group{background:var(--roxy-surface,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);min-inline-size:0;margin:0;display:grid}.person-group legend{padding:0 var(--roxy-space-xs,.25rem);font-weight:var(--roxy-weight-bold,600)}.field{gap:var(--roxy-space-xs,.25rem);flex-direction:column;min-width:0;display:flex}.tiles-field{grid-column:1/-1}label,.label{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569)}.req{color:var(--roxy-danger-fg,#991b1b);margin-left:4px}input,select{box-sizing:border-box;width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);font-family:inherit}input:focus,select:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.help{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}.help-details>summary{cursor:pointer;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);align-items:center;gap:4px;display:flex}.help-details .help-lead{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.help-details .help-full{margin-top:var(--roxy-space-xs,.25rem);display:block}.location-block{gap:var(--roxy-space-xs,.25rem);grid-column:1/-1;display:grid}.tiles{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(5.5rem,1fr));display:grid}.tile{min-height:44px;padding:var(--roxy-space-sm,.5rem);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease), background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-direction:column;justify-content:center;align-items:center;gap:2px;display:flex}.tile:hover{border-color:var(--roxy-accent,#f59e0b)}.tile[aria-checked=true]{border-color:var(--roxy-accent,#f59e0b);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 12%, transparent);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.tile:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.tile-glyph{font-size:1.35em;line-height:1}.toggle-row{align-items:center;gap:var(--roxy-space-sm,.5rem);display:flex}.toggle{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);background:var(--roxy-border,#e4e4e7);cursor:pointer;width:44px;height:26px;transition:background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0;padding:0;position:relative}.toggle[aria-checked=true]{background:var(--roxy-accent,#f59e0b);border-color:var(--roxy-accent,#f59e0b)}.toggle .knob{background:var(--roxy-bg,#fff);width:20px;height:20px;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);border-radius:50%;position:absolute;top:2px;left:2px}.toggle[aria-checked=true] .knob{transform:translate(18px)}.toggle:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.toggle-label{cursor:pointer}@media (prefers-reduced-motion:reduce){.tile,.toggle,.toggle .knob{transition:none}}.advanced{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.advanced>summary{cursor:pointer;font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-fg,#0a0a0a);align-items:center;gap:6px;display:flex}.advanced[open]>summary{margin-bottom:var(--roxy-space-md,1rem)}.advanced .fields,.advanced .person-group{margin-top:var(--roxy-space-md,1rem)}.validation-error{gap:var(--roxy-space-xs,.25rem);padding:var(--roxy-space-md,1rem);background:color-mix(in srgb, var(--roxy-danger,#dc2626) 8%, transparent);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);display:grid}button.submit{background:var(--roxy-accent-ink,#b45309);color:var(--roxy-bg,#fff);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-lg,1.5rem);font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600);cursor:pointer;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));border:0;justify-self:start}button.submit:hover{transform:scale(1.02)}button.submit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}@media (prefers-reduced-motion:reduce){button.submit{transition:none}}.spec-error{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}`],m([x({type:String,attribute:"data-endpoint"})],c.prototype,"endpoint",2),m([x({type:String})],c.prototype,"method",2),m([x({type:String,attribute:"spec-url"})],c.prototype,"specUrl",2),m([x({type:String,attribute:"submit-label"})],c.prototype,"submitLabel",2),m([x({type:String,attribute:"publishable-key"})],c.prototype,"publishableKey",2),m([x({attribute:!1})],c.prototype,"initialValues",2),m([h()],c.prototype,"fields",2),m([h()],c.prototype,"formTitle",2),m([h()],c.prototype,"hasLang",2),m([h()],c.prototype,"values",2),m([h()],c.prototype,"loaded",2),m([h()],c.prototype,"specError",2),m([h()],c.prototype,"validationErrors",2),c=m([oe("roxy-endpoint-form")],c);export{c as RoxyEndpointForm,Ie as resetSpecCache};
2
2
  //# sourceMappingURL=endpoint-form.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/endpoint-form.ts", "../../src/generated/api-languages.ts", "../../src/i18n/lang.ts", "../../src/utils/string.ts", "../../src/tokens/index.ts", "../../src/utils/base-styles.ts", "../../src/utils/disclosure.ts", "../../src/utils/field-schema.ts", "../../src/version.ts"],
4
- "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { apiLang } from '../i18n/lang.js';\nimport { signGlyph } from '../tokens/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { chevron, disclosureStyles } from '../utils/disclosure.js';\nimport {\n\tbuildFormModel,\n\tderiveSubmitLabel,\n\ttype FieldDef,\n\ttype FormModel,\n\tisZodiacEnum,\n\tLOCATION_PAIR,\n\tLOCATION_TRIO,\n\ttype OpenApiDoc,\n\ttype OperationSchema,\n\tsliceFileName,\n} from '../utils/field-schema.js';\nimport { humanize } from '../utils/string.js';\nimport { ROXY_UI_VERSION } from '../version.js';\n\n/** Production spec, fetched when no slice is available and no explicit `spec-url` is set. */\nconst PROD_SPEC_URL = 'https://roxyapi.com/api/v2/openapi.json';\n\n/** Version-pinned jsDelivr base for the digested per-operation schema slices, mirroring the wrapper CDN pinning so a slice matches the bundle it ships beside. */\nconst SLICE_BASE = `https://cdn.jsdelivr.net/npm/@roxyapi/ui@${ROXY_UI_VERSION}/dist/schemas`;\n\nconst specCache = new Map<string, Promise<OpenApiDoc>>();\n\n/**\n * Drop every cached spec promise.\n\n * @remarks\n * Test-only, and deliberately NOT re-exported from the package entry. The cache is module state shared by every test file in a single `bun test` process, and it only self-evicts on rejection, so one file that resolves a spec leaves a warm entry that silently satisfies a later file assertion about fetching. That made slice-fallback coverage pass or fail purely on file order.\n\n * @internal\n */\nexport function resetSpecCache(): void {\n\tspecCache.clear();\n}\n\nasync function loadSpec(url: string): Promise<OpenApiDoc> {\n\tlet pending = specCache.get(url);\n\tif (!pending) {\n\t\tpending = fetch(url)\n\t\t\t.then(async (res) => {\n\t\t\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\t\t\treturn (await res.json()) as OpenApiDoc;\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\t// Evict the rejected promise BEFORE rethrowing so subsequent\n\t\t\t\t// callers (the user clicking Retry, a remount) hit the network\n\t\t\t\t// again instead of replaying the cached failure forever.\n\t\t\t\tspecCache.delete(url);\n\t\t\t\tthrow err;\n\t\t\t});\n\t\tspecCache.set(url, pending);\n\t}\n\treturn pending;\n}\n\n/** A fresh seed for a hidden `seed` field, so each submit is a new draw unless the caller pinned one. */\nfunction randomSeed(): string {\n\treturn (\n\t\tglobalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2)\n\t);\n}\n\n/** Parse an array-field text value into a real array: JSON when it parses to one, else comma-separated tokens. */\nfunction parseArrayValue(raw: string): unknown {\n\tconst trimmed = raw.trim();\n\tif (!trimmed) return [];\n\ttry {\n\t\tconst parsed = JSON.parse(trimmed);\n\t\tif (Array.isArray(parsed)) return parsed;\n\t} catch {\n\t\t// Not JSON: fall through to comma splitting.\n\t}\n\treturn trimmed\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean);\n}\n\n/**\n * Schema-driven form. Pass `endpoint` (e.g. \"vedic-astrology/birth-chart\"). The form digests the operation's request schema into a spec-derived input for each parameter (a zodiac tile grid, a date or time input, a city search, a toggle) with progressive disclosure, and emits a `roxy-submit` CustomEvent carrying the validated payload. The caller decides what to do (call the SDK, render a chart, navigate).\n *\n * @remarks\n * Schema resolution order: an explicit `spec-url` fetches that full spec and digests it (unchanged, the demo path); otherwise the form tries a small version-pinned per-operation slice from the CDN, and on any miss falls back to fetching the production spec. Each input kind is chosen purely from the parameter shape (see {@link ../utils/field-schema.ts}), so a new endpoint gets a working, on-brand form with no per-endpoint code.\n *\n * The visitor-facing `lang` parameter is never rendered: a site owner sets the element `lang` attribute, and the form routes it to the query string on submit. Optional parameters collapse under one Advanced disclosure; a form whose only required field is an enum submits on selection.\n */\n@customElement('roxy-endpoint-form')\nexport class RoxyEndpointForm extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tdisclosureStyles,\n\t\tcss`form{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.fields{align-items:start;gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));display:grid}.fields:empty{display:none}.person-group{background:var(--roxy-surface,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);min-inline-size:0;margin:0;display:grid}.person-group legend{padding:0 var(--roxy-space-xs,.25rem);font-weight:var(--roxy-weight-bold,600)}.field{gap:var(--roxy-space-xs,.25rem);flex-direction:column;min-width:0;display:flex}.tiles-field{grid-column:1/-1}label,.label{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569)}.req{color:var(--roxy-danger-fg,#991b1b);margin-left:4px}input,select{box-sizing:border-box;width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);font-family:inherit}input:focus,select:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.help{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}.help-details>summary{cursor:pointer;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);align-items:center;gap:4px;display:flex}.help-details .help-lead{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.help-details .help-full{margin-top:var(--roxy-space-xs,.25rem);display:block}.location-block{gap:var(--roxy-space-xs,.25rem);grid-column:1/-1;display:grid}.tiles{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(5.5rem,1fr));display:grid}.tile{min-height:44px;padding:var(--roxy-space-sm,.5rem);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease), background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-direction:column;justify-content:center;align-items:center;gap:2px;display:flex}.tile:hover{border-color:var(--roxy-accent,#f59e0b)}.tile[aria-checked=true]{border-color:var(--roxy-accent,#f59e0b);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 12%, transparent);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.tile:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.tile-glyph{font-size:1.35em;line-height:1}.toggle-row{align-items:center;gap:var(--roxy-space-sm,.5rem);display:flex}.toggle{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);background:var(--roxy-border,#e4e4e7);cursor:pointer;width:44px;height:26px;transition:background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0;padding:0;position:relative}.toggle[aria-checked=true]{background:var(--roxy-accent,#f59e0b);border-color:var(--roxy-accent,#f59e0b)}.toggle .knob{background:var(--roxy-bg,#fff);width:20px;height:20px;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);border-radius:50%;position:absolute;top:2px;left:2px}.toggle[aria-checked=true] .knob{transform:translate(18px)}.toggle:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.toggle-label{cursor:pointer}@media (prefers-reduced-motion:reduce){.tile,.toggle,.toggle .knob{transition:none}}.advanced{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.advanced>summary{cursor:pointer;font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-fg,#0a0a0a);align-items:center;gap:6px;display:flex}.advanced[open]>summary{margin-bottom:var(--roxy-space-md,1rem)}.advanced .fields,.advanced .person-group{margin-top:var(--roxy-space-md,1rem)}.validation-error{gap:var(--roxy-space-xs,.25rem);padding:var(--roxy-space-md,1rem);background:color-mix(in srgb, var(--roxy-danger,#dc2626) 8%, transparent);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);display:grid}button.submit{background:var(--roxy-accent-ink,#b45309);color:var(--roxy-bg,#fff);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-lg,1.5rem);font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600);cursor:pointer;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));border:0;justify-self:start}button.submit:hover{transform:scale(1.02)}button.submit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}@media (prefers-reduced-motion:reduce){button.submit{transition:none}}.spec-error{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}`,\n\t];\n\n\t@property({ type: String, attribute: 'data-endpoint' })\n\tendpoint = 'vedic-astrology/birth-chart';\n\n\t@property({ type: String })\n\tmethod: 'GET' | 'POST' = 'POST';\n\n\t/** Explicit OpenAPI spec URL. When set, the form fetches and digests that full spec (the demo path). When empty, it resolves a version-pinned slice first, then the production spec. */\n\t@property({ type: String, attribute: 'spec-url' })\n\tspecUrl = '';\n\n\t/** Override the submit-button label. Empty derives an outcome-first label from the endpoint. */\n\t@property({ type: String, attribute: 'submit-label' })\n\tsubmitLabel = '';\n\n\t/** Browser-safe publishable key, forwarded to the slotted city search so the natal or synastry form can geocode. */\n\t@property({ type: String, attribute: 'publishable-key' })\n\tpublishableKey?: string;\n\n\t/** Prefill values, keyed by field name (nested per group). Used by `remember` mode and to restore the previous submission. JS property only. */\n\t@property({ attribute: false })\n\tinitialValues?: Record<string, unknown>;\n\n\t@state()\n\tprivate fields: FieldDef[] = [];\n\n\t@state()\n\tprivate formTitle = '';\n\n\t@state()\n\tprivate hasLang = false;\n\n\t@state()\n\tprivate values: Record<string, unknown> = {};\n\n\t@state()\n\tprivate loaded = false;\n\n\t@state()\n\tprivate specError: string | null = null;\n\n\t@state()\n\tprivate validationErrors: string[] = [];\n\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback();\n\t\tvoid this.loadSchema();\n\t}\n\n\tprivate async loadSchema() {\n\t\tthis.specError = null;\n\t\ttry {\n\t\t\tthis.applyModel(await this.resolveModel());\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.specError = message;\n\t\t\tthis.loaded = true;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-spec-error', {\n\t\t\t\t\tdetail: { url: this.specUrl || PROD_SPEC_URL, message },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Resolve the form model: explicit spec-url wins; else a version-pinned slice; else the production spec. */\n\tprivate async resolveModel(): Promise<FormModel> {\n\t\tif (this.specUrl) return this.modelFromSpec(this.specUrl);\n\t\tconst slice = await this.tryLoadSlice();\n\t\treturn slice ?? this.modelFromSpec(PROD_SPEC_URL);\n\t}\n\n\t/** Fetch and digest one operation from a full OpenAPI document. */\n\tprivate async modelFromSpec(url: string): Promise<FormModel> {\n\t\tconst spec = await loadSpec(url);\n\t\tconst path = `/${this.endpoint.replace(/^\\//, '')}`;\n\t\tconst op = spec.paths?.[path]?.[this.method.toLowerCase()] as\n\t\t\t| OperationSchema\n\t\t\t| undefined;\n\t\tif (!op) {\n\t\t\tthrow new Error(\n\t\t\t\t`Endpoint ${this.method} ${path} not found in OpenAPI spec`,\n\t\t\t);\n\t\t}\n\t\treturn buildFormModel(op, spec.components?.schemas ?? {}, this.endpoint);\n\t}\n\n\t/** Try the small precomputed slice; return null on any miss so the caller falls back to the full spec. */\n\tprivate async tryLoadSlice(): Promise<FormModel | null> {\n\t\ttry {\n\t\t\tconst res = await fetch(\n\t\t\t\t`${SLICE_BASE}/${sliceFileName(this.method, this.endpoint)}`,\n\t\t\t);\n\t\t\tif (!res.ok) return null;\n\t\t\treturn (await res.json()) as FormModel;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate applyModel(model: FormModel) {\n\t\tthis.fields = model.fields;\n\t\tthis.formTitle = model.title;\n\t\tthis.hasLang = model.hasLang;\n\t\t// Pre-fill: schema defaults first, then any remembered/initial values (only\n\t\t// for fields this endpoint has) so a stale stored payload from another\n\t\t// endpoint cannot inject unknown keys. Remembered values are nested per\n\t\t// group, so read them by group.\n\t\tconst init: Record<string, unknown> = {};\n\t\tfor (const f of model.fields) {\n\t\t\tif (f.default !== undefined) init[f.key] = f.default;\n\t\t\tconst remembered = f.group\n\t\t\t\t? (\n\t\t\t\t\t\tthis.initialValues?.[f.group] as Record<string, unknown> | undefined\n\t\t\t\t\t)?.[f.name]\n\t\t\t\t: this.initialValues?.[f.name];\n\t\t\tif (remembered !== undefined) init[f.key] = remembered;\n\t\t}\n\t\tthis.values = init;\n\t\tthis.loaded = true;\n\t}\n\n\tprivate retryLoadSchema = () => {\n\t\tthis.loaded = false;\n\t\tthis.specError = null;\n\t\tvoid this.loadSchema();\n\t};\n\n\tprivate setValue(name: string, value: unknown) {\n\t\tthis.values = { ...this.values, [name]: value };\n\t}\n\n\t/** The field's render role: a hidden autogenerated seed, a hidden defaulted limit/offset, a suppressed location coordinate, or a normally rendered input. */\n\tprivate roleOf(\n\t\tf: FieldDef,\n\t): 'seed' | 'hidden-default' | 'location' | 'normal' {\n\t\tif (f.name === 'seed') return 'seed';\n\t\tif ((f.name === 'limit' || f.name === 'offset') && !f.required)\n\t\t\treturn 'hidden-default';\n\t\tif (\n\t\t\t(LOCATION_TRIO as readonly string[]).includes(f.name) &&\n\t\t\tthis.groupHasLocation(f.group)\n\t\t)\n\t\t\treturn 'location';\n\t\t// A flat timezone in a group with no coordinates of its own is still suppressed when a\n\t\t// location group has claimed it, otherwise the prefixed shape shows a raw decimal-hours\n\t\t// box beside two city searches that already know the answer.\n\t\tif (\n\t\t\tf.name === 'timezone' &&\n\t\t\tthis.locationGroups().some((g) => this.timezoneFieldFor(g)?.key === f.key)\n\t\t)\n\t\t\treturn 'location';\n\t\treturn 'normal';\n\t}\n\n\t/** True when the field renders its own input (as opposed to being hidden or replaced by the city search). */\n\tprivate isRendered(f: FieldDef): boolean {\n\t\treturn this.roleOf(f) === 'normal';\n\t}\n\n\t/** Ordered, de-duplicated group keys (undefined flat group plus each named object). */\n\tprivate groupKeys(): (string | undefined)[] {\n\t\tconst keys: (string | undefined)[] = [];\n\t\tfor (const f of this.fields)\n\t\t\tif (!keys.includes(f.group)) keys.push(f.group);\n\t\treturn keys;\n\t}\n\n\t/** True when the fields in `group` (or the flat top level) carry a latitude+longitude pair, so a location-search can autofill them. Timezone is NOT required here, see {@link LOCATION_PAIR}. */\n\tprivate groupHasLocation(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_PAIR.every((n) => inGroup.some((f) => f.name === n));\n\t}\n\n\t/**\n\t * Location groups in field order. Order is load-bearing: when a request carries coordinate\n\t * groups but only ONE unprefixed top-level `timezone`, the FIRST group owns it, because that\n\t * timezone belongs to the primary moment (`generateRelocationChart` has one `timezone` and it is\n\t * the birth timezone). Without an owner both city boxes would write the same key and the second\n\t * pick would silently overwrite the first with the wrong offset.\n\t */\n\tprivate locationGroups(): (string | undefined)[] {\n\t\treturn this.groupKeys().filter((g) => this.groupHasLocation(g));\n\t}\n\n\t/**\n\t * The timezone field a group's city search should fill, or undefined when there is none.\n\t *\n\t * Prefers a timezone inside the group (the nested `person1`/`person2` shape has its own). Falls\n\t * back to an unowned flat `timezone` for the first location group only, which is what makes the\n\t * prefixed shape work without leaving a decimal-hours box for a visitor to guess at.\n\t */\n\tprivate timezoneFieldFor(group?: string): FieldDef | undefined {\n\t\tconst own = this.fields.find(\n\t\t\t(f) => f.group === group && f.name === 'timezone',\n\t\t);\n\t\tif (own) return own;\n\t\tif (this.locationGroups()[0] !== group) return undefined;\n\t\treturn this.fields.find(\n\t\t\t(f) => f.group === undefined && f.name === 'timezone',\n\t\t);\n\t}\n\n\t/**\n\t * True when the location block must show a required mark, i.e. ANY member of the trio is required. The block is a single city-search input that fills all three, so if even one is required (e.g. bodygraph requires `timezone` while `latitude`/`longitude` are optional) the input is required and `collectMissing` blocks submit without it. Requiring ALL three understated that: the asterisk went missing on a block the form still enforced, which reads as optional to a non-technical embedder.\n\t */\n\tprivate locationRequired(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_TRIO.some((n) =>\n\t\t\tinGroup.some((f) => f.name === n && f.required),\n\t\t);\n\t}\n\n\t/** A named group is a required input when any of its leaf fields is required or it carries a location. */\n\tprivate groupIsRequired(group: string): boolean {\n\t\treturn (\n\t\t\tthis.groupHasLocation(group) ||\n\t\t\tthis.fields.some((f) => f.group === group && f.required)\n\t\t);\n\t}\n\n\t/**\n\t * The single visible required enum field, when the whole form reduces to exactly one: no location block, no named group, one required rendered enum. This is what turns the horoscope form into a tap-to-load sign grid; returns null otherwise.\n\t */\n\tprivate get singleEnumField(): FieldDef | null {\n\t\tif (this.groupKeys().some((g) => this.groupHasLocation(g))) return null;\n\t\tif (this.groupKeys().some((g) => g !== undefined)) return null;\n\t\tconst req = this.fields.filter((f) => f.required && this.isRendered(f));\n\t\tconst only = req[0];\n\t\tif (req.length !== 1 || !only) return null;\n\t\treturn only.kind === 'tiles' || only.kind === 'select' ? only : null;\n\t}\n\n\tprivate effectiveSubmitLabel(): string {\n\t\treturn this.submitLabel || deriveSubmitLabel(this.endpoint);\n\t}\n\n\t/**\n\t * The value this form may put on `?lang=`, or undefined to leave the request on the API default.\n\t *\n\t * @remarks\n\t * NOT the raw site language. `?lang=es-AR` is a 400 and `?lang=es` is a 200, and the language now resolves from `<html lang>` rather than only from an attribute a developer typed, so the unfiltered tag reaching the query string would break every regional and every untranslated locale. {@link apiLang} does both narrowings; this method exists so the submit path reads as one call.\n\t */\n\tprivate effectiveLang(): string | undefined {\n\t\treturn apiLang(this);\n\t}\n\n\t/**\n\t * Location-select handler bound to a group: fills that group's coordinate keys plus whichever\n\t * timezone field it owns.\n\t *\n\t * Keys are LOOKED UP from the model rather than built as `group.name`. That assumption held only\n\t * while every group came from object nesting; a prefixed group stores under the original wire\n\t * name (`birthLatitude`), so constructing `birth.latitude` would write a key the request builder\n\t * never reads and the coordinates would silently stay empty.\n\t */\n\tprivate onLocationFor(group?: string) {\n\t\treturn (e: Event) => {\n\t\t\tconst detail = (e as CustomEvent).detail as {\n\t\t\t\tlatitude?: number;\n\t\t\t\tlongitude?: number;\n\t\t\t\ttimezone?: string;\n\t\t\t\tutcOffset?: number;\n\t\t\t};\n\t\t\tif (!detail) return;\n\t\t\tconst keyOf = (name: string) =>\n\t\t\t\tthis.fields.find((f) => f.group === group && f.name === name)?.key;\n\t\t\tconst next: Record<string, unknown> = { ...this.values };\n\t\t\tconst lat = keyOf('latitude');\n\t\t\tconst lon = keyOf('longitude');\n\t\t\tif (lat) next[lat] = detail.latitude;\n\t\t\tif (lon) next[lon] = detail.longitude;\n\t\t\tconst tz = this.timezoneFieldFor(group);\n\t\t\tif (tz) next[tz.key] = detail.timezone ?? detail.utcOffset;\n\t\t\tthis.values = next;\n\t\t};\n\t}\n\n\tprivate selectTile(f: FieldDef, value: string) {\n\t\tthis.setValue(f.key, value);\n\t\tif (this.singleEnumField?.key === f.key) this.submit();\n\t}\n\n\t/** Roving-tabindex arrow-key navigation for a tile radiogroup, modeled on the shared tablist pattern (selection follows focus). */\n\tprivate onTilesKeyDown(f: FieldDef) {\n\t\treturn (e: KeyboardEvent) => {\n\t\t\tconst opts = f.enum ?? [];\n\t\t\tif (opts.length === 0) return;\n\t\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\t\tlet next: number;\n\t\t\tif (e.key === 'Home') next = 0;\n\t\t\telse if (e.key === 'End') next = opts.length - 1;\n\t\t\telse if (e.key === 'ArrowRight' || e.key === 'ArrowDown')\n\t\t\t\tnext = cur === -1 ? 0 : (cur + 1) % opts.length;\n\t\t\telse if (e.key === 'ArrowLeft' || e.key === 'ArrowUp')\n\t\t\t\tnext =\n\t\t\t\t\tcur === -1 ? opts.length - 1 : (cur - 1 + opts.length) % opts.length;\n\t\t\telse return;\n\t\t\te.preventDefault();\n\t\t\tconst value = opts[next];\n\t\t\tif (value === undefined) return;\n\t\t\tthis.selectTile(f, value);\n\t\t\tconst root = e.currentTarget as HTMLElement;\n\t\t\trequestAnimationFrame(() =>\n\t\t\t\troot.querySelector<HTMLButtonElement>(`[data-tile='${next}']`)?.focus(),\n\t\t\t);\n\t\t};\n\t}\n\n\tprivate onSubmit = (e: Event) => {\n\t\te.preventDefault();\n\t\tthis.submit();\n\t};\n\n\t/** Validate, then emit `roxy-submit` with the reconstructed payload, the spec query keys, and whether the form was a single-enum sticky picker. */\n\tprivate submit() {\n\t\tconst missing = this.collectMissing();\n\t\tif (missing.keys.length > 0) {\n\t\t\tthis.validationErrors = missing.labels;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-validation-error', {\n\t\t\t\t\tdetail: { missing: missing.keys },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis.validationErrors = [];\n\t\tconst out: Record<string, unknown> = {};\n\t\tfor (const f of this.fields) {\n\t\t\tlet v = this.values[f.key];\n\t\t\t// A hidden seed autogenerates per submit unless a value was remembered.\n\t\t\tif (f.name === 'seed' && (v === undefined || v === '')) v = randomSeed();\n\t\t\tif (v === undefined || v === '') continue;\n\t\t\tif (f.kind === 'array' && typeof v === 'string') v = parseArrayValue(v);\n\t\t\tif (f.group) {\n\t\t\t\tconst g = (out[f.group] as Record<string, unknown> | undefined) ?? {};\n\t\t\t\tg[f.name] = v;\n\t\t\t\tout[f.group] = g;\n\t\t\t} else {\n\t\t\t\tout[f.name] = v;\n\t\t\t}\n\t\t}\n\t\t// The spec knows which parameters belong in the query string; the listener\n\t\t// does not. Report them (including a site-owner lang) so a POST with a query\n\t\t// parameter reaches the API correctly instead of being dropped in the body.\n\t\tconst queryKeys = this.fields.filter((f) => f.inQuery).map((f) => f.name);\n\t\tconst lang = this.effectiveLang();\n\t\tif (this.hasLang && lang) {\n\t\t\tout.lang = lang;\n\t\t\tqueryKeys.push('lang');\n\t\t}\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('roxy-submit', {\n\t\t\t\tdetail: {\n\t\t\t\t\tendpoint: this.endpoint,\n\t\t\t\t\tvalues: out,\n\t\t\t\t\tqueryKeys,\n\t\t\t\t\tsticky: this.singleEnumField != null,\n\t\t\t\t},\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** Required fields left empty, with the location trio collapsed to one entry per group. Seed and hidden defaults never block. */\n\tprivate collectMissing(): { keys: string[]; labels: string[] } {\n\t\tconst keys: string[] = [];\n\t\tconst labels: string[] = [];\n\t\tconst locGroups = new Set<string | undefined>();\n\t\tfor (const f of this.fields) {\n\t\t\tif (!f.required) continue;\n\t\t\tconst isLocation = this.roleOf(f) === 'location';\n\t\t\tif (!this.isRendered(f) && !isLocation) continue;\n\t\t\tconst v = this.values[f.key];\n\t\t\tif (v !== undefined && v !== '') continue;\n\t\t\tkeys.push(f.key);\n\t\t\tif (isLocation) {\n\t\t\t\tlocGroups.add(f.group);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlabels.push(\n\t\t\t\tf.group ? `${humanize(f.group)} ${humanize(f.name)}` : humanize(f.name),\n\t\t\t);\n\t\t}\n\t\tfor (const g of locGroups) {\n\t\t\tlabels.push(g ? `${humanize(g)} location` : 'Birth location');\n\t\t}\n\t\treturn { keys, labels };\n\t}\n\n\tprivate reqMark(f: FieldDef) {\n\t\treturn f.required\n\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t: nothing;\n\t}\n\n\t/** A description under a field: rendered inline when short, collapsed behind a disclosure showing its first line when long. */\n\tprivate description(f: FieldDef) {\n\t\tif (!f.description) return nothing;\n\t\tif (f.description.length <= 120) {\n\t\t\treturn html`<small class=\"help\">${f.description}</small>`;\n\t\t}\n\t\tconst lead = f.description.split('. ')[0] ?? f.description;\n\t\treturn html`<details class=\"help-details\"><summary><span class=\"help-lead\">${lead}</span>${chevron()}</summary><small class=\"help help-full\">${f.description}</small></details>`;\n\t}\n\n\tprivate renderTiles(f: FieldDef) {\n\t\tconst labelId = `roxy-form-${f.key}-label`;\n\t\tconst zodiac = !!f.enum && isZodiacEnum(f.enum);\n\t\tconst opts = f.enum ?? [];\n\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\tconst active = cur === -1 ? 0 : cur;\n\t\treturn html`<div class=\"field tiles-field\"><span class=\"label\" id=\"${labelId}\">${humanize(f.name)}${this.reqMark(f)}</span><div class=\"tiles\" role=\"radiogroup\" aria-labelledby=\"${labelId}\" @keydown=\"${this.onTilesKeyDown(f)}\">${opts.map((opt, i) => {\n\t\t\t\t\tconst selected = this.values[f.key] === opt;\n\t\t\t\t\tconst glyph = zodiac ? signGlyph(opt) : undefined;\n\t\t\t\t\treturn html`<button type=\"button\" class=\"tile\" role=\"radio\" data-tile=\"${i}\" aria-checked=\"${selected ? 'true' : 'false'}\" tabindex=\"${i === active ? '0' : '-1'}\" @click=\"${() => this.selectTile(f, opt)}\">${\n\t\t\t\t\t\t\tglyph\n\t\t\t\t\t\t\t\t? html`<span class=\"tile-glyph\" aria-hidden=\"true\">${glyph}</span>`\n\t\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t\t} <span class=\"tile-label\">${humanize(opt)}</span></button>`;\n\t\t\t\t})}</div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderSelect(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${humanize(f.name)}${this.reqMark(f)}</label> <select id=\"${id}\" ?required=\"${f.required}\" @change=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(f.key, (e.target as HTMLSelectElement).value)}\"><option value=\"\">Choose</option>${(f.enum ?? []).map(\n\t\t\t\t\t(\n\t\t\t\t\t\topt,\n\t\t\t\t\t) => html`<option value=\"${opt}\" ?selected=\"${this.values[f.key] === opt}\">${humanize(opt)}</option>`,\n\t\t\t\t)}</select> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderToggle(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst checked = this.values[f.key] === true;\n\t\treturn html`<div class=\"field\"><div class=\"toggle-row\"><button type=\"button\" id=\"${id}\" class=\"toggle\" role=\"switch\" aria-checked=\"${checked ? 'true' : 'false'}\" @click=\"${() => this.setValue(f.key, !checked)}\"><span class=\"knob\"></span></button> <label class=\"toggle-label\" for=\"${id}\">${humanize(f.name)}${this.reqMark(f)}</label></div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderInput(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst type =\n\t\t\tf.kind === 'datetime'\n\t\t\t\t? 'datetime-local'\n\t\t\t\t: f.kind === 'number'\n\t\t\t\t\t? 'number'\n\t\t\t\t\t: f.kind;\n\t\tconst placeholder =\n\t\t\tf.kind === 'array'\n\t\t\t\t? 'Comma separated'\n\t\t\t\t: f.example != null\n\t\t\t\t\t? String(f.example)\n\t\t\t\t\t: '';\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${humanize(f.name)}${this.reqMark(f)}</label> <input id=\"${id}\" type=\"${f.kind === 'array' ? 'text' : type}\" ?required=\"${f.required}\" min=\"${ifDefined(f.min)}\" max=\"${ifDefined(f.max)}\" step=\"${f.kind === 'number' ? 'any' : nothing}\" placeholder=\"${placeholder || nothing}\" .value=\"${(this.values[f.key] ?? '') as string}\" @input=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tf.key,\n\t\t\t\t\t\tthis.coerce(f.kind, (e.target as HTMLInputElement).value),\n\t\t\t\t\t)}\"> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderField(f: FieldDef) {\n\t\tswitch (f.kind) {\n\t\t\tcase 'tiles':\n\t\t\t\treturn this.renderTiles(f);\n\t\t\tcase 'select':\n\t\t\t\treturn this.renderSelect(f);\n\t\t\tcase 'toggle':\n\t\t\t\treturn this.renderToggle(f);\n\t\t\tdefault:\n\t\t\t\treturn this.renderInput(f);\n\t\t}\n\t}\n\n\t/**\n\t * The fields this group's city search actually fills, named in the help text.\n\t *\n\t * Not the hardcoded \"latitude, longitude, timezone\" it used to say: a group does not always own a\n\t * timezone. `generateRelocationChart` has one top-level `timezone` that belongs to the birth\n\t * moment, so the relocation block fills coordinates only, and promising a timezone there would be\n\t * a visible lie on the one form that made this method necessary.\n\t */\n\tprivate locationFillList(group?: string): string {\n\t\tconst names = [...LOCATION_PAIR] as string[];\n\t\tif (this.timezoneFieldFor(group)) names.push('timezone');\n\t\treturn names.join(', ');\n\t}\n\n\tprivate locationBlock(group?: string) {\n\t\treturn html`<div class=\"location-block\"><label>${group ? `${humanize(group)} location` : 'Birth location'}${\n\t\t\t\t\tthis.locationRequired(group)\n\t\t\t\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</label><roxy-location-search publishable-key=\"${ifDefined(this.publishableKey)}\" @roxy-location-select=\"${this.onLocationFor(group)}\" placeholder=\"${group ? `${humanize(group)} city` : 'City of birth'}\"></roxy-location-search><small class=\"help\">Fills ${this.locationFillList(group)}. Pick a city to autofill.</small></div>`;\n\t}\n\n\tprivate groupCard(group: string) {\n\t\tconst fields = this.fields.filter(\n\t\t\t(f) => f.group === group && this.isRendered(f),\n\t\t);\n\t\treturn html`<fieldset class=\"person-group\"><legend>${humanize(group)}</legend>${this.groupHasLocation(group) ? this.locationBlock(group) : nothing}<div class=\"fields\">${fields.map((f) => this.renderField(f))}</div></fieldset>`;\n\t}\n\n\trender() {\n\t\tif (!this.loaded) {\n\t\t\treturn html`<form><div class=\"roxy-skeleton\" style=\"height:8rem\"></div></form>`;\n\t\t}\n\t\tif (this.specError) {\n\t\t\treturn html`<div class=\"spec-error\" role=\"alert\">Schema load failed: ${this.specError} <button type=\"button\" class=\"submit\" @click=\"${this.retryLoadSchema}\">Retry</button></div>`;\n\t\t}\n\n\t\tconst flat = this.fields.filter((f) => !f.group && this.isRendered(f));\n\t\tconst flatReq = flat.filter((f) => f.required);\n\t\tconst flatOpt = flat.filter((f) => !f.required);\n\t\tconst named = this.groupKeys().filter((g): g is string => g !== undefined);\n\t\tconst reqGroups = named.filter((g) => this.groupIsRequired(g));\n\t\tconst optGroups = named.filter((g) => !this.groupIsRequired(g));\n\t\tconst hasAdvanced = flatOpt.length > 0 || optGroups.length > 0;\n\n\t\treturn html`<form @submit=\"${this.onSubmit}\"><h2 class=\"title\">${this.formTitle}</h2>${\n\t\t\t\tthis.validationErrors.length > 0\n\t\t\t\t\t? html`<div class=\"validation-error\" role=\"alert\"><strong>Please complete:</strong> ${this.validationErrors.join(', ')}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}<div class=\"fields\">${flatReq.map((f) => this.renderField(f))}</div>${this.groupHasLocation(undefined) ? this.locationBlock(undefined) : nothing} ${reqGroups.map((g) => this.groupCard(g))} ${\n\t\t\t\thasAdvanced\n\t\t\t\t\t? html`<details class=\"advanced\"><summary>Advanced${chevron()}</summary><div class=\"fields\">${flatOpt.map((f) => this.renderField(f))}</div>${optGroups.map((g) => this.groupCard(g))}</details>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tthis.singleEnumField\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<button class=\"submit\" type=\"submit\">${this.effectiveSubmitLabel()}</button>`\n\t\t\t}</form>`;\n\t}\n\n\tprivate coerce(kind: string, v: string): unknown {\n\t\tif (v === '') return undefined;\n\t\tif (kind === 'number') {\n\t\t\tconst n = Number(v);\n\t\t\treturn Number.isFinite(n) ? n : undefined;\n\t\t}\n\t\treturn v;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-endpoint-form': RoxyEndpointForm;\n\t}\n}\n", "// Generated by scripts/sync-bindings.ts (the `lang` query enum in specs/openapi.json). Do not edit.\n\n/**\n * Every language tag the API accepts on `?lang=`.\n *\n * @remarks\n * A self-fetch resolves the site language from the DOM, which means ANY value a\n * host page happens to carry can reach the query string. The API rejects an\n * unlisted tag with a 400, so a page in a language we do not translate would\n * stop working the moment the language chain was completed. Membership is\n * checked against this list before `lang` is sent, and a miss simply omits the\n * parameter, leaving the endpoint on its English default.\n */\nexport const API_LANGUAGES: readonly string[] = [\"de\",\"en\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\"];\n", "/**\n * Where a component's language comes from, and what is safe to send to the API.\n *\n * @remarks\n * Two different answers, and conflating them is the whole reason this file is separate from the catalogue:\n *\n * - {@link resolveLang} answers \"what language is this PAGE in\", and keeps the full tag, because `es-AR` is a legitimate thing for a catalogue to want to differ on.\n * - {@link apiLang} answers \"what may go on the query string\", which is a narrower question with a hard edge: `?lang=es-AR` is a 400, `?lang=es` is a 200.\n *\n * The full tag is not a nicety the catalogue happens to tolerate: `utils/format.ts` hands it to `Intl`, which reads the region and writes `15 de ene de 1990` for `es-AR` where it writes `15 ene 1990` for `es`. Passing the API answer to a formatter demotes every regional visitor to the base language and nothing fails, so the two values are never interchangeable.\n */\n\nimport { API_LANGUAGES } from '../generated/api-languages.js';\n\n/**\n * The site-owner language for an element, resolved through the four-link chain the revamp design specifies.\n *\n * @remarks\n * 1. the element's own `lang` attribute (the explicit per-embed override),\n * 2. the nearest ancestor carrying `lang`, so one wrapper localizes a whole section,\n * 3. `document.documentElement.lang`, which is what makes this work on a real CMS with no markup change at all: WordPress emits `<html lang=\"es-AR\">` on every page of a Spanish site,\n * 4. nothing, which the callers read as English.\n *\n * Only link 1 used to be implemented, so a component on a fully Spanish page rendered English chrome and there was no way to fix it except hand-editing every embed.\n *\n * `navigator.language` is deliberately NOT in the chain. It is the VISITOR's preference, not the site's: it fragments the API cache across every locale a visitor might carry and silently serves two people different content from the same URL.\n *\n * Link 2 uses `closest`, which stops at a shadow boundary. A component composed INSIDE another component's shadow root therefore cannot see the host page, which is why every composing component forwards `lang` to its children explicitly.\n */\nexport function resolveLang(el: HTMLElement): string | undefined {\n\t// Native accessor, never a Lit @property: declaring one would shadow\n\t// HTMLElement.lang and break the platform attribute for every consumer.\n\tif (el.lang) return el.lang;\n\tif (typeof document === 'undefined') return undefined;\n\tconst inherited = el.closest?.('[lang]')?.getAttribute('lang');\n\tif (inherited) return inherited;\n\treturn document.documentElement.lang || undefined;\n}\n\n/**\n * The value safe to put on `?lang=`, or `undefined` to leave the request on the API default.\n *\n * @remarks\n * Two narrowings, both of which are load-bearing the moment {@link resolveLang} starts reading `<html lang>`:\n *\n * - **The region is dropped.** A regional tag is a 400, so a Spanish WordPress site would go from English-but-working to broken the day the language chain was completed. `es-AR`, `es-419` and `ES` all send `es`.\n * - **An unsupported language is omitted, not sent.** The chain now surfaces whatever the host page carries, including languages the API does not translate, and an unlisted tag is the same 400. Omitting it degrades to English, which is the behaviour those pages already had.\n */\nexport function apiLang(el: HTMLElement): string | undefined {\n\tconst tag = resolveLang(el);\n\tif (!tag) return undefined;\n\tconst base = tag.toLowerCase().split('-')[0] as string;\n\treturn API_LANGUAGES.includes(base) ? base : undefined;\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `lookupKey`: the ONE normalizer every lookup table in this library is keyed\n * and read by (`tokens/index.ts` glyphs and abbreviations, `i18n/` chrome\n * strings).\n * - `capitalize`: title-cases the first character, lowercases the rest. A\n * DISPLAY helper only; it is not a lookup key (see `lookupKey`).\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\n/**\n * Fold a name to the canonical key its lookup table is stored under: lower case, every run of spaces, underscores and hyphens collapsed to one space, trimmed.\n *\n * @remarks\n * This exists because a GUESSED key spelling is a defect class this repo has now shipped twice. The glyph tables were keyed off whatever {@link capitalize} happened to produce (`North node`), while the API returns `North Node`, so every call site that reached the table without first calling `capitalize` missed and fell through to a fabricated abbreviation. Aspects hit the same wall from the other side: `/aspects` returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`.\n *\n * One normalizer, applied when a table is DEFINED and again when it is READ, removes the whole class: no call site has to remember a convention, and no table has to guess a spelling. Use it for every new table keyed by an API-supplied name.\n *\n * @example\n * ```ts\n * lookupKey('North Node'); // 'north node'\n * lookupKey('SEMI_SEXTILE'); // 'semi sextile'\n * lookupKey('semi-sextile'); // 'semi sextile'\n * ```\n */\nexport function lookupKey(s: string): string {\n\treturn s\n\t\t.toLowerCase()\n\t\t.replace(/[\\s_-]+/g, ' ')\n\t\t.trim();\n}\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn (\n\t\ts\n\t\t\t.replace(/[_-]+/g, ' ')\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t\t// Split a trailing/embedded digit off a word so \"person1\" reads \"Person 1\"\n\t\t\t// and every group legend and field label spaces its ordinal.\n\t\t\t.replace(/([a-z])([0-9])/g, '$1 $2')\n\t\t\t.replace(/^\\w/, (c) => c.toUpperCase())\n\t);\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n *\n * @remarks\n * **Every table here is keyed by {@link lookupKey} and read ONLY through the accessor beside it.** The raw records are deliberately not exported: a component that indexes a record directly has to guess the key convention, and a guessed spelling is what shipped `No North Node R`, `So South Node R` and `Bl Black Moon Lilith` into a live customer's natal chart. The API returns `North Node` with a space; the table was keyed `North node`, the spelling {@link capitalize} happens to produce, so every call site that forgot to call `capitalize` first missed the table.\n *\n * **A miss returns `undefined`, never a manufactured abbreviation.** The old `?? name.slice(0, 2)` fallback is what made the defect survive review: a failed lookup renders as a plausible two-letter code that reads exactly like an intentional abbreviation, so nothing about the output says \"this is broken\". A caller that can omit the glyph should omit it (`?? ''`); a caller that must show something falls back to the FULL name, which is visibly wrong at the size these slots are drawn.\n *\n * `tests/tokens.test.ts` resolves every body, sign and aspect name the committed spec can emit against these tables, so a vocabulary the API gains cannot ship unglyphed.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Look one name up in a normalized table. The single read path for every map in this file. */\nconst resolve = (\n\ttable: Record<string, string>,\n\tname: string | undefined | null,\n): string | undefined => (name ? table[lookupKey(name)] : undefined);\n\nconst PLANET_GLYPH: Record<string, string> = {\n\tsun: '\u2609',\n\tmoon: '\u263D',\n\tmercury: '\u263F',\n\tvenus: '\u2640',\n\tearth: '\u2641',\n\tmars: '\u2642',\n\tjupiter: '\u2643',\n\tsaturn: '\u2644',\n\turanus: '\u2645',\n\tneptune: '\u2646',\n\tpluto: '\u2647',\n\trahu: '\u260A',\n\tketu: '\u260B',\n\tascendant: 'Asc',\n\tlagna: 'La',\n\t'north node': '\u260A',\n\t'south node': '\u260B',\n\tchiron: '\u26B7',\n\tlilith: '\u26B8',\n\t'black moon lilith': '\u26B8',\n};\n\n/** Astrological glyph for a planet or point, or `undefined` when the library has none for it. */\nexport const planetGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_GLYPH, name);\n\nconst PLANET_ABBR: Record<string, string> = {\n\tsun: 'Su',\n\tmoon: 'Mo',\n\tmercury: 'Me',\n\tvenus: 'Ve',\n\tmars: 'Ma',\n\tjupiter: 'Ju',\n\tsaturn: 'Sa',\n\turanus: 'Ur',\n\tneptune: 'Ne',\n\tpluto: 'Pl',\n\trahu: 'Ra',\n\tketu: 'Ke',\n\tascendant: 'Asc',\n\tlagna: 'La',\n};\n\n/** Two-letter graha code for the tight cells of a North/South Indian kundli, or `undefined`. */\nexport const planetAbbr = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_ABBR, name);\n\nconst SIGN_GLYPH: Record<string, string> = {\n\taries: '\u2648',\n\ttaurus: '\u2649',\n\tgemini: '\u264A',\n\tcancer: '\u264B',\n\tleo: '\u264C',\n\tvirgo: '\u264D',\n\tlibra: '\u264E',\n\tscorpio: '\u264F',\n\tsagittarius: '\u2650',\n\tcapricorn: '\u2651',\n\taquarius: '\u2652',\n\tpisces: '\u2653',\n};\n\n/** Zodiac glyph for a sign name in any case, or `undefined`. */\nexport const signGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(SIGN_GLYPH, name);\n\nconst SIGN_ABBR: Record<string, string> = {\n\taries: 'Ar',\n\ttaurus: 'Ta',\n\tgemini: 'Ge',\n\tcancer: 'Cn',\n\tleo: 'Le',\n\tvirgo: 'Vi',\n\tlibra: 'Li',\n\tscorpio: 'Sc',\n\tsagittarius: 'Sg',\n\tcapricorn: 'Cp',\n\taquarius: 'Aq',\n\tpisces: 'Pi',\n};\n\n/** Two-letter rashi code for kundli cells and grid headers, or `undefined`. */\nexport const signAbbr = (name: string | undefined | null): string | undefined =>\n\tresolve(SIGN_ABBR, name);\n\n/** The twelve signs in zodiacal order. Display values, not lookup keys: read them through {@link signGlyph} / {@link signAbbr}. */\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Glyph per aspect. Used by the natal, transit and synastry aspect tables.\n *\n * @remarks\n * These are the nine aspects Unicode itself defines as a set, in its Miscellaneous Symbols block note: `260C, 26BA, 2220, 26B9, 25A1, 25B3, 26BC, 26BB, 260D` for 0, 30, 45, 60, 90, 120, 135, 150 and 180 degrees. That is exactly the vocabulary the API returns, so every aspect resolves to a real glyph and none falls through to a truncated slug.\n *\n * Do not substitute the visually similar maths operators. Unicode lists `\u22BB` XOR and `\u22BC` NAND as cross-references FROM the real quincunx and semisextile glyphs, so they look like safe stand-ins and are easy to pair the wrong way round, which renders a 150 degree quincunx with the 30 degree semisextile symbol. An astrologer reads the glyph, not the tooltip.\n */\nconst ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\tsemisextile: '\u26BA',\n\t'semi sextile': '\u26BA',\n\tsemisquare: '\u2220',\n\t'semi square': '\u2220',\n\tsextile: '\u26B9',\n\tsquare: '\u25A1',\n\ttrine: '\u25B3',\n\tsesquiquadrate: '\u26BC',\n\tquincunx: '\u26BB',\n\topposition: '\u260D',\n};\n\n/** Aspect glyph for any of the separator forms the endpoints use (`SEMI_SEXTILE`, `SEMI SEXTILE`, `semi-sextile`), or `undefined`. */\nexport const aspectSymbol = (\n\tname: string | undefined | null,\n): string | undefined => resolve(ASPECT_SYMBOL, name);\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nconst TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n};\n\n/** Trigram glyph for a trigram name in any case, or `undefined`. */\nexport const trigramGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(TRIGRAM_GLYPH, name);\n\n/** Moon phase emoji set. Used by the moon phase card. */\nconst MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n\n/**\n * Emoji for a lunar phase, or `undefined`.\n *\n * @remarks\n * The live API suffixes most phase names (`Waxing Gibbous Moon`) and calls the third quarter `Third Quarter Moon`, while only new and full moon carry the suffix in the table. Both reconciliations live here rather than in the card, so any component reading a phase name resolves the same eight phases from the same four spellings.\n */\nexport const moonPhaseEmoji = (\n\tname: string | undefined | null,\n): string | undefined => {\n\tif (!name) return undefined;\n\tconst key = lookupKey(name);\n\tconst bare = key.replace(/ moon$/, '');\n\tconst alias = bare === 'third quarter' ? 'last quarter' : bare;\n\treturn MOON_PHASE_EMOJI[key] ?? MOON_PHASE_EMOJI[alias];\n};\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { TemplateResult } from 'lit';\nimport { css, html } from 'lit';\n\n/**\n * Disclosure chevron for `<details>`/`<summary>` accordions. Replaces the\n * browser default triangle with a thin chevron that rotates when the host\n * `<details>` opens. Render it inside the `<summary>` and pair with\n * {@link disclosureStyles}.\n */\nexport function chevron(): TemplateResult {\n\treturn html`<svg class=\"roxy-chevron\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\"><path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n}\n\n/**\n * Shared `<details>` accordion styling: hides the native disclosure triangle\n * and rotates the {@link chevron} 180 degrees when the accordion is open.\n * Import into any component that renders disclosure accordions so the chevron\n * looks and behaves identically.\n */\nexport const disclosureStyles = css`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;\n", "/**\n * Pure, framework-free schema layer shared by the self-fetch form. It turns one OpenAPI operation into a digested list of {@link FieldDef}s whose {@link InputKind} decides which input widget renders, with zero Lit or DOM dependency so the build-time slice generator ({@link ../../../scripts/build-schemas.ts}) and the taxonomy-coverage test consume the exact same classification the browser does.\n *\n * @remarks\n * The registry is by SHAPE, never by name: {@link classifyInput} inspects `enum` / `type` / `format` only, so a new API parameter gets a working widget with no code change, and the taxonomy gate fails loudly (via a `null` return) the day a genuinely new shape appears. Name-driven behaviour (suppressing `lang`, hiding `seed` / `limit` / `offset`, replacing the latitude+longitude+timezone trio with a city search) is a separate render-time concern layered on top by the form, never encoded here.\n */\n\nimport { SIGNS_ORDER } from '../tokens/index.js';\nimport { humanize } from './string.js';\n\n/** A JSON `$ref` node, before resolution against `components.schemas`. */\nexport interface OpenApiSchemaRef {\n\t$ref?: string;\n}\n\n/** The subset of an OpenAPI 3 schema object the form reads. */\nexport interface OpenApiSchema extends OpenApiSchemaRef {\n\t/** A plain name in 3.0, or an ARRAY in 3.1 where nullability is spelled `['number', 'null']`. Read it through {@link scalarType}, never compare it directly. */\n\ttype?: string | string[];\n\tformat?: string;\n\tdescription?: string;\n\tenum?: string[];\n\tdefault?: unknown;\n\tminimum?: number;\n\tmaximum?: number;\n\tproperties?: Record<string, OpenApiSchema>;\n\trequired?: string[];\n\titems?: OpenApiSchema;\n\texample?: unknown;\n\tanyOf?: OpenApiSchema[];\n\toneOf?: OpenApiSchema[];\n}\n\n/** One operation's request shape, as read from `spec.paths[path][method]`. */\nexport interface OperationSchema {\n\tsummary?: string;\n\trequestBody?: {\n\t\tcontent?: Record<string, { schema?: OpenApiSchema | OpenApiSchemaRef }>;\n\t};\n\tparameters?: Array<{\n\t\tname: string;\n\t\tin: string;\n\t\trequired?: boolean;\n\t\tschema?: OpenApiSchema;\n\t}>;\n}\n\n/** The minimal OpenAPI document surface the form introspects. */\nexport interface OpenApiDoc {\n\tpaths?: Record<string, Record<string, unknown>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/** The fully typed spec document the build-time scripts read from the committed `specs/openapi.json`: every path item value is an {@link OperationSchema}. The runtime form keeps the looser {@link OpenApiDoc} because a live spec fetch is untrusted input it narrows per operation. */\nexport interface SpecDoc {\n\tpaths: Record<string, Record<string, OperationSchema>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/**\n * The widget kind a parameter resolves to. This is the closed set the taxonomy gate enforces: every request parameter in the spec MUST classify to one of these, or {@link classifyInput} returns `null` and the gate fails, forcing a conscious decision when the API grows a new shape.\n */\nexport type InputKind =\n\t| 'tiles'\n\t| 'select'\n\t| 'toggle'\n\t| 'date'\n\t| 'time'\n\t| 'datetime'\n\t| 'number'\n\t| 'text'\n\t| 'array';\n\n/** A single input the form renders, digested from one schema property or parameter. */\nexport interface FieldDef {\n\t/** Unique storage + input key: the property name, or \"group.name\" for a nested object field. */\n\tkey: string;\n\t/** Schema property name (the label source), e.g. \"date\". */\n\tname: string;\n\t/** Parent object key for a nested schema (person1/person2); undefined for a flat field. */\n\tgroup?: string;\n\t/** True when the spec declares the field as `in: query`, so it belongs in the query string even on a POST. */\n\tinQuery?: boolean;\n\t/** The resolved widget kind. */\n\tkind: InputKind;\n\trequired: boolean;\n\tdescription?: string;\n\tenum?: string[];\n\tmin?: number;\n\tmax?: number;\n\tdefault?: unknown;\n\t/** Spec `example`, used as the placeholder for a text input. */\n\texample?: unknown;\n}\n\n/** The digested form model for one operation. The build-time slice is exactly this shape. */\nexport interface FormModel {\n\t/** Concise heading derived from the operation summary, falling back to the path. */\n\ttitle: string;\n\t/** Every rendered field. The `lang` query parameter is intentionally excluded (routed via the element `lang` attribute instead). */\n\tfields: FieldDef[];\n\t/** True when the operation carries a `lang` query parameter, so the form knows to route an effective language to the query string on submit. */\n\thasLang: boolean;\n}\n\n/** At most this many enum options render as a tile/chip picker; above it a filterable select is used instead. */\nexport const TILE_MAX = 12;\n\n/** The latitude+longitude+timezone trio the form suppresses in favour of a city search. Centralised so the render path and tests agree. */\nexport const LOCATION_TRIO = ['latitude', 'longitude', 'timezone'] as const;\n\n/**\n * The coordinate pair that DEFINES a location group. `timezone` is deliberately absent.\n *\n * @remarks\n * A group qualifies for a city search on latitude+longitude alone, because a timezone is not always\n * part of the group that owns the coordinates: `generateRelocationChart` carries two coordinate\n * pairs and exactly ONE top-level `timezone`, which is the BIRTH timezone (relocating does not move\n * the birth moment), so the relocation pair correctly has no timezone of its own. Requiring all\n * three would leave that operation rendering raw number inputs, which is the bug this exists to\n * prevent.\n */\nexport const LOCATION_PAIR = ['latitude', 'longitude'] as const;\n\n/**\n * Split a flat coordinate property into its group prefix and canonical leaf name, or `null` when the\n * name is not a prefixed coordinate.\n *\n * @remarks\n * **Two shapes carry two locations in one request and this handles the second one.** Most\n * multi-location operations nest per person (`person1`/`person2`, `personA`/`personB`), so object\n * nesting alone already groups them. `generateRelocationChart` is the only operation in the spec\n * that instead puts both pairs at the TOP level and distinguishes them by a name prefix\n * (`birthLatitude` / `relocationLatitude`). Keying the grouping off the prefix as well as off the\n * nesting means both shapes converge on the same group machinery, and a future `partnerLatitude`\n * needs no code change.\n *\n * Matching is deliberately restricted to the coordinate pair. A prefix is NOT harvested from any\n * other field name, so `birthDate` stays an ordinary field in the flat group and does not invent a\n * phantom `birth` group with a lone date in it.\n */\nexport function splitCoordinateName(\n\tname: string,\n): { group: string; leaf: (typeof LOCATION_PAIR)[number] } | null {\n\tconst m = name.match(/^(.+?)(Latitude|Longitude)$/);\n\tif (!m) return null;\n\treturn {\n\t\tgroup: m[1],\n\t\tleaf: m[2].toLowerCase() as (typeof LOCATION_PAIR)[number],\n\t};\n}\n\n/** Canonical lowercase zodiac set, derived from {@link SIGNS_ORDER} so sign detection and the glyph map can never disagree. */\nconst ZODIAC_LOWER = SIGNS_ORDER.map((s) => s.toLowerCase());\n\n/** Resolve a `$ref` (one hop is all the spec uses) against the schema map; pass non-refs through. */\nexport function resolveSchema(\n\tschema: OpenApiSchema | OpenApiSchemaRef | undefined,\n\tall: Record<string, OpenApiSchema>,\n): OpenApiSchema | undefined {\n\tif (!schema) return undefined;\n\tif ('$ref' in schema && schema.$ref) {\n\t\tconst name = schema.$ref.split('/').pop();\n\t\treturn name ? all[name] : undefined;\n\t}\n\treturn schema as OpenApiSchema;\n}\n\n/**\n * Collapse an `anyOf`/`oneOf` union to the single member that decides the widget: an enum member wins (so `houseSystem` as enum-or-string renders as a picker), then any concrete-typed member (so timezone as number-or-string resolves to a real kind), else the first member. Non-union schemas pass through untouched.\n */\nfunction representative(s: OpenApiSchema): OpenApiSchema {\n\tconst union = s.anyOf ?? s.oneOf;\n\tif (!union || union.length === 0) return s;\n\treturn (\n\t\tunion.find((m) => Array.isArray(m.enum)) ??\n\t\tunion.find((m) => scalarType(m) && scalarType(m) !== 'null') ??\n\t\tunion[0] ??\n\t\ts\n\t);\n}\n\n/**\n * Map one resolved schema to its {@link InputKind}, or `null` when the shape is genuinely unhandled. The form treats `null` as a plain text fallback (never crashes); the taxonomy gate treats it as a failure (forces a decision). Object schemas are never passed here: an object with `properties` expands into a group of leaf fields upstream, so it has no leaf kind of its own.\n */\n/**\n * The single scalar type name a schema resolves to, across both OpenAPI spellings.\n *\n * @remarks\n * OpenAPI 3.1 expresses a nullable scalar as `type: ['number', 'null']` where 3.0 wrote `type: 'number', nullable: true`. Every direct `type === 'number'` comparison silently stops matching the day the served document switches, and the field then classifies as UNHANDLED rather than as a number, which is how a whole form degrades to text boxes without one test noticing. The `null` member carries no input information, so the remaining single member IS the type.\n */\nexport function scalarType(s: OpenApiSchema): string | undefined {\n\tif (typeof s.type === 'string') return s.type;\n\tif (!Array.isArray(s.type)) return undefined;\n\tconst real = s.type.filter((t) => t !== 'null');\n\treturn real.length === 1 ? real[0] : undefined;\n}\n\nexport function classifyInput(schema: OpenApiSchema): InputKind | null {\n\tconst s = representative(schema);\n\tconst type = scalarType(s);\n\tif (Array.isArray(s.enum))\n\t\treturn s.enum.length <= TILE_MAX ? 'tiles' : 'select';\n\tif (type === 'boolean') return 'toggle';\n\tif (s.format === 'date') return 'date';\n\tif (s.format === 'time') return 'time';\n\tif (s.format === 'date-time') return 'datetime';\n\tif (type === 'integer' || type === 'number') return 'number';\n\tif (type === 'string') return 'text';\n\tif (type === 'array') return 'array';\n\treturn null;\n}\n\n/** True when an enum's values are exactly the twelve zodiac signs (case-insensitive), so the tiles can carry sign glyphs. */\nexport function isZodiacEnum(values: readonly string[]): boolean {\n\tif (values.length !== 12) return false;\n\tconst lower = new Set(values.map((v) => v.toLowerCase()));\n\treturn ZODIAC_LOWER.every((s) => lower.has(s));\n}\n\n/** One digested leaf field from a resolved schema. Shared by the flat and grouped construction paths so params and body props carry identical metadata (min/max included). */\nfunction toField(\n\tname: string,\n\tresolved: OpenApiSchema,\n\topts: { key: string; group?: string; required: boolean; inQuery?: boolean },\n): FieldDef {\n\tconst rep = representative(resolved);\n\treturn {\n\t\tkey: opts.key,\n\t\tname,\n\t\tgroup: opts.group,\n\t\tinQuery: opts.inQuery,\n\t\tkind: classifyInput(resolved) ?? 'text',\n\t\trequired: opts.required,\n\t\tdescription: rep.description ?? resolved.description,\n\t\tenum: rep.enum,\n\t\tmin: rep.minimum,\n\t\tmax: rep.maximum,\n\t\tdefault: resolved.default ?? rep.default,\n\t\texample: resolved.example ?? rep.example,\n\t};\n}\n\n/**\n * Digest one operation into the {@link FormModel} the form renders. This is the single construction path: body properties (nested objects expand to `group.sub` keys) and path+query parameters flow through {@link toField} identically, so a query integer keeps its min/max the same as a body integer. The `lang` query parameter is dropped from `fields` and surfaced as {@link FormModel.hasLang} instead.\n */\nexport function buildFormModel(\n\top: OperationSchema,\n\tschemas: Record<string, OpenApiSchema>,\n\tendpoint: string,\n): FormModel {\n\tconst fields: FieldDef[] = [];\n\tlet hasLang = false;\n\n\tconst bodyRef = op.requestBody?.content?.['application/json']?.schema;\n\tconst bodySchema = resolveSchema(bodyRef, schemas);\n\tif (bodySchema?.properties) {\n\t\tconst required = new Set(bodySchema.required ?? []);\n\t\tfor (const [name, sub] of Object.entries(bodySchema.properties)) {\n\t\t\tconst resolved = resolveSchema(sub, schemas) ?? {};\n\t\t\tif (resolved.type === 'object' && resolved.properties) {\n\t\t\t\tconst subRequired = new Set(resolved.required ?? []);\n\t\t\t\tfor (const [subName, subSchema] of Object.entries(\n\t\t\t\t\tresolved.properties,\n\t\t\t\t)) {\n\t\t\t\t\tconst r = resolveSchema(subSchema, schemas) ?? {};\n\t\t\t\t\tfields.push(\n\t\t\t\t\t\ttoField(subName, r, {\n\t\t\t\t\t\t\tkey: `${name}.${subName}`,\n\t\t\t\t\t\t\tgroup: name,\n\t\t\t\t\t\t\trequired: required.has(name) && subRequired.has(subName),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// A prefixed coordinate joins a group named after its prefix and reports the\n\t\t\t\t// canonical leaf name, so the trio logic and the city search match it unchanged.\n\t\t\t\t// `key` stays the ORIGINAL property name because it is the storage and wire\n\t\t\t\t// identity: rewriting it to `birth.latitude` would serialise a body the API\n\t\t\t\t// rejects.\n\t\t\t\tconst coord = splitCoordinateName(name);\n\t\t\t\tfields.push(\n\t\t\t\t\tcoord\n\t\t\t\t\t\t? toField(coord.leaf, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\tgroup: coord.group,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: toField(name, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const param of op.parameters ?? []) {\n\t\tif (param.in !== 'path' && param.in !== 'query') continue;\n\t\t// lang is site-owner chrome, not a visitor field: route it through the\n\t\t// element `lang` attribute, never render it in the form.\n\t\tif (param.name === 'lang' && param.in === 'query') {\n\t\t\thasLang = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst resolved = resolveSchema(param.schema, schemas) ?? {};\n\t\tfields.push(\n\t\t\ttoField(param.name, resolved, {\n\t\t\t\tkey: param.name,\n\t\t\t\trequired: !!param.required,\n\t\t\t\tinQuery: param.in === 'query',\n\t\t\t}),\n\t\t);\n\t}\n\n\treturn { title: deriveTitle(op.summary, endpoint), fields, hasLang };\n}\n\n/**\n * Concise form heading. Prefers the operation summary (spec-authored), taking the clause before the first \" - \" so \"Daily horoscope by zodiac sign - Transit-based forecast\" reads as \"Daily horoscope by zodiac sign\", and falls back to the humanized last path segment.\n */\nexport function deriveTitle(\n\tsummary: string | undefined,\n\tendpoint: string,\n): string {\n\tconst lead = summary?.split(' - ')[0]?.trim();\n\tif (lead) return lead;\n\treturn humanize(endpoint.split('/').pop() ?? '');\n}\n\n/**\n * Outcome-first submit-button label keyed off the endpoint intent. Chart and reading endpoints \"Generate\", divination endpoints \"Cast\", comparison endpoints \"Compare\", and lookup/reading GETs \"Get reading\". A generic verb beats a bare \"Submit\" on a widget a visitor never set up.\n */\nexport function deriveSubmitLabel(endpoint: string): string {\n\tconst e = endpoint.toLowerCase();\n\tif (/compat|synastry|guna|connection|penta|composite/.test(e))\n\t\treturn 'Compare';\n\tif (/\\bcast\\b|\\/draw|iching|hexagram|tarot/.test(e)) return 'Cast';\n\tif (/horoscope|dream|angel|nakshatra|crystal|meaning|reference/.test(e))\n\t\treturn 'Get reading';\n\treturn 'Generate';\n}\n\n/** Deterministic slice filename for one operation, shared by the generator and the runtime loader so both address the same artifact. */\nexport function sliceFileName(method: string, endpoint: string): string {\n\tconst path = endpoint\n\t\t.replace(/^\\//, '')\n\t\t.replace(/[{}]/g, '')\n\t\t.replace(/\\//g, '-');\n\treturn `${method.toLowerCase()}--${path}.json`;\n}\n", "// Generated by scripts/sync-version.ts. Do not edit.\nexport const ROXY_UI_VERSION = '0.27.0';\n"],
4
+ "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { apiLang } from '../i18n/lang.js';\nimport { signGlyph } from '../tokens/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { chevron, disclosureStyles } from '../utils/disclosure.js';\nimport {\n\tbuildFormModel,\n\tderiveSubmitLabel,\n\ttype FieldDef,\n\ttype FormModel,\n\tisZodiacEnum,\n\tLOCATION_PAIR,\n\tLOCATION_TRIO,\n\ttype OpenApiDoc,\n\ttype OperationSchema,\n\tsliceFileName,\n} from '../utils/field-schema.js';\nimport { humanize } from '../utils/string.js';\nimport { ROXY_UI_VERSION } from '../version.js';\n\n/** Production spec, fetched when no slice is available and no explicit `spec-url` is set. */\nconst PROD_SPEC_URL = 'https://roxyapi.com/api/v2/openapi.json';\n\n/** Version-pinned jsDelivr base for the digested per-operation schema slices, mirroring the wrapper CDN pinning so a slice matches the bundle it ships beside. */\nconst SLICE_BASE = `https://cdn.jsdelivr.net/npm/@roxyapi/ui@${ROXY_UI_VERSION}/dist/schemas`;\n\nconst specCache = new Map<string, Promise<OpenApiDoc>>();\n\n/**\n * Drop every cached spec promise.\n\n * @remarks\n * Test-only, and deliberately NOT re-exported from the package entry. The cache is module state shared by every test file in a single `bun test` process, and it only self-evicts on rejection, so one file that resolves a spec leaves a warm entry that silently satisfies a later file assertion about fetching. That made slice-fallback coverage pass or fail purely on file order.\n\n * @internal\n */\nexport function resetSpecCache(): void {\n\tspecCache.clear();\n}\n\nasync function loadSpec(url: string): Promise<OpenApiDoc> {\n\tlet pending = specCache.get(url);\n\tif (!pending) {\n\t\tpending = fetch(url)\n\t\t\t.then(async (res) => {\n\t\t\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\t\t\treturn (await res.json()) as OpenApiDoc;\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\t// Evict the rejected promise BEFORE rethrowing so subsequent\n\t\t\t\t// callers (the user clicking Retry, a remount) hit the network\n\t\t\t\t// again instead of replaying the cached failure forever.\n\t\t\t\tspecCache.delete(url);\n\t\t\t\tthrow err;\n\t\t\t});\n\t\tspecCache.set(url, pending);\n\t}\n\treturn pending;\n}\n\n/** A fresh seed for a hidden `seed` field, so each submit is a new draw unless the caller pinned one. */\nfunction randomSeed(): string {\n\treturn (\n\t\tglobalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2)\n\t);\n}\n\n/** Parse an array-field text value into a real array: JSON when it parses to one, else comma-separated tokens. */\nfunction parseArrayValue(raw: string): unknown {\n\tconst trimmed = raw.trim();\n\tif (!trimmed) return [];\n\ttry {\n\t\tconst parsed = JSON.parse(trimmed);\n\t\tif (Array.isArray(parsed)) return parsed;\n\t} catch {\n\t\t// Not JSON: fall through to comma splitting.\n\t}\n\treturn trimmed\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean);\n}\n\n/**\n * Schema-driven form. Pass `endpoint` (e.g. \"vedic-astrology/birth-chart\"). The form digests the operation's request schema into a spec-derived input for each parameter (a zodiac tile grid, a date or time input, a city search, a toggle) with progressive disclosure, and emits a `roxy-submit` CustomEvent carrying the validated payload. The caller decides what to do (call the SDK, render a chart, navigate).\n *\n * @remarks\n * Schema resolution order: an explicit `spec-url` fetches that full spec and digests it (unchanged, the demo path); otherwise the form tries a small version-pinned per-operation slice from the CDN, and on any miss falls back to fetching the production spec. Each input kind is chosen purely from the parameter shape (see {@link ../utils/field-schema.ts}), so a new endpoint gets a working, on-brand form with no per-endpoint code.\n *\n * The visitor-facing `lang` parameter is never rendered: a site owner sets the element `lang` attribute, and the form routes it to the query string on submit. Optional parameters collapse under one Advanced disclosure; a form whose only required field is an enum submits on selection.\n */\n@customElement('roxy-endpoint-form')\nexport class RoxyEndpointForm extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tdisclosureStyles,\n\t\tcss`form{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.fields{align-items:start;gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));display:grid}.fields:empty{display:none}.person-group{background:var(--roxy-surface,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);min-inline-size:0;margin:0;display:grid}.person-group legend{padding:0 var(--roxy-space-xs,.25rem);font-weight:var(--roxy-weight-bold,600)}.field{gap:var(--roxy-space-xs,.25rem);flex-direction:column;min-width:0;display:flex}.tiles-field{grid-column:1/-1}label,.label{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569)}.req{color:var(--roxy-danger-fg,#991b1b);margin-left:4px}input,select{box-sizing:border-box;width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);font-family:inherit}input:focus,select:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.help{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}.help-details>summary{cursor:pointer;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);align-items:center;gap:4px;display:flex}.help-details .help-lead{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.help-details .help-full{margin-top:var(--roxy-space-xs,.25rem);display:block}.location-block{gap:var(--roxy-space-xs,.25rem);grid-column:1/-1;display:grid}.tiles{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(5.5rem,1fr));display:grid}.tile{min-height:44px;padding:var(--roxy-space-sm,.5rem);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease), background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-direction:column;justify-content:center;align-items:center;gap:2px;display:flex}.tile:hover{border-color:var(--roxy-accent,#f59e0b)}.tile[aria-checked=true]{border-color:var(--roxy-accent,#f59e0b);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 12%, transparent);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.tile:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.tile-glyph{font-size:1.35em;line-height:1}.toggle-row{align-items:center;gap:var(--roxy-space-sm,.5rem);display:flex}.toggle{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);background:var(--roxy-border,#e4e4e7);cursor:pointer;width:44px;height:26px;transition:background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0;padding:0;position:relative}.toggle[aria-checked=true]{background:var(--roxy-accent,#f59e0b);border-color:var(--roxy-accent,#f59e0b)}.toggle .knob{background:var(--roxy-bg,#fff);width:20px;height:20px;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);border-radius:50%;position:absolute;top:2px;left:2px}.toggle[aria-checked=true] .knob{transform:translate(18px)}.toggle:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.toggle-label{cursor:pointer}@media (prefers-reduced-motion:reduce){.tile,.toggle,.toggle .knob{transition:none}}.advanced{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.advanced>summary{cursor:pointer;font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-fg,#0a0a0a);align-items:center;gap:6px;display:flex}.advanced[open]>summary{margin-bottom:var(--roxy-space-md,1rem)}.advanced .fields,.advanced .person-group{margin-top:var(--roxy-space-md,1rem)}.validation-error{gap:var(--roxy-space-xs,.25rem);padding:var(--roxy-space-md,1rem);background:color-mix(in srgb, var(--roxy-danger,#dc2626) 8%, transparent);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);display:grid}button.submit{background:var(--roxy-accent-ink,#b45309);color:var(--roxy-bg,#fff);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-lg,1.5rem);font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600);cursor:pointer;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));border:0;justify-self:start}button.submit:hover{transform:scale(1.02)}button.submit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}@media (prefers-reduced-motion:reduce){button.submit{transition:none}}.spec-error{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}`,\n\t];\n\n\t@property({ type: String, attribute: 'data-endpoint' })\n\tendpoint = 'vedic-astrology/birth-chart';\n\n\t@property({ type: String })\n\tmethod: 'GET' | 'POST' = 'POST';\n\n\t/** Explicit OpenAPI spec URL. When set, the form fetches and digests that full spec (the demo path). When empty, it resolves a version-pinned slice first, then the production spec. */\n\t@property({ type: String, attribute: 'spec-url' })\n\tspecUrl = '';\n\n\t/** Override the submit-button label. Empty derives an outcome-first label from the endpoint. */\n\t@property({ type: String, attribute: 'submit-label' })\n\tsubmitLabel = '';\n\n\t/** Browser-safe publishable key, forwarded to the slotted city search so the natal or synastry form can geocode. */\n\t@property({ type: String, attribute: 'publishable-key' })\n\tpublishableKey?: string;\n\n\t/** Prefill values, keyed by field name (nested per group). Used by `remember` mode and to restore the previous submission. JS property only. */\n\t@property({ attribute: false })\n\tinitialValues?: Record<string, unknown>;\n\n\t@state()\n\tprivate fields: FieldDef[] = [];\n\n\t@state()\n\tprivate formTitle = '';\n\n\t@state()\n\tprivate hasLang = false;\n\n\t@state()\n\tprivate values: Record<string, unknown> = {};\n\n\t@state()\n\tprivate loaded = false;\n\n\t@state()\n\tprivate specError: string | null = null;\n\n\t@state()\n\tprivate validationErrors: string[] = [];\n\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback();\n\t\tvoid this.loadSchema();\n\t}\n\n\tprivate async loadSchema() {\n\t\tthis.specError = null;\n\t\ttry {\n\t\t\tthis.applyModel(await this.resolveModel());\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.specError = message;\n\t\t\tthis.loaded = true;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-spec-error', {\n\t\t\t\t\tdetail: { url: this.specUrl || PROD_SPEC_URL, message },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Resolve the form model: explicit spec-url wins; else a version-pinned slice; else the production spec. */\n\tprivate async resolveModel(): Promise<FormModel> {\n\t\tif (this.specUrl) return this.modelFromSpec(this.specUrl);\n\t\tconst slice = await this.tryLoadSlice();\n\t\treturn slice ?? this.modelFromSpec(PROD_SPEC_URL);\n\t}\n\n\t/** Fetch and digest one operation from a full OpenAPI document. */\n\tprivate async modelFromSpec(url: string): Promise<FormModel> {\n\t\tconst spec = await loadSpec(url);\n\t\tconst path = `/${this.endpoint.replace(/^\\//, '')}`;\n\t\tconst op = spec.paths?.[path]?.[this.method.toLowerCase()] as\n\t\t\t| OperationSchema\n\t\t\t| undefined;\n\t\tif (!op) {\n\t\t\tthrow new Error(\n\t\t\t\t`Endpoint ${this.method} ${path} not found in OpenAPI spec`,\n\t\t\t);\n\t\t}\n\t\treturn buildFormModel(op, spec.components?.schemas ?? {}, this.endpoint);\n\t}\n\n\t/** Try the small precomputed slice; return null on any miss so the caller falls back to the full spec. */\n\tprivate async tryLoadSlice(): Promise<FormModel | null> {\n\t\ttry {\n\t\t\tconst res = await fetch(\n\t\t\t\t`${SLICE_BASE}/${sliceFileName(this.method, this.endpoint)}`,\n\t\t\t);\n\t\t\tif (!res.ok) return null;\n\t\t\treturn (await res.json()) as FormModel;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate applyModel(model: FormModel) {\n\t\tthis.fields = model.fields;\n\t\tthis.formTitle = model.title;\n\t\tthis.hasLang = model.hasLang;\n\t\t// Pre-fill: schema defaults first, then any remembered/initial values (only\n\t\t// for fields this endpoint has) so a stale stored payload from another\n\t\t// endpoint cannot inject unknown keys. Remembered values are nested per\n\t\t// group, so read them by group.\n\t\tconst init: Record<string, unknown> = {};\n\t\tfor (const f of model.fields) {\n\t\t\tif (f.default !== undefined) init[f.key] = f.default;\n\t\t\tconst remembered = f.group\n\t\t\t\t? (\n\t\t\t\t\t\tthis.initialValues?.[f.group] as Record<string, unknown> | undefined\n\t\t\t\t\t)?.[f.name]\n\t\t\t\t: this.initialValues?.[f.name];\n\t\t\tif (remembered !== undefined) init[f.key] = remembered;\n\t\t}\n\t\tthis.values = init;\n\t\tthis.loaded = true;\n\t}\n\n\tprivate retryLoadSchema = () => {\n\t\tthis.loaded = false;\n\t\tthis.specError = null;\n\t\tvoid this.loadSchema();\n\t};\n\n\tprivate setValue(name: string, value: unknown) {\n\t\tthis.values = { ...this.values, [name]: value };\n\t}\n\n\t/** The field's render role: a hidden autogenerated seed, a hidden defaulted limit/offset, a suppressed location coordinate, or a normally rendered input. */\n\tprivate roleOf(\n\t\tf: FieldDef,\n\t): 'seed' | 'hidden-default' | 'location' | 'normal' {\n\t\tif (f.name === 'seed') return 'seed';\n\t\tif ((f.name === 'limit' || f.name === 'offset') && !f.required)\n\t\t\treturn 'hidden-default';\n\t\tif (\n\t\t\t(LOCATION_TRIO as readonly string[]).includes(f.name) &&\n\t\t\tthis.groupHasLocation(f.group)\n\t\t)\n\t\t\treturn 'location';\n\t\t// A flat timezone in a group with no coordinates of its own is still suppressed when a\n\t\t// location group has claimed it, otherwise the prefixed shape shows a raw decimal-hours\n\t\t// box beside two city searches that already know the answer.\n\t\tif (\n\t\t\tf.name === 'timezone' &&\n\t\t\tthis.locationGroups().some((g) => this.timezoneFieldFor(g)?.key === f.key)\n\t\t)\n\t\t\treturn 'location';\n\t\treturn 'normal';\n\t}\n\n\t/** True when the field renders its own input (as opposed to being hidden or replaced by the city search). */\n\tprivate isRendered(f: FieldDef): boolean {\n\t\treturn this.roleOf(f) === 'normal';\n\t}\n\n\t/** Ordered, de-duplicated group keys (undefined flat group plus each named object). */\n\tprivate groupKeys(): (string | undefined)[] {\n\t\tconst keys: (string | undefined)[] = [];\n\t\tfor (const f of this.fields)\n\t\t\tif (!keys.includes(f.group)) keys.push(f.group);\n\t\treturn keys;\n\t}\n\n\t/** True when the fields in `group` (or the flat top level) carry a latitude+longitude pair, so a location-search can autofill them. Timezone is NOT required here, see {@link LOCATION_PAIR}. */\n\tprivate groupHasLocation(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_PAIR.every((n) => inGroup.some((f) => f.name === n));\n\t}\n\n\t/**\n\t * Location groups in field order. Order is load-bearing: when a request carries coordinate\n\t * groups but only ONE unprefixed top-level `timezone`, the FIRST group owns it, because that\n\t * timezone belongs to the primary moment (`generateRelocationChart` has one `timezone` and it is\n\t * the birth timezone). Without an owner both city boxes would write the same key and the second\n\t * pick would silently overwrite the first with the wrong offset.\n\t */\n\tprivate locationGroups(): (string | undefined)[] {\n\t\treturn this.groupKeys().filter((g) => this.groupHasLocation(g));\n\t}\n\n\t/**\n\t * The timezone field a group's city search should fill, or undefined when there is none.\n\t *\n\t * Prefers a timezone inside the group (the nested `person1`/`person2` shape has its own). Falls\n\t * back to an unowned flat `timezone` for the first location group only, which is what makes the\n\t * prefixed shape work without leaving a decimal-hours box for a visitor to guess at.\n\t */\n\tprivate timezoneFieldFor(group?: string): FieldDef | undefined {\n\t\tconst own = this.fields.find(\n\t\t\t(f) => f.group === group && f.name === 'timezone',\n\t\t);\n\t\tif (own) return own;\n\t\tif (this.locationGroups()[0] !== group) return undefined;\n\t\treturn this.fields.find(\n\t\t\t(f) => f.group === undefined && f.name === 'timezone',\n\t\t);\n\t}\n\n\t/**\n\t * True when the location block must show a required mark, i.e. ANY member of the trio is required. The block is a single city-search input that fills all three, so if even one is required (e.g. bodygraph requires `timezone` while `latitude`/`longitude` are optional) the input is required and `collectMissing` blocks submit without it. Requiring ALL three understated that: the asterisk went missing on a block the form still enforced, which reads as optional to a non-technical embedder.\n\t */\n\tprivate locationRequired(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_TRIO.some((n) =>\n\t\t\tinGroup.some((f) => f.name === n && f.required),\n\t\t);\n\t}\n\n\t/** A named group is a required input when any of its leaf fields is required or it carries a location. */\n\tprivate groupIsRequired(group: string): boolean {\n\t\treturn (\n\t\t\tthis.groupHasLocation(group) ||\n\t\t\tthis.fields.some((f) => f.group === group && f.required)\n\t\t);\n\t}\n\n\t/**\n\t * The single visible required enum field, when the whole form reduces to exactly one: no location block, no named group, one required rendered enum. This is what turns the horoscope form into a tap-to-load sign grid; returns null otherwise.\n\t */\n\tprivate get singleEnumField(): FieldDef | null {\n\t\tif (this.groupKeys().some((g) => this.groupHasLocation(g))) return null;\n\t\tif (this.groupKeys().some((g) => g !== undefined)) return null;\n\t\tconst req = this.fields.filter((f) => f.required && this.isRendered(f));\n\t\tconst only = req[0];\n\t\tif (req.length !== 1 || !only) return null;\n\t\treturn only.kind === 'tiles' || only.kind === 'select' ? only : null;\n\t}\n\n\tprivate effectiveSubmitLabel(): string {\n\t\treturn this.submitLabel || deriveSubmitLabel(this.endpoint);\n\t}\n\n\t/**\n\t * The value this form may put on `?lang=`, or undefined to leave the request on the API default.\n\t *\n\t * @remarks\n\t * NOT the raw site language. `?lang=es-AR` is a 400 and `?lang=es` is a 200, and the language now resolves from `<html lang>` rather than only from an attribute a developer typed, so the unfiltered tag reaching the query string would break every regional and every untranslated locale. {@link apiLang} does both narrowings; this method exists so the submit path reads as one call.\n\t */\n\tprivate effectiveLang(): string | undefined {\n\t\treturn apiLang(this);\n\t}\n\n\t/**\n\t * Location-select handler bound to a group: fills that group's coordinate keys plus whichever\n\t * timezone field it owns.\n\t *\n\t * Keys are LOOKED UP from the model rather than built as `group.name`. That assumption held only\n\t * while every group came from object nesting; a prefixed group stores under the original wire\n\t * name (`birthLatitude`), so constructing `birth.latitude` would write a key the request builder\n\t * never reads and the coordinates would silently stay empty.\n\t */\n\tprivate onLocationFor(group?: string) {\n\t\treturn (e: Event) => {\n\t\t\tconst detail = (e as CustomEvent).detail as {\n\t\t\t\tlatitude?: number;\n\t\t\t\tlongitude?: number;\n\t\t\t\ttimezone?: string;\n\t\t\t\tutcOffset?: number;\n\t\t\t};\n\t\t\tif (!detail) return;\n\t\t\tconst keyOf = (name: string) =>\n\t\t\t\tthis.fields.find((f) => f.group === group && f.name === name)?.key;\n\t\t\tconst next: Record<string, unknown> = { ...this.values };\n\t\t\tconst lat = keyOf('latitude');\n\t\t\tconst lon = keyOf('longitude');\n\t\t\tif (lat) next[lat] = detail.latitude;\n\t\t\tif (lon) next[lon] = detail.longitude;\n\t\t\tconst tz = this.timezoneFieldFor(group);\n\t\t\tif (tz) next[tz.key] = detail.timezone ?? detail.utcOffset;\n\t\t\tthis.values = next;\n\t\t};\n\t}\n\n\tprivate selectTile(f: FieldDef, value: string) {\n\t\tthis.setValue(f.key, value);\n\t\tif (this.singleEnumField?.key === f.key) this.submit();\n\t}\n\n\t/** Roving-tabindex arrow-key navigation for a tile radiogroup, modeled on the shared tablist pattern (selection follows focus). */\n\tprivate onTilesKeyDown(f: FieldDef) {\n\t\treturn (e: KeyboardEvent) => {\n\t\t\tconst opts = f.enum ?? [];\n\t\t\tif (opts.length === 0) return;\n\t\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\t\tlet next: number;\n\t\t\tif (e.key === 'Home') next = 0;\n\t\t\telse if (e.key === 'End') next = opts.length - 1;\n\t\t\telse if (e.key === 'ArrowRight' || e.key === 'ArrowDown')\n\t\t\t\tnext = cur === -1 ? 0 : (cur + 1) % opts.length;\n\t\t\telse if (e.key === 'ArrowLeft' || e.key === 'ArrowUp')\n\t\t\t\tnext =\n\t\t\t\t\tcur === -1 ? opts.length - 1 : (cur - 1 + opts.length) % opts.length;\n\t\t\telse return;\n\t\t\te.preventDefault();\n\t\t\tconst value = opts[next];\n\t\t\tif (value === undefined) return;\n\t\t\tthis.selectTile(f, value);\n\t\t\tconst root = e.currentTarget as HTMLElement;\n\t\t\trequestAnimationFrame(() =>\n\t\t\t\troot.querySelector<HTMLButtonElement>(`[data-tile='${next}']`)?.focus(),\n\t\t\t);\n\t\t};\n\t}\n\n\tprivate onSubmit = (e: Event) => {\n\t\te.preventDefault();\n\t\tthis.submit();\n\t};\n\n\t/** Validate, then emit `roxy-submit` with the reconstructed payload, the spec query keys, and whether the form was a single-enum sticky picker. */\n\tprivate submit() {\n\t\tconst missing = this.collectMissing();\n\t\tif (missing.keys.length > 0) {\n\t\t\tthis.validationErrors = missing.labels;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-validation-error', {\n\t\t\t\t\tdetail: { missing: missing.keys },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis.validationErrors = [];\n\t\tconst out: Record<string, unknown> = {};\n\t\tfor (const f of this.fields) {\n\t\t\tlet v = this.values[f.key];\n\t\t\t// A hidden seed autogenerates per submit unless a value was remembered.\n\t\t\tif (f.name === 'seed' && (v === undefined || v === '')) v = randomSeed();\n\t\t\tif (v === undefined || v === '') continue;\n\t\t\tif (f.kind === 'array' && typeof v === 'string') v = parseArrayValue(v);\n\t\t\tif (f.group) {\n\t\t\t\tconst g = (out[f.group] as Record<string, unknown> | undefined) ?? {};\n\t\t\t\tg[f.name] = v;\n\t\t\t\tout[f.group] = g;\n\t\t\t} else {\n\t\t\t\tout[f.name] = v;\n\t\t\t}\n\t\t}\n\t\t// The spec knows which parameters belong in the query string; the listener\n\t\t// does not. Report them (including a site-owner lang) so a POST with a query\n\t\t// parameter reaches the API correctly instead of being dropped in the body.\n\t\tconst queryKeys = this.fields.filter((f) => f.inQuery).map((f) => f.name);\n\t\tconst lang = this.effectiveLang();\n\t\tif (this.hasLang && lang) {\n\t\t\tout.lang = lang;\n\t\t\tqueryKeys.push('lang');\n\t\t}\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('roxy-submit', {\n\t\t\t\tdetail: {\n\t\t\t\t\tendpoint: this.endpoint,\n\t\t\t\t\tvalues: out,\n\t\t\t\t\tqueryKeys,\n\t\t\t\t\tsticky: this.singleEnumField != null,\n\t\t\t\t},\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** Required fields left empty, with the location trio collapsed to one entry per group. Seed and hidden defaults never block. */\n\tprivate collectMissing(): { keys: string[]; labels: string[] } {\n\t\tconst keys: string[] = [];\n\t\tconst labels: string[] = [];\n\t\tconst locGroups = new Set<string | undefined>();\n\t\tfor (const f of this.fields) {\n\t\t\tif (!f.required) continue;\n\t\t\tconst isLocation = this.roleOf(f) === 'location';\n\t\t\tif (!this.isRendered(f) && !isLocation) continue;\n\t\t\tconst v = this.values[f.key];\n\t\t\tif (v !== undefined && v !== '') continue;\n\t\t\tkeys.push(f.key);\n\t\t\tif (isLocation) {\n\t\t\t\tlocGroups.add(f.group);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlabels.push(\n\t\t\t\tf.group ? `${humanize(f.group)} ${humanize(f.name)}` : humanize(f.name),\n\t\t\t);\n\t\t}\n\t\tfor (const g of locGroups) {\n\t\t\tlabels.push(g ? `${humanize(g)} location` : 'Birth location');\n\t\t}\n\t\treturn { keys, labels };\n\t}\n\n\tprivate reqMark(f: FieldDef) {\n\t\treturn f.required\n\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t: nothing;\n\t}\n\n\t/** A description under a field: rendered inline when short, collapsed behind a disclosure showing its first line when long. */\n\tprivate description(f: FieldDef) {\n\t\tif (!f.description) return nothing;\n\t\tif (f.description.length <= 120) {\n\t\t\treturn html`<small class=\"help\">${f.description}</small>`;\n\t\t}\n\t\tconst lead = f.description.split('. ')[0] ?? f.description;\n\t\treturn html`<details class=\"help-details\"><summary><span class=\"help-lead\">${lead}</span>${chevron()}</summary><small class=\"help help-full\">${f.description}</small></details>`;\n\t}\n\n\tprivate renderTiles(f: FieldDef) {\n\t\tconst labelId = `roxy-form-${f.key}-label`;\n\t\tconst zodiac = !!f.enum && isZodiacEnum(f.enum);\n\t\tconst opts = f.enum ?? [];\n\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\tconst active = cur === -1 ? 0 : cur;\n\t\treturn html`<div class=\"field tiles-field\"><span class=\"label\" id=\"${labelId}\">${humanize(f.name)}${this.reqMark(f)}</span><div class=\"tiles\" role=\"radiogroup\" aria-labelledby=\"${labelId}\" @keydown=\"${this.onTilesKeyDown(f)}\">${opts.map((opt, i) => {\n\t\t\t\t\tconst selected = this.values[f.key] === opt;\n\t\t\t\t\tconst glyph = zodiac ? signGlyph(opt) : undefined;\n\t\t\t\t\treturn html`<button type=\"button\" class=\"tile\" role=\"radio\" data-tile=\"${i}\" aria-checked=\"${selected ? 'true' : 'false'}\" tabindex=\"${i === active ? '0' : '-1'}\" @click=\"${() => this.selectTile(f, opt)}\">${\n\t\t\t\t\t\t\tglyph\n\t\t\t\t\t\t\t\t? html`<span class=\"tile-glyph\" aria-hidden=\"true\">${glyph}</span>`\n\t\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t\t} <span class=\"tile-label\">${humanize(opt)}</span></button>`;\n\t\t\t\t})}</div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderSelect(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${humanize(f.name)}${this.reqMark(f)}</label> <select id=\"${id}\" ?required=\"${f.required}\" @change=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(f.key, (e.target as HTMLSelectElement).value)}\"><option value=\"\">Choose</option>${(f.enum ?? []).map(\n\t\t\t\t\t(\n\t\t\t\t\t\topt,\n\t\t\t\t\t) => html`<option value=\"${opt}\" ?selected=\"${this.values[f.key] === opt}\">${humanize(opt)}</option>`,\n\t\t\t\t)}</select> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderToggle(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst checked = this.values[f.key] === true;\n\t\treturn html`<div class=\"field\"><div class=\"toggle-row\"><button type=\"button\" id=\"${id}\" class=\"toggle\" role=\"switch\" aria-checked=\"${checked ? 'true' : 'false'}\" @click=\"${() => this.setValue(f.key, !checked)}\"><span class=\"knob\"></span></button> <label class=\"toggle-label\" for=\"${id}\">${humanize(f.name)}${this.reqMark(f)}</label></div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderInput(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst type =\n\t\t\tf.kind === 'datetime'\n\t\t\t\t? 'datetime-local'\n\t\t\t\t: f.kind === 'number'\n\t\t\t\t\t? 'number'\n\t\t\t\t\t: f.kind;\n\t\tconst placeholder =\n\t\t\tf.kind === 'array'\n\t\t\t\t? 'Comma separated'\n\t\t\t\t: f.example != null\n\t\t\t\t\t? String(f.example)\n\t\t\t\t\t: '';\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${humanize(f.name)}${this.reqMark(f)}</label> <input id=\"${id}\" type=\"${f.kind === 'array' ? 'text' : type}\" ?required=\"${f.required}\" min=\"${ifDefined(f.min)}\" max=\"${ifDefined(f.max)}\" step=\"${f.kind === 'number' ? 'any' : nothing}\" placeholder=\"${placeholder || nothing}\" .value=\"${(this.values[f.key] ?? '') as string}\" @input=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tf.key,\n\t\t\t\t\t\tthis.coerce(f.kind, (e.target as HTMLInputElement).value),\n\t\t\t\t\t)}\"> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderField(f: FieldDef) {\n\t\tswitch (f.kind) {\n\t\t\tcase 'tiles':\n\t\t\t\treturn this.renderTiles(f);\n\t\t\tcase 'select':\n\t\t\t\treturn this.renderSelect(f);\n\t\t\tcase 'toggle':\n\t\t\t\treturn this.renderToggle(f);\n\t\t\tdefault:\n\t\t\t\treturn this.renderInput(f);\n\t\t}\n\t}\n\n\t/**\n\t * The fields this group's city search actually fills, named in the help text.\n\t *\n\t * Not the hardcoded \"latitude, longitude, timezone\" it used to say: a group does not always own a\n\t * timezone. `generateRelocationChart` has one top-level `timezone` that belongs to the birth\n\t * moment, so the relocation block fills coordinates only, and promising a timezone there would be\n\t * a visible lie on the one form that made this method necessary.\n\t */\n\tprivate locationFillList(group?: string): string {\n\t\tconst names = [...LOCATION_PAIR] as string[];\n\t\tif (this.timezoneFieldFor(group)) names.push('timezone');\n\t\treturn names.join(', ');\n\t}\n\n\tprivate locationBlock(group?: string) {\n\t\treturn html`<div class=\"location-block\"><label>${group ? `${humanize(group)} location` : 'Birth location'}${\n\t\t\t\t\tthis.locationRequired(group)\n\t\t\t\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</label><roxy-location-search publishable-key=\"${ifDefined(this.publishableKey)}\" @roxy-location-select=\"${this.onLocationFor(group)}\" placeholder=\"${group ? `${humanize(group)} city` : 'City of birth'}\"></roxy-location-search><small class=\"help\">Fills ${this.locationFillList(group)}. Pick a city to autofill.</small></div>`;\n\t}\n\n\tprivate groupCard(group: string) {\n\t\tconst fields = this.fields.filter(\n\t\t\t(f) => f.group === group && this.isRendered(f),\n\t\t);\n\t\treturn html`<fieldset class=\"person-group\"><legend>${humanize(group)}</legend>${this.groupHasLocation(group) ? this.locationBlock(group) : nothing}<div class=\"fields\">${fields.map((f) => this.renderField(f))}</div></fieldset>`;\n\t}\n\n\trender() {\n\t\tif (!this.loaded) {\n\t\t\treturn html`<form><div class=\"roxy-skeleton\" style=\"height:8rem\"></div></form>`;\n\t\t}\n\t\tif (this.specError) {\n\t\t\treturn html`<div class=\"spec-error\" role=\"alert\">Schema load failed: ${this.specError} <button type=\"button\" class=\"submit\" @click=\"${this.retryLoadSchema}\">Retry</button></div>`;\n\t\t}\n\n\t\tconst flat = this.fields.filter((f) => !f.group && this.isRendered(f));\n\t\tconst flatReq = flat.filter((f) => f.required);\n\t\tconst flatOpt = flat.filter((f) => !f.required);\n\t\tconst named = this.groupKeys().filter((g): g is string => g !== undefined);\n\t\tconst reqGroups = named.filter((g) => this.groupIsRequired(g));\n\t\tconst optGroups = named.filter((g) => !this.groupIsRequired(g));\n\t\tconst hasAdvanced = flatOpt.length > 0 || optGroups.length > 0;\n\n\t\treturn html`<form @submit=\"${this.onSubmit}\"><h2 class=\"title\">${this.formTitle}</h2>${\n\t\t\t\tthis.validationErrors.length > 0\n\t\t\t\t\t? html`<div class=\"validation-error\" role=\"alert\"><strong>Please complete:</strong> ${this.validationErrors.join(', ')}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}<div class=\"fields\">${flatReq.map((f) => this.renderField(f))}</div>${this.groupHasLocation(undefined) ? this.locationBlock(undefined) : nothing} ${reqGroups.map((g) => this.groupCard(g))} ${\n\t\t\t\thasAdvanced\n\t\t\t\t\t? html`<details class=\"advanced\"><summary>Advanced${chevron()}</summary><div class=\"fields\">${flatOpt.map((f) => this.renderField(f))}</div>${optGroups.map((g) => this.groupCard(g))}</details>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tthis.singleEnumField\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<button class=\"submit\" type=\"submit\">${this.effectiveSubmitLabel()}</button>`\n\t\t\t}</form>`;\n\t}\n\n\tprivate coerce(kind: string, v: string): unknown {\n\t\tif (v === '') return undefined;\n\t\tif (kind === 'number') {\n\t\t\tconst n = Number(v);\n\t\t\treturn Number.isFinite(n) ? n : undefined;\n\t\t}\n\t\treturn v;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-endpoint-form': RoxyEndpointForm;\n\t}\n}\n", "// Generated by scripts/sync-bindings.ts (the `lang` query enum in specs/openapi.json). Do not edit.\n\n/**\n * Every language tag the API accepts on `?lang=`.\n *\n * @remarks\n * A self-fetch resolves the site language from the DOM, which means ANY value a\n * host page happens to carry can reach the query string. The API rejects an\n * unlisted tag with a 400, so a page in a language we do not translate would\n * stop working the moment the language chain was completed. Membership is\n * checked against this list before `lang` is sent, and a miss simply omits the\n * parameter, leaving the endpoint on its English default.\n */\nexport const API_LANGUAGES: readonly string[] = [\"de\",\"en\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\"];\n", "/**\n * Where a component's language comes from, and what is safe to send to the API.\n *\n * @remarks\n * Two different answers, and conflating them is the whole reason this file is separate from the catalogue:\n *\n * - {@link resolveLang} answers \"what language is this PAGE in\", and keeps the full tag, because `es-AR` is a legitimate thing for a catalogue to want to differ on.\n * - {@link apiLang} answers \"what may go on the query string\", which is a narrower question with a hard edge: `?lang=es-AR` is a 400, `?lang=es` is a 200.\n *\n * The full tag is not a nicety the catalogue happens to tolerate: `utils/format.ts` hands it to `Intl`, which reads the region and writes `15 de ene de 1990` for `es-AR` where it writes `15 ene 1990` for `es`. Passing the API answer to a formatter demotes every regional visitor to the base language and nothing fails, so the two values are never interchangeable.\n */\n\nimport { API_LANGUAGES } from '../generated/api-languages.js';\n\n/**\n * The site-owner language for an element, resolved through the four-link chain the revamp design specifies.\n *\n * @remarks\n * 1. the element's own `lang` attribute (the explicit per-embed override),\n * 2. the nearest ancestor carrying `lang`, so one wrapper localizes a whole section,\n * 3. `document.documentElement.lang`, which is what makes this work on a real CMS with no markup change at all: WordPress emits `<html lang=\"es-AR\">` on every page of a Spanish site,\n * 4. nothing, which the callers read as English.\n *\n * Only link 1 used to be implemented, so a component on a fully Spanish page rendered English chrome and there was no way to fix it except hand-editing every embed.\n *\n * `navigator.language` is deliberately NOT in the chain. It is the VISITOR's preference, not the site's: it fragments the API cache across every locale a visitor might carry and silently serves two people different content from the same URL.\n *\n * Link 2 uses `closest`, which stops at a shadow boundary. A component composed INSIDE another component's shadow root therefore cannot see the host page, which is why every composing component forwards `lang` to its children explicitly.\n */\nexport function resolveLang(el: HTMLElement): string | undefined {\n\t// Native accessor, never a Lit @property: declaring one would shadow\n\t// HTMLElement.lang and break the platform attribute for every consumer.\n\tif (el.lang) return el.lang;\n\tif (typeof document === 'undefined') return undefined;\n\tconst inherited = el.closest?.('[lang]')?.getAttribute('lang');\n\tif (inherited) return inherited;\n\treturn document.documentElement.lang || undefined;\n}\n\n/**\n * The value safe to put on `?lang=`, or `undefined` to leave the request on the API default.\n *\n * @remarks\n * Two narrowings, both of which are load-bearing the moment {@link resolveLang} starts reading `<html lang>`:\n *\n * - **The region is dropped.** A regional tag is a 400, so a Spanish WordPress site would go from English-but-working to broken the day the language chain was completed. `es-AR`, `es-419` and `ES` all send `es`.\n * - **An unsupported language is omitted, not sent.** The chain now surfaces whatever the host page carries, including languages the API does not translate, and an unlisted tag is the same 400. Omitting it degrades to English, which is the behaviour those pages already had.\n */\nexport function apiLang(el: HTMLElement): string | undefined {\n\tconst tag = resolveLang(el);\n\tif (!tag) return undefined;\n\tconst base = tag.toLowerCase().split('-')[0] as string;\n\treturn API_LANGUAGES.includes(base) ? base : undefined;\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `lookupKey`: the ONE normalizer every lookup table in this library is keyed\n * and read by (`tokens/index.ts` glyphs and abbreviations, `i18n/` chrome\n * strings).\n * - `capitalize`: title-cases the first character, lowercases the rest. A\n * DISPLAY helper only; it is not a lookup key (see `lookupKey`).\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\n/**\n * Fold a name to the canonical key its lookup table is stored under: lower case, every run of spaces, underscores and hyphens collapsed to one space, trimmed.\n *\n * @remarks\n * This exists because a GUESSED key spelling is a defect class this repo has now shipped twice. The glyph tables were keyed off whatever {@link capitalize} happened to produce (`North node`), while the API returns `North Node`, so every call site that reached the table without first calling `capitalize` missed and fell through to a fabricated abbreviation. Aspects hit the same wall from the other side: `/aspects` returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`.\n *\n * One normalizer, applied when a table is DEFINED and again when it is READ, removes the whole class: no call site has to remember a convention, and no table has to guess a spelling. Use it for every new table keyed by an API-supplied name.\n *\n * @example\n * ```ts\n * lookupKey('North Node'); // 'north node'\n * lookupKey('SEMI_SEXTILE'); // 'semi sextile'\n * lookupKey('semi-sextile'); // 'semi sextile'\n * ```\n */\nexport function lookupKey(s: string): string {\n\treturn s\n\t\t.toLowerCase()\n\t\t.replace(/[\\s_-]+/g, ' ')\n\t\t.trim();\n}\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn (\n\t\ts\n\t\t\t.replace(/[_-]+/g, ' ')\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t\t// Split a trailing/embedded digit off a word so \"person1\" reads \"Person 1\"\n\t\t\t// and every group legend and field label spaces its ordinal.\n\t\t\t.replace(/([a-z])([0-9])/g, '$1 $2')\n\t\t\t.replace(/^\\w/, (c) => c.toUpperCase())\n\t);\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n *\n * @remarks\n * **Every table here is keyed by {@link lookupKey} and read ONLY through the accessor beside it.** The raw records are deliberately not exported: a component that indexes a record directly has to guess the key convention, and a guessed spelling is what shipped `No North Node R`, `So South Node R` and `Bl Black Moon Lilith` into a live customer's natal chart. The API returns `North Node` with a space; the table was keyed `North node`, the spelling {@link capitalize} happens to produce, so every call site that forgot to call `capitalize` first missed the table.\n *\n * **A miss returns `undefined`, never a manufactured abbreviation.** The old `?? name.slice(0, 2)` fallback is what made the defect survive review: a failed lookup renders as a plausible two-letter code that reads exactly like an intentional abbreviation, so nothing about the output says \"this is broken\". A caller that can omit the glyph should omit it (`?? ''`); a caller that must show something falls back to the FULL name, which is visibly wrong at the size these slots are drawn.\n *\n * `tests/tokens.test.ts` resolves every body, sign and aspect name the committed spec can emit against these tables, so a vocabulary the API gains cannot ship unglyphed.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Look one name up in a normalized table. The single read path for every map in this file. */\nconst resolve = (\n\ttable: Record<string, string>,\n\tname: string | undefined | null,\n): string | undefined => (name ? table[lookupKey(name)] : undefined);\n\nconst PLANET_GLYPH: Record<string, string> = {\n\tsun: '\u2609',\n\tmoon: '\u263D',\n\tmercury: '\u263F',\n\tvenus: '\u2640',\n\tearth: '\u2641',\n\tmars: '\u2642',\n\tjupiter: '\u2643',\n\tsaturn: '\u2644',\n\turanus: '\u2645',\n\tneptune: '\u2646',\n\tpluto: '\u2647',\n\trahu: '\u260A',\n\tketu: '\u260B',\n\tascendant: 'Asc',\n\tlagna: 'La',\n\t'north node': '\u260A',\n\t'south node': '\u260B',\n\tchiron: '\u26B7',\n\tlilith: '\u26B8',\n\t'black moon lilith': '\u26B8',\n};\n\n/** Astrological glyph for a planet or point, or `undefined` when the library has none for it. */\nexport const planetGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_GLYPH, name);\n\nconst PLANET_ABBR: Record<string, string> = {\n\tsun: 'Su',\n\tmoon: 'Mo',\n\tmercury: 'Me',\n\tvenus: 'Ve',\n\tmars: 'Ma',\n\tjupiter: 'Ju',\n\tsaturn: 'Sa',\n\turanus: 'Ur',\n\tneptune: 'Ne',\n\tpluto: 'Pl',\n\trahu: 'Ra',\n\tketu: 'Ke',\n\tascendant: 'Asc',\n\tlagna: 'La',\n};\n\n/** Two-letter graha code for the tight cells of a North/South Indian kundli, or `undefined`. */\nexport const planetAbbr = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_ABBR, name);\n\nconst SIGN_GLYPH: Record<string, string> = {\n\taries: '\u2648',\n\ttaurus: '\u2649',\n\tgemini: '\u264A',\n\tcancer: '\u264B',\n\tleo: '\u264C',\n\tvirgo: '\u264D',\n\tlibra: '\u264E',\n\tscorpio: '\u264F',\n\tsagittarius: '\u2650',\n\tcapricorn: '\u2651',\n\taquarius: '\u2652',\n\tpisces: '\u2653',\n};\n\n/** Zodiac glyph for a sign name in any case, or `undefined`. */\nexport const signGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(SIGN_GLYPH, name);\n\nconst SIGN_ABBR: Record<string, string> = {\n\taries: 'Ar',\n\ttaurus: 'Ta',\n\tgemini: 'Ge',\n\tcancer: 'Cn',\n\tleo: 'Le',\n\tvirgo: 'Vi',\n\tlibra: 'Li',\n\tscorpio: 'Sc',\n\tsagittarius: 'Sg',\n\tcapricorn: 'Cp',\n\taquarius: 'Aq',\n\tpisces: 'Pi',\n};\n\n/** Two-letter rashi code for kundli cells and grid headers, or `undefined`. */\nexport const signAbbr = (name: string | undefined | null): string | undefined =>\n\tresolve(SIGN_ABBR, name);\n\n/** The twelve signs in zodiacal order. Display values, not lookup keys: read them through {@link signGlyph} / {@link signAbbr}. */\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Glyph per aspect. Used by the natal, transit and synastry aspect tables.\n *\n * @remarks\n * These are the nine aspects Unicode itself defines as a set, in its Miscellaneous Symbols block note: `260C, 26BA, 2220, 26B9, 25A1, 25B3, 26BC, 26BB, 260D` for 0, 30, 45, 60, 90, 120, 135, 150 and 180 degrees. That is exactly the vocabulary the API returns, so every aspect resolves to a real glyph and none falls through to a truncated slug.\n *\n * Do not substitute the visually similar maths operators. Unicode lists `\u22BB` XOR and `\u22BC` NAND as cross-references FROM the real quincunx and semisextile glyphs, so they look like safe stand-ins and are easy to pair the wrong way round, which renders a 150 degree quincunx with the 30 degree semisextile symbol. An astrologer reads the glyph, not the tooltip.\n */\nconst ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\tsemisextile: '\u26BA',\n\t'semi sextile': '\u26BA',\n\tsemisquare: '\u2220',\n\t'semi square': '\u2220',\n\tsextile: '\u26B9',\n\tsquare: '\u25A1',\n\ttrine: '\u25B3',\n\tsesquiquadrate: '\u26BC',\n\tquincunx: '\u26BB',\n\topposition: '\u260D',\n};\n\n/** Aspect glyph for any of the separator forms the endpoints use (`SEMI_SEXTILE`, `SEMI SEXTILE`, `semi-sextile`), or `undefined`. */\nexport const aspectSymbol = (\n\tname: string | undefined | null,\n): string | undefined => resolve(ASPECT_SYMBOL, name);\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nconst TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n};\n\n/** Trigram glyph for a trigram name in any case, or `undefined`. */\nexport const trigramGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(TRIGRAM_GLYPH, name);\n\n/** Moon phase emoji set. Used by the moon phase card. */\nconst MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n\n/**\n * Emoji for a lunar phase, or `undefined`.\n *\n * @remarks\n * The live API suffixes most phase names (`Waxing Gibbous Moon`) and calls the third quarter `Third Quarter Moon`, while only new and full moon carry the suffix in the table. Both reconciliations live here rather than in the card, so any component reading a phase name resolves the same eight phases from the same four spellings.\n */\nexport const moonPhaseEmoji = (\n\tname: string | undefined | null,\n): string | undefined => {\n\tif (!name) return undefined;\n\tconst key = lookupKey(name);\n\tconst bare = key.replace(/ moon$/, '');\n\tconst alias = bare === 'third quarter' ? 'last quarter' : bare;\n\treturn MOON_PHASE_EMOJI[key] ?? MOON_PHASE_EMOJI[alias];\n};\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { TemplateResult } from 'lit';\nimport { css, html } from 'lit';\n\n/**\n * Disclosure chevron for `<details>`/`<summary>` accordions. Replaces the\n * browser default triangle with a thin chevron that rotates when the host\n * `<details>` opens. Render it inside the `<summary>` and pair with\n * {@link disclosureStyles}.\n */\nexport function chevron(): TemplateResult {\n\treturn html`<svg class=\"roxy-chevron\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\"><path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n}\n\n/**\n * Shared `<details>` accordion styling: hides the native disclosure triangle\n * and rotates the {@link chevron} 180 degrees when the accordion is open.\n * Import into any component that renders disclosure accordions so the chevron\n * looks and behaves identically.\n */\nexport const disclosureStyles = css`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;\n", "/**\n * Pure, framework-free schema layer shared by the self-fetch form. It turns one OpenAPI operation into a digested list of {@link FieldDef}s whose {@link InputKind} decides which input widget renders, with zero Lit or DOM dependency so the build-time slice generator ({@link ../../../scripts/build-schemas.ts}) and the taxonomy-coverage test consume the exact same classification the browser does.\n *\n * @remarks\n * The registry is by SHAPE, never by name: {@link classifyInput} inspects `enum` / `type` / `format` only, so a new API parameter gets a working widget with no code change, and the taxonomy gate fails loudly (via a `null` return) the day a genuinely new shape appears. Name-driven behaviour (suppressing `lang`, hiding `seed` / `limit` / `offset`, replacing the latitude+longitude+timezone trio with a city search) is a separate render-time concern layered on top by the form, never encoded here.\n */\n\nimport { SIGNS_ORDER } from '../tokens/index.js';\nimport { humanize } from './string.js';\n\n/** A JSON `$ref` node, before resolution against `components.schemas`. */\nexport interface OpenApiSchemaRef {\n\t$ref?: string;\n}\n\n/** The subset of an OpenAPI 3 schema object the form reads. */\nexport interface OpenApiSchema extends OpenApiSchemaRef {\n\t/** A plain name in 3.0, or an ARRAY in 3.1 where nullability is spelled `['number', 'null']`. Read it through {@link scalarType}, never compare it directly. */\n\ttype?: string | string[];\n\tformat?: string;\n\tdescription?: string;\n\tenum?: string[];\n\tdefault?: unknown;\n\tminimum?: number;\n\tmaximum?: number;\n\tproperties?: Record<string, OpenApiSchema>;\n\trequired?: string[];\n\titems?: OpenApiSchema;\n\texample?: unknown;\n\tanyOf?: OpenApiSchema[];\n\toneOf?: OpenApiSchema[];\n}\n\n/** One operation's request shape, as read from `spec.paths[path][method]`. */\nexport interface OperationSchema {\n\tsummary?: string;\n\trequestBody?: {\n\t\tcontent?: Record<string, { schema?: OpenApiSchema | OpenApiSchemaRef }>;\n\t};\n\tparameters?: Array<{\n\t\tname: string;\n\t\tin: string;\n\t\trequired?: boolean;\n\t\tschema?: OpenApiSchema;\n\t}>;\n}\n\n/** The minimal OpenAPI document surface the form introspects. */\nexport interface OpenApiDoc {\n\tpaths?: Record<string, Record<string, unknown>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/** The fully typed spec document the build-time scripts read from the committed `specs/openapi.json`: every path item value is an {@link OperationSchema}. The runtime form keeps the looser {@link OpenApiDoc} because a live spec fetch is untrusted input it narrows per operation. */\nexport interface SpecDoc {\n\tpaths: Record<string, Record<string, OperationSchema>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/**\n * The widget kind a parameter resolves to. This is the closed set the taxonomy gate enforces: every request parameter in the spec MUST classify to one of these, or {@link classifyInput} returns `null` and the gate fails, forcing a conscious decision when the API grows a new shape.\n */\nexport type InputKind =\n\t| 'tiles'\n\t| 'select'\n\t| 'toggle'\n\t| 'date'\n\t| 'time'\n\t| 'datetime'\n\t| 'number'\n\t| 'text'\n\t| 'array';\n\n/** A single input the form renders, digested from one schema property or parameter. */\nexport interface FieldDef {\n\t/** Unique storage + input key: the property name, or \"group.name\" for a nested object field. */\n\tkey: string;\n\t/** Schema property name (the label source), e.g. \"date\". */\n\tname: string;\n\t/** Parent object key for a nested schema (person1/person2); undefined for a flat field. */\n\tgroup?: string;\n\t/** True when the spec declares the field as `in: query`, so it belongs in the query string even on a POST. */\n\tinQuery?: boolean;\n\t/** The resolved widget kind. */\n\tkind: InputKind;\n\trequired: boolean;\n\tdescription?: string;\n\tenum?: string[];\n\tmin?: number;\n\tmax?: number;\n\tdefault?: unknown;\n\t/** Spec `example`, used as the placeholder for a text input. */\n\texample?: unknown;\n}\n\n/** The digested form model for one operation. The build-time slice is exactly this shape. */\nexport interface FormModel {\n\t/** Concise heading derived from the operation summary, falling back to the path. */\n\ttitle: string;\n\t/** Every rendered field. The `lang` query parameter is intentionally excluded (routed via the element `lang` attribute instead). */\n\tfields: FieldDef[];\n\t/** True when the operation carries a `lang` query parameter, so the form knows to route an effective language to the query string on submit. */\n\thasLang: boolean;\n}\n\n/** At most this many enum options render as a tile/chip picker; above it a filterable select is used instead. */\nexport const TILE_MAX = 12;\n\n/** The latitude+longitude+timezone trio the form suppresses in favour of a city search. Centralised so the render path and tests agree. */\nexport const LOCATION_TRIO = ['latitude', 'longitude', 'timezone'] as const;\n\n/**\n * The coordinate pair that DEFINES a location group. `timezone` is deliberately absent.\n *\n * @remarks\n * A group qualifies for a city search on latitude+longitude alone, because a timezone is not always\n * part of the group that owns the coordinates: `generateRelocationChart` carries two coordinate\n * pairs and exactly ONE top-level `timezone`, which is the BIRTH timezone (relocating does not move\n * the birth moment), so the relocation pair correctly has no timezone of its own. Requiring all\n * three would leave that operation rendering raw number inputs, which is the bug this exists to\n * prevent.\n */\nexport const LOCATION_PAIR = ['latitude', 'longitude'] as const;\n\n/**\n * Split a flat coordinate property into its group prefix and canonical leaf name, or `null` when the\n * name is not a prefixed coordinate.\n *\n * @remarks\n * **Two shapes carry two locations in one request and this handles the second one.** Most\n * multi-location operations nest per person (`person1`/`person2`, `personA`/`personB`), so object\n * nesting alone already groups them. `generateRelocationChart` is the only operation in the spec\n * that instead puts both pairs at the TOP level and distinguishes them by a name prefix\n * (`birthLatitude` / `relocationLatitude`). Keying the grouping off the prefix as well as off the\n * nesting means both shapes converge on the same group machinery, and a future `partnerLatitude`\n * needs no code change.\n *\n * Matching is deliberately restricted to the coordinate pair. A prefix is NOT harvested from any\n * other field name, so `birthDate` stays an ordinary field in the flat group and does not invent a\n * phantom `birth` group with a lone date in it.\n */\nexport function splitCoordinateName(\n\tname: string,\n): { group: string; leaf: (typeof LOCATION_PAIR)[number] } | null {\n\tconst m = name.match(/^(.+?)(Latitude|Longitude)$/);\n\tif (!m) return null;\n\treturn {\n\t\tgroup: m[1],\n\t\tleaf: m[2].toLowerCase() as (typeof LOCATION_PAIR)[number],\n\t};\n}\n\n/** Canonical lowercase zodiac set, derived from {@link SIGNS_ORDER} so sign detection and the glyph map can never disagree. */\nconst ZODIAC_LOWER = SIGNS_ORDER.map((s) => s.toLowerCase());\n\n/** Resolve a `$ref` (one hop is all the spec uses) against the schema map; pass non-refs through. */\nexport function resolveSchema(\n\tschema: OpenApiSchema | OpenApiSchemaRef | undefined,\n\tall: Record<string, OpenApiSchema>,\n): OpenApiSchema | undefined {\n\tif (!schema) return undefined;\n\tif ('$ref' in schema && schema.$ref) {\n\t\tconst name = schema.$ref.split('/').pop();\n\t\treturn name ? all[name] : undefined;\n\t}\n\treturn schema as OpenApiSchema;\n}\n\n/**\n * Collapse an `anyOf`/`oneOf` union to the single member that decides the widget: an enum member wins (so `houseSystem` as enum-or-string renders as a picker), then any concrete-typed member (so timezone as number-or-string resolves to a real kind), else the first member. Non-union schemas pass through untouched.\n */\nfunction representative(s: OpenApiSchema): OpenApiSchema {\n\tconst union = s.anyOf ?? s.oneOf;\n\tif (!union || union.length === 0) return s;\n\treturn (\n\t\tunion.find((m) => Array.isArray(m.enum)) ??\n\t\tunion.find((m) => scalarType(m) && scalarType(m) !== 'null') ??\n\t\tunion[0] ??\n\t\ts\n\t);\n}\n\n/**\n * Map one resolved schema to its {@link InputKind}, or `null` when the shape is genuinely unhandled. The form treats `null` as a plain text fallback (never crashes); the taxonomy gate treats it as a failure (forces a decision). Object schemas are never passed here: an object with `properties` expands into a group of leaf fields upstream, so it has no leaf kind of its own.\n */\n/**\n * The single scalar type name a schema resolves to, across both OpenAPI spellings.\n *\n * @remarks\n * OpenAPI 3.1 expresses a nullable scalar as `type: ['number', 'null']` where 3.0 wrote `type: 'number', nullable: true`. Every direct `type === 'number'` comparison silently stops matching the day the served document switches, and the field then classifies as UNHANDLED rather than as a number, which is how a whole form degrades to text boxes without one test noticing. The `null` member carries no input information, so the remaining single member IS the type.\n */\nexport function scalarType(s: OpenApiSchema): string | undefined {\n\tif (typeof s.type === 'string') return s.type;\n\tif (!Array.isArray(s.type)) return undefined;\n\tconst real = s.type.filter((t) => t !== 'null');\n\treturn real.length === 1 ? real[0] : undefined;\n}\n\nexport function classifyInput(schema: OpenApiSchema): InputKind | null {\n\tconst s = representative(schema);\n\tconst type = scalarType(s);\n\tif (Array.isArray(s.enum))\n\t\treturn s.enum.length <= TILE_MAX ? 'tiles' : 'select';\n\tif (type === 'boolean') return 'toggle';\n\tif (s.format === 'date') return 'date';\n\tif (s.format === 'time') return 'time';\n\tif (s.format === 'date-time') return 'datetime';\n\tif (type === 'integer' || type === 'number') return 'number';\n\tif (type === 'string') return 'text';\n\tif (type === 'array') return 'array';\n\treturn null;\n}\n\n/** True when an enum's values are exactly the twelve zodiac signs (case-insensitive), so the tiles can carry sign glyphs. */\nexport function isZodiacEnum(values: readonly string[]): boolean {\n\tif (values.length !== 12) return false;\n\tconst lower = new Set(values.map((v) => v.toLowerCase()));\n\treturn ZODIAC_LOWER.every((s) => lower.has(s));\n}\n\n/** One digested leaf field from a resolved schema. Shared by the flat and grouped construction paths so params and body props carry identical metadata (min/max included). */\nfunction toField(\n\tname: string,\n\tresolved: OpenApiSchema,\n\topts: { key: string; group?: string; required: boolean; inQuery?: boolean },\n): FieldDef {\n\tconst rep = representative(resolved);\n\treturn {\n\t\tkey: opts.key,\n\t\tname,\n\t\tgroup: opts.group,\n\t\tinQuery: opts.inQuery,\n\t\tkind: classifyInput(resolved) ?? 'text',\n\t\trequired: opts.required,\n\t\tdescription: rep.description ?? resolved.description,\n\t\tenum: rep.enum,\n\t\tmin: rep.minimum,\n\t\tmax: rep.maximum,\n\t\tdefault: resolved.default ?? rep.default,\n\t\texample: resolved.example ?? rep.example,\n\t};\n}\n\n/**\n * Digest one operation into the {@link FormModel} the form renders. This is the single construction path: body properties (nested objects expand to `group.sub` keys) and path+query parameters flow through {@link toField} identically, so a query integer keeps its min/max the same as a body integer. The `lang` query parameter is dropped from `fields` and surfaced as {@link FormModel.hasLang} instead.\n */\nexport function buildFormModel(\n\top: OperationSchema,\n\tschemas: Record<string, OpenApiSchema>,\n\tendpoint: string,\n): FormModel {\n\tconst fields: FieldDef[] = [];\n\tlet hasLang = false;\n\n\tconst bodyRef = op.requestBody?.content?.['application/json']?.schema;\n\tconst bodySchema = resolveSchema(bodyRef, schemas);\n\tif (bodySchema?.properties) {\n\t\tconst required = new Set(bodySchema.required ?? []);\n\t\tfor (const [name, sub] of Object.entries(bodySchema.properties)) {\n\t\t\tconst resolved = resolveSchema(sub, schemas) ?? {};\n\t\t\tif (resolved.type === 'object' && resolved.properties) {\n\t\t\t\tconst subRequired = new Set(resolved.required ?? []);\n\t\t\t\tfor (const [subName, subSchema] of Object.entries(\n\t\t\t\t\tresolved.properties,\n\t\t\t\t)) {\n\t\t\t\t\tconst r = resolveSchema(subSchema, schemas) ?? {};\n\t\t\t\t\tfields.push(\n\t\t\t\t\t\ttoField(subName, r, {\n\t\t\t\t\t\t\tkey: `${name}.${subName}`,\n\t\t\t\t\t\t\tgroup: name,\n\t\t\t\t\t\t\trequired: required.has(name) && subRequired.has(subName),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// A prefixed coordinate joins a group named after its prefix and reports the\n\t\t\t\t// canonical leaf name, so the trio logic and the city search match it unchanged.\n\t\t\t\t// `key` stays the ORIGINAL property name because it is the storage and wire\n\t\t\t\t// identity: rewriting it to `birth.latitude` would serialise a body the API\n\t\t\t\t// rejects.\n\t\t\t\tconst coord = splitCoordinateName(name);\n\t\t\t\tfields.push(\n\t\t\t\t\tcoord\n\t\t\t\t\t\t? toField(coord.leaf, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\tgroup: coord.group,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: toField(name, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const param of op.parameters ?? []) {\n\t\tif (param.in !== 'path' && param.in !== 'query') continue;\n\t\t// lang is site-owner chrome, not a visitor field: route it through the\n\t\t// element `lang` attribute, never render it in the form.\n\t\tif (param.name === 'lang' && param.in === 'query') {\n\t\t\thasLang = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst resolved = resolveSchema(param.schema, schemas) ?? {};\n\t\tfields.push(\n\t\t\ttoField(param.name, resolved, {\n\t\t\t\tkey: param.name,\n\t\t\t\trequired: !!param.required,\n\t\t\t\tinQuery: param.in === 'query',\n\t\t\t}),\n\t\t);\n\t}\n\n\treturn { title: deriveTitle(op.summary, endpoint), fields, hasLang };\n}\n\n/**\n * Concise form heading. Prefers the operation summary (spec-authored), taking the clause before the first \" - \" so \"Daily horoscope by zodiac sign - Transit-based forecast\" reads as \"Daily horoscope by zodiac sign\", and falls back to the humanized last path segment.\n */\nexport function deriveTitle(\n\tsummary: string | undefined,\n\tendpoint: string,\n): string {\n\tconst lead = summary?.split(' - ')[0]?.trim();\n\tif (lead) return lead;\n\treturn humanize(endpoint.split('/').pop() ?? '');\n}\n\n/**\n * Outcome-first submit-button label keyed off the endpoint intent. Chart and reading endpoints \"Generate\", divination endpoints \"Cast\", comparison endpoints \"Compare\", and lookup/reading GETs \"Get reading\". A generic verb beats a bare \"Submit\" on a widget a visitor never set up.\n */\nexport function deriveSubmitLabel(endpoint: string): string {\n\tconst e = endpoint.toLowerCase();\n\tif (/compat|synastry|guna|connection|penta|composite/.test(e))\n\t\treturn 'Compare';\n\tif (/\\bcast\\b|\\/draw|iching|hexagram|tarot/.test(e)) return 'Cast';\n\tif (/horoscope|dream|angel|nakshatra|crystal|meaning|reference/.test(e))\n\t\treturn 'Get reading';\n\treturn 'Generate';\n}\n\n/** Deterministic slice filename for one operation, shared by the generator and the runtime loader so both address the same artifact. */\nexport function sliceFileName(method: string, endpoint: string): string {\n\tconst path = endpoint\n\t\t.replace(/^\\//, '')\n\t\t.replace(/[{}]/g, '')\n\t\t.replace(/\\//g, '-');\n\treturn `${method.toLowerCase()}--${path}.json`;\n}\n", "// Generated by scripts/sync-version.ts. Do not edit.\nexport const ROXY_UI_VERSION = '0.27.1';\n"],
5
5
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,KAAM,OAAQ,UAAW,eAAgB,CAAC,GAP1C7E,EAQZ,wBAGA4E,EAAA,CADCC,EAAS,CAAE,KAAM,MAAO,CAAC,GAVd7E,EAWZ,sBAIA4E,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,UAAW,CAAC,GAdrC7E,EAeZ,uBAIA4E,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,cAAe,CAAC,GAlBzC7E,EAmBZ,2BAIA4E,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,iBAAkB,CAAC,GAtB5C7E,EAuBZ,8BAIA4E,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GA1BlB7E,EA2BZ,6BAGQ4E,EAAA,CADPE,EAAM,GA7BK9E,EA8BJ,sBAGA4E,EAAA,CADPE,EAAM,GAhCK9E,EAiCJ,yBAGA4E,EAAA,CADPE,EAAM,GAnCK9E,EAoCJ,uBAGA4E,EAAA,CADPE,EAAM,GAtCK9E,EAuCJ,sBAGA4E,EAAA,CADPE,EAAM,GAzCK9E,EA0CJ,sBAGA4E,EAAA,CADPE,EAAM,GA5CK9E,EA6CJ,yBAGA4E,EAAA,CADPE,EAAM,GA/CK9E,EAgDJ,gCAhDIA,EAAN4E,EAAA,CADNG,GAAc,oBAAoB,GACtB/E",
6
6
  "names": ["css", "html", "LitElement", "nothing", "customElement", "property", "state", "ifDefined", "API_LANGUAGES", "resolveLang", "el", "inherited", "apiLang", "tag", "base", "API_LANGUAGES", "lookupKey", "s", "humanize", "s", "c", "resolve", "table", "name", "lookupKey", "SIGN_GLYPH", "signGlyph", "name", "resolve", "SIGNS_ORDER", "css", "baseStyles", "css", "html", "chevron", "disclosureStyles", "TILE_MAX", "LOCATION_TRIO", "LOCATION_PAIR", "splitCoordinateName", "name", "m", "ZODIAC_LOWER", "SIGNS_ORDER", "s", "resolveSchema", "schema", "all", "representative", "union", "scalarType", "real", "t", "classifyInput", "type", "isZodiacEnum", "values", "lower", "v", "toField", "resolved", "opts", "rep", "buildFormModel", "op", "schemas", "endpoint", "fields", "hasLang", "bodyRef", "bodySchema", "required", "sub", "subRequired", "subName", "subSchema", "r", "coord", "param", "deriveTitle", "summary", "lead", "humanize", "deriveSubmitLabel", "e", "sliceFileName", "method", "path", "ROXY_UI_VERSION", "PROD_SPEC_URL", "SLICE_BASE", "ROXY_UI_VERSION", "specCache", "resetSpecCache", "loadSpec", "url", "pending", "res", "err", "randomSeed", "parseArrayValue", "raw", "trimmed", "parsed", "s", "RoxyEndpointForm", "LitElement", "message", "spec", "path", "op", "buildFormModel", "sliceFileName", "model", "init", "f", "remembered", "name", "value", "LOCATION_TRIO", "g", "keys", "group", "inGroup", "LOCATION_PAIR", "n", "own", "req", "only", "deriveSubmitLabel", "apiLang", "e", "detail", "keyOf", "next", "lat", "lon", "tz", "opts", "cur", "root", "missing", "out", "v", "queryKeys", "lang", "labels", "locGroups", "isLocation", "humanize", "html", "nothing", "lead", "chevron", "labelId", "zodiac", "isZodiacEnum", "active", "opt", "i", "selected", "glyph", "signGlyph", "id", "checked", "type", "placeholder", "ifDefined", "names", "fields", "flat", "flatReq", "flatOpt", "named", "reqGroups", "optGroups", "hasAdvanced", "kind", "baseStyles", "disclosureStyles", "css", "__decorateClass", "property", "state", "customElement"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ephemeris-table.d.ts","sourceRoot":"","sources":["../../src/components/ephemeris-table.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,2BAA2B,EAC3B,mCAAmC,EACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAoB3D;;;;;GAKG;AACH,KAAK,iBAAiB,GACnB,mCAAmC,GACnC,2BAA2B,CAAC;AAiD/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBACa,kBAAmB,SAAQ,eAAe,CAAC,iBAAiB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