@panphora/clayjs 0.1.0

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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -0
  3. package/clay.js +21 -0
  4. package/package.json +27 -0
  5. package/src/attrs/onaftersave.js +38 -0
  6. package/src/attrs/refetch-on-save.js +36 -0
  7. package/src/attrs/save-freeze.js +102 -0
  8. package/src/core/admin-attrs.js +22 -0
  9. package/src/core/admin-contenteditable.js +47 -0
  10. package/src/core/admin-inputs.js +48 -0
  11. package/src/core/admin-onclick.js +50 -0
  12. package/src/core/admin-resources.js +49 -0
  13. package/src/core/autosave.js +61 -0
  14. package/src/core/edit-mode.js +38 -0
  15. package/src/core/is-edit-mode.js +30 -0
  16. package/src/core/persist.js +103 -0
  17. package/src/core/save-core.js +385 -0
  18. package/src/core/save.js +475 -0
  19. package/src/core/snapshot.js +282 -0
  20. package/src/core/unsaved-warning.js +38 -0
  21. package/src/lib/autosave-debug.js +223 -0
  22. package/src/lib/cache-bust.js +12 -0
  23. package/src/lib/cookie.js +37 -0
  24. package/src/lib/dom-ready.js +9 -0
  25. package/src/lib/extension-noise.js +63 -0
  26. package/src/lib/load-vendor-script.js +57 -0
  27. package/src/lib/mutation.js +719 -0
  28. package/src/lib/query.js +3 -0
  29. package/src/lib/region-policy.js +220 -0
  30. package/src/lib/throttle.js +41 -0
  31. package/src/lib/user-gesture.js +126 -0
  32. package/src/loader-logic.js +62 -0
  33. package/src/loader.js +123 -0
  34. package/src/plugins/indicator.js +51 -0
  35. package/src/plugins/sortable.js +119 -0
  36. package/src/plugins/undo.js +23 -0
  37. package/src/sync/live-sync.js +752 -0
  38. package/src/vendor/Sortable.vendor.js +2 -0
  39. package/src/vendor/control-serialize.vendor.js +88 -0
  40. package/src/vendor/hyper-morph.vendor.js +22 -0
  41. package/src/vendor/hyper-undo.vendor.js +11 -0
  42. package/src/vendor/hypercms.vendor.js +1751 -0
  43. package/src/vendor/richclay.vendor.js +456 -0
