hyperclayjs 1.28.0 → 1.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -87,7 +87,7 @@ import 'hyperclayjs/presets/standard.js';
87
87
  | Module | Size | Description |
88
88
  |--------|------|-------------|
89
89
  | dialogs | 8.5KB | ask(), consent(), tell(), snippet() dialog functions |
90
- | the-modal | 22.5KB | Full modal window creation system - window.theModal |
90
+ | the-modal | 22.8KB | Full modal window creation system - window.theModal |
91
91
  | toast | 15.8KB | Success/error message notifications, toast(msg, msgType) |
92
92
 
93
93
  ### Utilities (Core utilities (often auto-included))
@@ -97,7 +97,7 @@ import 'hyperclayjs/presets/standard.js';
97
97
  | cache-bust | 0.6KB | Cache-bust href/src attributes |
98
98
  | cookie | 1.4KB | Cookie management (often auto-included) |
99
99
  | debounce | 0.7KB | Function debouncing |
100
- | mutation | 13.8KB | DOM mutation observation (often auto-included) |
100
+ | mutation | 14.7KB | DOM mutation observation (often auto-included) |
101
101
  | nearest | 3.4KB | Find nearest elements (often auto-included) |
102
102
  | throttle | 1.3KB | Function throttling |
103
103
 
@@ -130,8 +130,8 @@ import 'hyperclayjs/presets/standard.js';
130
130
 
131
131
  | Module | Size | Description |
132
132
  |--------|------|-------------|
133
- | hyper-html-api | 14.6KB | Declarative extract/apply engine driven by a rules tag — foundation for CMS and upgrade flows |
134
133
  | hyper-morph | 18.7KB | DOM morphing with content-based element matching |
134
+ | hypercms | 88.7KB | Live edit-in-place CMS sidebar driven by a hyper-html-api rules tag. Pairs with [sortable] and [hyper-morph]. |
135
135
 
136
136
  ## Presets
137
137
 
@@ -145,7 +145,7 @@ Standard feature set for most use cases
145
145
 
146
146
  **Modules:** `save-core`, `snapshot`, `save-system`, `unsaved-warning`, `edit-mode-helpers`, `persist`, `option-visibility`, `event-attrs`, `dom-helpers`, `toast`, `save-toast`, `export-to-window`, `view-mode-excludes-edit-modules`
147
147
 
148
- ### Everything (~262KB)
148
+ ### Everything (~337.3KB)
149
149
  All available features
150
150
 
151
151
  Includes all available modules across all categories.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperclayjs",
3
- "version": "1.28.0",
3
+ "version": "1.28.2",
4
4
  "description": "Modular JavaScript library for building interactive malleable HTML files with Hyperclay",
5
5
  "type": "module",
6
6
  "main": "src/hyperclay.js",
package/src/hyperclay.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * DO NOT EDIT THIS FILE DIRECTLY — it is generated from build/hyperclay.template.js
3
3
  *
4
- * HyperclayJS v1.28.0 - Minimal Browser-Native Loader
4
+ * HyperclayJS v1.28.2 - Minimal Browser-Native Loader
5
5
  *
6
6
  * Modules auto-init when imported (no separate init call needed).
7
7
  * Include `export-to-window` feature to export to window.hyperclay.
@@ -61,7 +61,7 @@ const MODULE_PATHS = {
61
61
  "style-injection": "./dom-utilities/insertStyleTag.js",
62
62
  "form-data": "./dom-utilities/getDataFromForm.js",
63
63
  "hyper-morph": "./vendor/hyper-morph.vendor.js",
64
- "hyper-html-api": "./vendor/hyper-html-api.vendor.js",
64
+ "hypercms": "./vendor/hypercms.vendor.js",
65
65
  "slugify": "./string-utilities/slugify.js",
66
66
  "copy-to-clipboard": "./string-utilities/copy-to-clipboard.js",
67
67
  "query-params": "./string-utilities/query.js",
@@ -140,6 +140,7 @@ const PRESETS = {
140
140
  "all-js",
141
141
  "style-injection",
142
142
  "form-data",
143
+ "hypercms",
143
144
  "slugify",
144
145
  "copy-to-clipboard",
145
146
  "query-params",
@@ -188,7 +189,7 @@ const PRESETS = {
188
189
  "style-injection",
189
190
  "form-data",
190
191
  "hyper-morph",
191
- "hyper-html-api",
192
+ "hypercms",
192
193
  "slugify",
193
194
  "copy-to-clipboard",
194
195
  "query-params",
@@ -339,7 +340,7 @@ export const insertStyleTag = window.hyperclayModules['style-injection']?.insert
339
340
  export const getDataFromForm = window.hyperclayModules['form-data']?.getDataFromForm ?? window.hyperclayModules['form-data']?.default;
340
341
  export const HyperMorph = window.hyperclayModules['hyper-morph']?.HyperMorph ?? window.hyperclayModules['hyper-morph']?.default;
341
342
  export const morph = window.hyperclayModules['hyper-morph']?.morph ?? window.hyperclayModules['hyper-morph']?.default;
342
- export const HyperHtmlApi = window.hyperclayModules['hyper-html-api']?.HyperHtmlApi ?? window.hyperclayModules['hyper-html-api']?.default;
343
+ export const cms = window.hyperclayModules['hypercms']?.cms ?? window.hyperclayModules['hypercms']?.default;
343
344
  export const slugify = window.hyperclayModules['slugify']?.slugify ?? window.hyperclayModules['slugify']?.default;
344
345
  export const copyToClipboard = window.hyperclayModules['copy-to-clipboard']?.copyToClipboard ?? window.hyperclayModules['copy-to-clipboard']?.default;
345
346
  export const query = window.hyperclayModules['query-params']?.query ?? window.hyperclayModules['query-params']?.default;
package/src/ui/prompts.js CHANGED
@@ -114,7 +114,9 @@ export function tell(promptText, ...content) {
114
114
  * Display a modal with a code snippet and copy functionality
115
115
  * @param {string} title - The modal heading
116
116
  * @param {string} content - The code to display
117
- * @param {string} extraContent - Optional warning/info text below the copy button
117
+ * @param {string} extraContent - Optional raw HTML rendered below the copy button.
118
+ * Callers style their own container; use `<div class="snippet-warning">…</div>`
119
+ * for the standard yellow-bordered warning box.
118
120
  */
119
121
  export function snippet(title, content, extraContent = '') {
120
122
 
@@ -126,11 +128,7 @@ export function snippet(title, content, extraContent = '') {
126
128
 
127
129
  <button type="button" class="micromodal__secondary-btn copy-snippet-btn" style="margin-bottom: 14px;">copy</button>
128
130
 
129
- ${extraContent ? `
130
- <div class="snippet-warning">
131
- ${extraContent}
132
- </div>
133
- ` : ''}
131
+ ${extraContent || ''}
134
132
  `;
135
133
 
136
134
  // Use the existing modal system
@@ -530,6 +530,23 @@ const modalCss = `<style class="micromodal-css">
530
530
  max-width: 420px;
531
531
  }
532
532
 
533
+ .micromodal .snippet-link-box {
534
+ padding: 0.75rem;
535
+ border: 2px solid #F6F7F9;
536
+ background-color: transparent;
537
+ font-size: 0.875rem;
538
+ margin-top: 0.75rem;
539
+ }
540
+
541
+ .micromodal .snippet-link-box a {
542
+ color: #F6F7F9;
543
+ text-decoration: underline;
544
+ }
545
+
546
+ .micromodal .snippet-link-box a:hover {
547
+ color: #E5E7EB;
548
+ }
549
+
533
550
  .micromodal button.micromodal__close {
534
551
  clip-path: polygon(0% 4%, 0% 0%, 100% 0%, 100% 100%, 94% 100%);
535
552
  position: absolute;
@@ -280,7 +280,7 @@ const Mutation = {
280
280
  if (node.nodeType === 1 && !this._shouldIgnore(node)) {
281
281
  const removedNodes = [node, ...node.querySelectorAll('*')];
282
282
  this._log(`Processing ${removedNodes.length} removed nodes`, { removedNodes });
283
-
283
+
284
284
  for (const element of removedNodes) {
285
285
  const change = {
286
286
  type: 'remove',
@@ -294,6 +294,29 @@ const Mutation = {
294
294
  }
295
295
  }
296
296
  }
297
+
298
+ // Bubble text-node child changes (e.g. `el.textContent = 'foo'`) up
299
+ // to the parent element so onAnyChange fires. Typed callbacks
300
+ // (addElement, removeElement) stay element-only by design.
301
+ let hasTextNodeChanges = false;
302
+ for (const node of mutation.addedNodes) {
303
+ if (node.nodeType === 3) { hasTextNodeChanges = true; break; }
304
+ }
305
+ if (!hasTextNodeChanges) {
306
+ for (const node of mutation.removedNodes) {
307
+ if (node.nodeType === 3) { hasTextNodeChanges = true; break; }
308
+ }
309
+ }
310
+ if (hasTextNodeChanges && mutation.target.nodeType === 1) {
311
+ const change = {
312
+ type: 'characterData',
313
+ element: mutation.target,
314
+ oldValue: undefined,
315
+ newValue: mutation.target.textContent
316
+ };
317
+ changes.push(change);
318
+ changesByType.characterData.push(change);
319
+ }
297
320
  }
298
321
 
299
322
  if (mutation.type === 'attributes') {
@@ -404,7 +427,8 @@ const Mutation = {
404
427
  attributes: true,
405
428
  subtree: true,
406
429
  characterData: true,
407
- attributeOldValue: true
430
+ attributeOldValue: true,
431
+ characterDataOldValue: true
408
432
  });
409
433
  this._observing = true;
410
434
  this._log('Observation started');
@@ -0,0 +1,374 @@
1
+ var hypercms=(()=>{var De=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var Ar=Object.getOwnPropertyNames;var vr=Object.prototype.hasOwnProperty;var Be=(e,t)=>{for(var r in t)De(e,r,{get:t[r],enumerable:!0})},Er=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ar(t))!vr.call(e,s)&&s!==r&&De(e,s,{get:()=>t[s],enumerable:!(n=Sr(t,s))||n.enumerable});return e};var Mr=e=>Er(De({},"__esModule",{value:!0}),e);var As={};Be(As,{cms:()=>bs,default:()=>Ss});var xe=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],Ue=new Set(xe),At=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),vt=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]);var Te={};Be(Te,{EmptyListInsert:()=>he,MAX_RULE_DEPTH:()=>se,MaxRuleDepthExceeded:()=>ee,RuleTargetReadOnly:()=>me,RulesParseError:()=>ne,ShapeMismatch:()=>fe,UnknownRulesVersion:()=>de,UpgradeAlreadyRegistered:()=>we});var ne=class extends Error{constructor(t,r){super(t),this.name="RulesParseError",this.cause=r}},de=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=t}},se=20,ee=class extends Error{constructor(t){super(`rule depth exceeded ${se} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},fe=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},he=class extends Error{constructor(t){super(`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},me=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}},we=class extends Error{constructor(){super("upgrade transform already registered; only one registration is allowed per page."),this.name="UpgradeAlreadyRegistered"}};function te(e,t,r,n={}){return We(e,t,r,{depth:0,path:[]},n)}function We(e,t,r,n,s){if(n.depth>se)throw new ee(n.path);if(typeof r=="string")return xr(e,t,r,s);if(Array.isArray(r)){let[o,u]=r;return e.find(t,o,s).map((f,y)=>We(e,f,u,{depth:n.depth+1,path:[...n.path,y]},s))}if(typeof r=="object"&&r!==null){let o={};for(let[u,l]of Object.entries(r))o[u]=We(e,t,l,{depth:n.depth+1,path:[...n.path,u]},s);return o}return null}function xr(e,t,r,n){if(r.endsWith("[]")){let o=r.slice(0,-2);return e.find(t,o,n).map(u=>e.text(u))}if(r.startsWith("@"))return Et(e,t,r.slice(1));if(r.includes("@")){let o=r.lastIndexOf("@"),u=r.slice(0,o),l=r.slice(o+1),f=u?e.find(t,u,n):[t];return f.length===0?null:Et(e,f[0],l)}if(r===".")return e.text(t);let s=e.find(t,r,n);return s.length===0?null:e.text(s[0])}function Et(e,t,r){if(Ue.has(r)){let s=e.prop(t,r);return s==null?null:String(s)}let n=e.attr(t,r);return n||null}var wr=.5;function Ve(e,t,r,n,s,o,u,l={}){let f=e.find(t,r,l);if(s.length===0){f.forEach(T=>e.remove(T));return}let y=s.length>f.length,v=f[0]||null;if(y&&!v&&(v=Cr(e,t,r,l),!v))throw new he(o.path);let b=f.map(T=>Tr(e,T,n,l)),S=null;if(v){S=e.clone(v),l.templateAttr&&e.removeAttr(S,l.templateAttr);let T=e.stripIds(S);T>0&&console.warn(`[hyper-html-api] stripped ${T} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let R=kr(s,b,n),I=f[0]||v,N=e.parent(I),m=f.length>0?Ir(e,N,I):0,k=new Set,M=s.map((T,x)=>{let E=R[x];if(E>=0)return k.add(E),f[E];let d=e.clone(S);return e.stripIds(d),d});f.forEach((T,x)=>{k.has(x)||e.remove(T)}),M.forEach((T,x)=>{let E=m+x;e.children(N).findIndex(i=>e.sameNode(i,T))!==E&&e.insertAt(N,T,E)}),M.forEach((T,x)=>{if(n===null){let E=s[x],d=E==null?"":String(E);e.text(T)!==d&&e.text(T,d)}else{let E=u(e,T,n,s[x],{depth:o.depth+1,path:[...o.path,x]},l);E&&E!==T&&(M[x]=E)}})}function Tr(e,t,r,n){return r===null?e.text(t):te(e,t,r,n)}function kr(e,t,r){let n=new Array(e.length).fill(-1),s=new Set;return e.forEach((o,u)=>{let l=-1,f=-1;t.forEach((y,v)=>{if(s.has(v))return;let b=Rr(o,y,r),S=b===f&&l>=0?Math.abs(v-u)<Math.abs(l-u):!1;(b>f||S)&&(f=b,l=v)}),f>=wr&&(n[u]=l,s.add(l))}),n}function Rr(e,t,r){if(r===null)return e===t?1:0;let n=Object.keys(r||{});if(n.length===0)return 0;let s=0;for(let o of n)JSON.stringify(e?.[o])===JSON.stringify(t?.[o])&&s++;return s/n.length}function Ir(e,t,r){let n=e.children(t);for(let s=0;s<n.length;s++)if(e.sameNode(n[s],r))return s;return-1}function Cr(e,t,r,n){if(!n.templateAttr)return null;let s=t;for(;s;){let o=e.find(s,r,{includeRulesTag:!1});for(let u of o)if(e.attr(u,n.templateAttr)!=null)return u;s=e.parent(s)}return null}var Mt=new Set(["checked","selected","disabled","readOnly","paused"]);function ge(e,t,r,n,s={}){let o=[];if(Ke(r,n,[],o),o.length)throw new fe(o);ke(e,t,r,n,{depth:0,path:[]},s)}function ke(e,t,r,n,s,o={}){if(s.depth>se)throw new ee(s.path);if(n===void 0)return t;if(typeof r=="string")return Nr(e,t,r,n,s,o);if(Array.isArray(r)){let[u,l]=r;return Ve(e,t,u,l,n,s,ke,o),t}if(typeof r=="object"&&r!==null){for(let[u,l]of Object.entries(r)){let f=ke(e,t,l,n==null?n:n[u],{depth:s.depth+1,path:[...s.path,u]},o);f&&f!==t&&(t=f)}return t}return t}function Nr(e,t,r,n,s,o){if(r.endsWith("[]")){let l=r.slice(0,-2);return Ve(e,t,l,null,n,s,ke,o),t}if(r.startsWith("@"))return xt(e,t,r.slice(1),n);if(r.includes("@")){let l=r.lastIndexOf("@"),f=r.slice(0,l),y=r.slice(l+1),v=f?e.find(t,f,o):[t];return v.length===0||xt(e,v[0],y,n),t}if(r===".")return e.text(t,n==null?"":String(n)),t;let u=e.find(t,r,o);return u.length===0||e.text(u[0],n==null?"":String(n)),t}function xt(e,t,r,n){if(vt.has(r))throw new me(r);if(r==="outerHTML"){let s=n==null?"":String(n);return e.replaceWith(t,s)}return At.has(r)?(e.prop(t,r,Lr(r,n)),t):(e.attr(t,r,n==null?"":String(n)),t)}function Lr(e,t){return t==null?Mt.has(e)?!1:"":Mt.has(e)?!!t:t}function Ke(e,t,r,n){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((s,o)=>{typeof s=="object"&&s!==null&&n.push({path:ye([...r,o]),expected:"scalar",got:pe(s)})}):n.push({path:ye(r),expected:"array",got:pe(t)});return}t!==null&&typeof t=="object"&&n.push({path:ye(r),expected:"scalar",got:pe(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){n.push({path:ye(r),expected:"array",got:pe(t)});return}let s=e[1];t.forEach((o,u)=>Ke(s,o,[...r,u],n));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){n.push({path:ye(r),expected:"object",got:pe(t)});return}for(let[s,o]of Object.entries(e))Ke(o,t[s],[...r,s],n)}}}function pe(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function ye(e){return e.join(".")}function ze(e){try{return JSON.parse(e)}catch(t){throw new ne(`Invalid strict JSON: ${t.message}`,t)}}function be(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(s){let o=[],u=0;for(;u<s.length;){let l=s[u];if(/\s/.test(l)){u++;continue}if("{}".includes(l)){o.push({type:l,value:l}),u++;continue}if(l==="["){let b=!1,S=u+1;for(;S<s.length&&/\s/.test(s[S]);)S++;if(S<s.length&&/[a-zA-Z_]/.test(s[S])&&(b=!0),!b){o.push({type:l,value:l}),u++;continue}}if(l==="]"){o.push({type:l,value:l}),u++;continue}if(l===":"){o.push({type:t.COLON,value:l}),u++;continue}if(l===","){o.push({type:t.COMMA,value:l}),u++;continue}if(l==='"'||l==="'"){let b=l,S=u+1;for(;S<s.length&&s[S]!==b;)s[S]==="\\"&&S++,S++;o.push({type:t.STRING,value:s.substring(u+1,S),quoted:!0,sourceQuote:b}),u=S+1;continue}let f=u,y;for(;f<s.length&&!/[{},]/.test(s[f]);)if(s[f]===":"){let b=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],S=!1;for(let R of b){let I=R.substring(1);if(s.substring(f+1,f+1+I.length)===I){S=!0,f+=I.length;break}}if(!S)break}else if(s[f]==="["){for(f++;f<s.length&&s[f]!=="]";){if(s[f]==='"'||s[f]==="'"){let b=s[f];for(f++;f<s.length&&s[f]!==b;)s[f]==="\\"&&f++,f++}f++}f<s.length&&s[f]==="]"&&f++}else f++;y=s.substring(u,f);let v=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(y)?v=t.NUMBER:y==="true"||y==="false"||y==="null"?v=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(y)&&(v=t.SELECTOR),o.push({type:v,value:y,quoted:!1}),u=f}return o}function n(s){let o="";for(let u=0;u<s.length;u++){let l=s[u];if("{}".includes(l.type)||"[]".includes(l.type)){o+=l.value;continue}if(l.type===t.COLON){o+=l.value;continue}if(l.type===t.COMMA){let f=s[u+1];if(f&&(f.type==="}"||f.type==="]"))continue;o+=l.value;continue}if(l.type===t.STRING&&l.quoted){let f=l.value;l.sourceQuote==="'"&&(f=f.replace(/\\'/g,"'"),f=f.replace(/(\\*)"/g,(y,v)=>v.length%2===0?v+'\\"':y)),o+=`"${f}"`;continue}if(l.type===t.NUMBER||l.type===t.BOOLEAN){o+=l.value;continue}if(l.type===t.SELECTOR||l.type===t.IDENTIFIER){o+=`"${l.value}"`;continue}o+=`"${l.value}"`}return o}try{let s=r(e),o=n(s);return JSON.parse(o)}catch(s){throw new ne("Invalid extraction rules syntax: "+s.message,s)}}var Or="hyper-html-api",jr="1";function Se(e,t){let r=e.find(t,`script#${Or}`,{includeRulesTag:!0});if(r.length===0)return null;let n=r[0],s=e.attr(n,"data-rules-version");if(s!==jr)throw new de(s);let o=e.text(n);return{rules:be(o),tagNode:n}}var kt={includeClasses:!0,includeAttributes:["href","src","name","type","role","aria-label","alt","title"],excludeAttributePrefixes:["data-morph-","data-hyper-","data-im-"],textHintLength:64,excludeIds:!0,maxPathDepth:4,landmarks:["HEADER","NAV","MAIN","ASIDE","FOOTER","SECTION","ARTICLE"],weights:{signature:100,pathSegment:10,textMatch:20,textMismatch:25,uniqueCandidate:50,positionPenalty:1,slotMatch:30},minConfidence:101};function qr(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t).toString(36)}function Fr(e){if(e.classList&&e.classList.length>0)return Array.from(e.classList).sort().join(" ");let t=e.getAttribute?.("class");return t?t.split(/\s+/).filter(Boolean).sort().join(" "):""}function Pr(e,t){let r=[];for(let n of e.attributes||[]){let s=n.name;s==="id"||s==="class"||t.excludeAttributePrefixes.some(o=>s.startsWith(o))||t.includeAttributes.includes(s)&&r.push(`${s}=${n.value}`)}return r.sort().join("|")}function _r(e,t){return(e.textContent||"").replace(/\s+/g," ").trim().slice(0,t.textHintLength)}function Dr(e,t){let r=[e.tagName];return t.includeClasses&&r.push(Fr(e)),r.push(Pr(e,t)),qr(r.join("|"))}function Br(e){let t=e.tagName,r=1,n=e.previousElementSibling;for(;n;)n.tagName===t&&r++,n=n.previousElementSibling;return r}function Ur(e,t){return e.id||e.getAttribute?.("role")?!0:t.landmarks.includes(e.tagName)}function Wr(e){if(e.id)return`#${e.id}`;let t=e.getAttribute?.("role");return t?`@${t}`:e.tagName}function Vr(e,t){let r=[],n=e;for(;n&&n.tagName&&r.length<t.maxPathDepth;){let s=`${n.tagName}:${Br(n)}`;if(r.unshift(s),n!==e&&Ur(n,t)){r.unshift(Wr(n));break}n=n.parentElement}return r}function Kr(e,t){let r=0,n=e.length-1,s=t.length-1;for(;n>=0&&s>=0&&e[n]===t[s];)r++,n--,s--;return r}function U(e,t,r){if(r.has(e))return r.get(e);let n={signature:Dr(e,t),path:Vr(e,t),textHint:_r(e,t)};return r.set(e,n),n}function Nt(e,t,r,n){if(n.has(e))return n.get(e);let s=new Map,o=e.querySelectorAll("*"),u=0;for(let l of o){let f=U(l,t,r);f.domIndex=u++,s.has(f.signature)||s.set(f.signature,[]),s.get(f.signature).push(l)}return n.set(e,s),s}function zr(e,t,r){r.delete(e),t.delete(e);let n=e.querySelectorAll("*");for(let s of n)t.delete(s)}function Ge(e,t,r,n,s){let o=U(e,r,n),u=U(t,r,n),l=r.weights,f={},y=0;if(o.signature!==u.signature)return{score:0,breakdown:{rejected:"signature mismatch"}};y+=l.signature,f.signature=l.signature;let b=Kr(o.path,u.path)*l.pathSegment;y+=b,f.path=b;let S=!0;if(o.textHint&&u.textHint?o.textHint===u.textHint?(y+=l.textMatch,f.text=l.textMatch):(y-=l.textMismatch,f.text=-l.textMismatch,S=!1):o.textHint!==u.textHint&&(y-=l.textMismatch,f.text=-l.textMismatch,S=!1),s.candidateCount===1&&S&&(y+=l.uniqueCandidate,f.unique=l.uniqueCandidate),typeof o.domIndex=="number"&&typeof u.domIndex=="number"){let R=Math.abs(o.domIndex-u.domIndex),I=Math.min(R*l.positionPenalty,20);y-=I,f.drift=-I}return{score:y,breakdown:f}}function Rt(e,t,r,n,s){if(r.excludeIds&&e.id)return null;let o=Nt(t,r,n,s),u=U(e,r,n);if(typeof u.domIndex!="number"){let S=0,R=e.previousElementSibling;for(;R;)S++,R=R.previousElementSibling;u.domIndex=S}let l=o.get(u.signature)||[],f=r.excludeIds?l.filter(S=>!S.id):l;if(f.length===0)return null;let y=null,v=0,b=null;for(let S of f){let{score:R,breakdown:I}=Ge(e,S,r,n,{candidateCount:f.length});R>v&&(v=R,y=S,b=I)}return v<r.minConfidence?null:{element:y,confidence:v,breakdown:b}}function Gr(e,t,r,n){let s=[],o=r.weights.signature+r.weights.slotMatch,u={slot:o};function l(b){if(b.children)return b.children;let S=b.childNodes;if(!S)return[];let R=[];for(let I=0;I<S.length;I++)S[I].nodeType===1&&R.push(S[I]);return R}function f(b,S){let R=l(b),I=l(S);if(R.length===I.length)for(let N=0;N<R.length;N++){let m=R[N],k=I[N];if(r.excludeIds&&(m.id||k.id)||m.tagName!==k.tagName)continue;let M=U(m,r,n).signature,T=U(k,r,n).signature;M!==T&&s.push({newEl:m,oldEl:k,score:o,breakdown:u}),f(m,k)}}function y(b,S){for(;;){if(b.tagName===S.tagName)return[b,S];let R=l(b);if(!b.tagName&&R.length===1){b=R[0];continue}let I=l(S);if(I.length===1&&I[0].tagName===b.tagName){S=I[0];continue}return null}}let v=y(e,t);return v&&f(v[0],v[1]),s}function It(e,t,r,n,s){let o=t.querySelectorAll("*"),u=Nt(e,r,n,s),l=0;for(let b of o){let S=U(b,r,n);S.domIndex=l++}let f=[];for(let b of o){if(r.excludeIds&&b.id)continue;let S=U(b,r,n),R=u.get(S.signature)||[],I=r.excludeIds?R.filter(N=>!N.id):R;for(let N of I){let{score:m,breakdown:k}=Ge(b,N,r,n,{candidateCount:I.length});m>=r.minConfidence&&f.push({newEl:b,oldEl:N,score:m,breakdown:k})}}if(r.weights.slotMatch>0){let b=Gr(t,e,r,n);for(let S of b)f.push(S)}f.sort((b,S)=>S.score-b.score);let y=new Map,v=new Set;for(let{newEl:b,oldEl:S}of f)y.has(b)||v.has(S)||(y.set(b,S),v.add(S));return y}function Ct(e,t,r,n){let s=U(e,r,n),o=U(t,r,n),{score:u,breakdown:l}=Ge(e,t,r,n,{candidateCount:1});return{matches:u>=r.minConfidence,score:u,breakdown:l,newMeta:{signature:s.signature,path:s.path,textHint:s.textHint},oldMeta:{signature:o.signature,path:o.path,textHint:o.textHint}}}function Lt(e={}){let t={...kt,...e,weights:{...kt.weights,...e.weights}},r=new WeakMap,n=new WeakMap;return{findMatch:(s,o)=>Rt(s,o,t,r,n),computeMatches:(s,o)=>It(s,o,t,r,n),explain:(s,o)=>Ct(s,o,t,r),invalidate:s=>zr(s,r,n),session:()=>{let s=new WeakMap,o=new WeakMap;return{findMatch:(u,l)=>Rt(u,l,t,s,o),computeMatches:(u,l)=>It(u,l,t,s,o),explain:(u,l)=>Ct(u,l,t,s)}},getConfig:()=>({...t})}}var Yr=Lt(),Ot=(function(){"use strict";let e=()=>{};function t(m){if(!(m instanceof Element))return!1;if(m.hasAttribute("save-ignore"))return!0;if(m.tagName==="LINK"||m.tagName==="SCRIPT"){let k=m.getAttribute("src")||m.getAttribute("href")||"";if(k.startsWith("chrome-extension://")||k.startsWith("moz-extension://")||k.startsWith("safari-web-extension://"))return!0}return!1}function r(m,k){if(k!=="smart")return m.outerHTML;let M=m.getAttribute("src"),T=m.getAttribute("type")||"text/javascript";if(M)try{let x=new URL(M,window.location.href);return`ext:${T}:${x.origin}${x.pathname}${x.search}`}catch{return`ext:${T}:${M}`}else{let x=m.textContent.trim(),E=5381;for(let d=0;d<x.length;d++)E=(E<<5)+E^x.charCodeAt(d);return`inline:${T}:${Math.abs(E).toString(36)}`}}let n={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:"merge",shouldPreserve:m=>m.getAttribute("im-preserve")==="true",shouldReAppend:m=>m.getAttribute("im-re-append")==="true",shouldRemove:e,afterHeadMorphed:e},scripts:{handle:!1,matchMode:"outerHTML",shouldPreserve:m=>m.getAttribute("im-preserve")==="true",shouldReAppend:m=>m.getAttribute("im-re-append")==="true",shouldRemove:e,afterScriptsHandled:e},restoreFocus:!0},s={computeMatches(m,k){let{computeMatches:M}=Yr.session();return M(m,k)}};function o(m,k,M={}){m=I(m);let T=N(k),x=R(m,T,M),E=x.scripts.matchMode,d=new Set(Array.from(m.querySelectorAll("script")).map(a=>r(a,E))),g=l(x,()=>v(x,m,T,a=>a.morphStyle==="innerHTML"?(f(a,m,T),Array.from(m.childNodes)):u(a,m,T)));x.pantry.remove();let i=S(m,d,x);return i.length>0?g instanceof Promise?g.then(a=>Promise.all(i).then(()=>a)):Promise.all(i).then(()=>g):g}function u(m,k,M){let T=N(k);return f(m,T,M,k,k.nextSibling),Array.from(T.childNodes)}function l(m,k){if(!m.config.restoreFocus)return k();let M=document.activeElement;if(!(M instanceof HTMLInputElement||M instanceof HTMLTextAreaElement))return k();let{id:T,selectionStart:x,selectionEnd:E}=M,d=k();return T&&T!==document.activeElement?.getAttribute("id")&&(M=m.target.querySelector(`[id="${T}"]`),M?.focus()),M&&!M.selectionEnd&&E!=null&&M.setSelectionRange(x,E),d}let f=(function(){function m(i,a,h,c=null,p=null){a instanceof HTMLTemplateElement&&h instanceof HTMLTemplateElement&&(a=a.content,h=h.content),c||=a.firstChild;for(let A of h.childNodes){if(t(A))continue;if(c&&c!=p){let C=M(i,A,c,p);if(C){C!==c&&x(i,c,C),y(C,A,i),c=C.nextSibling;continue}}if(A instanceof Element){let C=A.getAttribute("id");if(i.persistentIds.has(C)){let L=E(a,C,c,i);y(L,A,i),c=L.nextSibling;continue}if(!i.idMap.has(A)){let L=i.hyperMatches.get(A);if(L&&!i.idMap.has(L)){g(a,L,c),y(L,A,i),c=L.nextSibling;continue}}}let w=k(a,A,c,i);w&&(c=w.nextSibling)}for(;c&&c!=p;){let A=c;c=c.nextSibling,t(A)||T(i,A)}}function k(i,a,h,c){if(c.callbacks.beforeNodeAdded(a)===!1)return null;if(c.idMap.has(a)){let p=document.createElement(a.tagName);return i.insertBefore(p,h),y(p,a,c),c.callbacks.afterNodeAdded(p),p}else{let p=document.importNode(a,!0);return i.insertBefore(p,h),c.callbacks.afterNodeAdded(p),p}}let M=(function(){function i(c,p,A,w){let C=p instanceof Element&&!c.idMap.has(p)?c.hyperMatches.get(p):null,L=null,q=p.nextSibling,D=0,O=A;for(;O&&O!=w;){if(h(O,p)){if(a(c,O,p)||O===C&&!c.idMap.has(O))return O;if(L===null){let P=O instanceof Element&&c.hyperMatchedOldElements.has(O);!c.idMap.has(O)&&!P&&(L=O)}}if(L===null&&q&&h(O,q)&&(D++,q=q.nextSibling,D>=2&&(L=void 0)),c.activeElementAndParents.includes(O))break;O=O.nextSibling}return L||null}function a(c,p,A){let w=c.idMap.get(p),C=c.idMap.get(A);if(!C||!w)return!1;for(let L of w)if(C.has(L))return!0;return!1}function h(c,p){let A=c,w=p;return A.nodeType===w.nodeType&&A.tagName===w.tagName&&(!A.getAttribute?.("id")||A.getAttribute?.("id")===w.getAttribute?.("id"))}return i})();function T(i,a){let h=a instanceof Element&&i.hyperMatchedOldElements.has(a)&&!i.idMap.has(a);if(i.idMap.has(a)||h)g(i.pantry,a,null);else{if(i.callbacks.beforeNodeRemoved(a)===!1)return;a.parentNode?.removeChild(a),i.callbacks.afterNodeRemoved(a)}}function x(i,a,h){let c=a;for(;c&&c!==h;){let p=c;c=c.nextSibling,t(p)||T(i,p)}return c}function E(i,a,h,c){let p=c.target.getAttribute?.("id")===a&&c.target||c.target.querySelector(`[id="${a}"]`)||c.pantry.querySelector(`[id="${a}"]`);return d(p,c),g(i,p,h),p}function d(i,a){let h=i.getAttribute("id");for(;i=i.parentNode;){let c=a.idMap.get(i);c&&(c.delete(h),c.size||a.idMap.delete(i))}}function g(i,a,h){if(i.moveBefore)try{i.moveBefore(a,h)}catch{i.insertBefore(a,h)}else i.insertBefore(a,h)}return m})(),y=(function(){function m(d,g,i){return i.ignoreActive&&d===document.activeElement?null:(i.callbacks.beforeNodeMorphed(d,g)===!1||(d instanceof HTMLHeadElement&&i.head.ignore||(d instanceof HTMLHeadElement&&i.head.style!=="morph"?b(d,g,i):(k(d,g,i),E(d,i)||f(i,d,g))),i.callbacks.afterNodeMorphed(d,g)),d)}function k(d,g,i){let a=g.nodeType;if(a===1){let h=d,c=g,p=h.attributes,A=c.attributes;for(let w of A)x(w.name,h,"update",i)||h.getAttribute(w.name)!==w.value&&h.setAttribute(w.name,w.value);for(let w=p.length-1;0<=w;w--){let C=p[w];if(C&&!c.hasAttribute(C.name)){if(x(C.name,h,"remove",i))continue;h.removeAttribute(C.name)}}E(h,i)||M(h,c,i)}(a===8||a===3)&&d.nodeValue!==g.nodeValue&&(d.nodeValue=g.nodeValue)}function M(d,g,i){if(d instanceof HTMLInputElement&&g instanceof HTMLInputElement&&g.type!=="file"){let a=g.value,h=d.value;T(d,g,"checked",i),T(d,g,"disabled",i),i.formStateSync==="property"?h!==a&&(x("value",d,"update",i)||(d.value=a)):g.hasAttribute("value")?h!==a&&(x("value",d,"update",i)||(d.setAttribute("value",a),d.value=a)):x("value",d,"remove",i)||(d.value="",d.removeAttribute("value"))}else if(d instanceof HTMLOptionElement&&g instanceof HTMLOptionElement)T(d,g,"selected",i);else if(d instanceof HTMLTextAreaElement&&g instanceof HTMLTextAreaElement){let a=g.value,h=d.value;if(x("value",d,"update",i))return;a!==h&&(d.value=a),d.firstChild&&d.firstChild.nodeValue!==a&&(d.firstChild.nodeValue=a)}}function T(d,g,i,a){let h=g[i],c=d[i];if(h!==c){let p=x(i,d,"update",a);if(p||(d[i]=g[i]),a.formStateSync==="property")return;h?p||d.setAttribute(i,""):x(i,d,"remove",a)||d.removeAttribute(i)}}function x(d,g,i,a){return d==="value"&&a.ignoreActiveValue&&g===document.activeElement?!0:a.callbacks.beforeAttributeUpdated(d,g,i)===!1}function E(d,g){return!!g.ignoreActiveValue&&d===document.activeElement&&d!==document.body}return m})();function v(m,k,M,T){if(m.head.block){let x=k.querySelector("head"),E=M.querySelector("head");if(x&&E){let d=b(x,E,m);return Promise.all(d).then(()=>{let g=Object.assign(m,{head:{block:!1,ignore:!0}});return T(g)})}}return T(m)}function b(m,k,M){let T=[],x=[],E=[],d=[],g=M.scripts.matchMode,i=c=>{if(c.tagName==="SCRIPT")return r(c,g);if(c.tagName==="LINK"&&g==="smart"){let p=c.getAttribute("href");if(p)try{let A=new URL(p,window.location.href);return`link:${c.getAttribute("rel")||""}:${A.origin}${A.pathname}${A.search}`}catch{}}return c.outerHTML},a=new Map;for(let c of k.children)t(c)||a.set(i(c),c);for(let c of m.children){let p=i(c),A=a.has(p),w=M.head.shouldReAppend(c),C=M.head.shouldPreserve(c);A||C?w?x.push(c):(a.delete(p),E.push(c)):M.head.style==="append"?w&&(x.push(c),d.push(c)):M.head.shouldRemove(c)!==!1&&!t(c)&&x.push(c)}d.push(...a.values());let h=[];for(let c of d){let p=document.createRange().createContextualFragment(c.outerHTML).firstChild;if(M.callbacks.beforeNodeAdded(p)!==!1){if("href"in p&&p.href||"src"in p&&p.src){let A,w=new Promise(function(C){A=C});p.addEventListener("load",function(){A()}),h.push(w)}m.appendChild(p),M.callbacks.afterNodeAdded(p),T.push(p)}}for(let c of x)M.callbacks.beforeNodeRemoved(c)!==!1&&(m.removeChild(c),M.callbacks.afterNodeRemoved(c));return M.head.afterHeadMorphed(m,{added:T,kept:E,removed:x}),h}function S(m,k,M){if(!M.scripts.handle)return[];let T=[],x=[],E=[],d=[],g=M.scripts.matchMode,i=Array.from(m.querySelectorAll("script"));for(let h of i){let c=r(h,g),p=k.has(c),A=M.scripts.shouldPreserve(h),w=M.scripts.shouldReAppend(h);p||A?w?(x.push(h),d.push(h)):E.push(h):d.push(h)}for(let h of k){let c=i.some(p=>p.outerHTML===h)}let a=[];for(let h of d){if(M.callbacks.beforeNodeAdded(h)===!1)continue;let c=document.createRange().createContextualFragment(h.outerHTML).firstChild;if(c.src){let p,A=new Promise(function(w){p=w});c.addEventListener("load",function(){p()}),c.addEventListener("error",function(){p()}),a.push(A)}h.replaceWith(c),M.callbacks.afterNodeAdded(c),T.push(c)}return M.scripts.afterScriptsHandled(m,{added:T,kept:E,removed:x}),a}let R=(function(){function m(i,a,h){let{persistentIds:c,idMap:p}=d(i,a),A=s.computeMatches(i,a);if(typeof h.key=="function"){let q=new Map,D=new Set,O=j=>{let H=h.key(j);H!=null&&(q.has(H)?D.add(H):q.set(H,j))};i instanceof Element&&O(i);for(let j of i.querySelectorAll("*"))O(j);for(let j of D)q.delete(j);let P=new Map;for(let[j,H]of A)P.set(H,j);let J=a.__hyperMorphRoot||a,K=new Map,le=new Set,ue=j=>{let H=h.key(j);H!=null&&(K.has(H)?le.add(H):K.set(H,j))};J instanceof Element&&ue(J);for(let j of J.querySelectorAll("*"))ue(j);for(let j of le)K.delete(j);for(let[j,H]of K){let _=q.get(j);if(!_||_.tagName!==H.tagName)continue;let X=P.get(_);X&&X!==H&&A.delete(X);let Q=A.get(H);Q&&Q!==_&&P.delete(Q),A.set(H,_),P.set(_,H)}}let w=new Set;for(let q of A.values())w.add(q);let C=k(h),L=C.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(L))throw`Do not understand how to morph style ${L}`;return{target:i,newContent:a,config:C,morphStyle:L,ignoreActive:C.ignoreActive,ignoreActiveValue:C.ignoreActiveValue,restoreFocus:C.restoreFocus,formStateSync:C.formStateSync||"attribute",idMap:p,persistentIds:c,hyperMatches:A,hyperMatchedOldElements:w,pantry:M(),activeElementAndParents:T(i),callbacks:C.callbacks,head:C.head,scripts:C.scripts}}function k(i){let a=Object.assign({},n);return Object.assign(a,i),a.callbacks=Object.assign({},n.callbacks,i.callbacks),a.head=Object.assign({},n.head,i.head),a.scripts=Object.assign({},n.scripts,i.scripts),a}function M(){let i=document.createElement("div");return i.hidden=!0,document.body.insertAdjacentElement("afterend",i),i}function T(i){let a=[],h=document.activeElement;if(h?.tagName!=="BODY"&&i.contains(h))for(;h&&(a.push(h),h!==i);)h=h.parentElement;return a}function x(i){let a=Array.from(i.querySelectorAll("[id]"));return i.getAttribute?.("id")&&a.push(i),a}function E(i,a,h,c){for(let p of c){let A=p.getAttribute("id");if(a.has(A)){let w=p;for(;w;){let C=i.get(w);if(C==null&&(C=new Set,i.set(w,C)),C.add(A),w===h)break;w=w.parentElement}}}}function d(i,a){let h=x(i),c=x(a),p=g(h,c),A=new Map;E(A,p,i,h);let w=a.__hyperMorphRoot||a;return E(A,p,w,c),{persistentIds:p,idMap:A}}function g(i,a){let h=new Set,c=new Map;for(let{id:A,tagName:w}of i)c.has(A)?h.add(A):c.set(A,w);let p=new Set;for(let{id:A,tagName:w}of a)p.has(A)?h.add(A):c.get(A)===w&&p.add(A);for(let A of h)p.delete(A);return p}return m})(),{normalizeElement:I,normalizeParent:N}=(function(){let m=new WeakSet;function k(E){return E instanceof Document?E.documentElement:E}function M(E){if(E==null)return document.createElement("div");if(typeof E=="string")return M(x(E));if(m.has(E))return E;if(E instanceof Node){if(E.parentNode)return new T(E);{let d=document.createElement("div");return d.append(E),d}}else{let d=document.createElement("div");for(let g of[...E])d.append(g);return d}}class T{constructor(d){this.originalNode=d,this.realParentNode=d.parentNode,this.previousSibling=d.previousSibling,this.nextSibling=d.nextSibling}get childNodes(){let d=[],g=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;g&&g!=this.nextSibling;)d.push(g),g=g.nextSibling;return d}querySelectorAll(d){return this.childNodes.reduce((g,i)=>{if(i instanceof Element){i.matches(d)&&g.push(i);let a=i.querySelectorAll(d);for(let h=0;h<a.length;h++)g.push(a[h])}return g},[])}insertBefore(d,g){return this.realParentNode.insertBefore(d,g)}moveBefore(d,g){return this.realParentNode.moveBefore(d,g)}get __hyperMorphRoot(){return this.originalNode}}function x(E){let d=new DOMParser,g=E.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(g.match(/<\/html>/)||g.match(/<\/head>/)||g.match(/<\/body>/)){let i=d.parseFromString(E,"text/html");if(g.match(/<\/html>/))return m.add(i),i;{let a=i.firstChild;return a&&m.add(a),a}}else{let a=d.parseFromString("<body><template>"+E+"</template></body>","text/html").body.querySelector("template").content;return m.add(a),a}}return{normalizeElement:k,normalizeParent:M}})();return{morph:o,defaults:n}})();var ro=Ot.morph,no=Ot.defaults;var en=null;function Re(){return en}function Ce(e,t){let r={carriedOver:0,discarded:0,listItems:0},n=Ye(t,e,r);return Ze(t,e,r),{data:n,summary:r}}function Ye(e,t,r){if(typeof e=="string")return e.endsWith("[]")?Array.isArray(t)?(r.listItems+=t.length,r.carriedOver+=t.length,t):void 0:t==null?void 0:(r.carriedOver++,t);if(Array.isArray(e)){let[,n]=e;return Array.isArray(t)?(r.listItems+=t.length,t.map(s=>Ye(n,s,r))):void 0}if(typeof e=="object"&&e!==null){let n={};for(let[s,o]of Object.entries(e)){let u=Ye(o,t?.[s],r);u!==void 0&&(n[s]=u)}return n}}function Ze(e,t,r){if(t!=null){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){if(typeof t!="object"||Array.isArray(t))return;let n=new Set(Object.keys(e));for(let s of Object.keys(t))n.has(s)?Ze(e[s],t[s],r):r.discarded+=Ie(t[s]);return}if(Array.isArray(e)&&Array.isArray(t)){let n=e[1];t.forEach(s=>Ze(n,s,r));return}typeof e=="string"&&!e.endsWith("[]")&&typeof t=="object"&&t!==null&&(r.discarded+=Ie(t))}}function Ie(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+Ie(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+Ie(r),0):1}var tn="hyper-html-api";function rn(e){return e&&e.nodeType===1&&e.id===tn&&e.tagName==="SCRIPT"}function nn(e){return e?(e.nodeType===9||e.nodeType===11,e):null}var sn={find(e,t,r={}){let n=nn(e);if(!n||!n.querySelectorAll)return[];let s=Array.from(n.querySelectorAll(t));r.includeRulesTag||(s=s.filter(u=>!rn(u)));let o=[];if(r.skip&&o.push(r.skip),r.templateAttr&&o.push("["+r.templateAttr+"]"),o.length){let u=o.join(", ");s=s.filter(l=>!l.closest||!l.closest(u))}return s},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t)},prop(e,t,r){if(r===void 0){let n=e?e[t]:void 0;return n!==void 0?n:null}e[t]=r},clone(e){return e.cloneNode(!0)},insertAt(e,t,r){let n=e.children[r]||null;e.insertBefore(t,n)},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let n=e.ownerDocument.createElement("template");n.innerHTML=t;let s=n.content.firstElementChild;if(!s)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(s,e),s},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(n=>{n.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}},G=sn;var on="_hyperHtmlApi",an="upgrade-helper",cn="parentOrigin";function Qe(e=typeof location<"u"?location:null){if(!e)return!1;try{return new URLSearchParams(e.search).get(on)===an}catch{return!1}}function jt(e=typeof location<"u"?location:null){return e?new URLSearchParams(e.search).get(cn):null}function et({win:e,doc:t,parentOrigin:r}={}){if(e=e||(typeof window<"u"?window:null),t=t||(typeof document<"u"?document:null),!e||!t||(r=r||jt(e.location),!r))return;let n=()=>ln({win:e,doc:t,parentOrigin:r});t.readyState==="loading"?t.addEventListener("DOMContentLoaded",n,{once:!0}):n()}function ln({win:e,doc:t,parentOrigin:r}){let n;try{n=Se(G,t.body)}catch(f){return Je(e,r,f)}if(!n)return Je(e,r,new Error("helper-mode: no rules tag in v2 document"));let s=n.rules,o=dn(t,"hyper-version"),u=!!Re(),l=f=>{if(f.source!==e.parent||f.origin!==r)return;let y=f.data;if(!(!y||y.type!=="hha:upgrade-data")){e.removeEventListener("message",l);try{let v=un({doc:t,rules:s,v1Data:y.v1Data});e.parent.postMessage({type:"hha:upgrade-result",html:v.html,summary:v.summary},r)}catch(v){Je(e,r,v)}}};e.addEventListener("message",l),e.parent.postMessage({type:"hha:upgrade-ready",rules:s,version:o,hasTransform:u},r)}function un({doc:e,rules:t,v1Data:r}){let n=Re(),s=r,o=!1;n&&(s=n(r),o=!0);let{data:u,summary:l}=Ce(s,t);ge(G,e.body,t,u);let f=te(G,e.body,t);return{html:`<!DOCTYPE html>
2
+ `+e.documentElement.outerHTML,summary:{...l,transformApplied:o,appliedFieldCount:Xe(f)}}}function Je(e,t,r){e.parent.postMessage({type:"hha:upgrade-error",name:r?.name||"Error",message:r?.message||String(r)},t)}function dn(e,t){let r=e.querySelector(`meta[name="${t}"]`);return r?r.getAttribute("content"):null}function Xe(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+Xe(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+Xe(r),0):1}var F={extract:(e,t,r)=>te(G,e,t,r),apply:(e,t,r,n)=>ge(G,e,t,r,n),findRulesIn:e=>Se(G,e),parseStrict:ze,parseRelaxed:be,errors:Te,DOM_PROPERTIES:xe};typeof window<"u"&&Qe(window.location)&&et({win:window,doc:document});var rt={};Be(rt,{fromString:()=>Y,getRuleAtPath:()=>Ae,getValueAtPath:()=>yn,setAtPath:()=>tt,toString:()=>pn});function pn(e){return e.map(String).join(".")}function Y(e){return e===""?[]:e.split(".").map(t=>/^\d+$/.test(t)?Number(t):t)}function Ae(e,t){let r=e;for(let n of t){if(r==null)return;if(typeof r=="string"){if(r.endsWith("[]")&&(typeof n=="number"||n==="*")){r=r.slice(0,-2);continue}return}if(Array.isArray(r)){if(typeof n!="number"&&n!=="*")return;r=r[1];continue}if(typeof r=="object"){if(typeof n=="number"||!(n in r))return;r=r[n];continue}return}return r}function yn(e,t){let r=e;for(let n of t){if(r==null)return;r=r[n]}return r}function tt(e,t,r){if(t.length===0)return r;let[n,...s]=t;if(typeof n=="number"){let o=Array.isArray(e)?[...e]:[];return o[n]=tt(o[n],s,r),o}return{...e&&typeof e=="object"?e:{},[n]:tt((e||{})[n],s,r)}}function ve(e){if(typeof e=="string")return e.endsWith("[]")?[]:"";if(Array.isArray(e))return[];if(typeof e=="object"&&e!==null){let t={};for(let[r,n]of Object.entries(e))t[r]=ve(n);return t}return""}var Ht={includeClasses:!0,includeAttributes:["href","src","name","type","role","aria-label","alt","title"],excludeAttributePrefixes:["data-morph-","data-hyper-","data-im-"],textHintLength:64,excludeIds:!0,maxPathDepth:4,landmarks:["HEADER","NAV","MAIN","ASIDE","FOOTER","SECTION","ARTICLE"],weights:{signature:100,pathSegment:10,textMatch:20,textMismatch:25,uniqueCandidate:50,positionPenalty:1,slotMatch:30},minConfidence:101};function gn(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t).toString(36)}function bn(e){if(e.classList&&e.classList.length>0)return Array.from(e.classList).sort().join(" ");let t=e.getAttribute?.("class");return t?t.split(/\s+/).filter(Boolean).sort().join(" "):""}function Sn(e,t){let r=[];for(let n of e.attributes||[]){let s=n.name;s==="id"||s==="class"||t.excludeAttributePrefixes.some(o=>s.startsWith(o))||t.includeAttributes.includes(s)&&r.push(`${s}=${n.value}`)}return r.sort().join("|")}function An(e,t){return(e.textContent||"").replace(/\s+/g," ").trim().slice(0,t.textHintLength)}function vn(e,t){let r=[e.tagName];return t.includeClasses&&r.push(bn(e)),r.push(Sn(e,t)),gn(r.join("|"))}function En(e){let t=e.tagName,r=1,n=e.previousElementSibling;for(;n;)n.tagName===t&&r++,n=n.previousElementSibling;return r}function Mn(e,t){return e.id||e.getAttribute?.("role")?!0:t.landmarks.includes(e.tagName)}function xn(e){if(e.id)return`#${e.id}`;let t=e.getAttribute?.("role");return t?`@${t}`:e.tagName}function wn(e,t){let r=[],n=e;for(;n&&n.tagName&&r.length<t.maxPathDepth;){let s=`${n.tagName}:${En(n)}`;if(r.unshift(s),n!==e&&Mn(n,t)){r.unshift(xn(n));break}n=n.parentElement}return r}function Tn(e,t){let r=0,n=e.length-1,s=t.length-1;for(;n>=0&&s>=0&&e[n]===t[s];)r++,n--,s--;return r}function W(e,t,r){if(r.has(e))return r.get(e);let n={signature:vn(e,t),path:wn(e,t),textHint:An(e,t)};return r.set(e,n),n}function Pt(e,t,r,n){if(n.has(e))return n.get(e);let s=new Map,o=e.querySelectorAll("*"),u=0;for(let l of o){let f=W(l,t,r);f.domIndex=u++,s.has(f.signature)||s.set(f.signature,[]),s.get(f.signature).push(l)}return n.set(e,s),s}function kn(e,t,r){r.delete(e),t.delete(e);let n=e.querySelectorAll("*");for(let s of n)t.delete(s)}function nt(e,t,r,n,s){let o=W(e,r,n),u=W(t,r,n),l=r.weights,f={},y=0;if(o.signature!==u.signature)return{score:0,breakdown:{rejected:"signature mismatch"}};y+=l.signature,f.signature=l.signature;let b=Tn(o.path,u.path)*l.pathSegment;y+=b,f.path=b;let S=!0;if(o.textHint&&u.textHint?o.textHint===u.textHint?(y+=l.textMatch,f.text=l.textMatch):(y-=l.textMismatch,f.text=-l.textMismatch,S=!1):o.textHint!==u.textHint&&(y-=l.textMismatch,f.text=-l.textMismatch,S=!1),s.candidateCount===1&&S&&(y+=l.uniqueCandidate,f.unique=l.uniqueCandidate),typeof o.domIndex=="number"&&typeof u.domIndex=="number"){let R=Math.abs(o.domIndex-u.domIndex),I=Math.min(R*l.positionPenalty,20);y-=I,f.drift=-I}return{score:y,breakdown:f}}function $t(e,t,r,n,s){if(r.excludeIds&&e.id)return null;let o=Pt(t,r,n,s),u=W(e,r,n);if(typeof u.domIndex!="number"){let S=0,R=e.previousElementSibling;for(;R;)S++,R=R.previousElementSibling;u.domIndex=S}let l=o.get(u.signature)||[],f=r.excludeIds?l.filter(S=>!S.id):l;if(f.length===0)return null;let y=null,v=0,b=null;for(let S of f){let{score:R,breakdown:I}=nt(e,S,r,n,{candidateCount:f.length});R>v&&(v=R,y=S,b=I)}return v<r.minConfidence?null:{element:y,confidence:v,breakdown:b}}function Rn(e,t,r,n){let s=[],o=r.weights.signature+r.weights.slotMatch,u={slot:o};function l(b){if(b.children)return b.children;let S=b.childNodes;if(!S)return[];let R=[];for(let I=0;I<S.length;I++)S[I].nodeType===1&&R.push(S[I]);return R}function f(b,S){let R=l(b),I=l(S);if(R.length===I.length)for(let N=0;N<R.length;N++){let m=R[N],k=I[N];if(r.excludeIds&&(m.id||k.id)||m.tagName!==k.tagName)continue;let M=W(m,r,n).signature,T=W(k,r,n).signature;M!==T&&s.push({newEl:m,oldEl:k,score:o,breakdown:u}),f(m,k)}}function y(b,S){for(;;){if(b.tagName===S.tagName)return[b,S];let R=l(b);if(!b.tagName&&R.length===1){b=R[0];continue}let I=l(S);if(I.length===1&&I[0].tagName===b.tagName){S=I[0];continue}return null}}let v=y(e,t);return v&&f(v[0],v[1]),s}function qt(e,t,r,n,s){let o=t.querySelectorAll("*"),u=Pt(e,r,n,s),l=0;for(let b of o){let S=W(b,r,n);S.domIndex=l++}let f=[];for(let b of o){if(r.excludeIds&&b.id)continue;let S=W(b,r,n),R=u.get(S.signature)||[],I=r.excludeIds?R.filter(N=>!N.id):R;for(let N of I){let{score:m,breakdown:k}=nt(b,N,r,n,{candidateCount:I.length});m>=r.minConfidence&&f.push({newEl:b,oldEl:N,score:m,breakdown:k})}}if(r.weights.slotMatch>0){let b=Rn(t,e,r,n);for(let S of b)f.push(S)}f.sort((b,S)=>S.score-b.score);let y=new Map,v=new Set;for(let{newEl:b,oldEl:S}of f)y.has(b)||v.has(S)||(y.set(b,S),v.add(S));return y}function Ft(e,t,r,n){let s=W(e,r,n),o=W(t,r,n),{score:u,breakdown:l}=nt(e,t,r,n,{candidateCount:1});return{matches:u>=r.minConfidence,score:u,breakdown:l,newMeta:{signature:s.signature,path:s.path,textHint:s.textHint},oldMeta:{signature:o.signature,path:o.path,textHint:o.textHint}}}function _t(e={}){let t={...Ht,...e,weights:{...Ht.weights,...e.weights}},r=new WeakMap,n=new WeakMap;return{findMatch:(s,o)=>$t(s,o,t,r,n),computeMatches:(s,o)=>qt(s,o,t,r,n),explain:(s,o)=>Ft(s,o,t,r),invalidate:s=>kn(s,r,n),session:()=>{let s=new WeakMap,o=new WeakMap;return{findMatch:(u,l)=>$t(u,l,t,s,o),computeMatches:(u,l)=>qt(u,l,t,s,o),explain:(u,l)=>Ft(u,l,t,s)}},getConfig:()=>({...t})}}var In=_t(),st=(function(){"use strict";let e=()=>{};function t(m){if(!(m instanceof Element))return!1;if(m.hasAttribute("save-ignore"))return!0;if(m.tagName==="LINK"||m.tagName==="SCRIPT"){let k=m.getAttribute("src")||m.getAttribute("href")||"";if(k.startsWith("chrome-extension://")||k.startsWith("moz-extension://")||k.startsWith("safari-web-extension://"))return!0}return!1}function r(m,k){if(k!=="smart")return m.outerHTML;let M=m.getAttribute("src"),T=m.getAttribute("type")||"text/javascript";if(M)try{let x=new URL(M,window.location.href);return`ext:${T}:${x.origin}${x.pathname}${x.search}`}catch{return`ext:${T}:${M}`}else{let x=m.textContent.trim(),E=5381;for(let d=0;d<x.length;d++)E=(E<<5)+E^x.charCodeAt(d);return`inline:${T}:${Math.abs(E).toString(36)}`}}let n={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:"merge",shouldPreserve:m=>m.getAttribute("im-preserve")==="true",shouldReAppend:m=>m.getAttribute("im-re-append")==="true",shouldRemove:e,afterHeadMorphed:e},scripts:{handle:!1,matchMode:"outerHTML",shouldPreserve:m=>m.getAttribute("im-preserve")==="true",shouldReAppend:m=>m.getAttribute("im-re-append")==="true",shouldRemove:e,afterScriptsHandled:e},restoreFocus:!0},s={computeMatches(m,k){let{computeMatches:M}=In.session();return M(m,k)}};function o(m,k,M={}){m=I(m);let T=N(k),x=R(m,T,M),E=x.scripts.matchMode,d=new Set(Array.from(m.querySelectorAll("script")).map(a=>r(a,E))),g=l(x,()=>v(x,m,T,a=>a.morphStyle==="innerHTML"?(f(a,m,T),Array.from(m.childNodes)):u(a,m,T)));x.pantry.remove();let i=S(m,d,x);return i.length>0?g instanceof Promise?g.then(a=>Promise.all(i).then(()=>a)):Promise.all(i).then(()=>g):g}function u(m,k,M){let T=N(k);return f(m,T,M,k,k.nextSibling),Array.from(T.childNodes)}function l(m,k){if(!m.config.restoreFocus)return k();let M=document.activeElement;if(!(M instanceof HTMLInputElement||M instanceof HTMLTextAreaElement))return k();let{id:T,selectionStart:x,selectionEnd:E}=M,d=k();return T&&T!==document.activeElement?.getAttribute("id")&&(M=m.target.querySelector(`[id="${T}"]`),M?.focus()),M&&!M.selectionEnd&&E!=null&&M.setSelectionRange(x,E),d}let f=(function(){function m(i,a,h,c=null,p=null){a instanceof HTMLTemplateElement&&h instanceof HTMLTemplateElement&&(a=a.content,h=h.content),c||=a.firstChild;for(let A of h.childNodes){if(t(A))continue;if(c&&c!=p){let C=M(i,A,c,p);if(C){C!==c&&x(i,c,C),y(C,A,i),c=C.nextSibling;continue}}if(A instanceof Element){let C=A.getAttribute("id");if(i.persistentIds.has(C)){let L=E(a,C,c,i);y(L,A,i),c=L.nextSibling;continue}if(!i.idMap.has(A)){let L=i.hyperMatches.get(A);if(L&&!i.idMap.has(L)){g(a,L,c),y(L,A,i),c=L.nextSibling;continue}}}let w=k(a,A,c,i);w&&(c=w.nextSibling)}for(;c&&c!=p;){let A=c;c=c.nextSibling,t(A)||T(i,A)}}function k(i,a,h,c){if(c.callbacks.beforeNodeAdded(a)===!1)return null;if(c.idMap.has(a)){let p=document.createElement(a.tagName);return i.insertBefore(p,h),y(p,a,c),c.callbacks.afterNodeAdded(p),p}else{let p=document.importNode(a,!0);return i.insertBefore(p,h),c.callbacks.afterNodeAdded(p),p}}let M=(function(){function i(c,p,A,w){let C=p instanceof Element&&!c.idMap.has(p)?c.hyperMatches.get(p):null,L=null,q=p.nextSibling,D=0,O=A;for(;O&&O!=w;){if(h(O,p)){if(a(c,O,p)||O===C&&!c.idMap.has(O))return O;if(L===null){let P=O instanceof Element&&c.hyperMatchedOldElements.has(O);!c.idMap.has(O)&&!P&&(L=O)}}if(L===null&&q&&h(O,q)&&(D++,q=q.nextSibling,D>=2&&(L=void 0)),c.activeElementAndParents.includes(O))break;O=O.nextSibling}return L||null}function a(c,p,A){let w=c.idMap.get(p),C=c.idMap.get(A);if(!C||!w)return!1;for(let L of w)if(C.has(L))return!0;return!1}function h(c,p){let A=c,w=p;return A.nodeType===w.nodeType&&A.tagName===w.tagName&&(!A.getAttribute?.("id")||A.getAttribute?.("id")===w.getAttribute?.("id"))}return i})();function T(i,a){let h=a instanceof Element&&i.hyperMatchedOldElements.has(a)&&!i.idMap.has(a);if(i.idMap.has(a)||h)g(i.pantry,a,null);else{if(i.callbacks.beforeNodeRemoved(a)===!1)return;a.parentNode?.removeChild(a),i.callbacks.afterNodeRemoved(a)}}function x(i,a,h){let c=a;for(;c&&c!==h;){let p=c;c=c.nextSibling,t(p)||T(i,p)}return c}function E(i,a,h,c){let p=c.target.getAttribute?.("id")===a&&c.target||c.target.querySelector(`[id="${a}"]`)||c.pantry.querySelector(`[id="${a}"]`);return d(p,c),g(i,p,h),p}function d(i,a){let h=i.getAttribute("id");for(;i=i.parentNode;){let c=a.idMap.get(i);c&&(c.delete(h),c.size||a.idMap.delete(i))}}function g(i,a,h){if(i.moveBefore)try{i.moveBefore(a,h)}catch{i.insertBefore(a,h)}else i.insertBefore(a,h)}return m})(),y=(function(){function m(d,g,i){return i.ignoreActive&&d===document.activeElement?null:(i.callbacks.beforeNodeMorphed(d,g)===!1||(d instanceof HTMLHeadElement&&i.head.ignore||(d instanceof HTMLHeadElement&&i.head.style!=="morph"?b(d,g,i):(k(d,g,i),E(d,i)||f(i,d,g))),i.callbacks.afterNodeMorphed(d,g)),d)}function k(d,g,i){let a=g.nodeType;if(a===1){let h=d,c=g,p=h.attributes,A=c.attributes;for(let w of A)x(w.name,h,"update",i)||h.getAttribute(w.name)!==w.value&&h.setAttribute(w.name,w.value);for(let w=p.length-1;0<=w;w--){let C=p[w];if(C&&!c.hasAttribute(C.name)){if(x(C.name,h,"remove",i))continue;h.removeAttribute(C.name)}}E(h,i)||M(h,c,i)}(a===8||a===3)&&d.nodeValue!==g.nodeValue&&(d.nodeValue=g.nodeValue)}function M(d,g,i){if(d instanceof HTMLInputElement&&g instanceof HTMLInputElement&&g.type!=="file"){let a=g.value,h=d.value;T(d,g,"checked",i),T(d,g,"disabled",i),i.formStateSync==="property"?h!==a&&(x("value",d,"update",i)||(d.value=a)):g.hasAttribute("value")?h!==a&&(x("value",d,"update",i)||(d.setAttribute("value",a),d.value=a)):x("value",d,"remove",i)||(d.value="",d.removeAttribute("value"))}else if(d instanceof HTMLOptionElement&&g instanceof HTMLOptionElement)T(d,g,"selected",i);else if(d instanceof HTMLTextAreaElement&&g instanceof HTMLTextAreaElement){let a=g.value,h=d.value;if(x("value",d,"update",i))return;a!==h&&(d.value=a),d.firstChild&&d.firstChild.nodeValue!==a&&(d.firstChild.nodeValue=a)}}function T(d,g,i,a){let h=g[i],c=d[i];if(h!==c){let p=x(i,d,"update",a);if(p||(d[i]=g[i]),a.formStateSync==="property")return;h?p||d.setAttribute(i,""):x(i,d,"remove",a)||d.removeAttribute(i)}}function x(d,g,i,a){return d==="value"&&a.ignoreActiveValue&&g===document.activeElement?!0:a.callbacks.beforeAttributeUpdated(d,g,i)===!1}function E(d,g){return!!g.ignoreActiveValue&&d===document.activeElement&&d!==document.body}return m})();function v(m,k,M,T){if(m.head.block){let x=k.querySelector("head"),E=M.querySelector("head");if(x&&E){let d=b(x,E,m);return Promise.all(d).then(()=>{let g=Object.assign(m,{head:{block:!1,ignore:!0}});return T(g)})}}return T(m)}function b(m,k,M){let T=[],x=[],E=[],d=[],g=M.scripts.matchMode,i=c=>{if(c.tagName==="SCRIPT")return r(c,g);if(c.tagName==="LINK"&&g==="smart"){let p=c.getAttribute("href");if(p)try{let A=new URL(p,window.location.href);return`link:${c.getAttribute("rel")||""}:${A.origin}${A.pathname}${A.search}`}catch{}}return c.outerHTML},a=new Map;for(let c of k.children)t(c)||a.set(i(c),c);for(let c of m.children){let p=i(c),A=a.has(p),w=M.head.shouldReAppend(c),C=M.head.shouldPreserve(c);A||C?w?x.push(c):(a.delete(p),E.push(c)):M.head.style==="append"?w&&(x.push(c),d.push(c)):M.head.shouldRemove(c)!==!1&&!t(c)&&x.push(c)}d.push(...a.values());let h=[];for(let c of d){let p=document.createRange().createContextualFragment(c.outerHTML).firstChild;if(M.callbacks.beforeNodeAdded(p)!==!1){if("href"in p&&p.href||"src"in p&&p.src){let A,w=new Promise(function(C){A=C});p.addEventListener("load",function(){A()}),h.push(w)}m.appendChild(p),M.callbacks.afterNodeAdded(p),T.push(p)}}for(let c of x)M.callbacks.beforeNodeRemoved(c)!==!1&&(m.removeChild(c),M.callbacks.afterNodeRemoved(c));return M.head.afterHeadMorphed(m,{added:T,kept:E,removed:x}),h}function S(m,k,M){if(!M.scripts.handle)return[];let T=[],x=[],E=[],d=[],g=M.scripts.matchMode,i=Array.from(m.querySelectorAll("script"));for(let h of i){let c=r(h,g),p=k.has(c),A=M.scripts.shouldPreserve(h),w=M.scripts.shouldReAppend(h);p||A?w?(x.push(h),d.push(h)):E.push(h):d.push(h)}for(let h of k){let c=i.some(p=>p.outerHTML===h)}let a=[];for(let h of d){if(M.callbacks.beforeNodeAdded(h)===!1)continue;let c=document.createRange().createContextualFragment(h.outerHTML).firstChild;if(c.src){let p,A=new Promise(function(w){p=w});c.addEventListener("load",function(){p()}),c.addEventListener("error",function(){p()}),a.push(A)}h.replaceWith(c),M.callbacks.afterNodeAdded(c),T.push(c)}return M.scripts.afterScriptsHandled(m,{added:T,kept:E,removed:x}),a}let R=(function(){function m(i,a,h){let{persistentIds:c,idMap:p}=d(i,a),A=s.computeMatches(i,a);if(typeof h.key=="function"){let q=new Map,D=new Set,O=j=>{let H=h.key(j);H!=null&&(q.has(H)?D.add(H):q.set(H,j))};i instanceof Element&&O(i);for(let j of i.querySelectorAll("*"))O(j);for(let j of D)q.delete(j);let P=new Map;for(let[j,H]of A)P.set(H,j);let J=a.__hyperMorphRoot||a,K=new Map,le=new Set,ue=j=>{let H=h.key(j);H!=null&&(K.has(H)?le.add(H):K.set(H,j))};J instanceof Element&&ue(J);for(let j of J.querySelectorAll("*"))ue(j);for(let j of le)K.delete(j);for(let[j,H]of K){let _=q.get(j);if(!_||_.tagName!==H.tagName)continue;let X=P.get(_);X&&X!==H&&A.delete(X);let Q=A.get(H);Q&&Q!==_&&P.delete(Q),A.set(H,_),P.set(_,H)}}let w=new Set;for(let q of A.values())w.add(q);let C=k(h),L=C.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(L))throw`Do not understand how to morph style ${L}`;return{target:i,newContent:a,config:C,morphStyle:L,ignoreActive:C.ignoreActive,ignoreActiveValue:C.ignoreActiveValue,restoreFocus:C.restoreFocus,formStateSync:C.formStateSync||"attribute",idMap:p,persistentIds:c,hyperMatches:A,hyperMatchedOldElements:w,pantry:M(),activeElementAndParents:T(i),callbacks:C.callbacks,head:C.head,scripts:C.scripts}}function k(i){let a=Object.assign({},n);return Object.assign(a,i),a.callbacks=Object.assign({},n.callbacks,i.callbacks),a.head=Object.assign({},n.head,i.head),a.scripts=Object.assign({},n.scripts,i.scripts),a}function M(){let i=document.createElement("div");return i.hidden=!0,document.body.insertAdjacentElement("afterend",i),i}function T(i){let a=[],h=document.activeElement;if(h?.tagName!=="BODY"&&i.contains(h))for(;h&&(a.push(h),h!==i);)h=h.parentElement;return a}function x(i){let a=Array.from(i.querySelectorAll("[id]"));return i.getAttribute?.("id")&&a.push(i),a}function E(i,a,h,c){for(let p of c){let A=p.getAttribute("id");if(a.has(A)){let w=p;for(;w;){let C=i.get(w);if(C==null&&(C=new Set,i.set(w,C)),C.add(A),w===h)break;w=w.parentElement}}}}function d(i,a){let h=x(i),c=x(a),p=g(h,c),A=new Map;E(A,p,i,h);let w=a.__hyperMorphRoot||a;return E(A,p,w,c),{persistentIds:p,idMap:A}}function g(i,a){let h=new Set,c=new Map;for(let{id:A,tagName:w}of i)c.has(A)?h.add(A):c.set(A,w);let p=new Set;for(let{id:A,tagName:w}of a)p.has(A)?h.add(A):c.get(A)===w&&p.add(A);for(let A of h)p.delete(A);return p}return m})(),{normalizeElement:I,normalizeParent:N}=(function(){let m=new WeakSet;function k(E){return E instanceof Document?E.documentElement:E}function M(E){if(E==null)return document.createElement("div");if(typeof E=="string")return M(x(E));if(m.has(E))return E;if(E instanceof Node){if(E.parentNode)return new T(E);{let d=document.createElement("div");return d.append(E),d}}else{let d=document.createElement("div");for(let g of[...E])d.append(g);return d}}class T{constructor(d){this.originalNode=d,this.realParentNode=d.parentNode,this.previousSibling=d.previousSibling,this.nextSibling=d.nextSibling}get childNodes(){let d=[],g=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;g&&g!=this.nextSibling;)d.push(g),g=g.nextSibling;return d}querySelectorAll(d){return this.childNodes.reduce((g,i)=>{if(i instanceof Element){i.matches(d)&&g.push(i);let a=i.querySelectorAll(d);for(let h=0;h<a.length;h++)g.push(a[h])}return g},[])}insertBefore(d,g){return this.realParentNode.insertBefore(d,g)}moveBefore(d,g){return this.realParentNode.moveBefore(d,g)}get __hyperMorphRoot(){return this.originalNode}}function x(E){let d=new DOMParser,g=E.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(g.match(/<\/html>/)||g.match(/<\/head>/)||g.match(/<\/body>/)){let i=d.parseFromString(E,"text/html");if(g.match(/<\/html>/))return m.add(i),i;{let a=i.firstChild;return a&&m.add(a),a}}else{let a=d.parseFromString("<body><template>"+E+"</template></body>","text/html").body.querySelector("template").content;return m.add(a),a}}return{normalizeElement:k,normalizeParent:M}})();return{morph:o,defaults:n}})();var Ho=st.morph,$o=st.defaults,Dt=st;function Ne(e,t){Dt.morph(e,t,{morphStyle:"innerHTML",ignoreActiveValue:!0,restoreFocus:!0,formStateSync:"property"})}function Bt(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}var Ut={"@scalar":`
3
+ <label class="hcms-field" data-hcms-shape="scalar">
4
+ <span class="hcms-label" data-hcms-label></span>
5
+ <input class="hcms-input" data-hcms-field />
6
+ <div class="hcms-error" hidden></div>
7
+ </label>
8
+ `,"@object":`
9
+ <section class="hcms-object" data-hcms-shape="object">
10
+ <h3 class="hcms-object-title" data-hcms-label></h3>
11
+ <div class="hcms-object-fields"></div>
12
+ <div class="hcms-error" hidden></div>
13
+ </section>
14
+ `,"@scalar-array":`
15
+ <section class="hcms-array hcms-scalar-array" data-hcms-shape="scalar-array">
16
+ <header class="hcms-array-header">
17
+ <h3 class="hcms-array-title" data-hcms-label></h3>
18
+ </header>
19
+ <ul class="hcms-array-items"></ul>
20
+ <div class="hcms-error" hidden></div>
21
+ <button type="button" class="hcms-add" data-hcms-action="add">+ Add</button>
22
+ </section>
23
+ `,"@scalar-array-item":`
24
+ <li class="hcms-array-item" draggable="true">
25
+ <span class="hcms-drag-handle" aria-hidden="true">::</span>
26
+ <input class="hcms-input" data-hcms-field />
27
+ <button type="button" class="hcms-move hcms-move-up hcms-sr-only" data-hcms-action="move-up" aria-label="Move up">\u2191</button>
28
+ <button type="button" class="hcms-move hcms-move-down hcms-sr-only" data-hcms-action="move-down" aria-label="Move down">\u2193</button>
29
+ <button type="button" class="hcms-remove" data-hcms-action="remove" aria-label="Remove">x</button>
30
+ <div class="hcms-error" hidden></div>
31
+ </li>
32
+ `,"@object-array":`
33
+ <section class="hcms-array hcms-object-array" data-hcms-shape="object-array">
34
+ <header class="hcms-array-header">
35
+ <h3 class="hcms-array-title" data-hcms-label></h3>
36
+ </header>
37
+ <div class="hcms-array-items"></div>
38
+ <div class="hcms-error" hidden></div>
39
+ <button type="button" class="hcms-add" data-hcms-action="add">+ Add</button>
40
+ </section>
41
+ `,"@object-array-item":`
42
+ <article class="hcms-card" draggable="true">
43
+ <header class="hcms-card-header">
44
+ <span class="hcms-drag-handle" aria-hidden="true">::</span>
45
+ <button type="button" class="hcms-move hcms-move-up hcms-sr-only" data-hcms-action="move-up" aria-label="Move up">\u2191</button>
46
+ <button type="button" class="hcms-move hcms-move-down hcms-sr-only" data-hcms-action="move-down" aria-label="Move down">\u2193</button>
47
+ <button type="button" class="hcms-remove" data-hcms-action="remove" aria-label="Remove">x</button>
48
+ </header>
49
+ <div class="hcms-card-fields"></div>
50
+ <div class="hcms-error" hidden></div>
51
+ </article>
52
+ `},Cn=Object.keys(Ut);function Le(e){let t=e.head||e.documentElement;if(t)for(let r of Cn){if(V(e,r))continue;let n=e.createElement("template");n.setAttribute("data-hcms-tpl",r),n.setAttribute("save-remove",""),n.innerHTML=Ut[r].trim(),t.appendChild(n)}}function V(e,t){return!e||!e.querySelector?null:e.querySelector(`template[data-hcms-tpl="${Nn(t)}"]`)}function Nn(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}function oe(e){return typeof e=="string"?e.endsWith("[]")?"scalar-array":"scalar":Array.isArray(e)?"object-array":typeof e=="object"&&e!==null?"object":"scalar"}function Ee(e){return e?!!(e.content||e).querySelector("[data-hcms-field]"):!1}var Wt={IMG:"src",A:"href"};function Oe(e){if(!e)return"value";let t=(e.tagName||"").toUpperCase();return t==="INPUT"?(e.getAttribute("type")||"text").toLowerCase()==="checkbox"?"checked":"value":t==="TEXTAREA"||t==="SELECT"?"value":Wt[t]?Wt[t]:null}function Vt(e,t){let r=(e.tagName||"").toUpperCase(),n=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),s=Oe(e),u=`${zt(r,n)}[data-hcms-field="${ie(t)}"]`;return r==="INPUT"&&n==="radio"?`${u}:checked@value`:s?`${u}@${s}`:u}function Ln(e){let t=(e.tagName||"").toUpperCase(),r=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),n=Oe(e),o=`${zt(t,r)}[data-hcms-field]`;return t==="INPUT"&&r==="radio"?`${o}:checked@value`:n?`${o}@${n}`:o}function zt(e,t){return e==="INPUT"?t?`input[type="${t}"]`:"input":e==="TEXTAREA"?"textarea":e==="SELECT"?"select":e==="IMG"?"img":e==="A"?"a":':not([data-hcms-shape="scalar"]):not([data-hcms-shape="object"]):not([data-hcms-shape="object-array"]):not([data-hcms-shape="scalar-array"])'}function ie(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var Kt=new Set(["__proto__","constructor","prototype"]);function je(e,t){return r(e,[]);function r(y,v){let b=oe(y);if(b==="scalar")return n(y,v);if(b==="scalar-array")return s(v);if(b==="object-array")return o(y,v);if(b==="object"){let S=Object.create(null);for(let[R,I]of Object.entries(y)){if(Kt.has(R))throw new Error(`hypercms: rule key "${R}" is forbidden at "${v.join(".")||"<root>"}"`);S[R]=r(I,[...v,R])}return S}return null}function n(y,v){let b=v.length?v[v.length-1]:null,S=typeof b=="string"?b:"__value",R=f(v,S);if(R)return Vt(R,S);let I=l("@scalar",S);return I?Vt(I,S):`input[data-hcms-field="${ie(S)}"]@value`}function s(y){let v=l("@scalar-array-item",null),b=v?Ln(v):"input[data-hcms-field]@value";return[u(y,"[data-hcms-array-item]"),b]}function o(y,v){let[,b]=y,S=[...v,"*"],R=u(v,"[data-hcms-card]");if(b&&typeof b=="object"&&!Array.isArray(b)){let I=Object.create(null);for(let[N,m]of Object.entries(b)){if(Kt.has(N))throw new Error(`hypercms: rule key "${N}" is forbidden at "${S.join(".")}"`);I[N]=r(m,[...S,N])}return[R,I]}return[R,r(b,[...S,0])]}function u(y,v){let b=y.length?y[y.length-1]:"",S=y.some(N=>N==="*"),R=y.join(".");return`${S?`[data-hcms-field="${ie(b)}"]`:`[data-hcms-path="${ie(R)}"]`} > .hcms-array-items > ${v}`}function l(y,v){if(!t)return null;let b=V(t,y);if(!b)return null;let S=b.content||b;if(v){let R=S.querySelector(`[data-hcms-field="${ie(v)}"]`);if(R)return R}return S.querySelector("[data-hcms-field]")}function f(y,v){if(!t)return null;let b=y.map(I=>typeof I=="number"?"*":I).join("."),R=[y.join("."),b];for(let I=y.length-1;I>=0;I--){let N=y.slice(0,I).map(m=>typeof m=="number"?"*":m);N.push("*"),R.push(N.join("."))}for(let I of R){if(!I)continue;let N=V(t,I);if(!N||!Ee(N))continue;let m=N.content||N,k=m.querySelector(`[data-hcms-field="${ie(v)}"]`)||m.querySelector("[data-hcms-field]");if(k)return k}return null}}function He({pageRules:e,formRules:t,data:r,doc:n}){let s=n.createDocumentFragment(),o=ot(e,[],r,n);return o&&s.appendChild(o),s}function Yt({shape:e,itemShape:t,pathArr:r,data:n,doc:s}){if(e==="object-array-item")return Zt(t,r,n,s);if(e==="scalar-array-item")return Jt(r,n,s);throw new Error(`hypercms: buildItem called with unknown shape "${e}"`)}function ot(e,t,r,n){let s=oe(e);return s==="scalar"?On(t,r,n):s==="object"?jn(e,t,r,n):s==="object-array"?Hn(e,t,r,n):s==="scalar-array"?$n(e,t,r,n):null}function On(e,t,r){let n=$e(e,"@scalar",r);if(!n)throw new Error(`hypercms: missing template for scalar at "${e.join(".")}"`);let s=ae(n,r);return ce(s,e),qn(s,z(e)),qe(s,z(e)),Fe(s,z(e)),rr(s,t),s}function jn(e,t,r,n){let s=$e(t,"@object",n);if(!s)throw new Error(`hypercms: missing template for object at "${t.join(".")}"`);let o=ae(s,n);if(ce(o,t),qe(o,z(t)),Fe(o,z(t)),Ee(s))return sr(o,e,t),nr(o,e,r),o;let u=Pe(o,".hcms-object-fields",s,t);for(let[l,f]of Object.entries(e)){let y=r==null?null:r[l],v=ot(f,[...t,l],y,n);v&&u.appendChild(v)}return o}function Hn(e,t,r,n){let s=$e(t,"@object-array",n);if(!s)throw new Error(`hypercms: missing template for object-array at "${t.join(".")}"`);let o=ae(s,n);ce(o,t),qe(o,z(t)),Fe(o,z(t)),Qt(o,s),tr(o,s,t);let u=Pe(o,".hcms-array-items",s,t),[,l]=e;return(Array.isArray(r)?r:[]).forEach((y,v)=>{let b=Zt(l,[...t,v],y,n);b&&u.appendChild(b)}),er(o),o}function Zt(e,t,r,n){let s=Xt(t,"object-array-item",n);if(!s)throw new Error(`hypercms: missing item template for "${t.join(".")}"`);let o=ae(s,n);if(o.setAttribute("data-hcms-card",""),o.classList.contains("hcms-card")||o.classList.add("hcms-card"),ce(o,t),Ee(s))return e&&typeof e=="object"&&!Array.isArray(e)&&(sr(o,e,t),nr(o,e,r)),o;let u=Pe(o,".hcms-card-fields",s,t);if(e&&typeof e=="object"&&!Array.isArray(e))for(let[l,f]of Object.entries(e)){let y=r==null?null:r[l],v=ot(f,[...t,l],y,n);v&&u.appendChild(v)}return o}function $n(e,t,r,n){let s=$e(t,"@scalar-array",n);if(!s)throw new Error(`hypercms: missing template for scalar-array at "${t.join(".")}"`);let o=ae(s,n);ce(o,t),qe(o,z(t)),Fe(o,z(t)),Qt(o,s),tr(o,s,t);let u=Pe(o,".hcms-array-items",s,t);return(Array.isArray(r)?r:[]).forEach((f,y)=>{let v=Jt([...t,y],f,n);v&&u.appendChild(v)}),er(o),o}function Jt(e,t,r){let n=Xt(e,"scalar-array-item",r);if(!n)throw new Error(`hypercms: missing item template for "${e.join(".")}"`);let s=ae(n,r);return s.setAttribute("data-hcms-array-item",""),s.classList.contains("hcms-array-item")||s.classList.add("hcms-array-item"),ce(s,e),rr(s,t),s}function $e(e,t,r){let n=e.join("."),s=e.map(o=>typeof o=="number"?"*":o).join(".");return n&&V(r,n)||s&&s!==n&&V(r,s)||V(r,t)}function Xt(e,t,r){let n=e.map(s=>typeof s=="number"?"*":s).join(".");return V(r,n)||V(r,"@"+t)}function ae(e,t){let r=e.content||e,n=t.createElement("div");return n.appendChild(r.cloneNode(!0)),n.firstElementChild||n}function ce(e,t){e.setAttribute("data-hcms-path",t.join("."))}function qn(e,t){let r=t==null?"":String(t);if(e.matches&&e.matches("[data-hcms-field]")){e.getAttribute("data-hcms-field")||e.setAttribute("data-hcms-field",r);return}(e.querySelectorAll?e.querySelectorAll("[data-hcms-field]"):[]).forEach(s=>{s.getAttribute("data-hcms-field")||s.setAttribute("data-hcms-field",r)})}function qe(e,t){t==null||t===""||!e.setAttribute||e.hasAttribute?.("data-hcms-field")||e.setAttribute("data-hcms-field",String(t))}function Fe(e,t){if(t==null||t==="")return;(e.querySelectorAll?e.querySelectorAll("[data-hcms-label]"):[]).forEach(n=>{(n.textContent||"").trim()===""&&(n.textContent=Bt(String(t)))})}function Qt(e,t){["data-hcms-no-add","data-hcms-no-remove","data-hcms-no-reorder"].forEach(r=>{t.hasAttribute(r)&&e.setAttribute(r,"")}),["data-hcms-min-items","data-hcms-max-items"].forEach(r=>{t.hasAttribute(r)&&e.setAttribute(r,t.getAttribute(r))})}function er(e){let t=e.querySelector?e.querySelector(".hcms-array-items"):null;if(!t)return;let r=Array.from(t.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),n=r.length,s=Gt(e,"data-hcms-max-items"),o=Gt(e,"data-hcms-min-items"),u=e.hasAttribute("data-hcms-no-add"),l=e.hasAttribute("data-hcms-no-remove"),f=e.hasAttribute("data-hcms-no-reorder"),y=e.querySelector('[data-hcms-action="add"]');y&&(y.hidden=u||s!=null&&n>=s),r.forEach((v,b)=>{let S=v.querySelector('[data-hcms-action="remove"]');S&&(S.hidden=l||o!=null&&n<=o);let R=v.querySelector('[data-hcms-action="move-up"]');R&&(R.hidden=f||b===0);let I=v.querySelector('[data-hcms-action="move-down"]');I&&(I.hidden=f||b===n-1)})}function Gt(e,t){if(!e||!e.hasAttribute(t))return null;let r=parseInt(e.getAttribute(t),10);return Number.isFinite(r)?r:null}function tr(e,t,r){if(e.hasAttribute("data-hcms-no-reorder")||t.hasAttribute("data-hcms-no-reorder"))return;let n=e.querySelector(".hcms-array-items");if(!n)return;let s="hcms-"+r.join(".");n.setAttribute("sortable",s),n.setAttribute("onsorted","hypercmsCommit && hypercmsCommit()")}function z(e){return e.length?e[e.length-1]:null}function rr(e,t){let r=Fn(e);if(r.length!==0)for(let n of r)or(n,t)}function Fn(e){if(!e)return[];let t=[];return e.matches?.("[data-hcms-field]")&&Pn(e)&&t.push(e),(e.querySelectorAll?e.querySelectorAll("input[data-hcms-field], textarea[data-hcms-field], select[data-hcms-field], img[data-hcms-field], a[data-hcms-field], [contenteditable][data-hcms-field]"):[]).forEach(n=>t.push(n)),t}function Pn(e){let t=(e.tagName||"").toUpperCase();return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||t==="IMG"||t==="A"||e.hasAttribute?.("contenteditable"))}function nr(e,t,r){(e.querySelectorAll?e.querySelectorAll("[data-hcms-field]"):[]).forEach(s=>{let o=s.getAttribute("data-hcms-field");if(!o)return;if(!t||typeof t!="object"||!(o in t)){console.warn(`[hypercms] inline template field "${o}" is not in the rule shape; ignoring`);return}let u=r==null?null:r[o];or(s,u)})}function sr(e,t,r){if(!e.querySelectorAll)return;e.querySelectorAll("[data-hcms-field]").forEach(s=>{let o=s.getAttribute("data-hcms-field");if(!o||t&&typeof t=="object"&&!(o in t))return;let u=[...r,o].join(".");s.setAttribute("data-hcms-path",u)})}function Pe(e,t,r,n){if(!e.querySelector)return e;let s=e.querySelector(t);if(s)return s;let o=r?.getAttribute?.("data-hcms-tpl")||n.join(".");throw new Error(`hypercms: template "${o}" is in slotted mode but has no ${t} element`)}function or(e,t){let r=Oe(e),n=(e.tagName||"").toUpperCase(),s=(e.getAttribute("type")||"").toLowerCase();if(n==="INPUT"&&s==="radio"){e.checked=e.value!=null&&String(e.value)===String(t??"");return}if(r==="checked"){e.checked=t===!0||t==="true";return}if(r){e[r]=t==null?"":String(t);return}e.textContent=t==null?"":String(t)}var ir={skip:"[data-hcms-shell]",templateAttr:"cms-template"};function ar(e,t,r,n={}){let{observerHandle:s,shellRoot:o,structural:u,structuralPath:l}=n;s?.pause?.();try{if(!u)try{return F.apply(e,t,r,ir),{ok:!0}}catch(b){return{ok:!1,error:b}}let f=_n(e,t,l),y=f?Bn(f):null,v=f?null:Wn(e,o);try{return F.apply(e,t,r,ir),{ok:!0}}catch(b){return y?Un(f,y):v&&Vn(e,o,v),{ok:!1,error:b}}}finally{s?.resume?.()}}function _n(e,t,r){if(!r||!e)return null;let n=Y(r),s=[],o=t;for(let u of n){if(typeof o=="string"||o==null||Array.isArray(o))break;if(typeof o=="object"&&u in o){if(s.push(u),o=o[u],Array.isArray(o)||typeof o=="string"&&o.endsWith("[]"))break}else return null}return!Array.isArray(o)&&!(typeof o=="string"&&o.endsWith("[]"))?null:Dn(e,t,s)}function Dn(e,t,r){if(r.length===0)return null;let n=e,s=t;for(let o=0;o<r.length;o++){let u=r[o];if(!s||typeof s!="object"||Array.isArray(s))return null;let l=s[u];if(l==null)return null;if(o===r.length-1){if(Array.isArray(l)){let[f]=l;return n.querySelector?.(f)?.parentElement||null}if(typeof l=="string"&&l.endsWith("[]")){let f=l.slice(0,-2);return n.querySelector?.(f)?.parentElement||null}return null}s=l}return null}function Bn(e){let t=[];for(let r of Array.from(e.childNodes))t.push(r.cloneNode(!0));return t}function Un(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function Wn(e,t){let r=[];for(let n of Array.from(e.childNodes))n===t||t&&n.contains?.(t)||r.push(n.cloneNode(!0));return r}function Vn(e,t,r){for(let s of Array.from(e.childNodes))s===t||t&&s.contains?.(t)||e.removeChild(s);let n=Kn(e,t);for(let s of r)e.insertBefore(s,n||null)}function Kn(e,t){if(!t)return null;for(let r of Array.from(e.childNodes))if(r===t||r.contains?.(t))return r;return null}var it=new WeakSet;function ur(e){let{formRoot:t}=e;if(!t||it.has(t))return;it.add(t);let r=u=>{let l=u.target;!l||!l.closest||l.closest("[data-hcms-form-root]")&&l.matches("input, textarea, select")&&(!l.closest("[data-hcms-field]")&&!l.hasAttribute?.("data-hcms-field")||cr(l,e))},n=u=>{let l=u.target;!l||!l.closest||l.closest("[data-hcms-form-root]")&&l.matches('input[type="checkbox"], input[type="radio"], select')&&cr(l,e)},s=u=>{let l=u.target;if(!l||!l.closest)return;let f=l.closest("[data-hcms-action]");if(!f)return;let y=f.getAttribute("data-hcms-action");if(y==="add"||y==="remove"||y==="move-up"||y==="move-down"){if(!f.closest("[data-hcms-form-root]"))return}else if((y==="close"||y==="save")&&!f.closest("[data-hcms-shell]"))return;if(y==="add"){let v=f.closest("[data-hcms-path]");if(!v)return;let b=v.getAttribute("data-hcms-path");at(b,e)}else if(y==="remove"){let v=f.closest("[data-hcms-card], [data-hcms-array-item]");if(!v)return;ct(v,e)}else if(y==="move-up"||y==="move-down"){let v=f.closest("[data-hcms-card], [data-hcms-array-item]");if(!v)return;zn(v,y==="move-up"?-1:1,e)}else y==="close"?e.onCloseRequested?.():y==="save"&&Gn(e)},o=t.ownerDocument;o.addEventListener("input",r,!0),o.addEventListener("change",n,!0),o.addEventListener("click",s,!0),e.detachEvents=()=>{o.removeEventListener("input",r,!0),o.removeEventListener("change",n,!0),o.removeEventListener("click",s,!0),it.delete(t)}}function cr(e,t){let n=(e.closest("[data-hcms-field]")||e).closest("[data-hcms-path]")?.getAttribute("data-hcms-path")||"";Z(B(t),{path:n,structural:!1},t)}function at(e,t){let{formRoot:r,pageRules:n}=t,s=r.querySelector(`[data-hcms-path="${es(e)}"]`);if(!s)throw new Error(`hypercms: no element at path "${e}"`);let o=s.querySelector(".hcms-array-items");if(!o)throw new Error(`hypercms: array container missing .hcms-array-items at "${e}"`);let u=Y(e),l=Xn(n,u),f=Array.isArray(l),y=typeof l=="string"&&l.endsWith("[]");if(!f&&!y)throw new Error(`hypercms: path "${e}" is not an array`);let v=_e(s,"data-hcms-max-items"),b=o.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]");if(s.hasAttribute("data-hcms-no-add")||v!=null&&b.length>=v)return;let S=b.length,R=f?l[1]:l.replace(/\[\]$/,""),I=ve(f?R:"string"),N=Yt({shape:f?"object-array-item":"scalar-array-item",itemShape:R,pathArr:[...u,S],data:I,doc:t.doc});o.appendChild(N),ut(s),Z(B(t),{path:e,structural:!0},t)}function zn(e,t,r){let n=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!n||n.hasAttribute("data-hcms-no-reorder"))return;let s=n.querySelector(".hcms-array-items");if(!s)return;let o=Array.from(s.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),u=o.indexOf(e);if(u<0)return;let l=u+t;if(l<0||l>=o.length)return;let f=e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`);t<0?s.insertBefore(e,o[l]):s.insertBefore(e,o[l].nextSibling),ft(s),ut(n),f&&typeof f.focus=="function"&&e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`)?.focus?.(),Z(B(r),{path:n.getAttribute("data-hcms-path")||"",structural:!0},r)}function ct(e,t){let r=e.getAttribute("data-hcms-path")||"",n=e.parentElement,s=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!s?.hasAttribute("data-hcms-no-remove")){if(s){let o=_e(s,"data-hcms-min-items"),u=s.querySelector(".hcms-array-items"),l=u?u.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]").length:0;if(o!=null&&l<=o)return}e.remove(),n&&ft(n),s&&ut(s),Z(B(t),{path:r,structural:!0},t)}}function Gn(e){let t=B(e);e.dispatch?.("hcms:save",{data:t}),e.onSave?.(t)}function Z(e,t,r){let n=ht(e);if(n===r.lastFingerprint)return{ok:!0,skipped:!0};let s=ar(r.pageRoot,r.pageRules,e,{observerHandle:r.observerHandle,shellRoot:r.shellRoot,structural:!!t.structural,structuralPath:t.path||null});return s.ok?(r.lastFingerprint=n,r.lastData=e,lr(r,null),r.dispatch?.("hcms:change",{data:e,path:t.path,structural:!!t.structural}),r.onChange?.(e,t)):(lr(r,Jn(s.error,t.path)),r.dispatch?.("hcms:error",{error:s.error,attemptedData:e}),r.onError?.(s.error)),s}function B(e){let t=F.extract(e.formRoot,e.formRules);return re(t,e.formRules)}function re(e,t){if(t==null||e==null)return e;if(typeof t=="string")return t.endsWith("@checked")?e===!0||e==="true":e;if(Array.isArray(t)){if(!Array.isArray(e))return e;let[,r]=t;return e.map(n=>re(n,r))}if(typeof t=="object"){if(typeof e!="object"||Array.isArray(e))return e;let r={};for(let[n,s]of Object.entries(t))r[n]=re(e[n],s);return r}return e}function lr(e,t){e.lastErrors=t&&t.length?t:null,lt(e)}function lt(e){if(Yn(e),e.errorEl&&(e.errorEl.textContent="",e.errorEl.hidden=!0),!e.lastErrors)return;let t=[];for(let{message:r,path:n}of e.lastErrors){if(n!=null&&n!==""){let s=Zn(e.formRoot,n);if(s){s.textContent=s.textContent?`${s.textContent}
53
+ ${r}`:r,s.hidden=!1;continue}}t.push(r)}t.length&&e.errorEl&&(e.errorEl.textContent=t.join(`
54
+ `),e.errorEl.hidden=!1)}function Yn(e){if(e.formRoot)for(let t of e.formRoot.querySelectorAll(".hcms-error"))t.textContent="",t.hidden=!0}function Zn(e,t){if(!e)return null;let r=t.split(".");for(;r.length>0;){let n=r.join("."),s=typeof CSS<"u"&&CSS.escape?CSS.escape(n):n.replace(/[^a-zA-Z0-9_\-.*]/g,u=>"\\"+u),o=e.querySelector(`[data-hcms-path="${s}"]`);if(o){for(let u of o.children)if(u.classList&&u.classList.contains("hcms-error"))return u}r.pop()}return null}function Jn(e,t){return e?e.name==="EmptyListInsert"?[{message:"Add a seed item in HTML first.",path:t}]:e.name==="ShapeMismatch"&&Array.isArray(e.mismatches)&&e.mismatches.length?e.mismatches.map(r=>({message:`Shape mismatch: expected ${r.expected}, got ${r.got}`,path:r.path})):[{message:e.message||String(e),path:t}]:[{message:"unknown error",path:t}]}function Xn(e,t){let r=e;for(let n of t){if(r==null||typeof r=="string")return;if(Array.isArray(r)){if(typeof n!="number"&&n!=="*")return;r=r[1];continue}if(typeof r=="object"){if(typeof n=="number"||!(n in r))return;r=r[n];continue}return}return r}function _e(e,t){if(!e||!e.hasAttribute(t))return null;let r=parseInt(e.getAttribute(t),10);return Number.isFinite(r)?r:null}function ut(e){if(!e)return;let t=e.querySelector(".hcms-array-items");if(!t)return;let r=Array.from(t.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),n=r.length,s=_e(e,"data-hcms-max-items"),o=_e(e,"data-hcms-min-items"),u=e.hasAttribute("data-hcms-no-add"),l=e.hasAttribute("data-hcms-no-remove"),f=e.hasAttribute("data-hcms-no-reorder"),y=e.querySelector(':scope > .hcms-add, :scope > * > .hcms-add, :scope > [data-hcms-action="add"]');y&&(y.hidden=u||s!=null&&n>=s),r.forEach((v,b)=>{let S=v.querySelector('[data-hcms-action="remove"]');S&&(S.hidden=l||o!=null&&n<=o);let R=v.querySelector('[data-hcms-action="move-up"]');R&&(R.hidden=f||b===0);let I=v.querySelector('[data-hcms-action="move-down"]');I&&(I.hidden=f||b===n-1)})}function dt(e){!e||!e.querySelectorAll||e.querySelectorAll(".hcms-array-items").forEach(t=>ft(t))}function ft(e){let t=0;for(let r of e.children){if(!r.matches?.("[data-hcms-card], [data-hcms-array-item]"))continue;let n=r.getAttribute("data-hcms-path");if(!n)continue;let s=n.split(".");s[s.length-1]=String(t);let o=s.join(".");o!==n&&Qn(r,n,o),t++}}function Qn(e,t,r){let n=e.querySelectorAll("[data-hcms-path]");e.setAttribute("data-hcms-path",r);for(let s of n){let o=s.getAttribute("data-hcms-path");o===t?s.setAttribute("data-hcms-path",r):o&&o.startsWith(t+".")&&s.setAttribute("data-hcms-path",r+o.slice(t.length))}}function ht(e){return JSON.stringify(e,(t,r)=>{if(r&&typeof r=="object"&&!Array.isArray(r)){let n=Object.create(null);for(let s of Object.keys(r).sort())n[s]=r[s];return n}return r})}function es(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var is={},mt="hcms-shell-styles",ts="hcms-bundled-styles-installed",rs='a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',Me=new WeakSet,pt="";function dr(e){pt=e}var ns=0;function fr({mountTo:e,side:t="right",overlay:r=!1,showSaveButton:n=!1,doc:s}){ss(s);let o=`hcms-shell-title-${++ns}`,u=s.createElement("div");u.setAttribute("data-hcms-shell",""),u.setAttribute("save-remove",""),u.setAttribute("tabindex","-1"),u.setAttribute("role","dialog"),u.setAttribute("aria-modal","true"),u.setAttribute("aria-labelledby",o),u.className="hcms-shell hcms-side-"+t+(r?" hcms-overlay":""),u.innerHTML=`
55
+ <header class="hcms-shell-header">
56
+ <h2 class="hcms-shell-title" id="${o}">Edit</h2>
57
+ <button type="button" class="hcms-shell-close" data-hcms-action="close" aria-label="Close">\xD7</button>
58
+ </header>
59
+ <div class="hcms-shell-error" role="alert" hidden></div>
60
+ <div data-hcms-form-root class="hcms-form"></div>
61
+ <footer class="hcms-shell-footer"${n?"":" hidden"}>
62
+ <button type="button" class="hcms-shell-save" data-hcms-action="save">Save</button>
63
+ </footer>
64
+ `,(e||s.body).appendChild(u);let f=s.body;f.classList.add("hcms-open"),r&&f.classList.add("hcms-overlay"),t==="left"&&f.classList.add("hcms-side-left");let y=os(u,s);return{root:u,formRoot:u.querySelector("[data-hcms-form-root]"),errorEl:u.querySelector(".hcms-shell-error"),saveButton:u.querySelector(".hcms-shell-save"),destroy(){y.detach(),u.remove(),f.classList.remove("hcms-open","hcms-overlay","hcms-side-left")}}}function ss(e){if(e&&!Me.has(e)){if(e[ts]){Me.add(e);return}if(e.getElementById(mt)||e.querySelector("style[data-hcms-bundled-styles]")){Me.add(e);return}if(pt){let t=e.createElement("style");t.id=mt,t.setAttribute("save-remove",""),t.textContent=pt,(e.head||e.documentElement).appendChild(t),Me.add(e);return}try{let t=new URL("./styles.css",is.url).href,r=e.createElement("link");r.rel="stylesheet",r.id=mt,r.setAttribute("save-remove",""),r.href=t,(e.head||e.documentElement).appendChild(r),Me.add(e)}catch{}}}function os(e,t){function r(n){if(n.key!=="Tab"||!e.contains(t.activeElement))return;let s=Array.from(e.querySelectorAll(rs));if(s.length===0)return;let o=s[0],u=s[s.length-1];n.shiftKey&&t.activeElement===o?(n.preventDefault(),u.focus()):!n.shiftKey&&t.activeElement===u&&(n.preventDefault(),o.focus())}return t.addEventListener("keydown",r),{detach:()=>t.removeEventListener("keydown",r)}}var as={skip:"[data-hcms-shell]",templateAttr:"cms-template"};function yt(e){let t=F.findRulesIn(e.pageRoot)||e.doc.documentElement&&F.findRulesIn(e.doc.documentElement)||F.findRulesIn(e.doc);t&&(e.pageRules=t.rules,e.rulesTagNode=t.tagNode),Le(e.doc),e.formRules=je(e.pageRules,e.doc);let r=re(F.extract(e.pageRoot,e.pageRules,as),e.pageRules),n=He({pageRules:e.pageRules,formRules:e.formRules,data:r,doc:e.doc});Ne(e.formRoot,n),lt(e),e.updateFingerprint&&e.updateFingerprint()}function hr({debounce:e=100,onRefresh:t}){let r=typeof window<"u"&&window.hyperclay&&window.hyperclay.Mutation||null;if(!r||typeof r.onAnyChange!="function")throw new Error("hypercms: window.hyperclay.Mutation is required. Load hyperclayjs (or just the mutation utility) before initializing hypercms.");let n=0,s=r.onAnyChange({debounce:e},()=>{n>0||t()});return{unsubscribe:typeof s=="function"?s:()=>{},pause(){n++},resume(){n=Math.max(0,n-1)}}}var cs="[hypercms]";function mr(e,t){if(!e||!e.querySelectorAll||!t)return;let r=ls(t);e.querySelectorAll("template[data-hcms-tpl]").forEach(s=>{let o=s.getAttribute("data-hcms-tpl");o&&(o.startsWith("@")||r.has(o)||console.warn(`${cs} template "${o}" doesn't match any rule path; ignored`))})}function ls(e){let t=new Set;return r([],e),t;function r(n,s){let o=n.join("."),u=n.map(f=>typeof f=="number"?"*":f).join(".");o&&t.add(o),u&&t.add(u);let l=oe(s);if(l==="object")for(let[f,y]of Object.entries(s))r([...n,f],y);else if(l==="object-array"||l==="scalar-array"){let f=[...n,"*"],y=f.map(v=>typeof v=="number"?"*":v).join(".");if(t.add(y),l==="object-array"){let v=s[1];if(v&&typeof v=="object"&&!Array.isArray(v))for(let[b,S]of Object.entries(v))r([...f,b],S)}}}}function pr(e){dr(e)}var $={isOpen:!1,ctx:null,shell:null,opts:null};function us(e={}){if($.isOpen){console.warn("cms.open() called while already open; ignoring");return}let t=e.pageRoot||(typeof document<"u"?document.body:null);if(!t)throw new Error("hypercms: no pageRoot available");let r=t.ownerDocument||(typeof document<"u"?document:null);if(!r)throw new Error("hypercms: no document available");let n=F.findRulesIn(t)||F.findRulesIn(r.documentElement)||F.findRulesIn(r);if(!n)throw new Error("hypercms: no rules tag found in page");let s=n.rules,o=n.tagNode;Le(r),mr(r,s);let u=je(s,r),l=re(F.extract(t,s,{skip:"[data-hcms-shell]",templateAttr:"cms-template"}),s),f=fr({mountTo:e.mountTo||r.body,side:e.side||"right",overlay:!!e.overlay,showSaveButton:!!e.showSaveButton,doc:r}),y={doc:r,pageRoot:t,pageRules:s,formRules:u,rulesTagNode:o,formRoot:f.formRoot,shellRoot:f.root,errorEl:f.errorEl,lastFingerprint:null,lastData:null,observerHandle:null,onChange:e.onChange,onError:e.onError,onSave:e.onSave,previouslyFocused:r.activeElement,dispatch(b,S){let R=r.defaultView&&r.defaultView.CustomEvent||(typeof CustomEvent<"u"?CustomEvent:null);if(!R)return;let I=new R(b,{bubbles:!0,cancelable:b==="hcms:change"||b==="hcms:save",detail:S});f.root.dispatchEvent(I)},onCloseRequested(){yr()}};y.updateFingerprint=()=>{y.lastFingerprint=ht(B(y))};let v=He({pageRules:s,formRules:u,data:l,doc:r});f.formRoot.appendChild(v),ur(y),y.updateFingerprint(),y.observerHandle=hr({onRefresh:()=>yt(y)}),gt.ctx=y,fs(r),ds(f.root),$.isOpen=!0,$.ctx=y,$.shell=f,$.opts=e,y.dispatch("hcms:open",{pageRoot:t})}function ds(e){let r=e.querySelector('input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"])');r&&typeof r.focus=="function"&&r.focus()}var gt={ctx:null};function fs(e){let t=e.defaultView||(typeof globalThis<"u"?globalThis:null);if(!t)return;let r=function(){let s=gt.ctx;s&&(dt(s.formRoot),Z(B(s),{path:"",structural:!0},s))};typeof t.hypercmsCommit!="function"&&(t.hypercmsCommit=r),typeof globalThis<"u"&&typeof globalThis.hypercmsCommit!="function"&&(globalThis.hypercmsCommit=r)}function yr(){if(!$.isOpen)return;let{ctx:e,shell:t}=$,r=e.previouslyFocused;if(e.dispatch("hcms:close",null),e.observerHandle?.unsubscribe?.(),e.detachEvents?.(),t.destroy(),$.isOpen=!1,$.ctx=null,$.shell=null,$.opts=null,gt.ctx=null,r&&typeof r.focus=="function")try{r.focus()}catch{}}function gr(){$.isOpen&&yt($.ctx)}var hs={getData(){return $.isOpen?B($.ctx):null},setValue(e,t){if(!$.isOpen)throw new Error("hypercms: cms is not open");let r=$.ctx,n=Y(e),s=Ae(r.pageRules,n);if(s===void 0)throw new Error(`hypercms: no rule at path "${e}"`);if(typeof s!="string"||s.endsWith("[]"))throw new Error(`hypercms: setValue requires a leaf scalar path; "${e}" is not a leaf`);let o=ms(r.formRoot,e);if(!o)throw new Error(`hypercms: no field element at path "${e}"`);ps(o,t,r.formRoot,e),Z(B(r),{path:e,structural:!1},r)},addItem(e){if(!$.isOpen)throw new Error("hypercms: cms is not open");at(e,$.ctx)},removeItem(e){if(!$.isOpen)throw new Error("hypercms: cms is not open");let t=$.ctx,r=Y(e);if(typeof r[r.length-1]!="number")throw new Error(`hypercms: removeItem requires an item path; "${e}" is not an array index`);let s=Ae(t.pageRules,r.slice(0,-1));if(!(Array.isArray(s)||typeof s=="string"&&s.endsWith("[]")))throw new Error(`hypercms: removeItem requires an item path; parent of "${e}" is not an array`);let u=t.formRoot.querySelector(`[data-hcms-path="${St(e)}"]`);if(!u)throw new Error(`hypercms: no element at path "${e}"`);ct(u,t)},refresh:gr,_commit(){if(!$.isOpen)return;let e=$.ctx;dt(e.formRoot),Z(B(e),{path:"",structural:!0},e)}};function ms(e,t){let r=St(t),n=`[data-hcms-path="${r}"] input[data-hcms-field], [data-hcms-path="${r}"] textarea[data-hcms-field], [data-hcms-path="${r}"] select[data-hcms-field], [data-hcms-path="${r}"] img[data-hcms-field], [data-hcms-path="${r}"] a[data-hcms-field], [data-hcms-path="${r}"] [contenteditable][data-hcms-field], input[data-hcms-path="${r}"][data-hcms-field], textarea[data-hcms-path="${r}"][data-hcms-field], select[data-hcms-path="${r}"][data-hcms-field], img[data-hcms-path="${r}"][data-hcms-field], a[data-hcms-path="${r}"][data-hcms-field], [contenteditable][data-hcms-path="${r}"][data-hcms-field]`;return e.querySelector(n)}function ps(e,t,r,n){let s=(e.tagName||"").toUpperCase(),o=(e.getAttribute("type")||"").toLowerCase();if(s==="INPUT"&&o==="checkbox"){e.checked=t===!0||t==="true";return}if(s==="INPUT"&&o==="radio"){let u=St(n),l=r.querySelectorAll(`[data-hcms-path="${u}"][data-hcms-field][type="radio"], [data-hcms-path="${u}"] [data-hcms-field][type="radio"]`);l.length?l.forEach(f=>{f.checked=String(f.value)===String(t??"")}):e.checked=String(e.value)===String(t??"");return}if(s==="IMG"){e.src=t==null?"":String(t);return}if(s==="A"){e.href=t==null?"":String(t);return}if("value"in e){e.value=t==null?"":String(t);return}e.textContent=t==null?"":String(t)}var bt={open:us,close:yr,refresh:gr,api:hs,get isOpen(){return $.isOpen},path:rt,scaffold:ve,morphForm:Ne};function St(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var br=`.hcms-shell {
65
+ --hcms-primary: #2563eb;
66
+ --hcms-bg: #F6F7F9;
67
+ --hcms-text: #0f172a;
68
+ --hcms-muted: #64748b;
69
+ --hcms-border: #e2e8f0;
70
+ --hcms-error: #b91c1c;
71
+ --hcms-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
72
+ font-family: var(--hcms-font-family);
73
+ font-size: 14px;
74
+ line-height: 1.45;
75
+ color: var(--hcms-text);
76
+ background: var(--hcms-bg);
77
+ box-sizing: border-box;
78
+ position: fixed;
79
+ top: 0;
80
+ bottom: 0;
81
+ right: 0;
82
+ width: 100vw;
83
+ max-width: 400px;
84
+ overflow-y: auto;
85
+ border-left: 1px solid var(--hcms-border);
86
+ z-index: 2147483000;
87
+ display: flex;
88
+ flex-direction: column;
89
+ box-shadow: -4px 0 24px rgba(15, 23, 42, 0.08);
90
+ }
91
+
92
+ .hcms-shell.hcms-side-left {
93
+ left: 0;
94
+ right: auto;
95
+ border-left: 0;
96
+ border-right: 1px solid var(--hcms-border);
97
+ box-shadow: 4px 0 24px rgba(15, 23, 42, 0.08);
98
+ }
99
+
100
+ .hcms-shell * {
101
+ box-sizing: border-box;
102
+ }
103
+
104
+ .hcms-shell-header {
105
+ display: flex;
106
+ align-items: center;
107
+ justify-content: space-between;
108
+ padding: 16px;
109
+ border-bottom: 1px solid var(--hcms-border);
110
+ }
111
+
112
+ .hcms-shell-title {
113
+ margin: 0;
114
+ font-size: 16px;
115
+ font-weight: 600;
116
+ }
117
+
118
+ .hcms-shell-close {
119
+ background: transparent;
120
+ border: 0;
121
+ color: var(--hcms-muted);
122
+ font-size: 24px;
123
+ line-height: 1;
124
+ cursor: pointer;
125
+ padding: 4px 8px;
126
+ border-radius: 6px;
127
+ }
128
+ .hcms-shell-close:hover { background: rgba(15, 23, 42, 0.06); color: var(--hcms-text); }
129
+
130
+ .hcms-shell-error {
131
+ margin: 12px 16px;
132
+ padding: 10px 12px;
133
+ background: #fef2f2;
134
+ border: 1px solid #fecaca;
135
+ color: var(--hcms-error);
136
+ border-radius: 6px;
137
+ font-size: 13px;
138
+ }
139
+
140
+ .hcms-form {
141
+ flex: 1;
142
+ padding: 16px;
143
+ display: flex;
144
+ flex-direction: column;
145
+ gap: 16px;
146
+ }
147
+
148
+ .hcms-field {
149
+ display: flex;
150
+ flex-direction: column;
151
+ gap: 4px;
152
+ }
153
+
154
+ .hcms-label {
155
+ font-size: 12px;
156
+ font-weight: 600;
157
+ color: var(--hcms-muted);
158
+ text-transform: uppercase;
159
+ letter-spacing: 0.04em;
160
+ }
161
+
162
+ .hcms-input {
163
+ font-family: inherit;
164
+ font-size: 14px;
165
+ padding: 8px 10px;
166
+ border: 1px solid var(--hcms-border);
167
+ border-radius: 6px;
168
+ background: #fdfdfd;
169
+ color: var(--hcms-text);
170
+ width: 100%;
171
+ }
172
+ .hcms-input:focus {
173
+ outline: 2px solid var(--hcms-primary);
174
+ outline-offset: -1px;
175
+ border-color: var(--hcms-primary);
176
+ }
177
+
178
+ textarea.hcms-input { min-height: 80px; resize: vertical; }
179
+
180
+ .hcms-object {
181
+ display: flex;
182
+ flex-direction: column;
183
+ gap: 12px;
184
+ padding: 12px;
185
+ border: 1px solid var(--hcms-border);
186
+ border-radius: 8px;
187
+ background: #fdfdfd;
188
+ }
189
+
190
+ .hcms-object-title,
191
+ .hcms-array-title {
192
+ margin: 0 0 8px;
193
+ font-size: 13px;
194
+ font-weight: 600;
195
+ color: var(--hcms-muted);
196
+ text-transform: uppercase;
197
+ letter-spacing: 0.04em;
198
+ }
199
+
200
+ .hcms-array {
201
+ display: flex;
202
+ flex-direction: column;
203
+ gap: 8px;
204
+ }
205
+
206
+ .hcms-array-header {
207
+ display: flex;
208
+ justify-content: space-between;
209
+ align-items: baseline;
210
+ }
211
+
212
+ .hcms-array-items {
213
+ display: flex;
214
+ flex-direction: column;
215
+ gap: 8px;
216
+ list-style: none;
217
+ padding: 0;
218
+ margin: 0;
219
+ }
220
+
221
+ .hcms-array-item,
222
+ .hcms-card {
223
+ display: flex;
224
+ align-items: center;
225
+ gap: 8px;
226
+ padding: 8px;
227
+ background: #fdfdfd;
228
+ border: 1px solid var(--hcms-border);
229
+ border-radius: 6px;
230
+ }
231
+
232
+ .hcms-card {
233
+ flex-direction: column;
234
+ align-items: stretch;
235
+ padding: 12px;
236
+ gap: 10px;
237
+ }
238
+
239
+ .hcms-card-header {
240
+ display: flex;
241
+ justify-content: space-between;
242
+ align-items: center;
243
+ }
244
+
245
+ .hcms-card-fields {
246
+ display: flex;
247
+ flex-direction: column;
248
+ gap: 10px;
249
+ }
250
+
251
+ .hcms-drag-handle {
252
+ cursor: grab;
253
+ color: var(--hcms-muted);
254
+ user-select: none;
255
+ font-family: monospace;
256
+ font-size: 14px;
257
+ }
258
+
259
+ .hcms-remove,
260
+ .hcms-add {
261
+ font-family: inherit;
262
+ background: transparent;
263
+ border: 1px solid var(--hcms-border);
264
+ border-radius: 6px;
265
+ padding: 4px 10px;
266
+ cursor: pointer;
267
+ font-size: 13px;
268
+ color: var(--hcms-muted);
269
+ }
270
+ .hcms-remove:hover { color: var(--hcms-error); border-color: #fecaca; }
271
+ .hcms-add { align-self: flex-start; padding: 6px 12px; color: var(--hcms-text); }
272
+ .hcms-add:hover { border-color: var(--hcms-primary); color: var(--hcms-primary); }
273
+
274
+ .hcms-error {
275
+ margin: 6px 0;
276
+ padding: 6px 10px;
277
+ background: #fef2f2;
278
+ border: 1px solid #fecaca;
279
+ color: var(--hcms-error);
280
+ border-radius: 6px;
281
+ font-size: 12px;
282
+ }
283
+ .hcms-error[hidden] { display: none; }
284
+
285
+ .hcms-shell-footer {
286
+ border-top: 1px solid var(--hcms-border);
287
+ padding: 12px 16px;
288
+ display: flex;
289
+ justify-content: flex-end;
290
+ }
291
+
292
+ .hcms-shell-save {
293
+ font-family: inherit;
294
+ background: var(--hcms-primary);
295
+ color: #fdfdfd;
296
+ border: 0;
297
+ border-radius: 6px;
298
+ padding: 8px 16px;
299
+ font-size: 14px;
300
+ cursor: pointer;
301
+ font-weight: 500;
302
+ }
303
+ .hcms-shell-save:hover { filter: brightness(1.08); }
304
+
305
+ @media (max-width: 799px) {
306
+ .hcms-shell { max-width: 100vw; }
307
+ }
308
+
309
+ /* Scroll lock only when the sidebar covers the page (overlay + mobile fullscreen). In push mode the page keeps its own scroll. */
310
+ body.hcms-open.hcms-overlay {
311
+ overflow: hidden;
312
+ }
313
+
314
+ body.hcms-open:not(.hcms-overlay) {
315
+ padding-right: 400px;
316
+ }
317
+ body.hcms-open.hcms-side-left:not(.hcms-overlay) {
318
+ padding-right: 0;
319
+ padding-left: 400px;
320
+ }
321
+ @media (max-width: 799px) {
322
+ body.hcms-open:not(.hcms-overlay),
323
+ body.hcms-open.hcms-side-left:not(.hcms-overlay) {
324
+ padding-right: 0;
325
+ padding-left: 0;
326
+ }
327
+ body.hcms-open {
328
+ overflow: hidden;
329
+ }
330
+ }
331
+
332
+ /* sr-only: visually hidden but accessible to screen readers + becomes
333
+ visible on keyboard focus, so keyboard users can see move buttons land. */
334
+ .hcms-sr-only {
335
+ position: absolute;
336
+ width: 1px;
337
+ height: 1px;
338
+ padding: 0;
339
+ margin: -1px;
340
+ overflow: hidden;
341
+ clip: rect(0, 0, 0, 0);
342
+ white-space: nowrap;
343
+ border: 0;
344
+ }
345
+ .hcms-sr-only:focus {
346
+ position: static;
347
+ width: auto;
348
+ height: auto;
349
+ padding: 2px 6px;
350
+ margin: 0 2px;
351
+ overflow: visible;
352
+ clip: auto;
353
+ white-space: normal;
354
+ background: #F6F7F9;
355
+ border: 1px solid #c0c8d6;
356
+ border-radius: 3px;
357
+ color: #1f2532;
358
+ font-size: 12px;
359
+ cursor: pointer;
360
+ }
361
+ .hcms-sr-only[hidden] { display: none; }
362
+ `;pr(br);var bs=bt,Ss={cms:bt};return Mr(As);})();
363
+
364
+ // Auto-export to window unless suppressed by loader.
365
+ // Per hypercms plan locked decision 3: flatten to hyperclay.hypercms.open(),
366
+ // not hyperclay.hypercms.cms.open().
367
+ if (!window.__hyperclayNoAutoExport) {
368
+ window.hyperclay = window.hyperclay || {};
369
+ window.hyperclay.hypercms = hypercms.cms;
370
+ window.h = window.hyperclay;
371
+ }
372
+
373
+ export const cms = hypercms.cms;
374
+ export default hypercms;
@@ -1,13 +0,0 @@
1
- var HyperHtmlApi=(()=>{var B=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var r in t)B(e,r,{get:t[r],enumerable:!0})},ue=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of le(t))!ae.call(e,n)&&n!==r&&B(e,n,{get:()=>t[n],enumerable:!(o=ce(t,n))||o.enumerable});return e};var de=e=>ue(B({},"__esModule",{value:!0}),e);var Be={};ee(Be,{cms:()=>ie,default:()=>qe,engine:()=>se,upgrade:()=>fe});var C=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","href","src","action","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],O=new Set(C);var D={};ee(D,{EmptyListInsert:()=>b,MaxRuleDepthExceeded:()=>E,RulesParseError:()=>x,ShapeMismatch:()=>M,UnknownRulesVersion:()=>T,UpgradeAlreadyRegistered:()=>w});var x=class extends Error{constructor(t,r){super(t),this.name="RulesParseError",this.cause=r}},T=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=t}},E=class extends Error{constructor(t){super(`rule depth exceeded 20 at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},M=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},b=class extends Error{constructor(t){super(`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},w=class extends Error{constructor(){super("upgrade transform already registered; only one registration is allowed per page."),this.name="UpgradeAlreadyRegistered"}};var pe=20;function A(e,t,r){return $(e,t,r,{depth:0,path:[]})}function $(e,t,r,o){if(o.depth>pe)throw new E(o.path);if(typeof r=="string")return he(e,t,r);if(Array.isArray(r)){let[n,s]=r;return e.find(t,n).map((i,f)=>$(e,i,s,{depth:o.depth+1,path:[...o.path,f]}))}if(typeof r=="object"&&r!==null){let n={};for(let[s,c]of Object.entries(r))n[s]=$(e,t,c,{depth:o.depth+1,path:[...o.path,s]});return n}return null}function he(e,t,r){if(r.endsWith("[]")){let n=r.slice(0,-2);return e.find(t,n).map(s=>e.text(s))}if(r.startsWith("@"))return te(e,t,r.slice(1));if(r.includes("@")){let[n,s]=r.split("@"),c=n?e.find(t,n):[t];return c.length===0?null:te(e,c[0],s)}if(r===".")return e.text(t);let o=e.find(t,r);return o.length===0?null:e.text(o[0])}function te(e,t,r){if(O.has(r)){let n=e.prop(t,r);return n==null?null:String(n)}let o=e.attr(t,r);return o||null}var ye=.5;function W(e,t,r,o,n,s,c){let i=e.find(t,r);if(n.length===0){i.forEach(d=>e.remove(d));return}if(n.length>i.length&&i.length===0)throw new b(s.path);let a=i.map(d=>me(e,d,o)),u=null;if(i.length>0){u=e.clone(i[0]);let d=e.stripIds(u);d>0&&console.warn(`[hyper-html-api] stripped ${d} id attribute(s) from cloned template at "${s.path.join(".")||"(root)"}"`)}let p=ge(n,a,o),l=e.parent(i[0]),R=Ae(e,l,i[0]),y=new Set,h=n.map((d,m)=>{let S=p[m];if(S>=0)return y.add(S),i[S];let v=e.clone(u);return e.stripIds(v),v});i.forEach((d,m)=>{y.has(m)||e.remove(d)}),y.forEach(d=>e.remove(i[d])),h.forEach((d,m)=>{e.insertAt(l,d,R+m)}),h.forEach((d,m)=>{if(o===null){let S=n[m];e.text(d,S==null?"":String(S))}else c(e,d,o,n[m],{depth:s.depth+1,path:[...s.path,m]})})}function me(e,t,r){return r===null?e.text(t):A(e,t,r)}function ge(e,t,r){let o=new Array(e.length).fill(-1),n=new Set;return e.forEach((s,c)=>{let i=-1,f=-1;t.forEach((a,u)=>{if(n.has(u))return;let p=Ee(s,a,r),l=p===f&&i>=0?Math.abs(u-c)<Math.abs(i-c):!1;(p>f||l)&&(f=p,i=u)}),f>=ye&&(o[c]=i,n.add(i))}),o}function Ee(e,t,r){if(r===null)return e===t?1:0;let o=Object.keys(r||{});if(o.length===0)return 0;let n=0;for(let s of o)JSON.stringify(e?.[s])===JSON.stringify(t?.[s])&&n++;return n/o.length}function Ae(e,t,r){let o=e.children(t);for(let n=0;n<o.length;n++)if(e.sameNode(o[n],r))return n;return-1}var Re=20,re=new Set(["checked","selected","disabled","readOnly","paused"]);function L(e,t,r,o){let n=[];if(F(r,o,[],n),n.length)throw new M(n);j(e,t,r,o,{depth:0,path:[]})}function j(e,t,r,o,n){if(n.depth>Re)throw new E(n.path);if(o!==void 0){if(typeof r=="string")return Se(e,t,r,o,n);if(Array.isArray(r)){let[s,c]=r;return W(e,t,s,c,o,n,j)}if(typeof r=="object"&&r!==null)for(let[s,c]of Object.entries(r))j(e,t,c,o==null?o:o[s],{depth:n.depth+1,path:[...n.path,s]})}}function Se(e,t,r,o,n){if(r.endsWith("[]")){let c=r.slice(0,-2);return W(e,t,c,null,o,n,j)}if(r.startsWith("@"))return ne(e,t,r.slice(1),o);if(r.includes("@")){let[c,i]=r.split("@"),f=c?e.find(t,c):[t];return f.length===0?void 0:ne(e,f[0],i,o)}if(r==="."){e.text(t,o==null?"":String(o));return}let s=e.find(t,r);s.length!==0&&e.text(s[0],o==null?"":String(o))}function ne(e,t,r,o){O.has(r)?e.prop(t,r,xe(r,o)):e.attr(t,r,o==null?"":String(o))}function xe(e,t){return t==null?re.has(e)?!1:"":re.has(e)?!!t:t}function F(e,t,r,o){if(!(t==null||t==="")){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((n,s)=>{typeof n=="object"&&n!==null&&o.push({path:N([...r,s]),expected:"scalar",got:I(n)})}):o.push({path:N(r),expected:"array",got:I(t)});return}typeof t=="object"&&o.push({path:N(r),expected:"scalar",got:I(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){o.push({path:N(r),expected:"array",got:I(t)});return}let n=e[1];t.forEach((s,c)=>F(n,s,[...r,c],o));return}if(typeof e=="object"&&e!==null){if(Array.isArray(t)||typeof t!="object"){o.push({path:N(r),expected:"object",got:I(t)});return}for(let[n,s]of Object.entries(e))F(s,t[n],[...r,n],o)}}}function I(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function N(e){return e.join(".")}function P(e){try{return JSON.parse(e)}catch(t){throw new x(`hyper-html-api script tags require strict JSON. Relaxed JSON (unquoted keys, single quotes, trailing commas) is only supported in the ?data= URL parameter. Original error: ${t.message}`,t)}}function J(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(n){let s=[],c=0;for(;c<n.length;){let i=n[c];if(/\s/.test(i)){c++;continue}if("{}".includes(i)){s.push({type:i,value:i}),c++;continue}if(i==="["){let p=!1,l=c+1;for(;l<n.length&&/\s/.test(n[l]);)l++;if(l<n.length&&/[a-zA-Z_]/.test(n[l])&&(p=!0),!p){s.push({type:i,value:i}),c++;continue}}if(i==="]"){s.push({type:i,value:i}),c++;continue}if(i===":"){s.push({type:t.COLON,value:i}),c++;continue}if(i===","){s.push({type:t.COMMA,value:i}),c++;continue}if(i==='"'||i==="'"){let p=i,l=c+1;for(;l<n.length&&n[l]!==p;)n[l]==="\\"&&l++,l++;s.push({type:t.STRING,value:n.substring(c+1,l),quoted:!0}),c=l+1;continue}let f=c,a;for(;f<n.length&&!/[{},]/.test(n[f]);)if(n[f]===":"){let p=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],l=!1;for(let R of p){let y=R.substring(1);if(n.substring(f+1,f+1+y.length)===y){l=!0,f+=y.length;break}}if(!l)break}else if(n[f]==="["){for(f++;f<n.length&&n[f]!=="]";){if(n[f]==='"'||n[f]==="'"){let p=n[f];for(f++;f<n.length&&n[f]!==p;)n[f]==="\\"&&f++,f++}f++}f<n.length&&n[f]==="]"&&f++}else f++;a=n.substring(c,f);let u=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(a)?u=t.NUMBER:a==="true"||a==="false"||a==="null"?u=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(a)&&(u=t.SELECTOR),s.push({type:u,value:a,quoted:!1}),c=f}return s}function o(n){let s="";for(let c=0;c<n.length;c++){let i=n[c];if("{}".includes(i.type)||"[]".includes(i.type)){s+=i.value;continue}if(i.type===t.COLON){s+=i.value;continue}if(i.type===t.COMMA){s+=i.value;continue}if(i.type===t.STRING&&i.quoted){s+=`"${i.value}"`;continue}if(i.type===t.NUMBER||i.type===t.BOOLEAN){s+=i.value;continue}if(i.type===t.SELECTOR||i.type===t.IDENTIFIER){s+=`"${i.value}"`;continue}s+=`"${i.value}"`}return s}try{let n=r(e),s=o(n);return JSON.parse(s)}catch(n){throw new x("Invalid extraction rules syntax: "+n.message,n)}}var Oe="hyper-html-api",Te="1";function _(e,t){let r=e.find(t,`script#${Oe}`,{includeRulesTag:!0});if(r.length===0)return null;let o=r[0],n=e.attr(o,"data-rules-version");if(n!==Te)throw new T(n);let s=e.text(o);return{rules:P(s),tagNode:o}}var G=null;function V(e){if(typeof e!="function")throw new TypeError("registerUpgrade expects a function (v1Data) => v2Data");if(G)throw new w;G=e}function H(){return G}function U(e,t){let r={carriedOver:0,discarded:0,listItems:0},o=Y(t,e,r);return X(t,e,r),{data:o,summary:r}}function Y(e,t,r){if(typeof e=="string")return e.endsWith("[]")?Array.isArray(t)?(r.listItems+=t.length,r.carriedOver+=t.length,t):void 0:t==null?void 0:(r.carriedOver++,t);if(Array.isArray(e)){let[,o]=e;return Array.isArray(t)?(r.listItems+=t.length,t.map(n=>Y(o,n,r))):void 0}if(typeof e=="object"&&e!==null){let o={};for(let[n,s]of Object.entries(e)){let c=Y(s,t?.[n],r);c!==void 0&&(o[n]=c)}return o}}function X(e,t,r){if(t!=null){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){if(typeof t!="object"||Array.isArray(t))return;let o=new Set(Object.keys(e));for(let n of Object.keys(t))o.has(n)?X(e[n],t[n],r):r.discarded+=k(t[n]);return}if(Array.isArray(e)&&Array.isArray(t)){let o=e[1];t.forEach(n=>X(o,n,r));return}typeof e=="string"&&!e.endsWith("[]")&&typeof t=="object"&&t!==null&&(r.discarded+=k(t))}}function k(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+k(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+k(r),0):1}async function z({sourceUrl:e,v1Data:t,v1Version:r=null,parent:o=typeof window<"u"?window:null,timeoutMs:n=15e3,hidden:s=!0}={}){if(!o)throw new Error("upgrade.run requires a window context");if(!e)throw new Error("upgrade.run requires sourceUrl");let c=be(e,o.location.origin),i=new URL(c,o.location.href).origin,f=o.document.createElement("iframe");s&&(f.style.cssText="position:absolute;left:-9999px;top:-9999px;width:1px;height:1px;border:0;"),f.setAttribute("aria-hidden","true"),f.src=c,o.document.body.appendChild(f);let a=()=>{};try{return await new Promise((u,p)=>{let l=setTimeout(()=>{p(new Error(`upgrade.run: helper iframe timed out after ${n}ms`))},n),R=y=>{if(y.source!==f.contentWindow||y.origin!==i)return;let h=y.data;if(!(!h||typeof h!="object")){if(h.type==="hha:upgrade-ready"){f.contentWindow.postMessage({type:"hha:upgrade-data",v1Data:t,v1Version:r},i);return}if(h.type==="hha:upgrade-result"){clearTimeout(l),u({html:h.html,summary:h.summary});return}if(h.type==="hha:upgrade-error"){clearTimeout(l);let d=new Error(h.message||"helper error");d.name=h.name||"UpgradeHelperError",p(d);return}}};o.addEventListener("message",R),a=()=>{o.removeEventListener("message",R),clearTimeout(l),f.parentNode&&f.parentNode.removeChild(f)}})}finally{a()}}function be(e,t){let r=new URL(e,typeof location<"u"?location.href:void 0);return r.searchParams.set("_hyperHtmlApi","upgrade-helper"),r.searchParams.set("parentOrigin",t),r.toString()}var we="hyper-html-api";function Ie(e){return e&&e.nodeType===1&&e.id===we&&e.tagName==="SCRIPT"}function Ne(e){return e?(e.nodeType===9||e.nodeType===11,e):null}var Le={find(e,t,r={}){let o=Ne(e);if(!o||!o.querySelectorAll)return[];let n=Array.from(o.querySelectorAll(t));return r.includeRulesTag?n:n.filter(s=>!Ie(s))},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r)},prop(e,t,r){if(r===void 0){let o=e?e[t]:void 0;return o!==void 0?o:null}e[t]=r},clone(e){return e.cloneNode(!0)},insertAt(e,t,r){let o=e.children[r]||null;e.insertBefore(t,o)},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(o=>{o.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}},g=Le;var Pe="_hyperHtmlApi",_e="upgrade-helper",Ue="parentOrigin";function q(e=typeof location<"u"?location:null){if(!e)return!1;try{return new URLSearchParams(e.search).get(Pe)===_e}catch{return!1}}function oe(e=typeof location<"u"?location:null){return e?new URLSearchParams(e.search).get(Ue):null}function Z({win:e,doc:t,parentOrigin:r}={}){if(e=e||(typeof window<"u"?window:null),t=t||(typeof document<"u"?document:null),!e||!t||(r=r||oe(e.location),!r))return;let o=()=>Ce({win:e,doc:t,parentOrigin:r});t.readyState==="loading"?t.addEventListener("DOMContentLoaded",o,{once:!0}):o()}function Ce({win:e,doc:t,parentOrigin:r}){let o;try{o=_(g,t.body)}catch(f){return K(e,r,f)}if(!o)return K(e,r,new Error("helper-mode: no rules tag in v2 document"));let n=o.rules,s=je(t,"hyper-version"),c=!!H(),i=f=>{if(f.source!==e.parent||f.origin!==r)return;let a=f.data;if(!(!a||a.type!=="hha:upgrade-data")){e.removeEventListener("message",i);try{let u=De({doc:t,rules:n,v1Data:a.v1Data});e.parent.postMessage({type:"hha:upgrade-result",html:u.html,summary:u.summary},r)}catch(u){K(e,r,u)}}};e.addEventListener("message",i),e.parent.postMessage({type:"hha:upgrade-ready",rules:n,version:s,hasTransform:c},r)}function De({doc:e,rules:t,v1Data:r}){let o=H(),n=r,s=!1;o&&(n=o(r),s=!0);let{data:c,summary:i}=U(n,t);L(g,e.body,t,c);let f=A(g,e.body,t);return{html:`<!DOCTYPE html>
2
- `+e.documentElement.outerHTML,summary:{...i,transformApplied:s,appliedFieldCount:Q(f)}}}function K(e,t,r){e.parent.postMessage({type:"hha:upgrade-error",name:r?.name||"Error",message:r?.message||String(r)},t)}function je(e,t){let r=e.querySelector(`meta[name="${t}"]`);return r?r.getAttribute("content"):null}function Q(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+Q(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+Q(r),0):1}var se={extract:(e,t)=>A(g,e,t),apply:(e,t,r)=>L(g,e,t,r),findRulesIn:e=>_(g,e),parseStrict:P,parseRelaxed:J,errors:D,DOM_PROPERTIES:C},ie={},fe={registerUpgrade:V,run:z,shapeMatch:U,isHelperMode:q};typeof window<"u"&&q(window.location)&&Z({win:window,doc:document});var ke={engine:se,cms:ie,upgrade:fe},qe=ke;return de(Be);})();
3
-
4
- // Auto-export to window unless suppressed by loader
5
- if (!window.__hyperclayNoAutoExport) {
6
- window.hyperclay = window.hyperclay || {};
7
- window.hyperclay.htmlApi = HyperHtmlApi;
8
- window.HyperHtmlApi = HyperHtmlApi;
9
- window.h = window.hyperclay;
10
- }
11
-
12
- export { HyperHtmlApi };
13
- export default HyperHtmlApi;