@@ -0,0 +1,1751 @@
1
+ var hypercms=(()=>{var nt=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var Xr=Object.getOwnPropertyNames;var Zr=Object.prototype.hasOwnProperty;var ot=(e,t)=>{for(var r in t)nt(e,r,{get:t[r],enumerable:!0})},Qr=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Xr(t))!Zr.call(e,n)&&n!==r&&nt(e,n,{get:()=>t[n],enumerable:!(i=Jr(t,n))||i.enumerable});return e};var ei=e=>Qr(nt({},"__esModule",{value:!0}),e);var fo={};ot(fo,{cms:()=>uo,default:()=>po});var Re=["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"],st=new Set(Re),Ut=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),Wt=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]);var Me={};ot(Me,{EmptyListInsert:()=>fe,MAX_RULE_DEPTH:()=>ie,MaxRuleDepthExceeded:()=>G,RuleTargetReadOnly:()=>ge,RulesParseError:()=>re,ShapeMismatch:()=>pe,UnknownRulesVersion:()=>ue,UpgradeAlreadyRegistered:()=>Te});var re=class extends Error{constructor(t,r){super(t),this.name="RulesParseError",this.cause=r}},ue=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=t}},ie=20,G=class extends Error{constructor(t){super(`rule depth exceeded ${ie} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},pe=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},fe=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}},ge=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}},Te=class extends Error{constructor(){super("upgrade transform already registered; only one registration is allowed per page."),this.name="UpgradeAlreadyRegistered"}};function U(e,t,r,i={}){return at(e,t,r,{depth:0,path:[]},i)}function at(e,t,r,i,n){if(i.depth>ie)throw new G(i.path);if(typeof r=="string")return ti(e,t,r,n);if(Array.isArray(r)){let[o,a]=r;return e.find(t,o,n).map((l,c)=>at(e,l,a,{depth:i.depth+1,path:[...i.path,c]},n))}if(typeof r=="object"&&r!==null){let o={};for(let[a,s]of Object.entries(r))o[a]=at(e,t,s,{depth:i.depth+1,path:[...i.path,a]},n);return o}return null}function ti(e,t,r,i){if(r.endsWith("[]")){let o=r.slice(0,-2);return e.find(t,o,i).map(a=>e.text(a))}if(r.startsWith("@"))return Vt(e,t,r.slice(1));if(r.includes("@")){let o=r.lastIndexOf("@"),a=r.slice(0,o),s=r.slice(o+1),l=a?e.find(t,a,i):[t];return l.length===0?null:Vt(e,l[0],s)}if(r===".")return e.text(t);let n=e.find(t,r,i);return n.length===0?null:e.text(n[0])}function Vt(e,t,r){if(st.has(r)){let n=e.prop(t,r);return n==null?null:String(n)}let i=e.attr(t,r);return i||null}var ri=.5;function lt(e,t,r,i,n,o,a,s={}){let l=e.find(t,r,s);if(n.length===0){l.forEach(S=>e.remove(S));return}let c=n.length>l.length,m=l[0]||null;if(c&&!m&&(m=ai(e,t,r,s),!m))throw new fe(o.path);let d=l.map(S=>ii(e,S,i,s)),u=null;if(m){u=e.clone(m),s.templateAttr&&e.removeAttr(u,s.templateAttr);let S=e.stripIds(u);S>0&&console.warn(`[hyper-html-api] stripped ${S} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let y=ni(n,d,i),x=l[0]||m,M=e.parent(x),b=l.length>0?si(e,M,x):0,T=new Set,E=n.map((S,C)=>{let A=y[C];if(A>=0)return T.add(A),l[A];let g=e.clone(u);return e.stripIds(g),g});l.forEach((S,C)=>{T.has(C)||e.remove(S)}),E.forEach((S,C)=>{let A=b+C;e.children(M).findIndex(h=>e.sameNode(h,S))!==A&&e.insertAt(M,S,A)}),E.forEach((S,C)=>{if(i===null){let A=n[C],g=A==null?"":String(A);e.text(S)!==g&&e.text(S,g)}else{let A=a(e,S,i,n[C],{depth:o.depth+1,path:[...o.path,C]},s);A&&A!==S&&(E[C]=A)}})}function ii(e,t,r,i){return r===null?e.text(t):U(e,t,r,i)}function ni(e,t,r){let i=new Array(e.length).fill(-1),n=new Set;return e.forEach((o,a)=>{let s=-1,l=-1;t.forEach((c,m)=>{if(n.has(m))return;let d=oi(o,c,r),u=d===l&&s>=0?Math.abs(m-a)<Math.abs(s-a):!1;(d>l||u)&&(l=d,s=m)}),l>=ri&&(i[a]=s,n.add(s))}),i}function oi(e,t,r){if(r===null)return e===t?1:0;let i=Object.keys(r||{});if(i.length===0)return 0;let n=0;for(let o of i)JSON.stringify(e?.[o])===JSON.stringify(t?.[o])&&n++;return n/i.length}function si(e,t,r){let i=e.children(t);for(let n=0;n<i.length;n++)if(e.sameNode(i[n],r))return n;return-1}function ai(e,t,r,i){if(!i.templateAttr)return null;let n=t;for(;n;){let o=e.find(n,r,{includeRulesTag:!1});for(let a of o)if(e.attr(a,i.templateAttr)!=null)return a;n=e.parent(n)}return null}var Kt=new Set(["checked","selected","disabled","readOnly","paused"]);function Y(e,t,r,i,n={}){let o=[];if(ct(r,i,[],o),o.length)throw new pe(o);Oe(e,t,r,i,{depth:0,path:[]},n)}function Oe(e,t,r,i,n,o={}){if(n.depth>ie)throw new G(n.path);if(i===void 0)return t;if(typeof r=="string")return li(e,t,r,i,n,o);if(Array.isArray(r)){let[a,s]=r;return lt(e,t,a,s,i,n,Oe,o),t}if(typeof r=="object"&&r!==null){for(let[a,s]of Object.entries(r)){let l=Oe(e,t,s,i==null?i:i[a],{depth:n.depth+1,path:[...n.path,a]},o);l&&l!==t&&(t=l)}return t}return t}function li(e,t,r,i,n,o){if(r.endsWith("[]")){let s=r.slice(0,-2);return lt(e,t,s,null,i,n,Oe,o),t}if(r.startsWith("@"))return Gt(e,t,r.slice(1),i);if(r.includes("@")){let s=r.lastIndexOf("@"),l=r.slice(0,s),c=r.slice(s+1),m=l?e.find(t,l,o):[t];return m.length===0||Gt(e,m[0],c,i),t}if(r===".")return e.text(t,i==null?"":String(i)),t;let a=e.find(t,r,o);return a.length===0||e.text(a[0],i==null?"":String(i)),t}function Gt(e,t,r,i){if(Wt.has(r))throw new ge(r);if(r==="outerHTML"){let n=i==null?"":String(i);return e.replaceWith(t,n)}return Ut.has(r)?(e.prop(t,r,ci(r,i)),t):(e.attr(t,r,i==null?"":String(i)),t)}function ci(e,t){return t==null?Kt.has(e)?!1:"":Kt.has(e)?!!t:t}function ct(e,t,r,i){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((n,o)=>{typeof n=="object"&&n!==null&&i.push({path:ke([...r,o]),expected:"scalar",got:be(n)})}):i.push({path:ke(r),expected:"array",got:be(t)});return}t!==null&&typeof t=="object"&&i.push({path:ke(r),expected:"scalar",got:be(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){i.push({path:ke(r),expected:"array",got:be(t)});return}let n=e[1];t.forEach((o,a)=>ct(n,o,[...r,a],i));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){i.push({path:ke(r),expected:"object",got:be(t)});return}for(let[n,o]of Object.entries(e))ct(o,t[n],[...r,n],i)}}}function be(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function ke(e){return e.join(".")}function dt(e){try{return JSON.parse(e)}catch(t){throw new re(`Invalid strict JSON: ${t.message}`,t)}}function ye(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 o=[],a=0;for(;a<n.length;){let s=n[a];if(/\s/.test(s)){a++;continue}if("{}".includes(s)){o.push({type:s,value:s}),a++;continue}if(s==="["){let d=!1,u=a+1;for(;u<n.length&&/\s/.test(n[u]);)u++;if(u<n.length&&/[a-zA-Z_]/.test(n[u])&&(d=!0),!d){o.push({type:s,value:s}),a++;continue}}if(s==="]"){o.push({type:s,value:s}),a++;continue}if(s===":"){o.push({type:t.COLON,value:s}),a++;continue}if(s===","){o.push({type:t.COMMA,value:s}),a++;continue}if(s==='"'||s==="'"){let d=s,u=a+1;for(;u<n.length&&n[u]!==d;)n[u]==="\\"&&u++,u++;o.push({type:t.STRING,value:n.substring(a+1,u),quoted:!0,sourceQuote:d}),a=u+1;continue}let l=a,c;for(;l<n.length&&!/[{},]/.test(n[l]);)if(n[l]===":"){let d=[":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"],u=!1;for(let y of d){let x=y.substring(1);if(n.substring(l+1,l+1+x.length)===x){u=!0,l+=x.length;break}}if(!u)break}else if(n[l]==="["){for(l++;l<n.length&&n[l]!=="]";){if(n[l]==='"'||n[l]==="'"){let d=n[l];for(l++;l<n.length&&n[l]!==d;)n[l]==="\\"&&l++,l++}l++}l<n.length&&n[l]==="]"&&l++}else l++;c=n.substring(a,l);let m=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(c)?m=t.NUMBER:c==="true"||c==="false"||c==="null"?m=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(c)&&(m=t.SELECTOR),o.push({type:m,value:c,quoted:!1}),a=l}return o}function i(n){let o="";for(let a=0;a<n.length;a++){let s=n[a];if("{}".includes(s.type)||"[]".includes(s.type)){o+=s.value;continue}if(s.type===t.COLON){o+=s.value;continue}if(s.type===t.COMMA){let l=n[a+1];if(l&&(l.type==="}"||l.type==="]"))continue;o+=s.value;continue}if(s.type===t.STRING&&s.quoted){let l=s.value;s.sourceQuote==="'"&&(l=l.replace(/\\'/g,"'"),l=l.replace(/(\\*)"/g,(c,m)=>m.length%2===0?m+'\\"':c)),o+=`"${l}"`;continue}if(s.type===t.NUMBER||s.type===t.BOOLEAN){o+=s.value;continue}if(s.type===t.SELECTOR||s.type===t.IDENTIFIER){o+=`"${s.value}"`;continue}o+=`"${s.value}"`}return o}try{let n=r(e),o=i(n);return JSON.parse(o)}catch(n){throw new re("Invalid extraction rules syntax: "+n.message,n)}}var di="1",Yt=/^[a-zA-Z0-9_-]+$/;function J(e,t,r){let i;if(r===void 0)i="script[data-rules-name]";else{if(typeof r!="string"||!Yt.test(r))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(r)} (must match ${Yt})`);i=`script[data-rules-name~="${r}"]`}let n=e.find(t,i,{includeRulesTag:!0});if(n.length===0)return null;r!==void 0&&n.length>1&&console.warn(`hyper-html-api: ${n.length} rules tags match data-rules-name~="${r}"; using the first.`);let o=n[0],a=e.attr(o,"data-rules-version");if(a!==di)throw new ue(a);return{rules:ye(e.text(o)),tagNode:o}}function mt(e,t,r){if(r&&typeof r=="object")return{rules:r,tagNode:null};if(typeof r=="string"){let i=t&&t.ownerDocument?t.ownerDocument:t;return J(e,i,r)}return null}function Jt(e,t,r,i){let n=mt(e,t,r);if(!n){let s=typeof r=="string"?`data-rules-name~="${r}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${s}`)}let{rules:o,tagNode:a}=n;return{rules:o,tagNode:a,get:()=>U(e,t,o,i),set:s=>Y(e,t,o,s,i)}}var Qt={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 ui(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 pi(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 fi(e,t){let r=[];for(let i of e.attributes||[]){let n=i.name;n==="id"||n==="class"||t.excludeAttributePrefixes.some(o=>n.startsWith(o))||t.includeAttributes.includes(n)&&r.push(`${n}=${i.value}`)}return r.sort().join("|")}function gi(e,t){return(e.textContent||"").replace(/\s+/g," ").trim().slice(0,t.textHintLength)}function bi(e,t){let r=[e.tagName];return t.includeClasses&&r.push(pi(e)),r.push(fi(e,t)),ui(r.join("|"))}function ki(e){let t=e.tagName,r=1,i=e.previousElementSibling;for(;i;)i.tagName===t&&r++,i=i.previousElementSibling;return r}function yi(e,t){return e.id||e.getAttribute?.("role")?!0:t.landmarks.includes(e.tagName)}function vi(e){if(e.id)return`#${e.id}`;let t=e.getAttribute?.("role");return t?`@${t}`:e.tagName}function xi(e,t){let r=[],i=e;for(;i&&i.tagName&&r.length<t.maxPathDepth;){let n=`${i.tagName}:${ki(i)}`;if(r.unshift(n),i!==e&&yi(i,t)){r.unshift(vi(i));break}i=i.parentElement}return r}function wi(e,t){let r=0,i=e.length-1,n=t.length-1;for(;i>=0&&n>=0&&e[i]===t[n];)r++,i--,n--;return r}function P(e,t,r){if(r.has(e))return r.get(e);let i={signature:bi(e,t),path:xi(e,t),textHint:gi(e,t)};return r.set(e,i),i}function ir(e,t,r,i){if(i.has(e))return i.get(e);let n=new Map,o=e.querySelectorAll("*"),a=0;for(let s of o){let l=P(s,t,r);l.domIndex=a++,n.has(l.signature)||n.set(l.signature,[]),n.get(l.signature).push(s)}return i.set(e,n),n}function _i(e,t,r){r.delete(e),t.delete(e);let i=e.querySelectorAll("*");for(let n of i)t.delete(n)}function ht(e,t,r,i,n){let o=P(e,r,i),a=P(t,r,i),s=r.weights,l={},c=0;if(o.signature!==a.signature)return{score:0,breakdown:{rejected:"signature mismatch"}};c+=s.signature,l.signature=s.signature;let d=wi(o.path,a.path)*s.pathSegment;c+=d,l.path=d;let u=!0;if(o.textHint&&a.textHint?o.textHint===a.textHint?(c+=s.textMatch,l.text=s.textMatch):(c-=s.textMismatch,l.text=-s.textMismatch,u=!1):o.textHint!==a.textHint&&(c-=s.textMismatch,l.text=-s.textMismatch,u=!1),n.candidateCount===1&&u&&(c+=s.uniqueCandidate,l.unique=s.uniqueCandidate),typeof o.domIndex=="number"&&typeof a.domIndex=="number"){let y=Math.abs(o.domIndex-a.domIndex),x=Math.min(y*s.positionPenalty,20);c-=x,l.drift=-x}return{score:c,breakdown:l}}function er(e,t,r,i,n){if(r.excludeIds&&e.id)return null;let o=ir(t,r,i,n),a=P(e,r,i);if(typeof a.domIndex!="number"){let u=0,y=e.previousElementSibling;for(;y;)u++,y=y.previousElementSibling;a.domIndex=u}let s=o.get(a.signature)||[],l=r.excludeIds?s.filter(u=>!u.id):s;if(l.length===0)return null;let c=null,m=0,d=null;for(let u of l){let{score:y,breakdown:x}=ht(e,u,r,i,{candidateCount:l.length});y>m&&(m=y,c=u,d=x)}return m<r.minConfidence?null:{element:c,confidence:m,breakdown:d}}function Ai(e,t,r,i){let n=[],o=r.weights.signature+r.weights.slotMatch,a={slot:o};function s(d){if(d.children)return d.children;let u=d.childNodes;if(!u)return[];let y=[];for(let x=0;x<u.length;x++)u[x].nodeType===1&&y.push(u[x]);return y}function l(d,u){let y=s(d),x=s(u);if(y.length===x.length)for(let M=0;M<y.length;M++){let b=y[M],T=x[M];if(r.excludeIds&&(b.id||T.id)||b.tagName!==T.tagName)continue;let E=P(b,r,i).signature,S=P(T,r,i).signature;E!==S&&n.push({newEl:b,oldEl:T,score:o,breakdown:a}),l(b,T)}}function c(d,u){for(;;){if(d.tagName===u.tagName)return[d,u];let y=s(d);if(!d.tagName&&y.length===1){d=y[0];continue}let x=s(u);if(x.length===1&&x[0].tagName===d.tagName){u=x[0];continue}return null}}let m=c(e,t);return m&&l(m[0],m[1]),n}function tr(e,t,r,i,n){let o=t.querySelectorAll("*"),a=ir(e,r,i,n),s=0;for(let d of o){let u=P(d,r,i);u.domIndex=s++}let l=[];for(let d of o){if(r.excludeIds&&d.id)continue;let u=P(d,r,i),y=a.get(u.signature)||[],x=r.excludeIds?y.filter(M=>!M.id):y;for(let M of x){let{score:b,breakdown:T}=ht(d,M,r,i,{candidateCount:x.length});b>=r.minConfidence&&l.push({newEl:d,oldEl:M,score:b,breakdown:T})}}if(r.weights.slotMatch>0){let d=Ai(t,e,r,i);for(let u of d)l.push(u)}l.sort((d,u)=>u.score-d.score);let c=new Map,m=new Set;for(let{newEl:d,oldEl:u}of l)c.has(d)||m.has(u)||(c.set(d,u),m.add(u));return c}function rr(e,t,r,i){let n=P(e,r,i),o=P(t,r,i),{score:a,breakdown:s}=ht(e,t,r,i,{candidateCount:1});return{matches:a>=r.minConfidence,score:a,breakdown:s,newMeta:{signature:n.signature,path:n.path,textHint:n.textHint},oldMeta:{signature:o.signature,path:o.path,textHint:o.textHint}}}function nr(e={}){let t={...Qt,...e,weights:{...Qt.weights,...e.weights}},r=new WeakMap,i=new WeakMap;return{findMatch:(n,o)=>er(n,o,t,r,i),computeMatches:(n,o)=>tr(n,o,t,r,i),explain:(n,o)=>rr(n,o,t,r),invalidate:n=>_i(n,r,i),session:()=>{let n=new WeakMap,o=new WeakMap;return{findMatch:(a,s)=>er(a,s,t,n,o),computeMatches:(a,s)=>tr(a,s,t,n,o),explain:(a,s)=>rr(a,s,t,n)}},getConfig:()=>({...t})}}var Si=nr(),ut=(function(){"use strict";let e=()=>{};function t(b){if(!(b instanceof Element))return!1;if(b.hasAttribute("save-ignore"))return!0;if(b.tagName==="LINK"||b.tagName==="SCRIPT"){let T=b.getAttribute("src")||b.getAttribute("href")||"";if(T.startsWith("chrome-extension://")||T.startsWith("moz-extension://")||T.startsWith("safari-web-extension://"))return!0}return!1}function r(b,T){if(T!=="smart")return b.outerHTML;let E=b.getAttribute("src"),S=b.getAttribute("type")||"text/javascript";if(E)try{let C=new URL(E,window.location.href);return`ext:${S}:${C.origin}${C.pathname}${C.search}`}catch{return`ext:${S}:${E}`}else{let C=b.textContent.trim(),A=5381;for(let g=0;g<C.length;g++)A=(A<<5)+A^C.charCodeAt(g);return`inline:${S}:${Math.abs(A).toString(36)}`}}let i={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:"merge",shouldPreserve:b=>b.getAttribute("im-preserve")==="true",shouldReAppend:b=>b.getAttribute("im-re-append")==="true",shouldRemove:e,afterHeadMorphed:e},scripts:{handle:!1,matchMode:"outerHTML",shouldPreserve:b=>b.getAttribute("im-preserve")==="true",shouldReAppend:b=>b.getAttribute("im-re-append")==="true",shouldRemove:e,afterScriptsHandled:e},restoreFocus:!0},n={computeMatches(b,T){let{computeMatches:E}=Si.session();return E(b,T)}};function o(b,T,E={}){b=x(b);let S=M(T),C=y(b,S,E),A=C.scripts.matchMode,g=new Set(Array.from(b.querySelectorAll("script")).map(p=>r(p,A))),w=s(C,()=>m(C,b,S,p=>p.morphStyle==="innerHTML"?(l(p,b,S),Array.from(b.childNodes)):a(p,b,S)));C.pantry.remove();let h=u(b,g,C);return h.length>0?w instanceof Promise?w.then(p=>Promise.all(h).then(()=>p)):Promise.all(h).then(()=>w):w}function a(b,T,E){let S=M(T);return l(b,S,E,T,T.nextSibling),Array.from(S.childNodes)}function s(b,T){if(!b.config.restoreFocus)return T();let E=document.activeElement;if(!(E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement))return T();let{id:S,selectionStart:C,selectionEnd:A}=E,g=T();return S&&S!==document.activeElement?.getAttribute("id")&&(E=b.target.querySelector(`[id="${S}"]`),E?.focus()),E&&!E.selectionEnd&&A!=null&&E.setSelectionRange(C,A),g}let l=(function(){function b(h,p,k,f=null,v=null){p instanceof HTMLTemplateElement&&k instanceof HTMLTemplateElement&&(p=p.content,k=k.content),f||=p.firstChild;for(let _ of k.childNodes){if(t(_))continue;if(f&&f!=v){let O=E(h,_,f,v);if(O){O!==f&&C(h,f,O),c(O,_,h),f=O.nextSibling;continue}}if(_ instanceof Element){let O=_.getAttribute("id");if(h.persistentIds.has(O)){let j=A(p,O,f,h);c(j,_,h),f=j.nextSibling;continue}if(!h.idMap.has(_)){let j=h.hyperMatches.get(_);if(j&&!h.idMap.has(j)){w(p,j,f),c(j,_,h),f=j.nextSibling;continue}}}let R=T(p,_,f,h);R&&(f=R.nextSibling)}for(;f&&f!=v;){let _=f;f=f.nextSibling,t(_)||S(h,_)}}function T(h,p,k,f){if(f.callbacks.beforeNodeAdded(p)===!1)return null;if(f.idMap.has(p)){let v=document.createElement(p.tagName);return h.insertBefore(v,k),c(v,p,f),f.callbacks.afterNodeAdded(v),v}else{let v=document.importNode(p,!0);return h.insertBefore(v,k),f.callbacks.afterNodeAdded(v),v}}let E=(function(){function h(f,v,_,R){let O=v instanceof Element&&!f.idMap.has(v)?f.hyperMatches.get(v):null,j=null,$=v.nextSibling,he=0,N=_;for(;N&&N!=R;){if(k(N,v)){if(p(f,N,v)||N===O&&!f.idMap.has(N))return N;if(j===null){let ee=N instanceof Element&&f.hyperMatchedOldElements.has(N);!f.idMap.has(N)&&!ee&&(j=N)}}if(j===null&&$&&k(N,$)&&(he++,$=$.nextSibling,he>=2&&(j=void 0)),f.activeElementAndParents.includes(N))break;N=N.nextSibling}return j||null}function p(f,v,_){let R=f.idMap.get(v),O=f.idMap.get(_);if(!O||!R)return!1;for(let j of R)if(O.has(j))return!0;return!1}function k(f,v){let _=f,R=v;return _.nodeType===R.nodeType&&_.tagName===R.tagName&&(!_.getAttribute?.("id")||_.getAttribute?.("id")===R.getAttribute?.("id"))}return h})();function S(h,p){let k=p instanceof Element&&h.hyperMatchedOldElements.has(p)&&!h.idMap.has(p);if(h.idMap.has(p)||k)w(h.pantry,p,null);else{if(h.callbacks.beforeNodeRemoved(p)===!1)return;p.parentNode?.removeChild(p),h.callbacks.afterNodeRemoved(p)}}function C(h,p,k){let f=p;for(;f&&f!==k;){let v=f;f=f.nextSibling,t(v)||S(h,v)}return f}function A(h,p,k,f){let v=f.target.getAttribute?.("id")===p&&f.target||f.target.querySelector(`[id="${p}"]`)||f.pantry.querySelector(`[id="${p}"]`);return g(v,f),w(h,v,k),v}function g(h,p){let k=h.getAttribute("id");for(;h=h.parentNode;){let f=p.idMap.get(h);f&&(f.delete(k),f.size||p.idMap.delete(h))}}function w(h,p,k){if(h.moveBefore)try{h.moveBefore(p,k)}catch{h.insertBefore(p,k)}else h.insertBefore(p,k)}return b})(),c=(function(){function b(g,w,h){return h.ignoreActive&&g===document.activeElement?null:(h.callbacks.beforeNodeMorphed(g,w)===!1||(g instanceof HTMLHeadElement&&h.head.ignore||(g instanceof HTMLHeadElement&&h.head.style!=="morph"?d(g,w,h):(T(g,w,h),A(g,h)||l(h,g,w))),h.callbacks.afterNodeMorphed(g,w)),g)}function T(g,w,h){let p=w.nodeType;if(p===1){let k=g,f=w,v=k.attributes,_=f.attributes;for(let R of _)C(R.name,k,"update",h)||k.getAttribute(R.name)!==R.value&&k.setAttribute(R.name,R.value);for(let R=v.length-1;0<=R;R--){let O=v[R];if(O&&!f.hasAttribute(O.name)){if(C(O.name,k,"remove",h))continue;k.removeAttribute(O.name)}}A(k,h)||E(k,f,h)}(p===8||p===3)&&g.nodeValue!==w.nodeValue&&(g.nodeValue=w.nodeValue)}function E(g,w,h){if(g instanceof HTMLInputElement&&w instanceof HTMLInputElement&&w.type!=="file"){let p=w.value,k=g.value;S(g,w,"checked",h),S(g,w,"disabled",h),h.formStateSync==="property"?k!==p&&(C("value",g,"update",h)||(g.value=p)):w.hasAttribute("value")?k!==p&&(C("value",g,"update",h)||(g.setAttribute("value",p),g.value=p)):C("value",g,"remove",h)||(g.value="",g.removeAttribute("value"))}else if(g instanceof HTMLOptionElement&&w instanceof HTMLOptionElement)S(g,w,"selected",h);else if(g instanceof HTMLTextAreaElement&&w instanceof HTMLTextAreaElement){let p=w.value,k=g.value;if(C("value",g,"update",h))return;p!==k&&(g.value=p),g.firstChild&&g.firstChild.nodeValue!==p&&(g.firstChild.nodeValue=p)}}function S(g,w,h,p){let k=w[h],f=g[h];if(k!==f){let v=C(h,g,"update",p);if(v||(g[h]=w[h]),p.formStateSync==="property")return;k?v||g.setAttribute(h,""):C(h,g,"remove",p)||g.removeAttribute(h)}}function C(g,w,h,p){return g==="value"&&p.ignoreActiveValue&&w===document.activeElement?!0:p.callbacks.beforeAttributeUpdated(g,w,h)===!1}function A(g,w){return!!w.ignoreActiveValue&&g===document.activeElement&&g!==document.body}return b})();function m(b,T,E,S){if(b.head.block){let C=T.querySelector("head"),A=E.querySelector("head");if(C&&A){let g=d(C,A,b);return Promise.all(g).then(()=>{let w=Object.assign(b,{head:{block:!1,ignore:!0}});return S(w)})}}return S(b)}function d(b,T,E){let S=[],C=[],A=[],g=[],w=E.scripts.matchMode,h=f=>{if(f.tagName==="SCRIPT")return r(f,w);if(f.tagName==="LINK"&&w==="smart"){let v=f.getAttribute("href");if(v)try{let _=new URL(v,window.location.href);return`link:${f.getAttribute("rel")||""}:${_.origin}${_.pathname}${_.search}`}catch{}}return f.outerHTML},p=new Map;for(let f of T.children)t(f)||p.set(h(f),f);for(let f of b.children){let v=h(f),_=p.has(v),R=E.head.shouldReAppend(f),O=E.head.shouldPreserve(f);_||O?R?C.push(f):(p.delete(v),A.push(f)):E.head.style==="append"?R&&(C.push(f),g.push(f)):E.head.shouldRemove(f)!==!1&&!t(f)&&C.push(f)}g.push(...p.values());let k=[];for(let f of g){let v=document.createRange().createContextualFragment(f.outerHTML).firstChild;if(E.callbacks.beforeNodeAdded(v)!==!1){if("href"in v&&v.href||"src"in v&&v.src){let _,R=new Promise(function(O){_=O});v.addEventListener("load",function(){_()}),k.push(R)}b.appendChild(v),E.callbacks.afterNodeAdded(v),S.push(v)}}for(let f of C)E.callbacks.beforeNodeRemoved(f)!==!1&&(b.removeChild(f),E.callbacks.afterNodeRemoved(f));return E.head.afterHeadMorphed(b,{added:S,kept:A,removed:C}),k}function u(b,T,E){if(!E.scripts.handle)return[];let S=[],C=[],A=[],g=[],w=E.scripts.matchMode,h=Array.from(b.querySelectorAll("script"));for(let k of h){let f=r(k,w),v=T.has(f),_=E.scripts.shouldPreserve(k),R=E.scripts.shouldReAppend(k);v||_?R?(C.push(k),g.push(k)):A.push(k):g.push(k)}for(let k of T){let f=h.some(v=>v.outerHTML===k)}let p=[];for(let k of g){if(E.callbacks.beforeNodeAdded(k)===!1)continue;let f=document.createRange().createContextualFragment(k.outerHTML).firstChild;if(f.src){let v,_=new Promise(function(R){v=R});f.addEventListener("load",function(){v()}),f.addEventListener("error",function(){v()}),p.push(_)}k.replaceWith(f),E.callbacks.afterNodeAdded(f),S.push(f)}return E.scripts.afterScriptsHandled(b,{added:S,kept:A,removed:C}),p}let y=(function(){function b(h,p,k){let{persistentIds:f,idMap:v}=g(h,p),_=n.computeMatches(h,p);if(typeof k.key=="function"){let $=new Map,he=new Set,N=F=>{let I=k.key(F);I!=null&&($.has(I)?he.add(I):$.set(I,F))};h instanceof Element&&N(h);for(let F of h.querySelectorAll("*"))N(F);for(let F of he)$.delete(F);let ee=new Map;for(let[F,I]of _)ee.set(I,F);let tt=p.__hyperMorphRoot||p,Ce=new Map,Ht=new Set,zt=F=>{let I=k.key(F);I!=null&&(Ce.has(I)?Ht.add(I):Ce.set(I,F))};tt instanceof Element&&zt(tt);for(let F of tt.querySelectorAll("*"))zt(F);for(let F of Ht)Ce.delete(F);for(let[F,I]of Ce){let te=$.get(F);if(!te||te.tagName!==I.tagName)continue;let rt=ee.get(te);rt&&rt!==I&&_.delete(rt);let it=_.get(I);it&&it!==te&&ee.delete(it),_.set(I,te),ee.set(te,I)}}let R=new Set;for(let $ of _.values())R.add($);let O=T(k),j=O.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(j))throw`Do not understand how to morph style ${j}`;return{target:h,newContent:p,config:O,morphStyle:j,ignoreActive:O.ignoreActive,ignoreActiveValue:O.ignoreActiveValue,restoreFocus:O.restoreFocus,formStateSync:O.formStateSync||"attribute",idMap:v,persistentIds:f,hyperMatches:_,hyperMatchedOldElements:R,pantry:E(),activeElementAndParents:S(h),callbacks:O.callbacks,head:O.head,scripts:O.scripts}}function T(h){let p=Object.assign({},i);return Object.assign(p,h),p.callbacks=Object.assign({},i.callbacks,h.callbacks),p.head=Object.assign({},i.head,h.head),p.scripts=Object.assign({},i.scripts,h.scripts),p}function E(){let h=document.createElement("div");return h.hidden=!0,document.body.insertAdjacentElement("afterend",h),h}function S(h){let p=[],k=document.activeElement;if(k?.tagName!=="BODY"&&h.contains(k))for(;k&&(p.push(k),k!==h);)k=k.parentElement;return p}function C(h){let p=Array.from(h.querySelectorAll("[id]"));return h.getAttribute?.("id")&&p.push(h),p}function A(h,p,k,f){for(let v of f){let _=v.getAttribute("id");if(p.has(_)){let R=v;for(;R;){let O=h.get(R);if(O==null&&(O=new Set,h.set(R,O)),O.add(_),R===k)break;R=R.parentElement}}}}function g(h,p){let k=C(h),f=C(p),v=w(k,f),_=new Map;A(_,v,h,k);let R=p.__hyperMorphRoot||p;return A(_,v,R,f),{persistentIds:v,idMap:_}}function w(h,p){let k=new Set,f=new Map;for(let{id:_,tagName:R}of h)f.has(_)?k.add(_):f.set(_,R);let v=new Set;for(let{id:_,tagName:R}of p)v.has(_)?k.add(_):f.get(_)===R&&v.add(_);for(let _ of k)v.delete(_);return v}return b})(),{normalizeElement:x,normalizeParent:M}=(function(){let b=new WeakSet;function T(A){return A instanceof Document?A.documentElement:A}function E(A){if(A==null)return document.createElement("div");if(typeof A=="string")return E(C(A));if(b.has(A))return A;if(A instanceof Node){if(A.parentNode)return new S(A);{let g=document.createElement("div");return g.append(A),g}}else{let g=document.createElement("div");for(let w of[...A])g.append(w);return g}}class S{constructor(g){this.originalNode=g,this.realParentNode=g.parentNode,this.previousSibling=g.previousSibling,this.nextSibling=g.nextSibling}get childNodes(){let g=[],w=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;w&&w!=this.nextSibling;)g.push(w),w=w.nextSibling;return g}querySelectorAll(g){return this.childNodes.reduce((w,h)=>{if(h instanceof Element){h.matches(g)&&w.push(h);let p=h.querySelectorAll(g);for(let k=0;k<p.length;k++)w.push(p[k])}return w},[])}insertBefore(g,w){return this.realParentNode.insertBefore(g,w)}moveBefore(g,w){return this.realParentNode.moveBefore(g,w)}get __hyperMorphRoot(){return this.originalNode}}function C(A){let g=new DOMParser,w=A.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(w.match(/<\/html>/)||w.match(/<\/head>/)||w.match(/<\/body>/)){let h=g.parseFromString(A,"text/html");if(w.match(/<\/html>/))return b.add(h),h;{let p=h.firstChild;return p&&b.add(p),p}}else{let p=g.parseFromString("<body><template>"+A+"</template></body>","text/html").body.querySelector("template").content;return b.add(p),p}}return{normalizeElement:T,normalizeParent:E}})();return{morph:o,defaults:i}})();var es=ut.morph,ts=ut.defaults,pt=ut;var Mi=null;function Le(){return Mi}function Ne(e,t){let r={carriedOver:0,discarded:0,listItems:0},i=ft(t,e,r);return gt(t,e,r),{data:i,summary:r}}function ft(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[,i]=e;return Array.isArray(t)?(r.listItems+=t.length,t.map(n=>ft(i,n,r))):void 0}if(typeof e=="object"&&e!==null){let i={};for(let[n,o]of Object.entries(e)){let a=ft(o,t?.[n],r);a!==void 0&&(i[n]=a)}return i}}function gt(e,t,r){if(t!=null){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){if(typeof t!="object"||Array.isArray(t))return;let i=new Set(Object.keys(e));for(let n of Object.keys(t))i.has(n)?gt(e[n],t[n],r):r.discarded+=je(t[n]);return}if(Array.isArray(e)&&Array.isArray(t)){let i=e[1];t.forEach(n=>gt(i,n,r));return}typeof e=="string"&&!e.endsWith("[]")&&typeof t=="object"&&t!==null&&(r.discarded+=je(t))}}function je(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+je(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+je(r),0):1}function Oi(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function Li(e){return e?(e.nodeType===9||e.nodeType===11,e):null}var ji={find(e,t,r={}){let i=Li(e);if(!i||!i.querySelectorAll)return[];let n=Array.from(i.querySelectorAll(t));r.includeRulesTag||(n=n.filter(a=>!Oi(a)));let o=[];if(r.skip&&o.push(r.skip),r.templateAttr&&o.push("["+r.templateAttr+"]"),o.length){let a=o.join(", ");n=n.filter(s=>!s.closest||!s.closest(a))}return n},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 i=e?e[t]:void 0;return i!==void 0?i:null}e[t]=r},clone(e){return e.cloneNode(!0)},insertAt(e,t,r){let i=e.children[r]||null;e.insertBefore(t,i)},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 i=e.ownerDocument.createElement("template");i.innerHTML=t;let n=i.content.firstElementChild;if(!n)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(n,e),n},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(i=>{i.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}},H=ji;var Ni="_hyperHtmlApi",Fi="upgrade-helper",Ii="parentOrigin";function yt(e=typeof location<"u"?location:null){if(!e)return!1;try{return new URLSearchParams(e.search).get(Ni)===Fi}catch{return!1}}function or(e=typeof location<"u"?location:null){return e?new URLSearchParams(e.search).get(Ii):null}function vt({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||or(e.location),!r))return;let i=()=>qi({win:e,doc:t,parentOrigin:r});t.readyState==="loading"?t.addEventListener("DOMContentLoaded",i,{once:!0}):i()}function qi({win:e,doc:t,parentOrigin:r}){let i;try{i=J(H,t.body)}catch(l){return bt(e,r,l)}if(!i)return bt(e,r,new Error("helper-mode: no rules tag in v2 document"));let n=i.rules,o=$i(t,"hyper-version"),a=!!Le(),s=l=>{if(l.source!==e.parent||l.origin!==r)return;let c=l.data;if(!(!c||c.type!=="hha:upgrade-data")){e.removeEventListener("message",s);try{let m=Di({doc:t,rules:n,v1Data:c.v1Data});e.parent.postMessage({type:"hha:upgrade-result",html:m.html,summary:m.summary},r)}catch(m){bt(e,r,m)}}};e.addEventListener("message",s),e.parent.postMessage({type:"hha:upgrade-ready",rules:n,version:o,hasTransform:a},r)}function Di({doc:e,rules:t,v1Data:r}){let i=Le(),n=r,o=!1;i&&(n=i(r),o=!0);let{data:a,summary:s}=Ne(n,t);Y(H,e.body,t,a);let l=U(H,e.body,t);return{html:`<!DOCTYPE html>
2
+ `+e.documentElement.outerHTML,summary:{...s,transformApplied:o,appliedFieldCount:kt(l)}}}function bt(e,t,r){e.parent.postMessage({type:"hha:upgrade-error",name:r?.name||"Error",message:r?.message||String(r)},t)}function $i(e,t){let r=e.querySelector(`meta[name="${t}"]`);return r?r.getAttribute("content"):null}function kt(e){return e==null?0:Array.isArray(e)?e.reduce((t,r)=>t+kt(r),0):typeof e=="object"?Object.values(e).reduce((t,r)=>t+kt(r),0):1}var q={extract:(e,t,r)=>U(H,e,t,r),apply:(e,t,r,i)=>Y(H,e,t,r,i),findRulesIn:(e,t)=>J(H,e,t),findRules:(e,t)=>mt(H,e,t),bind:(e,t,r)=>Jt(H,e,t,r),parseStrict:dt,parseRelaxed:ye,errors:Me,DOM_PROPERTIES:Re};typeof window<"u"&&yt(window.location)&&vt({win:window,doc:document});var wt={};ot(wt,{fromString:()=>W,getRuleAtPath:()=>X,getValueAtPath:()=>Ui,setAtPath:()=>xt,toString:()=>zi});function zi(e){return e.map(String).join(".")}function W(e){return e===""?[]:e.split(".").map(t=>/^\d+$/.test(t)?Number(t):t)}function X(e,t){let r=e;for(let i of t){if(r==null)return;if(typeof r=="string"){if(r.endsWith("[]")&&(typeof i=="number"||i==="*")){r=r.slice(0,-2);continue}return}if(Array.isArray(r)){if(typeof i!="number"&&i!=="*")return;r=r[1];continue}if(typeof r=="object"){if(typeof i=="number"||!(i in r))return;r=r[i];continue}return}return r}function Ui(e,t){let r=e;for(let i of t){if(r==null)return;r=r[i]}return r}function xt(e,t,r){if(t.length===0)return r;let[i,...n]=t;if(typeof i=="number"){let o=Array.isArray(e)?[...e]:[];return o[i]=xt(o[i],n,r),o}return{...e&&typeof e=="object"?e:{},[i]:xt((e||{})[i],n,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,i]of Object.entries(e))t[r]=ve(i);return t}return""}function Fe(e,t,{ignoreActiveValue:r=!0}={}){pt.morph(e,t,{morphStyle:"innerHTML",ignoreActiveValue:r,restoreFocus:!0,formStateSync:"property"})}function qe(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 Wi='<div class="hcms-drag-handle mirk-sortable__grip" aria-hidden="true"><div class="mirk-sortable__dots"><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span></div></div>',_t='<svg class="hcms-x" viewBox="0 0 16 16" shape-rendering="crispEdges" aria-hidden="true"><path d="M4 4 L12 12 M12 4 L4 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square"></path></svg>',lr={"@scalar":`
3
+ <label class="hcms-field" data-hcms-shape="scalar">
4
+ <span class="hcms-label" data-hcms-label></span>
5
+ <textarea class="mirk-textarea" rows="1" data-hcms-field></textarea>
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 mirk-button mirk-button--small" data-hcms-action="add"><span class="mirk-button__label">+ Add</span></button>
22
+ </section>
23
+ `,"@scalar-array-item":`
24
+ <li class="hcms-array-item" draggable="true">
25
+ <input class="mirk-input" data-hcms-field />
26
+ <button type="button" class="hcms-move hcms-move-up hcms-sr-only" data-hcms-action="move-up" aria-label="Move up">\u2191</button>
27
+ <button type="button" class="hcms-move hcms-move-down hcms-sr-only" data-hcms-action="move-down" aria-label="Move down">\u2193</button>
28
+ <button type="button" class="hcms-remove" data-hcms-action="remove" aria-label="Remove">\xD7</button>
29
+ <div class="hcms-error" hidden></div>
30
+ </li>
31
+ `,"@object-array":`
32
+ <section class="hcms-array hcms-object-array hcms-array--cards" data-hcms-shape="object-array">
33
+ <header class="hcms-array-header">
34
+ <h3 class="hcms-array-title" data-hcms-label></h3>
35
+ </header>
36
+ <div class="hcms-array-items"></div>
37
+ <div class="hcms-error" hidden></div>
38
+ <button type="button" class="hcms-add mirk-button mirk-button--small" data-hcms-action="add"><span class="mirk-button__label">+ Add</span></button>
39
+ </section>
40
+ `,"@object-array-item":`
41
+ <article class="hcms-card mirk-sortable__item" draggable="true">
42
+ ${Wi}
43
+ <div class="hcms-card-body mirk-sortable__body">
44
+ <div class="hcms-card-fields"></div>
45
+ <div class="hcms-card-controls">
46
+ <button type="button" class="hcms-move hcms-move-up hcms-sr-only" data-hcms-action="move-up" aria-label="Move up">\u2191</button>
47
+ <button type="button" class="hcms-move hcms-move-down hcms-sr-only" data-hcms-action="move-down" aria-label="Move down">\u2193</button>
48
+ <button type="button" class="hcms-remove hcms-remove--card" data-hcms-action="remove" aria-label="Remove">${_t}</button>
49
+ </div>
50
+ </div>
51
+ <div class="hcms-error" hidden></div>
52
+ </article>
53
+ `,"@file":`
54
+ <div class="hcms-field hcms-upload hcms-upload--file" data-hcms-shape="scalar">
55
+ <span class="hcms-label" data-hcms-label></span>
56
+ <div class="mirk-file mirk-file--compact mirk-file--round">
57
+ <label class="mirk-button mirk-button--round mirk-button--small">
58
+ <input type="file" data-hcms-upload />
59
+ <span class="mirk-button__label">Choose</span>
60
+ </label>
61
+ <a class="mirk-file__name" data-hcms-field></a>
62
+ <button type="button" class="hcms-upload-clear" data-hcms-action="clear-upload" aria-label="Remove file">${_t}</button>
63
+ </div>
64
+ <div class="hcms-error" hidden></div>
65
+ </div>
66
+ `,"@image":`
67
+ <div class="hcms-field hcms-upload hcms-upload--image" data-hcms-shape="scalar">
68
+ <span class="hcms-label" data-hcms-label></span>
69
+ <div class="mirk-image mirk-image--compact mirk-image--rounded">
70
+ <label class="mirk-button mirk-button--small mirk-image__upload">
71
+ <input type="file" accept="image/*" data-hcms-upload />
72
+ <span class="mirk-button__label">Upload image</span>
73
+ </label>
74
+ <figure class="mirk-image__thumb">
75
+ <span class="mirk-image__frame"><img class="mirk-image__preview" data-hcms-field alt="" /></span>
76
+ <button type="button" class="hcms-upload-clear hcms-upload-clear--badge" data-hcms-action="clear-upload" aria-label="Remove image">${_t}</button>
77
+ </figure>
78
+ </div>
79
+ <div class="hcms-error" hidden></div>
80
+ </div>
81
+ `,"@checkbox":`
82
+ <div class="hcms-field hcms-field--row" data-hcms-shape="scalar">
83
+ <span class="hcms-label" data-hcms-label></span>
84
+ <label class="mirk-checkbox">
85
+ <input type="checkbox" class="mirk-sr-only" data-hcms-field />
86
+ <span class="mirk-checkbox__box"><span class="mirk-checkbox__mark"></span></span>
87
+ </label>
88
+ <div class="hcms-error" hidden></div>
89
+ </div>
90
+ `,"@toggle":`
91
+ <div class="hcms-field hcms-field--row" data-hcms-shape="scalar">
92
+ <span class="hcms-label" data-hcms-label></span>
93
+ <label class="mirk-toggle">
94
+ <input type="checkbox" role="switch" class="mirk-sr-only" data-hcms-field />
95
+ <span class="mirk-toggle__track"><span class="mirk-toggle__thumb"></span></span>
96
+ </label>
97
+ <div class="hcms-error" hidden></div>
98
+ </div>
99
+ `,"@select":`
100
+ <label class="hcms-field" data-hcms-shape="scalar">
101
+ <span class="hcms-label" data-hcms-label></span>
102
+ <div class="mirk-select">
103
+ <select class="mirk-select__field" data-hcms-field></select>
104
+ <span aria-hidden="true" class="mirk-select__chevron">\u203A</span>
105
+ </div>
106
+ <div class="hcms-error" hidden></div>
107
+ </label>
108
+ `,"@radio":`
109
+ <div class="hcms-field" data-hcms-shape="scalar">
110
+ <span class="hcms-label" data-hcms-label></span>
111
+ <div class="hcms-radio-row">
112
+ <label class="mirk-radio">
113
+ <input type="radio" class="mirk-sr-only" data-hcms-field />
114
+ <span class="mirk-radio__ring"><span class="mirk-radio__fill"></span><span class="mirk-radio__dot"></span></span>
115
+ <span class="mirk-radio__label"></span>
116
+ </label>
117
+ </div>
118
+ <div class="hcms-error" hidden></div>
119
+ </div>
120
+ `,"@textarea":`
121
+ <label class="hcms-field" data-hcms-shape="scalar">
122
+ <span class="hcms-label" data-hcms-label></span>
123
+ <textarea class="mirk-textarea" rows="3" data-hcms-field></textarea>
124
+ <div class="hcms-error" hidden></div>
125
+ </label>
126
+ `,"@richtext":`
127
+ <div class="hcms-field" data-hcms-shape="scalar">
128
+ <span class="hcms-label" data-hcms-label></span>
129
+ <div class="mirk-textarea hcms-richtext" contenteditable="true" data-hcms-field></div>
130
+ <div class="hcms-error" hidden></div>
131
+ </div>
132
+ `,"@number":`
133
+ <label class="hcms-field" data-hcms-shape="scalar">
134
+ <span class="hcms-label" data-hcms-label></span>
135
+ <input class="mirk-input" type="number" data-hcms-field />
136
+ <div class="hcms-error" hidden></div>
137
+ </label>
138
+ `,"@chips":`
139
+ <div class="hcms-field hcms-chips" data-hcms-shape="scalar-array">
140
+ <span class="hcms-label" data-hcms-label></span>
141
+ <div class="mirk-tags hcms-array-items"></div>
142
+ <button type="button" class="hcms-add mirk-button mirk-button--small" data-hcms-action="add"><span class="mirk-button__label">+ Add</span></button>
143
+ <div class="hcms-error" hidden></div>
144
+ </div>
145
+ `,"@chips-item":`
146
+ <span class="mirk-tags__chip" data-hcms-array-item>
147
+ <input class="hcms-chip-field" data-hcms-field aria-label="Item" placeholder="\u2026" />
148
+ <button type="button" class="hcms-remove" data-hcms-action="remove" aria-label="Remove">\xD7</button>
149
+ </span>
150
+ `},Vi=["@scalar","@object","@scalar-array","@scalar-array-item","@object-array","@object-array-item"];function De(e){let t=e.head||e.documentElement;if(t)for(let r of Vi)hr(e,t,r)}function At(e,t){if(!lr[t])return null;let r=e&&(e.head||e.documentElement);return r?hr(e,r,t):null}var sr={src:"@image",checked:"@checkbox",innerHTML:"@richtext"},Ie={image:"@image",file:"@file",checkbox:"@checkbox",toggle:"@toggle",select:"@select",radio:"@radio",textarea:"@textarea",number:"@number",richtext:"@richtext"},Ki=new Set([...Object.values(Ie),"@chips","@chips-item"]);function xe(e,t,r){if(typeof e!="string")return"@scalar";let i=e.lastIndexOf("@"),n=Pe(we(e,i),t,"data-hcms-component");if(n&&Ie[n]){let o=Ie[n],a=Array.isArray(r)&&r.some(s=>s==="*"||typeof s=="number");return o==="@number"&&!ar(e,i,t,a).every(Yi)||(o==="@checkbox"||o==="@toggle")&&(i<0||e.slice(i+1)!=="checked")&&!ar(e,i,t,a).every(Ji)?"@scalar":o}if(i>=0){let o=e.slice(i+1);if(sr[o])return sr[o]}return"@scalar"}function cr(e,t){if(typeof e!="string")return null;let r=e.lastIndexOf("@"),i=Pe(we(e,r),t,"data-hcms-component");return i&&Ie[i]||null}var Gi=/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/;function Yi(e){return e==null||e===""?!0:Gi.test(String(e))}function Ji(e){return e==null||e===""||e==="true"||e==="false"}function ar(e,t,r,i){if(!r||!r.querySelectorAll)return[];let n=we(e,t);if(!n||n===".")return[];let o=null;try{o=r.querySelectorAll(n)}catch{return[]}let a=t>=0?e.slice(t+1):null,s=[];for(let l of o)if(!(l.closest&&l.closest("[cms-template], [data-hcms-shell]"))&&(a?a==="value"&&"value"in l?s.push(l.value):s.push(l.getAttribute?l.getAttribute(a):null):s.push((l.textContent||"").trim()),!i))break;return s}function $e(e,t){if(typeof e!="string"||!e.endsWith("[]")||!t||!t.querySelector)return null;let r=e.slice(0,-2).trim();if(!r)return null;let i=null;try{i=t.querySelector(r)}catch{return null}let n=i&&i.closest?i.closest("[data-hcms-component]"):null;return(n&&n.getAttribute?n.getAttribute("data-hcms-component"):null)==="chips"?{array:"@chips",item:"@chips-item"}:null}function ne(e,t,r){let i=e.join("."),n=e.map(o=>typeof o=="number"?"*":o).join(".");return i&&B(r,i)||n&&n!==i&&B(r,n)||B(r,t)}function Be(e,t,r){let i=$e(e,r);if(!i)return null;let n=ne(t,i.array,r);return n&&n.getAttribute("data-hcms-tpl")===i.array?i:null}function dr(e,t){if(typeof e!="string")return null;let r=e.lastIndexOf("@"),i=Pe(we(e,r),t,"data-hcms-options");if(i==null)return null;let n=i.trim().split(/\s+/).filter(Boolean);return n.length?n:null}function mr(e,t){if(typeof e!="string")return null;let r=e.lastIndexOf("@");return Pe(we(e,r),t,"data-hcms-crop")}function we(e,t){return t>=0?e.slice(0,t):e}function Pe(e,t,r){if(!t||!t.querySelector||!e||e===".")return null;let i=null;try{i=t.querySelector(e)}catch{return null}return i&&i.getAttribute?i.getAttribute(r):null}function He(e,t){if(!e||t==null)return;r(t);function r(i){let n=Z(i);if(n==="scalar"){let o=xe(i,e);Ki.has(o)&&At(e,o);return}if(n==="scalar-array"){let o=$e(i,e);o&&(At(e,o.array),At(e,o.item));return}if(n==="object"){for(let o of Object.values(i))r(o);return}if(n==="object-array"){let o=i[1];if(o&&typeof o=="object"&&!Array.isArray(o))for(let a of Object.values(o))r(a);else r(o)}}}function hr(e,t,r){let i=B(e,r);if(i)return i;let n=e.createElement("template");return n.setAttribute("data-hcms-tpl",r),n.setAttribute("save-remove",""),n.innerHTML=lr[r].trim(),t.appendChild(n),n}function B(e,t){return!e||!e.querySelector?null:e.querySelector(`template[data-hcms-tpl="${Xi(t)}"]`)}function Xi(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}function Z(e){return typeof e=="string"?e.endsWith("[]")?"scalar-array":"scalar":Array.isArray(e)?"object-array":typeof e=="object"&&e!==null?"object":"scalar"}function _e(e){return e?!!(e.content||e).querySelector("[data-hcms-field]"):!1}var ur={IMG:"src",A:"href"};function ze(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":ur[t]?ur[t]:e.hasAttribute&&e.hasAttribute("contenteditable")?"innerHTML":null}function pr(e,t){let r=(e.tagName||"").toUpperCase(),i=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),n=ze(e),a=`${gr(r,i)}[data-hcms-field="${oe(t)}"]`;return r==="INPUT"&&i==="radio"?`${a}:checked@value`:n?`${a}@${n}`:a}function Zi(e){let t=(e.tagName||"").toUpperCase(),r=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),i=ze(e),o=`${gr(t,r)}[data-hcms-field]`;return t==="INPUT"&&r==="radio"?`${o}:checked@value`:i?`${o}@${i}`:o}function gr(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 oe(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var fr=new Set(["__proto__","constructor","prototype"]);function Ue(e,t){return r(e,[]);function r(c,m){let d=Z(c);if(d==="scalar")return i(c,m);if(d==="scalar-array")return n(c,m);if(d==="object-array")return o(c,m);if(d==="object"){let u=Object.create(null);for(let[y,x]of Object.entries(c)){if(fr.has(y))throw new Error(`hypercms: rule key "${y}" is forbidden at "${m.join(".")||"<root>"}"`);u[y]=r(x,[...m,y])}return u}return null}function i(c,m){let d=m.length?m[m.length-1]:null,u=typeof d=="string"?d:"__value",y=l(m,u);if(y)return pr(y,u);let x=s(xe(c,t,m),u);return x?pr(x,u):`input[data-hcms-field="${oe(u)}"]@value`}function n(c,m){let d=Be(c,m,t),u=d&&s(d.item,null)||s("@scalar-array-item",null),y=u?Zi(u):"input[data-hcms-field]@value";return[a(m,"[data-hcms-array-item]"),y]}function o(c,m){let[,d]=c,u=[...m,"*"],y=a(m,"[data-hcms-card]");if(d&&typeof d=="object"&&!Array.isArray(d)){let x=Object.create(null);for(let[M,b]of Object.entries(d)){if(fr.has(M))throw new Error(`hypercms: rule key "${M}" is forbidden at "${u.join(".")}"`);x[M]=r(b,[...u,M])}return[y,x]}return[y,r(d,[...u,0])]}function a(c,m){let d=c.length?c[c.length-1]:"",u=c.some(M=>M==="*"),y=c.join(".");return`${u?`[data-hcms-field="${oe(d)}"]`:`[data-hcms-path="${oe(y)}"]`} > .hcms-array-items > ${m}`}function s(c,m){if(!t)return null;let d=B(t,c);if(!d)return null;let u=d.content||d;if(m){let y=u.querySelector(`[data-hcms-field="${oe(m)}"]`);if(y)return y}return u.querySelector("[data-hcms-field]")}function l(c,m){if(!t)return null;let d=c.map(x=>typeof x=="number"?"*":x).join("."),y=[c.join("."),d];for(let x=c.length-1;x>=0;x--){let M=c.slice(0,x).map(b=>typeof b=="number"?"*":b);M.push("*"),y.push(M.join("."))}for(let x of y){if(!x)continue;let M=B(t,x);if(!M||!_e(M))continue;let b=M.content||M,T=b.querySelector(`[data-hcms-field="${oe(m)}"]`)||b.querySelector("[data-hcms-field]");if(T)return T}return null}}function St(e){if(!e)return"";let t=String(e).split(/[?#]/)[0],r=t.split("/").pop()||t;try{return decodeURIComponent(r)}catch{return r}}function We({pageRules:e,formRules:t,data:r,doc:i}){let n=i.createDocumentFragment(),o=Et(e,[],r,i);return o&&n.appendChild(o),n}function kr({shape:e,itemShape:t,pathArr:r,data:i,doc:n,itemKey:o}){if(e==="object-array-item")return vr(t,r,i,n);if(e==="scalar-array-item")return xr(r,i,n,o||null);throw new Error(`hypercms: buildItem called with unknown shape "${e}"`)}function Et(e,t,r,i){let n=Z(e);return n==="scalar"?Qi(e,t,r,i):n==="object"?nn(e,t,r,i):n==="object-array"?on(e,t,r,i):n==="scalar-array"?sn(e,t,r,i):null}function Qi(e,t,r,i){let n=xe(e,i,t),o=ne(t,n,i);if(!o)throw new Error(`hypercms: missing template for scalar at "${t.join(".")}"`);let a=cr(e,i);a==="@number"&&n==="@scalar"&&console.info(`[hypercms] field "${t.join(".")}" declares component "@number" but its value isn't a plain number; rendering a text input so the value is preserved`),(a==="@checkbox"||a==="@toggle")&&n==="@scalar"&&console.info(`[hypercms] field "${t.join(".")}" declares component "${a}" but its value isn't true/false; rendering a text input so the value is preserved`),yr(o,a===n?a:null,t);let s=se(o,i);ae(s,t);let l=o.getAttribute?.("data-hcms-tpl");if((n==="@select"||n==="@radio")&&l===n&&en(s,e,t,r,i,n),n==="@image"&&l==="@image"){let c=mr(e,i);c!=null&&!s.hasAttribute("data-hcms-crop")&&s.setAttribute("data-hcms-crop",c)}return an(s,V(t)),Ve(s,V(t)),Ke(s,V(t)),Er(s,r),n==="@file"&&rn(s),s}function yr(e,t,r){if(!t)return;let i=e.getAttribute?.("data-hcms-tpl");i&&i!==t&&console.info(`[hypercms] field "${r.join(".")}" declares component "${t}" but custom template "${i}" wins`)}function en(e,t,r,i,n,o){let a=dr(t,n),s=a?[...a]:[],l=i==null?"":String(i);if(l!==""&&!s.includes(l)&&s.unshift(l),!a&&(tn(e,"data-hcms-options required (space-separated values)"),s.length===0)){e.querySelector(".mirk-radio")?.remove();return}if(o==="@select"){let d=e.querySelector("select[data-hcms-field]");if(!d)return;for(let u of s){let y=n.createElement("option");y.value=u,y.textContent=qe(u),d.appendChild(y)}return}let c=e.querySelector(".mirk-radio");if(!c||!c.parentNode)return;let m=Ct(r.join("."));for(let d of s){let u=c.cloneNode(!0),y=u.querySelector('input[type="radio"]');y&&(y.value=d,y.name=m);let x=u.querySelector(".mirk-radio__label");x&&(x.textContent=qe(d)),c.parentNode.insertBefore(u,c)}c.remove()}function Ct(e){return"hcms-"+String(e).replace(/[^A-Za-z0-9_-]/g,"-")}function tn(e,t){let r=e.querySelector?e.querySelector(".hcms-error"):null;r&&(r.textContent=t,r.hidden=!1)}function rn(e){let t=e.querySelector?e.querySelector("a.mirk-file__name[data-hcms-field]"):null;t&&(t.textContent=St(t.getAttribute("href")))}function nn(e,t,r,i){let n=ne(t,"@object",i);if(!n)throw new Error(`hypercms: missing template for object at "${t.join(".")}"`);let o=se(n,i);if(ae(o,t),Ve(o,V(t)),Ke(o,V(t)),_e(n))return Rr(o,e,t),Cr(o,e,r),o;let a=Ge(o,".hcms-object-fields",n,t);for(let[s,l]of Object.entries(e)){let c=r==null?null:r[s],m=Et(l,[...t,s],c,i);m&&a.appendChild(m)}return o}function on(e,t,r,i){let n=ne(t,"@object-array",i);if(!n)throw new Error(`hypercms: missing template for object-array at "${t.join(".")}"`);let o=se(n,i);ae(o,t),Ve(o,V(t)),Ke(o,V(t)),_r(o,n),Sr(o,n,t);let a=Ge(o,".hcms-array-items",n,t),[,s]=e;return(Array.isArray(r)?r:[]).forEach((c,m)=>{let d=vr(s,[...t,m],c,i);d&&a.appendChild(d)}),Ar(o),o}function vr(e,t,r,i){let n=wr(t,"object-array-item",i);if(!n)throw new Error(`hypercms: missing item template for "${t.join(".")}"`);let o=se(n,i);if(o.setAttribute("data-hcms-card",""),o.classList.contains("hcms-card")||o.classList.add("hcms-card"),ae(o,t),_e(n))return e&&typeof e=="object"&&!Array.isArray(e)&&(Rr(o,e,t),Cr(o,e,r)),o;let a=Ge(o,".hcms-card-fields",n,t);if(e&&typeof e=="object"&&!Array.isArray(e))for(let[s,l]of Object.entries(e)){let c=r==null?null:r[s],m=Et(l,[...t,s],c,i);m&&a.appendChild(m)}return o}function sn(e,t,r,i){let n=$e(e,i),o=Be(e,t,i),a=n?n.array:"@scalar-array",s=ne(t,a,i);if(!s)throw new Error(`hypercms: missing template for scalar-array at "${t.join(".")}"`);yr(s,n?n.array:null,t);let l=se(s,i);ae(l,t),Ve(l,V(t)),Ke(l,V(t)),_r(l,s),Sr(l,s,t),o&&l.setAttribute("data-hcms-item-tpl",o.item);let c=Ge(l,".hcms-array-items",s,t);return(Array.isArray(r)?r:[]).forEach((d,u)=>{let y=xr([...t,u],d,i,o?o.item:null);y&&c.appendChild(y)}),Ar(l),l}function xr(e,t,r,i){let n=wr(e,"scalar-array-item",r,i);if(!n)throw new Error(`hypercms: missing item template for "${e.join(".")}"`);let o=se(n,r);return o.setAttribute("data-hcms-array-item",""),o.classList.contains("hcms-array-item")||o.classList.add("hcms-array-item"),ae(o,e),Er(o,t),o}function wr(e,t,r,i){let n=e.map(o=>typeof o=="number"?"*":o).join(".");return B(r,n)||i&&B(r,i)||B(r,"@"+t)}function se(e,t){let r=e.content||e,i=t.createElement("div");return i.appendChild(r.cloneNode(!0)),i.firstElementChild||i}function ae(e,t){e.setAttribute("data-hcms-path",t.join("."))}function an(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(n=>{n.getAttribute("data-hcms-field")||n.setAttribute("data-hcms-field",r)})}function Ve(e,t){t==null||t===""||!e.setAttribute||e.hasAttribute?.("data-hcms-field")||e.setAttribute("data-hcms-field",String(t))}function Ke(e,t){if(t==null||t==="")return;(e.querySelectorAll?e.querySelectorAll("[data-hcms-label]"):[]).forEach(i=>{(i.textContent||"").trim()===""&&(i.textContent=qe(String(t)))})}function _r(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 Ar(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]")),i=r.length,n=br(e,"data-hcms-max-items"),o=br(e,"data-hcms-min-items"),a=e.hasAttribute("data-hcms-no-add"),s=e.hasAttribute("data-hcms-no-remove"),l=e.hasAttribute("data-hcms-no-reorder"),c=e.querySelector('[data-hcms-action="add"]');c&&(c.hidden=a||n!=null&&i>=n),r.forEach((m,d)=>{let u=m.querySelector('[data-hcms-action="remove"]');u&&(u.hidden=s||o!=null&&i<=o);let y=m.querySelector('[data-hcms-action="move-up"]');y&&(y.hidden=l||d===0);let x=m.querySelector('[data-hcms-action="move-down"]');x&&(x.hidden=l||d===i-1)})}function br(e,t){if(!e||!e.hasAttribute(t))return null;let r=parseInt(e.getAttribute(t),10);return Number.isFinite(r)?r:null}function Sr(e,t,r){if(e.hasAttribute("data-hcms-no-reorder")||t.hasAttribute("data-hcms-no-reorder"))return;let i=e.querySelector(".hcms-array-items");if(!i)return;let n="hcms-"+r.join(".");i.setAttribute("sortable",n),i.setAttribute("onsorted","hypercmsCommit && hypercmsCommit()")}function V(e){return e.length?e[e.length-1]:null}function Er(e,t){let r=ln(e);if(r.length!==0)for(let i of r)Tr(i,t)}function ln(e){if(!e)return[];let t=[];return e.matches?.("[data-hcms-field]")&&cn(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(i=>t.push(i)),t}function cn(e){let t=(e.tagName||"").toUpperCase();return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||t==="IMG"||t==="A"||e.hasAttribute?.("contenteditable"))}function Cr(e,t,r){(e.querySelectorAll?e.querySelectorAll("[data-hcms-field]"):[]).forEach(n=>{let o=n.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 a=r==null?null:r[o];Tr(n,a)})}function Rr(e,t,r){if(!e.querySelectorAll)return;e.querySelectorAll("[data-hcms-field]").forEach(n=>{let o=n.getAttribute("data-hcms-field");if(!o||t&&typeof t=="object"&&!(o in t))return;let a=[...r,o].join(".");n.setAttribute("data-hcms-path",a)})}function Ge(e,t,r,i){if(!e.querySelector)return e;let n=e.querySelector(t);if(n)return n;let o=r?.getAttribute?.("data-hcms-tpl")||i.join(".");throw new Error(`hypercms: template "${o}" is in slotted mode but has no ${t} element`)}function Tr(e,t){let r=ze(e),i=(e.tagName||"").toUpperCase(),n=(e.getAttribute("type")||"").toLowerCase();if(i==="INPUT"&&n==="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 Mr={skip:"[data-hcms-shell]",templateAttr:"cms-template"};function Or(e,t,r,i={}){let{observerHandle:n,shellRoot:o,structural:a,structuralPath:s}=i;n?.pause?.();try{if(!a)try{return q.apply(e,t,r,Mr),{ok:!0}}catch(d){return{ok:!1,error:d}}let l=dn(e,t,s),c=l?hn(l):null,m=l?null:pn(e,o);try{return q.apply(e,t,r,Mr),{ok:!0}}catch(d){return c?un(l,c):m&&fn(e,o,m),{ok:!1,error:d}}}finally{n?.resume?.()}}function dn(e,t,r){if(!r||!e)return null;let i=W(r),n=[],o=t;for(let a of i){if(typeof o=="string"||o==null||Array.isArray(o))break;if(typeof o=="object"&&a in o){if(n.push(a),o=o[a],Array.isArray(o)||typeof o=="string"&&o.endsWith("[]"))break}else return null}return!Array.isArray(o)&&!(typeof o=="string"&&o.endsWith("[]"))?null:mn(e,t,n)}function mn(e,t,r){if(r.length===0)return null;let i=e,n=t;for(let o=0;o<r.length;o++){let a=r[o];if(!n||typeof n!="object"||Array.isArray(n))return null;let s=n[a];if(s==null)return null;if(o===r.length-1){if(Array.isArray(s)){let[l]=s;return i.querySelector?.(l)?.parentElement||null}if(typeof s=="string"&&s.endsWith("[]")){let l=s.slice(0,-2);return i.querySelector?.(l)?.parentElement||null}return null}n=s}return null}function hn(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 pn(e,t){let r=[];for(let i of Array.from(e.childNodes))i===t||t&&i.contains?.(t)||r.push(i.cloneNode(!0));return r}function fn(e,t,r){for(let n of Array.from(e.childNodes))n===t||t&&n.contains?.(t)||e.removeChild(n);let i=gn(e,t);for(let n of r)e.insertBefore(n,i||null)}function gn(e,t){if(!t)return null;for(let r of Array.from(e.childNodes))if(r===t||r.contains?.(t))return r;return null}function Ye(e,t){if(!t||e==null)return e;return r(e);function r(i){if(typeof i=="string"){if(i.endsWith("[]")||i.lastIndexOf("@")>=0)return i;let n=null;try{n=t.querySelector(i)}catch{return i}return n&&n.children.length>0?i+"@innerHTML":i}if(Array.isArray(i))return i;if(i&&typeof i=="object"){let n=Object.create(null);for(let[o,a]of Object.entries(i))n[o]=r(a);return n}return i}}function Rt(e){if(!e||e.tagName!=="TEXTAREA")return;let t=e.ownerDocument.defaultView||(typeof window<"u"?window:null);t&&t.CSS&&t.CSS.supports&&t.CSS.supports("field-sizing: content")||(e.style.height="auto",e.style.height=e.scrollHeight+"px")}function le(e,t){if(!e||!e.querySelectorAll)return;e.querySelectorAll("textarea[data-hcms-field]").forEach(Rt);let r=t&&t.defaultView||(typeof window<"u"?window:null),i=r&&r.richclay&&r.richclay.RichClay||r&&r.hyperclay&&r.hyperclay.RichClay||(r&&typeof r.RichClay=="function"?r.RichClay:null);i&&e.querySelectorAll("[contenteditable][data-hcms-field]").forEach(n=>{if(n.__hcmsRichclay)return;let o;try{o=new i(n,{inline:!0,hyperclay:!1,toolbar:["bold","italic","link","undo","redo"]})}catch(s){console.warn("[hypercms] richclay activation failed; field stays plain contenteditable",s);return}n.__hcmsRichclay=o;let a=o&&o.squire;a&&typeof a.addEventListener=="function"&&a.addEventListener("input",()=>{let s=r&&r.Event||Event;n.dispatchEvent(new s("input",{bubbles:!0}))})})}var Tt=new WeakSet;function de(e,t){let r=typeof window<"u"&&window.hyperclay&&window.hyperclay.undo||null;if(!r)return t();r.pause();try{let i=t();return i&&i.ok?r.commitCaptured(e):r.discardCaptured(),i}finally{r.resume()}}function Ze(e){let t=typeof window<"u"&&window.hyperclay&&window.hyperclay.undo||null;if(!t)return e();t.pause();try{return e()}finally{t.discardCaptured(),t.resume()}}function Nr(e){let{formRoot:t}=e;if(!t||Tt.has(t))return;Tt.add(t);let r=a=>{let s=a.target;!s||!s.closest||s.closest("[data-hcms-form-root]")&&s.matches("input, textarea, select, [contenteditable][data-hcms-field]")&&(s.tagName==="TEXTAREA"&&Rt(s),!s.matches('input[type="file"]')&&(!s.closest("[data-hcms-field]")&&!s.hasAttribute?.("data-hcms-field")||Lr(s,e)))},i=a=>{let s=a.target;if(!(!s||!s.closest)&&s.closest("[data-hcms-form-root]")){if(s.matches('input[type="file"][data-hcms-upload]')){_n(s,e);return}s.matches('input[type="checkbox"], input[type="radio"], select')&&Lr(s,e)}},n=a=>{let s=a.target;if(!s||!s.closest)return;let l=s.closest("[data-hcms-action]");if(!l)return;let c=l.getAttribute("data-hcms-action");if(c==="add"||c==="remove"||c==="move-up"||c==="move-down"||c==="clear-upload"){if(!l.closest("[data-hcms-form-root]"))return}else if(c==="close"&&!l.closest("[data-hcms-shell]"))return;if(c==="add"){let m=l.closest("[data-hcms-path]");if(!m)return;let d=m.getAttribute("data-hcms-path");Mt(d,e)}else if(c==="remove"){let m=l.closest("[data-hcms-card], [data-hcms-array-item]");if(!m)return;Tn(m,e)}else if(c==="move-up"||c==="move-down"){let m=l.closest("[data-hcms-card], [data-hcms-array-item]");if(!m)return;Cn(m,c==="move-up"?-1:1,e)}else c==="clear-upload"?An(l,e):c==="close"&&e.onCloseRequested?.()},o=t.ownerDocument;o.addEventListener("input",r,!0),o.addEventListener("change",i,!0),o.addEventListener("click",n,!0),e.detachEvents=()=>{o.removeEventListener("input",r,!0),o.removeEventListener("change",i,!0),o.removeEventListener("click",n,!0),Tt.delete(t)}}var bn=new Set(["value","checked"]);function kn(e,t){if(!t)return null;let r=W(t);if(r.some(l=>typeof l=="number"||l==="*"))return null;let i=X(e.pageRules,r);if(typeof i!="string")return null;let n=i.lastIndexOf("@");if(n===-1)return null;let o=i.slice(n+1);if(!bn.has(o))return null;let a=i.slice(0,n),s=a?e.pageRoot.querySelector(a):e.pageRoot;return s?{el:s,prop:o,oldValue:s[o]}:null}function Lr(e,t){let i=(e.closest("[data-hcms-field]")||e).closest("[data-hcms-path]")?.getAttribute("data-hcms-path")||"",n=kn(t,i);if(z(D(t),{path:i,structural:!1},t),n){let o=typeof window<"u"&&window.hyperclay&&window.hyperclay.undo||null;o&&typeof o.recordValue=="function"&&o.recordValue(n.el,{prop:n.prop,oldValue:n.oldValue,newValue:n.el[n.prop]})}}var yn={type:"image/webp",quality:.85,maxWidth:2048,maxHeight:2048};async function vn(e,t){let r=t&&t.getAttribute?t.getAttribute("data-hcms-crop"):null;if(r==null)return{file:e};let i=typeof window<"u"&&window.hyperclay&&window.hyperclay.quickcrop||null;if(typeof i!="function")return{file:e};try{let n=await i(e,{aspect:xn(r),...yn});return n===null?null:{file:wn(n.blob,e.name),dataURL:n.dataURL}}catch(n){return Ae(t,n&&n.message||"Crop failed"),null}}function xn(e){let t=String(e??"").trim().toLowerCase();if(t===""||t==="free")return null;let r=t.match(/^(\d+(?:\.\d+)?)\s*[:/]\s*(\d+(?:\.\d+)?)$/);if(!r)return null;let i=parseFloat(r[1]),n=parseFloat(r[2]);return!i||!n?null:i/n}function wn(e,t){let r=e.type==="image/webp"?".webp":e.type==="image/jpeg"?".jpg":".png",i=String(t||"image").replace(/\.[^.]+$/,"");try{return new File([e],i+r,{type:e.type})}catch{return e}}async function _n(e,t){let r=e.files&&e.files[0];if(!r)return;let i=e.closest("[data-hcms-path]");if(!i)return;let n=i.getAttribute("data-hcms-path")||"";Ae(i,null);let o=await vn(r,i);if(!o||t.closed){Q(e);return}let a=o.file,s=o.dataURL||null,l=typeof window<"u"&&window.hyperclay&&window.hyperclay.uploadFileBasic||null,c=null;if(typeof l=="function")try{let m=await l(a);c=m&&m.uploads&&m.uploads[0]&&m.uploads[0].url}catch(m){if(t.closed){Q(e);return}Ae(i,m&&m.message||"Upload failed"),t.dispatch?.("hcms:error",{error:m,path:n}),Q(e);return}if(t.closed){Q(e);return}if(c||(c=s||En(a)),!c){Q(e);return}Ae(i,null),Fr(i,c,a.name),z(D(t),{path:n,structural:!1},t),Q(e)}function An(e,t){let r=e.closest("[data-hcms-path]");if(!r)return;let i=r.getAttribute("data-hcms-path")||"";Fr(r,"","");let n=r.querySelector('input[type="file"][data-hcms-upload]');n&&Q(n),Ae(r,null),z(D(t),{path:i,structural:!1},t)}function Sn(e){return e.querySelector?e.querySelector("img[data-hcms-field], a[data-hcms-field]"):null}function Fr(e,t,r){let i=Sn(e);if(!i)return;let n=(i.tagName||"").toUpperCase();n==="IMG"?i.src=t||"":n==="A"&&(i.href=t||"",i.textContent=t?r||St(t):"")}function Q(e){try{e.value=""}catch{}}function En(e){let t=typeof URL<"u"&&URL.createObjectURL?URL:null;if(!t)return"";try{return t.createObjectURL(e)}catch{return""}}function Ae(e,t){let r=e.querySelector?e.querySelector(":scope > .hcms-error"):null;r&&(t?(r.textContent=t,r.hidden=!1):(r.textContent="",r.hidden=!0))}function Mt(e,t){let{formRoot:r,pageRules:i}=t,n=r.querySelector(`[data-hcms-path="${In(e)}"]`);if(!n)throw new Error(`hypercms: no element at path "${e}"`);let o=n.querySelector(".hcms-array-items");if(!o)throw new Error(`hypercms: array container missing .hcms-array-items at "${e}"`);let a=W(e),s=jn(i,a),l=Array.isArray(s),c=typeof s=="string"&&s.endsWith("[]");if(!l&&!c)throw new Error(`hypercms: path "${e}" is not an array`);let m=Xe(n,"data-hcms-max-items"),d=o.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]");if(n.hasAttribute("data-hcms-no-add")||m!=null&&d.length>=m)return;let u=d.length,y=l?s[1]:s.replace(/\[\]$/,""),x=ve(l?y:"string"),M=kr({shape:l?"object-array-item":"scalar-array-item",itemShape:y,pathArr:[...a,u],data:x,doc:t.doc,itemKey:n.getAttribute("data-hcms-item-tpl")||null});return o.appendChild(M),le(M,t.doc),Lt(n),de(`Add ${e}`,()=>z(D(t),{path:e,structural:!0},t))}function Cn(e,t,r){let i=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!i||i.hasAttribute("data-hcms-no-reorder"))return;let n=i.querySelector(".hcms-array-items");if(!n)return;let o=Array.from(n.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),a=o.indexOf(e);if(a<0)return;let s=a+t;if(s<0||s>=o.length)return;let l=e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`);return t<0?n.insertBefore(e,o[s]):n.insertBefore(e,o[s].nextSibling),Nt(n),Lt(i),l&&typeof l.focus=="function"&&e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`)?.focus?.(),de(`Reorder ${i.getAttribute("data-hcms-path")||""}`,()=>z(D(r),{path:i.getAttribute("data-hcms-path")||"",structural:!0},r))}var Je="Delete this item?";function Rn(e,t){let r=e&&e.getAttribute("data-hcms-confirm-remove");if(r!=null)return/^(off|false|no|0)$/i.test(r.trim())?null:r||Je;let i=t&&t.confirmRemove;return i===!1?null:typeof i=="string"?i||Je:i===!0||e&&e.getAttribute("data-hcms-shape")==="object-array"?Je:null}function Tn(e,t){let r=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]'),i=Rn(r,t);if(i==null)return ce(e,t);let n=typeof window<"u"&&(window.hyperclay?.consent||window.consent);typeof n=="function"?Promise.resolve(n(i)).then(()=>ce(e,t),()=>{}):typeof window<"u"&&typeof window.confirm=="function"?window.confirm(i)&&ce(e,t):ce(e,t)}function ce(e,t){let r=e.getAttribute("data-hcms-path")||"",i=e.parentElement,n=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!n?.hasAttribute("data-hcms-no-remove")){if(n){let o=Xe(n,"data-hcms-min-items"),a=n.querySelector(".hcms-array-items"),s=a?a.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]").length:0;if(o!=null&&s<=o)return}return e.remove(),i&&Nt(i),n&&Lt(n),de(`Remove ${r}`,()=>z(D(t),{path:r,structural:!0},t))}}function z(e,t,r){let i=Se(e);if(i===r.lastFingerprint)return{ok:!0,skipped:!0};let n=Or(r.pageRoot,r.pageRules,e,{observerHandle:r.observerHandle,shellRoot:r.shellRoot,structural:!!t.structural,structuralPath:t.path||null});return n.ok?(r.lastFingerprint=i,r.lastData=e,jr(r,null),r.dispatch?.("hcms:change",{data:e,path:t.path,structural:!!t.structural}),r.onChange?.(e,t)):(jr(r,Ln(n.error,t.path)),r.dispatch?.("hcms:error",{error:n.error,attemptedData:e}),r.onError?.(n.error)),n}function D(e){let t=q.extract(e.formRoot,e.formRules);return K(t,e.formRules)}function K(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(i=>K(i,r))}if(typeof t=="object"){if(typeof e!="object"||Array.isArray(e))return e;let r={};for(let[i,n]of Object.entries(t))r[i]=K(e[i],n);return r}return e}function jr(e,t){e.lastErrors=t&&t.length?t:null,Ot(e)}function Ot(e){if(Mn(e),e.errorEl&&(e.errorEl.textContent="",e.errorEl.hidden=!0),!e.lastErrors)return;let t=[];for(let{message:r,path:i}of e.lastErrors){if(i!=null&&i!==""){let n=On(e.formRoot,i);if(n){n.textContent=n.textContent?`${n.textContent}
151
+ ${r}`:r,n.hidden=!1;continue}}t.push(r)}t.length&&e.errorEl&&(e.errorEl.textContent=t.join(`
152
+ `),e.errorEl.hidden=!1)}function Mn(e){if(e.formRoot)for(let t of e.formRoot.querySelectorAll(".hcms-error"))t.textContent="",t.hidden=!0}function On(e,t){if(!e)return null;let r=t.split(".");for(;r.length>0;){let i=r.join("."),n=typeof CSS<"u"&&CSS.escape?CSS.escape(i):i.replace(/[^a-zA-Z0-9_\-.*]/g,a=>"\\"+a),o=e.querySelector(`[data-hcms-path="${n}"]`);if(o){for(let a of o.children)if(a.classList&&a.classList.contains("hcms-error"))return a}r.pop()}return null}function Ln(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 jn(e,t){let r=e;for(let i of t){if(r==null||typeof r=="string")return;if(Array.isArray(r)){if(typeof i!="number"&&i!=="*")return;r=r[1];continue}if(typeof r=="object"){if(typeof i=="number"||!(i in r))return;r=r[i];continue}return}return r}function Xe(e,t){if(!e||!e.hasAttribute(t))return null;let r=parseInt(e.getAttribute(t),10);return Number.isFinite(r)?r:null}function Lt(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]")),i=r.length,n=Xe(e,"data-hcms-max-items"),o=Xe(e,"data-hcms-min-items"),a=e.hasAttribute("data-hcms-no-add"),s=e.hasAttribute("data-hcms-no-remove"),l=e.hasAttribute("data-hcms-no-reorder"),c=e.querySelector(':scope > .hcms-add, :scope > * > .hcms-add, :scope > [data-hcms-action="add"]');c&&(c.hidden=a||n!=null&&i>=n),r.forEach((m,d)=>{let u=m.querySelector('[data-hcms-action="remove"]');u&&(u.hidden=s||o!=null&&i<=o);let y=m.querySelector('[data-hcms-action="move-up"]');y&&(y.hidden=l||d===0);let x=m.querySelector('[data-hcms-action="move-down"]');x&&(x.hidden=l||d===i-1)})}function jt(e){!e||!e.querySelectorAll||e.querySelectorAll(".hcms-array-items").forEach(t=>Nt(t))}function Nt(e){let t=e.querySelectorAll?Array.from(e.querySelectorAll('input[type="radio"][data-hcms-field]'),i=>[i,i.checked]):[],r=0;for(let i of e.children){if(!i.matches?.("[data-hcms-card], [data-hcms-array-item]"))continue;let n=i.getAttribute("data-hcms-path");if(!n)continue;let o=n.split(".");o[o.length-1]=String(r);let a=o.join(".");a!==n&&Nn(i,n,a),r++}for(let[i,n]of t)i.checked!==n&&(i.checked=n)}function Nn(e,t,r){let i=e.querySelectorAll("[data-hcms-path]");e.setAttribute("data-hcms-path",r);for(let n of i){let o=n.getAttribute("data-hcms-path");o===t?n.setAttribute("data-hcms-path",r):o&&o.startsWith(t+".")&&n.setAttribute("data-hcms-path",r+o.slice(t.length))}Fn(e)}function Fn(e){for(let t of e.querySelectorAll('input[type="radio"][data-hcms-field]')){if(!t.name||!t.name.startsWith("hcms-"))continue;let r=t.closest("[data-hcms-path]");r&&(t.name=Ct(r.getAttribute("data-hcms-path")))}}function Se(e){return JSON.stringify(e,(t,r)=>{if(r&&typeof r=="object"&&!Array.isArray(r)){let i=Object.create(null);for(let n of Object.keys(r).sort())i[n]=r[n];return i}return r})}function In(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var zn={},Qe="hcms-shell-styles",qn="hcms-bundled-styles-installed",Dn='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,Ft="";function qr(e){Ft=e}var $n=0;function Ir(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t])}function Dr({mountTo:e,side:t="right",overlay:r=!1,showSaveButton:i=!1,title:n="Page content",eyebrow:o="Edit",theme:a=null,doc:s}){$r(s);let l=`hcms-shell-title-${++$n}`,c=s.createElement("div");c.setAttribute("data-hcms-shell",""),c.setAttribute("save-remove",""),c.setAttribute("save-ignore",""),c.setAttribute("tabindex","-1"),c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-labelledby",l);let m=a==="dark"?" dark":a==="light"?" light":"";c.className="hcms-shell pixel-quiet hcms-side-"+t+(r?" hcms-overlay":"")+m;let d=Ir(n),u=Ir(o);c.innerHTML=`
153
+ <div class="hcms-shell-minibar" aria-hidden="true">
154
+ <span class="hcms-shell-minibar-title">${d}</span>
155
+ <button type="button" class="hcms-shell-close mirk-button mirk-button--small" data-hcms-action="close" aria-label="Close">
156
+ <span class="mirk-button__label">\xD7</span>
157
+ </button>
158
+ </div>
159
+ <div class="hcms-shell-body">
160
+ <header class="hcms-shell-header">
161
+ <div class="hcms-shell-heading">
162
+ <div class="hcms-shell-eyebrow">${u}</div>
163
+ <h2 class="hcms-shell-title" id="${l}">${d}</h2>
164
+ </div>
165
+ <button type="button" class="hcms-shell-close mirk-button mirk-button--small" data-hcms-action="close" aria-label="Close">
166
+ <span class="mirk-button__label">\xD7</span>
167
+ </button>
168
+ </header>
169
+ <div class="hcms-shell-error" role="alert" hidden></div>
170
+ <div data-hcms-form-root class="hcms-form"></div>
171
+ <footer class="hcms-shell-footer"${i?"":" hidden"}>
172
+ <button type="button" class="hcms-shell-save mirk-button" trigger-save>
173
+ <span class="mirk-button__label">Save</span>
174
+ </button>
175
+ </footer>
176
+ </div>
177
+ `,(e||s.body).appendChild(c);let x=s.body;x.classList.add("hcms-open"),r&&x.classList.add("hcms-overlay"),t==="left"&&x.classList.add("hcms-side-left");let M=Hn(c,s),b=Pn(c);return{root:c,formRoot:c.querySelector("[data-hcms-form-root]"),errorEl:c.querySelector(".hcms-shell-error"),saveButton:c.querySelector(".hcms-shell-save"),destroy(){M.detach(),b.detach(),c.remove(),x.classList.remove("hcms-open","hcms-overlay","hcms-side-left")},restoreChrome(){Bn(s),x.classList.add("hcms-open"),r&&x.classList.add("hcms-overlay"),t==="left"&&x.classList.add("hcms-side-left")}}}function Bn(e){e&&(e.getElementById(Qe)||e.querySelector("style[data-hcms-bundled-styles]")||(me.delete(e),$r(e)))}function $r(e){if(e&&!me.has(e)){if(e[qn]){me.add(e);return}if(e.getElementById(Qe)||e.querySelector("style[data-hcms-bundled-styles]")){me.add(e);return}if(Ft){let t=e.createElement("style");t.id=Qe,t.setAttribute("save-remove",""),t.setAttribute("save-ignore",""),t.textContent=Ft,(e.head||e.documentElement).appendChild(t),me.add(e);return}try{let t=new URL("./theme.generated.css",zn.url).href,r=e.createElement("link");r.rel="stylesheet",r.id=Qe,r.setAttribute("save-remove",""),r.setAttribute("save-ignore",""),r.href=t,(e.head||e.documentElement).appendChild(r),me.add(e)}catch{console.warn("hypercms: shell stylesheet not applied \u2014 cssText is empty and the co-located theme fallback is unavailable. Call installStyles(themeText) before opening the CMS.")}}}function Pn(e){let t=e.querySelector(".hcms-shell-body"),r=e.querySelector(".hcms-shell-header");if(!t||!r||typeof t.addEventListener!="function")return{detach(){}};let i=()=>{let n=(r.offsetHeight||0)-12;e.classList.toggle("is-condensed",t.scrollTop>n)};return t.addEventListener("scroll",i,{passive:!0}),i(),{detach(){t.removeEventListener("scroll",i)}}}function Hn(e,t){function r(i){if(i.key!=="Tab"||!e.contains(t.activeElement))return;let n=Array.from(e.querySelectorAll(Dn));if(n.length===0)return;let o=n[0],a=n[n.length-1];i.shiftKey&&t.activeElement===o?(i.preventDefault(),a.focus()):!i.shiftKey&&t.activeElement===a&&(i.preventDefault(),o.focus())}return t.addEventListener("keydown",r),{detach:()=>t.removeEventListener("keydown",r)}}var Un={skip:"[data-hcms-shell]",templateAttr:"cms-template"};function et(e,{ignoreActiveValue:t}={}){let r=q.findRules(e.doc,e.rulesSource||"cms");r&&(e.pageRules=e.richText?Ye(r.rules,e.pageRoot):r.rules,e.rulesTagNode=r.tagNode),De(e.doc),He(e.doc,e.pageRules),e.formRules=Ue(e.pageRules,e.doc);let i=K(q.extract(e.pageRoot,e.pageRules,Un),e.pageRules),n=We({pageRules:e.pageRules,formRules:e.formRules,data:i,doc:e.doc});Fe(e.formRoot,n,{ignoreActiveValue:t}),le(e.formRoot,e.doc),Ot(e),e.updateFingerprint&&e.updateFingerprint()}function Br({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 i=0,n=r.onAnyChange({debounce:e},()=>{i>0||t()});return{unsubscribe:typeof n=="function"?n:()=>{},pause(){i++},resume(){i=Math.max(0,i-1)}}}var Wn="[hypercms]";function Pr(e,t){if(!e||!e.querySelectorAll||!t)return;let r=Vn(t);e.querySelectorAll("template[data-hcms-tpl]").forEach(n=>{let o=n.getAttribute("data-hcms-tpl");o&&(o.startsWith("@")||r.has(o)||console.warn(`${Wn} template "${o}" doesn't match any rule path; ignored`))})}function Vn(e){let t=new Set;return r([],e),t;function r(i,n){let o=i.join("."),a=i.map(l=>typeof l=="number"?"*":l).join(".");o&&t.add(o),a&&t.add(a);let s=Z(n);if(s==="object")for(let[l,c]of Object.entries(n))r([...i,l],c);else if(s==="object-array"||s==="scalar-array"){let l=[...i,"*"],c=l.map(m=>typeof m=="number"?"*":m).join(".");if(t.add(c),s==="object-array"){let m=n[1];if(m&&typeof m=="object"&&!Array.isArray(m))for(let[d,u]of Object.entries(m))r([...l,d],u)}}}}var Hr="hcms-toggle",zr="hcms-toggle-style",Kn=`
178
+ #hcms-toggle {
179
+ position: fixed; right: 16px; bottom: 16px; z-index: 2147482900;
180
+ display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px;
181
+ border: 1px solid #3a3f58; background: #14161f; color: #f2f3f7;
182
+ font: 500 13px/1 system-ui, sans-serif; border-radius: 999px; cursor: pointer;
183
+ box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .55);
184
+ }
185
+ #hcms-toggle:hover { background: #1d2030; }
186
+ #hcms-toggle .hcms-toggle__close { display: none; }
187
+ body.hcms-open #hcms-toggle .hcms-toggle__open { display: none; }
188
+ body.hcms-open #hcms-toggle .hcms-toggle__close { display: inline; }
189
+ body.hcms-open:not(.hcms-overlay):not(.hcms-side-left) #hcms-toggle { right: calc(380px + 16px); }
190
+ body.hcms-open.hcms-overlay #hcms-toggle { display: none; }
191
+ `;function Gn({search:e="",cookie:t="",forced:r=null}={}){let i=typeof e=="string"?e:"",n=i.indexOf("?"),o=n===-1?i:i.slice(n+1),a=new URLSearchParams(o).get("editmode");return a?a==="true":r!=null?!!r:/(?:^|;\s*)isAdminOfCurrentResource=[^;]/.test(t)}function Yn({open:e,close:t,isOpen:r},i=document){let n=i.getElementById(Hr);if(n)return n;if(!i.getElementById(zr)){let a=i.createElement("style");a.id=zr,a.setAttribute("snapshot-remove",""),a.textContent=Kn,i.head.appendChild(a)}let o=i.createElement("button");return o.type="button",o.id=Hr,o.setAttribute("no-save",""),o.setAttribute("snapshot-remove",""),o.setAttribute("save-ignore",""),o.setAttribute("aria-label","Toggle content editor"),o.innerHTML='<span class="hcms-toggle__open">Edit content</span><span class="hcms-toggle__close">Close editor</span>',o.addEventListener("click",async()=>{try{r()?t():await e()}catch(a){console.warn("hypercms: toggle failed to open the CMS",a)}}),i.body.appendChild(o),o}function Ur(e){if(typeof window>"u"||typeof document>"u")return;let t=window.__hyperclayEditMode!=null?window.__hyperclayEditMode:null;if(!Gn({search:window.location.search,cookie:document.cookie,forced:t}))return;let r=()=>{document.body&&e.hasRules(document)&&Yn(e)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r,{once:!0}):r()}function Kr(e){qr(e)}var L={isOpen:!1,ctx:null,shell:null,opts:null};function Wr(e,t){if(L.ctx!==e)return;let r=t==="livesync";t==="livesync"&&L.shell?.restoreChrome?.(),et(e,{ignoreActiveValue:r})}var Vr=!1;function Jn(){if(Vr)return;let e=typeof window<"u"&&window.hyperclay&&window.hyperclay.onPrepareForSave||null;typeof e=="function"&&(e(t=>{let r=t&&t.querySelector&&t.querySelector("body");r&&r.classList.remove("hcms-open","hcms-overlay","hcms-side-left")}),Vr=!0)}function Dt(e={}){if(L.isOpen){console.warn("cms.open() called while already open; ignoring");return}Jn();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 i=e.rules!==void 0?e.rules:"cms",n=q.findRules(r,i);if(!n){let u=typeof i=="string"?`data-rules-name~="${i}"`:"the provided rules object";throw new Error(`hypercms: no rules found for ${u}`)}let o=e.richText!==!1,a=o?Ye(n.rules,t):n.rules,s=n.tagNode;De(r),He(r,a),Pr(r,a);let l=Ue(a,r),c=K(q.extract(t,a,{skip:"[data-hcms-shell]",templateAttr:"cms-template"}),a),m=Ze(()=>Dr({mountTo:e.mountTo||r.body,side:e.side||"right",overlay:!!e.overlay,showSaveButton:!!e.showSaveButton,title:e.title,eyebrow:e.eyebrow,theme:e.theme,doc:r})),d={doc:r,pageRoot:t,pageRules:a,formRules:l,rulesTagNode:s,rulesSource:i,richText:o,formRoot:m.formRoot,shellRoot:m.root,errorEl:m.errorEl,lastFingerprint:null,lastData:null,observerHandle:null,undoUnsub:null,livesyncUnsub:null,onChange:e.onChange,onError:e.onError,confirmRemove:e.confirmRemove,previouslyFocused:r.activeElement,dispatch(u,y){let x=r.defaultView&&r.defaultView.CustomEvent||(typeof CustomEvent<"u"?CustomEvent:null);if(!x)return;let M=new x(u,{bubbles:!0,cancelable:u==="hcms:change",detail:y});m.root.dispatchEvent(M)},onCloseRequested(){$t()}};d.updateFingerprint=()=>{d.lastFingerprint=Se(D(d))};try{let u=We({pageRules:a,formRules:l,data:c,doc:r});m.formRoot.appendChild(u),le(m.formRoot,r),Nr(d),d.updateFingerprint(),d.observerHandle=Br({onRefresh:()=>et(d)});let y=typeof window<"u"&&window.hyperclay&&window.hyperclay.undo||null;if(y&&typeof y.on=="function"){let M=()=>{if(L.ctx!==d)return;Wr(d,"undo");let b=K(q.extract(d.pageRoot,d.pageRules,{skip:"[data-hcms-shell]",templateAttr:"cms-template"}),d.pageRules);Se(b)!==Se(d.lastData)&&(d.lastData=b,d.onChange?.(b,{path:"",structural:!1}))};y.on("undo",M),y.on("redo",M),d.undoUnsub=()=>{y.off("undo",M),y.off("redo",M)}}let x=()=>Wr(d,"livesync");r.addEventListener("hyperclay:livesync-applied",x),d.livesyncUnsub=()=>r.removeEventListener("hyperclay:livesync-applied",x),Ee.ctx=d,Zn(r),Xn(m.root),L.isOpen=!0,L.ctx=d,L.shell=m,L.opts=e,d.dispatch("hcms:open",{pageRoot:t})}catch(u){throw d.observerHandle?.unsubscribe?.(),d.undoUnsub?.(),d.livesyncUnsub?.(),d.detachEvents?.(),Ee.ctx===d&&(Ee.ctx=null),Ze(()=>m.destroy()),L.isOpen=!1,L.ctx=null,L.shell=null,L.opts=null,u}}function Xn(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 Ee={ctx:null};function Zn(e){let t=e.defaultView||(typeof globalThis<"u"?globalThis:null);if(!t)return;let r=function(){let n=Ee.ctx;if(n)return jt(n.formRoot),de("Reorder",()=>z(D(n),{path:"",structural:!0},n))};typeof t.hypercmsCommit!="function"&&(t.hypercmsCommit=r),typeof globalThis<"u"&&typeof globalThis.hypercmsCommit!="function"&&(globalThis.hypercmsCommit=r)}var qt="cms";function Qn(e){let t=typeof e=="string"?e:"",r=t.indexOf("?"),i=r===-1?t:t.slice(r+1);if(!i)return t;let n=new URLSearchParams(i);return n.get(qt)!=="true"?t:(n.set(qt,"false"),"?"+n.toString())}function eo(e){let t=typeof e=="string"?e:"",r=t.indexOf("?"),i=r===-1?t:t.slice(r+1);return i?new URLSearchParams(i).get(qt)==="true":!1}function to(){if(typeof window>"u"||!window.location||!window.history||typeof window.history.replaceState!="function")return;let e=window.location.search,t=Qn(e);t!==e&&window.history.replaceState(window.history.state,"",t+window.location.hash)}function $t(){if(!L.isOpen)return;let{ctx:e,shell:t}=L;e.closed=!0;let r=e.previouslyFocused;if(e.dispatch("hcms:close",null),to(),e.observerHandle?.unsubscribe?.(),e.undoUnsub?.(),e.livesyncUnsub?.(),e.detachEvents?.(),Ze(()=>t.destroy()),L.isOpen=!1,L.ctx=null,L.shell=null,L.opts=null,Ee.ctx=null,r&&typeof r.focus=="function")try{r.focus()}catch{}}function Gr(){L.isOpen&&et(L.ctx)}function ro(){return L.isOpen}var io={getData(){return L.isOpen?D(L.ctx):null},setValue(e,t){if(!L.isOpen)throw new Error("hypercms: cms is not open");let r=L.ctx,i=W(e),n=X(r.pageRules,i);if(n===void 0)throw new Error(`hypercms: no rule at path "${e}"`);if(typeof n!="string"||n.endsWith("[]"))throw new Error(`hypercms: setValue requires a leaf scalar path; "${e}" is not a leaf`);let o=no(r.formRoot,e);if(!o)throw new Error(`hypercms: no field element at path "${e}"`);oo(o,t,r.formRoot,e),z(D(r),{path:e,structural:!1},r)},addItem(e){if(!L.isOpen)throw new Error("hypercms: cms is not open");Mt(e,L.ctx)},removeItem(e){if(!L.isOpen)throw new Error("hypercms: cms is not open");let t=L.ctx,r=W(e);if(typeof r[r.length-1]!="number")throw new Error(`hypercms: removeItem requires an item path; "${e}" is not an array index`);let n=X(t.pageRules,r.slice(0,-1));if(!(Array.isArray(n)||typeof n=="string"&&n.endsWith("[]")))throw new Error(`hypercms: removeItem requires an item path; parent of "${e}" is not an array`);let a=t.formRoot.querySelector(`[data-hcms-path="${Pt(e)}"]`);if(!a)throw new Error(`hypercms: no element at path "${e}"`);ce(a,t)},refresh:Gr,_commit(){if(!L.isOpen)return;let e=L.ctx;return jt(e.formRoot),de("Update",()=>z(D(e),{path:"",structural:!0},e))}};function no(e,t){let r=Pt(t),i=`[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(i)}function oo(e,t,r,i){let n=(e.tagName||"").toUpperCase(),o=(e.getAttribute("type")||"").toLowerCase();if(n==="INPUT"&&o==="checkbox"){e.checked=t===!0||t==="true";return}if(n==="INPUT"&&o==="radio"){let a=Pt(i),s=r.querySelectorAll(`[data-hcms-path="${a}"][data-hcms-field][type="radio"], [data-hcms-path="${a}"] [data-hcms-field][type="radio"]`);s.length?s.forEach(l=>{l.checked=String(l.value)===String(t??"")}):e.checked=String(e.value)===String(t??"");return}if(n==="IMG"){e.src=t==null?"":String(t);return}if(n==="A"){e.href=t==null?"":String(t);return}if(e.hasAttribute&&e.hasAttribute("contenteditable")){e.innerHTML=t==null?"":String(t);return}if("value"in e){e.value=t==null?"":String(t);return}e.textContent=t==null?"":String(t)}var so=250,ao=1e4;function lo(){typeof window>"u"||typeof document>"u"||eo(window.location?window.location.search:"")&&(L.isOpen||co(()=>{if(!L.isOpen)try{Dt()}catch(e){console.warn("hypercms: auto-open failed",e)}}))}function It(){return!!document.body&&!!(window.hyperclay&&window.hyperclay.Mutation)}function co(e){if(It()){queueMicrotask(e);return}let t=Date.now()+ao,r=!1,i=null,n=()=>{r||(r=!0,i!==null&&clearInterval(i),document.removeEventListener("hyperclay:mutation-ready",o))};function o(){if(L.isOpen){n();return}It()&&(n(),e())}document.addEventListener("hyperclay:mutation-ready",o,{once:!0}),i=setInterval(()=>{if(L.isOpen){n();return}if(It()){n(),e();return}Date.now()>=t&&(n(),console.warn("hypercms: ?cms=true auto-open gave up \u2014 window.hyperclay.Mutation never appeared. Load hyperclayjs (or the mutation utility) so the CMS can initialize."))},so)}lo();Ur({open:Dt,close:$t,isOpen:ro,hasRules:e=>!!q.findRules(e,"cms")});var Bt={open:Dt,close:$t,refresh:Gr,api:io,get isOpen(){return L.isOpen},path:wt,scaffold:ve,morphForm:Fe};function Pt(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var Yr=`/* GENERATED by scripts/build-theme.js from mirk-interface/mirk.css \u2014 DO NOT EDIT.
192
+ Source of truth: mirk-interface/mirk.css + src/theme/pixel-quiet.overrides.css.
193
+ Regenerate with: npm run build:theme */
194
+
195
+ /* ===== mirk-interface@2.2.0, scoped to .hcms-shell ===== */
196
+ /*
197
+ * mirk.css \u2014 the mirk UI kit, v2.
198
+ * Hand-written, no build. Fourteen form components as semantic BEM classes in
199
+ * @layer components, so utilities (Tailwind or your own) always override them
200
+ * with zero !important. Renders fully standalone; Tailwind is optional.
201
+ *
202
+ * Two hinges (see mirk-ui-guide.md):
203
+ * 1. Components live in @layer components \u2192 utilities win.
204
+ * 2. State serializes into the DOM (native attrs, :has(), inline --mirk-value)
205
+ * so document.documentElement.outerHTML round-trips every visible state.
206
+ *
207
+ * This @layer statement makes the file self-sufficient without Tailwind, and
208
+ * merges into Tailwind's own order (@layer theme, base, components, utilities)
209
+ * when present.
210
+ */
211
+ @layer base, components;
212
+
213
+ @layer base {
214
+ /* Components are authored border-box (a 2px bevel must not grow the box). */
215
+ .hcms-shell *, .hcms-shell *::before, .hcms-shell *::after { box-sizing: border-box; }
216
+ .hcms-shell button, .hcms-shell input, .hcms-shell optgroup, .hcms-shell select, .hcms-shell textarea { margin: 0; }
217
+
218
+ @font-face {
219
+ font-family: 'Departure Mono';
220
+ src: url('https://cdn.jsdelivr.net/npm/mirk-interface@2.2.0/fonts/DepartureMono-1.500/DepartureMono-Regular.woff2') format('woff2');
221
+ font-weight: 400; font-style: normal; font-display: swap;
222
+ }
223
+
224
+ .hcms-shell { font-family: 'Departure Mono', ui-monospace, "Menlo", monospace; }
225
+ /* Preflight sets these to ui-monospace; keep them in Departure Mono. */
226
+ .hcms-shell pre, .hcms-shell code, .hcms-shell kbd, .hcms-shell samp { font-family: inherit; }
227
+
228
+ /* 28 tokens, one value each. light-dark() picks the side from color-scheme.
229
+ :root paints the DEFAULT theme \u2014 "Pixel Quiet" (see 0030): mirk's warm soul
230
+ with the volume down. The louder original palette is the opt-in
231
+ [data-theme="full-volume"] block below. */
232
+ .hcms-shell {
233
+ color-scheme: light dark; /* default: follow the OS */
234
+
235
+ --mirk-canvas: light-dark(#FDF8F0, #0B0C13);
236
+ --mirk-bg: light-dark(#FDF8F0, #11131E);
237
+ --mirk-fg: light-dark(#2B241B, #ECEAF2);
238
+ --mirk-accent: light-dark(#efefe5, #1D1F2F);
239
+ --mirk-destructive: light-dark(#C24A3A, #ff5566);
240
+ --mirk-focus-color: light-dark(#C7AE93, #4A506B);
241
+ --mirk-bevel-bg: light-dark(#FCF8F1, #1A1D2C);
242
+ --mirk-bevel-fg: light-dark(#2B241B, #ECEAF2);
243
+ --mirk-bevel-tl: light-dark(#F0E7D8, #2A2E42);
244
+ --mirk-bevel-br: light-dark(#E2D4BF, #14182A);
245
+ --mirk-bevel-hover-bg: light-dark(#F4ECDF, #202436);
246
+ --mirk-pill-inner-top: light-dark(#FBF6EE, #202436);
247
+ --mirk-input-border: light-dark(#D8C8AF, #353B52);
248
+ --mirk-placeholder-color: light-dark(#A8987F, #6A7090);
249
+ --mirk-ctrl-bg: light-dark(#8C7660, #5F6582);
250
+ --mirk-toggle-bg: light-dark(#EFDBBD, #3E4660);
251
+ --mirk-toggle-hi: light-dark(#F4EADA, #4E567A);
252
+ --mirk-toggle-lo: light-dark(#C2A87E, #262B42);
253
+ --mirk-mark-fg: light-dark(#6B5942, #C9CDE0);
254
+ --mirk-sortable-dot: light-dark(#DDCBB0, #353B52);
255
+ --mirk-sortable-shadow: light-dark(#C9B493, #0E1120);
256
+ --mirk-sortable-label: light-dark(#8C7B62, #8A90AB);
257
+ --mirk-sortable-placeholder: light-dark(#A8987F, #6A7090);
258
+ --mirk-slider-fill: light-dark(#F2E0BD, #2A2E42);
259
+ --mirk-slider-nub-bg: light-dark(#EFDBBD, #3E4660);
260
+ --mirk-slider-nub-hi: light-dark(#F4EADA, #4E567A);
261
+ --mirk-slider-nub-lo: light-dark(#C2A87E, #262B42);
262
+
263
+ /* Chip \u2014 the recovery/notification component reads from the kit's own tokens
264
+ via 5 slim hooks, so it matches the kit by default and reskins by overriding
265
+ a hook (not a rule). Each follows the theme (incl. the Full Volume variant)
266
+ and OS light/dark with no per-theme repaint; the one exception is the primary
267
+ fill, which the default (Pixel Quiet) leaves as the theme's fg ink while the
268
+ Full Volume variant tints it a warm brown in light (see below). */
269
+ --mirk-chip-surface: var(--mirk-bg); /* raised panel face */
270
+ --mirk-chip-edge: var(--mirk-input-border); /* panel + recess outline */
271
+ --mirk-chip-primary-bg: var(--mirk-fg); /* primary action fill \u2014 the theme's fg ink (Full Volume tints it warm brown in light) */
272
+ --mirk-chip-primary-fg: var(--mirk-bg);
273
+ --mirk-chip-alert: var(--mirk-destructive); /* icon + struck "now" value */
274
+
275
+ --mirk-radius: 5px; /* the "rounded" corner */
276
+ --mirk-focus-offset: 2px; /* non-color \u2192 can't ride light-dark() */
277
+
278
+ background: var(--mirk-canvas);
279
+ color: var(--mirk-fg);
280
+ }
281
+
282
+ /* The one non-color token with a real light/dark split (was 2px / 3px). */
283
+ @media (prefers-color-scheme: dark) { .hcms-shell { --mirk-focus-offset: 3px; } }
284
+
285
+ /* Force a mode on any subtree with one attribute (class aliases for hosts that
286
+ prefer class-based theming and Tailwind's dark-variant convention). Each also
287
+ paints its own canvas so a wrapper visibly flips. */
288
+ .hcms-shell[data-theme="light"], .hcms-shell.light {
289
+ color-scheme: light; --mirk-focus-offset: 2px;
290
+ background: var(--mirk-canvas); color: var(--mirk-fg);
291
+ }
292
+ .hcms-shell[data-theme="dark"], .hcms-shell.dark {
293
+ color-scheme: dark; --mirk-focus-offset: 3px;
294
+ background: var(--mirk-canvas); color: var(--mirk-fg);
295
+ }
296
+
297
+ /* Built-in brand variant \u2014 "Full Volume": mirk's original full-strength palette,
298
+ the loud pole of the volume axis (Pixel Quiet, now the default, is the quiet
299
+ end). Full-contrast bevel, warm cream / deep navy, crimson destructive.
300
+ Authored with light-dark() like :root, so it follows the OS and still flips
301
+ with .dark / .light. Opt in: data-theme="full-volume". Sits after :root
302
+ (equal specificity, source order wins). --mirk-radius / --mirk-focus-offset /
303
+ --mirk-ctrl-bg and the four shared --mirk-chip-* hooks inherit from :root
304
+ unchanged; only the tokens that differ from the default are re-declared here. */
305
+ .hcms-shell[data-theme="full-volume"] {
306
+ --mirk-canvas: light-dark(#F7F2EA, #0B0C13);
307
+ --mirk-bg: light-dark(#F7F2EA, #1D1F2F);
308
+ --mirk-fg: light-dark(#15120e, #F6F7F9);
309
+ --mirk-accent: light-dark(#efefe5, #232639);
310
+ --mirk-destructive: light-dark(#d4183d, #ff5566);
311
+ --mirk-focus-color: light-dark(#BBA288, #5A607F);
312
+ --mirk-bevel-bg: light-dark(#e9d3bd, #1D1F2F);
313
+ --mirk-bevel-fg: light-dark(#15120e, #F6F7F9);
314
+ --mirk-bevel-tl: light-dark(#f3ddc7, #474C65);
315
+ --mirk-bevel-br: light-dark(#c2ad95, #131725);
316
+ --mirk-bevel-hover-bg: light-dark(#dfc9b3, #232639);
317
+ --mirk-pill-inner-top: light-dark(#efdac7, #232639);
318
+ --mirk-input-border: light-dark(#957E65, #6E738E);
319
+ --mirk-placeholder-color: light-dark(#7F7366, #545973);
320
+ --mirk-toggle-bg: light-dark(#DFC9AF, #656D95);
321
+ --mirk-toggle-hi: light-dark(#E9D6C3, #7F87AD);
322
+ --mirk-toggle-lo: light-dark(#C7A88A, #505677);
323
+ --mirk-mark-fg: light-dark(#3F3225, #E1E3EA);
324
+ --mirk-sortable-dot: light-dark(#e2c5a6, #393f5b);
325
+ --mirk-sortable-shadow: light-dark(#c7a47f, #111527);
326
+ --mirk-sortable-label: light-dark(#231e18, #edeef2);
327
+ --mirk-sortable-placeholder: light-dark(#99826c, #6f7695);
328
+ --mirk-slider-fill: light-dark(#e9d3bd, #232639);
329
+ --mirk-slider-nub-bg: light-dark(#DFC9AF, #656D95);
330
+ --mirk-slider-nub-hi: light-dark(#E9D6C3, #7F87AD);
331
+ --mirk-slider-nub-lo: light-dark(#C7A88A, #505677);
332
+ /* :root (Pixel Quiet) leaves the chip primary as its own fg ink; the original
333
+ default tinted it a warm brown in light \u2014 restore that here. */
334
+ --mirk-chip-primary-bg: light-dark(#1C170E, var(--mirk-fg));
335
+ }
336
+
337
+ /* Roll your own the same way \u2014 an explicit [data-theme] block is the escape hatch:
338
+ [data-theme="sunset"] { color-scheme: light; --mirk-accent: #f0a868; \u2026 } */
339
+ }
340
+
341
+ @layer components {
342
+ /* Visually hidden, still focusable/announced. The hidden native input behind
343
+ every custom control relies on it; Tailwind is optional now. */
344
+ .hcms-shell .mirk-sr-only {
345
+ position: absolute; width: 1px; height: 1px;
346
+ padding: 0; margin: -1px; overflow: hidden;
347
+ clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
348
+ }
349
+
350
+ /* ============================ BUTTON ============================ */
351
+ .hcms-shell .mirk-button {
352
+ display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
353
+ font: inherit; line-height: 1.5; cursor: pointer; user-select: none;
354
+ text-align: center;
355
+ color: var(--mirk-bevel-fg);
356
+ background: var(--mirk-bevel-bg);
357
+ border: 2px solid;
358
+ /* Raised bevel: light top+left, dark right+bottom. Shorthand is T R B L. */
359
+ border-color: var(--mirk-bevel-tl) var(--mirk-bevel-br) var(--mirk-bevel-br) var(--mirk-bevel-tl);
360
+ padding: 4px 14px 5px; /* medium */
361
+ outline: none;
362
+ }
363
+ .hcms-shell .mirk-button__label { white-space: nowrap; user-select: none; display: inline-block; }
364
+
365
+ /* States, written once, shared by every size and shape. */
366
+ .hcms-shell .mirk-button:hover { background-color: var(--mirk-bevel-hover-bg); }
367
+ .hcms-shell .mirk-button:active {
368
+ border-color: var(--mirk-bevel-br) var(--mirk-bevel-tl) var(--mirk-bevel-tl) var(--mirk-bevel-br);
369
+ }
370
+ .hcms-shell .mirk-button:not(.mirk-button--round):active .mirk-button__label { translate: 1.5px 1.5px; }
371
+ /* Direct focus (a real <button>) or a focus-visible descendant (a <label>
372
+ wrapping a hidden input, as the file/image upload triggers do). */
373
+ .hcms-shell .mirk-button:focus-visible, .hcms-shell .mirk-button:has(:focus-visible) {
374
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
375
+ }
376
+ .hcms-shell .mirk-button:disabled { opacity: 0.5; cursor: not-allowed; }
377
+
378
+ /* Sizes set padding + font (rect); round re-homes padding to the label below. */
379
+ .hcms-shell .mirk-button--small { padding: 3px 12px; font-size: 14px; }
380
+ .hcms-shell .mirk-button--large { padding: 4px 17px 7px; font-size: 18px; border-width: 3px; }
381
+
382
+ /* Round register: a gradient pill frame with the label as the inner fill. */
383
+ .hcms-shell .mirk-button--round {
384
+ border: none; padding: 2px; border-radius: 14px;
385
+ background-color: var(--mirk-canvas);
386
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-br), var(--mirk-bevel-tl));
387
+ opacity: 0.9; transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
388
+ }
389
+ .hcms-shell .mirk-button--round:hover { opacity: 1; }
390
+ .hcms-shell .mirk-button--round:active {
391
+ background-image: linear-gradient(to bottom in oklab, var(--mirk-bevel-br), var(--mirk-bevel-tl));
392
+ }
393
+ .hcms-shell .mirk-button--round .mirk-button__label {
394
+ display: flex; align-items: center; gap: 0.5rem;
395
+ padding: 4px 17px 6px; border-radius: 12px;
396
+ color: var(--mirk-bevel-fg);
397
+ background-color: var(--mirk-bevel-bg);
398
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-bg), var(--mirk-pill-inner-top));
399
+ }
400
+ .hcms-shell .mirk-button--round.mirk-button--small { border-radius: 12px; }
401
+ .hcms-shell .mirk-button--round.mirk-button--small .mirk-button__label { padding: 2px 14px; border-radius: 10px; }
402
+ .hcms-shell .mirk-button--round.mirk-button--large { border-radius: 16px; }
403
+ .hcms-shell .mirk-button--round.mirk-button--large .mirk-button__label { padding: 7px 24px 9px; border-radius: 14px; }
404
+
405
+ /* Quiet: a borderless text button (transparent border keeps the hit area + the
406
+ baseline aligned with neighbouring bevel buttons). For tertiary actions. */
407
+ .hcms-shell .mirk-button--quiet {
408
+ background: none; background-image: none;
409
+ border-color: transparent; color: var(--mirk-placeholder-color);
410
+ }
411
+ .hcms-shell .mirk-button--quiet:hover { background: none; color: var(--mirk-fg); }
412
+ .hcms-shell .mirk-button--quiet:active { border-color: transparent; }
413
+
414
+ /* ============================ TEXT INPUT ============================ */
415
+ .hcms-shell .mirk-input {
416
+ width: 100%;
417
+ background: var(--mirk-bevel-bg); color: var(--mirk-bevel-fg);
418
+ border: 1px solid var(--mirk-input-border);
419
+ padding: 5px 14px 6px; /* medium */
420
+ font: inherit; line-height: 1.5; border-radius: 0; outline: none;
421
+ }
422
+ .hcms-shell .mirk-input::placeholder { color: var(--mirk-placeholder-color); }
423
+ .hcms-shell .mirk-input:focus-visible {
424
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
425
+ }
426
+ .hcms-shell .mirk-input--small { padding: 4px 12px; font-size: 14px; }
427
+ .hcms-shell .mirk-input--large { padding: 6px 17px 9px; font-size: 18px; }
428
+ .hcms-shell .mirk-input--rounded { border-radius: var(--mirk-radius); }
429
+
430
+ /* ============================ TEXTAREA ============================ */
431
+ .hcms-shell .mirk-textarea {
432
+ width: 100%;
433
+ background: var(--mirk-bevel-bg); color: var(--mirk-bevel-fg);
434
+ border: 1px solid var(--mirk-input-border);
435
+ padding: 6px 17px 9px; font: inherit; font-size: 18px; line-height: 1.5;
436
+ border-radius: 0; outline: none; resize: vertical;
437
+ }
438
+ .hcms-shell .mirk-textarea::placeholder { color: var(--mirk-placeholder-color); }
439
+ .hcms-shell .mirk-textarea:focus-visible {
440
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
441
+ }
442
+ .hcms-shell .mirk-textarea--rounded { border-radius: var(--mirk-radius); }
443
+
444
+ /* ============================ NUMBER ============================ */
445
+ .hcms-shell .mirk-number {
446
+ display: flex; align-items: stretch; width: 100%;
447
+ background: var(--mirk-bevel-bg);
448
+ border: 1px solid var(--mirk-input-border); border-radius: 0;
449
+ }
450
+ .hcms-shell .mirk-number:has(:focus-visible) {
451
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
452
+ }
453
+ .hcms-shell .mirk-number__input {
454
+ flex: 1; min-width: 0; background: transparent; color: var(--mirk-bevel-fg);
455
+ padding: 5px 10px 6px 14px; /* medium */
456
+ font: inherit; line-height: 1.5; outline: none;
457
+ appearance: textfield; -webkit-appearance: textfield;
458
+ }
459
+ .hcms-shell .mirk-number__input::-webkit-outer-spin-button, .hcms-shell .mirk-number__input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; }
460
+ .hcms-shell .mirk-number__steps { display: flex; flex-direction: column; padding: 2px; gap: 2px; }
461
+ .hcms-shell .mirk-number__step {
462
+ flex: 1; cursor: pointer; line-height: 1; padding: 0 10px; font-size: 9px; /* medium */
463
+ display: flex; align-items: center; justify-content: center;
464
+ background: var(--mirk-bevel-bg); outline: none;
465
+ border: 2px solid;
466
+ border-color: var(--mirk-bevel-tl) var(--mirk-bevel-br) var(--mirk-bevel-br) var(--mirk-bevel-tl);
467
+ }
468
+ .hcms-shell .mirk-number__step:hover { background: var(--mirk-bevel-hover-bg); }
469
+ .hcms-shell .mirk-number__step:active {
470
+ border-color: var(--mirk-bevel-br) var(--mirk-bevel-tl) var(--mirk-bevel-tl) var(--mirk-bevel-br);
471
+ }
472
+ .hcms-shell .mirk-number__step:focus-visible { outline: 1px solid var(--mirk-focus-color); outline-offset: 1px; }
473
+
474
+ .hcms-shell .mirk-number--small .mirk-number__input { padding: 4px 8px 4px 12px; font-size: 14px; }
475
+ .hcms-shell .mirk-number--small .mirk-number__step { padding: 0 8px; font-size: 8px; }
476
+ .hcms-shell .mirk-number--large .mirk-number__input { padding: 6px 12px 9px 17px; font-size: 18px; }
477
+ .hcms-shell .mirk-number--large .mirk-number__step { padding: 0 12px; font-size: 10px; }
478
+
479
+ .hcms-shell .mirk-number--rounded { border-radius: var(--mirk-radius); }
480
+ .hcms-shell .mirk-number--rounded .mirk-number__step { border-radius: 3px; }
481
+
482
+ /* ============================ SELECT / DROPDOWN ============================ */
483
+ /* Keeps appearance:none + a real chevron (renders identically everywhere today);
484
+ base-select/::picker is a future enhancement. */
485
+ .hcms-shell .mirk-select { position: relative; }
486
+ .hcms-shell .mirk-select__field {
487
+ width: 100%; appearance: none; -webkit-appearance: none;
488
+ background: var(--mirk-bevel-bg); color: var(--mirk-bevel-fg);
489
+ border: 2px solid;
490
+ border-color: var(--mirk-bevel-tl) var(--mirk-bevel-br) var(--mirk-bevel-br) var(--mirk-bevel-tl);
491
+ padding: 4px 40px 5px 14px; /* medium */
492
+ font: inherit; line-height: 1.5; border-radius: 0; outline: none;
493
+ }
494
+ .hcms-shell .mirk-select__field:focus-visible {
495
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
496
+ }
497
+ .hcms-shell .mirk-select__chevron {
498
+ pointer-events: none; position: absolute; top: 50%; right: 14px; /* medium */
499
+ translate: 0 -50%; rotate: 90deg; display: inline-block; line-height: 1; font-size: 20px;
500
+ }
501
+ .hcms-shell .mirk-select--small .mirk-select__field { padding: 3px 36px 3px 12px; font-size: 14px; }
502
+ .hcms-shell .mirk-select--small .mirk-select__chevron { right: 12px; font-size: 18px; }
503
+ .hcms-shell .mirk-select--large .mirk-select__field { padding: 4px 48px 7px 17px; font-size: 18px; border-width: 3px; }
504
+ .hcms-shell .mirk-select--large .mirk-select__chevron { right: 16px; font-size: 24px; }
505
+
506
+ /* Round: gradient pill frame around a borderless, pill-filled select. */
507
+ .hcms-shell .mirk-select--round .mirk-select__frame {
508
+ padding: 2px; border-radius: 14px; /* medium */
509
+ background-color: var(--mirk-canvas);
510
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-br), var(--mirk-bevel-tl));
511
+ }
512
+ .hcms-shell .mirk-select--round .mirk-select__frame:has(:focus-visible) {
513
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
514
+ }
515
+ .hcms-shell .mirk-select--round .mirk-select__field {
516
+ border: none; background-color: transparent;
517
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-bg), var(--mirk-pill-inner-top));
518
+ border-radius: 12px; padding: 4px 40px 6px 17px; /* medium */
519
+ }
520
+ .hcms-shell .mirk-select--round.mirk-select--small .mirk-select__frame { border-radius: 12px; }
521
+ .hcms-shell .mirk-select--round.mirk-select--small .mirk-select__field { border-radius: 10px; padding: 2px 36px 2px 14px; }
522
+ .hcms-shell .mirk-select--round.mirk-select--large .mirk-select__frame { border-radius: 16px; }
523
+ .hcms-shell .mirk-select--round.mirk-select--large .mirk-select__field { border-radius: 14px; padding: 7px 48px 9px 24px; }
524
+ .hcms-shell .mirk-select--round.mirk-select--large .mirk-select__chevron { right: 16px; font-size: 24px; }
525
+
526
+ /* ============================ CHECKBOX ============================ */
527
+ .hcms-shell .mirk-checkbox { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; width: fit-content; }
528
+ .hcms-shell .mirk-checkbox__box {
529
+ position: relative; flex-shrink: 0; width: 22px; height: 22px;
530
+ display: flex; align-items: center; justify-content: center; border-radius: 0;
531
+ background: var(--mirk-bevel-bg);
532
+ border: 2px solid;
533
+ border-color: var(--mirk-bevel-tl) var(--mirk-bevel-br) var(--mirk-bevel-br) var(--mirk-bevel-tl);
534
+ }
535
+ .hcms-shell .mirk-checkbox__mark {
536
+ opacity: 0; display: block; width: 6px; height: 12px;
537
+ border-right: 2.5px solid var(--mirk-mark-fg); border-bottom: 2.5px solid var(--mirk-mark-fg);
538
+ rotate: 45deg; translate: 0.5px -1.5px;
539
+ }
540
+ .hcms-shell .mirk-checkbox__label { font-size: 18px; line-height: 1.5; }
541
+
542
+ .hcms-shell .mirk-checkbox:has(:checked) .mirk-checkbox__box { border-color: var(--mirk-input-border); }
543
+ .hcms-shell .mirk-checkbox:has(:checked) .mirk-checkbox__mark { opacity: 1; }
544
+ .hcms-shell .mirk-checkbox:has(:focus-visible) .mirk-checkbox__box {
545
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
546
+ }
547
+
548
+ .hcms-shell .mirk-checkbox--small { gap: 0.5rem; }
549
+ .hcms-shell .mirk-checkbox--small .mirk-checkbox__box { width: 18px; height: 18px; }
550
+ .hcms-shell .mirk-checkbox--small .mirk-checkbox__mark {
551
+ width: 5px; height: 10px;
552
+ border-right-width: 2px; border-bottom-width: 2px; translate: 0.5px -1px;
553
+ }
554
+ .hcms-shell .mirk-checkbox--small .mirk-checkbox__label { font-size: 14px; }
555
+
556
+ /* ============================ RADIO ============================ */
557
+ .hcms-shell .mirk-radio { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; width: fit-content; }
558
+ .hcms-shell .mirk-radio__ring {
559
+ position: relative; flex-shrink: 0; width: 25px; height: 25px; border-radius: 9999px;
560
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-br), var(--mirk-bevel-tl));
561
+ }
562
+ .hcms-shell .mirk-radio__fill {
563
+ display: block; position: absolute; inset: 2px; border-radius: 9999px;
564
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-bg), var(--mirk-pill-inner-top));
565
+ }
566
+ .hcms-shell .mirk-radio__dot {
567
+ display: none; position: absolute; top: 50%; left: 50%; translate: -50% -50%;
568
+ width: 9px; height: 9px; border-radius: 9999px; background: var(--mirk-mark-fg);
569
+ }
570
+ .hcms-shell .mirk-radio__label { font-size: 18px; line-height: 1.5; }
571
+
572
+ .hcms-shell .mirk-radio:has(:checked) .mirk-radio__ring {
573
+ background-image: none; background-color: var(--mirk-bevel-bg);
574
+ border: 2px solid var(--mirk-input-border);
575
+ }
576
+ .hcms-shell .mirk-radio:has(:checked) .mirk-radio__fill { display: none; }
577
+ .hcms-shell .mirk-radio:has(:checked) .mirk-radio__dot { display: block; }
578
+ .hcms-shell .mirk-radio:has(:focus-visible) .mirk-radio__ring {
579
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
580
+ }
581
+
582
+ .hcms-shell .mirk-radio--small { gap: 0.5rem; }
583
+ .hcms-shell .mirk-radio--small .mirk-radio__ring { width: 20px; height: 20px; }
584
+ .hcms-shell .mirk-radio--small .mirk-radio__dot { width: 7px; height: 7px; }
585
+ .hcms-shell .mirk-radio--small .mirk-radio__label { font-size: 14px; }
586
+
587
+ /* ============================ TOGGLE ============================ */
588
+ .hcms-shell .mirk-toggle { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; width: fit-content; }
589
+ .hcms-shell .mirk-toggle__track {
590
+ position: relative; flex-shrink: 0; width: 49px; height: 27px; border-radius: 0;
591
+ background: var(--mirk-canvas); /* own recessed channel, like the slider track \u2014 never the host page (0033) */
592
+ border: 1px solid var(--mirk-input-border);
593
+ }
594
+ .hcms-shell .mirk-toggle__thumb {
595
+ position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
596
+ background-color: var(--mirk-toggle-bg);
597
+ border: 2px solid;
598
+ border-color: var(--mirk-toggle-hi) var(--mirk-toggle-lo) var(--mirk-toggle-lo) var(--mirk-toggle-hi);
599
+ transition-property: transform, translate, scale, rotate;
600
+ transition-duration: 0.15s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
601
+ }
602
+ .hcms-shell .mirk-toggle__label { font-size: 18px; line-height: 1.5; }
603
+
604
+ .hcms-shell .mirk-toggle:has(:checked) .mirk-toggle__thumb { translate: 22px; }
605
+ .hcms-shell .mirk-toggle:has(:focus-visible) .mirk-toggle__track {
606
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
607
+ }
608
+
609
+ .hcms-shell .mirk-toggle--round .mirk-toggle__track { width: 50px; height: 29px; border-radius: 9999px; }
610
+ .hcms-shell .mirk-toggle--round .mirk-toggle__thumb {
611
+ width: 21px; height: 21px; border: none; border-radius: 9999px;
612
+ background-color: transparent;
613
+ background-image: linear-gradient(to top in oklab, var(--mirk-toggle-lo), var(--mirk-toggle-hi));
614
+ }
615
+ .hcms-shell .mirk-toggle--round .mirk-toggle__thumb::after {
616
+ content: ""; position: absolute; inset: 2px; border-radius: 9999px; background: var(--mirk-toggle-bg);
617
+ }
618
+ .hcms-shell .mirk-toggle--round:has(:checked) .mirk-toggle__thumb { translate: 21px; }
619
+
620
+ .hcms-shell .mirk-toggle--small { gap: 0.5rem; }
621
+ .hcms-shell .mirk-toggle--small .mirk-toggle__track { width: 42px; height: 23px; }
622
+ .hcms-shell .mirk-toggle--small .mirk-toggle__thumb { top: 2px; left: 2px; width: 17px; height: 17px; }
623
+ .hcms-shell .mirk-toggle--small:has(:checked) .mirk-toggle__thumb { translate: 19px; }
624
+ .hcms-shell .mirk-toggle--small .mirk-toggle__label { font-size: 14px; }
625
+ .hcms-shell .mirk-toggle--round.mirk-toggle--small .mirk-toggle__track { width: 43px; height: 25px; }
626
+ .hcms-shell .mirk-toggle--round.mirk-toggle--small .mirk-toggle__thumb { width: 19px; height: 19px; }
627
+ .hcms-shell .mirk-toggle--round.mirk-toggle--small:has(:checked) .mirk-toggle__thumb { translate: 18px; }
628
+
629
+ /* ============================ SLIDER ============================ */
630
+ .hcms-shell .mirk-slider { position: relative; height: 32px; width: 100%; --mirk-value: 0%; }
631
+ .hcms-shell .mirk-slider__input {
632
+ position: absolute; inset: 0; width: 100%; height: 100%;
633
+ opacity: 0; cursor: pointer; z-index: 10;
634
+ }
635
+ .hcms-shell .mirk-slider__track {
636
+ position: absolute; left: 0; right: 0; top: 50%; translate: 0 -50%; height: 12px;
637
+ background: var(--mirk-canvas); border: 1px solid var(--mirk-input-border); overflow: hidden;
638
+ }
639
+ .hcms-shell .mirk-slider__fill { height: 100%; width: var(--mirk-value); background: var(--mirk-slider-fill); }
640
+ .hcms-shell .mirk-slider__nub {
641
+ position: absolute; top: 50%; left: var(--mirk-value); translate: -50% -50%;
642
+ width: 21px; height: 21px; pointer-events: none;
643
+ background-color: var(--mirk-slider-nub-bg);
644
+ border: 2px solid;
645
+ border-color: var(--mirk-slider-nub-hi) var(--mirk-slider-nub-lo) var(--mirk-slider-nub-lo) var(--mirk-slider-nub-hi);
646
+ }
647
+ .hcms-shell .mirk-slider__input:focus-visible ~ .mirk-slider__nub {
648
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
649
+ }
650
+
651
+ .hcms-shell .mirk-slider--round .mirk-slider__track { height: 10px; border-radius: 9999px; }
652
+ .hcms-shell .mirk-slider--round .mirk-slider__nub {
653
+ width: 24px; height: 24px; border: none; border-radius: 9999px;
654
+ background-color: transparent;
655
+ background-image: linear-gradient(to top in oklab, var(--mirk-slider-nub-lo), var(--mirk-slider-nub-hi));
656
+ }
657
+ .hcms-shell .mirk-slider--round .mirk-slider__nub::after {
658
+ content: ""; position: absolute; inset: 2px; border-radius: 9999px; background: var(--mirk-slider-nub-bg);
659
+ }
660
+
661
+ .hcms-shell .mirk-slider--small { height: 24px; }
662
+ .hcms-shell .mirk-slider--small .mirk-slider__track { height: 8px; }
663
+ .hcms-shell .mirk-slider--small .mirk-slider__nub { width: 16px; height: 16px; }
664
+ .hcms-shell .mirk-slider--round.mirk-slider--small .mirk-slider__track { height: 7px; }
665
+ .hcms-shell .mirk-slider--round.mirk-slider--small .mirk-slider__nub { width: 18px; height: 18px; }
666
+
667
+ /* ============================ DATE ============================ */
668
+ .hcms-shell .mirk-date { position: relative; }
669
+ .hcms-shell .mirk-date__field {
670
+ width: 100%; background: var(--mirk-bevel-bg); color: var(--mirk-bevel-fg);
671
+ border: 1px solid var(--mirk-input-border);
672
+ padding: 6px 44px 9px 17px; font: inherit; font-size: 18px; line-height: 1.5;
673
+ border-radius: 0; outline: none;
674
+ }
675
+ .hcms-shell .mirk-date__field:focus-visible {
676
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
677
+ }
678
+ .hcms-shell .mirk-date__field::-webkit-calendar-picker-indicator {
679
+ opacity: 0; position: absolute; right: 0; top: 0; bottom: 0; width: 44px; margin: 0; cursor: pointer;
680
+ }
681
+ .hcms-shell .mirk-date__field::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; }
682
+ .hcms-shell .mirk-date__field::-webkit-clear-button { -webkit-appearance: none; appearance: none; }
683
+ .hcms-shell .mirk-date__icon {
684
+ pointer-events: none; position: absolute; right: 16px; top: 50%; translate: 0 -50%;
685
+ }
686
+ .hcms-shell .mirk-date--rounded .mirk-date__field { border-radius: var(--mirk-radius); }
687
+
688
+ .hcms-shell .mirk-date--small .mirk-date__field { padding: 4px 36px 4px 12px; font-size: 14px; }
689
+ .hcms-shell .mirk-date--small .mirk-date__field::-webkit-calendar-picker-indicator { width: 36px; }
690
+ .hcms-shell .mirk-date--small .mirk-date__icon { right: 12px; }
691
+
692
+ /* The native file/image inputs are visually hidden; their styled label drives
693
+ them, and the focus ring rides :has(:focus-visible) on button or container. */
694
+ .hcms-shell .mirk-file__input, .hcms-shell .mirk-image__input {
695
+ position: absolute; width: 1px; height: 1px;
696
+ padding: 0; margin: -1px; overflow: hidden;
697
+ clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
698
+ }
699
+
700
+ /* ============================ FILE ============================ */
701
+ .hcms-shell .mirk-file { display: flex; align-items: center; gap: 0.75rem; width: 100%; }
702
+ .hcms-shell .mirk-file__name {
703
+ color: var(--mirk-placeholder-color); font-size: 18px; line-height: 1.5;
704
+ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
705
+ }
706
+ .hcms-shell .mirk-file__name[data-filled] { color: var(--mirk-bevel-fg); }
707
+
708
+ /* Compact: a shared bordered container holds a smaller button + the name. */
709
+ .hcms-shell .mirk-file--compact {
710
+ padding: 4px 8px; background: var(--mirk-bevel-bg);
711
+ border: 1px solid var(--mirk-input-border); border-radius: 0;
712
+ }
713
+ .hcms-shell .mirk-file--compact:has(:focus-visible) {
714
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
715
+ }
716
+ /* The upload trigger is a .mirk-button; nudge it onto the container's left
717
+ border so the bevel sits flush (covers compact and round-compact). */
718
+ .hcms-shell .mirk-file--compact .mirk-button { margin-left: -1px; }
719
+ .hcms-shell .mirk-file--compact .mirk-file__name { font-size: 16px; }
720
+ .hcms-shell .mirk-file--compact.mirk-file--round { border-radius: 15px; }
721
+
722
+ /* Filled: the name slot becomes a link to the chosen file, beside a circular \xD7
723
+ to clear it: a 1px ring over a bevel fill that turns destructive on hover.
724
+ Empty keeps the placeholder span. */
725
+ .hcms-shell a.mirk-file__name { text-decoration: underline; text-underline-offset: 2px; }
726
+ .hcms-shell .mirk-file__remove {
727
+ appearance: none; -webkit-appearance: none; flex-shrink: 0;
728
+ width: 18px; height: 18px; border-radius: 50%;
729
+ display: inline-flex; align-items: center; justify-content: center;
730
+ margin: 0; padding: 0; cursor: pointer; line-height: 0;
731
+ color: var(--mirk-bevel-fg); background: var(--mirk-bevel-bg);
732
+ border: 1px solid var(--mirk-input-border);
733
+ }
734
+ .hcms-shell .mirk-file__remove svg { display: block; width: 66%; height: 66%; }
735
+ .hcms-shell .mirk-file__remove:hover { border-color: var(--mirk-destructive); color: var(--mirk-destructive); }
736
+
737
+ /* Small: tighter name + gap + remove \xD7; pair the trigger with mirk-button--small.
738
+ Composes with --compact (densest) and --round. */
739
+ .hcms-shell .mirk-file--small { gap: 0.5rem; }
740
+ .hcms-shell .mirk-file--small .mirk-file__name { font-size: 14px; }
741
+ .hcms-shell .mirk-file--small .mirk-file__remove { width: 16px; height: 16px; }
742
+ .hcms-shell .mirk-file--small.mirk-file--compact { padding: 3px 8px; }
743
+ .hcms-shell .mirk-file--small.mirk-file--compact .mirk-file__name { font-size: 13px; }
744
+
745
+ /* ============================ IMAGE ============================ */
746
+ .hcms-shell .mirk-image { display: flex; flex-direction: column; gap: 0.5rem; }
747
+ .hcms-shell .mirk-image__frame {
748
+ position: relative; width: 120px; height: 120px; overflow: hidden; border-radius: 0;
749
+ display: flex; align-items: center; justify-content: center;
750
+ background: var(--mirk-bevel-bg); border: 1px solid var(--mirk-input-border);
751
+ color: var(--mirk-placeholder-color); font-size: 14px; line-height: 1.5;
752
+ }
753
+ .hcms-shell .mirk-image__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
754
+ .hcms-shell .mirk-image--rounded .mirk-image__frame { border-radius: var(--mirk-radius); }
755
+ /* The upload trigger is a .mirk-button; keep it hugging its label instead of
756
+ stretching to fill this column-flex container. */
757
+ .hcms-shell .mirk-image .mirk-button { width: fit-content; }
758
+
759
+ /* Compact: a focused 56px thumbnail upload. Empty shows a small upload button;
760
+ once an image is chosen the button hides and a thumbnail + corner \xD7 takes its
761
+ place. The frame clips the image (overflow hidden) while the thumb wrapper
762
+ stays visible, so the \xD7 can sit just outside the corner without being cut. */
763
+ .hcms-shell .mirk-image--compact { flex-direction: row; align-items: center; gap: 0; }
764
+ .hcms-shell .mirk-image__thumb { position: relative; display: inline-block; width: fit-content; margin: 0; line-height: 0; }
765
+ .hcms-shell .mirk-image--compact .mirk-image__frame {
766
+ width: 56px; height: 56px; overflow: hidden; border-radius: 0;
767
+ border: 1px solid var(--mirk-input-border);
768
+ }
769
+ .hcms-shell .mirk-image--compact.mirk-image--rounded .mirk-image__frame { border-radius: var(--mirk-radius); }
770
+ .hcms-shell .mirk-image--compact .mirk-image__preview {
771
+ position: static; inset: auto; width: 100%; height: 100%; display: block; object-fit: cover;
772
+ }
773
+ .hcms-shell .mirk-image__remove {
774
+ position: absolute; top: -7px; right: -7px;
775
+ width: 18px; height: 18px; border-radius: 50%; padding: 0;
776
+ display: inline-flex; align-items: center; justify-content: center;
777
+ appearance: none; -webkit-appearance: none; cursor: pointer; line-height: 0;
778
+ color: var(--mirk-bevel-fg); background: var(--mirk-bevel-bg);
779
+ border: 1px solid var(--mirk-input-border);
780
+ }
781
+ .hcms-shell .mirk-image__remove svg { display: block; width: 10px; height: 10px; }
782
+ .hcms-shell .mirk-image__remove:hover { color: var(--mirk-destructive); border-color: var(--mirk-destructive); }
783
+
784
+ /* ============================ TAGS ============================ */
785
+ .hcms-shell .mirk-tags {
786
+ display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.5rem;
787
+ background: var(--mirk-bevel-bg); border: 1px solid var(--mirk-input-border);
788
+ border-radius: 0; cursor: text;
789
+ }
790
+ .hcms-shell .mirk-tags:has(:focus-visible) {
791
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
792
+ }
793
+ .hcms-shell .mirk-tags__chip {
794
+ display: inline-flex; align-items: center; gap: 0.5rem;
795
+ padding: 2px 8px 2px 12px; font-size: 14px; line-height: 1.5;
796
+ color: var(--mirk-bevel-fg); background: var(--mirk-bevel-bg);
797
+ border: 2px solid;
798
+ border-color: var(--mirk-bevel-tl) var(--mirk-bevel-br) var(--mirk-bevel-br) var(--mirk-bevel-tl);
799
+ }
800
+ .hcms-shell .mirk-tags__remove {
801
+ appearance: none; -webkit-appearance: none;
802
+ margin: 0; padding: 0; border: 0; background: none; color: inherit;
803
+ cursor: pointer; font-size: 14px; line-height: 1;
804
+ }
805
+ .hcms-shell .mirk-tags__remove:hover { color: var(--mirk-destructive); }
806
+ .hcms-shell .mirk-tags__input {
807
+ appearance: none; -webkit-appearance: none;
808
+ border: 0; padding: 0;
809
+ flex: 1; min-width: 120px; background: transparent; color: var(--mirk-bevel-fg);
810
+ outline: none; font-size: 18px; line-height: 1.5;
811
+ }
812
+ .hcms-shell .mirk-tags__input::placeholder { color: var(--mirk-placeholder-color); }
813
+
814
+ .hcms-shell .mirk-tags--round { border-radius: 15px; }
815
+ .hcms-shell .mirk-tags--round .mirk-tags__chip {
816
+ padding: 2px; border: none; border-radius: 12px;
817
+ background-color: transparent;
818
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-br), var(--mirk-bevel-tl));
819
+ }
820
+ .hcms-shell .mirk-tags__chip-inner {
821
+ display: inline-flex; align-items: center; gap: 0.5rem;
822
+ padding: 1px 8px 1px 12px; border-radius: 10px;
823
+ color: var(--mirk-bevel-fg); background-color: var(--mirk-bevel-bg);
824
+ background-image: linear-gradient(to top in oklab, var(--mirk-bevel-bg), var(--mirk-pill-inner-top));
825
+ }
826
+
827
+ .hcms-shell .mirk-tags--small { gap: 0.375rem; padding: 0.375rem; }
828
+ .hcms-shell .mirk-tags--small .mirk-tags__chip { padding: 1px 6px 1px 10px; font-size: 12px; }
829
+ .hcms-shell .mirk-tags--small .mirk-tags__remove { font-size: 12px; }
830
+ .hcms-shell .mirk-tags--small .mirk-tags__input { font-size: 14px; min-width: 90px; }
831
+ .hcms-shell .mirk-tags--small.mirk-tags--round { border-radius: 12px; }
832
+ .hcms-shell .mirk-tags--small.mirk-tags--round .mirk-tags__chip-inner { padding: 1px 6px 1px 10px; }
833
+
834
+ /* ============================ SORTABLE ============================ */
835
+ .hcms-shell .mirk-sortable { display: flex; flex-direction: column; gap: 0.5rem; }
836
+ .hcms-shell .mirk-sortable__item {
837
+ display: flex; flex-direction: row; width: 100%;
838
+ background: var(--mirk-bevel-bg); border: 1px solid var(--mirk-input-border);
839
+ }
840
+ .hcms-shell .mirk-sortable__grip {
841
+ width: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
842
+ cursor: grab; border-right: 1px solid var(--mirk-input-border);
843
+ }
844
+ .hcms-shell .mirk-sortable__grip:active { cursor: grabbing; }
845
+ .hcms-shell .mirk-sortable__dots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
846
+ .hcms-shell .mirk-sortable__dot {
847
+ display: block; width: 4px; height: 4px; background: var(--mirk-sortable-dot);
848
+ box-shadow: 1px 0 0 0 var(--mirk-sortable-shadow), 0 1px 0 0 var(--mirk-sortable-shadow), 1px 1px 0 0 var(--mirk-sortable-shadow);
849
+ }
850
+ .hcms-shell .mirk-sortable__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
851
+ .hcms-shell .mirk-sortable__row { padding: 8px 17px 9px; }
852
+ .hcms-shell .mirk-sortable__row:not(:last-child) { border-bottom: 1px solid var(--mirk-input-border); }
853
+ .hcms-shell .mirk-sortable__label {
854
+ display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
855
+ margin-bottom: 2px; color: var(--mirk-sortable-label);
856
+ }
857
+ .hcms-shell .mirk-sortable__field {
858
+ width: 100%; background: transparent; color: var(--mirk-bevel-fg);
859
+ font-size: 18px; line-height: 1.5; outline: none;
860
+ }
861
+ .hcms-shell .mirk-sortable__field::placeholder { color: var(--mirk-sortable-placeholder); }
862
+ .hcms-shell .mirk-sortable__field:focus-visible {
863
+ outline: 1px solid var(--mirk-focus-color); outline-offset: var(--mirk-focus-offset);
864
+ }
865
+ .hcms-shell .mirk-sortable--small { gap: 0.375rem; }
866
+ .hcms-shell .mirk-sortable--small .mirk-sortable__grip { width: 24px; }
867
+ .hcms-shell .mirk-sortable--small .mirk-sortable__row { padding: 5px 13px 6px; }
868
+ .hcms-shell .mirk-sortable--small .mirk-sortable__label { font-size: 10px; margin-bottom: 1px; }
869
+ .hcms-shell .mirk-sortable--small .mirk-sortable__field { font-size: 14px; }
870
+
871
+ /* ============================ CHIP ============================ */
872
+ /* A collapsible recovery/notification: a round pill that expands into a RAISED
873
+ panel \u2014 the kit's one elevated surface (a distinct --mirk-bg face, a hairline
874
+ outline, and a soft drop shadow, the only shadow in the kit, reserved for this
875
+ raised tier). State lives in classes (--open, is-changes) so it round-trips via
876
+ outerHTML; mirk.js only flips them on click. Color reads from generic kit
877
+ tokens through 5 slim --mirk-chip-* hooks, so it matches the kit and reskins by
878
+ overriding a hook, not a rule. In a Hyperclay app, add \`save-remove\` to the
879
+ block so a transient prompt never persists into the saved file. */
880
+ .hcms-shell .mirk-chip { display: inline-flex; flex-direction: column; align-items: flex-start; }
881
+ .hcms-shell .mirk-chip__panel { display: none; }
882
+ .hcms-shell .mirk-chip--open .mirk-chip__trigger { display: none; }
883
+ .hcms-shell .mirk-chip--open .mirk-chip__panel { display: flex; }
884
+
885
+ /* Collapsed chip \u2014 a round mirk-button pill (mirk-button--round in the markup),
886
+ the alert glyph seated in the label, so it reads as a distinct affordance, not
887
+ a flat button. A soft, tight lift sets it above the page; deeper on a dark
888
+ canvas (same media + forced-mode pattern as the panel shadow below). */
889
+ .hcms-shell .mirk-chip__trigger .mirk-button__label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
890
+ .hcms-shell .mirk-chip__trigger { box-shadow: 0 6px 14px -8px rgba(43, 36, 27, 0.5), 0 2px 5px -3px rgba(43, 36, 27, 0.32); }
891
+ @media (prefers-color-scheme: dark) { .hcms-shell .mirk-chip__trigger { box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.6), 0 2px 6px -3px rgba(0, 0, 0, 0.5); } }
892
+ .hcms-shell.light .mirk-chip__trigger, .hcms-shell[data-theme="light"] .mirk-chip__trigger { box-shadow: 0 6px 14px -8px rgba(43, 36, 27, 0.5), 0 2px 5px -3px rgba(43, 36, 27, 0.32); }
893
+ .hcms-shell.dark .mirk-chip__trigger, .hcms-shell[data-theme="dark"] .mirk-chip__trigger { box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.6), 0 2px 6px -3px rgba(0, 0, 0, 0.5); }
894
+ /* Drive the warning fill from CSS, not an SVG fill="var(...)" presentation
895
+ attribute (var() is not reliably honored there). */
896
+ .hcms-shell .mirk-chip__warn { fill: var(--mirk-chip-alert); }
897
+ .hcms-shell .mirk-chip__trigger .mirk-chip__warn { vertical-align: -2px; }
898
+
899
+ /* The panel \u2014 the raised surface: a --mirk-bg face over the page, a hairline
900
+ outline, a soft drop shadow. */
901
+ .hcms-shell .mirk-chip__panel {
902
+ width: 300px; max-width: calc(100vw - 44px);
903
+ background: var(--mirk-chip-surface); color: var(--mirk-fg);
904
+ border: 1px solid var(--mirk-chip-edge); border-radius: var(--mirk-radius);
905
+ box-shadow: 0 20px 50px -30px rgba(43, 36, 27, 0.6);
906
+ padding: 14px 15px 13px; flex-direction: column; gap: 12px;
907
+ }
908
+ /* The panel's larger drop (the collapsed pill above carries a tighter one); deepen
909
+ both on a dark canvas. Mirrors the --focus-offset pattern: a media default for
910
+ the OS, plus explicit forced-mode overrides. */
911
+ @media (prefers-color-scheme: dark) { .hcms-shell .mirk-chip__panel { box-shadow: 0 20px 52px -26px rgba(0, 0, 0, 0.78); } }
912
+ .hcms-shell.light .mirk-chip__panel, .hcms-shell[data-theme="light"] .mirk-chip__panel { box-shadow: 0 20px 50px -30px rgba(43, 36, 27, 0.6); }
913
+ .hcms-shell.dark .mirk-chip__panel, .hcms-shell[data-theme="dark"] .mirk-chip__panel { box-shadow: 0 20px 52px -26px rgba(0, 0, 0, 0.78); }
914
+
915
+ /* Head \u2014 icon, text, collapse glyph. */
916
+ .hcms-shell .mirk-chip__head { display: flex; gap: 10px; align-items: flex-start; }
917
+ .hcms-shell .mirk-chip__icon { flex-shrink: 0; line-height: 0; margin-top: 1px; }
918
+ .hcms-shell .mirk-chip__headtext { min-width: 0; }
919
+ .hcms-shell .mirk-chip__eyebrow {
920
+ font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.2em;
921
+ color: var(--mirk-placeholder-color); margin-bottom: 3px;
922
+ }
923
+ .hcms-shell .mirk-chip__title { margin: 0; font-size: 13px; font-weight: 400; line-height: 1.3; color: var(--mirk-fg); }
924
+ .hcms-shell .mirk-chip__collapse {
925
+ margin-left: auto; flex-shrink: 0; width: 24px; height: 24px;
926
+ display: inline-flex; align-items: center; justify-content: center;
927
+ background: none; border: 0; cursor: pointer; padding: 0;
928
+ color: var(--mirk-placeholder-color);
929
+ }
930
+ .hcms-shell .mirk-chip__collapse:hover { color: var(--mirk-fg); }
931
+ .hcms-shell .mirk-chip__collapse svg { display: block; }
932
+
933
+ /* Meta line. */
934
+ .hcms-shell .mirk-chip__meta { font-size: 11px; letter-spacing: 0.04em; color: var(--mirk-placeholder-color); }
935
+ .hcms-shell .mirk-chip__changes-toggle {
936
+ background: none; border: 0; cursor: pointer; font: inherit; font-size: 11px; padding: 0 0 0 4px;
937
+ color: var(--mirk-placeholder-color); text-decoration: underline; text-underline-offset: 2px;
938
+ }
939
+ .hcms-shell .mirk-chip__changes-toggle:hover { color: var(--mirk-fg); }
940
+
941
+ /* Before/after field table \u2014 a recessed stack, revealed by the changes toggle. */
942
+ .hcms-shell .mirk-chip__preview {
943
+ display: none; flex-direction: column; gap: 11px;
944
+ background: var(--mirk-bevel-bg); border: 1px solid var(--mirk-chip-edge);
945
+ padding: 10px 11px;
946
+ }
947
+ .hcms-shell .mirk-chip__panel.is-changes .mirk-chip__preview { display: flex; }
948
+ .hcms-shell .mirk-chip__row { display: flex; flex-direction: column; gap: 2px; }
949
+ .hcms-shell .mirk-chip__key {
950
+ font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em;
951
+ color: var(--mirk-placeholder-color);
952
+ }
953
+ .hcms-shell .mirk-chip__old, .hcms-shell .mirk-chip__new { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
954
+ .hcms-shell .mirk-chip__old { font-size: 11px; color: var(--mirk-chip-alert); text-decoration: line-through; opacity: 0.85; }
955
+ .hcms-shell .mirk-chip__new { font-size: 12px; color: var(--mirk-fg); }
956
+
957
+ /* Action stack \u2014 full-width buttons by weight: an embossed primary, a plain bevel
958
+ revert, a quiet (--quiet) dismiss. */
959
+ .hcms-shell .mirk-chip__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 1px; }
960
+ .hcms-shell .mirk-chip__actions .mirk-button { width: 100%; }
961
+ /* Primary action \u2014 a genuine kit bevel button whose bevel palette is derived from
962
+ the chip's primary fill (lighter top-left, darker bottom-right), so it embosses
963
+ on any color. The base .mirk-button rules then drive its border, hover, and the
964
+ :active flip, identical to the kit's other buttons. */
965
+ .hcms-shell .mirk-chip__actions .mirk-chip__action--primary {
966
+ --mirk-bevel-bg: var(--mirk-chip-primary-bg);
967
+ --mirk-bevel-fg: var(--mirk-chip-primary-fg);
968
+ --mirk-bevel-tl: color-mix(in srgb, var(--mirk-chip-primary-bg), white 24%);
969
+ --mirk-bevel-br: color-mix(in srgb, var(--mirk-chip-primary-bg), black 32%);
970
+ --mirk-bevel-hover-bg: color-mix(in srgb, var(--mirk-chip-primary-bg), white 10%);
971
+ }
972
+
973
+ /* ============================ FIELD ============================ */
974
+ /* Label + control + hint as one unit, so a form composes without utilities
975
+ (and without needing the mirk-page rhythm). Any control drops in; the gap
976
+ matches the page scaffold's label/hint hug. Consecutive fields space
977
+ themselves. */
978
+ .hcms-shell .mirk-field { display: flex; flex-direction: column; gap: 6px; }
979
+ .hcms-shell .mirk-field__label { font-size: 16px; line-height: 1.5; }
980
+ .hcms-shell .mirk-field + .mirk-field { margin-block-start: 18px; }
981
+ .hcms-shell .mirk-field--small .mirk-field__label { font-size: 14px; }
982
+
983
+ /* An alert hint inside a field stays hidden until a control in the field
984
+ goes :user-invalid \u2014 a zero-JS native-validation message. Show one
985
+ unconditionally (a server-side error) by placing it outside the field or
986
+ overriding display. */
987
+ .hcms-shell .mirk-field .mirk-hint--alert { display: none; }
988
+ .hcms-shell .mirk-field:has(:user-invalid) .mirk-hint--alert { display: block; }
989
+
990
+ /* ============================ INVALID ============================ */
991
+ /* Native constraint validation, styled. :user-invalid fires only after the
992
+ user interacts (unlike :invalid, which would paint required fields red on
993
+ load). A flat destructive border is the 0012 stateful read; the focus ring
994
+ stays the focus signal. Pair the message with mirk-hint--alert. */
995
+ .hcms-shell .mirk-input:user-invalid, .hcms-shell .mirk-textarea:user-invalid, .hcms-shell .mirk-date__field:user-invalid, .hcms-shell .mirk-select__field:user-invalid, .hcms-shell .mirk-number:has(.mirk-number__input:user-invalid) {
996
+ border-color: var(--mirk-destructive);
997
+ }
998
+ .hcms-shell .mirk-checkbox:has(:user-invalid) .mirk-checkbox__box, .hcms-shell .mirk-toggle:has(:user-invalid) .mirk-toggle__track {
999
+ border-color: var(--mirk-destructive);
1000
+ }
1001
+ /* The unchecked ring is a borderless gradient pill; invalid swaps it for a
1002
+ flat destructive ring (the fill pill still seats inside). */
1003
+ .hcms-shell .mirk-radio:has(:user-invalid) .mirk-radio__ring {
1004
+ background-image: none;
1005
+ border: 2px solid var(--mirk-destructive);
1006
+ }
1007
+
1008
+ /* ============================ PROGRESS ============================ */
1009
+ /* A native <progress> in the slider's clothes: the canvas channel, the
1010
+ slider-fill value bar. --blocks segments the fill into pixel blocks.
1011
+ Keep the -webkit and -moz rules separate \u2014 an unrecognized pseudo-element
1012
+ invalidates the whole selector list. */
1013
+ .hcms-shell .mirk-progress {
1014
+ appearance: none; -webkit-appearance: none;
1015
+ display: block; width: 100%; height: 12px;
1016
+ border: 1px solid var(--mirk-input-border);
1017
+ background: var(--mirk-canvas);
1018
+ }
1019
+ .hcms-shell .mirk-progress::-webkit-progress-bar { background: transparent; }
1020
+ .hcms-shell .mirk-progress::-webkit-progress-value { background: var(--mirk-slider-fill); }
1021
+ .hcms-shell .mirk-progress::-moz-progress-bar { background: var(--mirk-slider-fill); }
1022
+ .hcms-shell .mirk-progress--small { height: 8px; }
1023
+ .hcms-shell .mirk-progress--round { border-radius: 9999px; overflow: hidden; }
1024
+ .hcms-shell .mirk-progress--blocks::-webkit-progress-value {
1025
+ background: repeating-linear-gradient(to right,
1026
+ var(--mirk-slider-fill) 0 8px, transparent 8px 11px);
1027
+ }
1028
+ .hcms-shell .mirk-progress--blocks::-moz-progress-bar {
1029
+ background: repeating-linear-gradient(to right,
1030
+ var(--mirk-slider-fill) 0 8px, transparent 8px 11px);
1031
+ }
1032
+
1033
+ /* ============================ NOTE ============================ */
1034
+ /* An informational callout. Flat on purpose: bevel means pressable in this
1035
+ kit (0012) and a note is content, so it gets the 1px content border over
1036
+ the recessed face, never the raised edge. The 4px left edge carries the
1037
+ status: neutral ink by default, destructive on --alert. */
1038
+ .hcms-shell .mirk-note {
1039
+ display: flex; flex-direction: column; gap: 4px;
1040
+ background: var(--mirk-bevel-bg);
1041
+ border: 1px solid var(--mirk-input-border);
1042
+ border-left: 4px solid var(--mirk-mark-fg);
1043
+ padding: 10px 14px 11px;
1044
+ font-size: 14px; line-height: 1.5;
1045
+ }
1046
+ .hcms-shell .mirk-note__title {
1047
+ font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
1048
+ color: var(--mirk-mark-fg);
1049
+ }
1050
+ .hcms-shell .mirk-note__body { color: var(--mirk-fg); }
1051
+ .hcms-shell .mirk-note--alert { border-left-color: var(--mirk-destructive); }
1052
+ .hcms-shell .mirk-note--alert .mirk-note__title { color: var(--mirk-destructive); }
1053
+ .hcms-shell .mirk-note--rounded { border-radius: var(--mirk-radius); }
1054
+
1055
+ /* ============================ HINT ============================ */
1056
+ /* Small print under a field: neutral help text, or --alert validation text. */
1057
+ .hcms-shell .mirk-hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--mirk-placeholder-color); }
1058
+ .hcms-shell .mirk-hint--alert { color: var(--mirk-destructive); }
1059
+
1060
+ /* ============================ LIST ============================ */
1061
+ /* Content bullets. <ul> gets a square pixel dot (the sortable dot's idiom,
1062
+ one step larger); a nested <ul> hollows it. <ol> gets zero-padded counters
1063
+ in the muted label ink. Styles the bare <li> by descent, like the platform. */
1064
+ .hcms-shell .mirk-list {
1065
+ list-style: none; margin: 0; padding: 0;
1066
+ display: flex; flex-direction: column; gap: 6px;
1067
+ font-size: 16px; line-height: 1.5;
1068
+ }
1069
+ .hcms-shell .mirk-list li { position: relative; padding-left: 22px; }
1070
+ .hcms-shell ul.mirk-list > li::before {
1071
+ content: ""; position: absolute; left: 2px; top: 0.55em;
1072
+ width: 6px; height: 6px; background: var(--mirk-mark-fg);
1073
+ box-shadow: 1px 1px 0 0 var(--mirk-sortable-shadow);
1074
+ }
1075
+ .hcms-shell ol.mirk-list { counter-reset: mirk-li; }
1076
+ .hcms-shell ol.mirk-list > li { counter-increment: mirk-li; padding-left: 38px; }
1077
+ .hcms-shell ol.mirk-list > li::before {
1078
+ content: counter(mirk-li, decimal-leading-zero) ".";
1079
+ position: absolute; left: 0; top: 0;
1080
+ color: var(--mirk-sortable-label);
1081
+ }
1082
+
1083
+ /* One nested level: hollow square, same stack. */
1084
+ .hcms-shell .mirk-list ul {
1085
+ list-style: none; margin: 6px 0 0; padding: 0;
1086
+ display: flex; flex-direction: column; gap: 6px;
1087
+ }
1088
+ .hcms-shell .mirk-list ul > li::before {
1089
+ content: ""; position: absolute; left: 2px; top: 0.55em;
1090
+ width: 6px; height: 6px; background: transparent;
1091
+ border: 1.5px solid var(--mirk-mark-fg); box-shadow: none;
1092
+ }
1093
+
1094
+ .hcms-shell .mirk-list--small { font-size: 14px; gap: 4px; }
1095
+ .hcms-shell .mirk-list--small li { padding-left: 18px; }
1096
+ .hcms-shell ul.mirk-list--small > li::before, .hcms-shell .mirk-list--small ul > li::before { width: 5px; height: 5px; }
1097
+ .hcms-shell ol.mirk-list--small > li { padding-left: 32px; }
1098
+
1099
+ /* ============================ BADGE ============================ */
1100
+ /* A static tag label \u2014 the display counterpart to the mirk-tags input. Flat
1101
+ on purpose: bevel means pressable (0012), a badge is content. */
1102
+ .hcms-shell .mirk-badge {
1103
+ display: inline-flex; align-items: center; gap: 0.375rem;
1104
+ padding: 1px 8px 2px; font-size: 12px; line-height: 1.5;
1105
+ color: var(--mirk-fg); background: var(--mirk-bevel-bg);
1106
+ border: 1px solid var(--mirk-input-border);
1107
+ white-space: nowrap; vertical-align: middle;
1108
+ }
1109
+ .hcms-shell .mirk-badge--accent { background: var(--mirk-accent); }
1110
+ .hcms-shell .mirk-badge--round { border-radius: 9999px; padding: 1px 10px 2px; }
1111
+ .hcms-shell .mirk-badge--alert { color: var(--mirk-destructive); border-color: var(--mirk-destructive); }
1112
+
1113
+ /* ============================ TABLE ============================ */
1114
+ /* A flat data surface: the content face in a 1px frame, header cells in the
1115
+ eyebrow register, hairline row dividers. Semantic <table> styled by
1116
+ descent \u2014 no per-cell classes. The header/stripe tints ride color-mix
1117
+ toward the ink so they stay visible in every palette (Pixel Quiet's
1118
+ canvas and face are nearly the same value). Wrap in an overflow-x:auto
1119
+ div when the table can outgrow its column. */
1120
+ .hcms-shell .mirk-table {
1121
+ width: 100%; border-collapse: collapse;
1122
+ background: var(--mirk-bevel-bg);
1123
+ border: 1px solid var(--mirk-input-border);
1124
+ font-size: 14px; line-height: 1.5;
1125
+ }
1126
+ .hcms-shell .mirk-table th {
1127
+ text-align: left; font-weight: 400;
1128
+ font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em;
1129
+ color: var(--mirk-placeholder-color);
1130
+ background: color-mix(in srgb, var(--mirk-bevel-bg), var(--mirk-fg) 4%);
1131
+ padding: 7px 14px;
1132
+ border-bottom: 1px solid var(--mirk-input-border);
1133
+ }
1134
+ .hcms-shell .mirk-table td {
1135
+ padding: 8px 14px;
1136
+ border-bottom: 1px solid var(--mirk-input-border);
1137
+ vertical-align: top;
1138
+ }
1139
+ .hcms-shell .mirk-table tbody tr:last-child td { border-bottom: 0; }
1140
+ .hcms-shell .mirk-table--striped tbody tr:nth-child(even) td {
1141
+ background: color-mix(in srgb, var(--mirk-bevel-bg), var(--mirk-fg) 3%);
1142
+ }
1143
+ .hcms-shell .mirk-table--small { font-size: 13px; }
1144
+ .hcms-shell .mirk-table--small th { padding: 5px 12px; font-size: 10px; }
1145
+ .hcms-shell .mirk-table--small td { padding: 5px 12px; }
1146
+
1147
+ /* ============================ PAGE ============================ */
1148
+ /* The quickstart shell: mirk-page on <body> (or any wrapper) gives a centered
1149
+ column + typographic defaults, so two CDN tags and one class boot a full
1150
+ page. Every rule rides :where() (zero specificity): any utility, component
1151
+ class, or consumer rule beats it. Flow rhythm targets direct children only,
1152
+ so margins never leak inside component internals. */
1153
+ .hcms-shell .mirk-page { max-width: 640px; margin-inline: auto; padding: 48px 24px 96px; }
1154
+ .hcms-shell .mirk-page--wide { max-width: 960px; }
1155
+
1156
+ /* Departure Mono ships one weight \u2014 hierarchy comes from size, never bold. */
1157
+ .hcms-shell .mirk-page :where(h1, h2, h3, h4) { margin: 0; font-weight: 400; line-height: 1.15; }
1158
+ .hcms-shell .mirk-page :where(h1) { font-size: 40px; }
1159
+ .hcms-shell .mirk-page :where(h2) { font-size: 26px; }
1160
+ .hcms-shell .mirk-page :where(h3) { font-size: 20px; }
1161
+ .hcms-shell .mirk-page :where(h4) { font-size: 16px; }
1162
+ .hcms-shell .mirk-page :where(p) { margin: 0; font-size: 16px; line-height: 1.6; }
1163
+
1164
+ .hcms-shell .mirk-page :where(a) { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
1165
+ .hcms-shell .mirk-page :where(code, kbd) {
1166
+ font-size: 0.875em; padding: 1px 4px;
1167
+ background: var(--mirk-bevel-bg); border: 1px solid var(--mirk-input-border);
1168
+ }
1169
+ .hcms-shell .mirk-page :where(pre) {
1170
+ margin: 0; padding: 12px 14px; font-size: 13px; line-height: 1.5; overflow-x: auto;
1171
+ background: var(--mirk-bevel-bg); border: 1px solid var(--mirk-input-border);
1172
+ }
1173
+ .hcms-shell .mirk-page :where(pre code) { padding: 0; border: 0; background: none; font-size: inherit; }
1174
+ .hcms-shell .mirk-page :where(hr) { border: 0; border-top: 1px solid var(--mirk-input-border); }
1175
+
1176
+ /* Flow rhythm \u2014 direct children only; headings open sections, eyebrows and
1177
+ hints hug their neighbors. Equal specificity, so source order settles ties. */
1178
+ .hcms-shell .mirk-page > :where(* + *) { margin-block-start: 14px; }
1179
+ .hcms-shell .mirk-page > :where(h1, h2, h3, h4):where(* + *) { margin-block-start: 40px; }
1180
+ .hcms-shell .mirk-page > :where(.mirk-eyebrow + *), .hcms-shell .mirk-page > :where(* + .mirk-hint) { margin-block-start: 6px; }
1181
+
1182
+ /* ============================ EYEBROW ============================ */
1183
+ /* The kit's signature section label, as a shippable class. Block so it works
1184
+ the same on <p>, <label>, or <div>, and flow margins always apply. */
1185
+ .hcms-shell .mirk-eyebrow {
1186
+ display: block; margin: 0;
1187
+ font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
1188
+ color: var(--mirk-placeholder-color);
1189
+ }
1190
+ }
1191
+
1192
+ /* Respect the machine \u2014 outside @layer components so it always wins. */
1193
+ @media (prefers-reduced-motion: reduce) {
1194
+ .hcms-shell .mirk-button--round, .hcms-shell .mirk-toggle__thumb { transition: none; }
1195
+ .hcms-shell .mirk-button:active .mirk-button__label { translate: none; }
1196
+ }
1197
+ @media (forced-colors: active) {
1198
+ .hcms-shell .mirk-button, .hcms-shell .mirk-select__field, .hcms-shell .mirk-checkbox__box, .hcms-shell .mirk-toggle__track { border: 1px solid ButtonText; }
1199
+ }
1200
+
1201
+ /* ===== pixel-quiet overrides (hypercms-owned) ===== */
1202
+ /* =====================================================================
1203
+ Pixel Quiet \u2014 hypercms theme overrides (hypercms-owned).
1204
+
1205
+ Adapted from cms-sidebar/pixel-quiet/overrides.css. Two jobs:
1206
+ 1. Retune --mirk-* tokens, scoped to .hcms-shell.pixel-quiet (never :root).
1207
+ 2. Author the panel geometry + the functional chrome the static mockup
1208
+ doesn't have (error banner, add/remove/move controls, the engine's
1209
+ sortable cards, push / overlay / left-dock modes) on top of the
1210
+ .hcms-* structural hooks.
1211
+
1212
+ This file is concatenated AFTER the scoped mirk base+components by
1213
+ scripts/build-theme.js, so plain rules here win over mirk's @layer
1214
+ components with zero !important. Loaded only inside .hcms-shell, so nothing
1215
+ here leaks onto the host page.
1216
+ ===================================================================== */
1217
+
1218
+ /* ============================================================
1219
+ TOKEN RETUNE \u2014 LIGHT (warm cream, gentle near-equal bevel)
1220
+ ============================================================ */
1221
+ .hcms-shell.pixel-quiet {
1222
+ color-scheme: light;
1223
+ --mirk-canvas: #F7F2EA;
1224
+ --mirk-bg: #F7F2EA;
1225
+ --mirk-fg: #2B241B;
1226
+ --mirk-accent: #efefe5;
1227
+ --mirk-destructive: #C24A3A;
1228
+ --mirk-focus-color: #C7AE93;
1229
+
1230
+ --mirk-bevel-bg: #FCF8F1;
1231
+ --mirk-bevel-fg: #2B241B;
1232
+ --mirk-bevel-tl: #F0E7D8;
1233
+ --mirk-bevel-br: #E2D4BF;
1234
+ --mirk-bevel-hover-bg: #F4ECDF;
1235
+ --mirk-pill-inner-top: #FBF6EE;
1236
+ --mirk-input-border: #D8C8AF;
1237
+ --mirk-placeholder-color: #A8987F;
1238
+
1239
+ --mirk-mark-fg: #6B5942;
1240
+ --mirk-toggle-bg: #EFDBBD;
1241
+ --mirk-toggle-hi: #F4EADA;
1242
+ --mirk-toggle-lo: #C2A87E;
1243
+ --mirk-sortable-dot: #DDCBB0;
1244
+ --mirk-sortable-shadow: #C9B493;
1245
+ --mirk-sortable-label: #8C7B62;
1246
+ --mirk-sortable-placeholder: #A8987F;
1247
+
1248
+ --mirk-radius: 5px;
1249
+ --mirk-focus-offset: 2px;
1250
+ }
1251
+
1252
+ /* dark token deltas, shared by the explicit .dark opt-in and OS preference */
1253
+ .hcms-shell.pixel-quiet.dark,
1254
+ .hcms-shell.pixel-quiet[data-theme="dark"] {
1255
+ color-scheme: dark;
1256
+ --mirk-canvas: #0B0C13;
1257
+ --mirk-bg: #11131E;
1258
+ --mirk-fg: #ECEAF2;
1259
+ --mirk-accent: #1D1F2F;
1260
+ --mirk-focus-color: #4A506B;
1261
+
1262
+ --mirk-bevel-bg: #1A1D2C;
1263
+ --mirk-bevel-fg: #ECEAF2;
1264
+ --mirk-bevel-tl: #2A2E42;
1265
+ --mirk-bevel-br: #14182A;
1266
+ --mirk-bevel-hover-bg: #202436;
1267
+ --mirk-pill-inner-top: #202436;
1268
+ --mirk-input-border: #353B52;
1269
+ --mirk-placeholder-color: #6A7090;
1270
+
1271
+ --mirk-mark-fg: #C9CDE0;
1272
+ --mirk-toggle-bg: #3E4660;
1273
+ --mirk-toggle-hi: #4E567A;
1274
+ --mirk-toggle-lo: #262B42;
1275
+ --mirk-sortable-dot: #353B52;
1276
+ --mirk-sortable-shadow: #0E1120;
1277
+ --mirk-sortable-label: #8A90AB;
1278
+ --mirk-sortable-placeholder: #6A7090;
1279
+ }
1280
+
1281
+ /* Auto-dark on OS preference, unless the shell pins light with .light */
1282
+ @media (prefers-color-scheme: dark) {
1283
+ .hcms-shell.pixel-quiet:not(.light):not([data-theme="light"]) {
1284
+ color-scheme: dark;
1285
+ --mirk-canvas: #0B0C13;
1286
+ --mirk-bg: #11131E;
1287
+ --mirk-fg: #ECEAF2;
1288
+ --mirk-accent: #1D1F2F;
1289
+ --mirk-focus-color: #4A506B;
1290
+
1291
+ --mirk-bevel-bg: #1A1D2C;
1292
+ --mirk-bevel-fg: #ECEAF2;
1293
+ --mirk-bevel-tl: #2A2E42;
1294
+ --mirk-bevel-br: #14182A;
1295
+ --mirk-bevel-hover-bg: #202436;
1296
+ --mirk-pill-inner-top: #202436;
1297
+ --mirk-input-border: #353B52;
1298
+ --mirk-placeholder-color: #6A7090;
1299
+
1300
+ --mirk-mark-fg: #C9CDE0;
1301
+ --mirk-toggle-bg: #3E4660;
1302
+ --mirk-toggle-hi: #4E567A;
1303
+ --mirk-toggle-lo: #262B42;
1304
+ --mirk-sortable-dot: #353B52;
1305
+ --mirk-sortable-shadow: #0E1120;
1306
+ --mirk-sortable-label: #8A90AB;
1307
+ --mirk-sortable-placeholder: #6A7090;
1308
+ }
1309
+ }
1310
+
1311
+ /* ============================================================
1312
+ SHELL GEOMETRY \u2014 fixed, docked panel, single column.
1313
+ position: fixed makes the shell a containing block so the absolute
1314
+ minibar anchors to it; flex column so the body owns the scroll.
1315
+ ============================================================ */
1316
+ .hcms-shell.pixel-quiet {
1317
+ box-sizing: border-box;
1318
+ position: fixed;
1319
+ top: 0;
1320
+ right: 0;
1321
+ bottom: 0;
1322
+ width: 380px;
1323
+ max-width: 100vw;
1324
+ z-index: 2147483000;
1325
+ display: flex;
1326
+ flex-direction: column;
1327
+ color: var(--mirk-fg);
1328
+ background: var(--mirk-bg);
1329
+ border-left: 1px solid var(--mirk-input-border);
1330
+ box-shadow: -16px 0 48px -28px rgba(43, 36, 27, 0.45);
1331
+ }
1332
+ .hcms-shell.pixel-quiet.dark {
1333
+ box-shadow: -16px 0 48px -28px rgba(0, 0, 0, 0.6);
1334
+ }
1335
+
1336
+ .hcms-shell.pixel-quiet.hcms-side-left {
1337
+ right: auto;
1338
+ left: 0;
1339
+ border-left: 0;
1340
+ border-right: 1px solid var(--mirk-input-border);
1341
+ box-shadow: 16px 0 48px -28px rgba(43, 36, 27, 0.45);
1342
+ }
1343
+
1344
+ /* Push the page over so docked content is never hidden underneath. */
1345
+ body.hcms-open:not(.hcms-overlay) { padding-right: 380px; }
1346
+ body.hcms-open.hcms-side-left:not(.hcms-overlay) { padding-right: 0; padding-left: 380px; }
1347
+ body.hcms-open.hcms-overlay { overflow: hidden; }
1348
+
1349
+ @media (max-width: 799px) {
1350
+ .hcms-shell.pixel-quiet { width: 100vw; }
1351
+ body.hcms-open:not(.hcms-overlay),
1352
+ body.hcms-open.hcms-side-left:not(.hcms-overlay) { padding-right: 0; padding-left: 0; }
1353
+ body.hcms-open { overflow: hidden; }
1354
+ }
1355
+
1356
+ /* ---------- SCROLL REGION \u2014 holds the (scrollable) header + form + save ---------- */
1357
+ .hcms-shell-body {
1358
+ flex: 1;
1359
+ min-height: 0;
1360
+ overflow-y: auto;
1361
+ }
1362
+
1363
+ /* ---------- CONDENSED MINIBAR \u2014 appears once the full header scrolls away ---------- */
1364
+ .hcms-shell-minibar {
1365
+ position: absolute;
1366
+ top: 0;
1367
+ left: 0;
1368
+ right: 0;
1369
+ z-index: 2;
1370
+ display: flex;
1371
+ align-items: center;
1372
+ justify-content: space-between;
1373
+ gap: 12px;
1374
+ padding: 9px 24px 10px;
1375
+ background: var(--mirk-bg);
1376
+ border-bottom: 1px solid var(--mirk-input-border);
1377
+ opacity: 0;
1378
+ transform: translateY(-100%);
1379
+ pointer-events: none;
1380
+ transition: opacity 140ms ease, transform 160ms ease;
1381
+ }
1382
+ .hcms-shell.is-condensed .hcms-shell-minibar {
1383
+ opacity: 1;
1384
+ transform: none;
1385
+ pointer-events: auto;
1386
+ }
1387
+ .hcms-shell-minibar-title {
1388
+ font-size: 14px;
1389
+ line-height: 1;
1390
+ color: var(--mirk-fg);
1391
+ white-space: nowrap;
1392
+ overflow: hidden;
1393
+ text-overflow: ellipsis;
1394
+ }
1395
+
1396
+ /* ---------- HEADER (no underline rule \u2014 whitespace separates the bands) ---------- */
1397
+ .hcms-shell-header {
1398
+ flex-shrink: 0;
1399
+ display: flex;
1400
+ align-items: flex-start;
1401
+ justify-content: space-between;
1402
+ gap: 12px;
1403
+ padding: 24px 24px 4px;
1404
+ }
1405
+ .hcms-shell-heading { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
1406
+ .hcms-shell-eyebrow {
1407
+ font-size: 11px;
1408
+ text-transform: uppercase;
1409
+ letter-spacing: 0.18em;
1410
+ color: var(--mirk-placeholder-color);
1411
+ }
1412
+ .hcms-shell-title {
1413
+ margin: 0;
1414
+ font-size: 18px;
1415
+ font-weight: 400;
1416
+ line-height: 1.2;
1417
+ color: var(--mirk-fg);
1418
+ }
1419
+ .hcms-shell-close.mirk-button {
1420
+ flex-shrink: 0;
1421
+ padding: 2px 9px 3px;
1422
+ line-height: 1;
1423
+ }
1424
+ .hcms-shell-close .mirk-button__label { font-size: 16px; }
1425
+
1426
+ /* ---------- FORM \u2014 generous, even vertical rhythm ---------- */
1427
+ .hcms-form {
1428
+ display: flex;
1429
+ flex-direction: column;
1430
+ gap: 26px;
1431
+ padding: 12px 24px 28px;
1432
+ }
1433
+
1434
+ /* one labeled scalar field */
1435
+ .hcms-field { display: flex; flex-direction: column; gap: 9px; }
1436
+ .hcms-field--row {
1437
+ flex-direction: row;
1438
+ align-items: center;
1439
+ justify-content: space-between;
1440
+ }
1441
+
1442
+ /* themed field label */
1443
+ .hcms-label {
1444
+ font-size: 11px;
1445
+ text-transform: uppercase;
1446
+ letter-spacing: 0.14em;
1447
+ color: var(--mirk-sortable-label);
1448
+ }
1449
+
1450
+ /* comfortable control padding + readable size, in mirk's own mono */
1451
+ .hcms-shell.pixel-quiet .mirk-input,
1452
+ .hcms-shell.pixel-quiet .mirk-textarea {
1453
+ font-size: 15px;
1454
+ padding: 9px 14px 10px;
1455
+ }
1456
+ .hcms-shell.pixel-quiet textarea.mirk-input { min-height: 76px; resize: vertical; }
1457
+
1458
+ /* default scalar fields: one-row textareas that grow with their content.
1459
+ Browsers without field-sizing get a scrollHeight fallback (enhance.js). */
1460
+ .hcms-shell.pixel-quiet .hcms-form textarea.mirk-textarea {
1461
+ field-sizing: content;
1462
+ resize: none;
1463
+ overflow: hidden;
1464
+ min-height: 0;
1465
+ }
1466
+
1467
+ /* rich-text surface (@richtext): a contenteditable styled like a textarea */
1468
+ .hcms-shell.pixel-quiet .hcms-richtext {
1469
+ min-height: 2.5em;
1470
+ cursor: text;
1471
+ overflow-wrap: break-word;
1472
+ }
1473
+ .hcms-shell.pixel-quiet .hcms-richtext a {
1474
+ color: inherit;
1475
+ text-decoration: underline;
1476
+ text-underline-offset: 2px;
1477
+ }
1478
+ .hcms-shell.pixel-quiet .hcms-richtext:empty::before {
1479
+ content: attr(data-hcms-placeholder);
1480
+ color: var(--mirk-placeholder-color);
1481
+ }
1482
+ .hcms-shell.pixel-quiet .mirk-select__field {
1483
+ font-size: 15px;
1484
+ padding: 8px 40px 9px 14px;
1485
+ }
1486
+ .hcms-shell.pixel-quiet .mirk-radio__label,
1487
+ .hcms-shell.pixel-quiet .mirk-toggle__label,
1488
+ .hcms-shell.pixel-quiet .mirk-tags__input { font-size: 15px; }
1489
+
1490
+ /* inline radio row */
1491
+ .hcms-radio-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
1492
+
1493
+ /* chip-field (the @chips built-in): a borderless inline input that sizes to its
1494
+ text, so chips read like static chips but stay inline-editable. */
1495
+ .hcms-shell .mirk-tags__chip { padding-right: 6px; }
1496
+ .hcms-shell .hcms-chip-field {
1497
+ border: 0; background: transparent; color: inherit; font: inherit;
1498
+ outline: none; min-width: 2ch; field-sizing: content; padding: 0;
1499
+ }
1500
+ .hcms-shell .hcms-chips .hcms-add { margin-top: 4px; align-self: flex-start; }
1501
+
1502
+ /* ---------- OBJECT GROUP \u2014 a quiet framed band, not a heavy card ---------- */
1503
+ .hcms-object {
1504
+ display: flex;
1505
+ flex-direction: column;
1506
+ gap: 16px;
1507
+ }
1508
+ .hcms-object-title {
1509
+ margin: 0;
1510
+ font-size: 11px;
1511
+ font-weight: 400;
1512
+ text-transform: uppercase;
1513
+ letter-spacing: 0.14em;
1514
+ color: var(--mirk-sortable-label);
1515
+ }
1516
+ .hcms-object-fields { display: flex; flex-direction: column; gap: 16px; }
1517
+
1518
+ /* ---------- SCALAR ARRAY \u2014 a calm list of mirk-input rows ---------- */
1519
+ .hcms-array { display: flex; flex-direction: column; gap: 14px; }
1520
+ .hcms-array-header { display: flex; align-items: baseline; justify-content: space-between; }
1521
+ .hcms-array-title {
1522
+ margin: 0;
1523
+ font-size: 11px;
1524
+ font-weight: 400;
1525
+ text-transform: uppercase;
1526
+ letter-spacing: 0.14em;
1527
+ color: var(--mirk-sortable-label);
1528
+ }
1529
+ /* The generic stacked-list layout is unlayered, so it would beat mirk's
1530
+ @layer-components rules on any slot that is also a mirk component. Exempt a
1531
+ mirk tags box so it keeps mirk's own row-wrap layout and inner padding. */
1532
+ .hcms-array-items:not(.mirk-tags) {
1533
+ list-style: none;
1534
+ margin: 0;
1535
+ padding: 0;
1536
+ display: flex;
1537
+ flex-direction: column;
1538
+ gap: 10px;
1539
+ }
1540
+ .hcms-array-item {
1541
+ display: flex;
1542
+ align-items: center;
1543
+ gap: 8px;
1544
+ }
1545
+ .hcms-array-item .mirk-input { flex: 1; min-width: 0; }
1546
+
1547
+ /* ---------- OBJECT ARRAY \u2014 mirk-sortable cards from the engine markup ---------- */
1548
+ .hcms-array--cards .hcms-array-items { gap: 14px; }
1549
+ .hcms-card.mirk-sortable__item { background: var(--mirk-bevel-bg); position: relative; }
1550
+ .hcms-card .hcms-card-fields { display: flex; flex-direction: column; flex: 1; min-width: 0; }
1551
+ .hcms-card .hcms-field {
1552
+ gap: 2px;
1553
+ padding: 8px 14px 9px;
1554
+ }
1555
+ .hcms-card .hcms-field:not(:last-child) { border-bottom: 1px solid var(--mirk-input-border); }
1556
+ .hcms-card .hcms-label { letter-spacing: 0.16em; }
1557
+ /* fields inside a card read as quiet rows, not chunky boxed inputs */
1558
+ .hcms-card .mirk-input,
1559
+ .hcms-card .mirk-textarea {
1560
+ border: none;
1561
+ background: transparent;
1562
+ padding: 0;
1563
+ font-size: 15px;
1564
+ }
1565
+ .hcms-card .mirk-input:focus-visible,
1566
+ .hcms-card .mirk-textarea:focus-visible { outline: none; }
1567
+ /* the remove \xD7 is pulled out to the card corner (below), so the controls row
1568
+ now only holds the sr-only move buttons \u2014 collapse it until one is focused. */
1569
+ .hcms-card-controls {
1570
+ display: flex;
1571
+ align-items: center;
1572
+ justify-content: flex-end;
1573
+ gap: 6px;
1574
+ padding: 0;
1575
+ }
1576
+
1577
+ /* quiet \xD7 remove control, shared by scalar-array rows and object-array cards */
1578
+ .hcms-remove {
1579
+ flex-shrink: 0;
1580
+ appearance: none;
1581
+ border: 0;
1582
+ background: none;
1583
+ color: var(--mirk-placeholder-color);
1584
+ cursor: pointer;
1585
+ font-size: 16px;
1586
+ line-height: 1;
1587
+ padding: 2px 6px;
1588
+ }
1589
+ .hcms-remove:hover { color: var(--mirk-destructive); }
1590
+ .hcms-remove[hidden] { display: none; }
1591
+
1592
+ /* object-array card: the delete control is a square corner button pinned
1593
+ top-right, carrying the card's own 1px border + a crisp-line \xD7 icon. */
1594
+ .hcms-remove--card {
1595
+ position: absolute;
1596
+ top: -1px;
1597
+ right: -1px;
1598
+ width: 18px;
1599
+ height: 18px;
1600
+ padding: 0;
1601
+ display: flex;
1602
+ align-items: center;
1603
+ justify-content: center;
1604
+ border: 1px solid var(--mirk-input-border);
1605
+ background: var(--mirk-bevel-bg);
1606
+ color: var(--mirk-placeholder-color);
1607
+ }
1608
+ .hcms-remove--card:hover { border-color: var(--mirk-destructive); }
1609
+ .hcms-remove--card .hcms-x { width: 64%; height: 64%; display: block; }
1610
+
1611
+ /* "+ Add" \u2014 quiet, pinned left */
1612
+ .hcms-add.mirk-button { align-self: flex-start; }
1613
+
1614
+ /* ---------- UPLOAD COMPONENTS (@file / @image) ----------
1615
+ Built on the kit's mirk-file / mirk-image--compact chrome. The native picker
1616
+ is visually hidden but focusable (the mirk-button label is the visible
1617
+ trigger and rings via :has(:focus-visible)); it is NOT .mirk-*__input, so the
1618
+ vendored mirk runtime never handles it. The empty/filled chrome is driven by
1619
+ the bound leaf's value attribute (src/href) in CSS \u2014 no JS state to desync. */
1620
+ .hcms-upload input[type="file"] {
1621
+ position: absolute;
1622
+ width: 1px;
1623
+ height: 1px;
1624
+ padding: 0;
1625
+ margin: -1px;
1626
+ overflow: hidden;
1627
+ clip: rect(0, 0, 0, 0);
1628
+ white-space: nowrap;
1629
+ border: 0;
1630
+ }
1631
+
1632
+ /* @image: show the upload button until the bound <img> carries a real src. */
1633
+ .hcms-upload--image .mirk-image__thumb { display: none; }
1634
+ .hcms-upload--image:has(.mirk-image__preview[src]:not([src=""])) .mirk-image__upload { display: none; }
1635
+ .hcms-upload--image:has(.mirk-image__preview[src]:not([src=""])) .mirk-image__thumb { display: inline-block; }
1636
+
1637
+ /* @file: reveal the clear \xD7 and the filename only once the bound <a> has href. */
1638
+ .hcms-upload--file .hcms-upload-clear { display: none; }
1639
+ .hcms-upload--file:has(a.mirk-file__name[href]:not([href=""])) .hcms-upload-clear { display: inline-flex; }
1640
+ /* A filled filename uses the bright foreground (the kit's [data-filled] look),
1641
+ driven by the bound href so there's no JS attribute to keep in sync \u2014 the
1642
+ vendored runtime that would otherwise stamp data-filled is inert here. */
1643
+ .hcms-upload--file:has(a.mirk-file__name[href]:not([href=""])) a.mirk-file__name {
1644
+ color: var(--mirk-bevel-fg);
1645
+ }
1646
+ .hcms-upload--file a.mirk-file__name:empty {
1647
+ text-decoration: none;
1648
+ cursor: default;
1649
+ }
1650
+ .hcms-upload--file a.mirk-file__name:empty::after {
1651
+ content: "No file chosen";
1652
+ color: var(--mirk-placeholder-color);
1653
+ }
1654
+
1655
+ /* clear-\xD7 (vendored-inert; data-hcms-action, never .mirk-*__remove). Bare \xD7 for
1656
+ @file, a pinned corner badge for @image \u2014 mirroring .hcms-remove / --card. */
1657
+ .hcms-upload-clear {
1658
+ flex-shrink: 0;
1659
+ appearance: none;
1660
+ border: 0;
1661
+ background: none;
1662
+ color: var(--mirk-placeholder-color);
1663
+ cursor: pointer;
1664
+ line-height: 0;
1665
+ padding: 2px 4px;
1666
+ display: inline-flex;
1667
+ align-items: center;
1668
+ justify-content: center;
1669
+ }
1670
+ .hcms-upload-clear:hover { color: var(--mirk-destructive); }
1671
+ .hcms-upload-clear .hcms-x { display: block; width: 14px; height: 14px; }
1672
+
1673
+ .hcms-upload-clear--badge {
1674
+ position: absolute;
1675
+ top: -7px;
1676
+ right: -7px;
1677
+ width: 18px;
1678
+ height: 18px;
1679
+ padding: 0;
1680
+ border-radius: 50%;
1681
+ border: 1px solid var(--mirk-input-border);
1682
+ background: var(--mirk-bevel-bg);
1683
+ color: var(--mirk-bevel-fg);
1684
+ }
1685
+ .hcms-upload-clear--badge:hover { color: var(--mirk-destructive); border-color: var(--mirk-destructive); }
1686
+ .hcms-upload-clear--badge .hcms-x { width: 10px; height: 10px; }
1687
+
1688
+ /* ---------- ERROR BANNER + inline errors ---------- */
1689
+ .hcms-shell-error,
1690
+ .hcms-error {
1691
+ font-size: 12px;
1692
+ line-height: 1.45;
1693
+ color: var(--mirk-destructive);
1694
+ background: var(--mirk-bevel-bg);
1695
+ border: 1px solid var(--mirk-destructive);
1696
+ padding: 8px 12px;
1697
+ }
1698
+ .hcms-shell-error { margin: 0 24px; }
1699
+ .hcms-error { margin-top: 6px; }
1700
+ .hcms-shell-error[hidden],
1701
+ .hcms-error[hidden] { display: none; }
1702
+
1703
+ /* ---------- SAVE (sits at the end of the scrolling form, not pinned) ---------- */
1704
+ .hcms-shell-footer {
1705
+ display: flex;
1706
+ justify-content: flex-end;
1707
+ padding: 4px 24px 28px;
1708
+ }
1709
+ .hcms-shell-footer[hidden] { display: none; }
1710
+
1711
+ /* ---------- sr-only move buttons: hidden, visible on keyboard focus ---------- */
1712
+ .hcms-sr-only {
1713
+ position: absolute;
1714
+ width: 1px;
1715
+ height: 1px;
1716
+ padding: 0;
1717
+ margin: -1px;
1718
+ overflow: hidden;
1719
+ clip: rect(0, 0, 0, 0);
1720
+ white-space: nowrap;
1721
+ border: 0;
1722
+ }
1723
+ .hcms-sr-only:focus {
1724
+ position: static;
1725
+ width: auto;
1726
+ height: auto;
1727
+ padding: 2px 6px;
1728
+ margin: 0 2px;
1729
+ overflow: visible;
1730
+ clip: auto;
1731
+ white-space: normal;
1732
+ background: var(--mirk-bevel-bg);
1733
+ border: 1px solid var(--mirk-input-border);
1734
+ color: var(--mirk-fg);
1735
+ font-size: 12px;
1736
+ cursor: pointer;
1737
+ }
1738
+ .hcms-sr-only[hidden] { display: none; }
1739
+ `;typeof window<"u"&&typeof document<"u"&&(function(){if(window.__mirk)return;window.__mirk=!0;let e='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 4 12 12M12 4 4 12" stroke="currentColor" stroke-width="2" stroke-linecap="square" fill="none"/></svg>';document.addEventListener("click",r=>{let i=r.target.closest(".mirk-number__step");if(!i)return;let n=i.closest(".mirk-number").querySelector("input[type=number]");n&&(i.dataset.step==="up"?n.stepUp():n.stepDown(),n.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("input",r=>{let i=r.target.closest(".mirk-slider__input");i&&i.closest(".mirk-slider").style.setProperty("--mirk-value",`${i.value}%`)}),document.addEventListener("change",r=>{let i=r.target.closest(".mirk-file__input");if(!i||!i.files.length)return;let n=i.closest(".mirk-file"),o=n.querySelector(".mirk-file__name");if(!o)return;let a=i.files[0],s=document.createElement("a");if(s.className="mirk-file__name",s.dataset.filled="",s.href=URL.createObjectURL(a),s.target="_blank",s.rel="noopener",s.textContent=a.name,o.replaceWith(s),!n.querySelector(".mirk-file__remove")){let l=document.createElement("button");l.type="button",l.className="mirk-file__remove",l.setAttribute("aria-label","Remove file"),l.innerHTML=e,s.after(l)}}),document.addEventListener("change",r=>{let i=r.target.closest(".mirk-image__input");if(!i||!i.files.length)return;let n=i.closest(".mirk-image"),o=n.querySelector(".mirk-image__preview");if(!o)return;let a=n.querySelector(".mirk-image__placeholder"),s=new FileReader;s.onload=l=>{o.src=l.target.result,o.removeAttribute("hidden"),a&&a.setAttribute("hidden",""),n.querySelector(".mirk-image__thumb")?.removeAttribute("hidden"),n.querySelector(".mirk-image__upload")?.setAttribute("hidden","")},s.readAsDataURL(i.files[0])}),document.addEventListener("click",r=>{let i=r.target.closest(".mirk-file__remove");if(i){let o=i.closest(".mirk-file"),a=o?.querySelector(".mirk-file__input"),s=o?.querySelector(".mirk-file__name");if(a&&(a.value=""),s){let l=document.createElement("span");l.className="mirk-file__name",l.textContent="No file chosen",s.replaceWith(l)}i.remove();return}let n=r.target.closest(".mirk-image__remove");if(n){let o=n.closest(".mirk-image"),a=o?.querySelector(".mirk-image__input"),s=o?.querySelector(".mirk-image__preview");a&&(a.value=""),s&&(s.removeAttribute("src"),s.setAttribute("hidden","")),o?.querySelector(".mirk-image__thumb")?.setAttribute("hidden",""),o?.querySelector(".mirk-image__upload")?.removeAttribute("hidden")}});function t(r,i){let n=document.createElement("span");n.textContent=r;let o=document.createElement("input");o.type="hidden",o.name="tags[]",o.value=r;let a=document.createElement("button");a.type="button",a.className="mirk-tags__remove",a.textContent="\xD7";let s=document.createElement("span");if(s.className="mirk-tags__chip",i){let l=document.createElement("span");l.className="mirk-tags__chip-inner",l.append(n,o,a),s.append(l)}else s.append(n,o,a);return s}document.addEventListener("keydown",r=>{let i=r.target.closest(".mirk-tags__input");if(!i)return;let n=i.closest(".mirk-tags");if(r.key==="Enter"||r.key===","){let o=i.value.trim();if(!o)return;r.preventDefault(),i.before(t(o,n.classList.contains("mirk-tags--round"))),i.value=""}else if(r.key==="Backspace"&&!i.value){let o=n.querySelectorAll(".mirk-tags__chip");o[o.length-1]?.remove()}}),document.addEventListener("click",r=>{let i=r.target.closest(".mirk-tags__remove");if(i){i.closest(".mirk-tags__chip").remove();return}let n=r.target.closest(".mirk-tags");n&&r.target===n&&n.querySelector(".mirk-tags__input")?.focus()}),document.addEventListener("click",r=>{let i=r.target.closest("[data-mirk-chip]");if(!i)return;let n=i.getAttribute("data-mirk-chip");if(n==="open")i.closest(".mirk-chip")?.classList.add("mirk-chip--open");else if(n==="collapse")i.closest(".mirk-chip")?.classList.remove("mirk-chip--open");else if(n==="changes"){let o=i.closest(".mirk-chip__panel")?.classList.toggle("is-changes");i.textContent=o?"(hide changes)":"(view changes)"}}),document.addEventListener("click",r=>{let i=r.target.closest("[data-copy-btn]");if(!i)return;let n=i.closest("[data-copy]");if(!n)return;let o=n.cloneNode(!0);o.querySelectorAll("[data-copy-btn]").forEach(l=>l.remove());let s=n.getAttribute("data-copy")==="text"?o.textContent.replace(/^\s+|\s+$/g,""):o.innerHTML.replace(/\s+data-copy(="[^"]*")?/g,"").replace(/^\s*\n/gm,"").trim();navigator.clipboard.writeText(s).then(()=>{let l=i.textContent;i.textContent="copied",i.dataset.copied="",setTimeout(()=>{i.textContent=l,delete i.dataset.copied},1200)}).catch(()=>{i.textContent="error",setTimeout(()=>{i.textContent="copy"},1200)})})})();Kr(Yr);var uo=Bt,po={cms:Bt};return ei(fo);})();
1740
+
1741
+ // Auto-export to window unless suppressed by loader.
1742
+ // Per hypercms plan locked decision 3: flatten to hyperclay.hypercms.open(),
1743
+ // not hyperclay.hypercms.cms.open().
1744
+ if (!window.__hyperclayNoAutoExport) {
1745
+ window.hyperclay = window.hyperclay || {};
1746
+ window.hyperclay.hypercms = hypercms.cms;
1747
+ window.h = window.hyperclay;
1748
+ }
1749
+
1750
+ export const cms = hypercms.cms;
1751
+ export default hypercms;