@jxsuite/runtime 4.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/runtime.js +6 -11
- package/dist/runtime.js.map +6 -6
- package/package.json +3 -3
- package/src/runtime.ts +15 -12
package/dist/runtime.js.map
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../node_modules/@vue/shared/dist/shared.esm-bundler.js", "../../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js", "../../schema/src/guards.ts", "../src/css.ts", "../../schema/src/intl.ts", "../src/pointer.ts", "../src/expression.ts", "../../schema/src/asset-paths.ts", "../src/statements.ts", "../src/cookie.ts", "../src/runtime.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n* @vue/shared v3.5.42\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\n// @__NO_SIDE_EFFECTS__\nfunction makeMap(str) {\n const map = /* @__PURE__ */ Object.create(null);\n for (const key of str.split(\",\")) map[key] = 1;\n return (val) => val in map;\n}\n\nconst EMPTY_OBJ = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze({}) : {};\nconst EMPTY_ARR = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze([]) : [];\nconst NOOP = () => {\n};\nconst NO = () => false;\nconst isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter\n(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);\nconst isModelListener = (key) => key.startsWith(\"onUpdate:\");\nconst extend = Object.assign;\nconst remove = (arr, el) => {\n const i = arr.indexOf(el);\n if (i > -1) {\n arr.splice(i, 1);\n }\n};\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nconst hasOwn = (val, key) => hasOwnProperty.call(val, key);\nconst isArray = Array.isArray;\nconst isMap = (val) => toTypeString(val) === \"[object Map]\";\nconst isSet = (val) => toTypeString(val) === \"[object Set]\";\nconst isDate = (val) => toTypeString(val) === \"[object Date]\";\nconst isRegExp = (val) => toTypeString(val) === \"[object RegExp]\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isString = (val) => typeof val === \"string\";\nconst isSymbol = (val) => typeof val === \"symbol\";\nconst isObject = (val) => val !== null && typeof val === \"object\";\nconst isPromise = (val) => {\n return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);\n};\nconst objectToString = Object.prototype.toString;\nconst toTypeString = (value) => objectToString.call(value);\nconst toRawType = (value) => {\n return toTypeString(value).slice(8, -1);\n};\nconst isPlainObject = (val) => toTypeString(val) === \"[object Object]\";\nconst isIntegerKey = (key) => isString(key) && key !== \"NaN\" && key[0] !== \"-\" && \"\" + parseInt(key, 10) === key;\nconst isReservedProp = /* @__PURE__ */ makeMap(\n // the leading comma is intentional so empty string \"\" is also included\n \",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted\"\n);\nconst isBuiltInDirective = /* @__PURE__ */ makeMap(\n \"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo\"\n);\nconst cacheStringFunction = (fn) => {\n const cache = /* @__PURE__ */ Object.create(null);\n return ((str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n });\n};\nconst camelizeRE = /-\\w/g;\nconst camelize = cacheStringFunction(\n (str) => {\n return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());\n }\n);\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction(\n (str) => str.replace(hyphenateRE, \"-$1\").toLowerCase()\n);\nconst capitalize = cacheStringFunction((str) => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n});\nconst toHandlerKey = cacheStringFunction(\n (str) => {\n const s = str ? `on${capitalize(str)}` : ``;\n return s;\n }\n);\nconst hasChanged = (value, oldValue) => !Object.is(value, oldValue);\nconst invokeArrayFns = (fns, ...arg) => {\n for (let i = 0; i < fns.length; i++) {\n fns[i](...arg);\n }\n};\nconst def = (obj, key, value, writable = false) => {\n Object.defineProperty(obj, key, {\n configurable: true,\n enumerable: false,\n writable,\n value\n });\n};\nconst looseToNumber = (val) => {\n const n = parseFloat(val);\n return isNaN(n) ? val : n;\n};\nconst toNumber = (val) => {\n const n = isString(val) ? Number(val) : NaN;\n return isNaN(n) ? val : n;\n};\nlet _globalThis;\nconst getGlobalThis = () => {\n return _globalThis || (_globalThis = typeof globalThis !== \"undefined\" ? globalThis : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : {});\n};\nconst identRE = /^[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*$/;\nfunction genPropsAccessExp(name) {\n return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;\n}\nfunction genCacheKey(source, options) {\n return source + JSON.stringify(\n options,\n (_, val) => typeof val === \"function\" ? val.toString() : val\n );\n}\n\nconst PatchFlags = {\n \"TEXT\": 1,\n \"1\": \"TEXT\",\n \"CLASS\": 2,\n \"2\": \"CLASS\",\n \"STYLE\": 4,\n \"4\": \"STYLE\",\n \"PROPS\": 8,\n \"8\": \"PROPS\",\n \"FULL_PROPS\": 16,\n \"16\": \"FULL_PROPS\",\n \"NEED_HYDRATION\": 32,\n \"32\": \"NEED_HYDRATION\",\n \"STABLE_FRAGMENT\": 64,\n \"64\": \"STABLE_FRAGMENT\",\n \"KEYED_FRAGMENT\": 128,\n \"128\": \"KEYED_FRAGMENT\",\n \"UNKEYED_FRAGMENT\": 256,\n \"256\": \"UNKEYED_FRAGMENT\",\n \"NEED_PATCH\": 512,\n \"512\": \"NEED_PATCH\",\n \"DYNAMIC_SLOTS\": 1024,\n \"1024\": \"DYNAMIC_SLOTS\",\n \"DEV_ROOT_FRAGMENT\": 2048,\n \"2048\": \"DEV_ROOT_FRAGMENT\",\n \"CACHED\": -1,\n \"-1\": \"CACHED\",\n \"BAIL\": -2,\n \"-2\": \"BAIL\"\n};\nconst PatchFlagNames = {\n [1]: `TEXT`,\n [2]: `CLASS`,\n [4]: `STYLE`,\n [8]: `PROPS`,\n [16]: `FULL_PROPS`,\n [32]: `NEED_HYDRATION`,\n [64]: `STABLE_FRAGMENT`,\n [128]: `KEYED_FRAGMENT`,\n [256]: `UNKEYED_FRAGMENT`,\n [512]: `NEED_PATCH`,\n [1024]: `DYNAMIC_SLOTS`,\n [2048]: `DEV_ROOT_FRAGMENT`,\n [-1]: `CACHED`,\n [-2]: `BAIL`\n};\n\nconst ShapeFlags = {\n \"ELEMENT\": 1,\n \"1\": \"ELEMENT\",\n \"FUNCTIONAL_COMPONENT\": 2,\n \"2\": \"FUNCTIONAL_COMPONENT\",\n \"STATEFUL_COMPONENT\": 4,\n \"4\": \"STATEFUL_COMPONENT\",\n \"TEXT_CHILDREN\": 8,\n \"8\": \"TEXT_CHILDREN\",\n \"ARRAY_CHILDREN\": 16,\n \"16\": \"ARRAY_CHILDREN\",\n \"SLOTS_CHILDREN\": 32,\n \"32\": \"SLOTS_CHILDREN\",\n \"TELEPORT\": 64,\n \"64\": \"TELEPORT\",\n \"SUSPENSE\": 128,\n \"128\": \"SUSPENSE\",\n \"COMPONENT_SHOULD_KEEP_ALIVE\": 256,\n \"256\": \"COMPONENT_SHOULD_KEEP_ALIVE\",\n \"COMPONENT_KEPT_ALIVE\": 512,\n \"512\": \"COMPONENT_KEPT_ALIVE\",\n \"COMPONENT\": 6,\n \"6\": \"COMPONENT\"\n};\n\nconst SlotFlags = {\n \"STABLE\": 1,\n \"1\": \"STABLE\",\n \"DYNAMIC\": 2,\n \"2\": \"DYNAMIC\",\n \"FORWARDED\": 3,\n \"3\": \"FORWARDED\"\n};\nconst slotFlagsText = {\n [1]: \"STABLE\",\n [2]: \"DYNAMIC\",\n [3]: \"FORWARDED\"\n};\n\nconst GLOBALS_ALLOWED = \"Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol\";\nconst isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);\nconst isGloballyWhitelisted = isGloballyAllowed;\n\nconst range = 2;\nfunction generateCodeFrame(source, start = 0, end = source.length) {\n start = Math.max(0, Math.min(start, source.length));\n end = Math.max(0, Math.min(end, source.length));\n if (start > end) return \"\";\n let lines = source.split(/(\\r?\\n)/);\n const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);\n lines = lines.filter((_, idx) => idx % 2 === 0);\n let count = 0;\n const res = [];\n for (let i = 0; i < lines.length; i++) {\n count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);\n if (count >= start) {\n for (let j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length) continue;\n const line = j + 1;\n res.push(\n `${line}${\" \".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`\n );\n const lineLength = lines[j].length;\n const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;\n if (j === i) {\n const pad = start - (count - (lineLength + newLineSeqLength));\n const length = Math.max(\n 1,\n end > count ? lineLength - pad : end - start\n );\n res.push(` | ` + \" \".repeat(pad) + \"^\".repeat(length));\n } else if (j > i) {\n if (end > count) {\n const length = Math.max(Math.min(end - count, lineLength), 1);\n res.push(` | ` + \"^\".repeat(length));\n }\n count += lineLength + newLineSeqLength;\n }\n }\n break;\n }\n }\n return res.join(\"\\n\");\n}\n\nfunction normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);\n if (normalized) {\n for (const key in normalized) {\n res[key] = normalized[key];\n }\n }\n }\n return res;\n } else if (isString(value) || isObject(value)) {\n return value;\n }\n}\nconst listDelimiterRE = /;(?![^(]*\\))/g;\nconst propertyDelimiterRE = /:([^]+)/;\nconst styleCommentRE = /\\/\\*[^]*?\\*\\//g;\nfunction parseStringStyle(cssText) {\n const ret = {};\n cssText.replace(styleCommentRE, \"\").split(listDelimiterRE).forEach((item) => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n}\nfunction stringifyStyle(styles) {\n if (!styles) return \"\";\n if (isString(styles)) return styles;\n let ret = \"\";\n for (const key in styles) {\n const value = styles[key];\n if (isString(value) || typeof value === \"number\") {\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\n ret += `${normalizedKey}:${value};`;\n }\n }\n return ret;\n}\nfunction normalizeClass(value) {\n let res = \"\";\n if (isString(value)) {\n res = value;\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) {\n res += normalized + \" \";\n }\n }\n } else if (isObject(value)) {\n for (const name in value) {\n if (value[name]) {\n res += name + \" \";\n }\n }\n }\n return res.trim();\n}\nfunction normalizeProps(props) {\n if (!props) return null;\n let { class: klass, style } = props;\n if (klass && !isString(klass)) {\n props.class = normalizeClass(klass);\n }\n if (style) {\n props.style = normalizeStyle(style);\n }\n return props;\n}\n\nconst HTML_TAGS = \"html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot\";\nconst SVG_TAGS = \"svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view\";\nconst MATH_TAGS = \"annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics\";\nconst VOID_TAGS = \"area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr\";\nconst isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);\nconst isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);\nconst isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);\nconst isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);\n\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\nconst isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);\nconst isBooleanAttr = /* @__PURE__ */ makeMap(\n specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`\n);\nfunction includeBooleanAttr(value) {\n return !!value || value === \"\";\n}\nconst unsafeAttrCharRE = /[>/=\"'\\u0009\\u000a\\u000c\\u000d\\u0020]/;\nconst attrValidationCache = {};\nfunction isSSRSafeAttrName(name) {\n if (attrValidationCache.hasOwnProperty(name)) {\n return attrValidationCache[name];\n }\n const isUnsafe = unsafeAttrCharRE.test(name);\n if (isUnsafe) {\n console.error(`unsafe attribute name: ${name}`);\n }\n return attrValidationCache[name] = !isUnsafe;\n}\nconst propsToAttrMap = {\n acceptCharset: \"accept-charset\",\n className: \"class\",\n htmlFor: \"for\",\n httpEquiv: \"http-equiv\"\n};\nconst isKnownHtmlAttr = /* @__PURE__ */ makeMap(\n `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`\n);\nconst isKnownSvgAttr = /* @__PURE__ */ makeMap(\n `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`\n);\nconst isKnownMathMLAttr = /* @__PURE__ */ makeMap(\n `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`\n);\nfunction isRenderableAttrValue(value) {\n if (value == null) {\n return false;\n }\n const type = typeof value;\n return type === \"string\" || type === \"number\" || type === \"boolean\";\n}\n\nconst escapeRE = /[\"'&<>]/;\nfunction escapeHtml(string) {\n const str = \"\" + string;\n const match = escapeRE.exec(str);\n if (!match) {\n return str;\n }\n let html = \"\";\n let escaped;\n let index;\n let lastIndex = 0;\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34:\n escaped = \""\";\n break;\n case 38:\n escaped = \"&\";\n break;\n case 39:\n escaped = \"'\";\n break;\n case 60:\n escaped = \"<\";\n break;\n case 62:\n escaped = \">\";\n break;\n default:\n continue;\n }\n if (lastIndex !== index) {\n html += str.slice(lastIndex, index);\n }\n lastIndex = index + 1;\n html += escaped;\n }\n return lastIndex !== index ? html + str.slice(lastIndex, index) : html;\n}\nconst commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;\nfunction escapeHtmlComment(src) {\n let prev;\n do {\n prev = src;\n src = src.replace(commentStripRE, \"\");\n } while (src !== prev);\n return src;\n}\nconst cssVarNameEscapeSymbolsRE = /[ !\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~]/g;\nfunction getEscapedCssVarName(key, doubleEscape) {\n return key.replace(\n cssVarNameEscapeSymbolsRE,\n (s) => doubleEscape ? s === '\"' ? '\\\\\\\\\\\\\"' : `\\\\\\\\${s}` : `\\\\${s}`\n );\n}\n\nfunction looseCompareArrays(a, b) {\n if (a.length !== b.length) return false;\n let equal = true;\n for (let i = 0; equal && i < a.length; i++) {\n equal = looseEqual(a[i], b[i]);\n }\n return equal;\n}\nfunction looseCompareCollections(a, b) {\n if (a.size !== b.size) return false;\n const candidates = Array.from(b);\n const matched = new Uint8Array(candidates.length);\n for (const item of a) {\n let index = -1;\n for (let i = 0; i < candidates.length; i++) {\n if (!matched[i] && looseEqual(item, candidates[i])) {\n index = i;\n break;\n }\n }\n if (index < 0) return false;\n matched[index] = 1;\n }\n return true;\n}\nfunction looseEqual(a, b) {\n if (a === b) return true;\n let aValidType = isDate(a);\n let bValidType = isDate(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? a.getTime() === b.getTime() : false;\n }\n aValidType = isSymbol(a);\n bValidType = isSymbol(b);\n if (aValidType || bValidType) {\n return a === b;\n }\n aValidType = isArray(a);\n bValidType = isArray(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? looseCompareArrays(a, b) : false;\n }\n aValidType = isObject(a);\n bValidType = isObject(b);\n if (aValidType || bValidType) {\n if (!aValidType || !bValidType) {\n return false;\n }\n aValidType = isMap(a);\n bValidType = isMap(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? looseCompareCollections(a, b) : false;\n }\n aValidType = isSet(a);\n bValidType = isSet(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? looseCompareCollections(a, b) : false;\n }\n const aKeysCount = Object.keys(a).length;\n const bKeysCount = Object.keys(b).length;\n if (aKeysCount !== bKeysCount) {\n return false;\n }\n for (const key in a) {\n const aHasKey = a.hasOwnProperty(key);\n const bHasKey = b.hasOwnProperty(key);\n if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {\n return false;\n }\n }\n }\n return String(a) === String(b);\n}\nfunction looseIndexOf(arr, val) {\n return arr.findIndex((item) => looseEqual(item, val));\n}\n\nconst isRef = (val) => {\n return !!(val && val[\"__v_isRef\"] === true);\n};\nconst toDisplayString = (val) => {\n return isString(val) ? val : val == null ? \"\" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);\n};\nconst replacer = (_key, val) => {\n if (isRef(val)) {\n return replacer(_key, val.value);\n } else if (isMap(val)) {\n return {\n [`Map(${val.size})`]: [...val.entries()].reduce(\n (entries, [key, val2], i) => {\n entries[stringifySymbol(key, i) + \" =>\"] = val2;\n return entries;\n },\n {}\n )\n };\n } else if (isSet(val)) {\n return {\n [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))\n };\n } else if (isSymbol(val)) {\n return stringifySymbol(val);\n } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {\n return String(val);\n }\n return val;\n};\nconst stringifySymbol = (v, i = \"\") => {\n var _a;\n return (\n // Symbol.description in es2019+ so we need to cast here to pass\n // the lib: es2016 check\n isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v\n );\n};\n\nfunction normalizeCssVarValue(value) {\n if (value == null) {\n return \"initial\";\n }\n if (typeof value === \"string\") {\n return value === \"\" ? \" \" : value;\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n console.warn(\n \"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:\",\n value\n );\n }\n }\n return String(value);\n}\n\nexport { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };\n",
|
|
6
|
-
"/**\n* @vue/reactivity v3.5.42\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\nimport { extend, hasChanged, isArray, isIntegerKey, isSymbol, isMap, hasOwn, isObject, makeMap, capitalize, toRawType, def, isFunction, EMPTY_OBJ, isSet, isPlainObject, remove, NOOP } from '@vue/shared';\n\nfunction warn(msg, ...args) {\n console.warn(`[Vue warn] ${msg}`, ...args);\n}\n\nlet activeEffectScope;\nclass EffectScope {\n // TODO isolatedDeclarations \"__v_skip\"\n constructor(detached = false) {\n this.detached = detached;\n /**\n * @internal\n */\n this._active = true;\n /**\n * @internal track `on` calls, allow `on` call multiple times\n */\n this._on = 0;\n /**\n * @internal\n */\n this.effects = [];\n /**\n * @internal\n */\n this.cleanups = [];\n this._isPaused = false;\n this._warnOnRun = true;\n this.__v_skip = true;\n if (!detached && activeEffectScope) {\n if (activeEffectScope.active) {\n this.parent = activeEffectScope;\n this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(\n this\n ) - 1;\n } else {\n this._active = false;\n this._warnOnRun = false;\n }\n }\n }\n get active() {\n return this._active;\n }\n pause() {\n if (this._active) {\n this._isPaused = true;\n let i, l;\n if (this.scopes) {\n const scopes = this.scopes.slice();\n for (i = 0, l = scopes.length; i < l; i++) {\n scopes[i].pause();\n }\n }\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].pause();\n }\n }\n }\n /**\n * Resumes the effect scope, including all child scopes and effects.\n */\n resume() {\n if (this._active) {\n if (this._isPaused) {\n this._isPaused = false;\n let i, l;\n if (this.scopes) {\n const scopes = this.scopes.slice();\n for (i = 0, l = scopes.length; i < l; i++) {\n scopes[i].resume();\n }\n }\n const effects = this.effects.slice();\n for (i = 0, l = effects.length; i < l; i++) {\n effects[i].resume();\n }\n }\n }\n }\n run(fn) {\n if (this._active) {\n const currentEffectScope = activeEffectScope;\n try {\n activeEffectScope = this;\n return fn();\n } finally {\n activeEffectScope = currentEffectScope;\n }\n } else if (!!(process.env.NODE_ENV !== \"production\") && this._warnOnRun) {\n warn(`cannot run an inactive effect scope.`);\n }\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n on() {\n if (++this._on === 1) {\n this.prevScope = activeEffectScope;\n activeEffectScope = this;\n }\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n off() {\n if (this._on > 0 && --this._on === 0) {\n if (activeEffectScope === this) {\n activeEffectScope = this.prevScope;\n } else {\n let current = activeEffectScope;\n while (current) {\n if (current.prevScope === this) {\n current.prevScope = this.prevScope;\n break;\n }\n current = current.prevScope;\n }\n }\n this.prevScope = void 0;\n }\n }\n stop(fromParent) {\n if (this._active) {\n this._active = false;\n let i, l;\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].stop();\n }\n this.effects.length = 0;\n for (i = 0, l = this.cleanups.length; i < l; i++) {\n this.cleanups[i]();\n }\n this.cleanups.length = 0;\n if (this.scopes) {\n const scopes = this.scopes.slice();\n for (i = 0, l = scopes.length; i < l; i++) {\n scopes[i].stop(true);\n }\n this.scopes.length = 0;\n }\n if (!this.detached && this.parent && !fromParent) {\n const last = this.parent.scopes.pop();\n if (last && last !== this) {\n this.parent.scopes[this.index] = last;\n last.index = this.index;\n }\n }\n this.parent = void 0;\n }\n }\n}\nfunction effectScope(detached) {\n return new EffectScope(detached);\n}\nfunction getCurrentScope() {\n return activeEffectScope;\n}\nfunction onScopeDispose(fn, failSilently = false) {\n if (activeEffectScope) {\n activeEffectScope.cleanups.push(fn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onScopeDispose() is called when there is no active effect scope to be associated with.`\n );\n }\n}\n\nlet activeSub;\nconst EffectFlags = {\n \"ACTIVE\": 1,\n \"1\": \"ACTIVE\",\n \"RUNNING\": 2,\n \"2\": \"RUNNING\",\n \"TRACKING\": 4,\n \"4\": \"TRACKING\",\n \"NOTIFIED\": 8,\n \"8\": \"NOTIFIED\",\n \"DIRTY\": 16,\n \"16\": \"DIRTY\",\n \"ALLOW_RECURSE\": 32,\n \"32\": \"ALLOW_RECURSE\",\n \"PAUSED\": 64,\n \"64\": \"PAUSED\",\n \"EVALUATED\": 128,\n \"128\": \"EVALUATED\"\n};\nconst pausedQueueEffects = /* @__PURE__ */ new WeakSet();\nclass ReactiveEffect {\n constructor(fn) {\n this.fn = fn;\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 1 | 4;\n /**\n * @internal\n */\n this.next = void 0;\n /**\n * @internal\n */\n this.cleanup = void 0;\n this.scheduler = void 0;\n if (activeEffectScope) {\n if (activeEffectScope.active) {\n activeEffectScope.effects.push(this);\n } else {\n this.flags &= -2;\n }\n }\n }\n pause() {\n this.flags |= 64;\n }\n resume() {\n if (this.flags & 64) {\n this.flags &= -65;\n if (pausedQueueEffects.has(this)) {\n pausedQueueEffects.delete(this);\n this.trigger();\n }\n }\n }\n /**\n * @internal\n */\n notify() {\n if (this.flags & 2 && !(this.flags & 32)) {\n return;\n }\n if (!(this.flags & 8)) {\n batch(this);\n }\n }\n run() {\n if (!(this.flags & 1)) {\n return this.fn();\n }\n this.flags |= 2;\n cleanupEffect(this);\n prepareDeps(this);\n const prevEffect = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = this;\n shouldTrack = true;\n try {\n return this.fn();\n } finally {\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub !== this) {\n warn(\n \"Active effect was not restored correctly - this is likely a Vue internal bug.\"\n );\n }\n cleanupDeps(this);\n activeSub = prevEffect;\n shouldTrack = prevShouldTrack;\n this.flags &= -3;\n }\n }\n stop() {\n if (this.flags & 1) {\n for (let link = this.deps; link; link = link.nextDep) {\n removeSub(link);\n }\n this.deps = this.depsTail = void 0;\n cleanupEffect(this);\n this.onStop && this.onStop();\n this.flags &= -2;\n }\n }\n trigger() {\n if (this.flags & 64) {\n pausedQueueEffects.add(this);\n } else if (this.scheduler) {\n this.scheduler();\n } else {\n this.runIfDirty();\n }\n }\n /**\n * @internal\n */\n runIfDirty() {\n if (isDirty(this)) {\n this.run();\n }\n }\n get dirty() {\n return isDirty(this);\n }\n}\nlet batchDepth = 0;\nlet batchedSub;\nlet batchedComputed;\nfunction batch(sub, isComputed = false) {\n sub.flags |= 8;\n if (isComputed) {\n sub.next = batchedComputed;\n batchedComputed = sub;\n return;\n }\n sub.next = batchedSub;\n batchedSub = sub;\n}\nfunction startBatch() {\n batchDepth++;\n}\nfunction endBatch() {\n if (--batchDepth > 0) {\n return;\n }\n if (batchedComputed) {\n let e = batchedComputed;\n batchedComputed = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n e = next;\n }\n }\n let error;\n while (batchedSub) {\n let e = batchedSub;\n batchedSub = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n if (e.flags & 1) {\n try {\n ;\n e.trigger();\n } catch (err) {\n if (!error) error = err;\n }\n }\n e = next;\n }\n }\n if (error) throw error;\n}\nfunction prepareDeps(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n link.version = -1;\n link.prevActiveLink = link.dep.activeLink;\n link.dep.activeLink = link;\n }\n}\nfunction cleanupDeps(sub) {\n let head;\n let tail = sub.depsTail;\n let link = tail;\n while (link) {\n const prev = link.prevDep;\n if (link.version === -1) {\n if (link === tail) tail = prev;\n removeSub(link);\n removeDep(link);\n } else {\n head = link;\n }\n link.dep.activeLink = link.prevActiveLink;\n link.prevActiveLink = void 0;\n link = prev;\n }\n sub.deps = head;\n sub.depsTail = tail;\n}\nfunction isDirty(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {\n return true;\n }\n }\n if (sub._dirty) {\n return true;\n }\n return false;\n}\nfunction refreshComputed(computed) {\n if (computed.flags & 4 && !(computed.flags & 16)) {\n return;\n }\n computed.flags &= -17;\n if (computed.globalVersion === globalVersion) {\n return;\n }\n computed.globalVersion = globalVersion;\n if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {\n return;\n }\n computed.flags |= 2;\n const dep = computed.dep;\n const prevSub = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = computed;\n shouldTrack = true;\n try {\n prepareDeps(computed);\n const value = computed.fn(computed._value);\n if (dep.version === 0 || hasChanged(value, computed._value)) {\n computed.flags |= 128;\n computed._value = value;\n dep.version++;\n }\n } catch (err) {\n dep.version++;\n throw err;\n } finally {\n activeSub = prevSub;\n shouldTrack = prevShouldTrack;\n cleanupDeps(computed);\n computed.flags &= -3;\n }\n}\nfunction removeSub(link, soft = false) {\n const { dep, prevSub, nextSub } = link;\n if (prevSub) {\n prevSub.nextSub = nextSub;\n link.prevSub = void 0;\n }\n if (nextSub) {\n nextSub.prevSub = prevSub;\n link.nextSub = void 0;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && dep.subsHead === link) {\n dep.subsHead = nextSub;\n }\n if (dep.subs === link) {\n dep.subs = prevSub;\n if (!prevSub && dep.computed) {\n dep.computed.flags &= -5;\n for (let l = dep.computed.deps; l; l = l.nextDep) {\n removeSub(l, true);\n }\n }\n }\n if (!soft && !--dep.sc && dep.map) {\n dep.map.delete(dep.key);\n }\n}\nfunction removeDep(link) {\n const { prevDep, nextDep } = link;\n if (prevDep) {\n prevDep.nextDep = nextDep;\n link.prevDep = void 0;\n }\n if (nextDep) {\n nextDep.prevDep = prevDep;\n link.nextDep = void 0;\n }\n}\nfunction effect(fn, options) {\n if (fn.effect instanceof ReactiveEffect) {\n fn = fn.effect.fn;\n }\n const e = new ReactiveEffect(fn);\n if (options) {\n extend(e, options);\n }\n try {\n e.run();\n } catch (err) {\n e.stop();\n throw err;\n }\n const runner = e.run.bind(e);\n runner.effect = e;\n return runner;\n}\nfunction stop(runner) {\n runner.effect.stop();\n}\nlet shouldTrack = true;\nconst trackStack = [];\nfunction pauseTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = false;\n}\nfunction enableTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = true;\n}\nfunction resetTracking() {\n const last = trackStack.pop();\n shouldTrack = last === void 0 ? true : last;\n}\nfunction onEffectCleanup(fn, failSilently = false) {\n if (activeSub instanceof ReactiveEffect) {\n activeSub.cleanup = fn;\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onEffectCleanup() was called when there was no active effect to associate with.`\n );\n }\n}\nfunction cleanupEffect(e) {\n const { cleanup } = e;\n e.cleanup = void 0;\n if (cleanup) {\n const prevSub = activeSub;\n activeSub = void 0;\n try {\n cleanup();\n } finally {\n activeSub = prevSub;\n }\n }\n}\n\nlet globalVersion = 0;\nclass Link {\n constructor(sub, dep) {\n this.sub = sub;\n this.dep = dep;\n this.version = dep.version;\n this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;\n }\n}\nclass Dep {\n // TODO isolatedDeclarations \"__v_skip\"\n constructor(computed) {\n this.computed = computed;\n this.version = 0;\n /**\n * Link between this dep and the current active effect\n */\n this.activeLink = void 0;\n /**\n * Doubly linked list representing the subscribing effects (tail)\n */\n this.subs = void 0;\n /**\n * For object property deps cleanup\n */\n this.map = void 0;\n this.key = void 0;\n /**\n * Subscriber counter\n */\n this.sc = 0;\n /**\n * @internal\n */\n this.__v_skip = true;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.subsHead = void 0;\n }\n }\n track(debugInfo) {\n if (!activeSub || !shouldTrack || activeSub === this.computed) {\n return;\n }\n let link = this.activeLink;\n if (link === void 0 || link.sub !== activeSub) {\n link = this.activeLink = new Link(activeSub, this);\n if (!activeSub.deps) {\n activeSub.deps = activeSub.depsTail = link;\n } else {\n link.prevDep = activeSub.depsTail;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n }\n addSub(link);\n } else if (link.version === -1) {\n link.version = this.version;\n if (link.nextDep) {\n const next = link.nextDep;\n next.prevDep = link.prevDep;\n if (link.prevDep) {\n link.prevDep.nextDep = next;\n }\n link.prevDep = activeSub.depsTail;\n link.nextDep = void 0;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n if (activeSub.deps === link) {\n activeSub.deps = next;\n }\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub.onTrack) {\n activeSub.onTrack(\n extend(\n {\n effect: activeSub\n },\n debugInfo\n )\n );\n }\n return link;\n }\n trigger(debugInfo) {\n this.version++;\n globalVersion++;\n this.notify(debugInfo);\n }\n notify(debugInfo) {\n startBatch();\n try {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n for (let head = this.subsHead; head; head = head.nextSub) {\n if (head.sub.onTrigger && !(head.sub.flags & 8)) {\n head.sub.onTrigger(\n extend(\n {\n effect: head.sub\n },\n debugInfo\n )\n );\n }\n }\n }\n for (let link = this.subs; link; link = link.prevSub) {\n if (link.sub.notify()) {\n ;\n link.sub.dep.notify();\n }\n }\n } finally {\n endBatch();\n }\n }\n}\nfunction addSub(link) {\n link.dep.sc++;\n if (link.sub.flags & 4) {\n const computed = link.dep.computed;\n if (computed && !link.dep.subs) {\n computed.flags |= 4 | 16;\n for (let l = computed.deps; l; l = l.nextDep) {\n addSub(l);\n }\n }\n const currentTail = link.dep.subs;\n if (currentTail !== link) {\n link.prevSub = currentTail;\n if (currentTail) currentTail.nextSub = link;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && link.dep.subsHead === void 0) {\n link.dep.subsHead = link;\n }\n link.dep.subs = link;\n }\n}\nconst targetMap = /* @__PURE__ */ new WeakMap();\nconst ITERATE_KEY = /* @__PURE__ */ Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Object iterate\" : \"\"\n);\nconst MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Map keys iterate\" : \"\"\n);\nconst ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Array iterate\" : \"\"\n);\nfunction track(target, type, key) {\n if (shouldTrack && activeSub) {\n let depsMap = targetMap.get(target);\n if (!depsMap) {\n targetMap.set(target, depsMap = /* @__PURE__ */ new Map());\n }\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, dep = new Dep());\n dep.map = depsMap;\n dep.key = key;\n }\n if (!!(process.env.NODE_ENV !== \"production\")) {\n dep.track({\n target,\n type,\n key\n });\n } else {\n dep.track();\n }\n }\n}\nfunction trigger(target, type, key, newValue, oldValue, oldTarget) {\n const depsMap = targetMap.get(target);\n if (!depsMap) {\n globalVersion++;\n return;\n }\n const run = (dep) => {\n if (dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n dep.trigger({\n target,\n type,\n key,\n newValue,\n oldValue,\n oldTarget\n });\n } else {\n dep.trigger();\n }\n }\n };\n startBatch();\n if (type === \"clear\") {\n depsMap.forEach(run);\n } else {\n const targetIsArray = isArray(target);\n const isArrayIndex = targetIsArray && isIntegerKey(key);\n if (targetIsArray && key === \"length\") {\n const newLength = Number(newValue);\n depsMap.forEach((dep, key2) => {\n if (key2 === \"length\" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {\n run(dep);\n }\n });\n } else {\n if (key !== void 0 || depsMap.has(void 0)) {\n run(depsMap.get(key));\n }\n if (isArrayIndex) {\n run(depsMap.get(ARRAY_ITERATE_KEY));\n }\n switch (type) {\n case \"add\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n } else if (isArrayIndex) {\n run(depsMap.get(\"length\"));\n }\n break;\n case \"delete\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n }\n break;\n case \"set\":\n if (isMap(target)) {\n run(depsMap.get(ITERATE_KEY));\n }\n break;\n }\n }\n }\n endBatch();\n}\nfunction getDepFromReactive(object, key) {\n const depMap = targetMap.get(object);\n return depMap && depMap.get(key);\n}\n\nfunction reactiveReadArray(array) {\n const raw = toRaw(array);\n if (raw === array) return raw;\n track(raw, \"iterate\", ARRAY_ITERATE_KEY);\n return isShallow(array) ? raw : raw.map(toReactive);\n}\nfunction shallowReadArray(arr) {\n track(arr = toRaw(arr), \"iterate\", ARRAY_ITERATE_KEY);\n return arr;\n}\nfunction toWrapped(target, item) {\n if (isReadonly(target)) {\n return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);\n }\n return toReactive(item);\n}\nconst arrayInstrumentations = {\n __proto__: null,\n [Symbol.iterator]() {\n return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));\n },\n concat(...args) {\n return reactiveReadArray(this).concat(\n ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)\n );\n },\n entries() {\n return iterator(this, \"entries\", (value) => {\n value[1] = toWrapped(this, value[1]);\n return value;\n });\n },\n every(fn, thisArg) {\n return apply(this, \"every\", fn, thisArg, void 0, arguments);\n },\n filter(fn, thisArg) {\n return apply(\n this,\n \"filter\",\n fn,\n thisArg,\n (v) => v.map((item) => toWrapped(this, item)),\n arguments\n );\n },\n find(fn, thisArg) {\n return apply(\n this,\n \"find\",\n fn,\n thisArg,\n (item) => toWrapped(this, item),\n arguments\n );\n },\n findIndex(fn, thisArg) {\n return apply(this, \"findIndex\", fn, thisArg, void 0, arguments);\n },\n findLast(fn, thisArg) {\n return apply(\n this,\n \"findLast\",\n fn,\n thisArg,\n (item) => toWrapped(this, item),\n arguments\n );\n },\n findLastIndex(fn, thisArg) {\n return apply(this, \"findLastIndex\", fn, thisArg, void 0, arguments);\n },\n // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement\n forEach(fn, thisArg) {\n return apply(this, \"forEach\", fn, thisArg, void 0, arguments);\n },\n includes(...args) {\n return searchProxy(this, \"includes\", args);\n },\n indexOf(...args) {\n return searchProxy(this, \"indexOf\", args);\n },\n join(separator) {\n return reactiveReadArray(this).join(separator);\n },\n // keys() iterator only reads `length`, no optimization required\n lastIndexOf(...args) {\n return searchProxy(this, \"lastIndexOf\", args);\n },\n map(fn, thisArg) {\n return apply(this, \"map\", fn, thisArg, void 0, arguments);\n },\n pop() {\n return noTracking(this, \"pop\");\n },\n push(...args) {\n return noTracking(this, \"push\", args);\n },\n reduce(fn, ...args) {\n return reduce(this, \"reduce\", fn, args);\n },\n reduceRight(fn, ...args) {\n return reduce(this, \"reduceRight\", fn, args);\n },\n shift() {\n return noTracking(this, \"shift\");\n },\n // slice could use ARRAY_ITERATE but also seems to beg for range tracking\n some(fn, thisArg) {\n return apply(this, \"some\", fn, thisArg, void 0, arguments);\n },\n splice(...args) {\n return noTracking(this, \"splice\", args);\n },\n toReversed() {\n return reactiveReadArray(this).toReversed();\n },\n toSorted(comparer) {\n return reactiveReadArray(this).toSorted(comparer);\n },\n toSpliced(...args) {\n return reactiveReadArray(this).toSpliced(...args);\n },\n unshift(...args) {\n return noTracking(this, \"unshift\", args);\n },\n values() {\n return iterator(this, \"values\", (item) => toWrapped(this, item));\n }\n};\nfunction iterator(self, method, wrapValue) {\n const arr = shallowReadArray(self);\n const iter = arr[method]();\n if (arr !== self && !isShallow(self)) {\n iter._next = iter.next;\n iter.next = () => {\n const result = iter._next();\n if (!result.done) {\n result.value = wrapValue(result.value);\n }\n return result;\n };\n }\n return iter;\n}\nconst arrayProto = Array.prototype;\nfunction apply(self, method, fn, thisArg, wrappedRetFn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !isShallow(self);\n const methodFn = arr[method];\n if (methodFn !== arrayProto[method]) {\n const result2 = methodFn.apply(self, args);\n return needsWrap ? toReactive(result2) : result2;\n }\n let wrappedFn = fn;\n if (arr !== self) {\n if (needsWrap) {\n wrappedFn = function(item, index) {\n return fn.call(this, toWrapped(self, item), index, self);\n };\n } else if (fn.length > 2) {\n wrappedFn = function(item, index) {\n return fn.call(this, item, index, self);\n };\n }\n }\n const result = methodFn.call(arr, wrappedFn, thisArg);\n return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;\n}\nfunction reduce(self, method, fn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !isShallow(self);\n let wrappedFn = fn;\n let wrapInitialAccumulator = false;\n if (arr !== self) {\n if (needsWrap) {\n wrapInitialAccumulator = args.length === 0;\n wrappedFn = function(acc, item, index) {\n if (wrapInitialAccumulator) {\n wrapInitialAccumulator = false;\n acc = toWrapped(self, acc);\n }\n return fn.call(this, acc, toWrapped(self, item), index, self);\n };\n } else if (fn.length > 3) {\n wrappedFn = function(acc, item, index) {\n return fn.call(this, acc, item, index, self);\n };\n }\n }\n const result = arr[method](wrappedFn, ...args);\n return wrapInitialAccumulator ? toWrapped(self, result) : result;\n}\nfunction searchProxy(self, method, args) {\n const arr = toRaw(self);\n track(arr, \"iterate\", ARRAY_ITERATE_KEY);\n const res = arr[method](...args);\n if ((res === -1 || res === false) && isProxy(args[0])) {\n args[0] = toRaw(args[0]);\n return arr[method](...args);\n }\n return res;\n}\nfunction noTracking(self, method, args = []) {\n pauseTracking();\n startBatch();\n const res = toRaw(self)[method].apply(self, args);\n endBatch();\n resetTracking();\n return res;\n}\n\nconst isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);\nconst builtInSymbols = new Set(\n /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== \"arguments\" && key !== \"caller\").map((key) => Symbol[key]).filter(isSymbol)\n);\nfunction hasOwnProperty(key) {\n if (!isSymbol(key)) key = String(key);\n const obj = toRaw(this);\n track(obj, \"has\", key);\n return obj.hasOwnProperty(key);\n}\nclass BaseReactiveHandler {\n constructor(_isReadonly = false, _isShallow = false) {\n this._isReadonly = _isReadonly;\n this._isShallow = _isShallow;\n }\n get(target, key, receiver) {\n if (key === \"__v_skip\") return target[\"__v_skip\"];\n const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;\n if (key === \"__v_isReactive\") {\n return !isReadonly2;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly2;\n } else if (key === \"__v_isShallow\") {\n return isShallow2;\n } else if (key === \"__v_raw\") {\n if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype\n // this means the receiver is a user proxy of the reactive proxy\n Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {\n return target;\n }\n return;\n }\n const targetIsArray = isArray(target);\n if (!isReadonly2) {\n let fn;\n if (targetIsArray && (fn = arrayInstrumentations[key])) {\n return fn;\n }\n if (key === \"hasOwnProperty\") {\n return hasOwnProperty;\n }\n }\n const res = Reflect.get(\n target,\n key,\n // if this is a proxy wrapping a ref, return methods using the raw ref\n // as receiver so that we don't have to call `toRaw` on the ref in all\n // its class methods\n isRef(target) ? target : receiver\n );\n if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {\n return res;\n }\n if (!isReadonly2) {\n track(target, \"get\", key);\n }\n if (isShallow2) {\n return res;\n }\n if (isRef(res)) {\n const value = targetIsArray && isIntegerKey(key) ? res : res.value;\n return isReadonly2 && isObject(value) ? readonly(value) : value;\n }\n if (isObject(res)) {\n return isReadonly2 ? readonly(res) : reactive(res);\n }\n return res;\n }\n}\nclass MutableReactiveHandler extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(false, isShallow2);\n }\n set(target, key, value, receiver) {\n let oldValue = target[key];\n const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);\n if (!this._isShallow) {\n const isOldValueReadonly = isReadonly(oldValue);\n if (!isShallow(value) && !isReadonly(value)) {\n oldValue = toRaw(oldValue);\n value = toRaw(value);\n }\n if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {\n if (isOldValueReadonly) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Set operation on key \"${String(key)}\" failed: target is readonly.`,\n target[key]\n );\n }\n return true;\n } else {\n oldValue.value = value;\n return true;\n }\n }\n }\n const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);\n const result = Reflect.set(\n target,\n key,\n value,\n isRef(target) ? target : receiver\n );\n if (target === toRaw(receiver) && result) {\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n }\n return result;\n }\n deleteProperty(target, key) {\n const hadKey = hasOwn(target, key);\n const oldValue = target[key];\n const result = Reflect.deleteProperty(target, key);\n if (result && hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n }\n has(target, key) {\n const result = Reflect.has(target, key);\n if (!isSymbol(key) || !builtInSymbols.has(key)) {\n track(target, \"has\", key);\n }\n return result;\n }\n ownKeys(target) {\n track(\n target,\n \"iterate\",\n isArray(target) ? \"length\" : ITERATE_KEY\n );\n return Reflect.ownKeys(target);\n }\n}\nclass ReadonlyReactiveHandler extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(true, isShallow2);\n }\n set(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Set operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n }\n deleteProperty(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Delete operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n }\n}\nconst mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();\nconst readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();\nconst shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);\nconst shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);\n\nconst toShallow = (value) => value;\nconst getProto = (v) => Reflect.getPrototypeOf(v);\nfunction createIterableMethod(method, isReadonly2, isShallow2) {\n return function(...args) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const targetIsMap = isMap(rawTarget);\n const isPair = method === \"entries\" || method === Symbol.iterator && targetIsMap;\n const isKeyOnly = method === \"keys\" && targetIsMap;\n const innerIterator = target[method](...args);\n const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;\n !isReadonly2 && track(\n rawTarget,\n \"iterate\",\n isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY\n );\n return extend(\n // inheriting all iterator properties\n Object.create(innerIterator),\n {\n // iterator protocol\n next() {\n const { value, done } = innerIterator.next();\n return done ? { value, done } : {\n value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),\n done\n };\n }\n }\n );\n };\n}\nfunction createReadonlyMethod(type) {\n return function(...args) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const key = args[0] ? `on key \"${args[0]}\" ` : ``;\n warn(\n `${capitalize(type)} operation ${key}failed: target is readonly.`,\n toRaw(this)\n );\n }\n return type === \"delete\" ? false : type === \"clear\" ? void 0 : this;\n };\n}\nfunction createInstrumentations(readonly, shallow) {\n const instrumentations = {\n get(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) {\n track(rawTarget, \"get\", key);\n }\n track(rawTarget, \"get\", rawKey);\n }\n const { has } = getProto(rawTarget);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n if (has.call(rawTarget, key)) {\n return wrap(target.get(key));\n } else if (has.call(rawTarget, rawKey)) {\n return wrap(target.get(rawKey));\n } else if (target !== rawTarget) {\n target.get(key);\n }\n },\n get size() {\n const target = this[\"__v_raw\"];\n !readonly && track(toRaw(target), \"iterate\", ITERATE_KEY);\n return target.size;\n },\n has(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) {\n track(rawTarget, \"has\", key);\n }\n track(rawTarget, \"has\", rawKey);\n }\n return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);\n },\n forEach(callback, thisArg) {\n const observed = this;\n const target = observed[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n !readonly && track(rawTarget, \"iterate\", ITERATE_KEY);\n return target.forEach((value, key) => {\n return callback.call(thisArg, wrap(value), wrap(key), observed);\n });\n }\n };\n extend(\n instrumentations,\n readonly ? {\n add: createReadonlyMethod(\"add\"),\n set: createReadonlyMethod(\"set\"),\n delete: createReadonlyMethod(\"delete\"),\n clear: createReadonlyMethod(\"clear\")\n } : {\n add(value) {\n const target = toRaw(this);\n const proto = getProto(target);\n const rawValue = toRaw(value);\n const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;\n const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);\n if (!hadKey) {\n target.add(valueToAdd);\n trigger(target, \"add\", valueToAdd, valueToAdd);\n }\n return this;\n },\n set(key, value) {\n if (!shallow && !isShallow(value) && !isReadonly(value)) {\n value = toRaw(value);\n }\n const target = toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has, key);\n }\n const oldValue = get.call(target, key);\n target.set(key, value);\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n return this;\n },\n delete(key) {\n const target = toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has, key);\n }\n const oldValue = get ? get.call(target, key) : void 0;\n const result = target.delete(key);\n if (hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n },\n clear() {\n const target = toRaw(this);\n const hadItems = target.size !== 0;\n const oldTarget = !!(process.env.NODE_ENV !== \"production\") ? isMap(target) ? new Map(target) : new Set(target) : void 0;\n const result = target.clear();\n if (hadItems) {\n trigger(\n target,\n \"clear\",\n void 0,\n void 0,\n oldTarget\n );\n }\n return result;\n }\n }\n );\n const iteratorMethods = [\n \"keys\",\n \"values\",\n \"entries\",\n Symbol.iterator\n ];\n iteratorMethods.forEach((method) => {\n instrumentations[method] = createIterableMethod(method, readonly, shallow);\n });\n return instrumentations;\n}\nfunction createInstrumentationGetter(isReadonly2, shallow) {\n const instrumentations = createInstrumentations(isReadonly2, shallow);\n return (target, key, receiver) => {\n if (key === \"__v_isReactive\") {\n return !isReadonly2;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly2;\n } else if (key === \"__v_raw\") {\n return target;\n }\n return Reflect.get(\n hasOwn(instrumentations, key) && key in target ? instrumentations : target,\n key,\n receiver\n );\n };\n}\nconst mutableCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, false)\n};\nconst shallowCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, true)\n};\nconst readonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, false)\n};\nconst shallowReadonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, true)\n};\nfunction checkIdentityKeys(target, has, key) {\n const rawKey = toRaw(key);\n if (rawKey !== key && has.call(target, rawKey)) {\n const type = toRawType(target);\n warn(\n `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`\n );\n }\n}\n\nconst reactiveMap = /* @__PURE__ */ new WeakMap();\nconst shallowReactiveMap = /* @__PURE__ */ new WeakMap();\nconst readonlyMap = /* @__PURE__ */ new WeakMap();\nconst shallowReadonlyMap = /* @__PURE__ */ new WeakMap();\nfunction targetTypeMap(rawType) {\n switch (rawType) {\n case \"Object\":\n case \"Array\":\n return 1 /* COMMON */;\n case \"Map\":\n case \"Set\":\n case \"WeakMap\":\n case \"WeakSet\":\n return 2 /* COLLECTION */;\n default:\n return 0 /* INVALID */;\n }\n}\n// @__NO_SIDE_EFFECTS__\nfunction reactive(target) {\n if (/* @__PURE__ */ isReadonly(target)) {\n return target;\n }\n return createReactiveObject(\n target,\n false,\n mutableHandlers,\n mutableCollectionHandlers,\n reactiveMap\n );\n}\n// @__NO_SIDE_EFFECTS__\nfunction shallowReactive(target) {\n return createReactiveObject(\n target,\n false,\n shallowReactiveHandlers,\n shallowCollectionHandlers,\n shallowReactiveMap\n );\n}\n// @__NO_SIDE_EFFECTS__\nfunction readonly(target) {\n return createReactiveObject(\n target,\n true,\n readonlyHandlers,\n readonlyCollectionHandlers,\n readonlyMap\n );\n}\n// @__NO_SIDE_EFFECTS__\nfunction shallowReadonly(target) {\n return createReactiveObject(\n target,\n true,\n shallowReadonlyHandlers,\n shallowReadonlyCollectionHandlers,\n shallowReadonlyMap\n );\n}\nfunction createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {\n if (!isObject(target)) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `value cannot be made ${isReadonly2 ? \"readonly\" : \"reactive\"}: ${String(\n target\n )}`\n );\n }\n return target;\n }\n if (target[\"__v_raw\"] && !(isReadonly2 && target[\"__v_isReactive\"])) {\n return target;\n }\n if (target[\"__v_skip\"] || !Object.isExtensible(target)) {\n return target;\n }\n const existingProxy = proxyMap.get(target);\n if (existingProxy) {\n return existingProxy;\n }\n const targetType = targetTypeMap(toRawType(target));\n if (targetType === 0 /* INVALID */) {\n return target;\n }\n const proxy = new Proxy(\n target,\n targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers\n );\n proxyMap.set(target, proxy);\n return proxy;\n}\n// @__NO_SIDE_EFFECTS__\nfunction isReactive(value) {\n if (/* @__PURE__ */ isReadonly(value)) {\n return /* @__PURE__ */ isReactive(value[\"__v_raw\"]);\n }\n return !!(value && value[\"__v_isReactive\"]);\n}\n// @__NO_SIDE_EFFECTS__\nfunction isReadonly(value) {\n return !!(value && value[\"__v_isReadonly\"]);\n}\n// @__NO_SIDE_EFFECTS__\nfunction isShallow(value) {\n return !!(value && value[\"__v_isShallow\"]);\n}\n// @__NO_SIDE_EFFECTS__\nfunction isProxy(value) {\n return value ? !!value[\"__v_raw\"] : false;\n}\n// @__NO_SIDE_EFFECTS__\nfunction toRaw(observed) {\n const raw = observed && observed[\"__v_raw\"];\n return raw ? /* @__PURE__ */ toRaw(raw) : observed;\n}\nfunction markRaw(value) {\n if (!hasOwn(value, \"__v_skip\") && Object.isExtensible(value)) {\n def(value, \"__v_skip\", true);\n }\n return value;\n}\nconst toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;\nconst toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;\n\n// @__NO_SIDE_EFFECTS__\nfunction isRef(r) {\n return r ? r[\"__v_isRef\"] === true : false;\n}\n// @__NO_SIDE_EFFECTS__\nfunction ref(value) {\n return createRef(value, false);\n}\n// @__NO_SIDE_EFFECTS__\nfunction shallowRef(value) {\n return createRef(value, true);\n}\nfunction createRef(rawValue, shallow) {\n if (/* @__PURE__ */ isRef(rawValue)) {\n return rawValue;\n }\n return new RefImpl(rawValue, shallow);\n}\nclass RefImpl {\n constructor(value, isShallow2) {\n this.dep = new Dep();\n this[\"__v_isRef\"] = true;\n this[\"__v_isShallow\"] = false;\n this._rawValue = isShallow2 ? value : toRaw(value);\n this._value = isShallow2 ? value : toReactive(value);\n this[\"__v_isShallow\"] = isShallow2;\n }\n get value() {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.dep.track({\n target: this,\n type: \"get\",\n key: \"value\"\n });\n } else {\n this.dep.track();\n }\n return this._value;\n }\n set value(newValue) {\n const oldValue = this._rawValue;\n const useDirectValue = this[\"__v_isShallow\"] || isShallow(newValue) || isReadonly(newValue);\n newValue = useDirectValue ? newValue : toRaw(newValue);\n if (hasChanged(newValue, oldValue)) {\n this._rawValue = newValue;\n this._value = useDirectValue ? newValue : toReactive(newValue);\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.dep.trigger({\n target: this,\n type: \"set\",\n key: \"value\",\n newValue,\n oldValue\n });\n } else {\n this.dep.trigger();\n }\n }\n }\n}\nfunction triggerRef(ref2) {\n if (ref2.dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n ref2.dep.trigger({\n target: ref2,\n type: \"set\",\n key: \"value\",\n newValue: ref2._value\n });\n } else {\n ref2.dep.trigger();\n }\n }\n}\nfunction unref(ref2) {\n return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;\n}\nfunction toValue(source) {\n return isFunction(source) ? source() : unref(source);\n}\nconst shallowUnwrapHandlers = {\n get: (target, key, receiver) => key === \"__v_raw\" ? target : unref(Reflect.get(target, key, receiver)),\n set: (target, key, value, receiver) => {\n const oldValue = target[key];\n if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {\n oldValue.value = value;\n return true;\n } else {\n return Reflect.set(target, key, value, receiver);\n }\n }\n};\nfunction proxyRefs(objectWithRefs) {\n return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);\n}\nclass CustomRefImpl {\n constructor(factory) {\n this[\"__v_isRef\"] = true;\n this._value = void 0;\n const dep = this.dep = new Dep();\n const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));\n this._get = get;\n this._set = set;\n }\n get value() {\n return this._value = this._get();\n }\n set value(newVal) {\n this._set(newVal);\n }\n}\nfunction customRef(factory) {\n return new CustomRefImpl(factory);\n}\n// @__NO_SIDE_EFFECTS__\nfunction toRefs(object) {\n if (!!(process.env.NODE_ENV !== \"production\") && !isProxy(object)) {\n warn(`toRefs() expects a reactive object but received a plain one.`);\n }\n const ret = isArray(object) ? new Array(object.length) : {};\n for (const key in object) {\n ret[key] = propertyToRef(object, key);\n }\n return ret;\n}\nclass ObjectRefImpl {\n constructor(_object, key, _defaultValue) {\n this._object = _object;\n this._defaultValue = _defaultValue;\n this[\"__v_isRef\"] = true;\n this._value = void 0;\n this._key = isSymbol(key) ? key : String(key);\n this._raw = toRaw(_object);\n let shallow = true;\n let obj = _object;\n if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) {\n do {\n shallow = !isProxy(obj) || isShallow(obj);\n } while (shallow && (obj = obj[\"__v_raw\"]));\n }\n this._shallow = shallow;\n }\n get value() {\n let val = this._object[this._key];\n if (this._shallow) {\n val = unref(val);\n }\n return this._value = val === void 0 ? this._defaultValue : val;\n }\n set value(newVal) {\n if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {\n const nestedRef = this._object[this._key];\n if (/* @__PURE__ */ isRef(nestedRef)) {\n nestedRef.value = newVal;\n return;\n }\n }\n this._object[this._key] = newVal;\n }\n get dep() {\n return getDepFromReactive(this._raw, this._key);\n }\n}\nclass GetterRefImpl {\n constructor(_getter) {\n this._getter = _getter;\n this[\"__v_isRef\"] = true;\n this[\"__v_isReadonly\"] = true;\n this._value = void 0;\n }\n get value() {\n return this._value = this._getter();\n }\n}\n// @__NO_SIDE_EFFECTS__\nfunction toRef(source, key, defaultValue) {\n if (/* @__PURE__ */ isRef(source)) {\n return source;\n } else if (isFunction(source)) {\n return new GetterRefImpl(source);\n } else if (isObject(source) && arguments.length > 1) {\n return propertyToRef(source, key, defaultValue);\n } else {\n return /* @__PURE__ */ ref(source);\n }\n}\nfunction propertyToRef(source, key, defaultValue) {\n return new ObjectRefImpl(source, key, defaultValue);\n}\n\nclass ComputedRefImpl {\n constructor(fn, setter, isSSR) {\n this.fn = fn;\n this.setter = setter;\n /**\n * @internal\n */\n this._value = void 0;\n /**\n * @internal\n */\n this.dep = new Dep(this);\n /**\n * @internal\n */\n this.__v_isRef = true;\n // TODO isolatedDeclarations \"__v_isReadonly\"\n // A computed is also a subscriber that tracks other deps\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 16;\n /**\n * @internal\n */\n this.globalVersion = globalVersion - 1;\n /**\n * @internal\n */\n this.next = void 0;\n // for backwards compat\n this.effect = this;\n this[\"__v_isReadonly\"] = !setter;\n this.isSSR = isSSR;\n }\n /**\n * @internal\n */\n notify() {\n this.flags |= 16;\n if (!(this.flags & 8) && // avoid infinite self recursion\n activeSub !== this) {\n batch(this, true);\n return true;\n } else if (!!(process.env.NODE_ENV !== \"production\")) ;\n }\n get value() {\n const link = !!(process.env.NODE_ENV !== \"production\") ? this.dep.track({\n target: this,\n type: \"get\",\n key: \"value\"\n }) : this.dep.track();\n refreshComputed(this);\n if (link) {\n link.version = this.dep.version;\n }\n return this._value;\n }\n set value(newValue) {\n if (this.setter) {\n this.setter(newValue);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\"Write operation failed: computed value is readonly\");\n }\n }\n}\n// @__NO_SIDE_EFFECTS__\nfunction computed(getterOrOptions, debugOptions, isSSR = false) {\n let getter;\n let setter;\n if (isFunction(getterOrOptions)) {\n getter = getterOrOptions;\n } else {\n getter = getterOrOptions.get;\n setter = getterOrOptions.set;\n }\n const cRef = new ComputedRefImpl(getter, setter, isSSR);\n if (!!(process.env.NODE_ENV !== \"production\") && debugOptions && !isSSR) {\n cRef.onTrack = debugOptions.onTrack;\n cRef.onTrigger = debugOptions.onTrigger;\n }\n return cRef;\n}\n\nconst TrackOpTypes = {\n \"GET\": \"get\",\n \"HAS\": \"has\",\n \"ITERATE\": \"iterate\"\n};\nconst TriggerOpTypes = {\n \"SET\": \"set\",\n \"ADD\": \"add\",\n \"DELETE\": \"delete\",\n \"CLEAR\": \"clear\"\n};\nconst ReactiveFlags = {\n \"SKIP\": \"__v_skip\",\n \"IS_REACTIVE\": \"__v_isReactive\",\n \"IS_READONLY\": \"__v_isReadonly\",\n \"IS_SHALLOW\": \"__v_isShallow\",\n \"RAW\": \"__v_raw\",\n \"IS_REF\": \"__v_isRef\"\n};\n\nconst WatchErrorCodes = {\n \"WATCH_GETTER\": 2,\n \"2\": \"WATCH_GETTER\",\n \"WATCH_CALLBACK\": 3,\n \"3\": \"WATCH_CALLBACK\",\n \"WATCH_CLEANUP\": 4,\n \"4\": \"WATCH_CLEANUP\"\n};\nconst INITIAL_WATCHER_VALUE = {};\nconst cleanupMap = /* @__PURE__ */ new WeakMap();\nlet activeWatcher = void 0;\nfunction getCurrentWatcher() {\n return activeWatcher;\n}\nfunction onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {\n if (owner) {\n let cleanups = cleanupMap.get(owner);\n if (!cleanups) cleanupMap.set(owner, cleanups = []);\n cleanups.push(cleanupFn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onWatcherCleanup() was called when there was no active watcher to associate with.`\n );\n }\n}\nfunction watch(source, cb, options = EMPTY_OBJ) {\n const { immediate, deep, once, scheduler, augmentJob, call } = options;\n const warnInvalidSource = (s) => {\n (options.onWarn || warn)(\n `Invalid watch source: `,\n s,\n `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`\n );\n };\n const reactiveGetter = (source2) => {\n if (deep) return source2;\n if (isShallow(source2) || deep === false || deep === 0)\n return traverse(source2, 1);\n return traverse(source2);\n };\n let effect;\n let getter;\n let cleanup;\n let boundCleanup;\n let forceTrigger = false;\n let isMultiSource = false;\n if (isRef(source)) {\n getter = () => source.value;\n forceTrigger = isShallow(source);\n } else if (isReactive(source)) {\n getter = () => reactiveGetter(source);\n forceTrigger = true;\n } else if (isArray(source)) {\n isMultiSource = true;\n forceTrigger = source.some((s) => isReactive(s) || isShallow(s));\n getter = () => source.map((s) => {\n if (isRef(s)) {\n return s.value;\n } else if (isReactive(s)) {\n return reactiveGetter(s);\n } else if (isFunction(s)) {\n return call ? call(s, 2) : s();\n } else {\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(s);\n }\n });\n } else if (isFunction(source)) {\n if (cb) {\n getter = call ? () => call(source, 2) : source;\n } else {\n getter = () => {\n if (cleanup) {\n pauseTracking();\n try {\n cleanup();\n } finally {\n resetTracking();\n }\n }\n const currentEffect = activeWatcher;\n activeWatcher = effect;\n try {\n return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);\n } finally {\n activeWatcher = currentEffect;\n }\n };\n }\n } else {\n getter = NOOP;\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(source);\n }\n if (cb && deep) {\n const baseGetter = getter;\n const depth = deep === true ? Infinity : deep;\n getter = () => traverse(baseGetter(), depth);\n }\n const scope = getCurrentScope();\n const watchHandle = () => {\n effect.stop();\n if (scope && scope.active) {\n remove(scope.effects, effect);\n }\n };\n if (once && cb) {\n const _cb = cb;\n cb = (...args) => {\n const res = _cb(...args);\n watchHandle();\n return res;\n };\n }\n let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;\n const job = (immediateFirstRun) => {\n if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {\n return;\n }\n if (cb) {\n const newValue = effect.run();\n if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {\n if (cleanup) {\n cleanup();\n }\n const currentWatcher = activeWatcher;\n activeWatcher = effect;\n try {\n const args = [\n newValue,\n // pass undefined as the old value when it's changed for the first time\n oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,\n boundCleanup\n ];\n oldValue = newValue;\n call ? call(cb, 3, args) : (\n // @ts-expect-error\n cb(...args)\n );\n } finally {\n activeWatcher = currentWatcher;\n }\n }\n } else {\n effect.run();\n }\n };\n if (augmentJob) {\n augmentJob(job);\n }\n effect = new ReactiveEffect(getter);\n effect.scheduler = scheduler ? () => scheduler(job, false) : job;\n boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);\n cleanup = effect.onStop = () => {\n const cleanups = cleanupMap.get(effect);\n if (cleanups) {\n if (call) {\n call(cleanups, 4);\n } else {\n for (const cleanup2 of cleanups) cleanup2();\n }\n cleanupMap.delete(effect);\n }\n };\n if (!!(process.env.NODE_ENV !== \"production\")) {\n effect.onTrack = options.onTrack;\n effect.onTrigger = options.onTrigger;\n }\n if (cb) {\n if (immediate) {\n job(true);\n } else {\n oldValue = effect.run();\n }\n } else if (scheduler) {\n scheduler(job.bind(null, true), true);\n } else {\n effect.run();\n }\n watchHandle.pause = effect.pause.bind(effect);\n watchHandle.resume = effect.resume.bind(effect);\n watchHandle.stop = watchHandle;\n return watchHandle;\n}\nfunction traverse(value, depth = Infinity, seen) {\n if (depth <= 0 || !isObject(value) || value[\"__v_skip\"]) {\n return value;\n }\n seen = seen || /* @__PURE__ */ new Map();\n if ((seen.get(value) || 0) >= depth) {\n return value;\n }\n seen.set(value, depth);\n depth--;\n if (isRef(value)) {\n traverse(value.value, depth, seen);\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n traverse(value[i], depth, seen);\n }\n } else if (isSet(value) || isMap(value)) {\n value.forEach((v) => {\n traverse(v, depth, seen);\n });\n } else if (isPlainObject(value)) {\n for (const key in value) {\n traverse(value[key], depth, seen);\n }\n for (const key of Object.getOwnPropertySymbols(value)) {\n if (Object.prototype.propertyIsEnumerable.call(value, key)) {\n traverse(value[key], depth, seen);\n }\n }\n }\n return value;\n}\n\nexport { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };\n",
|
|
5
|
+
"/**\n* @vue/shared v3.5.43\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\n// @__NO_SIDE_EFFECTS__\nfunction makeMap(str) {\n const map = /* @__PURE__ */ Object.create(null);\n for (const key of str.split(\",\")) map[key] = 1;\n return (val) => val in map;\n}\n\nconst EMPTY_OBJ = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze({}) : {};\nconst EMPTY_ARR = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze([]) : [];\nconst NOOP = () => {\n};\nconst NO = () => false;\nconst isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter\n(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);\nconst isModelListener = (key) => key.startsWith(\"onUpdate:\");\nconst extend = Object.assign;\nconst remove = (arr, el) => {\n const i = arr.indexOf(el);\n if (i > -1) {\n arr.splice(i, 1);\n }\n};\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nconst hasOwn = (val, key) => hasOwnProperty.call(val, key);\nconst isArray = Array.isArray;\nconst isMap = (val) => toTypeString(val) === \"[object Map]\";\nconst isSet = (val) => toTypeString(val) === \"[object Set]\";\nconst isDate = (val) => toTypeString(val) === \"[object Date]\";\nconst isRegExp = (val) => toTypeString(val) === \"[object RegExp]\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isString = (val) => typeof val === \"string\";\nconst isSymbol = (val) => typeof val === \"symbol\";\nconst isObject = (val) => val !== null && typeof val === \"object\";\nconst isPromise = (val) => {\n return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);\n};\nconst objectToString = Object.prototype.toString;\nconst toTypeString = (value) => objectToString.call(value);\nconst toRawType = (value) => {\n return toTypeString(value).slice(8, -1);\n};\nconst isPlainObject = (val) => toTypeString(val) === \"[object Object]\";\nconst isIntegerKey = (key) => isString(key) && key !== \"NaN\" && key[0] !== \"-\" && \"\" + parseInt(key, 10) === key;\nconst isReservedProp = /* @__PURE__ */ makeMap(\n // the leading comma is intentional so empty string \"\" is also included\n \",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted\"\n);\nconst isBuiltInDirective = /* @__PURE__ */ makeMap(\n \"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo\"\n);\nconst cacheStringFunction = (fn) => {\n const cache = /* @__PURE__ */ Object.create(null);\n return ((str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n });\n};\nconst camelizeRE = /-\\w/g;\nconst camelize = cacheStringFunction(\n (str) => {\n return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());\n }\n);\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction(\n (str) => str.replace(hyphenateRE, \"-$1\").toLowerCase()\n);\nconst capitalize = cacheStringFunction((str) => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n});\nconst toHandlerKey = cacheStringFunction(\n (str) => {\n const s = str ? `on${capitalize(str)}` : ``;\n return s;\n }\n);\nconst hasChanged = (value, oldValue) => !Object.is(value, oldValue);\nconst invokeArrayFns = (fns, ...arg) => {\n for (let i = 0; i < fns.length; i++) {\n fns[i](...arg);\n }\n};\nconst def = (obj, key, value, writable = false) => {\n Object.defineProperty(obj, key, {\n configurable: true,\n enumerable: false,\n writable,\n value\n });\n};\nconst looseToNumber = (val) => {\n const n = parseFloat(val);\n return isNaN(n) ? val : n;\n};\nconst toNumber = (val) => {\n const n = isString(val) ? Number(val) : NaN;\n return isNaN(n) ? val : n;\n};\nlet _globalThis;\nconst getGlobalThis = () => {\n return _globalThis || (_globalThis = typeof globalThis !== \"undefined\" ? globalThis : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : {});\n};\nconst identRE = /^[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*$/;\nfunction genPropsAccessExp(name) {\n return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;\n}\nfunction genCacheKey(source, options) {\n return source + JSON.stringify(\n options,\n (_, val) => typeof val === \"function\" ? val.toString() : val\n );\n}\n\nconst PatchFlags = {\n \"TEXT\": 1,\n \"1\": \"TEXT\",\n \"CLASS\": 2,\n \"2\": \"CLASS\",\n \"STYLE\": 4,\n \"4\": \"STYLE\",\n \"PROPS\": 8,\n \"8\": \"PROPS\",\n \"FULL_PROPS\": 16,\n \"16\": \"FULL_PROPS\",\n \"NEED_HYDRATION\": 32,\n \"32\": \"NEED_HYDRATION\",\n \"STABLE_FRAGMENT\": 64,\n \"64\": \"STABLE_FRAGMENT\",\n \"KEYED_FRAGMENT\": 128,\n \"128\": \"KEYED_FRAGMENT\",\n \"UNKEYED_FRAGMENT\": 256,\n \"256\": \"UNKEYED_FRAGMENT\",\n \"NEED_PATCH\": 512,\n \"512\": \"NEED_PATCH\",\n \"DYNAMIC_SLOTS\": 1024,\n \"1024\": \"DYNAMIC_SLOTS\",\n \"DEV_ROOT_FRAGMENT\": 2048,\n \"2048\": \"DEV_ROOT_FRAGMENT\",\n \"CACHED\": -1,\n \"-1\": \"CACHED\",\n \"BAIL\": -2,\n \"-2\": \"BAIL\"\n};\nconst PatchFlagNames = {\n [1]: `TEXT`,\n [2]: `CLASS`,\n [4]: `STYLE`,\n [8]: `PROPS`,\n [16]: `FULL_PROPS`,\n [32]: `NEED_HYDRATION`,\n [64]: `STABLE_FRAGMENT`,\n [128]: `KEYED_FRAGMENT`,\n [256]: `UNKEYED_FRAGMENT`,\n [512]: `NEED_PATCH`,\n [1024]: `DYNAMIC_SLOTS`,\n [2048]: `DEV_ROOT_FRAGMENT`,\n [-1]: `CACHED`,\n [-2]: `BAIL`\n};\n\nconst ShapeFlags = {\n \"ELEMENT\": 1,\n \"1\": \"ELEMENT\",\n \"FUNCTIONAL_COMPONENT\": 2,\n \"2\": \"FUNCTIONAL_COMPONENT\",\n \"STATEFUL_COMPONENT\": 4,\n \"4\": \"STATEFUL_COMPONENT\",\n \"TEXT_CHILDREN\": 8,\n \"8\": \"TEXT_CHILDREN\",\n \"ARRAY_CHILDREN\": 16,\n \"16\": \"ARRAY_CHILDREN\",\n \"SLOTS_CHILDREN\": 32,\n \"32\": \"SLOTS_CHILDREN\",\n \"TELEPORT\": 64,\n \"64\": \"TELEPORT\",\n \"SUSPENSE\": 128,\n \"128\": \"SUSPENSE\",\n \"COMPONENT_SHOULD_KEEP_ALIVE\": 256,\n \"256\": \"COMPONENT_SHOULD_KEEP_ALIVE\",\n \"COMPONENT_KEPT_ALIVE\": 512,\n \"512\": \"COMPONENT_KEPT_ALIVE\",\n \"COMPONENT\": 6,\n \"6\": \"COMPONENT\"\n};\n\nconst SlotFlags = {\n \"STABLE\": 1,\n \"1\": \"STABLE\",\n \"DYNAMIC\": 2,\n \"2\": \"DYNAMIC\",\n \"FORWARDED\": 3,\n \"3\": \"FORWARDED\"\n};\nconst slotFlagsText = {\n [1]: \"STABLE\",\n [2]: \"DYNAMIC\",\n [3]: \"FORWARDED\"\n};\n\nconst GLOBALS_ALLOWED = \"Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol\";\nconst isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);\nconst isGloballyWhitelisted = isGloballyAllowed;\n\nconst range = 2;\nfunction generateCodeFrame(source, start = 0, end = source.length) {\n start = Math.max(0, Math.min(start, source.length));\n end = Math.max(0, Math.min(end, source.length));\n if (start > end) return \"\";\n let lines = source.split(/(\\r?\\n)/);\n const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);\n lines = lines.filter((_, idx) => idx % 2 === 0);\n let count = 0;\n const res = [];\n for (let i = 0; i < lines.length; i++) {\n count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);\n if (count >= start) {\n for (let j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length) continue;\n const line = j + 1;\n res.push(\n `${line}${\" \".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`\n );\n const lineLength = lines[j].length;\n const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;\n if (j === i) {\n const pad = start - (count - (lineLength + newLineSeqLength));\n const length = Math.max(\n 1,\n end > count ? lineLength - pad : end - start\n );\n res.push(` | ` + \" \".repeat(pad) + \"^\".repeat(length));\n } else if (j > i) {\n if (end > count) {\n const length = Math.max(Math.min(end - count, lineLength), 1);\n res.push(` | ` + \"^\".repeat(length));\n }\n count += lineLength + newLineSeqLength;\n }\n }\n break;\n }\n }\n return res.join(\"\\n\");\n}\n\nfunction normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);\n if (normalized) {\n for (const key in normalized) {\n res[key] = normalized[key];\n }\n }\n }\n return res;\n } else if (isString(value) || isObject(value)) {\n return value;\n }\n}\nconst listDelimiterRE = /;(?![^(]*\\))/g;\nconst propertyDelimiterRE = /:([^]+)/;\nconst styleCommentRE = /\"(?:[^\"\\\\]|\\\\[^])*\"|'(?:[^'\\\\]|\\\\[^])*'|\\\\[^]|\\/\\*[^]*?\\*\\//g;\nfunction parseStringStyle(cssText) {\n const ret = {};\n cssText.replace(styleCommentRE, (match) => match.startsWith(\"/*\") ? \"\" : match).split(listDelimiterRE).forEach((item) => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n}\nfunction stringifyStyle(styles) {\n if (!styles) return \"\";\n if (isString(styles)) return styles;\n let ret = \"\";\n for (const key in styles) {\n const value = styles[key];\n if (isString(value) || typeof value === \"number\") {\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\n ret += `${normalizedKey}:${value};`;\n }\n }\n return ret;\n}\nfunction normalizeClass(value) {\n let res = \"\";\n if (isString(value)) {\n res = value;\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) {\n res += normalized + \" \";\n }\n }\n } else if (isObject(value)) {\n for (const name in value) {\n if (value[name]) {\n res += name + \" \";\n }\n }\n }\n return res.trim();\n}\nfunction normalizeProps(props) {\n if (!props) return null;\n let { class: klass, style } = props;\n if (klass && !isString(klass)) {\n props.class = normalizeClass(klass);\n }\n if (style) {\n props.style = normalizeStyle(style);\n }\n return props;\n}\n\nconst HTML_TAGS = \"html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot\";\nconst SVG_TAGS = \"svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view\";\nconst MATH_TAGS = \"annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics\";\nconst VOID_TAGS = \"area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr\";\nconst isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);\nconst isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);\nconst isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);\nconst isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);\n\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\nconst isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);\nconst isBooleanAttr = /* @__PURE__ */ makeMap(\n specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`\n);\nfunction includeBooleanAttr(value) {\n return !!value || value === \"\";\n}\nconst unsafeAttrCharRE = /[>/=\"'\\u0009\\u000a\\u000c\\u000d\\u0020]/;\nconst attrValidationCache = {};\nfunction isSSRSafeAttrName(name) {\n if (attrValidationCache.hasOwnProperty(name)) {\n return attrValidationCache[name];\n }\n const isUnsafe = unsafeAttrCharRE.test(name);\n if (isUnsafe) {\n console.error(`unsafe attribute name: ${name}`);\n }\n return attrValidationCache[name] = !isUnsafe;\n}\nconst propsToAttrMap = {\n acceptCharset: \"accept-charset\",\n className: \"class\",\n htmlFor: \"for\",\n httpEquiv: \"http-equiv\"\n};\nconst isKnownHtmlAttr = /* @__PURE__ */ makeMap(\n `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`\n);\nconst isKnownSvgAttr = /* @__PURE__ */ makeMap(\n `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`\n);\nconst isKnownMathMLAttr = /* @__PURE__ */ makeMap(\n `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`\n);\nfunction isRenderableAttrValue(value) {\n if (value == null) {\n return false;\n }\n const type = typeof value;\n return type === \"string\" || type === \"number\" || type === \"boolean\";\n}\n\nconst escapeRE = /[\"'&<>]/;\nfunction escapeHtml(string) {\n const str = \"\" + string;\n const match = escapeRE.exec(str);\n if (!match) {\n return str;\n }\n let html = \"\";\n let escaped;\n let index;\n let lastIndex = 0;\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34:\n escaped = \""\";\n break;\n case 38:\n escaped = \"&\";\n break;\n case 39:\n escaped = \"'\";\n break;\n case 60:\n escaped = \"<\";\n break;\n case 62:\n escaped = \">\";\n break;\n default:\n continue;\n }\n if (lastIndex !== index) {\n html += str.slice(lastIndex, index);\n }\n lastIndex = index + 1;\n html += escaped;\n }\n return lastIndex !== index ? html + str.slice(lastIndex, index) : html;\n}\nconst commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;\nfunction escapeHtmlComment(src) {\n let prev;\n do {\n prev = src;\n src = src.replace(commentStripRE, \"\");\n } while (src !== prev);\n return src;\n}\nconst cssVarNameEscapeSymbolsRE = /[ !\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~]/g;\nfunction getEscapedCssVarName(key, doubleEscape) {\n return key.replace(\n cssVarNameEscapeSymbolsRE,\n (s) => doubleEscape ? s === '\"' ? '\\\\\\\\\\\\\"' : `\\\\\\\\${s}` : `\\\\${s}`\n );\n}\n\nfunction looseCompareArrays(a, b, seen) {\n if (a.length !== b.length) return false;\n let equal = true;\n for (let i = 0; equal && i < a.length; i++) {\n equal = looseEqual(a[i], b[i], seen);\n }\n return equal;\n}\nfunction looseCompareCollections(a, b, seen) {\n if (a.size !== b.size) return false;\n const candidates = Array.from(b);\n const matched = new Uint8Array(candidates.length);\n for (const item of a) {\n let index = -1;\n for (let i = 0; i < candidates.length; i++) {\n if (!matched[i] && looseEqual(item, candidates[i], seen)) {\n index = i;\n break;\n }\n }\n if (index < 0) return false;\n matched[index] = 1;\n }\n return true;\n}\nfunction looseCompareObjects(a, b, seen) {\n let aValidType = isMap(a);\n let bValidType = isMap(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;\n }\n aValidType = isSet(a);\n bValidType = isSet(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;\n }\n const aKeysCount = Object.keys(a).length;\n const bKeysCount = Object.keys(b).length;\n if (aKeysCount !== bKeysCount) {\n return false;\n }\n for (const key in a) {\n const aHasKey = a.hasOwnProperty(key);\n const bHasKey = b.hasOwnProperty(key);\n if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {\n return false;\n }\n }\n return String(a) === String(b);\n}\nfunction looseCompareNested(a, b, seen, compare) {\n if (!seen) {\n seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];\n }\n const [seenA, seenB] = seen;\n if (seenA.has(a) || seenB.has(b)) {\n return seenA.get(a) === b && seenB.get(b) === a;\n }\n seenA.set(a, b);\n seenB.set(b, a);\n const equal = compare(a, b, seen);\n seenA.delete(a);\n seenB.delete(b);\n return equal;\n}\nfunction looseEqual(a, b, seen) {\n if (a === b) return true;\n let aValidType = isDate(a);\n let bValidType = isDate(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? a.getTime() === b.getTime() : false;\n }\n aValidType = isSymbol(a);\n bValidType = isSymbol(b);\n if (aValidType || bValidType) {\n return a === b;\n }\n aValidType = isArray(a);\n bValidType = isArray(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;\n }\n aValidType = isObject(a);\n bValidType = isObject(b);\n if (aValidType || bValidType) {\n if (!aValidType || !bValidType) {\n return false;\n }\n return looseCompareNested(a, b, seen, looseCompareObjects);\n }\n return String(a) === String(b);\n}\nfunction looseIndexOf(arr, val) {\n return arr.findIndex((item) => looseEqual(item, val));\n}\n\nconst isRef = (val) => {\n return !!(val && val[\"__v_isRef\"] === true);\n};\nconst toDisplayString = (val) => {\n return isString(val) ? val : val == null ? \"\" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);\n};\nconst replacer = (_key, val) => {\n if (isRef(val)) {\n return replacer(_key, val.value);\n } else if (isMap(val)) {\n return {\n [`Map(${val.size})`]: [...val.entries()].reduce(\n (entries, [key, val2], i) => {\n entries[stringifySymbol(key, i) + \" =>\"] = val2;\n return entries;\n },\n {}\n )\n };\n } else if (isSet(val)) {\n return {\n [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))\n };\n } else if (isSymbol(val)) {\n return stringifySymbol(val);\n } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {\n return String(val);\n }\n return val;\n};\nconst stringifySymbol = (v, i = \"\") => {\n var _a;\n return (\n // Symbol.description in es2019+ so we need to cast here to pass\n // the lib: es2016 check\n isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v\n );\n};\n\nfunction normalizeCssVarValue(value) {\n if (value == null) {\n return \"initial\";\n }\n if (typeof value === \"string\") {\n return value === \"\" ? \" \" : value;\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n console.warn(\n \"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:\",\n value\n );\n }\n }\n return String(value);\n}\n\nexport { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };\n",
|
|
6
|
+
"/**\n* @vue/reactivity v3.5.43\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\nimport { extend, hasChanged, isArray, isIntegerKey, isSymbol, isMap, hasOwn, isObject, makeMap, capitalize, toRawType, def, isFunction, EMPTY_OBJ, isSet, isPlainObject, remove, NOOP } from '@vue/shared';\n\nfunction warn(msg, ...args) {\n console.warn(`[Vue warn] ${msg}`, ...args);\n}\n\nlet activeEffectScope;\nclass EffectScope {\n // TODO isolatedDeclarations \"__v_skip\"\n constructor(detached = false) {\n this.detached = detached;\n /**\n * @internal\n */\n this._active = true;\n /**\n * @internal track `on` calls, allow `on` call multiple times\n */\n this._on = 0;\n /**\n * @internal\n */\n this.effects = [];\n /**\n * @internal\n */\n this.cleanups = [];\n this._isPaused = false;\n this._warnOnRun = true;\n this.__v_skip = true;\n if (!detached && activeEffectScope) {\n if (activeEffectScope.active) {\n this.parent = activeEffectScope;\n this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(\n this\n ) - 1;\n } else {\n this._active = false;\n this._warnOnRun = false;\n }\n }\n }\n get active() {\n return this._active;\n }\n pause() {\n if (this._active) {\n this._isPaused = true;\n let i, l;\n if (this.scopes) {\n const scopes = this.scopes.slice();\n for (i = 0, l = scopes.length; i < l; i++) {\n scopes[i].pause();\n }\n }\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].pause();\n }\n }\n }\n /**\n * Resumes the effect scope, including all child scopes and effects.\n */\n resume() {\n if (this._active) {\n if (this._isPaused) {\n this._isPaused = false;\n let i, l;\n if (this.scopes) {\n const scopes = this.scopes.slice();\n for (i = 0, l = scopes.length; i < l; i++) {\n scopes[i].resume();\n }\n }\n const effects = this.effects.slice();\n for (i = 0, l = effects.length; i < l; i++) {\n effects[i].resume();\n }\n }\n }\n }\n run(fn) {\n if (this._active) {\n const currentEffectScope = activeEffectScope;\n try {\n activeEffectScope = this;\n return fn();\n } finally {\n activeEffectScope = currentEffectScope;\n }\n } else if (!!(process.env.NODE_ENV !== \"production\") && this._warnOnRun) {\n warn(`cannot run an inactive effect scope.`);\n }\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n on() {\n if (++this._on === 1) {\n this.prevScope = activeEffectScope;\n activeEffectScope = this;\n }\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n off() {\n if (this._on > 0 && --this._on === 0) {\n if (activeEffectScope === this) {\n activeEffectScope = this.prevScope;\n } else {\n let current = activeEffectScope;\n while (current) {\n if (current.prevScope === this) {\n current.prevScope = this.prevScope;\n break;\n }\n current = current.prevScope;\n }\n }\n this.prevScope = void 0;\n }\n }\n stop(fromParent) {\n if (this._active) {\n this._active = false;\n let i, l;\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].stop();\n }\n this.effects.length = 0;\n for (i = 0, l = this.cleanups.length; i < l; i++) {\n this.cleanups[i]();\n }\n this.cleanups.length = 0;\n if (this.scopes) {\n const scopes = this.scopes.slice();\n for (i = 0, l = scopes.length; i < l; i++) {\n scopes[i].stop(true);\n }\n this.scopes.length = 0;\n }\n if (!this.detached && this.parent && !fromParent) {\n const last = this.parent.scopes.pop();\n if (last && last !== this) {\n this.parent.scopes[this.index] = last;\n last.index = this.index;\n }\n }\n this.parent = void 0;\n }\n }\n}\nfunction effectScope(detached) {\n return new EffectScope(detached);\n}\nfunction getCurrentScope() {\n return activeEffectScope;\n}\nfunction onScopeDispose(fn, failSilently = false) {\n if (activeEffectScope) {\n activeEffectScope.cleanups.push(fn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onScopeDispose() is called when there is no active effect scope to be associated with.`\n );\n }\n}\n\nlet activeSub;\nconst EffectFlags = {\n \"ACTIVE\": 1,\n \"1\": \"ACTIVE\",\n \"RUNNING\": 2,\n \"2\": \"RUNNING\",\n \"TRACKING\": 4,\n \"4\": \"TRACKING\",\n \"NOTIFIED\": 8,\n \"8\": \"NOTIFIED\",\n \"DIRTY\": 16,\n \"16\": \"DIRTY\",\n \"ALLOW_RECURSE\": 32,\n \"32\": \"ALLOW_RECURSE\",\n \"PAUSED\": 64,\n \"64\": \"PAUSED\",\n \"EVALUATED\": 128,\n \"128\": \"EVALUATED\"\n};\nconst pausedQueueEffects = /* @__PURE__ */ new WeakSet();\nclass ReactiveEffect {\n constructor(fn) {\n this.fn = fn;\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 1 | 4;\n /**\n * @internal\n */\n this.next = void 0;\n /**\n * @internal\n */\n this.cleanup = void 0;\n this.scheduler = void 0;\n if (activeEffectScope) {\n if (activeEffectScope.active) {\n activeEffectScope.effects.push(this);\n } else {\n this.flags &= -2;\n }\n }\n }\n pause() {\n this.flags |= 64;\n }\n resume() {\n if (this.flags & 64) {\n this.flags &= -65;\n if (pausedQueueEffects.has(this)) {\n pausedQueueEffects.delete(this);\n this.trigger();\n }\n }\n }\n /**\n * @internal\n */\n notify() {\n if (this.flags & 2 && !(this.flags & 32)) {\n return;\n }\n if (!(this.flags & 8)) {\n batch(this);\n }\n }\n run() {\n if (!(this.flags & 1)) {\n return this.fn();\n }\n this.flags |= 2;\n cleanupEffect(this);\n prepareDeps(this);\n const prevEffect = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = this;\n shouldTrack = true;\n try {\n return this.fn();\n } finally {\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub !== this) {\n warn(\n \"Active effect was not restored correctly - this is likely a Vue internal bug.\"\n );\n }\n cleanupDeps(this);\n activeSub = prevEffect;\n shouldTrack = prevShouldTrack;\n this.flags &= -3;\n }\n }\n stop() {\n if (this.flags & 1) {\n for (let link = this.deps; link; link = link.nextDep) {\n removeSub(link);\n }\n this.deps = this.depsTail = void 0;\n cleanupEffect(this);\n this.onStop && this.onStop();\n this.flags &= -2;\n }\n }\n trigger() {\n if (this.flags & 64) {\n pausedQueueEffects.add(this);\n } else if (this.scheduler) {\n this.scheduler();\n } else {\n this.runIfDirty();\n }\n }\n /**\n * @internal\n */\n runIfDirty() {\n if (isDirty(this)) {\n this.run();\n }\n }\n get dirty() {\n return isDirty(this);\n }\n}\nlet batchDepth = 0;\nlet batchedSub;\nlet batchedComputed;\nfunction batch(sub, isComputed = false) {\n sub.flags |= 8;\n if (isComputed) {\n sub.next = batchedComputed;\n batchedComputed = sub;\n return;\n }\n sub.next = batchedSub;\n batchedSub = sub;\n}\nfunction startBatch() {\n batchDepth++;\n}\nfunction endBatch() {\n if (--batchDepth > 0) {\n return;\n }\n if (batchedComputed) {\n let e = batchedComputed;\n batchedComputed = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n e = next;\n }\n }\n let error;\n while (batchedSub) {\n let e = batchedSub;\n batchedSub = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n if (e.flags & 1) {\n try {\n ;\n e.trigger();\n } catch (err) {\n if (!error) error = err;\n }\n }\n e = next;\n }\n }\n if (error) throw error;\n}\nfunction prepareDeps(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n link.version = -1;\n link.prevActiveLink = link.dep.activeLink;\n link.dep.activeLink = link;\n }\n}\nfunction cleanupDeps(sub) {\n let head;\n let tail = sub.depsTail;\n let link = tail;\n while (link) {\n const prev = link.prevDep;\n if (link.version === -1) {\n if (link === tail) tail = prev;\n removeSub(link);\n removeDep(link);\n } else {\n head = link;\n }\n link.dep.activeLink = link.prevActiveLink;\n link.prevActiveLink = void 0;\n link = prev;\n }\n sub.deps = head;\n sub.depsTail = tail;\n}\nfunction isDirty(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {\n return true;\n }\n }\n if (sub._dirty) {\n return true;\n }\n return false;\n}\nfunction refreshComputed(computed) {\n if (computed.flags & 4 && !(computed.flags & 16)) {\n return;\n }\n computed.flags &= -17;\n if (computed.globalVersion === globalVersion) {\n return;\n }\n computed.globalVersion = globalVersion;\n if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {\n return;\n }\n computed.flags |= 2;\n const dep = computed.dep;\n const prevSub = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = computed;\n shouldTrack = true;\n try {\n prepareDeps(computed);\n const value = computed.fn(computed._value);\n if (dep.version === 0 || hasChanged(value, computed._value)) {\n computed.flags |= 128;\n computed._value = value;\n dep.version++;\n }\n } catch (err) {\n dep.version++;\n throw err;\n } finally {\n activeSub = prevSub;\n shouldTrack = prevShouldTrack;\n cleanupDeps(computed);\n computed.flags &= -3;\n }\n}\nfunction removeSub(link, soft = false) {\n const { dep, prevSub, nextSub } = link;\n if (prevSub) {\n prevSub.nextSub = nextSub;\n link.prevSub = void 0;\n }\n if (nextSub) {\n nextSub.prevSub = prevSub;\n link.nextSub = void 0;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && dep.subsHead === link) {\n dep.subsHead = nextSub;\n }\n if (dep.subs === link) {\n dep.subs = prevSub;\n if (!prevSub && dep.computed) {\n dep.computed.flags &= -5;\n for (let l = dep.computed.deps; l; l = l.nextDep) {\n removeSub(l, true);\n }\n }\n }\n if (!soft && !--dep.sc && dep.map) {\n dep.map.delete(dep.key);\n }\n}\nfunction removeDep(link) {\n const { prevDep, nextDep } = link;\n if (prevDep) {\n prevDep.nextDep = nextDep;\n link.prevDep = void 0;\n }\n if (nextDep) {\n nextDep.prevDep = prevDep;\n link.nextDep = void 0;\n }\n}\nfunction effect(fn, options) {\n if (fn.effect instanceof ReactiveEffect) {\n fn = fn.effect.fn;\n }\n const e = new ReactiveEffect(fn);\n if (options) {\n extend(e, options);\n }\n try {\n e.run();\n } catch (err) {\n e.stop();\n throw err;\n }\n const runner = e.run.bind(e);\n runner.effect = e;\n return runner;\n}\nfunction stop(runner) {\n runner.effect.stop();\n}\nlet shouldTrack = true;\nconst trackStack = [];\nfunction pauseTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = false;\n}\nfunction enableTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = true;\n}\nfunction resetTracking() {\n const last = trackStack.pop();\n shouldTrack = last === void 0 ? true : last;\n}\nfunction onEffectCleanup(fn, failSilently = false) {\n if (activeSub instanceof ReactiveEffect) {\n activeSub.cleanup = fn;\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onEffectCleanup() was called when there was no active effect to associate with.`\n );\n }\n}\nfunction cleanupEffect(e) {\n const { cleanup } = e;\n e.cleanup = void 0;\n if (cleanup) {\n const prevSub = activeSub;\n activeSub = void 0;\n try {\n cleanup();\n } finally {\n activeSub = prevSub;\n }\n }\n}\n\nlet globalVersion = 0;\nclass Link {\n constructor(sub, dep) {\n this.sub = sub;\n this.dep = dep;\n this.version = dep.version;\n this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;\n }\n}\nclass Dep {\n // TODO isolatedDeclarations \"__v_skip\"\n constructor(computed) {\n this.computed = computed;\n this.version = 0;\n /**\n * Link between this dep and the current active effect\n */\n this.activeLink = void 0;\n /**\n * Doubly linked list representing the subscribing effects (tail)\n */\n this.subs = void 0;\n /**\n * For object property deps cleanup\n */\n this.map = void 0;\n this.key = void 0;\n /**\n * Subscriber counter\n */\n this.sc = 0;\n /**\n * @internal\n */\n this.__v_skip = true;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.subsHead = void 0;\n }\n }\n track(debugInfo) {\n if (!activeSub || !shouldTrack || activeSub === this.computed) {\n return;\n }\n let link = this.activeLink;\n if (link === void 0 || link.sub !== activeSub) {\n link = this.activeLink = new Link(activeSub, this);\n if (!activeSub.deps) {\n activeSub.deps = activeSub.depsTail = link;\n } else {\n link.prevDep = activeSub.depsTail;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n }\n addSub(link);\n } else if (link.version === -1) {\n link.version = this.version;\n if (link.nextDep) {\n const next = link.nextDep;\n next.prevDep = link.prevDep;\n if (link.prevDep) {\n link.prevDep.nextDep = next;\n }\n link.prevDep = activeSub.depsTail;\n link.nextDep = void 0;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n if (activeSub.deps === link) {\n activeSub.deps = next;\n }\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub.onTrack) {\n activeSub.onTrack(\n extend(\n {\n effect: activeSub\n },\n debugInfo\n )\n );\n }\n return link;\n }\n trigger(debugInfo) {\n this.version++;\n globalVersion++;\n this.notify(debugInfo);\n }\n notify(debugInfo) {\n startBatch();\n try {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n for (let head = this.subsHead; head; head = head.nextSub) {\n if (head.sub.onTrigger && !(head.sub.flags & 8)) {\n head.sub.onTrigger(\n extend(\n {\n effect: head.sub\n },\n debugInfo\n )\n );\n }\n }\n }\n for (let link = this.subs; link; link = link.prevSub) {\n if (link.sub.notify()) {\n ;\n link.sub.dep.notify();\n }\n }\n } finally {\n endBatch();\n }\n }\n}\nfunction addSub(link) {\n link.dep.sc++;\n if (link.sub.flags & 4) {\n const computed = link.dep.computed;\n if (computed && !link.dep.subs) {\n computed.flags |= 4 | 16;\n for (let l = computed.deps; l; l = l.nextDep) {\n addSub(l);\n }\n }\n const currentTail = link.dep.subs;\n if (currentTail !== link) {\n link.prevSub = currentTail;\n if (currentTail) currentTail.nextSub = link;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && link.dep.subsHead === void 0) {\n link.dep.subsHead = link;\n }\n link.dep.subs = link;\n }\n}\nconst targetMap = /* @__PURE__ */ new WeakMap();\nconst ITERATE_KEY = /* @__PURE__ */ Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Object iterate\" : \"\"\n);\nconst MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Map keys iterate\" : \"\"\n);\nconst ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Array iterate\" : \"\"\n);\nfunction track(target, type, key) {\n if (shouldTrack && activeSub) {\n let depsMap = targetMap.get(target);\n if (!depsMap) {\n targetMap.set(target, depsMap = /* @__PURE__ */ new Map());\n }\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, dep = new Dep());\n dep.map = depsMap;\n dep.key = key;\n }\n if (!!(process.env.NODE_ENV !== \"production\")) {\n dep.track({\n target,\n type,\n key\n });\n } else {\n dep.track();\n }\n }\n}\nfunction trigger(target, type, key, newValue, oldValue, oldTarget) {\n const depsMap = targetMap.get(target);\n if (!depsMap) {\n globalVersion++;\n return;\n }\n const run = (dep) => {\n if (dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n dep.trigger({\n target,\n type,\n key,\n newValue,\n oldValue,\n oldTarget\n });\n } else {\n dep.trigger();\n }\n }\n };\n startBatch();\n if (type === \"clear\") {\n depsMap.forEach(run);\n } else {\n const targetIsArray = isArray(target);\n const isArrayIndex = targetIsArray && isIntegerKey(key);\n if (targetIsArray && key === \"length\") {\n const newLength = Number(newValue);\n depsMap.forEach((dep, key2) => {\n if (key2 === \"length\" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {\n run(dep);\n }\n });\n } else {\n if (key !== void 0 || depsMap.has(void 0)) {\n run(depsMap.get(key));\n }\n if (isArrayIndex) {\n run(depsMap.get(ARRAY_ITERATE_KEY));\n }\n switch (type) {\n case \"add\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n } else if (isArrayIndex) {\n run(depsMap.get(\"length\"));\n }\n break;\n case \"delete\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n }\n break;\n case \"set\":\n if (isMap(target)) {\n run(depsMap.get(ITERATE_KEY));\n }\n break;\n }\n }\n }\n endBatch();\n}\nfunction getDepFromReactive(object, key) {\n const depMap = targetMap.get(object);\n return depMap && depMap.get(key);\n}\n\nfunction reactiveReadArray(array) {\n const raw = toRaw(array);\n if (raw === array) return raw;\n track(raw, \"iterate\", ARRAY_ITERATE_KEY);\n if (isShallow(array)) return raw;\n if (!isReadonly(array)) return raw.map(toReactive);\n return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);\n}\nfunction shallowReadArray(arr) {\n track(arr = toRaw(arr), \"iterate\", ARRAY_ITERATE_KEY);\n return arr;\n}\nfunction toWrapped(target, item) {\n if (isReadonly(target)) {\n return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);\n }\n return toReactive(item);\n}\nconst arrayInstrumentations = {\n __proto__: null,\n [Symbol.iterator]() {\n return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));\n },\n concat(...args) {\n return reactiveReadArray(this).concat(\n ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)\n );\n },\n entries() {\n return iterator(this, \"entries\", (value) => {\n value[1] = toWrapped(this, value[1]);\n return value;\n });\n },\n every(fn, thisArg) {\n return apply(this, \"every\", fn, thisArg, void 0, arguments);\n },\n filter(fn, thisArg) {\n return apply(\n this,\n \"filter\",\n fn,\n thisArg,\n (v) => v.map((item) => toWrapped(this, item)),\n arguments\n );\n },\n find(fn, thisArg) {\n return apply(\n this,\n \"find\",\n fn,\n thisArg,\n (item) => toWrapped(this, item),\n arguments\n );\n },\n findIndex(fn, thisArg) {\n return apply(this, \"findIndex\", fn, thisArg, void 0, arguments);\n },\n findLast(fn, thisArg) {\n return apply(\n this,\n \"findLast\",\n fn,\n thisArg,\n (item) => toWrapped(this, item),\n arguments\n );\n },\n findLastIndex(fn, thisArg) {\n return apply(this, \"findLastIndex\", fn, thisArg, void 0, arguments);\n },\n // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement\n forEach(fn, thisArg) {\n return apply(this, \"forEach\", fn, thisArg, void 0, arguments);\n },\n includes(...args) {\n return searchProxy(this, \"includes\", args);\n },\n indexOf(...args) {\n return searchProxy(this, \"indexOf\", args);\n },\n join(separator) {\n return reactiveReadArray(this).join(separator);\n },\n // keys() iterator only reads `length`, no optimization required\n lastIndexOf(...args) {\n return searchProxy(this, \"lastIndexOf\", args);\n },\n map(fn, thisArg) {\n return apply(this, \"map\", fn, thisArg, void 0, arguments);\n },\n pop() {\n return noTracking(this, \"pop\");\n },\n push(...args) {\n return noTracking(this, \"push\", args);\n },\n reduce(fn, ...args) {\n return reduce(this, \"reduce\", fn, args);\n },\n reduceRight(fn, ...args) {\n return reduce(this, \"reduceRight\", fn, args);\n },\n shift() {\n return noTracking(this, \"shift\");\n },\n // slice could use ARRAY_ITERATE but also seems to beg for range tracking\n some(fn, thisArg) {\n return apply(this, \"some\", fn, thisArg, void 0, arguments);\n },\n splice(...args) {\n return noTracking(this, \"splice\", args);\n },\n toReversed() {\n return reactiveReadArray(this).toReversed();\n },\n toSorted(comparer) {\n return reactiveReadArray(this).toSorted(comparer);\n },\n toSpliced(...args) {\n return reactiveReadArray(this).toSpliced(...args);\n },\n unshift(...args) {\n return noTracking(this, \"unshift\", args);\n },\n values() {\n return iterator(this, \"values\", (item) => toWrapped(this, item));\n }\n};\nfunction iterator(self, method, wrapValue) {\n const arr = shallowReadArray(self);\n const iter = arr[method]();\n if (arr !== self && !isShallow(self)) {\n iter._next = iter.next;\n iter.next = () => {\n const result = iter._next();\n if (!result.done) {\n result.value = wrapValue(result.value);\n }\n return result;\n };\n }\n return iter;\n}\nconst arrayProto = Array.prototype;\nfunction apply(self, method, fn, thisArg, wrappedRetFn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !isShallow(self);\n const methodFn = arr[method];\n if (methodFn !== arrayProto[method]) {\n const result2 = methodFn.apply(self, args);\n return needsWrap ? toReactive(result2) : result2;\n }\n let wrappedFn = fn;\n if (arr !== self) {\n if (needsWrap) {\n wrappedFn = function(item, index) {\n return fn.call(this, toWrapped(self, item), index, self);\n };\n } else if (fn.length > 2) {\n wrappedFn = function(item, index) {\n return fn.call(this, item, index, self);\n };\n }\n }\n const result = methodFn.call(arr, wrappedFn, thisArg);\n return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;\n}\nfunction reduce(self, method, fn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !isShallow(self);\n let wrappedFn = fn;\n let wrapInitialAccumulator = false;\n if (arr !== self) {\n if (needsWrap) {\n wrapInitialAccumulator = args.length === 0;\n wrappedFn = function(acc, item, index) {\n if (wrapInitialAccumulator) {\n wrapInitialAccumulator = false;\n acc = toWrapped(self, acc);\n }\n return fn.call(this, acc, toWrapped(self, item), index, self);\n };\n } else if (fn.length > 3) {\n wrappedFn = function(acc, item, index) {\n return fn.call(this, acc, item, index, self);\n };\n }\n }\n const result = arr[method](wrappedFn, ...args);\n return wrapInitialAccumulator ? toWrapped(self, result) : result;\n}\nfunction searchProxy(self, method, args) {\n const arr = toRaw(self);\n track(arr, \"iterate\", ARRAY_ITERATE_KEY);\n const res = arr[method](...args);\n if ((res === -1 || res === false) && isProxy(args[0])) {\n args[0] = toRaw(args[0]);\n return arr[method](...args);\n }\n return res;\n}\nfunction noTracking(self, method, args = []) {\n pauseTracking();\n startBatch();\n const res = toRaw(self)[method].apply(self, args);\n endBatch();\n resetTracking();\n return res;\n}\n\nconst isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);\nconst builtInSymbols = new Set(\n /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== \"arguments\" && key !== \"caller\").map((key) => Symbol[key]).filter(isSymbol)\n);\nfunction hasOwnProperty(key) {\n if (!isSymbol(key)) key = String(key);\n const obj = toRaw(this);\n track(obj, \"has\", key);\n return obj.hasOwnProperty(key);\n}\nclass BaseReactiveHandler {\n constructor(_isReadonly = false, _isShallow = false) {\n this._isReadonly = _isReadonly;\n this._isShallow = _isShallow;\n }\n get(target, key, receiver) {\n if (key === \"__v_skip\") return target[\"__v_skip\"];\n const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;\n if (key === \"__v_isReactive\") {\n return !isReadonly2;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly2;\n } else if (key === \"__v_isShallow\") {\n return isShallow2;\n } else if (key === \"__v_raw\") {\n if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype\n // this means the receiver is a user proxy of the reactive proxy\n Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {\n return target;\n }\n return;\n }\n const targetIsArray = isArray(target);\n if (!isReadonly2) {\n let fn;\n if (targetIsArray && (fn = arrayInstrumentations[key])) {\n return fn;\n }\n if (key === \"hasOwnProperty\") {\n return hasOwnProperty;\n }\n }\n const res = Reflect.get(\n target,\n key,\n // if this is a proxy wrapping a ref, return methods using the raw ref\n // as receiver so that we don't have to call `toRaw` on the ref in all\n // its class methods\n isRef(target) ? target : receiver\n );\n if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {\n return res;\n }\n if (!isReadonly2) {\n track(target, \"get\", key);\n }\n if (isShallow2) {\n return res;\n }\n if (isRef(res)) {\n const value = targetIsArray && isIntegerKey(key) ? res : res.value;\n return isReadonly2 && isObject(value) ? readonly(value) : value;\n }\n if (isObject(res)) {\n return isReadonly2 ? readonly(res) : reactive(res);\n }\n return res;\n }\n}\nclass MutableReactiveHandler extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(false, isShallow2);\n }\n set(target, key, value, receiver) {\n let oldValue = target[key];\n const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);\n if (!this._isShallow) {\n const isOldValueReadonly = isReadonly(oldValue);\n if (!isShallow(value) && !isReadonly(value)) {\n oldValue = toRaw(oldValue);\n value = toRaw(value);\n }\n if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {\n if (isOldValueReadonly) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Set operation on key \"${String(key)}\" failed: target is readonly.`,\n target[key]\n );\n }\n return true;\n } else {\n oldValue.value = value;\n return true;\n }\n }\n }\n const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);\n const result = Reflect.set(\n target,\n key,\n value,\n isRef(target) ? target : receiver\n );\n if (target === toRaw(receiver) && result) {\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n }\n return result;\n }\n deleteProperty(target, key) {\n const hadKey = hasOwn(target, key);\n const oldValue = target[key];\n const result = Reflect.deleteProperty(target, key);\n if (result && hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n }\n has(target, key) {\n const result = Reflect.has(target, key);\n if (!isSymbol(key) || !builtInSymbols.has(key)) {\n track(target, \"has\", key);\n }\n return result;\n }\n ownKeys(target) {\n track(\n target,\n \"iterate\",\n isArray(target) ? \"length\" : ITERATE_KEY\n );\n return Reflect.ownKeys(target);\n }\n}\nclass ReadonlyReactiveHandler extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(true, isShallow2);\n }\n set(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Set operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n }\n deleteProperty(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Delete operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n }\n}\nconst mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();\nconst readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();\nconst shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);\nconst shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);\n\nconst toShallow = (value) => value;\nconst getProto = (v) => Reflect.getPrototypeOf(v);\nfunction createIterableMethod(method, isReadonly2, isShallow2) {\n return function(...args) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const targetIsMap = isMap(rawTarget);\n const isPair = method === \"entries\" || method === Symbol.iterator && targetIsMap;\n const isKeyOnly = method === \"keys\" && targetIsMap;\n const innerIterator = target[method](...args);\n const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;\n !isReadonly2 && track(\n rawTarget,\n \"iterate\",\n isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY\n );\n return extend(\n // inheriting all iterator properties\n Object.create(innerIterator),\n {\n // iterator protocol\n next() {\n const { value, done } = innerIterator.next();\n return done ? { value, done } : {\n value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),\n done\n };\n }\n }\n );\n };\n}\nfunction createReadonlyMethod(type) {\n return function(...args) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const key = args[0] ? `on key \"${args[0]}\" ` : ``;\n warn(\n `${capitalize(type)} operation ${key}failed: target is readonly.`,\n toRaw(this)\n );\n }\n return type === \"delete\" ? false : type === \"clear\" ? void 0 : this;\n };\n}\nfunction createInstrumentations(readonly, shallow) {\n const instrumentations = {\n get(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) {\n track(rawTarget, \"get\", key);\n }\n track(rawTarget, \"get\", rawKey);\n }\n const { has } = getProto(rawTarget);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n if (has.call(rawTarget, key)) {\n return wrap(target.get(key));\n } else if (has.call(rawTarget, rawKey)) {\n return wrap(target.get(rawKey));\n } else if (target !== rawTarget) {\n target.get(key);\n }\n },\n get size() {\n const target = this[\"__v_raw\"];\n !readonly && track(toRaw(target), \"iterate\", ITERATE_KEY);\n return target.size;\n },\n has(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) {\n track(rawTarget, \"has\", key);\n }\n track(rawTarget, \"has\", rawKey);\n }\n return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);\n },\n forEach(callback, thisArg) {\n const observed = this;\n const target = observed[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n !readonly && track(rawTarget, \"iterate\", ITERATE_KEY);\n return target.forEach((value, key) => {\n return callback.call(thisArg, wrap(value), wrap(key), observed);\n });\n }\n };\n extend(\n instrumentations,\n readonly ? {\n add: createReadonlyMethod(\"add\"),\n set: createReadonlyMethod(\"set\"),\n delete: createReadonlyMethod(\"delete\"),\n clear: createReadonlyMethod(\"clear\")\n } : {\n add(value) {\n const target = toRaw(this);\n const proto = getProto(target);\n const rawValue = toRaw(value);\n const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;\n const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);\n if (!hadKey) {\n target.add(valueToAdd);\n trigger(target, \"add\", valueToAdd, valueToAdd);\n }\n return this;\n },\n set(key, value) {\n if (!shallow && !isShallow(value) && !isReadonly(value)) {\n value = toRaw(value);\n }\n const target = toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has, key);\n }\n const oldValue = get.call(target, key);\n target.set(key, value);\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n return this;\n },\n delete(key) {\n const target = toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has, key);\n }\n const oldValue = get ? get.call(target, key) : void 0;\n const result = target.delete(key);\n if (hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n },\n clear() {\n const target = toRaw(this);\n const hadItems = target.size !== 0;\n const oldTarget = !!(process.env.NODE_ENV !== \"production\") ? isMap(target) ? new Map(target) : new Set(target) : void 0;\n const result = target.clear();\n if (hadItems) {\n trigger(\n target,\n \"clear\",\n void 0,\n void 0,\n oldTarget\n );\n }\n return result;\n }\n }\n );\n const iteratorMethods = [\n \"keys\",\n \"values\",\n \"entries\",\n Symbol.iterator\n ];\n iteratorMethods.forEach((method) => {\n instrumentations[method] = createIterableMethod(method, readonly, shallow);\n });\n return instrumentations;\n}\nfunction createInstrumentationGetter(isReadonly2, shallow) {\n const instrumentations = createInstrumentations(isReadonly2, shallow);\n return (target, key, receiver) => {\n if (key === \"__v_isReactive\") {\n return !isReadonly2;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly2;\n } else if (key === \"__v_raw\") {\n return target;\n }\n return Reflect.get(\n hasOwn(instrumentations, key) && key in target ? instrumentations : target,\n key,\n receiver\n );\n };\n}\nconst mutableCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, false)\n};\nconst shallowCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, true)\n};\nconst readonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, false)\n};\nconst shallowReadonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, true)\n};\nfunction checkIdentityKeys(target, has, key) {\n const rawKey = toRaw(key);\n if (rawKey !== key && has.call(target, rawKey)) {\n const type = toRawType(target);\n warn(\n `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`\n );\n }\n}\n\nconst reactiveMap = /* @__PURE__ */ new WeakMap();\nconst shallowReactiveMap = /* @__PURE__ */ new WeakMap();\nconst readonlyMap = /* @__PURE__ */ new WeakMap();\nconst shallowReadonlyMap = /* @__PURE__ */ new WeakMap();\nfunction targetTypeMap(rawType) {\n switch (rawType) {\n case \"Object\":\n case \"Array\":\n return 1 /* COMMON */;\n case \"Map\":\n case \"Set\":\n case \"WeakMap\":\n case \"WeakSet\":\n return 2 /* COLLECTION */;\n default:\n return 0 /* INVALID */;\n }\n}\n// @__NO_SIDE_EFFECTS__\nfunction reactive(target) {\n if (/* @__PURE__ */ isReadonly(target)) {\n return target;\n }\n return createReactiveObject(\n target,\n false,\n mutableHandlers,\n mutableCollectionHandlers,\n reactiveMap\n );\n}\n// @__NO_SIDE_EFFECTS__\nfunction shallowReactive(target) {\n return createReactiveObject(\n target,\n false,\n shallowReactiveHandlers,\n shallowCollectionHandlers,\n shallowReactiveMap\n );\n}\n// @__NO_SIDE_EFFECTS__\nfunction readonly(target) {\n return createReactiveObject(\n target,\n true,\n readonlyHandlers,\n readonlyCollectionHandlers,\n readonlyMap\n );\n}\n// @__NO_SIDE_EFFECTS__\nfunction shallowReadonly(target) {\n return createReactiveObject(\n target,\n true,\n shallowReadonlyHandlers,\n shallowReadonlyCollectionHandlers,\n shallowReadonlyMap\n );\n}\nfunction createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {\n if (!isObject(target)) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `value cannot be made ${isReadonly2 ? \"readonly\" : \"reactive\"}: ${String(\n target\n )}`\n );\n }\n return target;\n }\n if (target[\"__v_raw\"] && !(isReadonly2 && target[\"__v_isReactive\"])) {\n return target;\n }\n if (target[\"__v_skip\"] || !Object.isExtensible(target)) {\n return target;\n }\n const existingProxy = proxyMap.get(target);\n if (existingProxy) {\n return existingProxy;\n }\n const targetType = targetTypeMap(toRawType(target));\n if (targetType === 0 /* INVALID */) {\n return target;\n }\n const proxy = new Proxy(\n target,\n targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers\n );\n proxyMap.set(target, proxy);\n return proxy;\n}\n// @__NO_SIDE_EFFECTS__\nfunction isReactive(value) {\n if (/* @__PURE__ */ isReadonly(value)) {\n return /* @__PURE__ */ isReactive(value[\"__v_raw\"]);\n }\n return !!(value && value[\"__v_isReactive\"]);\n}\n// @__NO_SIDE_EFFECTS__\nfunction isReadonly(value) {\n return !!(value && value[\"__v_isReadonly\"]);\n}\n// @__NO_SIDE_EFFECTS__\nfunction isShallow(value) {\n return !!(value && value[\"__v_isShallow\"]);\n}\n// @__NO_SIDE_EFFECTS__\nfunction isProxy(value) {\n return value ? !!value[\"__v_raw\"] : false;\n}\n// @__NO_SIDE_EFFECTS__\nfunction toRaw(observed) {\n const raw = observed && observed[\"__v_raw\"];\n return raw ? /* @__PURE__ */ toRaw(raw) : observed;\n}\nfunction markRaw(value) {\n if (!hasOwn(value, \"__v_skip\") && Object.isExtensible(value)) {\n def(value, \"__v_skip\", true);\n }\n return value;\n}\nconst toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;\nconst toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;\n\n// @__NO_SIDE_EFFECTS__\nfunction isRef(r) {\n return r ? r[\"__v_isRef\"] === true : false;\n}\n// @__NO_SIDE_EFFECTS__\nfunction ref(value) {\n return createRef(value, false);\n}\n// @__NO_SIDE_EFFECTS__\nfunction shallowRef(value) {\n return createRef(value, true);\n}\nfunction createRef(rawValue, shallow) {\n if (/* @__PURE__ */ isRef(rawValue)) {\n return rawValue;\n }\n return new RefImpl(rawValue, shallow);\n}\nclass RefImpl {\n constructor(value, isShallow2) {\n this.dep = new Dep();\n this[\"__v_isRef\"] = true;\n this[\"__v_isShallow\"] = false;\n this._rawValue = isShallow2 ? value : toRaw(value);\n this._value = isShallow2 ? value : toReactive(value);\n this[\"__v_isShallow\"] = isShallow2;\n }\n get value() {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.dep.track({\n target: this,\n type: \"get\",\n key: \"value\"\n });\n } else {\n this.dep.track();\n }\n return this._value;\n }\n set value(newValue) {\n const oldValue = this._rawValue;\n const useDirectValue = this[\"__v_isShallow\"] || isShallow(newValue) || isReadonly(newValue);\n newValue = useDirectValue ? newValue : toRaw(newValue);\n if (hasChanged(newValue, oldValue)) {\n this._rawValue = newValue;\n this._value = useDirectValue ? newValue : toReactive(newValue);\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.dep.trigger({\n target: this,\n type: \"set\",\n key: \"value\",\n newValue,\n oldValue\n });\n } else {\n this.dep.trigger();\n }\n }\n }\n}\nfunction triggerRef(ref2) {\n if (ref2.dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n ref2.dep.trigger({\n target: ref2,\n type: \"set\",\n key: \"value\",\n newValue: ref2._value\n });\n } else {\n ref2.dep.trigger();\n }\n }\n}\nfunction unref(ref2) {\n return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;\n}\nfunction toValue(source) {\n return isFunction(source) ? source() : unref(source);\n}\nconst shallowUnwrapHandlers = {\n get: (target, key, receiver) => key === \"__v_raw\" ? target : unref(Reflect.get(target, key, receiver)),\n set: (target, key, value, receiver) => {\n const oldValue = target[key];\n if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {\n oldValue.value = value;\n return true;\n } else {\n return Reflect.set(target, key, value, receiver);\n }\n }\n};\nfunction proxyRefs(objectWithRefs) {\n return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);\n}\nclass CustomRefImpl {\n constructor(factory) {\n this[\"__v_isRef\"] = true;\n this._value = void 0;\n const dep = this.dep = new Dep();\n const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));\n this._get = get;\n this._set = set;\n }\n get value() {\n return this._value = this._get();\n }\n set value(newVal) {\n this._set(newVal);\n }\n}\nfunction customRef(factory) {\n return new CustomRefImpl(factory);\n}\n// @__NO_SIDE_EFFECTS__\nfunction toRefs(object) {\n if (!!(process.env.NODE_ENV !== \"production\") && !isProxy(object)) {\n warn(`toRefs() expects a reactive object but received a plain one.`);\n }\n const ret = isArray(object) ? new Array(object.length) : {};\n for (const key in object) {\n ret[key] = propertyToRef(object, key);\n }\n return ret;\n}\nclass ObjectRefImpl {\n constructor(_object, key, _defaultValue) {\n this._object = _object;\n this._defaultValue = _defaultValue;\n this[\"__v_isRef\"] = true;\n this._value = void 0;\n this._key = isSymbol(key) ? key : String(key);\n this._raw = toRaw(_object);\n let shallow = true;\n let obj = _object;\n if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) {\n do {\n shallow = !isProxy(obj) || isShallow(obj);\n } while (shallow && (obj = obj[\"__v_raw\"]));\n }\n this._shallow = shallow;\n }\n get value() {\n let val = this._object[this._key];\n if (this._shallow) {\n val = unref(val);\n }\n return this._value = val === void 0 ? this._defaultValue : val;\n }\n set value(newVal) {\n if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {\n const nestedRef = this._object[this._key];\n if (/* @__PURE__ */ isRef(nestedRef)) {\n nestedRef.value = newVal;\n return;\n }\n }\n this._object[this._key] = newVal;\n }\n get dep() {\n return getDepFromReactive(this._raw, this._key);\n }\n}\nclass GetterRefImpl {\n constructor(_getter) {\n this._getter = _getter;\n this[\"__v_isRef\"] = true;\n this[\"__v_isReadonly\"] = true;\n this._value = void 0;\n }\n get value() {\n return this._value = this._getter();\n }\n}\n// @__NO_SIDE_EFFECTS__\nfunction toRef(source, key, defaultValue) {\n if (/* @__PURE__ */ isRef(source)) {\n return source;\n } else if (isFunction(source)) {\n return new GetterRefImpl(source);\n } else if (isObject(source) && arguments.length > 1) {\n return propertyToRef(source, key, defaultValue);\n } else {\n return /* @__PURE__ */ ref(source);\n }\n}\nfunction propertyToRef(source, key, defaultValue) {\n return new ObjectRefImpl(source, key, defaultValue);\n}\n\nclass ComputedRefImpl {\n constructor(fn, setter, isSSR) {\n this.fn = fn;\n this.setter = setter;\n /**\n * @internal\n */\n this._value = void 0;\n /**\n * @internal\n */\n this.dep = new Dep(this);\n /**\n * @internal\n */\n this.__v_isRef = true;\n // TODO isolatedDeclarations \"__v_isReadonly\"\n // A computed is also a subscriber that tracks other deps\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 16;\n /**\n * @internal\n */\n this.globalVersion = globalVersion - 1;\n /**\n * @internal\n */\n this.next = void 0;\n // for backwards compat\n this.effect = this;\n this[\"__v_isReadonly\"] = !setter;\n this.isSSR = isSSR;\n }\n /**\n * @internal\n */\n notify() {\n this.flags |= 16;\n if (!(this.flags & 8) && // avoid infinite self recursion\n activeSub !== this) {\n batch(this, true);\n return true;\n } else if (!!(process.env.NODE_ENV !== \"production\")) ;\n }\n get value() {\n const link = !!(process.env.NODE_ENV !== \"production\") ? this.dep.track({\n target: this,\n type: \"get\",\n key: \"value\"\n }) : this.dep.track();\n refreshComputed(this);\n if (link) {\n link.version = this.dep.version;\n }\n return this._value;\n }\n set value(newValue) {\n if (this.setter) {\n this.setter(newValue);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\"Write operation failed: computed value is readonly\");\n }\n }\n}\n// @__NO_SIDE_EFFECTS__\nfunction computed(getterOrOptions, debugOptions, isSSR = false) {\n let getter;\n let setter;\n if (isFunction(getterOrOptions)) {\n getter = getterOrOptions;\n } else {\n getter = getterOrOptions.get;\n setter = getterOrOptions.set;\n }\n const cRef = new ComputedRefImpl(getter, setter, isSSR);\n if (!!(process.env.NODE_ENV !== \"production\") && debugOptions && !isSSR) {\n cRef.onTrack = debugOptions.onTrack;\n cRef.onTrigger = debugOptions.onTrigger;\n }\n return cRef;\n}\n\nconst TrackOpTypes = {\n \"GET\": \"get\",\n \"HAS\": \"has\",\n \"ITERATE\": \"iterate\"\n};\nconst TriggerOpTypes = {\n \"SET\": \"set\",\n \"ADD\": \"add\",\n \"DELETE\": \"delete\",\n \"CLEAR\": \"clear\"\n};\nconst ReactiveFlags = {\n \"SKIP\": \"__v_skip\",\n \"IS_REACTIVE\": \"__v_isReactive\",\n \"IS_READONLY\": \"__v_isReadonly\",\n \"IS_SHALLOW\": \"__v_isShallow\",\n \"RAW\": \"__v_raw\",\n \"IS_REF\": \"__v_isRef\"\n};\n\nconst WatchErrorCodes = {\n \"WATCH_GETTER\": 2,\n \"2\": \"WATCH_GETTER\",\n \"WATCH_CALLBACK\": 3,\n \"3\": \"WATCH_CALLBACK\",\n \"WATCH_CLEANUP\": 4,\n \"4\": \"WATCH_CLEANUP\"\n};\nconst INITIAL_WATCHER_VALUE = {};\nconst cleanupMap = /* @__PURE__ */ new WeakMap();\nlet activeWatcher = void 0;\nfunction getCurrentWatcher() {\n return activeWatcher;\n}\nfunction onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {\n if (owner) {\n let cleanups = cleanupMap.get(owner);\n if (!cleanups) cleanupMap.set(owner, cleanups = []);\n cleanups.push(cleanupFn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onWatcherCleanup() was called when there was no active watcher to associate with.`\n );\n }\n}\nfunction watch(source, cb, options = EMPTY_OBJ) {\n const { immediate, deep, once, scheduler, augmentJob, call } = options;\n const warnInvalidSource = (s) => {\n (options.onWarn || warn)(\n `Invalid watch source: `,\n s,\n `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`\n );\n };\n const reactiveGetter = (source2) => {\n if (deep) return source2;\n if (isShallow(source2) || deep === false || deep === 0)\n return traverse(source2, 1);\n return traverse(source2);\n };\n let effect;\n let getter;\n let cleanup;\n let boundCleanup;\n let forceTrigger = false;\n let isMultiSource = false;\n if (isRef(source)) {\n getter = () => source.value;\n forceTrigger = isShallow(source);\n } else if (isReactive(source)) {\n getter = () => reactiveGetter(source);\n forceTrigger = true;\n } else if (isArray(source)) {\n isMultiSource = true;\n forceTrigger = source.some((s) => isReactive(s) || isShallow(s));\n getter = () => source.map((s) => {\n if (isRef(s)) {\n return s.value;\n } else if (isReactive(s)) {\n return reactiveGetter(s);\n } else if (isFunction(s)) {\n return call ? call(s, 2) : s();\n } else {\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(s);\n }\n });\n } else if (isFunction(source)) {\n if (cb) {\n getter = call ? () => call(source, 2) : source;\n } else {\n getter = () => {\n if (cleanup) {\n pauseTracking();\n try {\n cleanup();\n } finally {\n resetTracking();\n }\n }\n const currentEffect = activeWatcher;\n activeWatcher = effect;\n try {\n return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);\n } finally {\n activeWatcher = currentEffect;\n }\n };\n }\n } else {\n getter = NOOP;\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(source);\n }\n if (cb && deep) {\n const baseGetter = getter;\n const depth = deep === true ? Infinity : deep;\n getter = () => traverse(baseGetter(), depth);\n }\n const scope = getCurrentScope();\n const watchHandle = () => {\n effect.stop();\n if (scope && scope.active) {\n remove(scope.effects, effect);\n }\n };\n if (once && cb) {\n const _cb = cb;\n cb = (...args) => {\n const res = _cb(...args);\n watchHandle();\n return res;\n };\n }\n let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;\n const job = (immediateFirstRun) => {\n if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {\n return;\n }\n if (cb) {\n const newValue = effect.run();\n if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {\n if (cleanup) {\n cleanup();\n }\n const currentWatcher = activeWatcher;\n activeWatcher = effect;\n try {\n const args = [\n newValue,\n // pass undefined as the old value when it's changed for the first time\n oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,\n boundCleanup\n ];\n oldValue = newValue;\n call ? call(cb, 3, args) : (\n // @ts-expect-error\n cb(...args)\n );\n } finally {\n activeWatcher = currentWatcher;\n }\n }\n } else {\n effect.run();\n }\n };\n if (augmentJob) {\n augmentJob(job);\n }\n effect = new ReactiveEffect(getter);\n effect.scheduler = scheduler ? () => scheduler(job, false) : job;\n boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);\n cleanup = effect.onStop = () => {\n const cleanups = cleanupMap.get(effect);\n if (cleanups) {\n if (call) {\n call(cleanups, 4);\n } else {\n for (const cleanup2 of cleanups) cleanup2();\n }\n cleanupMap.delete(effect);\n }\n };\n if (!!(process.env.NODE_ENV !== \"production\")) {\n effect.onTrack = options.onTrack;\n effect.onTrigger = options.onTrigger;\n }\n if (cb) {\n if (immediate) {\n job(true);\n } else {\n oldValue = effect.run();\n }\n } else if (scheduler) {\n scheduler(job.bind(null, true), true);\n } else {\n effect.run();\n }\n watchHandle.pause = effect.pause.bind(effect);\n watchHandle.resume = effect.resume.bind(effect);\n watchHandle.stop = watchHandle;\n return watchHandle;\n}\nfunction traverse(value, depth = Infinity, seen) {\n if (depth <= 0 || !isObject(value) || value[\"__v_skip\"]) {\n return value;\n }\n seen = seen || /* @__PURE__ */ new Map();\n if ((seen.get(value) || 0) >= depth) {\n return value;\n }\n seen.set(value, depth);\n depth--;\n if (isRef(value)) {\n traverse(value.value, depth, seen);\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n traverse(value[i], depth, seen);\n }\n } else if (isSet(value) || isMap(value)) {\n value.forEach((v) => {\n traverse(v, depth, seen);\n });\n } else if (isPlainObject(value)) {\n for (const key in value) {\n traverse(value[key], depth, seen);\n }\n for (const key of Object.getOwnPropertySymbols(value)) {\n if (Object.prototype.propertyIsEnumerable.call(value, key)) {\n traverse(value[key], depth, seen);\n }\n }\n }\n return value;\n}\n\nexport { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };\n",
|
|
7
7
|
"/**\n * Type predicate guards for the Jx document model.\n *\n * These narrow `unknown`/union-typed values to precise domain types so call sites get real property\n * checking instead of casts. Every guard mirrors the runtime's actual detection logic (see\n * buildScope's five-shape algorithm in the runtime).\n */\n\nimport type {\n JsonObject,\n JsonValue,\n JxClassDef,\n JxElement,\n JxEventBinding,\n JxExpressionDef,\n JxFunctionDef,\n JxMappedArray,\n JxMutableNode,\n JxPrototypeDef,\n JxRef,\n JxServerFnDef,\n JxStateObject,\n JxStatement,\n JxStyle,\n JxTagExpression,\n} from \"../types\";\n\n// ─── JSON shape guards ──────────────────────────────────────────────────────────\n\n/** A plain object: not null, not an array. The base check for all object-shaped defs. */\nexport function isJsonObject(value: unknown): value is JsonObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n// ─── Binding guards ─────────────────────────────────────────────────────────────\n\n/** A `{ $ref: \"#/...\" }` JSON Pointer reference. */\nexport function isRef(value: unknown): value is JxRef {\n return isJsonObject(value) && typeof value.$ref === \"string\";\n}\n\n// ─── State definition guards (the five-shape algorithm) ────────────────────────\n\n/** Shape 4: a function declaration — `{ $prototype: \"Function\", body | $src }`. */\nexport function isFunctionDef(value: unknown): value is JxFunctionDef {\n return isJsonObject(value) && value.$prototype === \"Function\";\n}\n\n/** Shape 5: a declarative expression entry — `{ $expression: { operator, target } }`. */\nexport function isExpressionDef(value: unknown): value is JxExpressionDef {\n return isJsonObject(value) && isJsonObject(value.$expression);\n}\n\n/**\n * Shape 5 with `parameters`: a named formula — a pure, reusable computation invoked via the `call`\n * operator rather than lowered to a computed value.\n */\nexport function isNamedFormulaDef(\n value: unknown,\n): value is JxExpressionDef & { parameters: unknown[] } {\n return isExpressionDef(value) && Array.isArray(value.parameters) && value.parameters.length > 0;\n}\n\n/**\n * Shape 4 with a structured body: a Function entry whose `body` is a statement array (spec §20)\n * rather than opaque JS source.\n */\nexport function hasStructuredBody(\n value: unknown,\n): value is JxFunctionDef & { body: JxStatement[] } {\n return isFunctionDef(value) && Array.isArray(value.body);\n}\n\n/** A non-Function `$prototype` instance (Request, Storage, ContentCollection, classes, …). */\nexport function isPrototypeDef(value: unknown): value is JxPrototypeDef {\n return (\n isJsonObject(value) && typeof value.$prototype === \"string\" && value.$prototype !== \"Function\"\n );\n}\n\n/** A `timing: \"server\"` function proxy (no `$prototype`, external `$src`/`$export`). */\nexport function isServerFnDef(value: unknown): value is JxServerFnDef {\n return (\n isJsonObject(value) &&\n value.timing === \"server\" &&\n typeof value.$src === \"string\" &&\n typeof value.$export === \"string\" &&\n !value.$prototype\n );\n}\n\n/** Shape 2: an expanded signal — an object carrying a `default` value. */\nexport function isExpandedSignal(value: unknown): value is JxStateObject & { default: JsonValue } {\n return isJsonObject(value) && !value.$prototype && !value.$expression && \"default\" in value;\n}\n\n/**\n * Schema-only keywords used to detect pure type definitions (Shape 2b). An object with ONLY these\n * keys and no `default` is a type def, not a signal.\n */\nexport const SCHEMA_KEYWORDS: ReadonlySet<string> = new Set([\n \"type\",\n \"enum\",\n \"minimum\",\n \"maximum\",\n \"minLength\",\n \"maxLength\",\n \"pattern\",\n \"format\",\n \"items\",\n \"properties\",\n \"required\",\n \"description\",\n \"title\",\n \"$comment\",\n]);\n\n/** Shape 2b: a pure type definition — every key is a JSON Schema keyword. */\nexport function isSchemaOnlyDef(value: unknown): value is JxStateObject {\n if (!isJsonObject(value)) {\n return false;\n }\n for (const k of Object.keys(value)) {\n if (!SCHEMA_KEYWORDS.has(k)) {\n return false;\n }\n }\n return true;\n}\n\n/** True when an object carries at least one JSON Schema keyword. */\nexport function hasSchemaKeywords(value: unknown): value is JxStateObject {\n if (!isJsonObject(value)) {\n return false;\n }\n for (const k of Object.keys(value)) {\n if (SCHEMA_KEYWORDS.has(k)) {\n return true;\n }\n }\n return false;\n}\n\n// ─── Document structure guards ──────────────────────────────────────────────────\n\n/** A mapped (repeater) children object — `{ $prototype: \"Array\", items, map }`. */\nexport function isMappedArray(value: unknown): value is JxMappedArray {\n return isJsonObject(value) && value.$prototype === \"Array\";\n}\n\n/**\n * Whether a node's `children` holds at least one mapped array — either as the bare whole-children\n * slot (legacy) or as a member of the children array. Used by renderers and the compiler to decide\n * if a children list needs inline repeater expansion.\n */\nexport function childrenContainArray(children?: unknown): boolean {\n if (isMappedArray(children)) {\n return true;\n }\n return Array.isArray(children) && children.some((c) => isMappedArray(c));\n}\n\n/** A .class.json schema-defined class document — `{ $prototype: \"Class\" }`. */\nexport function isClassDef(value: unknown): value is JxClassDef {\n return isJsonObject(value) && value.$prototype === \"Class\";\n}\n\n/** An element-shaped node object (vs. a bare string/number child). */\nexport function isNodeObject(value: unknown): value is JxMutableNode & JxElement {\n return isJsonObject(value);\n}\n\n/** A `${...}` template-expression string. */\nexport function isTemplateString(value?: unknown): value is string {\n return typeof value === \"string\" && value.includes(\"${\");\n}\n\n/**\n * Whether a function `body` returns a value — the heuristic that classifies a `$prototype:\n * \"Function\"` as a computed value vs an event handler. Uses a word boundary so identifiers like\n * `returned` do not match. Shared by the runtime interpreter and the compiler so both agree on the\n * classification.\n *\n * A bare `return;` does not count. It is an early-exit guard, which is handler code — reading it as\n * a value return turned any handler with a guard clause into a `computed()`, so the binding that\n * invoked it found a value where it expected a function. The value has to follow on the same line,\n * because a newline after `return` is an ASI bare return.\n */\nexport function bodyReturnsValue(body: string): boolean {\n return /\\breturn\\b[^\\S\\n]*(?![;}\\s]|$)/.test(body);\n}\n\n// ─── Style guards & accessors ───────────────────────────────────────────────────\n\n/**\n * A nested style object (selector/media block), as opposed to a scalar CSS value.\n *\n * An ARRAY of blocks is not one: it is a key written more than once (`@font-face`, spec.md §9.4),\n * and every caller here reads or edits a single block. Answering true for it would hand a caller an\n * array to look properties up on, which finds nothing and reports nothing.\n */\nexport function isNestedStyle(\n value: string | number | JxStyle | JxStyle[] | undefined,\n): value is JxStyle {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Read a nested style block (`:hover`, `@--md`, `& > li`, …), if present. */\nexport function getNestedStyle(style: JxStyle | undefined, key: string): JxStyle | undefined {\n const value = style?.[key];\n return isNestedStyle(value) ? value : undefined;\n}\n\n/** Read a nested style block, creating an empty one in place when absent or scalar. */\nexport function ensureNestedStyle(style: JxStyle, key: string): JxStyle {\n const existing = style[key];\n if (isNestedStyle(existing)) {\n return existing;\n }\n const created: JxStyle = {};\n style[key] = created;\n return created;\n}\n\n// ─── Event binding guards ───────────────────────────────────────────────────────\n\n/**\n * The value of an `on*` document key: a `$ref`, an inline function declaration, or a declarative\n * expression.\n */\nexport function isEventBinding(value: unknown): value is JxEventBinding {\n return isRef(value) || isFunctionDef(value) || isExpressionDef(value);\n}\n\n/** Read the event binding stored under an `on*` key of a node, if there is one. */\nexport function getEventBinding(\n node: JxMutableNode | JxElement,\n key: string,\n): JxEventBinding | undefined {\n const value = node[key];\n return isEventBinding(value) ? value : undefined;\n}\n\n// ─── Parameter helpers ──────────────────────────────────────────────────────────\n\n/** Resolve `parameters` entries (bare strings or CEM objects) to their names. */\nexport function paramNames(parameters: JxFunctionDef[\"parameters\"]): string[] {\n if (!parameters) {\n return [];\n }\n return parameters.map((p) => (typeof p === \"string\" ? p : p.name));\n}\n\n/**\n * Whether an element's `tagName` is a choice rather than a name.\n *\n * **It reads the WHOLE shape, because it promises the whole shape.**\n * `defs/tag-expression.schema.ts` admits exactly two forms — `?:` with a `TagName` in `value` and\n * `initial`, and `switch` with a `TagName` per case and a required `default` — and this predicate\n * is the only thing standing between that promise and the four readers who trust it\n * ({@link tagNameCandidates}, the runtime's `resolveTagName`, the compiler's `resolveStaticTagName`\n * and its two target emitters). Answering `true` for any `{ $expression: … }` at all was the\n * unsound half: a general formula in tag position — which the Inspector's Tag row let a user pick\n * out of the formula catalog — then reached `Object.values(expression.cases)` with no `cases` to\n * read, and `Cannot convert undefined or null to object` came out of the Command Bar, the jump bar,\n * the Inspector and the canvas renderer at once.\n *\n * A `$expression` this refuses is not a tag choice, so it has no candidates and no static tag; the\n * readers fall back to their own \"nothing declared\" answer (`[]`, `\"div\"`) instead of throwing.\n */\nexport function isTagExpression(tagName: unknown): tagName is { $expression: JxTagExpression } {\n if (!isJsonObject(tagName) || !isJsonObject(tagName.$expression)) {\n return false;\n }\n const expression = tagName.$expression;\n if (expression.operator === \"?:\") {\n return typeof expression.value === \"string\" && typeof expression.initial === \"string\";\n }\n if (expression.operator === \"switch\") {\n return (\n isJsonObject(expression.cases) &&\n Object.values(expression.cases).every((tag) => typeof tag === \"string\") &&\n typeof expression.default === \"string\"\n );\n }\n return false;\n}\n\n/**\n * Every tag an element could be, without evaluating anything.\n *\n * ONE implementation, shared by the runtime, the three compiler targets and the studio, because\n * four surfaces each writing their own enumeration is four chances to disagree about what an\n * element can be — and disagreeing about that is how the `${…}` tagName shipped a page whose SSR\n * markup and client render used different elements.\n *\n * A plain name yields itself, so every caller can treat the two forms alike.\n */\nexport function tagNameCandidates(tagName: unknown): string[] {\n if (typeof tagName === \"string\") {\n return [tagName];\n }\n if (!isTagExpression(tagName)) {\n return [];\n }\n const expression = tagName.$expression;\n if (expression.operator === \"?:\") {\n return [...new Set([expression.value, expression.initial])];\n }\n return [...new Set([...Object.values(expression.cases), expression.default])];\n}\n\n/**\n * The tag to show a human when the element could be several.\n *\n * The Outline draws one row per node and needs a label that is stable, short and honest: `a|div`\n * says \"this is one element whose tag is chosen\" without pretending to know which. Rendering the\n * first candidate would have been a quieter lie.\n */\nexport function displayTagName(tagName: unknown): string {\n return typeof tagName === \"string\" ? tagName : tagNameCandidates(tagName).join(\"|\");\n}\n\n/**\n * Whether a `state` key is private (`spec.md` §5.6).\n *\n * A `#`-prefixed entry is ordinary state in every respect but one: it is not part of the\n * component's interface. It never reaches the studio property panel, never appears in an exported\n * CEM manifest, and is never settable through `$props` — which is the clause that needs a predicate\n * rather than a convention, because the props paths are spread across two tiers.\n *\n * The rule lived inline at three call sites before it lived here, spelled `key.startsWith(\"#\")`\n * each time. That is survivable for two and a drift risk at four, and the interesting direction of\n * drift is silent: a path that forgets the check does not fail, it just quietly makes a private\n * entry writable from outside.\n *\n * @param {string} key - A `state` key\n * @returns {boolean}\n */\nexport function isPrivateStateKey(key: string): boolean {\n return key.startsWith(\"#\");\n}\n",
|
|
8
8
|
"/**\n * The CSS-authoring rules that are not the DOM.\n *\n * `@jxsuite/runtime` renders a document in a browser, and every consumer of its root export pays\n * for that: the element registry, the reactive scope, `@vue/reactivity`. These exports need none of\n * it. They are pure string and regex math over what a `style` block MEANS — how a property name is\n * spelled in CSS, which media query an `@`-key resolves to, and which selector pair a\n * scheme-conditional rule dual-emits as.\n *\n * The rule builder joined them for the same reason: it is what a style object MEANS as a list of\n * CSS rules, and three emitters used to answer that question three different ways. Its only import\n * is `@jxsuite/schema/guards`, which imports nothing but types.\n *\n * They are a subpath of their own because of who else needs them. `@jxsuite/site/site-style` turns\n * `project.json`'s `style` into a stylesheet, and it runs in places the DOM runtime cannot go — a\n * static build, and a Cloudflare Worker serving a live preview. Importing the root export for\n * `camelToKebab` would put the whole renderer plus `@vue/reactivity` inside a Worker script for\n * four pure functions.\n *\n * `./runtime` re-exports all of these, so nothing that already imported them from the root export\n * has to change. This is a narrow door beside the wide one, not a replacement for it.\n */\n\nimport { isRef, isTemplateString } from \"@jxsuite/schema/guards\";\nimport type { JxRef, JxStyle } from \"@jxsuite/schema/types\";\n\n/**\n * Convert camelCase to kebab-case.\n *\n * @param {string} s\n * @returns {string}\n */\nexport function camelToKebab(s: string) {\n return s.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);\n}\n\n// ─── Style At-Rules ───────────────────────────────────────────────────────────\n\n/**\n * The four CSS media types. A media _type_ is bare — `@media print` — while a media _feature_ is\n * parenthesised, so `@media (print)` reads as a boolean feature named `print`, which does not exist\n * and evaluates false.\n */\nconst MEDIA_TYPES = new Set([\"all\", \"print\", \"screen\", \"speech\"]);\n\n/**\n * The media query an `@`-prefixed style key names, or null when the key is some other at-rule\n * (`@supports`, `@starting-style`) that is emitted verbatim.\n *\n * `@--name` resolves through the project's `$media` map. `@(…)` carries its own parentheses, so\n * they are stripped only when what they wrap is a bare media type: `@(print)` must become `@media\n * print`, while `@(min-width: 40rem)` keeps them.\n *\n * @param {string} atKey\n * @param {Record<string, string>} mediaQueries\n * @returns {string | null}\n * @docs framework/concepts/styling\n */\nexport function resolveAtQuery(atKey: string, mediaQueries: Record<string, string>): string | null {\n if (atKey.startsWith(\"@--\")) {\n return mediaQueries[atKey.slice(1)] ?? atKey.slice(1);\n }\n if (atKey.startsWith(\"@(\")) {\n const inner = atKey.slice(2, -1).trim();\n return MEDIA_TYPES.has(inner.toLowerCase()) ? inner : atKey.slice(1);\n }\n return null;\n}\n\n/**\n * At-rules whose body is a list of DECLARATIONS rather than a list of rules.\n *\n * Every other `@`-key in a `style` object wraps selectors — `@media`, `@supports`,\n * `@starting-style` — so both emitters assume a selector child and write `@key { <selector> { … }\n * }`. These four have no selector: `@position-try --flip { inset-block-start: auto }` IS the body,\n * and wrapping it in one produces a block the parser discards without a word.\n *\n * That is why an anchored dropdown had no custom fallback to declare. `position-try-fallbacks` can\n * name `flip-block` and friends without this, but a bespoke fallback position — the thing you need\n * when the built-in flips do not fit — could not be expressed at all.\n *\n * The name is part of the key (`@position-try --flip`), so this is a PREFIX match. `@keyframes` is\n * deliberately absent, and stays absent: its body is neither declarations nor selectors but\n * keyframe stops, which is a third shape with its own predicate ({@link isKeyframesAtRule}) and its\n * own serializer. Adding it here would be the tempting one-line fix and it deletes the animation\n * without a word — every child of a keyframes block is a block, `declarationsOf` skips blocks, and\n * a rule with no declarations is never emitted.\n *\n * @param {string} atKey - An `@`-prefixed style key\n * @returns {boolean} True when the block is emitted verbatim, with no selector inside\n * @docs framework/concepts/styling\n */\nexport function isDeclarationAtRule(atKey: string): boolean {\n return (\n atKey.startsWith(\"@position-try\") ||\n atKey.startsWith(\"@property\") ||\n atKey.startsWith(\"@font-face\") ||\n atKey.startsWith(\"@counter-style\")\n );\n}\n\n/**\n * The at-rule whose body is a list of KEYFRAME BLOCKS: `@keyframes <name>`.\n *\n * The third body shape, and the only one. Its children are keyframe selectors — `from`, `to`,\n * `50%`, `\"0%, 100%\"` — which name a point in an animation's timeline and not an element. Scoping\n * one produces `@keyframes toast-in { .x from { … } }`, which a browser parses without complaint\n * into a keyframes rule holding NO keyframes: the `animation` declaration still names a live\n * animation, and that animation animates nothing. That is how the Studio toast lost its entry\n * animation the day it became a Jx document.\n *\n * The name is part of the key, so this is a PREFIX match like {@link isDeclarationAtRule}.\n *\n * @param {string} atKey - An `@`-prefixed style key\n * @returns {boolean}\n * @docs framework/concepts/styling\n */\nexport function isKeyframesAtRule(atKey: string): boolean {\n return atKey.startsWith(\"@keyframes\");\n}\n\n/**\n * Resolve one nested style key against its parent selector.\n *\n * `&` splices, `:`/`.`/`[` concatenate, anything else is a descendant. Extracted because the same\n * four-branch decision was written THREE times in `applyStyle` — the top-level nested loop,\n * `emitNested`'s recursion and `emitMediaNested` — and three copies of one decision is three\n * chances for a selector to mean different things depending on how deeply it was nested.\n *\n * @param {string} scope - The parent selector\n * @param {string} key - The nested key, e.g. `\":hover\"`, `\"& > li\"`, `\".child\"`\n * @returns {string} The resolved selector\n */\nexport function resolveNestedSelector(scope: string, key: string): string {\n const resolved: string[] = [];\n for (const scopePart of splitSelectorList(scope)) {\n for (const keyPart of splitSelectorList(key)) {\n resolved.push(resolveOneNestedSelector(scopePart, keyPart));\n }\n }\n return resolved.join(\", \");\n}\n\n/** One member of a scope against one member of a key — the four-branch decision itself. */\nfunction resolveOneNestedSelector(scope: string, key: string): string {\n if (key.startsWith(\"&\")) {\n return key.replaceAll(\"&\", scope);\n }\n if (key.startsWith(\"[\") || key.startsWith(\":\") || key.startsWith(\".\")) {\n return `${scope}${key}`;\n }\n return `${scope} ${key}`;\n}\n\n/**\n * Split a selector list on its top-level commas.\n *\n * A comma inside `:is()`, `:where()`, `:not()`, an attribute value or a quoted string separates\n * nothing, so depth and quotes are tracked. Members are trimmed and an empty member is dropped; a\n * selector with no top-level comma comes back as itself, so callers never special-case the single\n * form.\n *\n * Why this exists: a nested key was spliced onto its scope as ONE string, so `\"& .a, & .b\"` with a\n * `\":hover\"` inside it emitted `#x .a, #x .b:hover` — the first member got the hover rule with no\n * hover — and the second `&` of the key was never replaced at all. CSS Nesting distributes a nested\n * selector over every member of the parent list (its implicit `:is()`); the flattener now does the\n * same, member by member.\n *\n * @param {string} selector - A selector or a selector list\n * @returns {string[]} The members, in order\n */\nexport function splitSelectorList(selector: string): string[] {\n const members: string[] = [];\n let depth = 0;\n let quote: string | null = null;\n let start = 0;\n for (let i = 0; i < selector.length; i += 1) {\n const ch = selector[i]!;\n if (quote) {\n if (ch === \"\\\\\") {\n i += 1;\n } else if (ch === quote) {\n quote = null;\n }\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n quote = ch;\n } else if (ch === \"(\" || ch === \"[\") {\n depth += 1;\n } else if (ch === \")\" || ch === \"]\") {\n depth = Math.max(0, depth - 1);\n } else if (ch === \",\" && depth === 0) {\n members.push(selector.slice(start, i));\n start = i + 1;\n }\n }\n members.push(selector.slice(start));\n const trimmed = members.map((member) => member.trim()).filter((member) => member !== \"\");\n return trimmed.length > 0 ? trimmed : [selector];\n}\n\n/**\n * Studio-canvas popover selector transposition — the style half of `setCanvasDelinkPopovers`.\n *\n * The canvas renames `popover` to `data-jx-popover` so an open panel leaves the TOP LAYER and\n * becomes an ordinary positioned element the editor can measure, select and grow the artboard for.\n * The moment it does, `:popover-open` matches nothing — so an authored open state would simply not\n * apply, and the author would be styling a rule they could never see.\n *\n * `[data-jx-popover-open]` is the stand-in, and the substitution is exact in the way that matters:\n * a pseudo-class and an attribute selector are both specificity (0,1,0), so a `:popover-open` block\n * still wins and loses against the same neighbours it does on the shipped page.\n *\n * `null` means \"do not emit this rule at all\", and `::backdrop` is the one thing it is returned\n * for. There is no backdrop pseudo-element outside the top layer; synthesising one would paint a\n * full-canvas scrim over the document being edited, and emitting an inert rule would mark the\n * selector as \"styled\" in the Style panel while doing nothing. Preview renders it natively.\n *\n * @param {string} selector - A fully resolved selector, canvas-side\n * @returns {string | null} The selector to emit, or null to emit nothing\n * @docs framework/concepts/overlays\n */\nexport function transposeCanvasPopoverSelector(selector: string): string | null {\n return transposeCanvasOverlaySelector(selector);\n}\n\n/** What {@link transposeCanvasOverlaySelector} needs to know about the element that owns a rule. */\nexport interface CanvasOverlayTransposeOptions {\n /**\n * The rule was authored on a `<dialog>`. It answers `[open]` only for a compound that names no\n * element type at all (`&[open]`, `#d[open]`, `.panel[open]`) — a compound that names one is\n * decided by that type instead, so a `<div>`'s `& dialog[open]` is transposed and a `<dialog>`'s\n * `& details[open]` is not.\n */\n dialog?: boolean;\n}\n\n/** A character that ends the compound selector to the left of it. */\nconst COMPOUND_BREAK = /[\\s>+~,()]/;\n\n/** The leading type selector of a compound, if it has one. */\nconst LEADING_TYPE = /^[A-Za-z_\\u{00A0}-\\u{FFFF}][\\w\\u{00A0}-\\u{FFFF}-]*/u;\n\n/**\n * Rewrite each `[open]` according to the compound it belongs to, not the element the style object\n * hangs off. A compound naming `dialog` is the dialog's own open state and is transposed; one\n * naming any other type (`details`, a custom element) is left alone; one naming no type — or naming\n * the scope handle, which IS the styled element — inherits `options.dialog`.\n */\nfunction transposeOpenAttribute(selector: string, options: CanvasOverlayTransposeOptions): string {\n let out = \"\";\n let from = 0;\n for (;;) {\n const at = selector.indexOf(\"[open]\", from);\n if (at === -1) {\n return out + selector.slice(from);\n }\n let start = at;\n while (start > 0 && !COMPOUND_BREAK.test(selector[start - 1] as string)) {\n start -= 1;\n }\n const type = LEADING_TYPE.exec(selector.slice(start, at))?.[0]?.toLowerCase();\n const dialog = type === undefined ? options.dialog === true : type === \"dialog\";\n out += selector.slice(from, at) + (dialog ? \"[data-jx-dialog-open]\" : \"[open]\");\n from = at + \"[open]\".length;\n }\n}\n\n/**\n * Studio-canvas overlay selector transposition, for dialogs as well as popovers — the style half of\n * `setCanvasDelinkPopovers` and `setCanvasDelinkCommands` together.\n *\n * A dialog the canvas shows in place is not `:modal` and, its `open` renamed with the rest of the\n * invoker machinery, not `[open]` either; `[data-jx-dialog-open]` is the stand-in for both, at the\n * same (0,1,0) specificity. `::backdrop` is dropped for the reason given above: neither kind of\n * overlay has one outside the top layer.\n *\n * `[inert]` travels with `commandfor` and a dialog's `open`, and for the same reason: the canvas\n * renames the attribute on every stamped node so the editor can select into an inert region, so a\n * rule the author wrote against `[inert]` would match on the built page and silently not on the\n * canvas. `[data-jx-inert]` is the same (0,1,0) specificity, so it wins and loses against the same\n * neighbours. Unlike `[open]` it needs no option: `inert` is renamed whatever the tag is, where\n * `<details open>` keeps its attribute and so its `[open]` must keep matching.\n *\n * **`[open]` follows the compound it is written on, not the element the style object hangs off.** A\n * compound naming `dialog` is transposed whatever owns the rule, so a wrapper's `& dialog[open]`\n * keeps matching; a compound naming any other type is left alone, so a dialog's `& details[open]`\n * is not corrupted into a selector that can never match. Only a compound with no type of its own —\n * `&[open]`, `#d[open]`, or the runtime's own scope handle — falls back to `options.dialog`. The\n * handle needs no special case: it is not a parseable type name, so the scan finds none and the\n * fallback is what answers for it, which is the right answer because the handle IS the styled\n * element.\n *\n * Three shapes are out of reach of that scan and take the fallback: `:is(dialog)[open]`, a quoted\n * attribute value carrying selector punctuation, and any functional pseudo between the type and the\n * attribute — `dialog:not(.x)[open]` reads as no type, because a parenthesis breaks the backscan.\n *\n * **The rename is per NODE and the selector is not**, so one limitation survives whatever this\n * does. `open` is renamed only on a node the canvas stamped, and a rule may address both stamped\n * and unstamped dialogs at once: a stamped wrapper styling `& dialog[open]` whose dialog comes from\n * a component's own template now emits an attribute that dialog does not carry. Before this, the\n * same rule failed the other way round, on the stamped dialog. Whichever way it is decided one of\n * the two is wrong, so it is decided for the addressable one and stated here rather than papered\n * over.\n *\n * @param {string} selector - A fully resolved selector, canvas-side\n * @param {CanvasOverlayTransposeOptions} [options]\n * @returns {string | null} The selector to emit, or null to emit nothing\n * @docs framework/concepts/overlays\n */\nexport function transposeCanvasOverlaySelector(\n selector: string,\n options: CanvasOverlayTransposeOptions = {},\n): string | null {\n if (selector.includes(\"::backdrop\")) {\n return null;\n }\n const transposed = selector\n .replaceAll(\":popover-open\", \"[data-jx-popover-open]\")\n .replaceAll(\":modal\", \"[data-jx-dialog-open]\")\n .replaceAll(\"[inert]\", \"[data-jx-inert]\");\n return transposeOpenAttribute(transposed, options);\n}\n\n// ─── Color Schemes ────────────────────────────────────────────────────────────\n\n/**\n * Attribute on the root element (`<html>`) that forces a color scheme. Absent = auto (follow the OS\n * `prefers-color-scheme`). Values: \"light\" | \"dark\".\n *\n * @docs framework/concepts/color-schemes\n */\nexport const COLOR_SCHEME_ATTR = \"data-color-scheme\";\n\n/**\n * The localStorage key a site switcher persists the visitor's forced scheme under; read by the\n * compiler-injected pre-paint script. Values: \"light\" | \"dark\" (absent = auto).\n *\n * @docs framework/concepts/color-schemes\n */\nexport const COLOR_SCHEME_STORAGE_KEY = \"jx-color-scheme\";\n\n/**\n * The scheme a _pure_ `prefers-color-scheme` media query targets. Compound queries (any other\n * conditions attached) return null — they are not eligible for forced-scheme dual emission.\n *\n * @param {string} query\n * @returns {\"light\" | \"dark\" | null}\n * @docs framework/concepts/color-schemes\n */\nexport function pureSchemeOf(query: string): \"light\" | \"dark\" | null {\n const m = /^\\(\\s*prefers-color-scheme\\s*:\\s*(light|dark)\\s*\\)$/.exec(query.trim());\n return (m?.[1] as \"light\" | \"dark\") ?? null;\n}\n\n/**\n * Selector pair for a scheme-conditional rule: `auto` applies inside the scheme's media query only\n * while no scheme is forced; `forced` applies unconditionally when the root attribute forces the\n * scheme. Guards are wrapped in `:where()` so specificity matches the unguarded selector and source\n * order decides the cascade.\n *\n * @param {string} selector\n * @param {\"light\" | \"dark\"} scheme\n * @returns {{ auto: string; forced: string }}\n * @docs framework/concepts/color-schemes\n */\nexport function schemeSelectors(\n selector: string,\n scheme: \"light\" | \"dark\",\n): { auto: string; forced: string } {\n if (selector === \":root\" || selector === \"html\") {\n return {\n auto: `${selector}:where(:not([${COLOR_SCHEME_ATTR}]))`,\n forced: `${selector}:where([${COLOR_SCHEME_ATTR}=\"${scheme}\"])`,\n };\n }\n return {\n auto: `:where(:root:not([${COLOR_SCHEME_ATTR}])) ${selector}`,\n forced: `:where(:root[${COLOR_SCHEME_ATTR}=\"${scheme}\"]) ${selector}`,\n };\n}\n\n// ─── The Rule Builder ─────────────────────────────────────────────────────────\n\n/**\n * Where a rule points, relative to the element the style object was authored on.\n *\n * The runtime needs this to decide what it is allowed to SHARE. A `self` rule can be interned and\n * pointed at by any number of elements, because everything it says applies to whichever element\n * carries the scope handle. A `descendant` rule cannot be shared the moment it reads a custom\n * property, because `var()` resolves from the nearest ancestor that set it and a shared handle has\n * more than one such ancestor. `unscoped` is a declaration-body at-rule — `@font-face`,\n * `@position-try` — or a `@keyframes` block, whose name is document-global and which is therefore\n * hoisted once rather than emitted per element.\n */\nexport type CssRuleTarget = \"self\" | \"descendant\" | \"unscoped\";\n\n/** One keyframe stop: its keyframe selector, verbatim as authored, and what it declares. */\nexport interface CssKeyframeBlock {\n /** `from`, `to`, `50%`, `\"0%, 100%\"` — a point on the timeline, never an element selector. */\n selector: string;\n /** Kebab-cased property/value pairs, in authored order. */\n declarations: readonly (readonly [string, string])[];\n}\n\n/** One emitted CSS rule: its parts, its text, and a content hash of the two. */\nexport interface CssRule {\n /** The rule as one `insertRule` argument, or one line of a `<style>` element. */\n text: string;\n /** At-rule wrappers, outermost first. Empty for a top-level rule. */\n conditions: readonly string[];\n /**\n * The resolved selector, or null for a rule that has none: a declaration-body at-rule, or a\n * `@keyframes` block (whose stops are in {@link CssRule.blocks} instead).\n */\n selector: string | null;\n /** Kebab-cased property/value pairs, in authored order. Empty for a `@keyframes` block. */\n declarations: readonly (readonly [string, string])[];\n /**\n * The stops of a `@keyframes` block, in authored order. Absent for every other rule.\n *\n * `declarations` cannot describe N stops each with its own list, so it stays empty here and this\n * carries the body. Nothing in the repository reads either field — `text`, `key` and `target` are\n * the whole cross-consumer contract — but a rule that plainly has declarations must not report\n * none without saying where they went.\n */\n blocks?: readonly CssKeyframeBlock[];\n /**\n * The block's `$description`, if it wrote one: why the rule exists, in the author's words.\n *\n * It is NOT in {@link CssRule.text}, and that is the point. `text` is what a sheet inserts and\n * what {@link hashCss} interns, so prose there would make two identical rules two rules and put a\n * paragraph in every adopted sheet at runtime. A static emitter — the one writing a stylesheet a\n * person will read — renders it as a comment; every other consumer ignores it, exactly as a\n * document's own `$description` is ignored.\n */\n description?: string;\n /** See {@link CssRuleTarget}. */\n target: CssRuleTarget;\n /** FNV-1a base36 hash of `text` — the dedup key. */\n key: string;\n}\n\n/** Hooks that let one builder serve the DOM runtime, the compiler, the site builder and Studio. */\nexport interface CssBuildOptions {\n /**\n * The selector the style object hangs off. Every nested key resolves against it, so the runtime\n * passes a placeholder it substitutes afterwards and the compiler passes `#id` / `.jx-N` / a\n * tag.\n */\n scope?: string | null;\n /** The project's `$media` map, for resolving `@--name` keys. */\n mediaQueries?: Record<string, string>;\n /** Applied to every declaration value. The canvas passes `canvasStyleValue`; hosts pass identity. */\n transposeValue?: (value: string) => string;\n /**\n * Applied to every resolved selector. Returning null drops the rule entirely, which is how the\n * canvas refuses to synthesise a `::backdrop` outside the top layer.\n */\n transposeSelector?: (selector: string) => string | null;\n /**\n * Resolve a value the builder cannot serialize on its own: a `${…}` template or a `{ $ref }`.\n *\n * The runtime returns `var(--jx-rN)` and writes the real value into that custom property from an\n * effect, so the declaration lives in a rule where `:hover` can override it while the reactive\n * part stays inline. Hosts with no scope to evaluate against omit the hook, and the declaration\n * is dropped — which is what the compiler already did for template strings, and what the runtime\n * should always have done with a `$ref` it was instead reading as a nested selector.\n */\n /**\n * Resolve a reactive value to what the declaration should say, or `null` to emit no declaration\n * at all. `target` is the rule's own target, so a resolver can treat a value on the element\n * itself differently from one on a descendant.\n */\n resolveValue?: (property: string, value: string | JxRef, target: CssRuleTarget) => string | null;\n}\n\n/** A style-object key that names a nested selector rather than a CSS property. */\nexport function isNestedSelectorKey(key: string): boolean {\n return key.startsWith(\":\") || key.startsWith(\".\") || key.startsWith(\"&\") || key.startsWith(\"[\");\n}\n\n/**\n * A style-object key as a CSS property name.\n *\n * Custom properties pass through untouched. They are case-SENSITIVE — `--fooBar` and `--foo-bar`\n * are two different properties — so kebab-casing one renames it, and the `var(--fooBar)` that reads\n * it finds nothing.\n *\n * @param {string} property\n * @returns {string}\n */\nexport function cssPropertyName(property: string): string {\n return property.startsWith(\"--\") ? property : camelToKebab(property);\n}\n\n/**\n * FNV-1a (32-bit), base36. Not a cryptographic hash and does not need to be: it is a dedup key and\n * an SSR-stable replacement for `Math.random()`, and a collision costs two elements sharing a rule\n * set that says the same thing.\n *\n * @param {string} text\n * @returns {string}\n */\nexport function hashCss(text: string): string {\n /* oxlint-disable no-bitwise, unicorn/prefer-code-point -- FNV-1a IS bitwise arithmetic over\n 16-bit code UNITS; `codePointAt` would consume a surrogate pair as one unit and change the\n hash of any string containing an astral character, for no benefit to a non-cryptographic\n content key. The final `>>> 0` is what keeps the result unsigned, and so base36-clean. */\n let h = 2_166_136_261;\n for (let i = 0; i < text.length; i += 1) {\n h ^= text.charCodeAt(i);\n h = Math.imul(h, 16_777_619);\n }\n return (h >>> 0).toString(36);\n /* oxlint-enable no-bitwise, unicorn/prefer-code-point */\n}\n\n/**\n * Serialize one rule: declarations, wrapped in a selector unless there is none, wrapped in its\n * at-rule conditions from the inside out.\n *\n * @param {readonly string[]} conditions\n * @param {string | null} selector\n * @param {readonly (readonly [string, string])[]} declarations\n * @returns {string}\n */\nexport function cssRuleText(\n conditions: readonly string[],\n selector: string | null,\n declarations: readonly (readonly [string, string])[],\n): string {\n const body = declarations.map(([property, value]) => `${property}: ${value}`).join(\"; \");\n let text = selector === null ? body : `${selector} { ${body} }`;\n for (let i = conditions.length - 1; i >= 0; i -= 1) {\n text = `${conditions[i]} { ${text} }`;\n }\n return text;\n}\n\n/**\n * Serialize one `@keyframes` block: every stop, in authored order, inside ONE at-rule, wrapped in\n * its enclosing conditions.\n *\n * One rule, not one per stop, and that is a correctness requirement rather than tidiness. CSS\n * Animations 1: where two `@keyframes` rules share a name, the last in document order wins and the\n * earlier ones are ignored ENTIRELY. So a block split into `@keyframes fade { from { … } }` plus\n * `@keyframes fade { to { … } }` is valid CSS that animates only its last stop, which is the shape\n * the site-style and compiler paths emitted before this existed.\n *\n * @param {readonly string[]} conditions\n * @param {string} name - The animation name, as authored\n * @param {readonly CssKeyframeBlock[]} blocks\n * @returns {string}\n */\nfunction cssKeyframesText(\n conditions: readonly string[],\n name: string,\n blocks: readonly CssKeyframeBlock[],\n): string {\n const body = blocks\n .map(\n ({ selector, declarations }) =>\n `${selector} { ${declarations.map(([property, value]) => `${property}: ${value}`).join(\"; \")} }`,\n )\n .join(\" \");\n let text = `@keyframes ${name} { ${body} }`;\n for (let i = conditions.length - 1; i >= 0; i -= 1) {\n text = `${conditions[i]} { ${text} }`;\n }\n return text;\n}\n\n/**\n * A block with its `@keyframes` children removed, for the forced-scheme twin of a dual emission.\n *\n * A scheme-pure query emits twice, once media-guarded and once under the root attribute, because a\n * SELECTOR can be re-pointed at the forced state. A `@keyframes` name cannot: it is document-global\n * and has no selector, so a second copy would be a second definition of one name, and the\n * unconditional copy would silently replace the media-guarded one for every visitor. The\n * media-guarded copy is the one that keeps the author's condition, so it is the one that survives.\n */\nfunction withoutKeyframes(block: JxStyle): JxStyle {\n const keyframeKeys = Object.keys(block).filter((key) => isKeyframesAtRule(key));\n if (keyframeKeys.length === 0) {\n return block;\n }\n const rest: JxStyle = { ...block };\n for (const key of keyframeKeys) {\n delete rest[key];\n }\n return rest;\n}\n\n/**\n * Whether a nested key COMPOUNDS onto its scope rather than descending from it.\n *\n * `:hover`, `.wide`, `[open]` and their `&`-spliced spellings still match the element the style was\n * authored on; `> li` and `span` match something inside it. That distinction is the whole of\n * {@link CssRuleTarget}, so it is decided once, here.\n */\nfunction compoundsOntoScope(key: string): boolean {\n const rest = key.startsWith(\"&\") ? key.slice(1) : key;\n return rest === \"\" || rest.startsWith(\":\") || rest.startsWith(\".\") || rest.startsWith(\"[\");\n}\n\n/**\n * Turn one authored `style` object into a flat list of CSS rules.\n *\n * This is the single answer to \"what does a Jx style object MEAN as CSS\", shared by the DOM\n * runtime, the compiler's static emitter and the site-style builder. Before it, three emitters each\n * walked the shape with their own recursion and each dropped a different combination: the runtime\n * lost `selector → @media`, the compiler lost `@media → selector → pseudo`, and neither composed\n * at-rules at all.\n *\n * The recursion carries `{ selector, conditions }` rather than special-casing depth, so nesting and\n * at-rules compose to any depth in either order by construction. A scheme-pure media query\n * dual-emits through {@link schemeSelectors} — a media-guarded copy for the OS preference and an\n * unconditional copy for the forced root attribute — and the forced copy keeps recursing, so an\n * `@--md` block inside a `@(prefers-color-scheme: dark)` block survives both branches.\n *\n * Nesting is FLATTENED, never handed to the browser as native CSS nesting: `&` is resolved here and\n * no `&` reaches the output. That is deliberate — Jx compounds `.child` onto its scope where CSS\n * Nesting would make it a descendant — and it is also what keeps the output parseable by the test\n * DOM, which has no native nesting.\n *\n * @param {JxStyle} style - The authored style object\n * @param {CssBuildOptions} [options]\n * @returns {CssRule[]} Rules in cascade order: a scope's own declarations before its nested blocks\n * @docs framework/concepts/styling\n */\nexport function buildStyleRules(style: JxStyle, options: CssBuildOptions = {}): CssRule[] {\n const {\n scope = null,\n mediaQueries = {},\n transposeValue = (value: string) => value,\n transposeSelector = (selector: string) => selector,\n resolveValue,\n } = options;\n const rules: CssRule[] = [];\n\n const isBlock = (value: unknown): value is JxStyle =>\n value !== null && typeof value === \"object\" && !Array.isArray(value) && !isRef(value);\n\n /**\n * The blocks written under one key: the block itself, or each of an ARRAY of them, in order.\n *\n * An object's keys are unique, so a key can name a rule only once — and `@font-face` is the\n * at-rule whose identity is not in its key, so a family with three weights had no spelling at\n * all. It was not refused either: an array here emitted NOTHING, silently, so a style block that\n * looked complete shipped no faces and the page fell to its fallback stack.\n *\n * **Only a DECLARATION at-rule takes the array**, and the narrowness is the point rather than\n * caution. Those four are leaves — `walkAt` emits their declarations and recurses into nothing —\n * so admitting a list there teaches no other walker anything new. Under a selector key an array\n * would say what one block already says, while every style walker in the repo (the overlay lint,\n * the a11y lint, the canvas) assumes a block key holds ONE block; allowing it there would leave\n * those reading past it in silence, which is the failure this codebase keeps finding.\n */\n const blocksOf = (key: string, value: unknown): JxStyle[] => {\n if (isBlock(value)) {\n return [value];\n }\n if (!isDeclarationAtRule(key) || !Array.isArray(value) || value.length === 0) {\n return [];\n }\n return value.every((entry) => isBlock(entry)) ? value : [];\n };\n\n const declarationValue = (\n property: string,\n value: unknown,\n reactive: boolean,\n target: CssRuleTarget,\n ): string | null => {\n if (value === undefined || value === null) {\n return null;\n }\n /* Defect: a `{ $ref }` is a VALUE. Read as an object it looked like a nested selector, and the\n runtime emitted `[data-jx=\"…\"] color { $ref: #/state/tint }` — a rule for an element named\n `color`, and a declaration whose property is `$ref`. */\n if (isRef(value)) {\n return reactive ? (resolveValue?.(property, value, target) ?? null) : null;\n }\n if (typeof value === \"object\") {\n return null;\n }\n const raw = String(value);\n if (isTemplateString(raw)) {\n return reactive ? (resolveValue?.(property, raw, target) ?? null) : null;\n }\n return transposeValue(raw);\n };\n\n /**\n * `reactive: false` drops a `${…}` or `{ $ref }` instead of resolving it, and only a `@keyframes`\n * stop passes it. The resolver's answer is `var(--jx-rN-M)`, a custom property the runtime writes\n * INLINE on the one element that declared the style — but a keyframes block is hoisted once for\n * the whole document, so the variable would be read where it was never set. Worse, the hoist is\n * refcounted by rule TEXT: two elements naming one animation would produce two different texts,\n * hence two definitions of one name, and the later would erase the earlier.\n */\n const declarationsOf = (\n node: JxStyle,\n skipSelectorKeys: boolean,\n reactive = true,\n target: CssRuleTarget = \"self\",\n ): [string, string][] => {\n const declarations: [string, string][] = [];\n for (const [key, value] of Object.entries(node)) {\n /* `blocksOf`, not `isBlock`: an array of blocks is a rule written more than once, never a\n declaration value, and reading it as one emitted `@font-face: [object Object]`. */\n if (blocksOf(key, value).length > 0) {\n continue;\n }\n // A scalar under a selector or at-rule key is an invalid shape, not a declaration.\n if (skipSelectorKeys && (key.startsWith(\"@\") || isNestedSelectorKey(key))) {\n continue;\n }\n /* `$`-prefixed keys are METADATA, the way they are everywhere else in a document. No CSS\n property begins with `$` — a custom property begins with `--` — so this can refuse the\n whole prefix rather than name one key. `$description` used to emit\n `$description: why this exists;`: an invalid declaration the parser drops in silence, which\n also put the prose inside the text `hashCss` interns. */\n if (key.startsWith(\"$\")) {\n continue;\n }\n const resolved = declarationValue(key, value, reactive, target);\n if (resolved !== null) {\n declarations.push([cssPropertyName(key), resolved]);\n }\n }\n return declarations;\n };\n\n const emit = (\n conditions: readonly string[],\n selector: string | null,\n declarations: readonly (readonly [string, string])[],\n target: CssRuleTarget,\n description?: unknown,\n ) => {\n if (declarations.length === 0) {\n return;\n }\n let resolved = selector;\n if (resolved !== null) {\n const transposed = transposeSelector(resolved);\n if (transposed === null) {\n return;\n }\n resolved = transposed;\n }\n const text = cssRuleText(conditions, resolved, declarations);\n rules.push({\n text,\n conditions: [...conditions],\n selector: resolved,\n declarations,\n target,\n key: hashCss(text),\n ...(typeof description === \"string\" && description !== \"\" ? { description } : {}),\n });\n };\n\n /**\n * Emit a whole `@keyframes` block as ONE unscoped rule.\n *\n * The enclosing `selector` is not a parameter, which is the fix stated as a signature: a keyframe\n * selector is a point on a timeline, so there is nothing for a scope to compound onto or descend\n * from. Its key is therefore taken VERBATIM — no `resolveNestedSelector`, no selector-list split\n * (`\"0%, 100%\"` is one valid keyframe selector already), and no `transposeSelector`, whose canvas\n * implementation may return null and would delete a stop out of an otherwise sound animation.\n * `transposeValue` still runs on every declaration, so a `translateY(10vh)` stop keeps the\n * canvas's viewport-to-container rewrite.\n *\n * It pushes onto `rules` rather than going through `emit`, which serializes a declaration list\n * and refuses an empty one.\n */\n const emitKeyframes = (atKey: string, block: JxStyle, conditions: readonly string[]) => {\n const name = atKey.slice(\"@keyframes\".length).trim();\n if (name === \"\") {\n return;\n }\n const blocks: CssKeyframeBlock[] = [];\n for (const [key, value] of Object.entries(block)) {\n if (!isBlock(value)) {\n continue;\n }\n /* A stop holds declarations and nothing else. A nested selector or at-rule inside one is not\n valid CSS, and `declarationsOf` drops both shapes rather than emitting a block a parser\n would throw the whole animation away over. */\n const declarations = declarationsOf(value, true, false, \"unscoped\");\n if (declarations.length > 0) {\n blocks.push({ declarations, selector: key.trim() });\n }\n }\n if (blocks.length === 0) {\n return;\n }\n const text = cssKeyframesText(conditions, name, blocks);\n rules.push({\n blocks,\n conditions: [...conditions],\n declarations: [],\n key: hashCss(text),\n selector: null,\n target: \"unscoped\",\n text,\n });\n };\n\n const walkAt = (\n atKey: string,\n block: JxStyle,\n selector: string | null,\n conditions: readonly string[],\n target: CssRuleTarget,\n ) => {\n /* Not a query. `@--` is the canvas's base-width block — the value a breakpoint panel renders\n at when no named breakpoint applies — and resolving it would emit `@media --`. */\n if (atKey === \"@--\") {\n return;\n }\n if (isDeclarationAtRule(atKey)) {\n emit(\n [...conditions, atKey],\n null,\n declarationsOf(block, false, true, \"unscoped\"),\n \"unscoped\",\n block[\"$description\"],\n );\n return;\n }\n if (isKeyframesAtRule(atKey)) {\n emitKeyframes(atKey, block, conditions);\n return;\n }\n const query = resolveAtQuery(atKey, mediaQueries);\n const atRule = query === null ? atKey : `@media ${query}`;\n const scheme = query === null ? null : pureSchemeOf(query);\n if (scheme !== null && selector !== null) {\n const { auto, forced } = schemeSelectors(selector, scheme);\n walk(block, auto, [...conditions, atRule], target);\n walk(withoutKeyframes(block), forced, conditions, target);\n return;\n }\n walk(block, selector, [...conditions, atRule], target);\n };\n\n function walk(\n node: JxStyle,\n selector: string | null,\n conditions: readonly string[],\n target: CssRuleTarget,\n ) {\n emit(\n conditions,\n selector,\n declarationsOf(node, true, true, target),\n target,\n node[\"$description\"],\n );\n for (const [key, value] of Object.entries(node)) {\n for (const block of blocksOf(key, value)) {\n if (key.startsWith(\"@\")) {\n walkAt(key, block, selector, conditions, target);\n } else if (selector !== null) {\n walk(\n block,\n resolveNestedSelector(selector, key),\n conditions,\n compoundsOntoScope(key) ? target : \"descendant\",\n );\n }\n }\n }\n }\n\n walk(style, scope, [], \"self\");\n return rules;\n}\n",
|
|
9
9
|
"/**\n * The blessed `Intl` helpers: one list, read by everything that needs to know them.\n *\n * **The list used to exist in four places** — the runtime's allow-set, the runtime's dispatch\n * table, the compiler's emitter, and a prose JSON-Schema description enumerating them by name. The\n * description was the dangerous one: nothing checked it, so a helper could ship and the schema go\n * on telling authors it did not exist. The names live here; the runtime and the schema description\n * both read them, and a test asserts the two agree.\n *\n * **Why helpers and not the constructors.** ECMA-402's formatters are constructors, and a formula\n * is a pure call — `new` is not in the expression grammar and should not be. Each helper wraps\n * construct-then-format, which is the shape a document author wants anyway.\n *\n * **Every helper takes an explicit locale.** `new Intl.NumberFormat(undefined)` reads the _host's_\n * locale, so the same document compiled on two machines emits different text. A call that names no\n * locale gets the **page's** — which is a function of the route, not of the build machine — and\n * failing that the fixed default below; see `site-architecture.md` §13.7.\n *\n * Pure data and no imports, so a browser bundle, the compiler and the schema generator can all read\n * it without pulling anything else in.\n *\n * @docs studio/logic/formulas\n */\n\n/**\n * The locale a helper uses when a formula names none **and there is no page to ask**.\n *\n * **Not the host's.** `new Intl.NumberFormat(undefined)` reads the machine's locale, so the same\n * document renders `1,234.5` on one build machine and `1.234,5` on another, and a site's output\n * stops being a function of its input.\n *\n * A page's own locale is the better answer where there is one — a page under `/fr/` that formats a\n * date means French, and it already said so in `<html lang>` — so `$page.locale` is consulted first\n * (see `INTL_LOCALE_PARAM`). That preserves the property this constant exists for, because\n * `$page.locale` is a function of the route and the document rather than of the machine. This value\n * is what remains for a scope with no page: a component's own state, or the runtime evaluated\n * standalone.\n */\nexport const DEFAULT_FORMAT_LOCALE = \"en-US\";\n\n/**\n * The time zone `Intl/formatDate` uses when the formula's options name none.\n *\n * The same determinism argument as the locale, and worse in effect: a locale changes how a date\n * reads, a time zone can change **which day it is**. A post timestamped `2026-08-16T02:00Z` renders\n * as the 16th in UTC and the 15th in New York, so a build machine's zone would silently move dates\n * in published HTML. UTC is the one zone that is the same everywhere.\n */\nexport const DEFAULT_TIME_ZONE = \"UTC\";\n\n/** One blessed helper: its callee path (after `window#/`) and what it wraps. */\nexport interface IntlHelper {\n /** The callee path an expression names, e.g. `Intl/formatNumber`. */\n path: string;\n /** The ECMA-402 constructor it wraps. */\n api: string;\n /** Parameter names, in order, for documentation and for the compiled call. */\n params: string[];\n /** One line, for the formula catalogue and the schema description. */\n summary: string;\n}\n\n/**\n * Every blessed `Intl` helper, in the order they are documented.\n *\n * **`DurationFormat` is deliberately absent.** Its baseline support is not universal, and a blessed\n * global that throws on a browser Jx claims to support is worse than one that does not exist: the\n * author writes a formula that works on their machine and fails on a visitor's.\n */\nexport const INTL_HELPERS: readonly IntlHelper[] = [\n {\n api: \"Intl.NumberFormat\",\n params: [\"value\", \"locale\", \"options\"],\n path: \"Intl/formatNumber\",\n summary: \"Format a number for a locale — grouping, decimals, currency, percent, units.\",\n },\n {\n api: \"Intl.DateTimeFormat\",\n params: [\"value\", \"locale\", \"options\"],\n path: \"Intl/formatDate\",\n summary: \"Format a date or timestamp for a locale. Pass `timeZone` in options.\",\n },\n {\n api: \"Intl.RelativeTimeFormat\",\n params: [\"value\", \"unit\", \"locale\", \"options\"],\n path: \"Intl/formatRelativeTime\",\n summary: 'Format a relative time — `-3, \"day\"` becomes \"3 days ago\".',\n },\n {\n api: \"Intl.ListFormat\",\n params: [\"values\", \"locale\", \"options\"],\n path: \"Intl/formatList\",\n summary: 'Join a list the way a locale does — \"a, b, and c\", not a hand-written comma join.',\n },\n {\n api: \"Intl.PluralRules\",\n params: [\"value\", \"locale\", \"options\"],\n path: \"Intl/plural\",\n summary:\n 'Which plural category a number falls in (\"one\", \"few\", \"other\") — many languages have ' +\n \"more than two, so a ternary on `n === 1` is wrong outside English.\",\n },\n {\n api: \"Intl.Collator\",\n params: [\"a\", \"b\", \"locale\", \"options\"],\n path: \"Intl/compare\",\n summary:\n \"Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts \" +\n '\"Zebra\" before \"apple\" and sorts every accented word into the wrong place.',\n },\n {\n api: \"Intl.DisplayNames\",\n params: [\"code\", \"type\", \"locale\", \"options\"],\n path: \"Intl/displayName\",\n summary:\n 'The name of a language, region, script or currency in a locale — \"de\" as \"German\" or ' +\n '\"Deutsch\", from CLDR rather than a hand-kept table.',\n },\n {\n api: \"Intl.Segmenter\",\n params: [\"value\", \"granularity\", \"locale\"],\n path: \"Intl/segment\",\n summary:\n \"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, \" +\n \"so it cuts an emoji with a skin-tone modifier in half.\",\n },\n] as const;\n\n/** Just the callee paths, for the runtime's allow-set. */\nexport const INTL_HELPER_PATHS: readonly string[] = INTL_HELPERS.map((helper) => helper.path);\n\n/**\n * Where each helper's `locale` argument sits, so a call that omits it can be given the page's.\n *\n * Derived from `params` rather than written out, for the reason this module exists at all: a\n * hand-kept second list is what let the schema description drift from the implementation. The\n * position differs per helper — `formatNumber` takes it second, `formatRelativeTime` third — and a\n * table that disagreed with the signature would pass the wrong argument silently, which reads as a\n * formatting bug rather than a wiring one.\n */\nexport const INTL_LOCALE_PARAM: Readonly<Record<string, number>> = Object.fromEntries(\n INTL_HELPERS.map((helper) => [helper.path, helper.params.indexOf(\"locale\")]),\n);\n\n/**\n * The helper names as one clause, for the `call` operator's JSON-Schema description.\n *\n * Generated rather than typed out, because a hand-written enumeration is what let the schema drift\n * from the implementation in the first place.\n *\n * @returns {string}\n */\nexport function intlHelpersClause(): string {\n return `the Intl helpers ${INTL_HELPER_PATHS.join(\", \")}`;\n}\n",
|
|
10
10
|
"/**\n * The one `$ref` path grammar — the tokenizer, and the JavaScript accessor built from it.\n *\n * There used to be five, and they disagreed. Two read paths split a path on `/` **and** `.`; the\n * compiler's build-time evaluator split on `/` alone; `resolveWritableRef` split on `/` alone, so a\n * write to `#/state/a/b.c` landed on a key the matching read could never see; and four lowering\n * functions did neither — they ran `replaceAll(\"/\", \".\")` and emitted the result as raw member\n * access. That last one is why `#/state/items/0` compiled to `s.items.0`, a SyntaxError, while the\n * build reported success.\n *\n * Segments are separated by `/` and nothing else, which is RFC 6901 §3: the ABNF excludes only `/`\n * and `~` from a reference token, so `.` is an ordinary character and `#/state/user.name` denotes\n * one member literally named `user.name`. Making the dot ordinary is what lets all five paths share\n * this file — it was the only rule they differed on.\n *\n * @docs framework/concepts/references\n */\n\n/** `~1` is `/` and `~0` is `~`; RFC 6901 §4 fixes this order so `~01` becomes `~1`, not `/`. */\nexport function unescapeToken(token: string): string {\n return token.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\");\n}\n\n/** `~` and `/` are the two characters a token cannot carry literally (RFC 6901 §3). */\nexport function escapeToken(key: string): string {\n return key.replaceAll(\"~\", \"~0\").replaceAll(\"/\", \"~1\");\n}\n\n/**\n * Split a `$ref` path — the part after its scheme — into member names.\n *\n * An empty path is no segments rather than one empty segment, so `#/state/` reads `state` itself\n * rather than a member named \"\".\n *\n * @param {string} path - E.g. `user/name`, `items/0`, `a~1b`\n * @returns {string[]} Unescaped member names\n */\nexport function refSegments(path: string): string[] {\n if (path === \"\") {\n return [];\n }\n return path.split(\"/\").map((token) => unescapeToken(token));\n}\n\n/**\n * Walk a value along a `$ref` path, or `undefined` where the path leaves the object.\n *\n * @param {unknown} root\n * @param {string} path\n * @returns {unknown}\n */\nexport function readPath(root: unknown, path: string): unknown {\n let current = root;\n for (const key of refSegments(path)) {\n current = (current as Record<string, unknown> | null | undefined)?.[key];\n }\n return current;\n}\n\n/**\n * A segment that can follow a `.` — deliberately ASCII-only, so anything exotic takes the bracket\n * branch rather than relying on this regex to model ECMAScript's full identifier grammar. Reserved\n * words are fine: `s.class` and `s.new` are legal member accesses.\n */\nconst IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n/**\n * A JavaScript expression reading `path` from `base`.\n *\n * Dotted where a segment is genuinely an identifier, bracketed with a JSON-quoted key where it is\n * not — the emitted module is read in devtools by the site's author, and `state.cart.push(3)` is\n * worth keeping over `state[\"cart\"].push(3)`.\n *\n * The bug was never dot notation; it was dot notation with no other branch. The compiler ran\n * `replaceAll(\"/\", \".\")` unconditionally, so `#/state/items/0` became `s.items.0` — a SyntaxError\n * emitted by a build that reported success — and a key holding a hyphen or a space did the same.\n * `$args/` already bracketed everything, which is why shipped `$args/values/0` formulas worked\n * while `#/state/items/0` did not. One rule now, with the safe branch as the fallback.\n *\n * @param {string} base - Receiver expression, e.g. `s` or `_args`\n * @param {string} path\n * @returns {string}\n */\nexport function refAccessor(base: string, path: string): string {\n let expr = base;\n for (const key of refSegments(path)) {\n expr += IDENTIFIER.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n }\n return expr;\n}\n\n/**\n * An object-literal key: bare where it is an identifier, JSON-quoted where it is not.\n *\n * Both forms are valid JavaScript, so this is only about what the emitted module reads like — and\n * quoting is the branch that has to exist, because a document may legally declare a state key of\n * `user.name` and pasting that raw produced `user.name: 1,`, a SyntaxError.\n *\n * @param {string} key\n * @returns {string}\n */\nexport function objectKey(key: string): string {\n return IDENTIFIER.test(key) ? key : JSON.stringify(key);\n}\n\n/**\n * A safe identifier naming one binding in a generated `bind`/`on` map.\n *\n * The key is emitted as an object-literal key _and_ as a `data-bind` attribute value _and_ as\n * `on.<key>` member access, so unlike {@link objectKey} it cannot fall back to quoting — it has to\n * be an identifier outright. Every character outside `[A-Za-z0-9_$]` becomes `_` and a leading\n * digit gains a prefix; nothing else is touched.\n *\n * `$` is deliberately kept. Folding it would rename the `$handler` key while the emitted call site\n * still said `on.$handler`, unbinding the handler with no error anywhere. Runs of `_` are likewise\n * left alone: collapsing them made `a__b` and `a_b` collide for cosmetic reasons.\n *\n * Distinct paths can still collide (`a/b` and `a.b` both give `a_b`); callers needing uniqueness\n * compare the paths themselves.\n *\n * @param {string} ref - The ref, prefix already stripped by the caller\n * @returns {string}\n */\nexport function refBindingKey(ref: string): string {\n const safe = ref.replaceAll(/[^A-Za-z0-9_$]/g, \"_\");\n if (safe === \"\") {\n return \"ref\";\n }\n return /^\\d/.test(safe) ? `_${safe}` : safe;\n}\n",
|
|
11
11
|
"/// <reference lib=\"dom\" />\n/**\n * Jx Declarative Expression Engine (spec §19)\n *\n * Shared module used by both runtime (evaluateExpression) and compiler (compileExpression).\n *\n * @module expression\n */\n\nimport {\n DEFAULT_FORMAT_LOCALE,\n DEFAULT_TIME_ZONE,\n INTL_HELPER_PATHS,\n INTL_LOCALE_PARAM,\n} from \"@jxsuite/schema/intl\";\nimport type { JxExpressionNode, JxExpressionOperand } from \"@jxsuite/schema/types\";\nimport type { JxScope } from \"./types.ts\";\nimport { readPath, refAccessor, refSegments } from \"./pointer.ts\";\n\n/** The runtime's expression node — the schema's expression model. */\nexport type ExpressionNode = JxExpressionNode;\nexport type ExpressionOperand = JxExpressionOperand;\n\n/** The `$map` iteration context object stored in scope during mapped rendering. */\ninterface ScopeMapCtx {\n item?: unknown;\n index?: number;\n [key: string]: unknown;\n}\n\n/** View the scope's `$map` iteration context, if present. */\nfunction scopeMap(state: JxScope): ScopeMapCtx | undefined {\n const map = state.$map;\n return map && typeof map === \"object\" ? (map as ScopeMapCtx) : undefined;\n}\n\ninterface CompileOpts {\n statePrefix?: string;\n eventParam?: string;\n /**\n * Parameter-name order per named-formula state key, used by `call` sites to map positional\n * argument lists onto the emitted formula functions' named-args object.\n */\n formulaParams?: Record<string, string[]>;\n}\n\nconst MUTATING_OPS = new Set([\n \"=\",\n \"+=\",\n \"-=\",\n \"*=\",\n \"/=\",\n \"push\",\n \"pop\",\n \"shift\",\n \"unshift\",\n \"splice\",\n]);\nconst UNARY_OPS = new Set([\"!\", \"-\"]);\nconst BINARY_OPS = new Set([\n \"+\",\n \"-\",\n \"*\",\n \"/\",\n \"%\",\n \"===\",\n \"!==\",\n \"<\",\n \"<=\",\n \">\",\n \">=\",\n \"&&\",\n \"||\",\n \"??\",\n]);\nconst ASSIGNMENT_OPS = new Set([\"=\", \"+=\", \"-=\", \"*=\", \"/=\"]);\nconst ARRAY_METHOD_OPS = new Set([\"push\", \"pop\", \"shift\", \"unshift\", \"splice\"]);\nconst AGGREGATE_OPS = new Set([\"reduce\", \"map\", \"filter\"]);\nconst CONDITIONAL_OPS = new Set([\"?:\", \"switch\"]);\n\n/**\n * Pure standard-library method operators (spec §19.4d): genuine `String.prototype` /\n * `Array.prototype` / `Number.prototype` methods that never mutate their receiver — the ES2023\n * change-by-copy family stands in where mutation would otherwise occur (`toSorted`, not `sort`).\n * Receiver in `target`; `value` carries the argument (bare scalar) or argument list (array), the\n * splice precedent. No token is invented.\n */\nexport const PURE_METHOD_OPS = new Set([\n // Array.prototype (and the String.prototype homonyms: includes/indexOf/slice/at/concat)\n \"includes\",\n \"indexOf\",\n \"lastIndexOf\",\n \"join\",\n \"slice\",\n \"concat\",\n \"at\",\n \"flat\",\n \"toSorted\",\n \"toReversed\",\n \"toSpliced\",\n \"with\",\n // String.prototype\n \"toUpperCase\",\n \"toLowerCase\",\n \"trim\",\n \"trimStart\",\n \"trimEnd\",\n \"split\",\n \"startsWith\",\n \"endsWith\",\n \"padStart\",\n \"padEnd\",\n \"replaceAll\",\n \"repeat\",\n \"charAt\",\n \"normalize\",\n \"toLocaleUpperCase\",\n \"toLocaleLowerCase\",\n // Number.prototype\n \"toFixed\",\n \"toPrecision\",\n \"toLocaleString\",\n]);\n\nexport const BLESSED_OPERATORS = new Set([\n ...MUTATING_OPS,\n ...UNARY_OPS,\n ...BINARY_OPS,\n ...AGGREGATE_OPS,\n ...CONDITIONAL_OPS,\n ...PURE_METHOD_OPS,\n \"call\",\n]);\n\n/**\n * Pure globals a `call` node may target through the `window#/` scheme (spec §19.4c). Every entry is\n * a genuine ECMAScript or WHATWG standard-library function with no side effects; anything off this\n * list is a compile-time error, keeping formula purity decidable.\n */\nexport const BLESSED_GLOBALS = new Set([\n // Global functions\n \"isNaN\",\n \"isFinite\",\n \"parseFloat\",\n \"parseInt\",\n \"encodeURIComponent\",\n \"decodeURIComponent\",\n \"structuredClone\",\n // Math\n \"Math/abs\",\n \"Math/ceil\",\n \"Math/floor\",\n \"Math/round\",\n \"Math/trunc\",\n \"Math/sign\",\n \"Math/sqrt\",\n \"Math/cbrt\",\n \"Math/pow\",\n \"Math/exp\",\n \"Math/log\",\n \"Math/log2\",\n \"Math/log10\",\n \"Math/min\",\n \"Math/max\",\n \"Math/hypot\",\n // Number\n \"Number/isInteger\",\n \"Number/isFinite\",\n \"Number/isNaN\",\n \"Number/parseFloat\",\n \"Number/parseInt\",\n // JSON\n \"JSON/parse\",\n \"JSON/stringify\",\n // Object\n \"Object/keys\",\n \"Object/values\",\n \"Object/entries\",\n \"Object/fromEntries\",\n // Array\n \"Array/from\",\n \"Array/isArray\",\n \"Array/of\",\n // String\n \"String/fromCharCode\",\n \"String/fromCodePoint\",\n // Intl helpers come from @jxsuite/schema/intl — see BLESSED_HELPERS. One list, so the runtime,\n // The compiler and the JSON-Schema description cannot drift apart.\n ...INTL_HELPER_PATHS,\n]);\n\n/**\n * Synthetic blessed helpers (spec §19.4c): pure functions that have no direct `window` global\n * because the underlying standard-library API is a constructor. The interpreter dispatches to\n * these; the compiler emits the equivalent inline construct-then-format expression.\n */\nconst BLESSED_HELPERS: Record<string, (...a: unknown[]) => unknown> = {\n \"Intl/compare\": (a, b, locale, options) =>\n new Intl.Collator(\n (locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE,\n options as Intl.CollatorOptions | undefined,\n ).compare(a as string, b as string),\n \"Intl/displayName\": (code, type, locale, options) =>\n new Intl.DisplayNames((locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE, {\n ...(options as Intl.DisplayNamesOptions | undefined),\n type: (type as Intl.DisplayNamesType | undefined) ?? \"language\",\n }).of(code as string),\n \"Intl/formatDate\": (value, locale, options) =>\n new Intl.DateTimeFormat((locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE, {\n timeZone: DEFAULT_TIME_ZONE,\n ...(options as Intl.DateTimeFormatOptions | undefined),\n }).format(new Date(value as string | number | Date)),\n \"Intl/formatList\": (values, locale, options) =>\n new Intl.ListFormat(\n (locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE,\n options as Intl.ListFormatOptions | undefined,\n ).format(values as string[]),\n \"Intl/formatNumber\": (value, locale, options) =>\n new Intl.NumberFormat(\n (locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE,\n options as Intl.NumberFormatOptions | undefined,\n ).format(value as number),\n \"Intl/formatRelativeTime\": (value, unit, locale, options) =>\n new Intl.RelativeTimeFormat(\n (locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE,\n options as Intl.RelativeTimeFormatOptions | undefined,\n ).format(value as number, unit as Intl.RelativeTimeFormatUnit),\n \"Intl/plural\": (value, locale, options) =>\n new Intl.PluralRules(\n (locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE,\n options as Intl.PluralRulesOptions | undefined,\n ).select(value as number),\n /* Returns the segments as plain strings, because a formula's value has to be JSON — the\n Segmenter's own iterator of {segment, index, isWordLike} records is not. */\n \"Intl/segment\": (value, granularity, locale) =>\n [\n ...new Intl.Segmenter((locale as string | undefined) ?? DEFAULT_FORMAT_LOCALE, {\n granularity: (granularity as \"grapheme\" | \"sentence\" | \"word\" | undefined) ?? \"grapheme\",\n }).segment(value as string),\n ].map((part) => part.segment),\n};\n\n/**\n * Fill in a helper's omitted `locale` argument from the page's own locale.\n *\n * A page under `/fr/` that formats a date without naming a locale means French: the route said so,\n * `<html lang>` says so, and `hreflang` tells every crawler so. Requiring the author to repeat it\n * at every call site is how a translated page ends up with English dates and English number\n * grouping on it — a defect that is invisible to the person who built the site in their own\n * language, and obvious to every reader of the other one.\n *\n * Determinism is untouched, which is the property `DEFAULT_FORMAT_LOCALE` exists to protect:\n * `$page.locale` is a function of the route and the document (site-architecture.md §13.4), not of\n * the machine the build runs on. A scope with no `$page` — a component's own state, the runtime\n * used standalone — keeps the fixed default.\n *\n * @param {string} path - Helper callee path, e.g. `Intl/formatNumber`\n * @param {unknown[]} args - Resolved arguments, in declaration order\n * @param {JxScope} state\n * @returns {unknown[]}\n */\nfunction withPageLocale(path: string, args: unknown[], state: JxScope): unknown[] {\n const index = INTL_LOCALE_PARAM[path];\n if (index === undefined || index < 0 || args[index] != null) {\n return args;\n }\n const page = (state as { $page?: { locale?: unknown } }).$page;\n const locale = page?.locale;\n if (typeof locale !== \"string\" || locale === \"\") {\n return args;\n }\n const filled = [...args];\n filled[index] = locale;\n return filled;\n}\n\n/** Whether a `window#/…` callee ref is on the blessed pure-globals list. */\nexport function isBlessedGlobal(ref: string): boolean {\n return ref.startsWith(\"window#/\") && BLESSED_GLOBALS.has(ref.slice(\"window#/\".length));\n}\n\n/**\n * @param {string} op\n * @returns {boolean}\n */\nexport function isMutating(op: string) {\n return MUTATING_OPS.has(op);\n}\n\n// ─── Runtime Evaluation ──────────────────────────────────────────────────────\n\ninterface IterCtx {\n acc?: unknown;\n item?: unknown;\n index?: number;\n /** Named-formula arguments bound for the current `call` body ($args/<name> refs). */\n args?: Record<string, unknown>;\n /** Call-nesting depth; capped at MAX_CALL_DEPTH to bound recursive formulas. */\n callDepth?: number;\n}\n\n/** Recursion bound for `call` chains (formula → formula), mirroring MAX_REPORT_DEPTH. */\nexport const MAX_CALL_DEPTH = 64;\n\n/**\n * Editor-mode evaluation trace (spec §19.9). When passed, every node and operand reports its\n * evaluated value keyed by its path within the expression tree, and the branch-selecting operators\n * (`?:`, `switch` — plus the eager `&&`/`||`/`??`) yield values for ALL branches so a visual editor\n * can badge every node. Absent (production), evaluation is untouched.\n */\nexport interface ExpressionTrace {\n report: (path: (string | number)[], value: unknown) => void;\n /** Current node path — internal; leave unset at the call boundary. */\n path?: (string | number)[];\n /** Recursion depth — internal; reporting stops beyond MAX_REPORT_DEPTH. */\n depth?: number;\n}\n\n/** Reporting recursion bound: branch-forcing removes natural exit conditions, so cap the walk. */\nexport const MAX_REPORT_DEPTH = 64;\n\n/** Derive the trace for a child operand at path segment(s) `seg`; undefined once capped. */\nfunction subTrace(\n trace: ExpressionTrace | undefined,\n seg: string | number | (string | number)[],\n): ExpressionTrace | undefined {\n if (!trace) {\n return undefined;\n }\n const depth = (trace.depth ?? 0) + 1;\n if (depth > MAX_REPORT_DEPTH) {\n return undefined;\n }\n return {\n depth,\n path: [...(trace.path ?? []), ...(Array.isArray(seg) ? seg : [seg])],\n report: trace.report,\n };\n}\n\n/** Resolve an operand to its runtime value. */\nfunction resolveOperand(\n operand: unknown,\n state: JxScope,\n event: Event | null,\n iterCtx?: IterCtx,\n trace?: ExpressionTrace,\n): unknown {\n if (operand === null || operand === undefined) {\n return operand;\n }\n\n // Nested expression node\n if (typeof operand === \"object\" && !Array.isArray(operand) && \"operator\" in operand) {\n return evaluateExpression(operand as ExpressionNode, state, event, iterCtx, trace);\n }\n\n // $ref pointer\n if (typeof operand === \"object\" && !Array.isArray(operand) && \"$ref\" in operand) {\n const resolved = resolveExprRef((operand as { $ref: string }).$ref, state, event, iterCtx);\n trace?.report(trace.path ?? [], resolved);\n return resolved;\n }\n\n // Array of operands (e.g., splice args)\n if (Array.isArray(operand)) {\n return operand.map((o: unknown, i: number) =>\n resolveOperand(o, state, event, iterCtx, subTrace(trace, i)),\n );\n }\n\n // Literal\n trace?.report(trace.path ?? [], operand);\n return operand;\n}\n\n/** Resolve a $ref string within expression context. */\n/**\n * The receiver a `call` binds: the value the pointer's parent path names. `#/state/x` and\n * `parent#/x` are owned by the scope itself; `$map/item/fn` by the item; a pointer with no parent\n * segment (`$map/item`, `$args/x`) has no owner.\n */\nfunction calleeOwner(ref: string, state: JxScope, event: Event | null, iterCtx?: IterCtx): unknown {\n const parentRef = (prefix: string): unknown => {\n const rest = ref.slice(prefix.length);\n if (!rest.includes(\"/\")) {\n return state;\n }\n return resolveExprRef(ref.slice(0, ref.lastIndexOf(\"/\")), state, event, iterCtx);\n };\n if (ref.startsWith(\"#/state/\")) {\n return parentRef(\"#/state/\");\n }\n if (ref.startsWith(\"parent#/\")) {\n return parentRef(\"parent#/\");\n }\n if (ref.startsWith(\"$map/\") || ref.startsWith(\"$args/\")) {\n return ref.split(\"/\").length > 2\n ? resolveExprRef(ref.slice(0, ref.lastIndexOf(\"/\")), state, event, iterCtx)\n : undefined;\n }\n return undefined;\n}\n\nfunction resolveExprRef(ref: string, state: JxScope, event: Event | null, iterCtx?: IterCtx) {\n if (ref === \"$reduce/acc\") {\n return iterCtx?.acc;\n }\n if (ref.startsWith(\"$reduce/\")) {\n return iterCtx?.acc;\n }\n if (ref.startsWith(\"$args/\")) {\n const parts = ref.slice(\"$args/\".length).split(\"/\");\n const base = iterCtx?.args?.[parts[0]!];\n return parts.length > 1 ? getPath(base, parts.slice(1).join(\"/\")) : base;\n }\n if (ref.startsWith(\"event#/\")) {\n const path = ref.slice(\"event#/\".length);\n return getPath(event, path);\n }\n if (ref.startsWith(\"$map/\")) {\n const parts = ref.split(\"/\");\n const [, key] = parts;\n let base;\n const map = scopeMap(state);\n if (key === \"item\") {\n base = iterCtx?.item ?? map?.item ?? state[\"$map/item\"];\n } else if (key === \"index\") {\n base = iterCtx?.index ?? map?.index ?? state[\"$map/index\"];\n } else {\n base = map?.[key!] ?? state[`$map/${key}`];\n }\n return parts.length > 2 ? getPath(base, parts.slice(2).join(\"/\")) : base;\n }\n if (ref.startsWith(\"#/state/\")) {\n // One call, not a hand-split leading token: slicing at the first `/` skipped unescaping it, so\n // `#/state/a~1b/c` looked for a member called `a~1b` rather than `a/b`.\n return readPath(state, ref.slice(\"#/state/\".length));\n }\n if (ref.startsWith(\"parent#/\")) {\n /*\n * A prop name may be a path into the prop. This read the whole path as one key and returned\n * undefined for `parent#/user/name`, while the lowerer above compiled it to a walk.\n */\n return readPath(state, ref.slice(\"parent#/\".length));\n }\n if (ref.startsWith(\"window#/\")) {\n return getPath(globalThis.window, ref.slice(\"window#/\".length));\n }\n if (ref.startsWith(\"document#/\")) {\n return getPath(globalThis.document, ref.slice(\"document#/\".length));\n }\n return readPath(state, ref) ?? null;\n}\n\n/** Resolve a $ref to a writable location — returns { obj, key } for assignment. */\nfunction resolveWritableRef(\n ref: string,\n state: JxScope,\n _event: Event | null,\n iterCtx?: IterCtx,\n): { obj: JxScope; key: string } {\n if (ref.startsWith(\"$map/\")) {\n const parts = ref.split(\"/\");\n const [, key] = parts;\n let base;\n const map = scopeMap(state);\n if (key === \"item\") {\n base = iterCtx?.item ?? map?.item ?? state[\"$map/item\"];\n } else if (key === \"index\") {\n base = iterCtx?.index ?? map?.index ?? state[\"$map/index\"];\n } else {\n base = map?.[key!] ?? state[`$map/${key}`];\n }\n if (parts.length > 2) {\n const pathParts = parts.slice(2);\n const lastKey = pathParts.pop();\n const obj = pathParts.length > 0 ? getPath(base, pathParts.join(\"/\")) : base;\n return { key: lastKey as string, obj: obj as JxScope };\n }\n return {\n key: key === \"item\" ? \"$map/item\" : \"$map/index\",\n obj: scopeMap(state) ?? state,\n };\n }\n if (ref.startsWith(\"#/state/\")) {\n const sub = ref.slice(\"#/state/\".length);\n const slash = sub.indexOf(\"/\");\n if (slash === -1) {\n return { key: sub, obj: state };\n }\n /*\n * The same tokenizer the read path uses. It used to split on `/` alone while the read split on\n * `/[./]/`, so a write to `#/state/a/b.c` created a key `\"b.c\"` that the matching read — which\n * walked `b` then `c` — could never see. The write simply vanished.\n */\n const parts = refSegments(sub);\n const lastKey = parts.pop();\n let obj = state;\n // Pointer paths address objects by construction (validated by the schema).\n for (const p of parts) {\n obj = obj[p] as JxScope;\n }\n return { key: lastKey as string, obj };\n }\n return { key: ref, obj: state };\n}\n\n/** Evaluate an expression node at runtime. */\nexport function evaluateExpression(\n node: ExpressionNode,\n state: JxScope,\n event: Event | null,\n iterCtx?: IterCtx,\n trace?: ExpressionTrace,\n): unknown {\n const result = evaluateNode(node, state, event, iterCtx, trace);\n trace?.report(trace.path ?? [], result);\n return result;\n}\n\nfunction evaluateNode(\n node: ExpressionNode,\n state: JxScope,\n event: Event | null,\n iterCtx?: IterCtx,\n trace?: ExpressionTrace,\n): unknown {\n const { operator, target, value, initial } = node;\n\n if (!BLESSED_OPERATORS.has(operator)) {\n throw new Error(`$expression: unknown operator \"${operator}\"`);\n }\n\n // ─── Unary ───\n if (UNARY_OPS.has(operator) && !(\"value\" in node)) {\n const operand: unknown = resolveOperand(\n target,\n state,\n event,\n iterCtx,\n subTrace(trace, \"target\"),\n );\n if (operator === \"!\") {\n return !operand;\n }\n if (operator === \"-\") {\n return -(operand as number);\n }\n }\n\n // ─── Call (spec §19.4c) ───\n if (operator === \"call\") {\n const calleeRef = (target as { $ref?: string } | null)?.$ref;\n if (typeof calleeRef !== \"string\") {\n throw new TypeError(\"$expression: call target must be a $ref pointer\");\n }\n const callDepth = (iterCtx?.callDepth ?? 0) + 1;\n if (callDepth > MAX_CALL_DEPTH) {\n throw new Error(`$expression: call depth exceeded (${MAX_CALL_DEPTH})`);\n }\n const argValues = Array.isArray(value)\n ? value.map((o: unknown, i: number) =>\n resolveOperand(o, state, event, iterCtx, subTrace(trace, [\"value\", i])),\n )\n : [];\n\n // Blessed pure global via the window#/ scheme (Math.max, JSON.parse, …).\n if (calleeRef.startsWith(\"window#/\")) {\n if (!isBlessedGlobal(calleeRef)) {\n throw new Error(`$expression: \"${calleeRef}\" is not a blessed pure global`);\n }\n const globalPath = calleeRef.slice(\"window#/\".length);\n const helper = BLESSED_HELPERS[globalPath];\n if (helper) {\n return helper(...withPageLocale(globalPath, argValues, state));\n }\n const fn = getPath(globalThis.window, globalPath) as (...a: unknown[]) => unknown;\n const lastSlash = globalPath.lastIndexOf(\"/\");\n const thisArg =\n lastSlash === -1\n ? globalThis.window\n : getPath(globalThis.window, globalPath.slice(0, lastSlash));\n return fn.apply(thisArg, argValues);\n }\n\n const callee = resolveExprRef(calleeRef, state, event, iterCtx);\n // A scope callable (buildScope lowers parameterized formula entries to functions). The receiver\n // Is the object that owns the pointer's last segment — what the compiled lowering binds when it\n // Emits `s.commands.run(...)` — so a host method handed in through the scope keeps its `this`.\n if (typeof callee === \"function\") {\n return (callee as (...a: unknown[]) => unknown).apply(\n calleeOwner(calleeRef, state, event, iterCtx),\n argValues,\n );\n }\n // A raw named-formula def (standalone evaluation, e.g. editor preview).\n if (callee && typeof callee === \"object\" && \"$expression\" in callee) {\n const def = callee as { $expression: ExpressionNode; parameters?: unknown[] };\n const args: Record<string, unknown> = {};\n for (const [i, p] of (def.parameters ?? []).entries()) {\n const name = typeof p === \"string\" ? p : ((p as { name?: string } | null)?.name ?? \"\");\n if (!name) {\n continue;\n }\n args[name] =\n argValues[i] === undefined && typeof p === \"object\" && p !== null && \"default\" in p\n ? (p as { default?: unknown }).default\n : argValues[i];\n }\n // The callee body's node paths are its own tree, not the call site's — no trace inside.\n return evaluateExpression(def.$expression, state, event, { args, callDepth });\n }\n throw new TypeError(`$expression: call target \"${calleeRef}\" is not callable`);\n }\n\n // ─── Conditional (pure) ───\n if (CONDITIONAL_OPS.has(operator)) {\n if (operator === \"?:\") {\n const test = resolveOperand(target, state, event, iterCtx, subTrace(trace, \"target\"));\n if (trace) {\n // Editor mode: evaluate both branches so each carries a live value.\n const consequent = resolveOperand(value, state, event, iterCtx, subTrace(trace, \"value\"));\n const alternate = resolveOperand(\n initial,\n state,\n event,\n iterCtx,\n subTrace(trace, \"initial\"),\n );\n return test ? consequent : alternate;\n }\n return test\n ? resolveOperand(value, state, event, iterCtx)\n : resolveOperand(initial, state, event, iterCtx);\n }\n // Switch — value-keyed selection; discriminant matched against case keys by string form.\n const discriminant = resolveOperand(target, state, event, iterCtx, subTrace(trace, \"target\"));\n const key = String(discriminant);\n const cases = node.cases ?? {};\n const matched = Object.hasOwn(cases, key);\n if (trace) {\n let result: unknown;\n for (const [k, caseOperand] of Object.entries(cases)) {\n const v = resolveOperand(caseOperand, state, event, iterCtx, subTrace(trace, [\"cases\", k]));\n if (k === key) {\n result = v;\n }\n }\n const fallback = resolveOperand(\n node.default,\n state,\n event,\n iterCtx,\n subTrace(trace, \"default\"),\n );\n return matched ? result : fallback;\n }\n return matched\n ? resolveOperand(cases[key], state, event, iterCtx)\n : resolveOperand(node.default, state, event, iterCtx);\n }\n\n // ─── Binary (pure) ───\n if (BINARY_OPS.has(operator)) {\n const left = resolveOperand(\n target,\n state,\n event,\n iterCtx,\n subTrace(trace, \"target\"),\n ) as number & string;\n const right = resolveOperand(value, state, event, iterCtx, subTrace(trace, \"value\")) as number &\n string;\n switch (operator) {\n case \"+\": {\n return left + right;\n }\n case \"-\": {\n return left - right;\n }\n case \"*\": {\n return left * right;\n }\n case \"/\": {\n return left / right;\n }\n case \"%\": {\n return left % right;\n }\n case \"===\": {\n return left === right;\n }\n case \"!==\": {\n return left !== right;\n }\n case \"<\": {\n return left < right;\n }\n case \"<=\": {\n return left <= right;\n }\n case \">\": {\n return left > right;\n }\n case \">=\": {\n return left >= right;\n }\n case \"&&\": {\n return left && right;\n }\n case \"||\": {\n return left || right;\n }\n case \"??\": {\n return (left as unknown) ?? (right as unknown);\n }\n default: {\n break;\n }\n }\n }\n\n // ─── Assignment ───\n if (ASSIGNMENT_OPS.has(operator)) {\n const rhs = resolveOperand(value, state, event, iterCtx, subTrace(trace, \"value\")) as number;\n const { obj, key } = resolveWritableRef(\n (target as { $ref: string }).$ref,\n state,\n event,\n iterCtx,\n );\n switch (operator) {\n case \"=\": {\n obj[key] = rhs;\n break;\n }\n case \"+=\": {\n const current = obj[key] as number;\n obj[key] = current + rhs;\n break;\n }\n case \"-=\": {\n const current = obj[key] as number;\n obj[key] = current - rhs;\n break;\n }\n case \"*=\": {\n const current = obj[key] as number;\n obj[key] = current * rhs;\n break;\n }\n case \"/=\": {\n const current = obj[key] as number;\n obj[key] = current / rhs;\n break;\n }\n default: {\n break;\n }\n }\n return;\n }\n\n // ─── Array methods ───\n if (ARRAY_METHOD_OPS.has(operator)) {\n const arr: unknown[] = resolveOperand(\n target,\n state,\n event,\n iterCtx,\n subTrace(trace, \"target\"),\n ) as unknown[];\n switch (operator) {\n case \"push\": {\n return arr.push(resolveOperand(value, state, event, iterCtx, subTrace(trace, \"value\")));\n }\n case \"unshift\": {\n return arr.unshift(resolveOperand(value, state, event, iterCtx, subTrace(trace, \"value\")));\n }\n case \"pop\": {\n return arr.pop();\n }\n case \"shift\": {\n return arr.shift();\n }\n case \"splice\": {\n const args: unknown[] = resolveOperand(\n value,\n state,\n event,\n iterCtx,\n subTrace(trace, \"value\"),\n ) as unknown[];\n return (arr.splice as (...a: unknown[]) => unknown[])(...args);\n }\n default: {\n break;\n }\n }\n }\n\n // ─── Pure standard-library methods (spec §19.4d) ───\n if (PURE_METHOD_OPS.has(operator)) {\n const receiver = resolveOperand(target, state, event, iterCtx, subTrace(trace, \"target\"));\n const args =\n value === undefined\n ? []\n : Array.isArray(value)\n ? (resolveOperand(value, state, event, iterCtx, subTrace(trace, \"value\")) as unknown[])\n : [resolveOperand(value, state, event, iterCtx, subTrace(trace, \"value\"))];\n const method = (receiver as Record<string, unknown> | null | undefined)?.[operator];\n if (typeof method !== \"function\") {\n // Null-safe, like path reads: a missing receiver or method yields undefined, not a throw.\n return undefined;\n }\n return (method as (...a: unknown[]) => unknown).apply(receiver, args);\n }\n\n // ─── Aggregates (pure) ───\n if (AGGREGATE_OPS.has(operator)) {\n const arr: unknown[] = resolveOperand(\n target,\n state,\n event,\n iterCtx,\n subTrace(trace, \"target\"),\n ) as unknown[];\n // Trace only the first iteration's per-item expression — one sample badge per node,\n // Not one report per array element.\n if (operator === \"reduce\") {\n let acc: unknown = resolveOperand(initial, state, event, iterCtx, subTrace(trace, \"initial\"));\n for (const [index, item] of arr.entries()) {\n acc = evaluateExpression(\n value as ExpressionNode,\n state,\n event,\n { acc, index, item },\n index === 0 ? subTrace(trace, \"value\") : undefined,\n );\n }\n return acc;\n }\n if (operator === \"map\") {\n return arr.map((item: unknown, index: number) =>\n evaluateExpression(\n value as ExpressionNode,\n state,\n event,\n { ...iterCtx, index, item },\n index === 0 ? subTrace(trace, \"value\") : undefined,\n ),\n );\n }\n if (operator === \"filter\") {\n return arr.filter((item: unknown, index: number) =>\n evaluateExpression(\n value as ExpressionNode,\n state,\n event,\n { ...iterCtx, index, item },\n index === 0 ? subTrace(trace, \"value\") : undefined,\n ),\n );\n }\n }\n\n return undefined;\n}\n\n// ─── Compiler: Expression → JS Source ────────────────────────────────────────\n\n/** Compile an operand to a JS source string. */\nfunction compileOperand(operand: unknown, opts: CompileOpts): string {\n if (operand === null) {\n return \"null\";\n }\n if (operand === undefined) {\n return \"undefined\";\n }\n\n // Nested expression node\n if (typeof operand === \"object\" && !Array.isArray(operand) && \"operator\" in operand) {\n return compileExpression(operand as ExpressionNode, opts);\n }\n\n // $ref pointer\n if (typeof operand === \"object\" && !Array.isArray(operand) && \"$ref\" in operand) {\n return compileRef((operand as { $ref: string }).$ref, opts);\n }\n\n // Array of operands\n if (Array.isArray(operand)) {\n return operand.map((o: unknown) => compileOperand(o, opts)).join(\", \");\n }\n\n // Literal\n return JSON.stringify(operand);\n}\n\n/**\n * The module-scope function name a named formula compiles to. Shared by call-site emission here and\n * the declaration emission in the compiler targets.\n *\n * @param {string} key\n * @returns {string}\n */\nexport function formulaFnName(key: string) {\n return `_fx_${key.replaceAll(/[^A-Za-z0-9_$]/g, \"_\")}`;\n}\n\n/**\n * Compile a $ref to its JS equivalent.\n *\n * @param {string} ref\n * @param {CompileOpts} opts\n * @returns {string}\n */\nfunction compileRef(ref: string, opts: CompileOpts) {\n const s = opts.statePrefix ?? \"state\";\n const e = opts.eventParam ?? \"event\";\n\n if (ref === \"$reduce/acc\") {\n return \"_acc\";\n }\n if (ref.startsWith(\"$reduce/\")) {\n return \"_acc\";\n }\n if (ref.startsWith(\"$args/\")) {\n return refAccessor(\"_args\", ref.slice(\"$args/\".length));\n }\n\n if (ref.startsWith(\"event#/\")) {\n return refAccessor(e, ref.slice(\"event#/\".length));\n }\n\n if (ref.startsWith(\"$map/\")) {\n const parts = ref.split(\"/\");\n const [, key] = parts;\n if (key === \"item\") {\n return parts.length > 2 ? refAccessor(\"_item\", parts.slice(2).join(\"/\")) : \"_item\";\n }\n if (key === \"index\") {\n return \"_index\";\n }\n return `_${key}`;\n }\n\n if (ref.startsWith(\"#/state/\")) {\n return refAccessor(s, ref.slice(\"#/state/\".length));\n }\n\n if (ref.startsWith(\"parent#/\")) {\n return refAccessor(s, ref.slice(\"parent#/\".length));\n }\n if (ref.startsWith(\"window#/\")) {\n return refAccessor(\"window\", ref.slice(\"window#/\".length));\n }\n if (ref.startsWith(\"document#/\")) {\n return refAccessor(\"document\", ref.slice(\"document#/\".length));\n }\n\n /*\n * An unrecognized scheme is still a path under state. Pasting it raw emitted `s.a/b`, which is\n * not a parse error but a division against an undeclared identifier.\n */\n return refAccessor(s, ref);\n}\n\n/** Compile a writable $ref target to its JS equivalent (for LHS of assignment). */\nfunction compileTarget(target: unknown, opts: CompileOpts): string {\n if (typeof target === \"object\" && target !== null && \"$ref\" in target) {\n return compileRef((target as { $ref: string }).$ref, opts);\n }\n return compileOperand(target, opts);\n}\n\n/**\n * Compile an expression node to a JS source string. Returns a statement for mutating ops, a value\n * expression for pure ops.\n *\n * @param {ExpressionNode} node\n * @param {CompileOpts} [opts]\n * @returns {string}\n */\n/**\n * Emit the inline JS for a synthetic blessed helper (see BLESSED_HELPERS), or null for ordinary\n * globals that compile to a plain `window.<path>` call.\n *\n * @param {string} path - The `window#/`-stripped callee path (e.g. \"Intl/formatNumber\")\n * @param {string[]} args - Already-compiled argument expressions\n * @param {CompileOpts} opts\n * @returns {string | null}\n */\nfunction compileHelperCall(path: string, args: string[], opts: CompileOpts): string | null {\n const a = (i: number) => args[i] ?? \"undefined\";\n /*\n * The same defaults the interpreter applies, inlined — see @jxsuite/schema/intl. The page's own\n * locale comes first and the fixed one behind it, so an island formats in the language of the\n * page it is on. `?.` and not `.`: a component's state has no `$page`, and neither does the\n * runtime evaluated standalone.\n */\n const L = `(${opts.statePrefix ?? \"state\"}?.$page?.locale ?? ${JSON.stringify(DEFAULT_FORMAT_LOCALE)})`;\n const Z = JSON.stringify(DEFAULT_TIME_ZONE);\n switch (path) {\n case \"Intl/formatNumber\": {\n return `new Intl.NumberFormat(${a(1)} ?? ${L}, ${a(2)}).format(${a(0)})`;\n }\n case \"Intl/formatDate\": {\n return (\n `new Intl.DateTimeFormat(${a(1)} ?? ${L}, ` +\n `{timeZone: ${Z}, ...${a(2)}}).format(new Date(${a(0)}))`\n );\n }\n case \"Intl/formatRelativeTime\": {\n return `new Intl.RelativeTimeFormat(${a(2)} ?? ${L}, ${a(3)}).format(${a(0)}, ${a(1)})`;\n }\n case \"Intl/formatList\": {\n return `new Intl.ListFormat(${a(1)} ?? ${L}, ${a(2)}).format(${a(0)})`;\n }\n case \"Intl/plural\": {\n return `new Intl.PluralRules(${a(1)} ?? ${L}, ${a(2)}).select(${a(0)})`;\n }\n case \"Intl/compare\": {\n return `new Intl.Collator(${a(2)} ?? ${L}, ${a(3)}).compare(${a(0)}, ${a(1)})`;\n }\n case \"Intl/displayName\": {\n return (\n `new Intl.DisplayNames(${a(2)} ?? ${L}, ` +\n `{...${a(3)}, type: ${a(1)} ?? 'language'}).of(${a(0)})`\n );\n }\n case \"Intl/segment\": {\n return (\n `[...new Intl.Segmenter(${a(2)} ?? ${L}, {granularity: ${a(1)} ?? 'grapheme'})` +\n `.segment(${a(0)})].map((p) => p.segment)`\n );\n }\n default: {\n return null;\n }\n }\n}\n\nexport function compileExpression(node: ExpressionNode, opts: CompileOpts = {}): string {\n const { operator, target, value, initial } = node;\n\n // ─── Unary ───\n if (UNARY_OPS.has(operator) && !(\"value\" in node)) {\n const operand: string = compileOperand(target, opts);\n if (operator === \"!\") {\n return `!(${operand})`;\n }\n if (operator === \"-\") {\n return `-(${operand})`;\n }\n }\n\n // ─── Call (spec §19.4c) ───\n if (operator === \"call\") {\n const calleeRef = (target as { $ref?: string } | null)?.$ref ?? \"\";\n const args = Array.isArray(value) ? value.map((o: unknown) => compileOperand(o, opts)) : [];\n if (calleeRef.startsWith(\"window#/\")) {\n if (!isBlessedGlobal(calleeRef)) {\n throw new Error(`$expression: \"${calleeRef}\" is not a blessed pure global`);\n }\n const helperJs = compileHelperCall(calleeRef.slice(\"window#/\".length), args, opts);\n if (helperJs) {\n return helperJs;\n }\n return `window.${calleeRef.slice(\"window#/\".length).replaceAll(\"/\", \".\")}(${args.join(\", \")})`;\n }\n if (calleeRef.startsWith(\"#/state/\")) {\n const key = calleeRef.slice(\"#/state/\".length);\n const params = opts.formulaParams?.[key];\n if (params) {\n const named = params\n .map((p, i) => `${JSON.stringify(p)}: ${args[i] ?? \"undefined\"}`)\n .join(\", \");\n return `${formulaFnName(key)}(${opts.statePrefix ?? \"state\"}, { ${named} })`;\n }\n }\n // Fallback: the scope member itself is callable.\n return `${compileRef(calleeRef, opts)}(${args.join(\", \")})`;\n }\n\n // ─── Conditional (pure) ───\n if (CONDITIONAL_OPS.has(operator)) {\n if (operator === \"?:\") {\n const test: string = compileOperand(target, opts);\n const consequent: string = compileOperand(value, opts);\n const alternate: string = compileOperand(initial, opts);\n return `(${test} ? ${consequent} : ${alternate})`;\n }\n // Switch — bind the discriminant's string form once, then chain strict-equality tests.\n const discriminant: string = compileOperand(target, opts);\n const chain = Object.entries(node.cases ?? {})\n .map(([k, v]) => `_d === ${JSON.stringify(k)} ? ${compileOperand(v, opts)} : `)\n .join(\"\");\n const fallback = \"default\" in node ? compileOperand(node.default, opts) : \"undefined\";\n return `((_d) => ${chain}${fallback})(String(${discriminant}))`;\n }\n\n // ─── Binary (pure) ───\n if (BINARY_OPS.has(operator)) {\n const left: string = compileOperand(target, opts);\n const right: string = compileOperand(value, opts);\n return `(${left} ${operator} ${right})`;\n }\n\n // ─── Assignment ───\n if (ASSIGNMENT_OPS.has(operator)) {\n const lhs: string = compileTarget(target, opts);\n const rhs: string = compileOperand(value, opts);\n return `${lhs} ${operator} ${rhs}`;\n }\n\n // ─── Array methods ───\n if (ARRAY_METHOD_OPS.has(operator)) {\n const arr: string = compileTarget(target, opts);\n switch (operator) {\n case \"push\": {\n return `${arr}.push(${compileOperand(value, opts)})`;\n }\n case \"unshift\": {\n return `${arr}.unshift(${compileOperand(value, opts)})`;\n }\n case \"pop\": {\n return `${arr}.pop()`;\n }\n case \"shift\": {\n return `${arr}.shift()`;\n }\n case \"splice\": {\n const args: string = Array.isArray(value)\n ? value.map((o: unknown) => compileOperand(o, opts)).join(\", \")\n : compileOperand(value, opts);\n return `${arr}.splice(${args})`;\n }\n default: {\n break;\n }\n }\n }\n\n // ─── Pure standard-library methods (spec §19.4d) ───\n if (PURE_METHOD_OPS.has(operator)) {\n const receiver: string = compileOperand(target, opts);\n const args: string =\n value === undefined\n ? \"\"\n : Array.isArray(value)\n ? value.map((o: unknown) => compileOperand(o, opts)).join(\", \")\n : compileOperand(value, opts);\n // ?.method?.() matches the interpreter: missing receiver or method yields undefined.\n return `(${receiver})?.${operator}?.(${args})`;\n }\n\n // ─── Aggregates (pure) ───\n if (AGGREGATE_OPS.has(operator)) {\n const arr: string = compileOperand(target, opts);\n const itemExpr: string = compileExpression(value as ExpressionNode, opts);\n if (operator === \"reduce\") {\n const seed: string = compileOperand(initial, opts);\n return `${arr}.reduce((_acc, _item, _index) => ${itemExpr}, ${seed})`;\n }\n if (operator === \"map\") {\n return `${arr}.map((_item, _index) => ${itemExpr})`;\n }\n if (operator === \"filter\") {\n return `${arr}.filter((_item, _index) => ${itemExpr})`;\n }\n }\n\n return \"undefined\";\n}\n\n// ─── Utilities ───────────────────────────────────────────────────────────────\n\n/** Resolve a `$ref` path on an object, through the one tokenizer (`pointer.ts`). */\nfunction getPath(obj: unknown, path: string): unknown {\n return readPath(obj, path);\n}\n\n// ─── Statement-Engine Surface (spec §20) ─────────────────────────────────────\n\n/**\n * Evaluate a bare operand (pointer, literal, or nested node) outside a node position — used by\n * statement execution (spec §20) for `if` tests and `$switch` discriminants.\n */\nexport function evaluateOperand(\n operand: unknown,\n state: JxScope,\n event: Event | null,\n iterCtx?: IterCtx,\n): unknown {\n return resolveOperand(operand, state, event, iterCtx);\n}\n\n/** Compile a bare operand to JS source — the statement compiler's counterpart to evaluateOperand. */\nexport function compileOperandSource(operand: unknown, opts: CompileOpts = {}): string {\n return compileOperand(operand, opts);\n}\n\nexport type { CompileOpts, IterCtx };\n",
|
|
12
|
-
"/**\n * Deterministic mapping from Function-def `$src` module specifiers to bundled asset URLs, plus the\n * asset-mount math that publishes files living outside the project root at a stable site URL.\n * Shared between the compiler's sidecar bundler (which writes the bundle) and extension `lower()`\n * implementations (which emit the URL into client code) so neither needs to depend on the other.\n *\n * The mapping is intentionally hash-free: the same specifier always yields the same URL, letting\n * lowered defs reference bundles the compiler produces later in the build. Distinct specifiers that\n * collide on a slug are rejected by the bundler at build time.\n *\n * Pure string math only — no node imports — so browser hosts can import this module.\n */\n\n/** Prefix for npm package specifiers in `$src` (spec §12): `npm:<pkg>[/subpath]`. */\nexport const NPM_SPECIFIER_PREFIX = \"npm:\";\n\n/** URL directory (under the site root) where bundled sidecars are written. */\nexport const SIDECAR_ASSET_DIR = \"/assets/\";\n\n/** True when a `$src` specifier names an npm package rather than a project file. */\nexport function isNpmSpecifier(specifier: string): boolean {\n return specifier.startsWith(NPM_SPECIFIER_PREFIX);\n}\n\n/**\n * Map a Function-def `$src` specifier to its bundled asset URL.\n *\n * `npm:@jxsuite/search/client` → `/assets/jxsuite-search-client.js` `./lib/search-helpers.ts` →\n * `/assets/lib-search-helpers.js`\n */\nexport function sidecarAssetPath(specifier: string): string {\n let base = specifier;\n if (isNpmSpecifier(base)) {\n base = base.slice(NPM_SPECIFIER_PREFIX.length);\n }\n base = base\n .replace(/^\\.\\//, \"\")\n .replace(/\\.(js|ts|mjs|mts)$/, \"\")\n .replaceAll(\"@\", \"\")\n .replaceAll(/[/\\\\]+/g, \"-\")\n .replaceAll(/[^\\w.-]/g, \"-\")\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\");\n return `${SIDECAR_ASSET_DIR}${base}.js`;\n}\n\n/**\n * Map a bare npm specifier naming a **file** — a stylesheet, a font, a prebuilt script — to the URL\n * the build copies it to.\n *\n * Unlike {@link sidecarAssetPath} this keeps the extension, because the file is copied rather than\n * bundled and both the browser and the host dispatch on it.\n *\n * @docs framework/site/seo\n */\nexport function npmAssetPath(specifier: string): string {\n const ext = /\\.(\\w+)$/.exec(specifier)?.[1] ?? \"\";\n const base = specifier\n .replace(/\\.\\w+$/, \"\")\n .replaceAll(\"@\", \"\")\n .replaceAll(/[/\\\\]+/g, \"-\")\n .replaceAll(/[^\\w.-]/g, \"-\")\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\");\n return ext === \"\" ? `${SIDECAR_ASSET_DIR}${base}` : `${SIDECAR_ASSET_DIR}${base}.${ext}`;\n}\n\n// ─── Asset mounts (specs/extensions.md §8.5) ─────────────────────────────────\n\n/**\n * A site URL prefix backed by a real directory. Extensions declaring the `assets` capability return\n * mounts so hosts can publish files that live outside the project root (an external content\n * source's co-located images) without knowing anything about the section that owns them.\n */\nexport interface AssetMount {\n /** Site-absolute URL prefix, e.g. `/content/docs` (no trailing slash). */\n urlPrefix: string;\n /** Absolute directory the prefix maps onto. */\n dir: string;\n}\n\n/** Normalize a path or prefix for comparison: forward slashes, no trailing slash. */\nfunction normalizeDir(value: string): string {\n const forward = value.replaceAll(\"\\\\\", \"/\");\n return forward.length > 1 && forward.endsWith(\"/\") ? forward.slice(0, -1) : forward;\n}\n\n/** Normalize a mount's URL prefix: leading slash, no trailing slash. */\nexport function normalizeAssetPrefix(prefix: string): string {\n const forward = normalizeDir(prefix);\n return forward.startsWith(\"/\") ? forward : `/${forward}`;\n}\n\n/** Mounts sorted so the most specific (longest) candidate matches first. */\nfunction bySpecificity(mounts: readonly AssetMount[], key: \"dir\" | \"urlPrefix\"): AssetMount[] {\n return [...mounts].toSorted((a, b) => b[key].length - a[key].length);\n}\n\n/** True when `path` is `dir` itself or sits underneath it (both already normalized). */\nfunction isUnder(path: string, dir: string): boolean {\n return path === dir || path.startsWith(`${dir}/`);\n}\n\n/**\n * Map an absolute file path to its mounted site URL, or null when no mount contains it. Path\n * segments are percent-encoded so the URL survives HTML attributes; `resolveAssetUrl` reverses it.\n *\n * @param {readonly AssetMount[]} mounts\n * @param {string} absolutePath - Absolute filesystem path\n * @returns {string | null}\n */\nexport function assetUrlFor(mounts: readonly AssetMount[], absolutePath: string): string | null {\n const path = normalizeDir(absolutePath);\n for (const mount of bySpecificity(mounts, \"dir\")) {\n const dir = normalizeDir(mount.dir);\n if (!isUnder(path, dir) || path === dir) {\n continue;\n }\n const rest = path.slice(dir.length + 1);\n const encoded = rest\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n return `${normalizeAssetPrefix(mount.urlPrefix)}/${encoded}`;\n }\n return null;\n}\n\n/**\n * Map a mounted site URL back to its absolute file path, or null when it matches no mount. Query\n * and hash are dropped, the path is decoded ONCE (a still-encoded dot or slash after that decode is\n * a bypass attempt and is rejected), and `.`/`..` segments are refused outright — so the result can\n * never escape the mount directory.\n *\n * @param {readonly AssetMount[]} mounts\n * @param {string} url - Site-absolute URL (e.g. `/content/docs/images/hero.png`)\n * @returns {string | null}\n */\nexport function resolveAssetUrl(mounts: readonly AssetMount[], url: string): string | null {\n const pathname = url.split(\"#\")[0]!.split(\"?\")[0]!;\n if (!pathname.startsWith(\"/\")) {\n return null;\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(pathname);\n } catch {\n return null;\n }\n if (/%2e|%2f/i.test(decoded)) {\n return null;\n }\n for (const mount of bySpecificity(mounts, \"urlPrefix\")) {\n const prefix = normalizeAssetPrefix(mount.urlPrefix);\n if (!decoded.startsWith(`${prefix}/`)) {\n continue;\n }\n const rest = decoded.slice(prefix.length + 1);\n const segments = rest.split(\"/\");\n if (segments.some((s) => s === \"\" || s === \".\" || s === \"..\")) {\n return null;\n }\n return `${normalizeDir(mount.dir)}/${segments.join(\"/\")}`;\n }\n return null;\n}\n\n/** Characters that terminate a URL inside markup: quotes, whitespace, CSS `url()` parens, `<>`. */\nconst URL_TERMINATOR = String.raw`\"'\\s<>()\\\\`;\n\n/**\n * Collect every mounted URL referenced by a compiled artifact (HTML, CSS, JSON-LD). Scanning output\n * text rather than the document tree catches references wherever they came from — markdown images,\n * hand-authored pages, `$head` metadata, `url()` in stylesheets — with no per-attribute knowledge.\n *\n * @param {string} text - Compiled HTML or CSS\n * @param {readonly AssetMount[]} mounts\n * @returns {string[]} Unique mounted URLs, in first-seen order\n */\nexport function collectAssetUrls(text: string, mounts: readonly AssetMount[]): string[] {\n const found = new Set<string>();\n for (const mount of mounts) {\n const prefix = normalizeAssetPrefix(mount.urlPrefix);\n const pattern = new RegExp(\n `${prefix.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`)}/[^${URL_TERMINATOR}]+`,\n \"g\",\n );\n for (const match of text.matchAll(pattern)) {\n const url = match[0].split(\"#\")[0]!.split(\"?\")[0]!;\n // A trailing slash names a directory, not a file — prose quoting the mount prefix\n // (\"published under /content/docs/images/\") is a mention, not a reference.\n if (!url.endsWith(\"/\")) {\n found.add(url);\n }\n }\n }\n return [...found].filter(Boolean);\n}\n\n// ─── Project paths ↔ site URLs (specs/site-architecture.md §9.3) ─────────────\n\n/**\n * The project directory whose contents publish at the site root.\n *\n * A convention rather than a setting: `public/logo.png` is `/logo.png` on the built site, which is\n * why an authored `/logo.png` names a file the project tree calls something else.\n */\nexport const PUBLIC_DIR = \"public\";\n\n/** Node keys whose value is a media reference. Mirrors `ASSET_KEYS` in the content loader. */\nexport const ASSET_KEYS = [\"src\", \"poster\"] as const;\n\n/**\n * One step in a host's resolution order for a site-absolute URL.\n *\n * - `\"mounts\"` — an extension asset mount publishes a directory at a URL prefix (extensions.md §8.5).\n * - `\"root\"` — the URL path is a project-relative path as written.\n * - `\"public\"` — the URL path is relative to {@link PUBLIC_DIR}.\n */\nexport type AssetLane = \"mounts\" | \"root\" | \"public\";\n\n/**\n * What a BUILD resolves — mounts, then `public/`, and nothing else.\n *\n * This is the published contract (site-architecture.md §9.3): a file at `<root>/hero.jpg` is not\n * addressable at `/hero.jpg` on a deployed site, because nothing copies it there.\n */\nexport const BUILD_LANES: readonly AssetLane[] = [\"mounts\", \"public\"];\n\n/**\n * What the editing servers resolve — mounts, then the project root, then `public/`.\n *\n * It is deliberately NOT {@link BUILD_LANES}, and the difference is a real one rather than an\n * implementation detail: `serveProjectFile` in `@jxsuite/server` tries the project root BEFORE\n * `public/`, so `<root>/hero.jpg` loads at `/hero.jpg` in a preview and 404s in production. A test\n * asserts the two constants differ, so nobody can quietly assume they agree.\n */\nexport const DEV_SERVER_LANES: readonly AssetLane[] = [\"mounts\", \"root\", \"public\"];\n\n/**\n * Split a reference into the path part and the `?query#hash` suffix.\n *\n * The suffix must survive every rewrite untouched: `./hero.png?v=2` is one file plus a\n * cache-buster, and a rewrite that drops the buster changes what the browser requests.\n *\n * @param {string} value - An authored reference\n * @returns {{ path: string; suffix: string }} The bare path and everything from the first `?`/`#`\n */\nexport function splitRefSuffix(value: string): { path: string; suffix: string } {\n const cut = value.search(/[#?]/);\n return cut === -1\n ? { path: value, suffix: \"\" }\n : { path: value.slice(0, cut), suffix: value.slice(cut) };\n}\n\n/**\n * True when `value` is already a URL, a template, a fragment, or empty — never a project file.\n *\n * Mirrors `isNonRelativeRef` in the content loader. A root-relative `/hero.jpg` counts as\n * non-relative here because it is a SITE URL, not a path relative to the document.\n *\n * @param {string} value - An authored reference\n * @returns {boolean}\n */\nexport function isNonRelativeRef(value: string): boolean {\n return (\n value === \"\" ||\n value.startsWith(\"/\") ||\n value.startsWith(\"#\") ||\n value.includes(\"${\") ||\n /^[a-z][\\w+.-]*:/i.test(value)\n );\n}\n\n/**\n * Normalize a project-relative path: forward slashes, no `./` prefix, no leading or trailing slash.\n *\n * @param {string} path - A project-relative path in any spelling\n * @returns {string} The canonical spelling\n */\nexport function normalizeProjectPath(path: string): string {\n return path.replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\").replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n}\n\n/** The directory portion of a project-relative path (`\"\"` for a root-level file). */\nexport function dirOfPath(path: string): string {\n const normalized = normalizeProjectPath(path);\n const slash = normalized.lastIndexOf(\"/\");\n return slash === -1 ? \"\" : normalized.slice(0, slash);\n}\n\n/**\n * Resolve `ref` against `dir` in a pure, POSIX-ish way — no `node:path`, and no leading-slash\n * assumption, because project paths are relative to a root the browser does not have.\n *\n * @param {string} dir - Project-relative directory (`\"\"` for the root)\n * @param {string} ref - A relative reference\n * @returns {string | null} The project-relative result, or null when it climbs above the root\n */\nexport function joinProjectPath(dir: string, ref: string): string | null {\n const base = dir === \"\" || dir === \".\" ? [] : normalizeProjectPath(dir).split(\"/\");\n const out = base.filter((segment) => segment !== \"\" && segment !== \".\");\n for (const segment of ref.replaceAll(\"\\\\\", \"/\").split(\"/\")) {\n if (segment === \"\" || segment === \".\") {\n continue;\n }\n if (segment === \"..\") {\n if (out.length === 0) {\n return null; // Escapes the project root.\n }\n out.pop();\n continue;\n }\n out.push(segment);\n }\n return out.join(\"/\");\n}\n\n/**\n * The site URL a project file publishes at under `lanes`, or null when nothing publishes it.\n *\n * The lanes are tried in order, so the answer is the URL the host would resolve FIRST — which is\n * what makes {@link projectPathsForSiteUrl} its inverse. Under {@link DEV_SERVER_LANES} that means\n * `public/logo.png` answers `/public/logo.png` (the root lane, which the server tries first) rather\n * than `/logo.png`; both work there, and only one round-trips.\n *\n * @param {string} path - Project-relative path\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string | null} A site-absolute URL, or null\n */\nexport function siteUrlForPath(\n path: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string | null {\n const normalized = normalizeProjectPath(path);\n if (normalized === \"\") {\n return null;\n }\n for (const lane of lanes) {\n if (lane === \"mounts\") {\n const url = assetUrlFor(mounts, normalized);\n if (url) {\n return url;\n }\n continue;\n }\n if (lane === \"root\") {\n return `/${encodeProjectPath(normalized)}`;\n }\n if (normalized === PUBLIC_DIR || normalized.startsWith(`${PUBLIC_DIR}/`)) {\n return `/${encodeProjectPath(normalized.slice(PUBLIC_DIR.length + 1))}`;\n }\n }\n return null;\n}\n\n/**\n * Every project path a site-absolute URL could name under `lanes`, in the order the host tries\n * them.\n *\n * A list rather than one answer because the lanes genuinely overlap: `/hero.jpg` is `hero.jpg` to\n * the root lane and `public/hero.jpg` to the public lane, and only a filesystem can say which\n * exists. Callers with no filesystem — the Studio canvas — take the first.\n *\n * @param {string} url - A site-absolute URL (query and hash are ignored)\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string[]} Candidate project-relative paths, most-preferred first\n */\nexport function projectPathsForSiteUrl(\n url: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string[] {\n const { path } = splitRefSuffix(url);\n if (!path.startsWith(\"/\")) {\n return [];\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(path);\n } catch {\n return [];\n }\n // A still-encoded dot or slash after one decode is a traversal attempt, not a filename.\n if (/%2e|%2f/i.test(decoded)) {\n return [];\n }\n const rest = decoded.replace(/^\\/+/, \"\");\n if (rest === \"\" || rest.split(\"/\").some((segment) => segment === \".\" || segment === \"..\")) {\n return [];\n }\n const out: string[] = [];\n for (const lane of lanes) {\n if (lane === \"mounts\") {\n const mounted = resolveAssetUrl(mounts, path);\n // Only a mount INSIDE the project is addressable by path; `../../docs` is not.\n if (mounted !== null && !mounted.startsWith(\"/\") && !/^[A-Za-z]:/.test(mounted)) {\n out.push(normalizeProjectPath(mounted));\n }\n continue;\n }\n out.push(lane === \"root\" ? rest : `${PUBLIC_DIR}/${rest}`);\n }\n return [...new Set(out)];\n}\n\n/**\n * The project file an authored reference names, seen from the document that wrote it.\n *\n * The two shapes an author writes resolve differently and neither goes through a site URL:\n *\n * - A content-relative `./images/hero.png` resolves against the document's own directory, which IS a\n * project path already — `content/posts/images/hero.png`. The mount detour that the built site\n * performs is not needed to name the file, only to publish it.\n * - A root-relative `/hero.jpg` is a site URL, so it resolves through {@link projectPathsForSiteUrl}\n * and takes the host's first lane.\n *\n * Everything else — an absolute URL, a `data:` URI, a `${…}` template, a bare fragment — names no\n * project file and returns null, which callers read as \"leave it exactly as written\".\n *\n * @param {string} value - The authored reference\n * @param {string} documentDir - Project-relative directory of the document that wrote it\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string | null} A project-relative path, or null\n */\nexport function projectPathForRef(\n value: string,\n documentDir: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string | null {\n const { path } = splitRefSuffix(value);\n if (path === \"\") {\n return null;\n }\n if (isNonRelativeRef(value)) {\n return path.startsWith(\"/\") ? (projectPathsForSiteUrl(path, mounts, lanes)[0] ?? null) : null;\n }\n // A reference ending in a slash names a DIRECTORY, and no directory is a media file.\n if (path.endsWith(\"/\")) {\n return null;\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(path);\n } catch {\n return null;\n }\n const joined = joinProjectPath(documentDir, decoded);\n if (joined === null || joined === \"\" || joined === normalizeProjectPath(documentDir)) {\n return null;\n }\n return joined;\n}\n\n/**\n * Percent-encode each path segment so the result survives an HTML attribute.\n *\n * Segment by segment, so the separators stay separators: `encodeURIComponent` on the whole path\n * would turn every `/` into `%2F` and produce one very long filename.\n *\n * @param {string} path - A project-relative path\n * @returns {string} The same path, each segment encoded\n */\nexport function encodeProjectPath(path: string): string {\n return path\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n}\n\n// ─── srcset ──────────────────────────────────────────────────────────────────\n\n/** One `srcset` candidate: a URL and the descriptor that selects it (`\"\"` when there is none). */\nexport interface SrcsetCandidate {\n url: string;\n descriptor: string;\n}\n\n/**\n * Parse a `srcset` attribute into its candidates.\n *\n * Splitting on `\",\"` is wrong and quietly so: a `data:` URL contains commas, and so does any URL\n * with a query list. This follows HTML's own algorithm instead — collect non-whitespace as the URL,\n * and if it ends in commas, the descriptor is empty and the next candidate starts immediately.\n *\n * @param {string} value - The attribute value\n * @returns {SrcsetCandidate[]} Candidates in source order\n */\nexport function parseSrcset(value: string): SrcsetCandidate[] {\n const out: SrcsetCandidate[] = [];\n let i = 0;\n while (i < value.length) {\n while (i < value.length && (/\\s/.test(value[i]!) || value[i] === \",\")) {\n i += 1;\n }\n if (i >= value.length) {\n break;\n }\n const start = i;\n while (i < value.length && !/\\s/.test(value[i]!)) {\n i += 1;\n }\n let url = value.slice(start, i);\n if (url.endsWith(\",\")) {\n out.push({ descriptor: \"\", url: url.replace(/,+$/, \"\") });\n continue;\n }\n while (i < value.length && /\\s/.test(value[i]!)) {\n i += 1;\n }\n const descStart = i;\n while (i < value.length && value[i] !== \",\") {\n i += 1;\n }\n const descriptor = value.slice(descStart, i).trim();\n i += 1; // Consume the separating comma.\n url = url.replace(/,+$/, \"\");\n if (url !== \"\") {\n out.push({ descriptor, url });\n }\n }\n return out;\n}\n\n/**\n * Serialize candidates back into a `srcset` attribute value.\n *\n * @param {readonly SrcsetCandidate[]} candidates\n * @returns {string} The attribute value\n */\nexport function formatSrcset(candidates: readonly SrcsetCandidate[]): string {\n return candidates\n .map(({ url, descriptor }) => (descriptor ? `${url} ${descriptor}` : url))\n .join(\", \");\n}\n\n// ─── Deployment base path (RFC 3986 §5) ──────────────────────────────────────\n\n/**\n * The path a site is deployed under, derived from `project.json`'s `url`.\n *\n * **There is no second key for this, on purpose.** Every URL the build emits is a URI reference,\n * and `url` is the base URI it is resolved against (RFC 3986 §5). A site at\n * `https://example.pages.dev/m/my-site/` has already said where it lives; a `build.base` beside it\n * would be a second writer on one fact, free to disagree with the canonical links and the sitemap\n * that are built from the same value.\n *\n * What went wrong was narrower than a missing option: the compiler resolved its references against\n * the base's ORIGIN and discarded its path, which is what §5.2 does to an absolute-path reference\n * (`/assets/x.js`) and is not what a deployment means by one. So the fix is to stop discarding it.\n *\n * Returns `\"\"` for a site at an origin root, a missing `url`, or a `url` that will not parse — all\n * three mean \"prefix nothing\", and a malformed URL must not take the build down when the only thing\n * it can affect is a prefix. Never has a trailing slash, so `base + \"/assets/x\"` is well-formed.\n *\n * @param {string | undefined} url - `project.json`'s `url`\n * @returns {string} `\"\"` or a path with a leading slash and no trailing one\n */\nexport function siteBasePath(url: string | undefined | null): string {\n if (typeof url !== \"string\" || url === \"\") {\n return \"\";\n }\n let pathname: string;\n try {\n ({ pathname } = new URL(url));\n } catch {\n return \"\";\n }\n const trimmed = pathname.replace(/\\/+$/, \"\");\n if (trimmed === \"\" || trimmed === \"/\") {\n return \"\";\n }\n return trimmed.startsWith(\"/\") ? trimmed : `/${trimmed}`;\n}\n\n/**\n * Re-root a site-absolute URL onto the deployment base.\n *\n * Only an absolute-path reference is affected — the one form whose meaning is \"from the site root\",\n * and therefore the one form that moves when the site root does. A protocol-relative `//host/x`, an\n * absolute URL, a fragment, a query and every relative path already resolve against something else\n * and are returned untouched.\n *\n * **Idempotent**, because a URL may reach this more than once: an emitter that already prefixed and\n * an output pass that prefixes everything must not compound. A value already under the base is\n * returned as-is.\n *\n * @param {string} base - From {@link siteBasePath}\n * @param {string} url - A URL as emitted\n * @returns {string} The URL a browser should be given\n */\nexport function withBase(base: string, url: string): string {\n if (base === \"\" || !url.startsWith(\"/\") || url.startsWith(\"//\")) {\n return url;\n }\n if (url === base || url.startsWith(`${base}/`)) {\n return url;\n }\n return base + url;\n}\n\n/**\n * An absolute URL for a site route, keeping the base's path.\n *\n * `new URL(\"/about\", \"https://x.dev/m/site/\")` is `https://x.dev/about` — RFC 3986 §5.2 replaces\n * the whole path for an absolute-path reference, which is exactly right for the RFC and exactly\n * wrong for a canonical link. Resolving the route as a RELATIVE-path reference keeps the base, so\n * `<link rel=\"canonical\">`, `sitemap.xml` and `robots.txt` name pages that exist.\n *\n * @param {string} route - A site route (`/about`), leading slash optional\n * @param {string} siteUrl - `project.json`'s `url`\n * @returns {string} The absolute URL\n */\nexport function siteAbsoluteUrl(route: string, siteUrl: string): string {\n const base = new URL(siteUrl);\n // A base whose path does not end in \"/\" would drop its last segment under §5.2's merge.\n if (!base.pathname.endsWith(\"/\")) {\n base.pathname += \"/\";\n }\n return new URL(route.replace(/^\\/+/, \"\"), base).href;\n}\n",
|
|
12
|
+
"/**\n * Deterministic mapping from Function-def `$src` module specifiers to bundled asset URLs, plus the\n * asset-mount math that publishes files living outside the project root at a stable site URL.\n * Shared between the compiler's sidecar bundler (which writes the bundle) and extension `lower()`\n * implementations (which emit the URL into client code) so neither needs to depend on the other.\n *\n * The mapping is intentionally hash-free: the same specifier always yields the same URL, letting\n * lowered defs reference bundles the compiler produces later in the build. Distinct specifiers that\n * collide on a slug are rejected by the bundler at build time.\n *\n * Pure string math only — no node imports — so browser hosts can import this module.\n */\n\n/** Prefix for npm package specifiers in `$src` (spec §12): `npm:<pkg>[/subpath]`. */\nexport const NPM_SPECIFIER_PREFIX = \"npm:\";\n\n/** URL directory (under the site root) where bundled sidecars are written. */\nexport const SIDECAR_ASSET_DIR = \"/assets/\";\n\n/** True when a `$src` specifier names an npm package rather than a project file. */\nexport function isNpmSpecifier(specifier: string): boolean {\n return specifier.startsWith(NPM_SPECIFIER_PREFIX);\n}\n\n/**\n * Map a Function-def `$src` specifier to its bundled asset URL.\n *\n * `npm:@jxsuite/search/client` → `/assets/jxsuite-search-client.js` `./lib/search-helpers.ts` →\n * `/assets/lib-search-helpers.js`\n */\nexport function sidecarAssetPath(specifier: string): string {\n let base = specifier;\n if (isNpmSpecifier(base)) {\n base = base.slice(NPM_SPECIFIER_PREFIX.length);\n }\n base = base\n .replace(/^\\.\\//, \"\")\n .replace(/\\.(js|ts|mjs|mts)$/, \"\")\n .replaceAll(\"@\", \"\")\n .replaceAll(/[/\\\\]+/g, \"-\")\n .replaceAll(/[^\\w.-]/g, \"-\")\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\");\n return `${SIDECAR_ASSET_DIR}${base}.js`;\n}\n\n/**\n * Map a bare npm specifier naming a **file** — a stylesheet, a font, a prebuilt script — to the URL\n * the build copies it to.\n *\n * Unlike {@link sidecarAssetPath} this keeps the extension, because the file is copied rather than\n * bundled and both the browser and the host dispatch on it.\n *\n * @docs framework/site/seo\n */\nexport function npmAssetPath(specifier: string): string {\n const ext = /\\.(\\w+)$/.exec(specifier)?.[1] ?? \"\";\n const base = specifier\n .replace(/\\.\\w+$/, \"\")\n .replaceAll(\"@\", \"\")\n .replaceAll(/[/\\\\]+/g, \"-\")\n .replaceAll(/[^\\w.-]/g, \"-\")\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\");\n return ext === \"\" ? `${SIDECAR_ASSET_DIR}${base}` : `${SIDECAR_ASSET_DIR}${base}.${ext}`;\n}\n\n// ─── Asset mounts (specs/extensions.md §8.5) ─────────────────────────────────\n\n/**\n * A site URL prefix backed by a real directory. Extensions declaring the `assets` capability return\n * mounts so hosts can publish files that live outside the project root (an external content\n * source's co-located images) without knowing anything about the section that owns them.\n */\nexport interface AssetMount {\n /** Site-absolute URL prefix, e.g. `/content/docs` (no trailing slash). */\n urlPrefix: string;\n /** Absolute directory the prefix maps onto. */\n dir: string;\n /**\n * Whether the mount serves a file, asked with the file's path relative to {@link dir},\n * `/`-separated. Absent means every file under the directory. A mount over a folder of notes sets\n * it so that what the collection leaves out (`exclude`, hidden files, unpublished documents) is\n * never reachable through the mount either: {@link assetUrlFor} gives a refused file no URL and\n * {@link resolveAssetUrl} resolves a refused URL to nothing, so no host serves or copies it. It is\n * a function, so it exists only where the mount was declared; a host that rebuilds a mount from\n * its two strings (a project-relative copy for Studio) gets none.\n */\n filter?: (path: string) => boolean;\n}\n\n/** Normalize a path or prefix for comparison: forward slashes, no trailing slash. */\nfunction normalizeDir(value: string): string {\n const forward = value.replaceAll(\"\\\\\", \"/\");\n return forward.length > 1 && forward.endsWith(\"/\") ? forward.slice(0, -1) : forward;\n}\n\n/** Normalize a mount's URL prefix: leading slash, no trailing slash. */\nexport function normalizeAssetPrefix(prefix: string): string {\n const forward = normalizeDir(prefix);\n return forward.startsWith(\"/\") ? forward : `/${forward}`;\n}\n\n/** Mounts sorted so the most specific (longest) candidate matches first. */\nfunction bySpecificity(mounts: readonly AssetMount[], key: \"dir\" | \"urlPrefix\"): AssetMount[] {\n return [...mounts].toSorted((a, b) => b[key].length - a[key].length);\n}\n\n/** True when `path` is `dir` itself or sits underneath it (both already normalized). */\nfunction isUnder(path: string, dir: string): boolean {\n return path === dir || path.startsWith(`${dir}/`);\n}\n\n/**\n * Map an absolute file path to its mounted site URL, or null when no mount contains it. Path\n * segments are percent-encoded so the URL survives HTML attributes; `resolveAssetUrl` reverses it.\n *\n * @param {readonly AssetMount[]} mounts\n * @param {string} absolutePath - Absolute filesystem path\n * @returns {string | null}\n */\nexport function assetUrlFor(mounts: readonly AssetMount[], absolutePath: string): string | null {\n const path = normalizeDir(absolutePath);\n for (const mount of bySpecificity(mounts, \"dir\")) {\n const dir = normalizeDir(mount.dir);\n if (!isUnder(path, dir) || path === dir) {\n continue;\n }\n const rest = path.slice(dir.length + 1);\n const { filter: serves } = mount;\n if (serves && !serves(rest)) {\n return null;\n }\n const encoded = rest\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n return `${normalizeAssetPrefix(mount.urlPrefix)}/${encoded}`;\n }\n return null;\n}\n\n/**\n * Map a mounted site URL back to its absolute file path, or null when it matches no mount. Query\n * and hash are dropped, the path is decoded ONCE (a still-encoded dot or slash after that decode is\n * a bypass attempt and is rejected), and `.`/`..` segments are refused outright — so the result can\n * never escape the mount directory.\n *\n * @param {readonly AssetMount[]} mounts\n * @param {string} url - Site-absolute URL (e.g. `/content/docs/images/hero.png`)\n * @returns {string | null}\n */\nexport function resolveAssetUrl(mounts: readonly AssetMount[], url: string): string | null {\n const pathname = url.split(\"#\")[0]!.split(\"?\")[0]!;\n if (!pathname.startsWith(\"/\")) {\n return null;\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(pathname);\n } catch {\n return null;\n }\n if (/%2e|%2f/i.test(decoded)) {\n return null;\n }\n for (const mount of bySpecificity(mounts, \"urlPrefix\")) {\n const prefix = normalizeAssetPrefix(mount.urlPrefix);\n if (!decoded.startsWith(`${prefix}/`)) {\n continue;\n }\n const rest = decoded.slice(prefix.length + 1);\n const segments = rest.split(\"/\");\n if (segments.some((s) => s === \"\" || s === \".\" || s === \"..\")) {\n return null;\n }\n const { filter: serves } = mount;\n if (serves && !serves(segments.join(\"/\"))) {\n return null;\n }\n return `${normalizeDir(mount.dir)}/${segments.join(\"/\")}`;\n }\n return null;\n}\n\n/** Characters that terminate a URL inside markup: quotes, whitespace, CSS `url()` parens, `<>`. */\nconst URL_TERMINATOR = String.raw`\"'\\s<>()\\\\`;\n\n/**\n * Collect every mounted URL referenced by a compiled artifact (HTML, CSS, JSON-LD). Scanning output\n * text rather than the document tree catches references wherever they came from — markdown images,\n * hand-authored pages, `$head` metadata, `url()` in stylesheets — with no per-attribute knowledge.\n *\n * @param {string} text - Compiled HTML or CSS\n * @param {readonly AssetMount[]} mounts\n * @returns {string[]} Unique mounted URLs, in first-seen order\n */\nexport function collectAssetUrls(text: string, mounts: readonly AssetMount[]): string[] {\n const found = new Set<string>();\n for (const mount of mounts) {\n const prefix = normalizeAssetPrefix(mount.urlPrefix);\n const pattern = new RegExp(\n `${prefix.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`)}/[^${URL_TERMINATOR}]+`,\n \"g\",\n );\n for (const match of text.matchAll(pattern)) {\n const url = match[0].split(\"#\")[0]!.split(\"?\")[0]!;\n // A trailing slash names a directory, not a file — prose quoting the mount prefix\n // (\"published under /content/docs/images/\") is a mention, not a reference.\n if (!url.endsWith(\"/\")) {\n found.add(url);\n }\n }\n }\n return [...found].filter(Boolean);\n}\n\n// ─── Project paths ↔ site URLs (specs/site-architecture.md §9.3) ─────────────\n\n/**\n * The project directory whose contents publish at the site root.\n *\n * A convention rather than a setting: `public/logo.png` is `/logo.png` on the built site, which is\n * why an authored `/logo.png` names a file the project tree calls something else.\n */\nexport const PUBLIC_DIR = \"public\";\n\n/** Node keys whose value is a media reference. Mirrors `ASSET_KEYS` in the content loader. */\nexport const ASSET_KEYS = [\"src\", \"poster\"] as const;\n\n/**\n * One step in a host's resolution order for a site-absolute URL.\n *\n * - `\"mounts\"` — an extension asset mount publishes a directory at a URL prefix (extensions.md §8.5).\n * - `\"root\"` — the URL path is a project-relative path as written.\n * - `\"public\"` — the URL path is relative to {@link PUBLIC_DIR}.\n */\nexport type AssetLane = \"mounts\" | \"root\" | \"public\";\n\n/**\n * What a BUILD resolves — mounts, then `public/`, and nothing else.\n *\n * This is the published contract (site-architecture.md §9.3): a file at `<root>/hero.jpg` is not\n * addressable at `/hero.jpg` on a deployed site, because nothing copies it there.\n */\nexport const BUILD_LANES: readonly AssetLane[] = [\"mounts\", \"public\"];\n\n/**\n * What the editing servers resolve — mounts, then the project root, then `public/`.\n *\n * It is deliberately NOT {@link BUILD_LANES}, and the difference is a real one rather than an\n * implementation detail: `serveProjectFile` in `@jxsuite/server` tries the project root BEFORE\n * `public/`, so `<root>/hero.jpg` loads at `/hero.jpg` in a preview and 404s in production. A test\n * asserts the two constants differ, so nobody can quietly assume they agree.\n */\nexport const DEV_SERVER_LANES: readonly AssetLane[] = [\"mounts\", \"root\", \"public\"];\n\n/**\n * Split a reference into the path part and the `?query#hash` suffix.\n *\n * The suffix must survive every rewrite untouched: `./hero.png?v=2` is one file plus a\n * cache-buster, and a rewrite that drops the buster changes what the browser requests.\n *\n * @param {string} value - An authored reference\n * @returns {{ path: string; suffix: string }} The bare path and everything from the first `?`/`#`\n */\nexport function splitRefSuffix(value: string): { path: string; suffix: string } {\n const cut = value.search(/[#?]/);\n return cut === -1\n ? { path: value, suffix: \"\" }\n : { path: value.slice(0, cut), suffix: value.slice(cut) };\n}\n\n/**\n * True when `value` is already a URL, a template, a fragment, or empty — never a project file.\n *\n * Mirrors `isNonRelativeRef` in the content loader. A root-relative `/hero.jpg` counts as\n * non-relative here because it is a SITE URL, not a path relative to the document.\n *\n * @param {string} value - An authored reference\n * @returns {boolean}\n */\nexport function isNonRelativeRef(value: string): boolean {\n return (\n value === \"\" ||\n value.startsWith(\"/\") ||\n value.startsWith(\"#\") ||\n value.includes(\"${\") ||\n /^[a-z][\\w+.-]*:/i.test(value)\n );\n}\n\n/**\n * Normalize a project-relative path: forward slashes, no `./` prefix, no leading or trailing slash.\n *\n * @param {string} path - A project-relative path in any spelling\n * @returns {string} The canonical spelling\n */\nexport function normalizeProjectPath(path: string): string {\n return path.replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\").replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n}\n\n/** The directory portion of a project-relative path (`\"\"` for a root-level file). */\nexport function dirOfPath(path: string): string {\n const normalized = normalizeProjectPath(path);\n const slash = normalized.lastIndexOf(\"/\");\n return slash === -1 ? \"\" : normalized.slice(0, slash);\n}\n\n/**\n * Resolve `ref` against `dir` in a pure, POSIX-ish way — no `node:path`, and no leading-slash\n * assumption, because project paths are relative to a root the browser does not have.\n *\n * @param {string} dir - Project-relative directory (`\"\"` for the root)\n * @param {string} ref - A relative reference\n * @returns {string | null} The project-relative result, or null when it climbs above the root\n */\nexport function joinProjectPath(dir: string, ref: string): string | null {\n const base = dir === \"\" || dir === \".\" ? [] : normalizeProjectPath(dir).split(\"/\");\n const out = base.filter((segment) => segment !== \"\" && segment !== \".\");\n for (const segment of ref.replaceAll(\"\\\\\", \"/\").split(\"/\")) {\n if (segment === \"\" || segment === \".\") {\n continue;\n }\n if (segment === \"..\") {\n if (out.length === 0) {\n return null; // Escapes the project root.\n }\n out.pop();\n continue;\n }\n out.push(segment);\n }\n return out.join(\"/\");\n}\n\n/**\n * The site URL a project file publishes at under `lanes`, or null when nothing publishes it.\n *\n * The lanes are tried in order, so the answer is the URL the host would resolve FIRST — which is\n * what makes {@link projectPathsForSiteUrl} its inverse. Under {@link DEV_SERVER_LANES} that means\n * `public/logo.png` answers `/public/logo.png` (the root lane, which the server tries first) rather\n * than `/logo.png`; both work there, and only one round-trips.\n *\n * @param {string} path - Project-relative path\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string | null} A site-absolute URL, or null\n */\nexport function siteUrlForPath(\n path: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string | null {\n const normalized = normalizeProjectPath(path);\n if (normalized === \"\") {\n return null;\n }\n for (const lane of lanes) {\n if (lane === \"mounts\") {\n const url = assetUrlFor(mounts, normalized);\n if (url) {\n return url;\n }\n continue;\n }\n if (lane === \"root\") {\n return `/${encodeProjectPath(normalized)}`;\n }\n if (normalized === PUBLIC_DIR || normalized.startsWith(`${PUBLIC_DIR}/`)) {\n return `/${encodeProjectPath(normalized.slice(PUBLIC_DIR.length + 1))}`;\n }\n }\n return null;\n}\n\n/**\n * Every project path a site-absolute URL could name under `lanes`, in the order the host tries\n * them.\n *\n * A list rather than one answer because the lanes genuinely overlap: `/hero.jpg` is `hero.jpg` to\n * the root lane and `public/hero.jpg` to the public lane, and only a filesystem can say which\n * exists. Callers with no filesystem — the Studio canvas — take the first.\n *\n * @param {string} url - A site-absolute URL (query and hash are ignored)\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string[]} Candidate project-relative paths, most-preferred first\n */\nexport function projectPathsForSiteUrl(\n url: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string[] {\n const { path } = splitRefSuffix(url);\n if (!path.startsWith(\"/\")) {\n return [];\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(path);\n } catch {\n return [];\n }\n // A still-encoded dot or slash after one decode is a traversal attempt, not a filename.\n if (/%2e|%2f/i.test(decoded)) {\n return [];\n }\n const rest = decoded.replace(/^\\/+/, \"\");\n if (rest === \"\" || rest.split(\"/\").some((segment) => segment === \".\" || segment === \"..\")) {\n return [];\n }\n const out: string[] = [];\n for (const lane of lanes) {\n if (lane === \"mounts\") {\n const mounted = resolveAssetUrl(mounts, path);\n // Only a mount INSIDE the project is addressable by path; `../../docs` is not.\n if (mounted !== null && !mounted.startsWith(\"/\") && !/^[A-Za-z]:/.test(mounted)) {\n out.push(normalizeProjectPath(mounted));\n }\n continue;\n }\n out.push(lane === \"root\" ? rest : `${PUBLIC_DIR}/${rest}`);\n }\n return [...new Set(out)];\n}\n\n/**\n * The project file an authored reference names, seen from the document that wrote it.\n *\n * The two shapes an author writes resolve differently and neither goes through a site URL:\n *\n * - A content-relative `./images/hero.png` resolves against the document's own directory, which IS a\n * project path already — `content/posts/images/hero.png`. The mount detour that the built site\n * performs is not needed to name the file, only to publish it.\n * - A root-relative `/hero.jpg` is a site URL, so it resolves through {@link projectPathsForSiteUrl}\n * and takes the host's first lane.\n *\n * Everything else — an absolute URL, a `data:` URI, a `${…}` template, a bare fragment — names no\n * project file and returns null, which callers read as \"leave it exactly as written\".\n *\n * @param {string} value - The authored reference\n * @param {string} documentDir - Project-relative directory of the document that wrote it\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string | null} A project-relative path, or null\n */\nexport function projectPathForRef(\n value: string,\n documentDir: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string | null {\n const { path } = splitRefSuffix(value);\n if (path === \"\") {\n return null;\n }\n if (isNonRelativeRef(value)) {\n return path.startsWith(\"/\") ? (projectPathsForSiteUrl(path, mounts, lanes)[0] ?? null) : null;\n }\n // A reference ending in a slash names a DIRECTORY, and no directory is a media file.\n if (path.endsWith(\"/\")) {\n return null;\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(path);\n } catch {\n return null;\n }\n const joined = joinProjectPath(documentDir, decoded);\n if (joined === null || joined === \"\" || joined === normalizeProjectPath(documentDir)) {\n return null;\n }\n return joined;\n}\n\n/**\n * Percent-encode each path segment so the result survives an HTML attribute.\n *\n * Segment by segment, so the separators stay separators: `encodeURIComponent` on the whole path\n * would turn every `/` into `%2F` and produce one very long filename.\n *\n * @param {string} path - A project-relative path\n * @returns {string} The same path, each segment encoded\n */\nexport function encodeProjectPath(path: string): string {\n return path\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n}\n\n// ─── srcset ──────────────────────────────────────────────────────────────────\n\n/** One `srcset` candidate: a URL and the descriptor that selects it (`\"\"` when there is none). */\nexport interface SrcsetCandidate {\n url: string;\n descriptor: string;\n}\n\n/**\n * Parse a `srcset` attribute into its candidates.\n *\n * Splitting on `\",\"` is wrong and quietly so: a `data:` URL contains commas, and so does any URL\n * with a query list. This follows HTML's own algorithm instead — collect non-whitespace as the URL,\n * and if it ends in commas, the descriptor is empty and the next candidate starts immediately.\n *\n * @param {string} value - The attribute value\n * @returns {SrcsetCandidate[]} Candidates in source order\n */\nexport function parseSrcset(value: string): SrcsetCandidate[] {\n const out: SrcsetCandidate[] = [];\n let i = 0;\n while (i < value.length) {\n while (i < value.length && (/\\s/.test(value[i]!) || value[i] === \",\")) {\n i += 1;\n }\n if (i >= value.length) {\n break;\n }\n const start = i;\n while (i < value.length && !/\\s/.test(value[i]!)) {\n i += 1;\n }\n let url = value.slice(start, i);\n if (url.endsWith(\",\")) {\n out.push({ descriptor: \"\", url: url.replace(/,+$/, \"\") });\n continue;\n }\n while (i < value.length && /\\s/.test(value[i]!)) {\n i += 1;\n }\n const descStart = i;\n while (i < value.length && value[i] !== \",\") {\n i += 1;\n }\n const descriptor = value.slice(descStart, i).trim();\n i += 1; // Consume the separating comma.\n url = url.replace(/,+$/, \"\");\n if (url !== \"\") {\n out.push({ descriptor, url });\n }\n }\n return out;\n}\n\n/**\n * Serialize candidates back into a `srcset` attribute value.\n *\n * @param {readonly SrcsetCandidate[]} candidates\n * @returns {string} The attribute value\n */\nexport function formatSrcset(candidates: readonly SrcsetCandidate[]): string {\n return candidates\n .map(({ url, descriptor }) => (descriptor ? `${url} ${descriptor}` : url))\n .join(\", \");\n}\n\n// ─── Deployment base path (RFC 3986 §5) ──────────────────────────────────────\n\n/**\n * The path a site is deployed under, derived from `project.json`'s `url`.\n *\n * **There is no second key for this, on purpose.** Every URL the build emits is a URI reference,\n * and `url` is the base URI it is resolved against (RFC 3986 §5). A site at\n * `https://example.pages.dev/m/my-site/` has already said where it lives; a `build.base` beside it\n * would be a second writer on one fact, free to disagree with the canonical links and the sitemap\n * that are built from the same value.\n *\n * What went wrong was narrower than a missing option: the compiler resolved its references against\n * the base's ORIGIN and discarded its path, which is what §5.2 does to an absolute-path reference\n * (`/assets/x.js`) and is not what a deployment means by one. So the fix is to stop discarding it.\n *\n * Returns `\"\"` for a site at an origin root, a missing `url`, or a `url` that will not parse — all\n * three mean \"prefix nothing\", and a malformed URL must not take the build down when the only thing\n * it can affect is a prefix. Never has a trailing slash, so `base + \"/assets/x\"` is well-formed.\n *\n * @param {string | undefined} url - `project.json`'s `url`\n * @returns {string} `\"\"` or a path with a leading slash and no trailing one\n */\nexport function siteBasePath(url: string | undefined | null): string {\n if (typeof url !== \"string\" || url === \"\") {\n return \"\";\n }\n let pathname: string;\n try {\n ({ pathname } = new URL(url));\n } catch {\n return \"\";\n }\n const trimmed = pathname.replace(/\\/+$/, \"\");\n if (trimmed === \"\" || trimmed === \"/\") {\n return \"\";\n }\n return trimmed.startsWith(\"/\") ? trimmed : `/${trimmed}`;\n}\n\n/**\n * Re-root a site-absolute URL onto the deployment base.\n *\n * Only an absolute-path reference is affected — the one form whose meaning is \"from the site root\",\n * and therefore the one form that moves when the site root does. A protocol-relative `//host/x`, an\n * absolute URL, a fragment, a query and every relative path already resolve against something else\n * and are returned untouched.\n *\n * **Idempotent**, because a URL may reach this more than once: an emitter that already prefixed and\n * an output pass that prefixes everything must not compound. A value already under the base is\n * returned as-is.\n *\n * @param {string} base - From {@link siteBasePath}\n * @param {string} url - A URL as emitted\n * @returns {string} The URL a browser should be given\n */\nexport function withBase(base: string, url: string): string {\n if (base === \"\" || !url.startsWith(\"/\") || url.startsWith(\"//\")) {\n return url;\n }\n if (url === base || url.startsWith(`${base}/`)) {\n return url;\n }\n return base + url;\n}\n\n/**\n * An absolute URL for a site route, keeping the base's path.\n *\n * `new URL(\"/about\", \"https://x.dev/m/site/\")` is `https://x.dev/about` — RFC 3986 §5.2 replaces\n * the whole path for an absolute-path reference, which is exactly right for the RFC and exactly\n * wrong for a canonical link. Resolving the route as a RELATIVE-path reference keeps the base, so\n * `<link rel=\"canonical\">`, `sitemap.xml` and `robots.txt` name pages that exist.\n *\n * @param {string} route - A site route (`/about`), leading slash optional\n * @param {string} siteUrl - `project.json`'s `url`\n * @returns {string} The absolute URL\n */\nexport function siteAbsoluteUrl(route: string, siteUrl: string): string {\n const base = new URL(siteUrl);\n // A base whose path does not end in \"/\" would drop its last segment under §5.2's merge.\n if (!base.pathname.endsWith(\"/\")) {\n base.pathname += \"/\";\n }\n return new URL(route.replace(/^\\/+/, \"\"), base).href;\n}\n",
|
|
13
13
|
"/// <reference lib=\"dom\" />\n/**\n * Jx Statement Engine (spec §20) — structured function bodies.\n *\n * A Function entry's `body` may be a statement array instead of opaque JS source. This module is\n * the statements counterpart to expression.ts, with the same dual shape: `runStatements`\n * (interpreter) and `compileStatements` (JS emitter), shared by the runtime and every compiler\n * target. Statement kinds reuse web-platform names only: bare expression nodes (§19), the JSON\n * Schema `if`/`then`/`else` triple, `$switch`/`cases` in statement position, and WHATWG's\n * `dispatchEvent` with `CustomEventInit` members, `stopPropagation` and `preventDefault`.\n */\n\nimport {\n compileExpression,\n compileOperandSource,\n evaluateExpression,\n evaluateOperand,\n} from \"./expression.ts\";\n\nimport type { JxStatement } from \"@jxsuite/schema/types\";\nimport type { CompileOpts, ExpressionNode, IterCtx } from \"./expression.ts\";\nimport type { JxScope } from \"./types.ts\";\n\ninterface RunOpts {\n /** Named-formula-style arguments bound for $args/<name> refs in the body. */\n args?: Record<string, unknown>;\n /**\n * Dispatch target for dispatchEvent statements when there is no event to read `currentTarget`\n * from — a parameterised body invoked through `call`, or a lifecycle hook. A thunk is read at\n * dispatch time, because a mount's root does not exist yet when its scope is built.\n */\n target?: EventTarget | null | (() => EventTarget | null);\n}\n\ntype StatementKind =\n | \"expression\"\n | \"if\"\n | \"switch\"\n | \"dispatch\"\n | \"stopPropagation\"\n | \"preventDefault\";\n\nfunction statementKind(statement: JxStatement): StatementKind {\n if (\"operator\" in statement) {\n return \"expression\";\n }\n if (\"if\" in statement) {\n return \"if\";\n }\n if (\"$switch\" in statement) {\n return \"switch\";\n }\n if (\"stopPropagation\" in statement) {\n return \"stopPropagation\";\n }\n if (\"preventDefault\" in statement) {\n return \"preventDefault\";\n }\n return \"dispatch\";\n}\n\n/**\n * Execute a statement list sequentially against the reactive scope. A statement whose value is a\n * thenable is awaited before the next runs (ECMA async/await semantics); purely synchronous bodies\n * complete synchronously before the returned promise settles.\n */\nexport async function runStatements(\n statements: JxStatement[],\n state: JxScope,\n event: Event | null,\n opts: RunOpts = {},\n): Promise<void> {\n const iterCtx: IterCtx | undefined = opts.args ? { args: opts.args } : undefined;\n for (const statement of statements) {\n switch (statementKind(statement)) {\n case \"expression\": {\n const result = evaluateExpression(statement as ExpressionNode, state, event, iterCtx);\n if (result && typeof (result as PromiseLike<unknown>).then === \"function\") {\n await (result as PromiseLike<unknown>);\n }\n break;\n }\n case \"if\": {\n const branch = statement as { if: unknown; then: JxStatement[]; else?: JxStatement[] };\n const taken = evaluateOperand(branch.if, state, event, iterCtx) ? branch.then : branch.else;\n if (Array.isArray(taken)) {\n await runStatements(taken, state, event, opts);\n }\n break;\n }\n case \"switch\": {\n const branch = statement as {\n $switch: unknown;\n cases: Record<string, JxStatement[]>;\n default?: JxStatement[];\n };\n const key = String(evaluateOperand(branch.$switch, state, event, iterCtx));\n const cases = branch.cases ?? {};\n const taken = Object.hasOwn(cases, key) ? cases[key] : branch.default;\n if (Array.isArray(taken)) {\n await runStatements(taken, state, event, opts);\n }\n break;\n }\n case \"dispatch\": {\n const dispatch = statement as {\n dispatchEvent: string;\n detail?: unknown;\n bubbles?: boolean;\n composed?: boolean;\n };\n // An event's own target wins; the option is the fallback for bodies run without one.\n const fallback = typeof opts.target === \"function\" ? opts.target() : opts.target;\n const target = event?.currentTarget ?? fallback;\n if (!target) {\n break;\n }\n const init: CustomEventInit = {};\n if (\"detail\" in dispatch) {\n init.detail = evaluateOperand(dispatch.detail, state, event, iterCtx);\n }\n if (dispatch.bubbles !== undefined) {\n init.bubbles = dispatch.bubbles;\n }\n if (dispatch.composed !== undefined) {\n init.composed = dispatch.composed;\n }\n target.dispatchEvent(new CustomEvent(dispatch.dispatchEvent, init));\n break;\n }\n case \"stopPropagation\": {\n // The event the handler is running for; a body run without one has nothing to stop.\n event?.stopPropagation();\n break;\n }\n case \"preventDefault\": {\n event?.preventDefault();\n break;\n }\n default: {\n break;\n }\n }\n }\n}\n\ninterface StatementCompileOpts extends CompileOpts {\n /** JS expression for the dispatchEvent target; defaults to `(event && event.currentTarget)`. */\n dispatchTarget?: string;\n /** Indentation prefix for emitted lines. */\n indent?: string;\n}\n\n/**\n * Compile a statement list to a JS statement block (no surrounding braces). Mirrors `runStatements`\n * exactly; each statement kind lowers to its genuine ECMAScript form — expression statements,\n * `if`/`else`, `switch` over the discriminant's string form, and `dispatchEvent(new\n * CustomEvent(...))`.\n */\nexport function compileStatements(\n statements: JxStatement[],\n opts: StatementCompileOpts = {},\n): string {\n const indent = opts.indent ?? \"\";\n const lines: string[] = [];\n for (const statement of statements) {\n switch (statementKind(statement)) {\n case \"expression\": {\n lines.push(`${indent}${compileExpression(statement as ExpressionNode, opts)};`);\n break;\n }\n case \"if\": {\n const branch = statement as { if: unknown; then: JxStatement[]; else?: JxStatement[] };\n const test = compileOperandSource(branch.if, opts);\n const inner = { ...opts, indent: `${indent} ` };\n lines.push(`${indent}if (${test}) {`, compileStatements(branch.then ?? [], inner));\n if (branch.else) {\n lines.push(`${indent}} else {`, compileStatements(branch.else, inner));\n }\n lines.push(`${indent}}`);\n break;\n }\n case \"switch\": {\n const branch = statement as {\n $switch: unknown;\n cases: Record<string, JxStatement[]>;\n default?: JxStatement[];\n };\n const disc = compileOperandSource(branch.$switch, opts);\n const inner = { ...opts, indent: `${indent} ` };\n lines.push(`${indent}switch (String(${disc})) {`);\n for (const [key, caseStatements] of Object.entries(branch.cases ?? {})) {\n lines.push(\n `${indent} case ${JSON.stringify(key)}: {`,\n compileStatements(caseStatements, inner),\n `${indent} break;`,\n `${indent} }`,\n );\n }\n if (branch.default) {\n lines.push(\n `${indent} default: {`,\n compileStatements(branch.default, inner),\n `${indent} }`,\n );\n }\n lines.push(`${indent}}`);\n break;\n }\n case \"dispatch\": {\n const dispatch = statement as {\n dispatchEvent: string;\n detail?: unknown;\n bubbles?: boolean;\n composed?: boolean;\n };\n const eventName = opts.eventParam ?? \"event\";\n const target = opts.dispatchTarget ?? `(${eventName} && ${eventName}.currentTarget)`;\n const init: string[] = [];\n if (\"detail\" in dispatch) {\n init.push(`detail: ${compileOperandSource(dispatch.detail, opts)}`);\n }\n if (dispatch.bubbles !== undefined) {\n init.push(`bubbles: ${JSON.stringify(dispatch.bubbles)}`);\n }\n if (dispatch.composed !== undefined) {\n init.push(`composed: ${JSON.stringify(dispatch.composed)}`);\n }\n const initSource = init.length > 0 ? `, { ${init.join(\", \")} }` : \"\";\n lines.push(\n `${indent}${target}?.dispatchEvent(new CustomEvent(${JSON.stringify(dispatch.dispatchEvent)}${initSource}));`,\n );\n break;\n }\n case \"stopPropagation\": {\n lines.push(`${indent}${opts.eventParam ?? \"event\"}?.stopPropagation();`);\n break;\n }\n case \"preventDefault\": {\n lines.push(`${indent}${opts.eventParam ?? \"event\"}?.preventDefault();`);\n break;\n }\n default: {\n break;\n }\n }\n }\n return lines.join(\"\\n\");\n}\n",
|
|
14
14
|
"/**\n * The `Cookie` state `$prototype`'s reading and writing, split out because both halves are exactly\n * the places a cookie binding goes wrong (RFC 6265bis).\n *\n * **Reading does not build a regular expression.** The cookie's name comes from the document, and\n * the old reader interpolated it straight into a pattern — so a name containing a dot, a paren or a\n * star silently matched the wrong cookie, and one containing an unbalanced bracket threw\n * SyntaxError from a document that validates. There is nothing to escape here: the cookie header is\n * a semicolon-separated list, so splitting it and comparing names is both correct and cheaper.\n *\n * **`HttpOnly` is absent on purpose, and must stay absent.** A cookie this prototype writes is\n * written by script through `document.cookie`; the browser refuses to _set_ `HttpOnly` from script\n * and refuses to _read back_ an `HttpOnly` cookie, so adding the attribute would produce a binding\n * that writes a value it can never see again. Its absence is the correct behavior for a\n * script-written cookie, not a missing feature.\n *\n * **`Expires` is not supported, and that is also deliberate.** `Max-Age` covers the same ground,\n * RFC 6265bis §5.5 makes `Max-Age` win wherever both appear, and `Expires` takes an HTTP-date whose\n * mis-spelling fails silently in the direction of a cookie that never expires.\n */\n\n/** The cookie attributes an `external-class-def` may declare for the `Cookie` `$prototype`. */\nexport interface CookieOptions {\n domain?: string | undefined;\n maxAge?: number | undefined;\n path?: string | undefined;\n sameSite?: string | undefined;\n secure?: boolean | undefined;\n}\n\n/** Cookie names carrying RFC 6265bis §4.1.3 prefixes, which constrain their own attributes. */\nconst HOST_PREFIX = \"__Host-\";\nconst SECURE_PREFIX = \"__Secure-\";\n\n/**\n * The raw (still percent-encoded) value of `name` in a `document.cookie` header, or null.\n *\n * @param {string} header The full `name=value; name=value` string.\n * @param {string} name\n * @returns {string | null}\n */\nexport function readCookie(header: string, name: string): string | null {\n for (const pair of header.split(\";\")) {\n const eq = pair.indexOf(\"=\");\n if (eq === -1) {\n continue;\n }\n if (pair.slice(0, eq).trim() === name) {\n return pair.slice(eq + 1);\n }\n }\n return null;\n}\n\n/**\n * Serialize one `document.cookie` assignment, applying the attribute rules a name's prefix and its\n * `SameSite` value already imply.\n *\n * Three of those rules are enforced rather than left to the author, because a browser that\n * disagrees with the attributes **silently drops the cookie** — the write appears to succeed and\n * the value is simply never there again:\n *\n * - `__Host-` requires `Secure`, requires `Path=/`, and forbids `Domain` (RFC 6265bis §4.1.3.2). A\n * declared `path` or `domain` is overridden rather than honored, since honoring it would produce\n * a cookie no browser will store.\n * - `__Secure-` requires `Secure` (§4.1.3.1).\n * - `SameSite=None` requires `Secure` (§5.4.7); without it the cookie is rejected outright.\n *\n * @param {string} name\n * @param {unknown} value JSON-encoded, then percent-encoded.\n * @param {CookieOptions} options\n * @returns {string}\n */\nexport function serializeCookie(name: string, value: unknown, options: CookieOptions): string {\n const hostPrefixed = name.startsWith(HOST_PREFIX);\n const parts = [`${name}=${encodeURIComponent(JSON.stringify(value))}`];\n\n if (options.maxAge !== undefined) {\n parts.push(`Max-Age=${options.maxAge}`);\n }\n\n const path = hostPrefixed ? \"/\" : options.path;\n if (path) {\n parts.push(`Path=${path}`);\n }\n if (options.domain && !hostPrefixed) {\n parts.push(`Domain=${options.domain}`);\n }\n\n const { sameSite } = options;\n const secure =\n options.secure === true ||\n hostPrefixed ||\n name.startsWith(SECURE_PREFIX) ||\n sameSite?.toLowerCase() === \"none\";\n if (secure) {\n parts.push(\"Secure\");\n }\n if (sameSite) {\n parts.push(`SameSite=${sameSite}`);\n }\n\n return parts.join(\"; \");\n}\n",
|
|
15
|
-
"/// <reference lib=\"dom\" />\n/**\n * Jx — JSON-native reactive web component runtime\n * @version 3.0.0\n * @license MIT\n *\n * Four-step pipeline:\n * 1. resolve — fetch JSON source (or accept raw object)\n * 2. buildScope — state detection + reactive proxy construction\n * 3. render — walk resolved tree, build DOM, wire reactive effects\n * 4. output — append to target\n *\n * @module jx\n */\n\nimport {\n computed,\n effect,\n effectScope,\n isReactive,\n isRef,\n onEffectCleanup,\n onScopeDispose,\n pauseTracking,\n reactive,\n ref,\n resetTracking,\n shallowReactive,\n toRaw,\n} from \"@vue/reactivity\";\nimport {\n buildStyleRules,\n cssPropertyName,\n hashCss,\n isNestedSelectorKey,\n transposeCanvasOverlaySelector,\n} from \"./css.ts\";\nimport { evaluateExpression, evaluateOperand, isMutating } from \"./expression.ts\";\nimport { readPath } from \"./pointer.ts\";\nimport type {\n DynamicClass,\n JxContext,\n JxEventHandler,\n JxMount,\n JxMountOptions,\n JxPath,\n JxRenderOptions,\n JxScope,\n} from \"./types.ts\";\nimport {\n bodyReturnsValue,\n hasStructuredBody,\n isExpressionDef,\n isFunctionDef,\n isJsonObject,\n isMappedArray,\n isNamedFormulaDef,\n isPrivateStateKey,\n isPrototypeDef,\n isRef as isRefValue,\n isServerFnDef,\n isTagExpression,\n isTemplateString,\n paramNames,\n} from \"@jxsuite/schema/guards\";\nimport { formatSrcset, parseSrcset } from \"@jxsuite/schema/asset-paths\";\nimport { runStatements } from \"./statements.ts\";\nimport { readCookie, serializeCookie } from \"./cookie.ts\";\nimport type {\n JxAttributeValue,\n JxClassDef,\n JxDocument,\n JxElement,\n JxFunctionDef,\n JxHeadEntry,\n JxMappedArray,\n JxPrototypeDef,\n JxRef,\n JxServerFnDef,\n JxStyle,\n} from \"@jxsuite/schema/types\";\nimport type { EffectScope, Ref } from \"@vue/reactivity\";\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Mount a Jx document into a DOM container.\n *\n * @example\n * import { Jx } from \"@jxsuite/runtime\";\n * const state = await Jx(\"./counter.json\", document.getElementById(\"app\"));\n *\n * @param {string | JxDocument} source - Path to .json file, URL, or raw document object\n * @param {HTMLElement} [target] Default is `document.body`\n * @param {JxRenderOptions} [options]\n * @returns {Promise<JxScope>} Resolves with the live component scope (state reactive\n * proxy)\n */\n/** The document-schema version this runtime understands (the `/schema/vN` in a hosted `$schema`). */\nexport const SUPPORTED_SCHEMA_VERSION = 1;\nlet _schemaVersionWarned = false;\n\n/**\n * Warn once when a document declares a hosted `$schema` whose version differs from the one this\n * runtime supports. A relative or non-hosted `$schema` (local dev schema paths) is ignored. This is\n * a diagnostic only — there is no document-format migration story yet (see spec §3.2 / §21.4).\n */\nfunction checkSchemaVersion($schema: unknown): void {\n if (_schemaVersionWarned || typeof $schema !== \"string\") {\n return;\n }\n const match = $schema.match(/\\/schema\\/v(\\d+)\\b/);\n if (match && Number(match[1]) !== SUPPORTED_SCHEMA_VERSION) {\n _schemaVersionWarned = true;\n console.warn(\n `Jx: document $schema is version v${match[1]} but this runtime supports ` +\n `v${SUPPORTED_SCHEMA_VERSION}. Behavior may be undefined; there is no format migrator yet.`,\n );\n }\n}\n\nexport async function Jx(\n source: string | JxDocument,\n target: HTMLElement = document.body,\n options?: JxRenderOptions,\n) {\n const base = options?.base\n ? new URL(options.base, location.href).href\n : typeof source === \"string\"\n ? new URL(source, location.href).href\n : location.href;\n const doc = await resolve(source);\n\n /* The module-level fallback is still written here, on purpose: a component defined LATER with\n `@--name` blocks and no own `$media` reads it (setRootMedia). `mount()` never writes it — a\n mount's `$media` travels in its context, which is the whole point of having one. */\n if (doc.$media) {\n _rootMedia = doc.$media;\n }\n\n const mounted = await mount(doc, target, {\n base,\n ...(options?.onNodeCreated ? { onNodeCreated: options.onNodeCreated } : {}),\n ...(options?.signal ? { signal: options.signal } : {}),\n });\n return mounted.scope;\n}\n\n/** Host-scope keys the runtime owns: `$media`, `$map`, the `$`-locals and `#`-private entries. */\nconst HOST_SCOPE_RESERVED = /^[$#]/;\n\nfunction assertHostScope(scope: Record<string, unknown>): void {\n for (const key of Object.keys(scope)) {\n if (HOST_SCOPE_RESERVED.test(key)) {\n throw new TypeError(\n `Jx mount: host scope key \"${key}\" is reserved — names beginning with \"$\" or \"#\" are ` +\n `runtime vocabulary`,\n );\n }\n }\n}\n\n/**\n * Mount a document into a host-owned node and hand back the live scope with a disposer.\n *\n * This is the embedding contract (specs/embedding.md): the host supplies its own reactive records\n * and functions as `options.scope`, a per-mount base, `$media` and document resolver, and gets a\n * root it can remove and a `dispose()` that stops every effect the render created. Nothing here\n * writes a module global, so a shell can hold many roots with different needs at once.\n *\n * @param {JxDocument} doc - The document to render (already an object; use {@link resolve} for a\n * URL)\n * @param {ParentNode} target - Where the rendered root is appended\n * @param {JxMountOptions} [options]\n * @returns {Promise<JxMount>}\n * @docs extending/embedding/runtime-host\n */\nexport async function mount(\n doc: JxDocument,\n target: ParentNode,\n options: JxMountOptions = {},\n): Promise<JxMount> {\n const hostScope = options.scope ?? {};\n assertHostScope(hostScope);\n const base = options.base ? new URL(options.base, location.href).href : location.href;\n const ctx: JxContext = {\n base,\n media: options.media ?? doc.$media ?? null,\n root: null,\n ...(options.resolver ? { resolver: options.resolver } : {}),\n ...(options.skipServerFunctions === undefined\n ? {}\n : { skipServerFunctions: options.skipServerFunctions }),\n ...(options.skipAutoRequests === undefined\n ? {}\n : { skipAutoRequests: options.skipAutoRequests }),\n };\n checkSchemaVersion(doc.$schema);\n\n // Register custom elements declared in $elements (depth-first)\n if (doc.$elements) {\n await registerElements(doc.$elements, base, ctx);\n }\n\n // Inject <head> elements declared in $head (link, meta, script, etc.)\n if (doc.$head) {\n injectHead(doc.$head, base);\n }\n\n const scope = await buildScope(doc, hostScope, base, ctx);\n\n const elements = new Set<string>();\n const renderOptions: JxRenderOptions = {\n _ctx: ctx,\n onNodeCreated: (el, path, def, state) => {\n if (el instanceof Element && el.tagName.includes(\"-\")) {\n elements.add(el.tagName.toLowerCase());\n }\n options.onNodeCreated?.(el, path, def, state);\n },\n ...(options.onNodeMoved ? { onNodeMoved: options.onNodeMoved } : {}),\n };\n const { result: root, stop } = runScoped(() => renderNode(doc, scope, renderOptions));\n ctx.root = root;\n\n let mounted = false;\n let disposed = false;\n const dispose = (): void => {\n if (disposed) {\n return;\n }\n disposed = true;\n options.signal?.removeEventListener(\"abort\", dispose);\n stop();\n if (mounted && typeof scope.onUnmount === \"function\") {\n (scope.onUnmount as (s: JxScope) => unknown)(scope);\n }\n root.remove();\n };\n\n if (options.signal?.aborted) {\n // Aborted before it could be attached: tear the effects down and attach nothing.\n dispose();\n } else {\n options.signal?.addEventListener(\"abort\", dispose, { once: true });\n target.append(root);\n mounted = true;\n if (typeof scope.onMount === \"function\") {\n (scope.onMount as (s: JxScope) => unknown)(scope);\n }\n }\n return { scope, root, elements, dispose };\n}\n\n// ─── Step 1: Resolve ──────────────────────────────────────────────────────────\n\nconst _resolveCache = new Map<string, Promise<JxDocument>>();\n\n/**\n * Seed the resolve cache with a document a host already holds, under the URL its references use.\n *\n * A bundled document — one imported as JSON rather than fetched — still names its dependencies by\n * URL: an `$elements` entry, a `$switch` case. Preloading those under the same URLs lets every such\n * reference resolve with no network, and lets `defineElement(\"<url>\")` dedupe on the source it\n * would otherwise have fetched. The key is stored as given and, when it parses as a URL, in its\n * absolute form too, because the two lookup paths spell it differently.\n *\n * @param {string} url - The URL the document is known by\n * @param {JxDocument} doc\n */\nexport function preloadDocument(url: string, doc: JxDocument): void {\n const settled = Promise.resolve(doc);\n _resolveCache.set(url, settled);\n try {\n _resolveCache.set(new URL(url, location.href).href, settled);\n } catch {\n // Not a URL at all — the raw key still serves the lookup that uses it.\n }\n}\n\nexport async function resolve(source: string | JxDocument, ctx?: JxContext): Promise<JxDocument> {\n if (typeof source !== \"string\") {\n return source;\n }\n // A mount's resolver answers for THIS mount and its hit never enters the shared cache.\n const served = ctx?.resolver?.(source);\n if (served) {\n return served;\n }\n if (_resolveCache.has(source)) {\n return _resolveCache.get(source)!;\n }\n const p = fetch(source).then(async (res) => {\n if (!res.ok) {\n throw new Error(`Jx: failed to fetch ${source} (${res.status})`);\n }\n /*\n * `res.ok` is not enough on a single-page host. A static host configured with an SPA fallback\n * answers a path it does not have with the APPLICATION SHELL at HTTP 200, so a missing document\n * arrives looking like a successful fetch and dies inside `res.json()` as\n * `Unexpected token '<', \"<!doctype \"... is not valid JSON` — a parser error for what is\n * actually a 404. Jx Cloud did this to every component `$ref` in the canvas.\n *\n * Checked on the content type rather than by sniffing the body: a host that says `text/html`\n * has told us plainly, and saying so costs nothing.\n */\n // Optional-chained: a response that carries no headers at all is one we have no EVIDENCE\n // About, and guessing is worse than proceeding. Every real `Response` has them.\n const contentType = res.headers?.get(\"Content-Type\") ?? \"\";\n if (contentType.includes(\"text/html\")) {\n throw new Error(\n `Jx: ${source} returned HTML, not a document — the host answered a missing file with its ` +\n `app shell (a single-page fallback), so this path is not served.`,\n );\n }\n // Trust boundary: fetched sources are Jx documents by contract.\n return (await res.json()) as JxDocument;\n });\n _resolveCache.set(source, p);\n return p;\n}\n\n// ─── Step 2: Build scope ──────────────────────────────────────────────────────\n\n/** JSON Schema keywords used to identify pure type definitions (Shape 2b). */\nconst SCHEMA_KEYWORDS = new Set([\n \"type\",\n \"properties\",\n \"items\",\n \"enum\",\n \"minimum\",\n \"maximum\",\n \"minLength\",\n \"maxLength\",\n \"pattern\",\n \"required\",\n \"examples\",\n]);\n\n/** /** @type {{ skip: boolean }} */\nconst _serverFnConfig = { skip: false };\n/** Set to true to suppress timing: \"server\" resolution (used by Studio edit mode). */\nexport function setSkipServerFunctions(v: boolean) {\n _serverFnConfig.skip = v;\n}\n\n/** @type {{ skip: boolean }} */\nconst _autoRequestConfig = { skip: false };\n/**\n * Set to true to suppress AUTOMATIC `$prototype: \"Request\"` fetches — the sibling of\n * {@link setSkipServerFunctions}, and used by Studio for the same reason.\n *\n * `buildScope` re-resolves every `state` entry on each full canvas render, so an auto-request\n * re-issued its HTTP call every time the canvas rebuilt. In edit/design mode that meant authoring\n * actions — a signal edit, or pressing Enter inside component-wrapped content, both of which force\n * a full render — fired network requests. Live data belongs to preview and to the deployed site.\n *\n * Only non-`manual` requests are gated: a `manual` one fires from an event handler, and edit mode\n * strips handlers before rendering. The returned ref is unchanged either way — it simply stays at\n * its initial `null`, which is the same state bindings observe before any fetch resolves.\n */\nexport function setSkipAutoRequests(v: boolean) {\n _autoRequestConfig.skip = v;\n}\n\n// ─── Dev-proxy auth token (Studio cross-origin canvas) ────────────────────────\n// The Studio canvas iframe is served from a token-gated loopback origin (createProjectServer): its\n// POST /__jx_resolve__ + /__jx_server__ routes 403 without ?token=<rpcToken>. The iframe boot reads\n// The token from its URL and calls setResolveToken so these dev-proxy fetches authenticate. Unset by\n// Default, leaving production + same-origin dev untouched (bare path, no query appended).\nlet _resolveToken: string | null = null;\nexport function setResolveToken(token: string | null) {\n _resolveToken = token || null;\n}\n/** Append the dev-proxy auth token to a privileged resolve path when one is configured. */\nfunction resolveProxyPath(path: string): string {\n return _resolveToken ? `${path}?token=${encodeURIComponent(_resolveToken)}` : path;\n}\n\n/** @deprecated No longer needed — ContentCollection/ContentEntry resolve via generic class path */\nexport function setSkipContentResolution(_v: boolean) {\n // No-op retained for API compatibility\n}\n\n/**\n * Observe runtime-created reactive values: runs `fn` immediately inside a reactive effect and\n * re-runs it whenever a tracked value changes; returns a disposer. Dep tracking in @vue/reactivity\n * is per module INSTANCE, so an effect created from another copy of the package (e.g. the studio's\n * own pin) can never track a ref/reactive created here — consumers that want to observe\n * runtime-resolved scope values (the Studio canvas iframe's dataScope re-post) must use this.\n *\n * @param {() => void} fn - Read the reactive values to observe inside this callback.\n * @returns {() => void} Disposer — stops the effect and its scope.\n */\nexport function observeScope(fn: () => void): () => void {\n const scope = effectScope(true);\n scope.run(() => {\n effect(fn);\n });\n return () => scope.stop();\n}\n\n/**\n * Run `fn` inside a detached reactive scope of THIS module's reactivity instance, returning its\n * result plus a disposer that stops every effect `fn` created. Callers that render via\n * {@link renderNode} and later tear the render down (the Studio canvas full render and its surgical\n * subtree re-renders) MUST use this instead of their own effectScope: scope collection is per\n * vue-reactivity module instance, so a scope from another copy of the package collects NOTHING and\n * its stop() silently leaks every binding effect of the superseded render.\n *\n * @param {() => T} fn - Work that may create reactive effects (typically a renderNode call).\n * @returns {{ result: T; stop: () => void }} The callback result and the scope disposer.\n */\nexport function runScoped<T>(fn: () => T): { result: T; stop: () => void } {\n const scope = effectScope(true);\n try {\n const result = scope.run(fn) as T;\n return { result, stop: () => scope.stop() };\n } catch (error) {\n // A throwing fn would otherwise leak the effects it created before failing.\n scope.stop();\n throw error;\n }\n}\n\n/**\n * Studio-canvas viewport-unit transpose. The canvas iframe is sized to its document's height, so\n * any viewport unit (`vh`/`vw`/`vmin`/`vmax`/`svh`/…) — which resolves against the iframe ELEMENT —\n * would feed back into an ever-growing height. When this is on, the runtime transposes them to\n * CONTAINER units (`cqh`/`cqw`/…) that resolve against the canvas's fixed-size query container (see\n * `canvas.html`): a predictable, feedback-free stand-in for the viewport. Off (the default) leaves\n * CSS untouched for real production rendering.\n */\nlet _canvasViewportTranspose = false;\nexport function setCanvasViewportTranspose(on: boolean) {\n _canvasViewportTranspose = on;\n}\n\nconst VIEWPORT_UNIT_RE = /(-?\\d*\\.?\\d+)(?:s|l|d)?v(h|w|min|max|i|b)\\b/gi;\nconst VIEWPORT_UNIT_MAP: Record<string, string> = {\n b: \"cqb\",\n h: \"cqh\",\n i: \"cqi\",\n max: \"cqmax\",\n min: \"cqmin\",\n w: \"cqw\",\n};\n\n/**\n * Transpose CSS viewport units → container-query units in a value string, but only when the\n * studio-canvas flag is set (otherwise the value is returned untouched). `100vh` → `100cqh`,\n * `50svw` → `50cqw`, `10vmin` → `10cqmin`, etc.\n */\nexport function transposeCanvasUnits(value: string): string {\n if (!_canvasViewportTranspose || !value.includes(\"v\")) {\n return value;\n }\n return value.replace(\n VIEWPORT_UNIT_RE,\n (_m, num: string, dim: string) => `${num}${VIEWPORT_UNIT_MAP[dim.toLowerCase()] ?? `cq${dim}`}`,\n );\n}\n\n/**\n * Studio-canvas anchor de-linking. In the editor canvas a rendered `<a href>` would navigate the\n * iframe when clicked, fighting element selection. When this is on, the runtime stamps the value on\n * `data-jx-href` instead of `href` so the anchor is inert (selectable, not a live link) while the\n * original target stays recoverable for richer link handling later. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _canvasDelinkAnchors = false;\nexport function setCanvasDelinkAnchors(on: boolean) {\n _canvasDelinkAnchors = on;\n}\n\n/**\n * Studio-canvas popover de-linking — `setCanvasDelinkAnchors`'s rule applied to `popover`.\n *\n * An OPEN popover is in the top layer, and CSS Position 4 §3.1 gives a top-layer element the\n * VIEWPORT as its containing block whatever its ancestors say. In the editor canvas that viewport\n * is a fiction: the frame is sized to its own content height, so a drawer pinned with `inset: 0`\n * lands halfway down a 6000px page, and a panel taller than a short component frame is clipped by\n * the `overflow: hidden` the canvas document needs. Worse, a top-layer box contributes nothing to\n * any ancestor's scrollable overflow, so the artboard can never grow to fit one.\n *\n * When this is on, the runtime stamps `popover` on `data-jx-popover` for nodes the studio can\n * ADDRESS — those carrying a stamped `data-jx-path`. That drops every `[popover]` UA rule at once,\n * and the one that matters most is `position: fixed`: with it gone the panel lays out in NORMAL\n * FLOW at its document position, which is what makes it contribute to `#jx-canvas-root`'s\n * scrollHeight so the host can grow the artboard to fit it. Leaving the top layer is necessary but\n * not sufficient — a fixed box contributes nothing to an ancestor's overflow either.\n *\n * It is worth saying what does NOT rescue this, because it is the intuitive answer and it is wrong:\n * `container-type: size` on the canvas's query container does NOT make it a containing block for\n * fixed descendants. Measured in Chrome 151 — `getComputedStyle(container).contain` is `none`, and\n * a `position: fixed` child inside it measures the WINDOW, not the container. So a panel that stays\n * fixed stays laid out against the frame's own viewport, which in an editable mode is the\n * document's full height. `iframe-render.ts` therefore FORCES `position` on the open panel rather\n * than relying on any containment.\n *\n * The studio re-supplies the one UA rule that matters — `display: none` while closed — inside a\n * cascade LAYER, so author declarations still beat it exactly as they beat the real UA rule on the\n * shipped page. That is deliberate: a popover whose base rule sets `display` is broken in\n * production, and the canvas has to show that rather than paper over it.\n *\n * The gate on `data-jx-path` is what keeps this out of documents the studio does not own: a popover\n * rendered inside a component's own template is never stamped, so it keeps its native behaviour.\n *\n * It also drives {@link transposeCanvasPopoverSelector}. The two are one transform — an attribute\n * renamed without its selectors transposed is a popover that can never be styled open.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkPopovers = false;\nexport function setCanvasDelinkPopovers(on: boolean) {\n _canvasDelinkPopovers = on;\n}\n\n/**\n * Studio-canvas de-linking of invoker commands, `inert` and a dialog's `open` — the dialog half of\n * {@link setCanvasDelinkPopovers}.\n *\n * A `<button command=\"show-modal\" commandfor=\"…\">` is the platform's own invoker: clicking it calls\n * `showModal()` on its target, which puts the dialog in the top layer and makes the rest of the\n * page INERT — the two things an editable canvas can least afford, since the first is the geometry\n * the popover comment above describes and the second makes every other element unclickable. So on a\n * stamped node `commandfor` is renamed to `data-jx-commandfor`: a button with `command` and no\n * target does nothing, and the studio's frame reports the click instead, so the host's single\n * writer of open state can answer it. `popovertarget` is left alone on purpose — its target has no\n * `popover` attribute on the canvas, so the platform already does nothing with it.\n *\n * `inert` becomes `data-jx-inert` for the same reason: an author's inert region is a region the\n * editor could not select into. And a `<dialog open>` becomes `<dialog data-jx-open>`, so the UA's\n * `dialog:not([open]) { display: none }` keeps every dialog closed until the canvas opens ONE with\n * `data-jx-dialog-open`, exactly as it opens one popover. `<details open>` is untouched: its `open`\n * is content, not an overlay state.\n *\n * Gated on `data-jx-path` like the popover rewrite, and driving\n * {@link transposeCanvasOverlaySelector} with it: an attribute renamed without its selectors\n * transposed is a dialog that can never be styled open, or a region that can never be styled inert.\n * Both renames travel with their selectors there — `[open]` on a dialog's own rules, `[inert]`\n * wherever it appears.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkCommands = false;\nexport function setCanvasDelinkCommands(on: boolean) {\n _canvasDelinkCommands = on;\n}\n\n/**\n * Raised while a defined element renders its own children, so the canvas de-link reaches them.\n *\n * The de-link rules gate on `data-jx-path`, which a document node carries and an element's INTERNAL\n * node never can: the internals belong to the definition, not to the page being edited, so the\n * studio's stamper never sees them. Without this a kit element that declares `popover` on a panel\n * inside itself opens a genuine top-layer popover inside an editable canvas, while Studio's single\n * writer of open state learns nothing about it.\n *\n * A module-scoped flag is sound here because `canvasAttrName` is called once per attribute OUTSIDE\n * the effect that binds it, and a definition renders its children synchronously — so the flag is\n * never read across a suspension point.\n */\nlet _canvasInsideStampedHost = false;\n\n/** Whether the node being rendered is inside a stamped host, and so part of the edited page. */\nfunction canvasStamped(el: HTMLElement): boolean {\n return _canvasInsideStampedHost || el.dataset.jxPath !== undefined;\n}\n\n/** The attribute name to stamp `key` on `el` under — `href` → `data-jx-href` on de-linked anchors. */\nfunction canvasAttrName(el: HTMLElement, key: string): string {\n if (_canvasDelinkAnchors && key === \"href\" && (el.tagName === \"A\" || el.tagName === \"AREA\")) {\n return \"data-jx-href\";\n }\n /* `dataset.jxPath` is already stamped here: `onNodeCreated` fires before `applyAttributes` in\n `renderNode`, and the studio's stamper writes the attribute synchronously inside it. That\n ordering is an unwritten contract between two packages, so `runtime-canvas.test.ts` asserts it\n directly rather than trusting it. */\n if (_canvasDelinkPopovers && key === \"popover\" && canvasStamped(el)) {\n return \"data-jx-popover\";\n }\n if (_canvasDelinkCommands && canvasStamped(el)) {\n if (key === \"commandfor\") {\n return \"data-jx-commandfor\";\n }\n if (key === \"inert\") {\n return \"data-jx-inert\";\n }\n if (key === \"open\" && el.tagName === \"DIALOG\") {\n return \"data-jx-open\";\n }\n }\n return key;\n}\n\n/**\n * Rewrite one asset reference for a host that does not serve the site's own URL space.\n *\n * The runtime writes a reference VERBATIM — `el.src = \"/hero.jpg\"` — so the browser resolves it\n * against the document, and the document is whatever page the renderer happens to be running in. On\n * a real site and on an editing server that serves the project tree, that is correct and this hook\n * stays null. On a multi-tenant editor origin it is not: `/hero.jpg` resolves against the editor,\n * misses, and — behind a single-page-app fallback — comes back as HTML at HTTP 200, so the image\n * renders broken and nothing is logged.\n *\n * A function rather than data because it cannot be one: the values it must fix are produced INSIDE\n * reactive effects (`{\"$ref\": \"#/state/hero\"}` is not a string until the effect runs), so no\n * document walk can see them. The Studio canvas iframe sets this at render time.\n *\n * Returning null leaves the value exactly as written, and a null resolver makes every call site\n * below the identity — so production rendering is byte-identical.\n *\n * @param {CanvasAssetResolver | null} fn - The resolver, or null to restore verbatim rendering\n */\nexport type CanvasAssetResolver = (value: string, key: string) => string | null;\n\nlet _canvasAssetResolver: CanvasAssetResolver | null = null;\nexport function setCanvasAssetResolver(fn: CanvasAssetResolver | null) {\n _canvasAssetResolver = fn;\n}\n\n/** Attribute/property names whose value is an asset reference, on any element. */\nconst ASSET_KEYS = new Set([\"src\", \"poster\", \"data\"]);\n\n/** Names whose value is a `srcset`-shaped candidate list rather than one reference. */\nconst SRCSET_KEYS = new Set([\"srcset\", \"imagesrcset\"]);\n\n/**\n * Elements on which `href` names an ASSET rather than a destination.\n *\n * `<a href>` and `<area href>` are places to go, not files to load; rewriting one would send a\n * click at the file that backs the page instead of at the page. `<link href>` is the opposite — a\n * stylesheet, an icon, a preload — and is the reason `$head` needs this at all.\n */\nconst HREF_ASSET_TAGS = new Set([\"LINK\"]);\n\n/** True when writing `key` on a `<tagName>` writes an asset reference. */\nfunction isAssetKey(tagName: string, key: string): boolean {\n return ASSET_KEYS.has(key) || (key === \"href\" && HREF_ASSET_TAGS.has(tagName));\n}\n\n/**\n * The value to actually write for `key` on a `<tagName>` — resolved when it is an asset reference,\n * and the input itself in every other case, including whenever no resolver is installed.\n *\n * `srcset` is split into its candidates and resolved one at a time, because it is N references in\n * one attribute and a resolver handed the whole string would have to re-implement HTML's parser to\n * find them.\n */\nfunction canvasAssetValue(tagName: string, key: string, value: string): string {\n if (!_canvasAssetResolver || value === \"\") {\n return value;\n }\n const name = key.toLowerCase();\n if (SRCSET_KEYS.has(name)) {\n const candidates = parseSrcset(value);\n let changed = false;\n const next = candidates.map((candidate) => {\n const resolved = _canvasAssetResolver?.(candidate.url, name) ?? null;\n if (resolved === null || resolved === candidate.url) {\n return candidate;\n }\n changed = true;\n return { descriptor: candidate.descriptor, url: resolved };\n });\n return changed ? formatSrcset(next) : value;\n }\n if (!isAssetKey(tagName, name)) {\n return value;\n }\n return _canvasAssetResolver(value, name) ?? value;\n}\n\n/** Every `url(...)` inside a CSS value, unquoted or quoted with either quote. */\nconst CSS_URL_RE = /\\burl\\(\\s*(?<q>[\"']?)(?<u>[^\"')]*)\\k<q>\\s*\\)/g;\n\n/**\n * Resolve every `url()` inside a CSS value.\n *\n * Applied to CSS rather than to a list of properties because in CSS a `url()` is ALWAYS a resource\n * reference — `background-image`, `mask`, `cursor`, `@font-face src`, `list-style-image` and every\n * shorthand that contains them — so enumerating the properties would be a list that goes stale\n * while the syntax does not.\n */\nfunction canvasStyleUrls(value: string): string {\n if (!_canvasAssetResolver || !value.includes(\"url(\")) {\n return value;\n }\n return value.replaceAll(CSS_URL_RE, (whole, quote: string, url: string) => {\n const resolved = url === \"\" ? null : (_canvasAssetResolver?.(url, \"url()\") ?? null);\n return resolved === null ? whole : `url(${quote}${resolved}${quote})`;\n });\n}\n\n/**\n * A style scalar as the canvas wants it written: assets resolved, then viewport units transposed.\n *\n * Exported because the canvas emits some CSS itself — the site-level `style` block, which never\n * passes through {@link applyStyle} — and a second implementation of \"what the canvas does to a\n * style value\" is a second thing to keep in step.\n *\n * @param {string} value - A CSS declaration value\n * @returns {string} The value as the canvas should write it\n */\nexport function canvasStyleValue(value: string): string {\n return transposeCanvasUnits(canvasStyleUrls(value));\n}\n\n/**\n * Studio-canvas prop-binding markers. When on, `bindProperty` stamps `data-jx-bound-prop=\"<key>\"`\n * on elements whose `textContent` is an invertible single-key state binding — the pure template\n * `\"${state.key}\"` or `{ \"$ref\": \"#/state/key\" }`. The studio canvas uses the marker to offer\n * inline editing of component-instance prop values; the rendered text must BE the prop value\n * verbatim, so mixed templates and deep paths are never stamped. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _stampPropBindings = false;\nexport function setStampPropBindings(on: boolean) {\n _stampPropBindings = on;\n}\n\n/** The single invertible template form: the whole string is exactly one `${state.key}` access. */\nconst PURE_STATE_TEMPLATE = /^\\s*\\$\\{\\s*state\\.(\\w+)\\s*\\}\\s*$/;\n\n/** The state key of an invertible `textContent` binding, or null (mixed template, deep path). */\nfunction boundPropKey(key: string, val: unknown, state: JxScope): string | null {\n if (!_stampPropBindings || key !== \"textContent\") {\n return null;\n }\n let sub: string | null = null;\n if (isRefObj(val)) {\n if (!val.$ref.startsWith(\"#/state/\")) {\n return null;\n }\n const rest = val.$ref.slice(\"#/state/\".length);\n sub = rest && !rest.includes(\"/\") ? rest : null;\n } else if (typeof val === \"string\") {\n sub = PURE_STATE_TEMPLATE.exec(val)?.[1] ?? null;\n }\n if (!sub) {\n return null;\n }\n // Only plain writable data entries are per-instance props. Computed/signal entries live as refs\n // In the raw scope (auto-unwrapped by the reactive proxy), and function/object entries (handlers,\n // $prototype instances) are not prop-overridable either — an instance $props write against any of\n // Them would clobber the definition's behavior, so their bindings are never marked editable.\n const stored = (toRaw(state) as Record<string, unknown>)[sub];\n if (isRef(stored) || typeof stored === \"function\") {\n return null;\n }\n if (typeof stored === \"object\" && stored !== null) {\n return null;\n }\n return sub;\n}\n\n/**\n * Build the reactive scope (state) from the document using the five-shape detection algorithm.\n *\n * @param {JxDocument} doc\n * @param {JxScope} [parentScope] Default is `{}`\n * @param {string} [base] Base URL for resolving $src imports. Default is `location.href`\n * @param {JxContext} [ctx] The mount context; absent on the legacy direct path\n * @returns {Promise<JxScope>} Reactive proxy (state)\n */\nexport async function buildScope(\n doc: JxDocument,\n parentScope: JxScope = {},\n base: string = location.href,\n ctx?: JxContext,\n) {\n // A body run without an event dispatches from the mount's root, read when it fires.\n const dispatchRoot = (): EventTarget | null => ctx?.root ?? null;\n const raw: JxScope = {};\n const defs = doc.state ?? {};\n\n /* Merge parent scope properties. A REACTIVE parent stays live: its members are read through\n accessors rather than copied, so a host that hands in a reactive record as the scope sees the\n document follow every field of it, not a snapshot of the primitives it held at mount time. A\n member the document declares itself is copied instead, so the document's own entry can still\n overwrite it — the document wins (embedding.md §3). */\n const linked = isReactive(parentScope);\n for (const key of Object.keys(parentScope)) {\n if (linked && !(key in defs)) {\n Object.defineProperty(raw, key, {\n configurable: true,\n enumerable: true,\n get: () => parentScope[key],\n set: (value: unknown) => {\n parentScope[key] = value;\n },\n });\n } else {\n raw[key] = parentScope[key];\n }\n }\n\n // Pass 0: resolve bare $prototype names via import map\n const imports = doc.imports ?? {};\n for (const [, def] of Object.entries(defs)) {\n if (isPrototypeDef(def) && !def.$src) {\n const mapped = imports[def.$prototype];\n if (mapped) {\n if (!mapped.endsWith(\".class.json\")) {\n console.warn(\n `Jx: import \"${def.$prototype}\" must map to a .class.json path, got \"${mapped}\"`,\n );\n continue;\n }\n def.$src = mapped;\n }\n }\n }\n\n // First pass: collect naked values, expanded defaults, plain objects\n for (const [key, def] of Object.entries(defs)) {\n // 1. String value\n if (typeof def === \"string\") {\n if (!def.includes(\"${\")) {\n raw[key] = def;\n } // Shape 1: naked string\n continue; // Template strings handled in second pass\n }\n\n // 2. Number, boolean, null\n if (typeof def === \"number\" || typeof def === \"boolean\" || def === null) {\n raw[key] = def;\n continue;\n }\n\n // 3. Array\n if (Array.isArray(def)) {\n raw[key] = def;\n continue;\n }\n\n // 4. Object\n if (typeof def === \"object\") {\n if (def.$prototype) {\n continue;\n } // Handled in later passes\n if (isExpressionDef(def)) {\n continue;\n } // Handled in pass 2.5\n if (isServerFnDef(def)) {\n continue;\n } // Handled in fifth pass\n if (\"default\" in def) {\n raw[key] = def.default;\n continue;\n } // Shape 2: expanded signal\n if (hasSchemaKeywords(def)) {\n continue;\n } // Shape 2b: pure type def\n raw[key] = def; // Shape 1: plain object\n }\n }\n\n // Wrap in Vue reactive proxy — deep reactivity from this point on\n const state = reactive(raw);\n\n // Second pass: template strings → computed\n for (const [key, def] of Object.entries(defs)) {\n if (typeof def === \"string\" && def.includes(\"${\")) {\n state[key] = computed(() => evaluateTemplate(def, state));\n }\n }\n\n // Pass 2.5: $expression entries (Shape 5)\n for (const [key, def] of Object.entries(defs)) {\n if (isExpressionDef(def)) {\n const node = def.$expression;\n if (isNamedFormulaDef(def)) {\n // A named formula: callable with positional args mapped onto its declared parameters.\n const params = def.parameters as (string | { name?: string; default?: unknown })[];\n state[key] = (...argValues: unknown[]) => {\n const args: Record<string, unknown> = {};\n for (const [i, p] of params.entries()) {\n const name = typeof p === \"string\" ? p : (p?.name ?? \"\");\n if (!name) {\n continue;\n }\n args[name] =\n argValues[i] === undefined && typeof p === \"object\" && p !== null && \"default\" in p\n ? p.default\n : argValues[i];\n }\n return evaluateExpression(node, state, null, { args });\n };\n } else if (isMutating(node.operator)) {\n const handler: JxEventHandler = (s, event) => evaluateExpression(node, s, event);\n state[key] = handler;\n } else {\n state[key] = computed(() => evaluateExpression(node, state, null));\n }\n }\n }\n\n // Third pass: $prototype: \"Function\" entries\n for (const [key, def] of Object.entries(defs)) {\n if (hasStructuredBody(def)) {\n // Structured body (spec §20): with parameters → a callable mapping positional args onto\n // $args names (invoked via the call operator); without → an event handler.\n const { body } = def;\n if (Array.isArray(def.parameters) && def.parameters.length > 0) {\n const params = def.parameters as (string | { name?: string; default?: unknown })[];\n state[key] = (...argValues: unknown[]) => {\n const args: Record<string, unknown> = {};\n for (const [i, p] of params.entries()) {\n const name = typeof p === \"string\" ? p : (p?.name ?? \"\");\n if (!name) {\n continue;\n }\n args[name] =\n argValues[i] === undefined && typeof p === \"object\" && p !== null && \"default\" in p\n ? p.default\n : argValues[i];\n }\n return runStatements(body, state, null, { args, target: dispatchRoot });\n };\n } else {\n const handler: JxEventHandler = (s, event) => {\n void runStatements(body, s, event ?? null, { target: dispatchRoot });\n };\n state[key] = handler;\n }\n } else if (isFunctionDef(def)) {\n state[key] = await resolveFunction(def, state, key, base);\n }\n }\n\n // Fourth pass: other $prototype entries (Request, Set, Map, etc.)\n for (const [key, def] of Object.entries(defs)) {\n if (isPrototypeDef(def)) {\n state[key] = await resolvePrototype(def, state, key, base, ctx);\n }\n }\n\n // Fifth pass: timing: \"server\" entries (dev mode — execute client-side, boundary unenforced)\n if (!(ctx?.skipServerFunctions ?? _serverFnConfig.skip)) {\n for (const [key, def] of Object.entries(defs)) {\n if (isServerFnDef(def)) {\n state[key] = await resolveServerFunction(def, state, key, base);\n }\n }\n }\n\n const rootMedia = ctx?.media ?? _rootMedia;\n if (doc.$media) {\n state[\"$media\"] = doc.$media;\n } else if (!state[\"$media\"] && Object.keys(rootMedia).length > 0) {\n state[\"$media\"] = rootMedia;\n }\n\n return state;\n}\n\n/**\n * Check whether an object contains any JSON Schema keywords. Used to discriminate Shape 2b (pure\n * type definition) from Shape 1 (naked object).\n *\n * @param {JxScope} obj\n * @returns {boolean}\n */\nfunction hasSchemaKeywords(obj: object) {\n for (const k of Object.keys(obj)) {\n if (SCHEMA_KEYWORDS.has(k)) {\n return true;\n }\n }\n return false;\n}\nexport { hasSchemaKeywords };\n\n/**\n * Evaluate a template string in the context of state and optional $map. Templates use\n * `state.varName` and `$map.item` syntax.\n *\n * @param {string} str\n * @param {JxScope} state\n * @returns {string}\n */\nfunction evaluateTemplate(str: string, state: JxScope): string {\n const $map = state?.$map as { item?: unknown; index?: number } | undefined;\n const fn = new Function(\"state\", \"$map\", \"item\", \"index\", `return \\`${str}\\``) as (\n state: JxScope,\n $map: unknown,\n item: unknown,\n index: number | undefined,\n ) => string;\n return fn(state, $map, $map?.item, $map?.index);\n}\n\n/**\n * Whether a template is ONE expression end to end — `\"${a.b}\"` rather than `\"a ${b}\"` or\n * `\"${a}${b}\"`.\n *\n * Depth-counted rather than pattern-matched. A greedy `/^\\$\\{(.+)\\}$/` also matched `\"${a} /\n * ${b}\"`, spliced the interior into `return (a} / ${b)`, and the SyntaxError became a silent null:\n * the node rendered empty and a `$head` entry shipped its own template text. A brace scan is exact\n * where a tightened regex is not — `\"${`${a}-x`}\"` is still one expression, and must keep its raw\n * value.\n *\n * Lives here rather than in the compiler because both renderers must draw the line in the same\n * place. It is what decides whether a value keeps its own type, and a value that is a boolean in\n * one renderer and the string `\"false\"` in the other is a page that changes meaning as it\n * hydrates.\n *\n * @param {string} str - Template source\n * @returns {boolean} True when the whole string is a single `${…}`\n */\nexport function isSingleExpression(str: string): boolean {\n if (!str.startsWith(\"${\") || !str.endsWith(\"}\")) {\n return false;\n }\n let depth = 0;\n for (let i = 1; i < str.length; i += 1) {\n const c = str[i];\n if (c === \"{\") {\n depth += 1;\n } else if (c === \"}\") {\n depth -= 1;\n if (depth === 0) {\n return i === str.length - 1;\n }\n }\n }\n return false;\n}\n\n/**\n * Evaluate a template for an ATTRIBUTE, keeping the expression's own type.\n *\n * `evaluateTemplate` interpolates into a string, which is what text wants and what an attribute\n * cannot afford: `\"${state.expanded}\"` has to arrive as the boolean `false`, or `booleanAttrValue`\n * never sees a boolean, `open=\"false\"` is written, and HTML reads that as open. Only a single\n * expression can carry a type at all — `\"a ${b}\"` is text by construction — which is the same line\n * `evaluateStaticTemplate` draws in the compiler, and drawing it identically is what keeps a\n * prerendered page and the same document rendered live in agreement.\n *\n * @param {string} str - Template source\n * @param {JxScope} state - Reactive scope\n * @returns {unknown} The expression's value, or the interpolated string\n */\nfunction evaluateAttrTemplate(str: string, state: JxScope): unknown {\n if (!isSingleExpression(str)) {\n return evaluateTemplate(str, state);\n }\n const $map = state?.$map as { item?: unknown; index?: number } | undefined;\n const fn = new Function(\"state\", \"$map\", \"item\", \"index\", `return (${str.slice(2, -1)})`) as (\n state: JxScope,\n $map: unknown,\n item: unknown,\n index: number | undefined,\n ) => unknown;\n return fn(state, $map, $map?.item, $map?.index);\n}\n\n// ─── Step 2b: Function resolution (Shape 4) ─────────────────────────────────\n\n/** Shape of a dynamically imported module: named exports plus an optional default. */\ntype ImportedModule = Record<string, unknown> & { default?: Record<string, unknown> };\n\n/** Minimal contract an externally-imported resolver class may implement. */\ninterface ExternalClassInstance {\n value?: unknown;\n resolve?: () => unknown;\n subscribe?: (cb: (newVal: unknown) => void) => void;\n}\n\n/** Module cache for $src imports (shared with external class resolution). */\nconst _moduleCache = new Map<string, ImportedModule>();\n\n/** A module the host will import on first use, keyed as the document spells its `$src`. */\ntype ModuleLoader = () => Promise<Record<string, unknown>>;\n\n/**\n * Lazy registrations: a loader until it runs, then the in-flight load, so two entries resolving the\n * same sidecar in one tick share one import rather than racing two.\n */\nconst _moduleLoaders = new Map<string, ModuleLoader | Promise<ImportedModule>>();\n\n/**\n * Seed the `$src` module cache with a module the host already imported, under the specifier the\n * document spells. A bundled document cannot have its sidecar fetched by URL — the bundler saw\n * neither the string nor the file — so the host imports the sidecar itself and registers it here,\n * and `$src` then resolves exactly as it would have from the network.\n *\n * Given a FUNCTION instead of a namespace, the registration is lazy: nothing is imported until a\n * document names the specifier, and the loader runs once. That is the shape for a host that can\n * bundle a sidecar as its own chunk but should not pay for it until something renders — Studio's\n * canvas frame registers every kit behaviour this way, so a page that uses no kit element loads\n * none of them (embedding.md §6).\n *\n * @param {string} specifier - The `$src` value as written in the document\n * @param {Record<string, unknown> | (() => Promise<Record<string, unknown>>)} mod - The imported\n * module namespace, or a loader that imports it on first use\n */\nexport function preloadModule(\n specifier: string,\n mod: Record<string, unknown> | ModuleLoader,\n): void {\n if (typeof mod === \"function\") {\n _moduleCache.delete(specifier);\n _moduleLoaders.set(specifier, mod);\n return;\n }\n _moduleLoaders.delete(specifier);\n _moduleCache.set(specifier, mod as ImportedModule);\n}\n\n/**\n * The module a specifier was seeded with — imported, or lazily registered — or undefined when the\n * host said nothing about it and the network is the answer.\n *\n * SYNCHRONOUS for a namespace the host imported, and that is load-bearing rather than tidy: a cache\n * hit used to be a `Map#has` on the way through `resolveFunction`, and an `await` there — even of a\n * value that is not a promise — defers one microtask, which reorders every element's scope\n * construction against its siblings'. The kit's field naming its slotted control is one thing that\n * order decides. Only a loader is a promise, because only a loader has to be.\n *\n * @param {string} src\n * @returns {ImportedModule | Promise<ImportedModule> | undefined}\n */\nfunction seededModule(src: string): ImportedModule | Promise<ImportedModule> | undefined {\n const cached = _moduleCache.get(src);\n if (cached) {\n return cached;\n }\n const pending = _moduleLoaders.get(src);\n if (!pending) {\n return undefined;\n }\n if (typeof pending !== \"function\") {\n return pending;\n }\n /* `Promise.resolve` so a thenable from a host's loader is still a Promise the call sites can\n tell from a namespace. */\n const load = Promise.resolve(pending()).then(\n (mod) => {\n _moduleCache.set(src, mod as ImportedModule);\n _moduleLoaders.delete(src);\n return mod as ImportedModule;\n },\n (error: unknown) => {\n /* A failed load — a chunk the network dropped — puts the loader back, so the next document to\n name the specifier tries again rather than inheriting this rejection for good. */\n _moduleLoaders.set(src, pending);\n throw error;\n },\n );\n _moduleLoaders.set(src, load);\n return load;\n}\n\n/**\n * Resolve a $prototype: \"Function\" entry into a function or computed.\n *\n * Functions receive state as their first parameter at call time. Functions with a return statement\n * in their body are wrapped in computed() for reactive evaluation.\n *\n * @param {JxFunctionDef} def - State entry with $prototype: \"Function\"\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key name\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<unknown>}\n */\nasync function resolveFunction(def: JxFunctionDef, state: JxScope, key: string, base?: string) {\n if (def.body && def.$src) {\n throw new Error(`Jx: '${key}' declares both body and $src — these are mutually exclusive`);\n }\n if (!def.body && !def.$src) {\n const params = resolveParamNames(def);\n const noop = new Function(...params, \"\");\n Object.defineProperty(noop, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n return noop;\n }\n\n let fn: ((...args: unknown[]) => unknown) | undefined;\n\n if (typeof def.body === \"string\") {\n const params = resolveParamNames(def);\n fn = new Function(...params, def.body) as (...args: unknown[]) => unknown;\n Object.defineProperty(fn, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n } else {\n // $src: dynamic import (the body/$src dichotomy was validated above)\n const src = def.$src;\n if (!src) {\n throw new Error(`Jx: '${key}' has neither body nor $src`);\n }\n const exportName = def.$export ?? key;\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n if (base) {\n const resolvedSrc = new URL(src, base).href;\n try {\n mod = (await import(resolvedSrc)) as ImportedModule;\n } catch {\n mod = (await import(src)) as ImportedModule;\n }\n } else {\n mod = (await import(src)) as ImportedModule;\n }\n _moduleCache.set(src, mod);\n }\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (typeof candidate !== \"function\") {\n throw new TypeError(`Jx: export \"${exportName}\" not found or not a function in \"${src}\"`);\n }\n fn = candidate as (...args: unknown[]) => unknown;\n }\n\n // Detect computed: body contains a return statement, or $src function introspection.\n // Functions with parameters (event handlers, callbacks) are never computed.\n const hasParams = (def.parameters ?? def.arguments ?? []).length > 0;\n let isComputed = false;\n if (!hasParams) {\n if (typeof def.body === \"string\") {\n isComputed = bodyReturnsValue(def.body);\n } else if (fn) {\n isComputed = fn.length <= 1 && bodyReturnsValue(fn.toString());\n }\n }\n if (isComputed) {\n return computed(() => fn(state));\n }\n\n return fn;\n}\n\n// ─── Step 3: Render ───────────────────────────────────────────────────────────\n\n/**\n * Extract parameter names from a function definition. Supports both legacy \"arguments\" (string\n * array) and CEM-compatible \"parameters\" (object array). Always ensures \"state\" is the first\n * parameter.\n *\n * @param {JxFunctionDef | JxPrototypeDef} def\n * @returns {string[]}\n */\nfunction resolveParamNames(def: JxFunctionDef | JxPrototypeDef) {\n const names = def.parameters ? paramNames(def.parameters) : (def.arguments ?? []);\n return names.length > 0 && names[0] === \"state\" ? names : [\"state\", ...names];\n}\n\n/**\n * Reserved Jx keys — never set as DOM properties.\n *\n * @type {Set<string>}\n */\nexport const RESERVED_KEYS = new Set([\n \"$schema\",\n \"$id\",\n \"$defs\",\n \"state\",\n \"$ref\",\n \"$props\",\n \"$elements\",\n \"$title\",\n \"$description\",\n \"$switch\",\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"$media\",\n \"$map\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n \"tagName\",\n \"children\",\n \"style\",\n \"attributes\",\n \"items\",\n \"map\",\n \"filter\",\n \"sort\",\n \"cases\",\n \"observedAttributes\",\n]);\n\n/**\n * Recursively render a Jx element definition into a DOM element.\n *\n * @param {JxElement | string | number | boolean} def\n * @param {JxScope} state - Reactive scope proxy (or child scope via Object.create)\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement | Text}\n */\n/** Refs already warned about, so the §13 diagnostic fires once per distinct target. */\nconst warnedRefChildren = new Set<string>();\n\n/** Foreign-content namespaces the HTML parser switches into, and the runtime must too. */\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\nconst MATHML_NS = \"http://www.w3.org/1998/Math/MathML\";\n\n/**\n * The namespace an element belongs in, given the one its parent established.\n *\n * The static build emits markup text, so the HTML parser applied foreign-content rules for it and\n * SVG worked there. The runtime built every node with `document.createElement`, which is HTML-only,\n * so the same document rendered blank in the Studio canvas and in any hydrated component — the\n * editor and the deployed site disagreeing, with only the editor wrong.\n *\n * @param {string} tagName\n * @param {string | null | undefined} inherited - The namespace the parent element established\n * @returns {string | null} Null means HTML\n */\nfunction elementNamespace(tagName: string, inherited: string | null | undefined): string | null {\n if (tagName === \"svg\") {\n return SVG_NS;\n }\n if (tagName === \"math\") {\n return MATHML_NS;\n }\n return inherited ?? null;\n}\n\nexport function renderNode(\n def: JxElement | string | number | boolean,\n state: JxScope,\n options?: JxRenderOptions,\n): HTMLElement | Text {\n const path = options?._path ?? [];\n\n // Text node children: bare strings/numbers/booleans produce DOM Text nodes\n if (typeof def === \"string\" || typeof def === \"number\" || typeof def === \"boolean\") {\n const textNode = document.createTextNode(String(def));\n if (typeof def === \"string\" && isTemplateString(def)) {\n effect(() => {\n textNode.textContent = evaluateTemplate(def, state);\n });\n }\n return textNode;\n }\n\n // Extend scope with any $-prefixed local bindings declared on this node\n let localState: JxScope = state;\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"$\") && !RESERVED_KEYS.has(key)) {\n if (localState === state) {\n localState = Object.create(state) as JxScope;\n }\n localState[key] = isRefObj(val) ? resolveRef(val.$ref, state) : val;\n }\n }\n\n /*\n * §13 diagnostic: a node-level external `$ref` (the withdrawn component-instance syntax) has no\n * tagName and silently renders an empty <div>. Warn once per target instead of failing silently —\n * the supported mechanism is $elements + a custom-element tag (see spec §13).\n */\n if (\"$ref\" in def && !def.tagName) {\n const refTarget = String((def as { $ref?: unknown }).$ref ?? \"\");\n if (!warnedRefChildren.has(refTarget)) {\n warnedRefChildren.add(refTarget);\n console.warn(\n `Jx: a $ref child (\"${refTarget}\") is not a supported component instance; register the ` +\n `component in $elements and use its custom-element tag instead (spec §13).`,\n );\n }\n }\n\n /* RESOLVED ONCE, HERE, before anything branches on it.\n A tag may be a name or a choice between names (`ElementTagName`). Resolving at the top means\n every test below — the hyphen check that routes to the custom-element path, `customElements.get`,\n `createElement` itself — sees a literal, exactly as it did when a tag could only be written out.\n\n It is not tracked. `tagName` is in RESERVED_KEYS so no binding sweep reaches it, and a tag that\n changed after mount would mean replacing the node: the subtree's listeners, its focus, its typed\n input values and its component instances all go with it, and this runtime has no dispose walk to\n pay that bill (renderSwitch, two hundred lines up, still leaks its previous case's effects).\n `jx validate` warns when a tag discriminant is also an assignment target, so the case where this\n rule bites is caught before it ships rather than found as a `<div>` that never became an `<a>`. */\n const tagName = resolveTagName(def.tagName, localState);\n const isCustomEl = tagName.includes(\"-\") && customElements.get(tagName);\n\n if (def.$props && isCustomEl) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n\n if (def.$props) {\n // A hyphenated tag carrying $props is a component instance whose definition has not finished\n // Registering yet (async defineElement — e.g. the Studio desktop canvas, where the component\n // Fetch can land after this node renders). Render via the property-first path anyway: it sets\n // The instance props as JS properties on the bare element, which the eventual upgrade's\n // ConnectedCallback reads back off `this` (see the def.state merge below), so the instance's\n // Props win. The old branch stripped the props here, so a late upgrade painted the component's\n // State DEFAULTS instead (\"0\"/\"DESCRIPTION\" for every instance). A non-custom tag can never\n // Upgrade, so it keeps the historical mergeProps-into-scope behavior.\n if (tagName.includes(\"-\")) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n const { $props: _$props, ...rest } = def;\n return renderNode(rest, mergeProps(def, localState), options);\n }\n if (def.$switch) {\n return renderSwitch(def, localState, options);\n }\n\n const ns = elementNamespace(tagName, options?._ns);\n /*\n * `foreignObject` is itself an SVG element, and is the documented way back into HTML: its\n * DESCENDANTS are HTML, so the element and its children carry different namespaces.\n */\n const childNs = tagName === \"foreignObject\" ? null : ns;\n /*\n * A namespaced node comes back as Element; every apply* helper below is typed for HTMLElement\n * and touches only members both share (style, dataset, setAttribute, append).\n */\n const el = (ns\n ? document.createElementNS(ns, tagName)\n : document.createElement(tagName)) as unknown as HTMLElement;\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path, def, localState);\n }\n\n applyProperties(el, def, localState);\n /* A custom element's own definition applies its style at connection, through the same interning\n path — which releases whatever is already on the element. So the call site's style is\n remembered here and merged there; see {@link callSiteStyles}. */\n if (def.style && tagName.includes(\"-\")) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(\n el,\n def.style ?? {},\n (localState[\"$media\"] as Record<string, string>) ?? {},\n localState,\n );\n applyAttributes(el, def.attributes ?? {}, localState);\n\n const kids = def.children;\n if (isMappedArray(kids)) {\n // Legacy whole-children repeater: the items render directly into `el` (which keeps its own\n // TagName, e.g. <ul>), with no extra wrapper element.\n const arrOpts =\n options || childNs ? { ...options, _ns: childNs, _path: [...path, \"children\"] } : undefined;\n renderMappedArrayInto(el, kids, localState, arrOpts);\n } else if (Array.isArray(kids)) {\n for (let i = 0; i < kids.length; i++) {\n const child = kids[i]!;\n const childOpts =\n options || childNs\n ? { ...options, _ns: childNs, _path: [...path, \"children\", i] }\n : undefined;\n if (isMappedArray(child)) {\n // Array pseudo-element among siblings: expand inline, no wrapper.\n renderMappedArrayInto(el, child, localState, childOpts);\n } else {\n el.append(renderNode(child, localState, childOpts));\n }\n }\n }\n\n return el;\n}\n\n// ─── Template string utilities ────────────────────────────────────────────────\n\n/**\n * Check if a value is a template string (contains ${}).\n *\n * @param {unknown} val\n * @returns {boolean}\n */\n// ─── Property / style / attribute application ─────────────────────────────────\n\n/**\n * @param {HTMLElement} el\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction applyProperties(el: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (RESERVED_KEYS.has(key)) {\n continue;\n }\n if (key.startsWith(\"$\")) {\n continue;\n } // Scope bindings — handled in renderNode\n\n if (key.startsWith(\"on\") && bindHandler(el, key, val, state)) {\n continue;\n }\n\n bindProperty(el, key, val, state);\n }\n}\n\n/**\n * Attach an `on*` key as an event listener, in any of the four spellings a handler has: a `$ref` to\n * a function, a structured body (spec §20), a string body, or an `$expression`. Returns false for a\n * value that is none of those, which the caller then writes as a plain property.\n *\n * @param {HTMLElement} el\n * @param {string} key The `on`-prefixed key\n * @param {unknown} val\n * @param {JxScope} state\n * @returns {boolean} Whether a listener was attached\n */\nfunction bindHandler(el: HTMLElement, key: string, val: unknown, state: JxScope): boolean {\n const type = key.slice(2);\n const scope = state;\n if (isRefObj(val)) {\n const handler = resolveRef(val.$ref, state);\n if (typeof handler === \"function\") {\n const handlerFn = handler as (s: JxScope, e: Event) => unknown;\n el.addEventListener(type, (e) => handlerFn(scope, e));\n }\n return true;\n }\n if (hasStructuredBody(val)) {\n const { body } = val;\n el.addEventListener(type, (e) => {\n void runStatements(body, scope, e);\n });\n return true;\n }\n if (isFunctionDef(val) && typeof val.body === \"string\") {\n const params = resolveParamNames(val);\n const fn = new Function(...params, val.body) as (s: JxScope, e: Event) => unknown;\n el.addEventListener(type, (e) => fn(scope, e));\n return true;\n }\n if (isExpressionDef(val)) {\n const node = val.$expression;\n el.addEventListener(type, (e) => evaluateExpression(node, scope, e));\n return true;\n }\n return false;\n}\n\n/**\n * A definition's root-level `on*` keys listen on the HOST element, exactly as they would on an\n * element in a document. Only handler keys are read here: the rest of a definition's root —\n * `observedAttributes`, `emits`, `description` — describes the element rather than styling an\n * instance, and is not written onto it.\n *\n * @param {HTMLElement} host\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction bindDefinitionHandlers(host: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"on\") && !RESERVED_KEYS.has(key)) {\n bindHandler(host, key, val, state);\n }\n }\n}\n\n/**\n * @param {HTMLElement} el\n * @param {string} key\n * @param {unknown} val\n * @param {JxScope} state\n */\nfunction bindProperty(el: HTMLElement, key: string, val: unknown, state: JxScope) {\n const target = el as unknown as Record<string, unknown>;\n const boundProp = boundPropKey(key, val, state);\n if (boundProp) {\n el.dataset.jxBoundProp = boundProp;\n }\n /* An `<img>` in a document says `{\"tagName\": \"img\", \"src\": \"/hero.jpg\"}`, so `src` arrives HERE\n as a top-level key and is written as a DOM PROPERTY — `attributes: { src }` is the rarer\n spelling. Both are the same reference and both need the same resolution. */\n const asAsset = (resolved: unknown): unknown =>\n typeof resolved === \"string\" ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n /*\n * `className` on an SVGElement is a read-only SVGAnimatedString, so assigning it throws in the\n * strict mode an ES module always runs under. It is the most common Jx element property, so the\n * attribute form is the only one that works on both.\n */\n const write = (resolved: unknown): void => {\n const node = el as unknown as Element;\n if (key === \"className\" && !(node instanceof HTMLElement)) {\n node.setAttribute(\"class\", resolved == null ? \"\" : String(resolved));\n return;\n }\n /* An equal write is skipped. A binding re-runs whenever anything it read changes, not only\n when its own result does, and re-setting `value` on a focused control is not free: it can\n move the caret and collapse the selection. A control that already holds the value has\n nothing to learn from being told again. */\n if (target[key] === resolved) {\n return;\n }\n target[key] = resolved;\n };\n if (isRefObj(val)) {\n const refVal = val as { $ref: string };\n if (key === \"id\") {\n target[key] = resolveRef(refVal.$ref, state) as string;\n return;\n }\n effect(() => {\n write(asAsset(resolveRef(refVal.$ref, state)));\n });\n return;\n }\n\n // Universal ${} reactivity — template strings in element properties\n if (isTemplateString(val)) {\n effect(() => {\n write(asAsset(evaluateTemplate(val as string, state)));\n });\n return;\n }\n\n write(asAsset(val));\n}\n\n/*\n * ─── The Stylesheet Engine ───────────────────────────────────────────────────\n *\n * An authored `style` object becomes REAL CSS RULES, delivered through the document's\n * `adoptedStyleSheets`. Everything below exists to make that true, and the reason it has to be\n * true is a cascade inversion rather than a missing feature.\n *\n * `applyStyle` used to split one style object across two cascade ORIGINS: a top-level scalar went\n * inline (`el.style.color = …`) while an object-valued key became a per-element `<style>` tag. An\n * inline declaration beats any non-`!important` rule, so\n *\n * { \"backgroundColor\": \"#6e0303\", \":hover\": { \"backgroundColor\": \"#15164a\" } }\n *\n * emitted a perfectly correct `:hover` rule that could never win. Nesting was not missing; it was\n * outranked. The one existing defence, `mediaOverriddenProps`, moved a base property out of inline\n * when an `@`-block overrode it — one level deep, `@`-keys only, never `:hover` — which is the\n * shape of the bug rather than a fix for it. Every style assertion in the suite read the `<style>`\n * tag's text, so the inversion was invisible to all of them.\n *\n * With every declaration in a rule, `:hover` versus base is an ordinary equal-specificity pair and\n * source order decides, exactly as it does on the compiled page.\n *\n * **Three sheet roles, because mutation cost scales with sheet size.** Measured in Chrome 152 over\n * 500 styled elements: 500 `<style>` tags cost 86.0ms to build, one adopted sheet with hash dedup\n * costs 1.7ms, and 500 separate adopted sheets cost 6.2ms to build but 84.1ms per style recalc\n * because each one is walked. On the update path (300 value edits, the Style-panel hot path)\n * mutating a rule inside one big shared sheet costs 295.7ms, because Chrome rebuilds the whole\n * sheet's RuleSet on any mutation. So:\n *\n * - the SHARED sheet holds every static, interned rule set and is grown but never rewritten;\n * - a reactive declaration is indirected through a custom property, so the rule is static text\n * and the update writes `el.style.setProperty(\"--jx-r0-0\", v)` — 12.4ms, and independent of\n * sheet size (the same mechanism that makes `${…}` work inside a nested block at all);\n * - the SCRATCH sheet takes the elements under live Studio edit and is rewritten with\n * `replaceSync`, 7.5ms per 100 structural edits against 76.9ms for delete+insert in the big one.\n *\n * **The handle stays `data-jx`, and its value becomes a content hash.** Not a generated class:\n * `applyAttributes` runs after `applyStyle`, so a static `attributes: { class: … }` would wipe a\n * class handle. `data-jx` is already there, is specificity (0,1,0), and is not author-writable.\n * Hashing the built rule text rather than calling `Math.random()` is what gives dedup and SSR\n * stability, and it covers everything that varies per call site by construction — the authored\n * object, the resolved `$media` map and the canvas transposer state are all inputs to that text.\n *\n * **Jx emits no cascade layer of its own.** Third-party CSS arrives through `$head` unlayered, and\n * an unlayered rule beats a layered one at any specificity — so layering Jx's own rules would hand\n * every page's `$head` a win it does not have today. It is also what keeps the canvas's\n * `@layer jx-canvas-ua` UA emulation working now that base declarations are unlayered rules rather\n * than inline styles: unlayered still beats layered, which is the same direction author origin\n * beats UA origin on the shipped page.\n */\n\n/** A rule set as it was written into a sheet: the texts, plus the live rules when there are any. */\ninterface InsertedRules {\n texts: readonly string[];\n rules: CSSRule[];\n}\n\n/** A place rules can be written. Two implementations: the CSSOM, and `<style>` text. */\ninterface StyleSink {\n insert: (texts: readonly string[]) => InsertedRules;\n remove: (inserted: InsertedRules) => void;\n /** Rewrite the whole sink. Used only by the scratch sheet. */\n replaceAll: (texts: readonly string[]) => void;\n /** Everything written, in sheet order. See {@link documentStyleText}. */\n text: () => string;\n detach: () => void;\n}\n\n/**\n * A sink over a real `CSSStyleSheet` — constructable and adopted, or a `<style>` element's own.\n *\n * @param {CSSStyleSheet} sheet\n * @param {() => void} detach\n * @returns {StyleSink}\n */\nfunction cssomSink(sheet: CSSStyleSheet, detach: () => void): StyleSink {\n const entries: InsertedRules[] = [];\n return {\n detach,\n insert(texts) {\n const rules: CSSRule[] = [];\n for (const text of texts) {\n const index = sheet.cssRules.length;\n try {\n sheet.insertRule(text, index);\n } catch {\n /* One unparseable rule must not take the other twenty with it. A `<style>` element drops\n exactly the offending rule and keeps going; `insertRule` throws, so this restores the\n tolerance an author's stylesheet has always had. */\n continue;\n }\n const rule = sheet.cssRules[index];\n if (rule) {\n rules.push(rule);\n }\n }\n const inserted: InsertedRules = { rules, texts };\n entries.push(inserted);\n return inserted;\n },\n remove(inserted) {\n const at = entries.indexOf(inserted);\n if (at !== -1) {\n entries.splice(at, 1);\n }\n if (inserted.rules.length === 0) {\n return;\n }\n /* An index scan of a 302-rule sheet measures 0.04ms, so finding the rules costs nothing next\n to the RuleSet rebuild the deletion itself forces. Descending, or each deletion shifts the\n indices still to be removed. */\n const list = [...sheet.cssRules];\n const indices = inserted.rules\n .map((rule) => list.indexOf(rule))\n .filter((index) => index >= 0)\n .toSorted((a, b) => b - a);\n for (const index of indices) {\n sheet.deleteRule(index);\n }\n inserted.rules.length = 0;\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n sheet.replaceSync(texts.join(\"\\n\"));\n },\n text() {\n return entries.flatMap((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n },\n };\n}\n\n/**\n * The last resort: a `<style>` element whose text is rewritten. No CSSOM required.\n *\n * @param {HTMLStyleElement} tag\n * @returns {StyleSink}\n */\nfunction textSink(tag: HTMLStyleElement): StyleSink {\n const entries: InsertedRules[] = [];\n const write = () => {\n tag.textContent = entries.map((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n };\n return {\n detach() {\n tag.remove();\n },\n insert(texts) {\n const inserted: InsertedRules = { rules: [], texts };\n entries.push(inserted);\n write();\n return inserted;\n },\n remove(inserted) {\n const index = entries.indexOf(inserted);\n if (index !== -1) {\n entries.splice(index, 1);\n write();\n }\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n write();\n },\n text() {\n return tag.textContent ?? \"\";\n },\n };\n}\n\n/**\n * Open a sheet on `doc`, preferring a constructable one.\n *\n * A constructable stylesheet cannot be adopted into another document, which is why the registry\n * below is keyed on the document and never cached at module scope: the Studio iframe, the live\n * preview tab and the parent page each open their own.\n *\n * @param {Document} doc\n * @returns {StyleSink}\n */\nfunction openSink(doc: Document): StyleSink {\n const view = doc.defaultView as (Window & { CSSStyleSheet?: typeof CSSStyleSheet }) | null;\n const SheetConstructor = view?.CSSStyleSheet;\n if (typeof SheetConstructor === \"function\" && Array.isArray(doc.adoptedStyleSheets)) {\n try {\n const sheet = new SheetConstructor();\n doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];\n return cssomSink(sheet, () => {\n doc.adoptedStyleSheets = doc.adoptedStyleSheets.filter((s) => s !== sheet);\n });\n } catch {\n // No constructable stylesheets, or a frozen adoptedStyleSheets. Fall through to a tag.\n }\n }\n const tag = doc.createElement(\"style\");\n tag.dataset.jxSheet = \"\";\n (doc.head ?? doc.documentElement).append(tag);\n return tag.sheet ? cssomSink(tag.sheet, () => tag.remove()) : textSink(tag);\n}\n\n/** One interned rule set: the rules as written, and how many elements point at them. */\ninterface InternEntry {\n inserted: InsertedRules;\n refs: number;\n}\n\n/** Everything one document's rules are kept in. */\ninterface SheetState {\n shared: StyleSink;\n /** Opened on the first live edit, and only then — most documents never have one. */\n scratch: StyleSink | null;\n /** Elements living on the scratch sheet, in the order their rules are written. */\n scratchOwners: Map<HTMLElement, readonly string[]>;\n /** Scope handle to the rule set it names. */\n interned: Map<string, InternEntry>;\n /** Declaration-body at-rule text to the one copy of it. */\n hoisted: Map<string, InternEntry>;\n /** Distinguishes `--jx-r<serial>-<n>` variables between elements. */\n serial: number;\n}\n\n/**\n * The per-document registry. A `WeakMap` rather than a module-level singleton because one process\n * renders into several documents (canvas iframe, preview tab, parent) and a constructable sheet\n * belongs to exactly one of them.\n */\nconst sheetStates = new WeakMap<Document, SheetState>();\n\n/**\n * @param {Document} doc\n * @returns {SheetState}\n */\nfunction sheetStateFor(doc: Document): SheetState {\n const existing = sheetStates.get(doc);\n if (existing) {\n return existing;\n }\n const created: SheetState = {\n hoisted: new Map(),\n interned: new Map(),\n scratch: null,\n scratchOwners: new Map(),\n serial: 0,\n shared: openSink(doc),\n };\n sheetStates.set(doc, created);\n return created;\n}\n\n/** What one element holds, so that releasing it is exact rather than approximate. */\ninterface ElementStyleEntry {\n doc: Document;\n /** The state this entry's handles belong to; a reset replaces it and orphans them. */\n state: SheetState;\n uid: string;\n /** The interning key in the shared sheet, or null when the element is on the scratch sheet. */\n interned: string | null;\n /** Hoisted declaration at-rules this element holds a reference to. */\n hoisted: readonly string[];\n /** The `--jx-r…` custom properties its effects write inline. */\n vars: readonly string[];\n /** Stops those effects. */\n stop: (() => void) | null;\n}\n\n/**\n * Per-element style bookkeeping. The replacement for the old `elementStyleTags`, which exported a\n * `<style>` element and let its importers remove it by hand; {@link releaseElementStyles} is the\n * documented teardown in its place, because a rule set is now refcounted and dropping one by hand\n * would either leak it or take it away from another element that shares it.\n */\nconst elementStyles = new WeakMap<HTMLElement, ElementStyleEntry>();\n\n/** The scope handle `buildStyleRules` writes, before the hash of its own output replaces it. */\nconst SCOPE_TOKEN = \"\u0001jx-scope\u0001\";\n\n/**\n * Rewrite the scratch sheet from its owners.\n *\n * `scratchOwners` is a STRONG map — it has to be, since the sheet's whole text is rebuilt from it —\n * so an element only leaves it through {@link releaseElementStyles}. That is not a hole: every way\n * an edited element can go away calls it. `applyStyle` registers it with the enclosing reactive\n * scope, Studio's `disposeSubtree` calls it per element, and `resetDocumentStyles` drops the map\n * wholesale. Sweeping on `isConnected` instead would be wrong rather than merely redundant: an\n * element is routinely styled before it is inserted.\n *\n * @param {SheetState} state\n */\nfunction rewriteScratch(state: SheetState) {\n if (!state.scratch) {\n return;\n }\n state.scratch.replaceAll([...state.scratchOwners.values()].flat());\n}\n\n/**\n * Drop one reference to an interned rule set, removing its rules when the last one goes.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n */\nfunction releaseInterned(state: SheetState, table: Map<string, InternEntry>, key: string) {\n const entry = table.get(key);\n if (!entry) {\n return;\n }\n entry.refs -= 1;\n if (entry.refs <= 0) {\n table.delete(key);\n state.shared.remove(entry.inserted);\n }\n}\n\n/**\n * Take one reference to a rule set, inserting it the first time it is asked for.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n * @param {readonly string[]} texts\n */\nfunction retainInterned(\n state: SheetState,\n table: Map<string, InternEntry>,\n key: string,\n texts: readonly string[],\n) {\n const existing = table.get(key);\n if (existing) {\n existing.refs += 1;\n return;\n }\n table.set(key, { inserted: state.shared.insert(texts), refs: 1 });\n}\n\n/**\n * Release everything {@link applyStyle} gave an element: its rules, its scope handle, and the inline\n * custom properties and effects behind its reactive declarations.\n *\n * This is the teardown API `elementStyleTags` used to stand in for, and it is exported because\n * removing a rule set by hand is no longer possible: sets are shared between elements that style\n * alike, so the only safe removal is a refcounted one. Calling it on an element that has no styles\n * is a no-op, which is what makes `applyStyle` safe to call twice.\n *\n * Callers rarely need it. `applyStyle` registers it with the enclosing reactive scope, so an\n * element discarded by a re-rendering mapped array or a disposed Studio subtree releases itself.\n *\n * @param {HTMLElement} el\n * @param {ElementStyleEntry} [only] - Release only if this is still the element's current entry\n */\nexport function releaseElementStyles(el: HTMLElement, only?: ElementStyleEntry): void {\n const entry = elementStyles.get(el);\n if (!entry || (only !== undefined && entry !== only)) {\n return;\n }\n elementStyles.delete(el);\n entry.stop?.();\n for (const name of entry.vars) {\n el.style.removeProperty(name);\n }\n delete el.dataset.jx;\n /* A `resetDocumentStyles` between the two replaces the state, and its sheets are already gone —\n so the element-local half above always runs and the sheet half is skipped as already done. */\n if (sheetStates.get(entry.doc) !== entry.state) {\n return;\n }\n const { state } = entry;\n if (entry.interned === null) {\n if (state.scratchOwners.delete(el)) {\n rewriteScratch(state);\n }\n } else {\n releaseInterned(state, state.interned, entry.interned);\n }\n for (const key of entry.hoisted) {\n releaseInterned(state, state.hoisted, key);\n }\n}\n\n/**\n * Discard every sheet this runtime opened on a document, and orphan the element entries that point\n * into them.\n *\n * A full re-render replaces the whole tree, so the alternative is a shared sheet that only ever\n * grows. The element `WeakMap` cannot be enumerated to be cleared, so entries are invalidated\n * instead: each one records the `SheetState` it was written into, and a release that finds a\n * different state registered for the document does the element-local half only. That is what stops\n * a surviving element from later handing `deleteRule` an index into a sheet nobody is reading.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n */\nexport function resetDocumentStyles(doc: Document = document): void {\n const state = sheetStates.get(doc);\n if (!state) {\n return;\n }\n sheetStates.delete(doc);\n for (const el of state.scratchOwners.keys()) {\n elementStyles.delete(el);\n delete el.dataset.jx;\n }\n state.scratchOwners.clear();\n state.interned.clear();\n state.hoisted.clear();\n state.shared.detach();\n state.scratch?.detach();\n}\n\n/**\n * The CSS this engine has written into a document, in sheet order.\n *\n * It reports what the engine ASKED the document to adopt, not what the document managed to parse,\n * and the difference is the point: `insertRule` throws on a rule the host cannot parse, and the\n * sink swallows that so one bad rule cannot take the rest of an element's set with it. The test DOM\n * rejects `@position-try` outright, so reading it back off `cssRules` there would report a block\n * that a browser adopts perfectly well as missing.\n *\n * It is also the honest answer to \"what CSS did my style object become\", which is a question the\n * Studio style inspector asks and, before this, nothing could answer without scraping `<style>`\n * tags out of the head.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n * @returns {string} One rule per line, shared sheet first\n * @docs framework/concepts/styling\n */\nexport function documentStyleText(doc: Document = document): string {\n const state = sheetStates.get(doc);\n if (!state) {\n return \"\";\n }\n return [state.shared.text(), state.scratch?.text() ?? \"\"].filter(Boolean).join(\"\\n\");\n}\n\n/**\n * Whether a style object declares `display` anywhere in it.\n *\n * `defineElement` gives a custom element `display: block` because a custom element defaults to\n * `inline` and Jx containers behave like `<div>`. It used to test `this.style.display`, which was a\n * correct test only while the author's own `display` was written inline — the moment it became a\n * rule the guard stopped seeing it and the default started overriding the author. The test is now\n * on the source rather than on the element, and it is a deep one on purpose: an inline default\n * would beat a `:hover` or `@media` `display` just as surely as a base one.\n *\n * A `@keyframes` block is the one thing the walk does NOT descend into. A `display` in a keyframe\n * stop is a point on a timeline, not a declaration on this element — animating `display` is the\n * ordinary shape of an `allow-discrete` reveal — so counting one as the author's own left the\n * element with no `display` at all, and a custom element with no `display` is `inline`. The element\n * laid out wrongly whenever it was still, which is most of the time.\n *\n * @param {JxStyle | undefined} style\n * @returns {boolean}\n */\nfunction declaresDisplay(style: JxStyle | undefined): boolean {\n /* The BASE block only. A deep walk read a `display` that exists solely inside `&:hover` or an\n `@media` block as \"the author supplied one\", so the element stayed `inline` at rest and\n became a block on hover — a live trap rather than a subtlety. An author who wants the\n platform's own default writes `display: revert` in the base block, which this sees. */\n return Boolean(style) && typeof style === \"object\" && \"display\" in style;\n}\n\n/**\n * The `style` object a USAGE SITE wrote on a custom element, kept until the element connects.\n *\n * Weak in the element, so an instance that is never connected is collected with its entry.\n */\nconst callSiteStyles = new WeakMap<HTMLElement, JxStyle>();\n\n/**\n * Merge two style objects, `over` winning.\n *\n * Deep, because a nested selector block is a rule of its own: a call site that declares `&:hover`\n * must not delete the definition's `&:hover`, only the declarations it repeats inside it. A scalar\n * always replaces, which is what \"the call site wins\" means.\n *\n * @param base The definition's style.\n * @param over The usage site's, if any.\n * @returns {JxStyle} A new object; neither argument is mutated.\n */\nfunction mergeStyle(base: JxStyle, over: JxStyle | undefined): JxStyle {\n if (!over) {\n return base;\n }\n const out: Record<string, unknown> = { ...(base as Record<string, unknown>) };\n for (const [key, value] of Object.entries(over as Record<string, unknown>)) {\n const prior = out[key];\n out[key] =\n prior !== null &&\n typeof prior === \"object\" &&\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value)\n ? mergeStyle(prior as JxStyle, value as JxStyle)\n : value;\n }\n return out as JxStyle;\n}\n\n/**\n * Turn an element's `style` object into CSS rules and adopt them.\n *\n * Nothing is written inline except the `--jx-r…` custom properties that carry reactive values, so\n * an authored `:hover`, `@media` or `@supports` block overrides its own base declaration by\n * ordinary cascade rules — which is what the emitted CSS always said and the inline write always\n * prevented. See the engine essay above for the sheet roles and the measurements behind them.\n *\n * Calling it twice on one element is safe: the first call's rules are released first.\n *\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} [mediaQueries] Named breakpoints from root $media. Default is\n * `{}`\n * @param {JxScope} [state] Component scope for template string evaluation. Default is `{}`\n * @docs framework/concepts/styling\n */\nexport function applyStyle(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef, mediaQueries, state, false);\n}\n\n/**\n * Re-apply an element's style definition in place.\n *\n * The Studio Style panel calls this per keystroke, so its rules go to the SCRATCH sheet, which is\n * rewritten whole with `replaceSync` rather than edited rule by rule inside the shared one: 7.5ms\n * per 100 structural edits against 76.9ms. The previous rule set is released first — without that\n * this would leak a set into the shared sheet on every keypress, which is the opposite of the\n * `<style>`-tag leak it replaced.\n *\n * Inline styles are NOT cleared wholesale any more. `el.style.cssText = \"\"` also destroyed an\n * author's own `attributes: { style: \"…\" }` and would now take the custom-element `display` default\n * with it; only the `--jx-r…` properties this engine wrote are removed.\n *\n * @param {HTMLElement} el\n * @param {JxStyle | undefined} styleDef\n * @param {Record<string, string>} [mediaQueries]\n * @param {JxScope} [state]\n */\nexport function reapplyStyle(\n el: HTMLElement,\n styleDef: JxStyle | undefined,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef ?? {}, mediaQueries, state, true);\n}\n\n/**\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} mediaQueries\n * @param {JxScope} state\n * @param {boolean} live - Write to the scratch sheet (the Studio edit path) rather than intern\n */\nfunction applyStyleInto(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string>,\n state: JxScope,\n live: boolean,\n) {\n releaseElementStyles(el);\n const doc = el.ownerDocument ?? document;\n const sheetState = sheetStateFor(doc);\n\n /* One gate for the whole call, so every recursion answers alike. Off in production and in\n preview, where the selector is written exactly as authored.\n\n The SAME predicate the attribute rename uses, and it has to be: an attribute renamed without\n its selectors transposed is a panel that can never be styled open. They disagreed while the\n rename learned to reach inside a defined element and this did not, so a kit popover rendered\n within another definition's template would have been de-linked and then left with a\n `:popover-open` rule that could no longer match. */\n const transposeSelector =\n (_canvasDelinkPopovers || _canvasDelinkCommands) && canvasStamped(el)\n ? (selector: string) =>\n transposeCanvasOverlaySelector(selector, {\n dialog: el.tagName === \"DIALOG\",\n })\n : (selector: string) => selector;\n\n /* Reactive declarations become `var()` reads of a custom property this element sets inline. The\n variable inherits, which is correct, and the declaration stays in the rule where `:hover` can\n override it. The serial keeps two elements' variables apart: a descendant rule reads `var()`\n from the nearest ancestor that set it, and without it a styled child would shadow its parent's\n `--jx-r0` with its own. It also makes the rule text — and so the scope handle hashed from it —\n unique per element, which is exactly the sharing a reactive rule set must not have. */\n let serial = -1;\n let indirect = 0;\n const sources: { name: string; value: string | JxRef }[] = [];\n const rules = buildStyleRules(styleDef, {\n mediaQueries,\n resolveValue: (property, value, target) => {\n /* A reactive value on a CUSTOM PROPERTY, in a rule targeting the element itself, is written\n inline under the AUTHOR'S OWN NAME and contributes no declaration. That keeps the rule\n text free of anything per-element, so every row of a repeater interns ONE rule instead of\n one each: the serial below is in the rule text, the interning handle is a hash of that\n text, and so no two reactive elements could ever share a rule set. Measured before this:\n three font rows produced three handles and three rules.\n The declaration that READS the variable — `font-family: var(--row-face, inherit)` — lives\n in the owning element's own style, is identical across rows, and interns once.\n Only a SELF-target rule qualifies. A descendant rule keeps the indirection, because its\n variable must not be set on the element that carries the rule: a `var()` resolves from the\n nearest ancestor that set it, and a shared descendant rule would read the wrong one. */\n if (target === \"self\" && property.startsWith(\"--\")) {\n sources.push({ name: property, value });\n return null;\n }\n if (serial < 0) {\n ({ serial } = sheetState);\n sheetState.serial += 1;\n }\n /* Counted separately from `sources`, so an inline custom property before it cannot shift the\n name of an indirected one. The name is IN the rule text, and the interning handle is a\n hash of that text — a number that moved with unrelated declarations would give two\n otherwise identical styles two rules. */\n const name = `--jx-r${serial}-${indirect}`;\n indirect += 1;\n sources.push({ name, value });\n return `var(${name})`;\n },\n scope: SCOPE_TOKEN,\n transposeSelector,\n transposeValue: canvasStyleValue,\n });\n /* `sources.length` too, not `rules.length` alone: a style whose ONLY reactive declaration is a\n custom property on the element itself emits no rule at all, and returning here would install\n no effect, so the variable would be written once and never track its source again. */\n if (rules.length === 0 && sources.length === 0) {\n return;\n }\n\n /* Declaration-body at-rules declare a document-global NAME — `@position-try --flip`,\n `@font-face` — so they are written once for the whole document and refcounted, rather than\n once per element that mentions them. */\n const scoped = rules.filter((rule) => rule.target !== \"unscoped\");\n const unscoped = rules.filter((rule) => rule.target === \"unscoped\");\n for (const rule of unscoped) {\n retainInterned(sheetState, sheetState.hoisted, rule.text, [rule.text]);\n }\n\n const uid = `jx-${hashCss(scoped.map((rule) => rule.key).join(\"|\"))}`;\n const texts = scoped.map((rule) => rule.text.replaceAll(SCOPE_TOKEN, `[data-jx=\"${uid}\"]`));\n if (texts.length > 0) {\n el.dataset.jx = uid;\n if (live) {\n sheetState.scratch ??= openSink(doc);\n sheetState.scratchOwners.set(el, texts);\n rewriteScratch(sheetState);\n } else {\n retainInterned(sheetState, sheetState.interned, uid, texts);\n }\n }\n\n const entry: ElementStyleEntry = {\n doc,\n hoisted: unscoped.map((rule) => rule.text),\n interned: texts.length > 0 && !live ? uid : null,\n state: sheetState,\n stop: null,\n uid,\n vars: sources.map((source) => source.name),\n };\n if (sources.length > 0) {\n const scope = effectScope();\n scope.run(() => {\n for (const { name, value } of sources) {\n effect(() => {\n const resolved = isRefObj(value)\n ? resolveRef(value.$ref, state)\n : evaluateTemplate(value, state);\n el.style.setProperty(name, canvasStyleValue(String(resolved ?? \"\")));\n });\n }\n });\n entry.stop = () => scope.stop();\n }\n elementStyles.set(el, entry);\n /* Ties the rules to the render that made them: a mapped array's discarded generation, or a\n Studio subtree being replaced, stops its scope and the rule set goes with it. Guarded on the\n entry so a later `reapplyStyle` is not undone by an older scope disposing after it. */\n onScopeDispose(() => releaseElementStyles(el, entry), true);\n}\n\n/*\n * HTML carries a boolean two incompatible ways, and writing one as the other inverts it in silence.\n *\n * A *boolean attribute* — `open`, `disabled`, `hidden`, `required` — is read by PRESENCE. Any value\n * at all counts as true, `\"false\"` included, so `<details open=\"false\">` is an OPEN `<details>`.\n * The value must never be written; absence is the only way to say false.\n *\n * An *enumerated* attribute carries the word in its own text and reads an empty value as unset, so\n * the presence form is the broken one here: bare `aria-hidden` is NOT hidden, and a dropped\n * `contenteditable` means \"inherit from the parent\" rather than `false`. Every `aria-*` is in this\n * family — ARIA has no presence attributes at all — along with the three HTML attributes below.\n *\n * **`popover` is enumerated and is deliberately NOT in this set**, which looks like an oversight\n * and is not. Its keywords are `auto`, `manual` and `hint`; its MISSING-value default is `auto`, so\n * a bare `popover` and `popover=\"\"` are both auto popovers — which is what the presence branch\n * below already produces for `true`, correctly. Its INVALID-value default is `manual`, so moving it\n * here would emit `popover=\"true\"`, which is not a keyword, and every popover written as a boolean\n * would silently stop light-dismissing and stop answering Escape. The right answer to a boolean\n * `popover` is not a different emission, it is not writing one: `@jxsuite/schema/overlays` reports\n * it as `invalid-mode`, and the house spelling is `\"auto\"`.\n *\n * That also corrects the paragraph above for this one attribute: a presence attribute counts any\n * value as true, but `popover=\"false\"` is a *manual* popover rather than a true-ish one, because it\n * is enumerated even though it is emitted through the presence branch.\n *\n * @docs framework/concepts/elements\n */\nconst ENUMERATED_ATTRS = new Set([\"contenteditable\", \"draggable\", \"spellcheck\"]);\n\n/**\n * The enumerated-attribute names, for a code generator that cannot import this module.\n *\n * The compiler's element and client targets emit standalone ES modules that a built site loads\n * without `@jxsuite/runtime`, so they inline the boolean decision instead of calling it. They\n * serialize THIS array into that inlined helper, and `compile-element.test.ts` asserts the emitted\n * literal still equals it — which is what keeps the four writers of the rule one decision rather\n * than four, in the one place a shared function could not reach.\n *\n * @returns {string[]} The names, sorted, so the emitted output is stable.\n */\nexport function enumeratedAttrNames(): string[] {\n return [...ENUMERATED_ATTRS].toSorted();\n}\n\n/**\n * The text an attribute's boolean value must be written with, or `null` when saying it means\n * removing the attribute instead.\n *\n * An empty string is the bare form: `setAttribute(name, \"\")` is how the DOM spells the `open` that\n * HTML source writes with no `=`.\n *\n * Shared rather than restated because two renderers must agree. The compiler writes attributes into\n * a string of HTML and this file writes them onto live elements; were they to disagree about which\n * family an attribute belongs to, a prerendered page would change meaning as it hydrated.\n *\n * @param {string} name - Attribute name, already resolved to what will be written\n * @param {boolean} value - The resolved boolean\n * @returns {string | null} Text to write, or null to omit the attribute\n */\nexport function booleanAttrValue(name: string, value: boolean): string | null {\n const lower = name.toLowerCase();\n if (lower.startsWith(\"aria-\") || ENUMERATED_ATTRS.has(lower)) {\n return String(value);\n }\n return value ? \"\" : null;\n}\n\n/**\n * @param {HTMLElement} el\n * @param {Record<string, import(\"@jxsuite/schema/types\").JxAttributeValue>} attrs\n * @param {JxScope} state\n */\nfunction applyAttributes(el: HTMLElement, attrs: Record<string, JxAttributeValue>, state: JxScope) {\n for (const [k, v] of Object.entries(attrs)) {\n const attr = canvasAttrName(el, k);\n /* Inside the effects, not before them. A `$ref` or `${…}` value is not a string until the\n effect runs — which is exactly why the document walk this replaced could never see it. */\n const write = (resolved: unknown) => {\n if (resolved === null || resolved === undefined) {\n /* Nothing is an attribute the element does not have. A binding that resolves to `null`\n has to take the attribute WITH it, for the same reason a `false` does below — and an\n `aria-checked=\"\"` or `title=\"\"` left behind is not absence, it is a wrong value. */\n el.removeAttribute(attr);\n return;\n }\n if (typeof resolved === \"boolean\") {\n const text = booleanAttrValue(attr, resolved);\n /* `removeAttribute`, not `setAttribute(attr, \"false\")`. A binding that flips back has to\n take the attribute WITH it: the element is being re-used, so anything left behind is the\n state the page just said it had left. Asset rewriting is skipped because a boolean names\n no asset — `canvasAssetValue` reads `src`/`href` values, which are never booleans. */\n if (text === null) {\n el.removeAttribute(attr);\n } else {\n el.setAttribute(attr, text);\n }\n return;\n }\n el.setAttribute(attr, canvasAssetValue(el.tagName, k, String(resolved)));\n };\n if (isRefObj(v)) {\n effect(() => write(resolveRef(v.$ref, state)));\n } else if (isTemplateString(v)) {\n effect(() => write(evaluateAttrTemplate(v, state)));\n } else {\n write(v);\n }\n }\n}\n\n// ─── Array mapping ────────────────────────────────────────────────────────────\n\n/**\n * Render a mapped array (repeater) wrapper-less: its item instances are inserted directly into\n * `parentEl`, in place, ahead of an anchor comment that marks the array's position among the\n * parent's other children.\n *\n * Rows are RECONCILED, not rebuilt. Each row is keyed — by the `key` pointer the array declares,\n * else by its index — and owns a detached effect scope and a reactive `$map` context. When `items`\n * (or the filter/sort sources, or a key) change, a row whose key survives keeps its node and its\n * effects: a reorder moves the node, an insertion creates only the new rows, a removal stops only\n * the removed ones, and a moved row's `$map.index` is updated in place. That is what lets focus,\n * scroll position and a half-typed value survive a change to the list.\n *\n * Reads made while a row is constructed are made with tracking PAUSED. `effectScope.run()` does not\n * reset the active subscriber, so without this every top-level read a row performs — a `$props`\n * write, a tag discriminant, a `$`-local — subscribed the LIST effect, and one row's data changing\n * rebuilt the whole list. The bindings inside a row are effects of their own and re-enable tracking\n * when they run, so a row still updates itself.\n *\n * `options._path` is the array node's own document path (`[…, \"children\", i]`, or `[…, \"children\"]`\n * for a legacy whole-children repeater); item instances render at `[…that…, \"map\", index]`, and a\n * row that moves reports its new path through `options.onNodeMoved`.\n *\n * @param {HTMLElement} parentEl\n * @param {import(\"@jxsuite/schema/types\").JxMappedArray} arrayDef\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n */\nfunction renderMappedArrayInto(\n parentEl: HTMLElement,\n arrayDef: JxMappedArray,\n state: JxScope,\n options?: JxRenderOptions,\n) {\n const path = options?._path ?? [];\n const anchor = document.createComment(\"jx-array\");\n parentEl.append(anchor);\n const { items: itemsSrc, map: mapDef, filter: filterRef, sort: sortRef, key: keyRef } = arrayDef;\n const keyPointer = isRefObj(keyRef) ? keyRef.$ref : null;\n /* The instantiation chain the list belongs to (spec.md §16.9), for the same reason\n {@link renderSwitch} keeps one: a row that arrives with new data is inserted from an effect\n re-run, and the instance it holds must connect under the chain of the definition that drew\n the list. */\n const instancePath = _instancePath;\n\n let warned = false;\n const warnOnce = (message: string): void => {\n if (!warned) {\n warned = true;\n console.warn(`Jx $map: ${message}`);\n }\n };\n\n /** The rows currently rendered, in DOM order. */\n let rows: MappedRow[] = [];\n\n const teardown = (row: MappedRow): void => {\n row.scope.stop();\n row.node.remove();\n };\n\n const createRow = (key: unknown, item: unknown, index: number): MappedRow => {\n const map = shallowReactive({ index, item });\n const child = Object.create(state) as JxScope;\n child.$map = map;\n // The flat aliases stay readable by legacy readers, and follow the reactive context.\n Object.defineProperty(child, \"$map/item\", { enumerable: true, get: () => map.item });\n Object.defineProperty(child, \"$map/index\", { enumerable: true, get: () => map.index });\n const scope = effectScope(true);\n const childOpts = options ? { ...options, _path: [...path, \"map\", index] } : undefined;\n const node = scope.run(() => renderNode(mapDef!, child, childOpts))!;\n return { key, map, node, scope };\n };\n\n const reconcile = (list: unknown[], keys: unknown[]): void => {\n const previous = new Map<unknown, MappedRow>();\n for (const row of rows) {\n previous.set(row.key, row);\n }\n const next: MappedRow[] = [];\n for (let index = 0; index < list.length; index++) {\n const key = keys[index];\n const item = list[index];\n const existing = previous.get(key);\n if (existing) {\n previous.delete(key);\n if (existing.map.item !== item) {\n existing.map.item = item;\n }\n if (existing.map.index !== index) {\n existing.map.index = index;\n options?.onNodeMoved?.(existing.node, [...path, \"map\", index]);\n }\n next.push(existing);\n } else {\n next.push(createRow(key, item, index));\n }\n }\n // Whatever was not claimed is gone.\n for (const row of previous.values()) {\n teardown(row);\n }\n /* Order in one forward pass. The cursor walks the kept nodes in their current order; a row\n already under the cursor is in place, anything else is inserted before it — a new node, or\n a kept node moved forward. Only rows that are out of place move, and a move is the one thing\n that can cost a focused element its focus. */\n let cursor: ChildNode = rows.find((row) => !previous.has(row.key))?.node ?? anchor;\n for (const row of next) {\n if (row.node === cursor) {\n cursor = cursor.nextSibling ?? anchor;\n continue;\n }\n cursor.before(row.node);\n }\n rows = next;\n };\n\n const update = (): void => {\n let items: unknown = isRefObj(itemsSrc) ? resolveRef(itemsSrc.$ref, state) : itemsSrc;\n if (Array.isArray(items) && isRefObj(filterRef)) {\n const fn = resolveRef(filterRef.$ref, state);\n if (typeof fn === \"function\") {\n items = items.filter(fn as (v: unknown) => boolean);\n }\n }\n if (Array.isArray(items) && isRefObj(sortRef)) {\n const fn = resolveRef(sortRef.$ref, state);\n if (typeof fn === \"function\") {\n items = [...(items as unknown[])].toSorted(fn as (a: unknown, b: unknown) => number);\n }\n }\n const list = Array.isArray(items) && mapDef ? (items as unknown[]) : [];\n\n // Keys are read HERE, tracked, so a key that changes reconciles the list.\n const keys = list.map((item, index) => mappedRowKey(keyPointer, item, index, warnOnce));\n const seen = new Set<unknown>();\n for (let i = 0; i < keys.length; i++) {\n if (seen.has(keys[i])) {\n warnOnce(\n `duplicate key ${String(keys[i])} — every occurrence after the first is rebuilt on each change`,\n );\n keys[i] = { duplicate: i };\n } else {\n seen.add(keys[i]);\n }\n }\n\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () => reconcile(list, keys));\n } finally {\n resetTracking();\n }\n };\n\n /* The first render is synchronous; every re-render is coalesced into ONE microtask. A reactive\n array mutated in place — `reverse()`, `sort()`, an index write — triggers once per element it\n touches, and an effect run between two of those writes sees an array that is half of each\n state: a row that is transiently absent would be torn down and then rebuilt, which is exactly\n the identity loss keys exist to prevent. Deferring to a microtask is what a framework scheduler\n does for the same reason; a row's own bindings stay synchronous. */\n let queued = false;\n let stopped = false;\n const runner = effect(update, {\n scheduler: () => {\n if (queued) {\n return;\n }\n queued = true;\n queueMicrotask(() => {\n queued = false;\n if (!stopped) {\n runner();\n }\n });\n },\n });\n\n onScopeDispose(() => {\n stopped = true;\n for (const row of rows) {\n teardown(row);\n }\n rows = [];\n }, true);\n}\n\n/** A rendered row of a mapped array. */\ninterface MappedRow {\n key: unknown;\n /** The row's `$map` context; `item` and `index` are written in place when the row is reused. */\n map: { index: number; item: unknown };\n node: HTMLElement | Text;\n scope: EffectScope;\n}\n\n/**\n * The identity a `key` pointer names for one item: the item itself for `$map/item`, a value read\n * off it for `$map/item/<path>`. Anything else is not a key — an index names a position, not a row\n * — and a key that evaluates to nothing cannot tell rows apart, so both fall back to the index.\n */\nfunction mappedRowKey(\n pointer: string | null,\n item: unknown,\n index: number,\n warnOnce: (message: string) => void,\n): unknown {\n if (pointer === null) {\n return index;\n }\n if (pointer === \"$map/item\") {\n return item;\n }\n if (pointer.startsWith(\"$map/item/\")) {\n const key = readPath(item, pointer.slice(\"$map/item/\".length));\n if (key === undefined || key === null) {\n warnOnce(`key \"${pointer}\" is empty for some items — those rows fall back to their index`);\n return index;\n }\n return key;\n }\n warnOnce(`key \"${pointer}\" is not a $map/item pointer — rows fall back to their index`);\n return index;\n}\n\n/**\n * An element's tag: a name, or the branch of a {@link JxTagExpression} the state selects.\n *\n * Every branch of the expression is itself a `TagName`, so this can only ever return something the\n * schema already held to the tag-name pattern — the property that lets the compiler enumerate the\n * candidates and lets `createElement` be called without a second thought here.\n *\n * @param {unknown} tagName The element's declared tag.\n * @param {JxScope} scope The state the discriminant reads.\n * @returns {string} A literal tag name; `\"div\"` when nothing is declared.\n */\nexport function resolveTagName(tagName: unknown, scope: JxScope): string {\n if (typeof tagName === \"string\") {\n return tagName;\n }\n if (!isTagExpression(tagName)) {\n return \"div\";\n }\n const expression = tagName.$expression;\n if (expression.operator === \"?:\") {\n // `evaluateOperand`, not `evaluateExpression`: the discriminant is an OPERAND — a pointer, a\n // Literal or a nested node — exactly as it is for a `$switch`, whose docstring names this.\n return evaluateOperand(expression.target, scope, null) ? expression.value : expression.initial;\n }\n const key = evaluateOperand(expression.target, scope, null);\n return expression.cases[String(key)] ?? expression.default;\n}\n\n// ─── $switch ──────────────────────────────────────────────────────────────────\n\n/**\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement}\n */\nfunction renderSwitch(def: JxElement, state: JxScope, options?: JxRenderOptions) {\n const path = options?._path ?? [];\n const container = document.createElement(resolveTagName(def.tagName, state));\n /* The instantiation chain this switch belongs to (spec.md §16.9), read now because the effect\n below re-runs with nothing on the stack. A case that flips after the first paint puts it back\n around the insertion, so an instance the new case creates connects under the chain of the\n definition that drew the switch rather than under none. See {@link _instancePath}. */\n const instancePath = _instancePath;\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(container, path, def, state);\n }\n\n applyProperties(container, def, state);\n applyStyle(container, def.style ?? {}, (state[\"$media\"] as Record<string, string>) ?? {}, state);\n applyAttributes(container, def.attributes ?? {}, state);\n /* Every case renders in a detached scope of its own, stopped before the next case renders and\n when the container's own scope stops. A generation counter names the case a pending external\n load belongs to; it moves on EVERY change — an inline case included — so a load that resolves\n after the discriminant moved on cannot paint over what replaced it. */\n let generation = 0;\n let live: EffectScope | null = null;\n /* The key the rendered case was chosen by. A discriminant that re-resolves to the SAME key keeps\n its case: the subtree, its effects and its state — an open submenu, a half-typed value —\n survive. Without this a mapped row whose item was replaced by an equal one (a host rebuilding\n its projection) rebuilt every switch inside it, and the popover the case rendered closed. */\n let renderedKey: string | null = null;\n const retire = (): void => {\n live?.stop();\n live = null;\n };\n\n effect(() => {\n if (!isRefObj(def.$switch)) {\n retire();\n container.replaceChildren();\n generation += 1;\n return;\n }\n const key = String(resolveRef(def.$switch.$ref, state));\n if (key === renderedKey) {\n return;\n }\n renderedKey = key;\n retire();\n /* `replaceChildren()` rather than `innerHTML = \"\"`: identical semantics, and it is not a\n Trusted Types injection sink — under `require-trusted-types-for 'script'` an innerHTML write\n needs a policy even when the string is empty. Four sinks that were never injecting anything\n is four fewer things a policy has to be permissive about. */\n container.replaceChildren();\n generation += 1;\n const caseDef = def.cases?.[key];\n if (!caseDef) {\n return;\n }\n const gen = generation;\n const scope = effectScope(true);\n live = scope;\n const childOpts = options ? { ...options, _path: [...path, \"cases\", key] } : undefined;\n\n if (isRefObj(caseDef)) {\n // External $ref — fetch and render asynchronously, against the mount's base so a bundled\n // Document need not live at the page URL.\n const { href } = new URL(caseDef.$ref, options?._ctx?.base ?? location.href);\n resolve(href, options?._ctx)\n .then(async (doc) => {\n if (gen !== generation) {\n return;\n }\n const childScope = await buildScope(doc, {}, href, options?._ctx);\n if (gen !== generation) {\n return;\n }\n container.replaceChildren();\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(doc, childScope, childOpts))),\n );\n })\n .catch((error: unknown) =>\n console.error(\"Jx $switch: failed to load external case\", caseDef.$ref, error),\n );\n return;\n }\n\n // Tracking is paused for the same reason it is for a mapped row: a top-level read the case\n // Makes while it renders must not subscribe THIS effect, or the case re-renders on every\n // Change to anything it read. The bindings inside it track for themselves.\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(caseDef, state, childOpts))),\n );\n } finally {\n resetTracking();\n }\n });\n onScopeDispose(retire, true);\n\n return container;\n}\n\n// ─── Prototype namespaces (Shape 5) ──────────────────────────────────────────\n\n/**\n * Resolve a $prototype definition into a value for the reactive scope.\n *\n * Returns a ref() for async/persistent entries (Request, Storage, Cookie, IndexedDB), or a plain\n * value for simple entries (Set, Map, FormData, Blob).\n *\n * @param {JxPrototypeDef} def - State entry with $prototype\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key (for diagnostics)\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<unknown>}\n */\nexport async function resolvePrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n ctx?: JxContext,\n) {\n // ── External class via $src ─────────────────────────────────────────────────\n if (def.$src) {\n return resolveExternalPrototype(def, state, key, base);\n }\n\n switch (def.$prototype) {\n case \"Request\": {\n const s: Ref<unknown> = ref(null);\n const debounceMs = def.debounce ?? 0;\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n if (!def.manual && !(ctx?.skipAutoRequests ?? _autoRequestConfig.skip)) {\n effect(() => {\n let url: string | undefined;\n if (isTemplateString(def.url)) {\n url = evaluateTemplate(def.url, state);\n } else {\n ({ url } = def);\n }\n if (!url || url === \"undefined\" || url.includes(\"undefined\")) {\n return;\n }\n\n const controller = new AbortController();\n onEffectCleanup(() => {\n controller.abort();\n if (debounceTimer !== null) {\n clearTimeout(debounceTimer);\n }\n });\n\n const doFetch = () =>\n fetch(url, {\n method: def.method ?? \"GET\",\n signal: controller.signal,\n ...(def.headers && { headers: def.headers }),\n ...(def.body && {\n body: typeof def.body === \"object\" ? JSON.stringify(def.body) : def.body,\n }),\n })\n .then((r) => (r.ok ? r.json() : Promise.reject(r.statusText)))\n .then((d) => {\n s.value = d;\n })\n .catch((error: unknown) => {\n if (!(error instanceof Error && error.name === \"AbortError\")) {\n s.value = { error: String(error) };\n }\n });\n\n if (debounceMs > 0) {\n debounceTimer = setTimeout(doFetch, debounceMs);\n } else {\n void doFetch();\n }\n });\n }\n\n return s;\n }\n\n case \"URLSearchParams\": {\n return computed(() => {\n const p: Record<string, string> = {};\n for (const [k, v] of Object.entries(def)) {\n if (k !== \"$prototype\") {\n p[k] = (\n isRefObj(v)\n ? resolveRef(v.$ref, state)\n : isTemplateString(v)\n ? evaluateTemplate(v, state)\n : v\n ) as string;\n }\n }\n return new URLSearchParams(p).toString();\n });\n }\n\n case \"LocalStorage\":\n case \"SessionStorage\": {\n const store = def.$prototype === \"LocalStorage\" ? localStorage : sessionStorage;\n const k = def.key ?? key;\n let init: unknown;\n try {\n const s = store.getItem(k);\n init = s !== null ? (JSON.parse(s) as unknown) : (def.default ?? null);\n } catch {\n init = def.default ?? null;\n }\n const storageState: Ref<unknown> = ref(init);\n // Persist on change\n effect(() => {\n const v = storageState.value;\n if (v === null) {\n try {\n store.removeItem(k);\n } catch {}\n } else {\n try {\n store.setItem(k, JSON.stringify(v));\n } catch {}\n }\n });\n return storageState;\n }\n\n case \"Cookie\": {\n const name = def.name ?? key;\n const read = () => {\n const raw = readCookie(document.cookie, name);\n if (raw === null) {\n return null;\n }\n try {\n return JSON.parse(decodeURIComponent(raw));\n } catch {\n return raw;\n }\n };\n const cookieState: Ref<unknown> = ref(read() ?? def.default ?? null);\n // Persist on change\n effect(() => {\n // oxlint-disable-next-line unicorn/no-document-cookie -- the Cookie $prototype IS the cookie store binding\n document.cookie = serializeCookie(name, cookieState.value, def);\n });\n return cookieState;\n }\n\n case \"IndexedDB\": {\n const idbState: Ref<unknown> = ref(null);\n const {\n database,\n store,\n version = 1,\n keyPath = \"id\",\n autoIncrement = true,\n indexes = [],\n } = def;\n if (!database || !store) {\n throw new Error(`Jx: IndexedDB entry '${key}' requires database and store`);\n }\n const req = indexedDB.open(database, version);\n req.addEventListener(\"upgradeneeded\", (e) => {\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n if (!db.objectStoreNames.contains(store)) {\n const os = db.createObjectStore(store, { autoIncrement, keyPath });\n for (const i of indexes) {\n os.createIndex(i.name, i.keyPath, { unique: i.unique ?? false });\n }\n }\n });\n req.addEventListener(\"success\", (e) => {\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n idbState.value = {\n database,\n getStore: (mode: IDBTransactionMode = \"readwrite\") =>\n Promise.resolve(db.transaction(store, mode).objectStore(store)),\n isReady: true,\n store,\n version,\n };\n });\n req.addEventListener(\"error\", () => {\n idbState.value = { error: req.error?.message };\n });\n return idbState;\n }\n\n case \"Set\": {\n return new Set(Array.isArray(def.default) ? def.default : []);\n }\n\n case \"Map\": {\n return new Map(Object.entries(isJsonObject(def.default) ? def.default : {}));\n }\n\n case \"FormData\": {\n const fd = new FormData();\n for (const [k, v] of Object.entries(def.fields ?? {})) {\n fd.append(k, v as string);\n }\n return fd;\n }\n\n case \"Blob\": {\n return new Blob((def.parts as BlobPart[]) ?? [], {\n type: typeof def.type === \"string\" ? def.type : \"text/plain\",\n });\n }\n\n case \"ReadableStream\": {\n return null;\n }\n\n default: {\n console.warn(\n `Jx: unknown $prototype \"${def.$prototype}\" for \"${key}\". Did you mean to add '$src'?`,\n );\n return ref(null);\n }\n }\n}\n\n// ─── External class resolution ────────────────────────────────────────────────\n\n/** Reserved keys stripped from the config object passed to external class constructors. */\nconst EXTERNAL_RESERVED = new Set([\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n]);\n\n/**\n * Resolve an external class prototype via $src.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveExternalPrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n\n // Non-Function $prototype must use .class.json as entrypoint\n if (!src || !src.endsWith(\".class.json\")) {\n throw new Error(\n `Jx: $prototype \"${def.$prototype}\" requires a .class.json $src, got \"${src}\". ` +\n `Wrap the class in a .class.json schema with $implementation.`,\n );\n }\n\n return resolveClassJson(def, state, key, base);\n}\n\n/**\n * Import a JS module and instantiate a class from it. Internal helper used by resolveClassJson for\n * $implementation.\n *\n * @param {JxScope} def - Original state entry (for config extraction)\n * @param {string} src - JS module URL to import\n * @param {string} exportName - Export name to look up\n * @param {string} [base] - Base URL for resolution\n * @returns {Promise<unknown>}\n */\nasync function importAndInstantiate(def: JxScope, src: string, exportName: string, base?: string) {\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n try {\n mod = (await import(src)) as ImportedModule;\n } catch {\n if (base) {\n const resolvedSrc = new URL(src, base).href;\n mod = (await import(resolvedSrc)) as ImportedModule;\n } else {\n throw new Error(`Failed to import \"${src}\"`);\n }\n }\n _moduleCache.set(src, mod);\n }\n\n const ExportedClass = mod[exportName] ?? mod.default?.[exportName];\n if (!ExportedClass) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\"`);\n }\n if (typeof ExportedClass !== \"function\") {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a class`);\n }\n\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n\n const Ctor = ExportedClass as new (config: JxScope) => ExternalClassInstance;\n const instance = new Ctor(config);\n\n let value: unknown;\n if (typeof instance.resolve === \"function\") {\n value = await instance.resolve();\n } else if (\"value\" in instance) {\n ({ value } = instance);\n } else {\n value = instance;\n }\n\n // Always wrap in ref for reactivity with external classes\n const s: Ref<unknown> = ref(value);\n if (typeof instance.subscribe === \"function\") {\n instance.subscribe((newVal: unknown) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Resolve a .class.json schema-defined class. Fetches the schema, follows $implementation if\n * hybrid, or constructs dynamically if self-contained.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveClassJson(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const src = def.$src;\n if (!src) {\n throw new Error(`Jx: class entry '${key}' has no $src`);\n }\n let classDef: JxClassDef;\n\n // Bare specifiers (package references like @scope/pkg/file) can't be fetched directly —\n // Go straight to dev proxy which can resolve them via node_modules.\n const isBareSpecifier =\n !src.startsWith(\".\") &&\n !src.startsWith(\"/\") &&\n !src.startsWith(\"http\") &&\n !src.startsWith(\"file:\");\n if (isBareSpecifier) {\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Try fetching the .class.json file directly\n try {\n const url = base ? new URL(src, base).href : src;\n const res = await fetch(url);\n if (!res.ok) {\n throw new Error(`HTTP ${res.status}`);\n }\n // Trust boundary: fetched .class.json sources are class definitions by contract.\n classDef = (await res.json()) as JxClassDef;\n } catch {\n // Fall back to dev proxy (server will handle .class.json resolution)\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Hybrid mode: $implementation points to the real JS module\n if (classDef.$implementation) {\n // If the schema references $context (e.g. content types), the browser cannot provide\n // The required server-side context — go directly to dev proxy.\n const schemaStr = JSON.stringify(classDef);\n if (schemaStr.includes('\"#/$context/')) {\n return resolveViaDevProxy(def, state, key, base);\n }\n const schemaUrl = base ? new URL(src, base).href : new URL(src, location.href).href;\n const implSrc = new URL(classDef.$implementation, schemaUrl).href;\n const exportName = def.$export ?? classDef.title ?? def.$prototype;\n try {\n return await importAndInstantiate(def, implSrc, exportName, base);\n } catch {\n return resolveViaDevProxy(def, state, key, base);\n }\n }\n\n // Self-contained: construct class dynamically from schema\n const DynClass = classFromSchema(classDef);\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n const instance = new DynClass(config) as ExternalClassInstance;\n\n let value: unknown;\n if (typeof instance.resolve === \"function\") {\n value = await instance.resolve();\n } else if (\"value\" in instance) {\n ({ value } = instance);\n } else {\n value = instance;\n }\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(value);\n if (typeof instance.subscribe === \"function\") {\n instance.subscribe((newVal: unknown) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Dynamically construct a class from a .class.json schema definition. Browser-side: maps private\n * fields to _-prefixed public fields.\n *\n * @param {import(\"@jxsuite/schema/types\").JxClassDef} classDef\n * @returns {DynamicClass}\n */\nfunction classFromSchema(classDef: JxClassDef) {\n const fields = classDef.$defs?.fields ?? {};\n // JSON objects inherit Object.prototype.constructor — only an own object value counts.\n const rawCtor = classDef.$defs?.constructor;\n const ctor = typeof rawCtor === \"object\" ? rawCtor : undefined;\n const methods = classDef.$defs?.methods ?? {};\n\n // oxlint-disable-next-line typescript/no-extraneous-class -- methods are attached to the prototype dynamically below\n class DynClass {\n constructor(config: Record<string, unknown> = {}) {\n for (const [key, typedField] of Object.entries(fields)) {\n const id = typedField.identifier ?? key;\n const propName = typedField.access === \"private\" ? `_${id}` : id;\n if (config[id] !== undefined) {\n (this as Record<string, unknown>)[propName] = config[id];\n } else if (typedField.initializer !== undefined) {\n (this as Record<string, unknown>)[propName] = typedField.initializer;\n } else if (typedField.default !== undefined) {\n (this as Record<string, unknown>)[propName] = structuredClone(typedField.default);\n } else {\n (this as Record<string, unknown>)[propName] = null;\n }\n }\n if (ctor?.body) {\n const bodyStr = Array.isArray(ctor.body) ? ctor.body.join(\"\\n\") : ctor.body;\n (\n new Function(\"config\", bodyStr) as (\n this: unknown,\n config: Record<string, unknown>,\n ) => void\n ).call(this, config);\n }\n }\n }\n\n for (const [key, typedMethod] of Object.entries(methods)) {\n const name = typedMethod.identifier ?? key;\n const params = (typedMethod.parameters ?? []).map((p) => {\n if (p.$ref) {\n return p.$ref.split(\"/\").pop() as string;\n }\n const n = p.identifier ?? p.name;\n return typeof n === \"string\" ? n : \"arg\";\n });\n const bodyStr = Array.isArray(typedMethod.body)\n ? typedMethod.body.join(\"\\n\")\n : (typedMethod.body ?? \"\");\n\n if (typedMethod.role === \"accessor\") {\n const descriptor: PropertyDescriptor = {};\n if (typedMethod.getter) {\n descriptor.get = new Function(typedMethod.getter.body ?? \"\") as () => unknown;\n }\n if (typedMethod.setter) {\n const sp = (typedMethod.setter.parameters ?? []).map(\n (p) => p.$ref?.split(\"/\").pop() ?? \"v\",\n );\n descriptor.set = new Function(...sp, typedMethod.setter.body ?? \"\") as (v: unknown) => void;\n }\n Object.defineProperty(DynClass.prototype, name, {\n ...descriptor,\n configurable: true,\n });\n } else if (typedMethod.scope === \"static\") {\n (DynClass as unknown as DynamicClass)[name] = new Function(...params, bodyStr);\n } else {\n (DynClass as unknown as DynamicClass).prototype[name] = new Function(...params, bodyStr);\n }\n }\n\n Object.defineProperty(DynClass, \"name\", {\n configurable: true,\n value: classDef.title,\n });\n const dynCtor = DynClass as unknown as DynamicClass;\n return dynCtor;\n}\n\n/**\n * Dev-mode fallback: when an $src module cannot run in the browser, proxy the resolve() call\n * through the Jx dev server (POST /**jx_resolve**). Supports reactive template strings in config\n * values via Vue effect().\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveViaDevProxy(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n\n const hasTemplates = Object.values(config).some((v: unknown) => isTemplateString(v));\n\n /** @param {JxScope} resolvedConfig */\n const doResolve = (resolvedConfig: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_resolve__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $prototype: def.$prototype,\n $src: def.$src,\n ...resolvedConfig,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r) => {\n if (!r.ok) {\n throw new Error(`Jx dev proxy ${r.status} for \"${key}\"`);\n }\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(null);\n if (hasTemplates) {\n effect(() => {\n const resolvedConfig: JxScope = {};\n for (const [k, v] of Object.entries(config)) {\n resolvedConfig[k] = isTemplateString(v) ? evaluateTemplate(v, state) : v;\n }\n doResolve(resolvedConfig)\n .then((value: unknown) => {\n s.value = value;\n })\n .catch((error: unknown) => console.error(\"Jx dev proxy:\", error));\n });\n } else {\n doResolve(config)\n .then((value: unknown) => {\n s.value = value;\n })\n .catch((error: unknown) => console.error(\"Jx dev proxy:\", error));\n }\n return s;\n}\n\n// ─── Server function resolution (dev mode) ────────────────────────────────────\n\n/**\n * Resolve a timing: \"server\" entry in dev mode by executing the function client-side. In\n * production, the compiler replaces this with a fetch to the generated server handler.\n *\n * @param {JxScope} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveServerFunction(\n def: JxServerFnDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n const exportName = def.$export;\n\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n try {\n mod = (await import(src)) as ImportedModule;\n } catch {\n if (base) {\n try {\n const resolvedSrc = new URL(src, base).href;\n mod = (await import(resolvedSrc)) as ImportedModule;\n } catch {\n // Module cannot run in the browser — fall back to dev server proxy\n return resolveServerFunctionViaProxy(def, state, key, base);\n }\n } else {\n return resolveServerFunctionViaProxy(def, state, key, base);\n }\n }\n _moduleCache.set(src, mod);\n }\n\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (!candidate) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\" for \"${key}\"`);\n }\n if (typeof candidate !== \"function\") {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a function`);\n }\n const fn = candidate as (args: JxScope) => Promise<unknown>;\n\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v: unknown) => isRefObj(v));\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefObj(v) ? resolveRef(v.$ref, state) : v;\n }\n return args;\n };\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(null);\n if (hasReactiveArg) {\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n fn(args)\n .then((result: unknown) => {\n s.value = result;\n })\n .catch(() => {});\n });\n } else {\n s.value = await fn(resolveArgs());\n }\n return s;\n}\n\n/**\n * Dev-mode fallback: when a timing: \"server\" module cannot run in the browser, proxy the function\n * call through the Jx dev server (POST /**jx_server**). Supports reactive $ref arguments via Vue\n * effect().\n *\n * @param {JxScope} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveServerFunctionViaProxy(\n def: JxScope,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v: unknown) => isRefObj(v));\n\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefObj(v) ? resolveRef((v as { $ref: string }).$ref, state) : v;\n }\n return args;\n };\n\n /** @param {JxScope} args */\n const doResolve = (args: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_server__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $src: def.$src,\n arguments: args,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r) => {\n if (!r.ok) {\n throw new Error(`Jx server proxy ${r.status} for \"${key}\"`);\n }\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(null);\n if (hasReactiveArg) {\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n doResolve(args)\n .then((result: unknown) => {\n s.value = result;\n })\n .catch((error: unknown) => console.error(\"Jx server proxy:\", error));\n });\n } else {\n doResolve(resolveArgs())\n .then((result: unknown) => {\n s.value = result;\n })\n .catch((error: unknown) => console.error(\"Jx server proxy:\", error));\n }\n return s;\n}\n\n/**\n * Resolve a $ref string to a value in scope.\n *\n * With Vue reactivity, this reads directly from the reactive proxy. When called inside a effect or\n * computed, the read is tracked.\n *\n * @param {string} ref\n * @param {JxScope} state - Reactive scope proxy (or child scope)\n * @returns {unknown}\n */\nexport function resolveRef(refPath: string, state: JxScope) {\n if (typeof refPath !== \"string\") {\n return refPath;\n }\n if (refPath.startsWith(\"$map/\") || refPath.startsWith(\"#/$map/\")) {\n /* Both spellings. `#/` is the documented JSON Pointer prefix everywhere else in the schema,\n so a `#/$map/item/x` fell through to `readPath`, returned null, and a `$map` over it\n rendered ZERO rows with no warning. */\n const parts = (refPath.startsWith(\"#/\") ? refPath.slice(2) : refPath).split(\"/\");\n const [, key] = parts; // \"item\" or \"index\"\n const map = state.$map as Record<string, unknown> | undefined;\n const base = map?.[key!] ?? state[`$map/${key}`];\n return parts.length > 2 ? getPath(base, parts.slice(2).join(\"/\")) : base;\n }\n if (refPath.startsWith(\"#/state/\")) {\n // One call, not a hand-split leading token: slicing at the first `/` skipped unescaping it, so\n // `#/state/a~1b/c` looked for a member called `a~1b` rather than `a/b`.\n return readPath(state, refPath.slice(\"#/state/\".length));\n }\n if (refPath.startsWith(\"parent#/\")) {\n /*\n * A prop name may be a path into the prop. This read the whole path as one key and returned\n * undefined for `parent#/user/name`, while the compiler lowered it to a walk.\n */\n return readPath(state, refPath.slice(\"parent#/\".length));\n }\n if (refPath.startsWith(\"window#/\")) {\n return getPath(globalThis.window, refPath.slice(\"window#/\".length));\n }\n if (refPath.startsWith(\"document#/\")) {\n return getPath(globalThis.document, refPath.slice(\"document#/\".length));\n }\n return readPath(state, refPath) ?? null;\n}\n\n// ─── Utilities ────────────────────────────────────────────────────────────────\n\n/**\n * Check if v is a Vue ref (including computed).\n *\n * @param {unknown} v\n * @returns {boolean}\n */\nexport function isSignal(v: unknown) {\n return isRef(v);\n}\n\n/**\n * @param {unknown} v\n * @returns {v is import(\"@jxsuite/schema/types\").JxRef}\n */\nfunction isRefObj(v: unknown): v is JxRef {\n return isRefValue(v);\n}\n\n/**\n * Walk a path off a value. Delegates to the one tokenizer (`pointer.ts`) — this used to split on\n * `/[./]/`, which no other path in the codebase agreed with.\n *\n * @param {unknown} obj\n * @param {string} path\n * @returns {unknown}\n */\nfunction getPath(obj: unknown, path: string) {\n return readPath(obj, path);\n}\n\n/**\n * Write an observed attribute into element state, coerced by the type the state entry already holds\n * (spec §16.5): a number parses, a boolean is presence (`\"false\"` counts as absent), and anything\n * else is the string. Shared by connection and `attributeChangedCallback` so the two cannot\n * disagree.\n *\n * REMOVING an attribute restores the entry's DECLARED DEFAULT rather than writing the absence\n * through. `attributeChangedCallback` reports a removal as `null`, and writing that through gave a\n * `type: \"string\"` entry the value `null` and a `type: \"number\"` entry `Number(null)`, which is 0 —\n * so a numeric prop could never express \"unset\" and a string prop stopped matching its own declared\n * type. The default is the value the entry had before anyone set the attribute, which is what the\n * removal is asking to go back to.\n *\n * @param defaults The declared defaults by state key; a key absent from it has none.\n */\nfunction absorbAttribute(\n state: JxScope,\n name: string,\n value: string | null,\n defaults?: ReadonlyMap<string, unknown>,\n): void {\n const camelKey = name.replaceAll(/-([a-z])/g, (_: string, c: string) => c.toUpperCase());\n const current = state[camelKey];\n if (typeof current === \"boolean\") {\n // Presence IS the value for a boolean, so a removal is already spelled by the same rule.\n state[camelKey] = value !== null && value !== \"false\";\n return;\n }\n if (value === null) {\n const declared = defaults?.get(camelKey);\n state[camelKey] = declared === undefined ? (typeof current === \"number\" ? 0 : \"\") : declared;\n return;\n }\n state[camelKey] = typeof current === \"number\" ? Number(value) : value;\n}\n\n/**\n * The declared default of every state entry that has one, by state key.\n *\n * @param def The element definition\n * @returns {Map<string, unknown>} Key → default\n */\nfunction declaredDefaults(def: JxElement): Map<string, unknown> {\n const out = new Map<string, unknown>();\n for (const [key, entry] of Object.entries(def.state ?? {})) {\n if (entry !== null && typeof entry === \"object\") {\n const obj = entry as Record<string, unknown>;\n if (\"default\" in obj) {\n out.set(key, obj[\"default\"]);\n continue;\n }\n // A computed entry has no default: its value is produced, and a removal leaves it alone.\n if (COMPUTED_STATE_KEYS.some((marker) => marker in obj)) {\n continue;\n }\n }\n // The shorthand `{ \"label\": \"none\" }` IS the default, the same way `buildScope` reads it.\n out.set(key, entry);\n }\n return out;\n}\n\n/** The markers that make a state entry produced rather than authored. */\nconst COMPUTED_STATE_KEYS = [\"$expression\", \"$prototype\", \"$ref\", \"$src\"] as const;\n\n/** Keys already reported, so a component rendered in a loop warns once rather than per instance. */\nconst _privatePropWarned = new Set<string>();\n\n/**\n * Refuse a `$props` write against a private (`#`) state key — `spec.md` §5.6.\n *\n * Ignored rather than thrown. A `$props` block naming a private entry is an authoring mistake, not\n * a broken document: the rest of the instance is well-formed and refusing to render it would turn a\n * typo into a blank page. But silence was the previous behavior and it is the wrong kind — the\n * author sees a prop that looks accepted and does nothing — so the write is dropped and named.\n *\n * @param {string} key\n * @param {string} [where] - The site refusing it, for a message that points somewhere\n * @returns {boolean} True when the key is private and the caller must skip it\n */\n/**\n * Whether the instance genuinely CARRIES `key`, rather than the prototype merely having an accessor\n * for it.\n *\n * `key in el` cannot tell those apart, and for a REFLECTED DOM property — `title`, `role`, `id`,\n * `lang`, `dir`, `slot`, `hidden` — the accessor answers `\"\"` when nothing is set. `\"\" !==\n * undefined`, so a component declaring `state.title` never rendered its own default: the empty\n * string won. `quote` next to it kept its default, which is what made the bug look like bad\n * content.\n *\n * The test is NOT `Object.hasOwn` alone, and that distinction is the whole subtlety. Assigning a\n * reflected name goes through the prototype accessor and creates no own property, so a legitimate\n * `$props.title` would be discarded by an own-property test — silently, for every component that\n * declares one. What the accessor DOES do is write the attribute, so the attribute is the evidence\n * that somebody set it, whether that was `$props` before connection or the author in the document.\n *\n * @param {HTMLElement} el - The instance being connected.\n * @param {string} key - A state key declared by the component definition.\n * @returns {boolean}\n */\nfunction instanceSupplies(el: HTMLElement, key: string): boolean {\n if (Object.hasOwn(el, key)) {\n return true;\n }\n if (el.hasAttribute(key)) {\n return true;\n }\n // ARIA-style reflections carry a kebab attribute for a camelCase property (`ariaLabel` →\n // `aria-label`), so the direct name lookup above would miss a value that really was set.\n const kebab = key.replaceAll(/[A-Z]/gu, (c) => `-${c.toLowerCase()}`);\n return kebab !== key && el.hasAttribute(kebab);\n}\n\nfunction refusePrivateProp(key: string, where?: string): boolean {\n if (!isPrivateStateKey(key)) {\n return false;\n }\n const seen = where === undefined ? key : `${where}:${key}`;\n if (!_privatePropWarned.has(seen)) {\n _privatePropWarned.add(seen);\n console.warn(\n `Jx: \"${key}\" is private state (spec.md §5.6) and cannot be set through $props` +\n `${where === undefined ? \"\" : ` (${where})`}. The write was ignored; rename the entry ` +\n \"without the leading # to make it part of the component's interface.\",\n );\n }\n return true;\n}\n\n/** Tests only — the warn-once set outlives a single render by design. */\nexport function _resetPrivatePropWarnings(): void {\n _privatePropWarned.clear();\n}\n\n/**\n * @param {JxElement} def\n * @param {JxScope} parentState\n * @returns {JxScope}\n */\nfunction mergeProps(def: JxElement, parentState: JxScope): JxScope {\n const child = Object.create(parentState) as JxScope;\n for (const [k, v] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(k, \"$props\")) {\n continue;\n }\n child[k] = isRefObj(v) ? resolveRef(v.$ref, parentState) : v;\n }\n return child;\n}\n\n/*\n * The CSS-authoring rules live in `./css.ts`, whose only import is a pair of type guards. They are\n * re-exported\n * here because they always were part of this module's surface and moving them must not break a\n * consumer; a host that cannot afford the DOM runtime imports `@jxsuite/runtime/css` instead.\n */\nexport {\n buildStyleRules,\n camelToKebab,\n COLOR_SCHEME_ATTR,\n COLOR_SCHEME_STORAGE_KEY,\n cssPropertyName,\n cssRuleText,\n hashCss,\n isDeclarationAtRule,\n isKeyframesAtRule,\n isNestedSelectorKey,\n pureSchemeOf,\n resolveAtQuery,\n resolveNestedSelector,\n schemeSelectors,\n splitSelectorList,\n transposeCanvasOverlaySelector,\n transposeCanvasPopoverSelector,\n} from \"./css.ts\";\nexport type { CssBuildOptions, CssKeyframeBlock, CssRule, CssRuleTarget } from \"./css.ts\";\n\n/**\n * Convert a style rules object to a CSS text string (skipping nested selectors).\n *\n * Kept for consumers; nothing in this repository composes a rule this way any more, because\n * `buildStyleRules` answers the same question for a whole style object rather than one flat level\n * of it. It shares that function's property spelling — `cssPropertyName`, not `camelToKebab` — so a\n * custom property survives it: `--fooBar` and `--foo-bar` are two different properties, and\n * kebab-casing one renames it out from under the `var()` that reads it.\n *\n * @param {Record<string, unknown> | object} rules\n * @returns {string}\n */\nexport function toCSSText(rules: Record<string, unknown> | object) {\n return Object.entries(rules)\n .filter(([k, v]) => !isNestedSelectorKey(k) && (v === null || typeof v !== \"object\"))\n .map(([p, v]) => `${cssPropertyName(p)}: ${canvasStyleValue(String(v))}`)\n .join(\"; \");\n}\n\n// ─── Custom Element Registration ──────────────────────────────────────────────\n\nlet _rootMedia: Record<string, string> = {};\n/**\n * Every defined element's CURRENT definition, read at connection — which is what lets a definition\n * be replaced.\n */\nconst _elementDefs = new Map<string, { base: string; doc: JxDocument }>();\n\n/**\n * The definition an element tag renders from, as most recently defined or redefined.\n *\n * @param {string} tagName\n * @returns {{ base: string; doc: JxDocument } | undefined}\n */\nexport function elementDefinition(tagName: string): { base: string; doc: JxDocument } | undefined {\n return _elementDefs.get(tagName);\n}\n\n/**\n * Replace an element's definition (embedding.md §7). `customElements.define` is one-shot, so the\n * generated class reads its definition through the registry at connection time: an instance\n * connected after this call renders the new document; one already on the page keeps the definition\n * it rendered until it is re-mounted. `observedAttributes` is the one thing the platform freezes at\n * first definition, so a changed list is reported and takes effect only in a fresh realm. A tag not\n * yet defined is simply defined.\n *\n * @param {JxDocument} doc\n * @param {string} [baseUrl]\n * @returns {Promise<void>}\n */\nexport async function redefineElement(doc: JxDocument, baseUrl?: string): Promise<void> {\n const base = baseUrl ?? location.href;\n const { tagName } = doc;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx redefineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (!customElements.get(tagName)) {\n await defineElement(doc, base);\n return;\n }\n if (doc.$elements) {\n await registerElements(doc.$elements, base);\n }\n const before = _elementDefs.get(tagName)?.doc.observedAttributes ?? [];\n const after = doc.observedAttributes ?? [];\n if (JSON.stringify(before) !== JSON.stringify(after)) {\n console.warn(\n `Jx redefineElement: <${tagName}> keeps observedAttributes [${before.join(\", \")}] as first defined; [${after.join(\", \")}] takes effect only in a fresh realm`,\n );\n }\n _elementDefs.set(tagName, { base, doc });\n}\n\n/**\n * Seed the module-level root `$media` map used as the fallback for components that declare their\n * own `@--name` style blocks but carry no own `$media` (buildScope ~279-280). `Jx()` sets this from\n * the document during a full top-level render, but the Studio iframe canvas calls `buildScope`/\n * `renderNode` directly (never `Jx()`), so without seeding it a component's `@--md` would resolve\n * to the invalid `@media md`. Callers on the direct path MUST set it (with the merged `$media`)\n * before `buildScope`, and re-set it every render so a stale map from a previous document cannot\n * leak.\n *\n * @param {Record<string, string>} map\n */\nexport function setRootMedia(map: Record<string, string>): void {\n _rootMedia = map ?? {};\n}\n\n/**\n * Resolve and register $elements entries (depth-first).\n *\n * @param {JxDocument[\"$elements\"]} elements\n * @param {string} base\n * @returns {Promise<void>}\n */\nasync function registerElements(\n elements: NonNullable<JxDocument[\"$elements\"]>,\n base: string,\n ctx?: JxContext,\n) {\n for (const entry of elements) {\n // Bare string: npm package side-effect import (registers custom elements)\n if (typeof entry === \"string\") {\n try {\n // Bare specifiers need a URL path for the browser; the dev server resolves\n // /node_modules/<pkg> to the package entry point via exports/module/main.\n const specifier =\n entry.startsWith(\"/\") || entry.startsWith(\".\") ? entry : `/node_modules/${entry}`;\n await import(specifier);\n } catch (error) {\n console.warn(`Jx: failed to import package \"${entry}\"`, error);\n }\n continue;\n }\n if (!isRefObj(entry)) {\n continue;\n }\n const { href } = new URL(entry.$ref, base);\n const doc = await resolve(href, ctx);\n if (!doc.tagName || !doc.tagName.includes(\"-\")) {\n continue;\n }\n if (customElements.get(doc.tagName)) {\n continue;\n }\n\n // Depth-first: register sub-dependencies first\n if (doc.$elements) {\n await registerElements(doc.$elements, href, ctx);\n }\n\n await defineElement(doc, href);\n }\n}\n\n/**\n * Inject head elements from $head declarations. Each entry is { tagName, attributes } — bare npm\n * specifiers in href/src are rewritten to /node_modules/ paths for the dev server.\n *\n * @param {import(\"@jxsuite/schema/types\").JxHeadEntry[]} entries\n * @param {string} _base - Document base URL for resolving relative paths\n */\nfunction injectHead(entries: JxHeadEntry[], _base: string) {\n for (const entry of entries) {\n if (!entry || !entry.tagName) {\n continue;\n }\n const tag = entry.tagName.toLowerCase();\n const attrs = { ...entry.attributes };\n // Resolve href/src: bare npm specifiers -> /node_modules/ path\n for (const key of [\"href\", \"src\"] as const) {\n const v = attrs[key];\n if (typeof v !== \"string\" || v === \"\") {\n continue;\n }\n if (!v.startsWith(\"/\") && !v.startsWith(\".\") && !v.startsWith(\"http\")) {\n /* The bare-specifier lane owns `/node_modules/<pkg>`, which is the HOST's URL space and\n not the project's. A canvas resolver must never claim it: the file is not in the\n repository, so there is nothing for it to resolve to. */\n attrs[key] = `/node_modules/${v}`;\n continue;\n }\n attrs[key] = canvasAssetValue(tag.toUpperCase(), key, v);\n }\n\n // Deduplicate: skip if an identical element already exists\n const selector = `${tag}${attrs.href ? `[href=\"${attrs.href}\"]` : \"\"}${attrs.src ? `[src=\"${attrs.src}\"]` : \"\"}`;\n if (selector !== tag && document.head.querySelector(selector)) {\n continue;\n }\n\n const el = document.createElement(tag);\n for (const [k, v] of Object.entries(attrs)) {\n el.setAttribute(k, String(v));\n }\n if (entry.textContent) {\n // An object is a structured data block (JSON-LD, site-architecture.md §8.5). The compiler\n // Serializes it the same way, so the interpreted page and the built page agree.\n el.textContent =\n typeof entry.textContent === \"object\"\n ? JSON.stringify(entry.textContent, null, 2)\n : entry.textContent;\n }\n document.head.append(el);\n }\n}\n\n// ─── Instantiation chain (spec.md §16.9) ─────────────────────────────────────\n\n/**\n * How deep component nesting may go before an instance refuses to render.\n *\n * The same number the compiler holds in `MAX_COMPONENT_NESTING` (`@jxsuite/compiler`, `shared.ts`),\n * and for the same reason: the cycle check in {@link extendInstancePath} catches a definition that\n * renders ITSELF — same tag, same props — which is the only shape that can never terminate, while a\n * self-reference whose props change at every level is data-driven recursion that a `$switch` may or\n * may not bottom out. The seen-set cannot tell those apart, so this cap is what turns a forgotten\n * stop into a diagnostic instead of a page that never settles. It is written twice because the\n * compiler depends on the runtime and not the other way round, and the runtime's browser bundle\n * cannot reach into the build tool; spec.md §16.9 is the one statement both are held to, and the\n * compiler's `nesting-cap-agreement.test.ts` asserts its copy against this export, so the two\n * numbers cannot part without a red test in the workspace that owns the copy.\n */\nexport const MAX_COMPONENT_NESTING = 32;\n\n/** One instance on the chain: its tag, and the props it was given, as an identity. */\ninterface InstanceFrame {\n tag: string;\n /** Every value the instance supplied that its definition's state read (§16.9). */\n props: Record<string, unknown>;\n}\n\n/**\n * The chain an instance is created under, and where on it the current expansion began.\n *\n * `frames` is every instance from the page-level one down, outermost first. `expansion` is the\n * index of the first frame that belongs to the SAME synchronous pass as the instance being created:\n * the cycle check (§16.9 rule 1) looks back no further than that, while the cap (rule 2) counts\n * every frame. The distinction is what an effect re-run does to certainty. Along one pass a\n * repeated frame is a render that repeats itself, deterministically, forever. Across a re-run it is\n * not: the frames above the boundary rendered to completion once, and whether the page asks for one\n * of them again is its data — an `onMount` that flips a `$switch` into the same tag every time, or\n * a click that opens one more level of a node that starts closed — which the runtime cannot tell\n * apart. So the cycle check is not asked across the boundary, and the loop that lives in re-runs is\n * ended by the cap instead: thirty-three empty hosts and a diagnostic, not a page that never\n * settles.\n */\ninterface InstancePath {\n frames: readonly InstanceFrame[];\n expansion: number;\n}\n\n/** The chain a page-level render runs under: nothing above it. */\nconst ROOT_INSTANCE_PATH: InstancePath = { expansion: 0, frames: [] };\n\n/**\n * The chain of instances whose definitions are being rendered RIGHT NOW.\n *\n * A module-level stack rather than a WeakMap from element to chain, and it is worth saying why that\n * survives `connectedCallback` being async. The callback awaits `buildScope` before it touches the\n * DOM, and by the time it resumes, whatever the enclosing instance pushed here has long been popped\n * — so the stack alone would be empty for every instance and catch nothing. What saves it is WHEN\n * an instance connects: `this.append(child)` in the enclosing render runs the child's\n * `connectedCallback` synchronously, and every way a definition brings an instance into being —\n * `renderCustomElementWithProps`, the bare-tag branch of `renderNode`, a nested element inside\n * either, and a prerendered host drawing its children again as it upgrades — appends it inside that\n * same synchronous stretch. So the callback reads the stack ONCE, before its first `await`, and\n * carries the copy across the gap. A WeakMap would need a write at each of those creation sites to\n * say the same thing.\n *\n * A subtree an effect renders LATER — a `$switch` case that flips after the first paint, a `$map`\n * row that arrives with new data — connects with nothing on the stack, because no enclosing render\n * is running when the effect re-runs; a write from `onMount` or a click is what triggered it. So\n * the two renderers that create nodes from an effect each capture the stack when they are first\n * rendered (which is inside the enclosing pass) and put it back, re-expanded, around every later\n * insertion ({@link underInstancePath}). That is the one thing this stack needs beyond the\n * synchronous stretch, and it is what makes the `onMount`-flip shape a diagnostic rather than a\n * hang. Reading `@vue/reactivity`'s `getCurrentScope()` there instead would find nothing: an effect\n * re-run restores no scope, and a case or a row renders in a DETACHED scope with no parent.\n */\nlet _instancePath: InstancePath = ROOT_INSTANCE_PATH;\n\n/**\n * Run `fn` with `path` as the chain, so every instance that CONNECTS during it reads that chain.\n *\n * Restored rather than cleared afterwards: the enclosing render's chain is what was there, and a\n * restore needs no argument about whether anything was.\n *\n * @param {InstancePath} path - The chain the instances `fn` connects are created under\n * @param {() => T} fn - The render, or the insertion that connects what a render made\n * @returns {T} What `fn` returned\n */\nfunction underInstancePath<T>(path: InstancePath, fn: () => T): T {\n const was = _instancePath;\n _instancePath = path;\n try {\n return fn();\n } finally {\n _instancePath = was;\n }\n}\n\n/**\n * The chain a later insertion runs under: the same frames, with the expansion beginning now.\n *\n * Called on EVERY run of a `$switch` case or a `$map` reconcile, the first one included — harmless\n * there, because a first run builds into a detached container and nothing connects until the\n * enclosing pass appends it, under the enclosing pass's own chain.\n *\n * @param {InstancePath} path - The chain captured when the renderer was first rendered\n * @returns {InstancePath}\n */\nfunction reexpand(path: InstancePath): InstancePath {\n return { expansion: path.frames.length, frames: path.frames };\n}\n\n/**\n * Whether two prop values are the same input to a definition.\n *\n * Reference equality first — a `$ref` into the parent's state forwards the same primitive, the same\n * reactive proxy or the same function to the next level — and structural equality for plain data\n * rebuilt at each level (`data-jx-props` parsed twice is two objects with one meaning). Plain data\n * is what JSON can describe: an array, or an object with no prototype but `Object`'s, reactive or\n * raw. Anything else — a `Map`, a `Set`, a class instance, a circular object — is different from\n * everything but itself, because its JSON form would not say what it holds and two different values\n * that serialise alike would close a cycle that was never there. The cost of that policy is a loop\n * the depth cap catches instead; the alternative is a false diagnostic on a page that would have\n * ended. Inside plain data the comparison IS the JSON form, so a member JSON cannot see (a\n * function, a `Map` two levels down) is not seen here either; §16.9 says so.\n *\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nfunction samePropValue(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n if (!isPlainData(a) || !isPlainData(b)) {\n return false;\n }\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a value is an array or a plain object — the shapes whose JSON form is the whole value.\n *\n * @param {unknown} value\n * @returns {value is object}\n */\nfunction isPlainData(value: unknown): value is object {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const raw: unknown = toRaw(value);\n if (Array.isArray(raw)) {\n return true;\n }\n const proto: unknown = Object.getPrototypeOf(raw);\n return proto === Object.prototype || proto === null;\n}\n\n/**\n * Whether two frames are the same instance: one tag, one set of prop names, equal values.\n *\n * @param {InstanceFrame} a\n * @param {InstanceFrame} b\n * @returns {boolean}\n */\nfunction sameFrame(a: InstanceFrame, b: InstanceFrame): boolean {\n if (a.tag !== b.tag) {\n return false;\n }\n const keys = Object.keys(a.props);\n if (keys.length !== Object.keys(b.props).length) {\n return false;\n }\n return keys.every(\n (key) => Object.hasOwn(b.props, key) && samePropValue(a.props[key], b.props[key]),\n );\n}\n\n/**\n * The chain an instance's own render runs under: the enclosing chain plus itself — or the\n * diagnostic that says why it must not render at all.\n *\n * The two messages are the compiler's, word for word (`renderComponentInstance` in\n * `@jxsuite/compiler`), so a page that fails to build and a canvas that fails to paint say the same\n * thing about the same definition. Meeting a frame already on the chain, within the current\n * expansion, is the instance rendering itself with the same props, which never ends; a chain at the\n * cap is a self-reference whose props change — or whose repeats live in re-runs, where the cycle\n * check is not asked ({@link InstancePath}) — and whose stop case never came.\n *\n * @param {InstancePath} path - The chain the instance was created under\n * @param {InstanceFrame} frame - The instance about to render\n * @returns {InstancePath} The chain its children render under\n * @throws {Error} The named diagnostic — never a stack overflow, never a hang\n * @docs framework/concepts/components\n */\nfunction extendInstancePath(path: InstancePath, frame: InstanceFrame): InstancePath {\n const chain = [...path.frames.map((f) => f.tag), frame.tag].join(\" → \");\n if (path.frames.slice(path.expansion).some((f) => sameFrame(f, frame))) {\n throw new Error(\n `Component <${frame.tag}> renders itself: ${chain}. A component cannot appear inside its own ` +\n `definition with the same props — the expansion would never end.`,\n );\n }\n if (path.frames.length >= MAX_COMPONENT_NESTING) {\n throw new Error(\n `Component nesting exceeds ${MAX_COMPONENT_NESTING} levels: ${chain}. A component that ` +\n `renders itself with changing props needs a case that stops.`,\n );\n }\n return { expansion: path.expansion, frames: [...path.frames, frame] };\n}\n\n/**\n * Register a custom element from a Jx document.\n *\n * @param {string | JxDocument} source - URL to .json file, or raw document object\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<void>}\n */\nconst _definedSources = new Set<string>();\n\nexport async function defineElement(source: string | JxDocument, baseUrl?: string) {\n let base = baseUrl;\n let doc = source;\n if (typeof source === \"string\") {\n base = new URL(source, base ?? location.href).href;\n if (_definedSources.has(base)) {\n return;\n }\n _definedSources.add(base);\n doc = await resolve(source);\n }\n base ??= location.href;\n\n const source_: JxDocument = doc as JxDocument;\n\n const { tagName } = source_;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx defineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (customElements.get(tagName)) {\n return;\n }\n\n // Register sub-dependencies first\n if (source_.$elements) {\n await registerElements(source_.$elements, base);\n }\n\n _elementDefs.set(tagName, { base, doc: source_ });\n\n // The definition as first given. The class reads the CURRENT one at connection (see\n // `redefineElement`); only `observedAttributes` is frozen here, because the platform freezes it.\n const initialDef = source_;\n const initialBase = base;\n const observedAttrs = initialDef.observedAttributes ?? [];\n\n const ElementClass = class extends HTMLElement {\n _jxInitialized = false;\n _state: JxScope | null = null;\n\n static get observedAttributes() {\n return observedAttrs;\n }\n\n async connectedCallback() {\n // An element carrying `data-jx-definition-root` IS the definition being rendered by an\n // External renderer (the studio canvas editing this component's own document) — its subtree\n // Is authored DOM, not an instantiation site. Self-initializing here would wipe that tree\n // And re-render it with default state (the \"component editor shows a live instance\" bug).\n if (this.dataset.jxDefinitionRoot !== undefined) {\n return;\n }\n if (this._jxInitialized) {\n return;\n }\n this._jxInitialized = true;\n\n /* The chain this instance was created under, read BEFORE the first `await`: the enclosing\n render is still on the stack now and will not be when this callback resumes. See\n {@link _instancePath} for why that ordering is the whole mechanism. */\n const enclosingPath = _instancePath;\n /* What this instance was given, recorded beside each write into state below. It is the\n instance's identity on the chain (§16.9): two nested instances of one tag that were given\n the same values render the same thing, forever. Only a value the definition's state READS\n is recorded — a `$props` key no state entry declares changes nothing about the render, so\n a definition that \"varies\" one at each level is still rendering itself. */\n const supplied: Record<string, unknown> = {};\n\n // The definition as it stands NOW — a redefinition since this class was made is honoured.\n const live = _elementDefs.get(tagName) ?? { base: initialBase, doc: initialDef };\n const def = live.doc;\n const defBase = live.base;\n\n // The element is its own dispatch root: a body run without an event emits from the host.\n const state = await buildScope(def, {}, defBase, { base: defBase, media: null, root: this });\n\n // Read properties from the data-jx-props payload the site build writes on a\n // Non-static instance, so an upgrade re-renders with the authored props, not the defaults.\n /* Observed attributes already on the element are read now. `attributeChangedCallback` fires\n for an attribute set before connection too — but on an instance with no state yet, so it\n had nothing to write into, and `<jx-icon name=\"plus\">` rendered with the default. Before\n the `$props` merges below, so a property a parent set still wins (spec §16.2). */\n for (const attr of observedAttrs) {\n if (this.hasAttribute(attr)) {\n absorbAttribute(state, attr, this.getAttribute(attr));\n // The raw string, not the coerced value: coercion is a function of it, so two equal\n // Strings are one input.\n supplied[attr] = this.getAttribute(attr);\n }\n }\n\n const propsAttr = this.dataset.jxProps;\n if (propsAttr) {\n try {\n const props = JSON.parse(propsAttr) as Record<string, unknown>;\n for (const [key, val] of Object.entries(props)) {\n if (refusePrivateProp(key, \"data-jx-props\")) {\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = val;\n supplied[key] = val;\n }\n }\n } catch {}\n delete this.dataset.jxProps;\n }\n\n // Read literal `props.*` attributes (JSON-authored instances pass props this way; the\n // Compiler lifts them into $props at build, and this is the live-render mirror). String\n // Values only — HTML lowercases attribute names, so state keys must be lowercase to match.\n // Collect first: removing while iterating the live NamedNodeMap skips entries.\n const propAttrNames = this.getAttributeNames().filter(\n (name) => name.startsWith(\"props.\") && name.length > \"props.\".length,\n );\n for (const name of propAttrNames) {\n const key = name.slice(\"props.\".length);\n if (refusePrivateProp(key, \"props.* attribute\")) {\n this.removeAttribute(name);\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = this.getAttribute(name);\n supplied[key] = this.getAttribute(name);\n this.removeAttribute(name);\n }\n }\n\n // Merge $props set as JS properties by parent before connection\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n if (\n key in this &&\n (this as Record<string, unknown>)[key] !== undefined &&\n instanceSupplies(this, key)\n ) {\n state[key] = (this as Record<string, unknown>)[key];\n supplied[key] = (this as Record<string, unknown>)[key];\n }\n }\n\n /* Every input is known now, so this is where an instance that would never finish is\n refused (§16.9): before it has a state, a style or a child, so a refused host is an empty\n element the page renders around — emptied of what the definition wrote into it for its\n slots too, since nothing will distribute that. The diagnostic is REPORTED rather than\n thrown onward: a throw from an async `connectedCallback` is an unhandled rejection that\n names no element and stops nothing. It goes two ways. The console is the runtime's\n surface for a render that fails after the page has settled (`$switch` external cases and\n the dev proxies report there too). The `jx-error` event is the surface a HOST can hold:\n it bubbles from the refused element with the error on it, so a page, or the studio canvas\n wrapping one, can collect it where a console line inside an iframe reaches nobody. The\n rest of the page keeps rendering, which is the point.\n\n Neither surface is used for a host that is no longer in the document. A refused instance\n was connected when this callback began, and one that is not by the time the verdict is in\n belongs to a subtree the page discarded during the `await` above: a prerendered host of the\n same tag that was parsed INSIDE another and re-rendered from the definition by the outer\n one's upgrade, which captures it as slot content and empties itself. Its replacement is\n the instance that reports, on the chain the outer upgrade draws; reporting from the\n discarded copy too said one defect twice. The refusal itself still stands, so a host\n re-attached later is an empty element and not a hang. */\n let ownPath: InstancePath;\n try {\n ownPath = extendInstancePath(enclosingPath, { props: supplied, tag: tagName });\n } catch (error) {\n this.replaceChildren();\n if (!this.isConnected) {\n return;\n }\n console.error(`Jx: <${tagName}> was not rendered:`, error);\n this.dispatchEvent(\n new ErrorEvent(\"jx-error\", {\n bubbles: true,\n composed: true,\n error,\n message: error instanceof Error ? error.message : String(error),\n }),\n );\n return;\n }\n /*\n * Set up property getters/setters that forward into reactive state. Private entries get NO\n * accessor: the property-first interface IS the props mechanism, so defining one would leave\n * `el[\"#cache\"] = x` writing straight through everything above.\n */\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n if (!(key in HTMLElement.prototype)) {\n Object.defineProperty(this, key, {\n configurable: true,\n get: () => state[key],\n set: (v: unknown) => {\n state[key] = v;\n },\n });\n }\n }\n\n this._state = state;\n\n // Capture light DOM children (for slot distribution) before rendering\n const slottedChildren = [...this.childNodes];\n this.replaceChildren();\n\n /* Custom elements default to `display: inline`; a Jx container behaves like a `<div>`, so\n one is supplied. It goes in the element's OWN RULE rather than inline: an inline\n declaration is beaten only by `!important`, so a consumer could not override the default\n without one. At (0,1,0) a consumer's rule, a cascade layer or a parent's descendant rule\n all win normally, and the definition's own `display` still wins because it is written into\n the same rule after this. */\n const defStyle = declaresDisplay(def.style) ? def.style : { display: \"block\", ...def.style };\n /* Definition first, call site second, so the call site wins at equal specificity by source\n order — the promise §9.2 already makes for base-before-nested. Merged into ONE call\n because each `applyStyle` releases what the last one interned. */\n const hostStyle = mergeStyle(defStyle as JxStyle, callSiteStyles.get(this));\n\n // Render template into light DOM (once, not in effect — inner effects handle reactivity)\n applyStyle(this, hostStyle, (state[\"$media\"] as Record<string, string>) ?? {}, state);\n applyAttributes(this, def.attributes ?? {}, state);\n bindDefinitionHandlers(this, def, state);\n\n /*\n * Root-level `textContent` is a definition's content just as much as `children` is — it is\n * the shape spec.md §17.2 recommends when every child would be a bare string — and it was\n * dropped here, so such a component rendered empty everywhere the interpreter runs.\n */\n if (!Array.isArray(def.children) && def.textContent !== undefined) {\n bindProperty(this, \"textContent\", def.textContent, state);\n }\n const children = Array.isArray(def.children) ? def.children : [];\n /* An instance the studio stamped is part of the page being edited, so everything the\n definition draws inside it is too — and the de-link rules cannot see that from the nodes\n themselves. Restored rather than cleared, because one definition may render another. */\n const wasInside = _canvasInsideStampedHost;\n _canvasInsideStampedHost ||= this.dataset.jxPath !== undefined;\n /* And the chain, for the same span: an instance this definition draws connects inside\n `this.append` below and reads it there ({@link underInstancePath}). */\n try {\n underInstancePath(ownPath, () => {\n for (const childDef of children) {\n this.append(renderNode(childDef, state));\n }\n });\n } finally {\n _canvasInsideStampedHost = wasInside;\n }\n\n // Slot distribution (light DOM)\n distributeSlots(this, slottedChildren);\n\n /* Lifecycle: onMount, with the HOST as its second argument.\n A sidecar that must reach the element it belongs to had no way to: the runtime handed it\n the scope alone, so elements resorted to dispatching a `jx-ready` event at themselves and\n catching it with a root handler purely to learn `currentTarget`. The host is what the\n callback needed; the event round trip was the workaround. */\n const { onMount } = state;\n if (typeof onMount === \"function\") {\n queueMicrotask(() => (onMount as (s: JxScope, host: HTMLElement) => unknown)(state, this));\n }\n }\n\n disconnectedCallback() {\n if (typeof this._state?.onUnmount === \"function\") {\n (this._state.onUnmount as (s: JxScope) => unknown)(this._state);\n }\n }\n\n adoptedCallback() {\n if (typeof this._state?.onAdopted === \"function\") {\n (this._state.onAdopted as (s: JxScope) => unknown)(this._state);\n }\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n if (!this._state || oldVal === newVal) {\n return;\n }\n // The CURRENT definition's defaults, so a redefinition (embedding.md §7) that changes one\n // Reaches an instance that is already connected.\n absorbAttribute(\n this._state,\n name,\n newVal,\n declaredDefaults(_elementDefs.get(tagName)?.doc ?? initialDef),\n );\n }\n };\n\n customElements.define(tagName, ElementClass);\n}\n\n/**\n * Render a registered custom element with $props (property-first interface).\n *\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @param {JxPath} [path]\n * @returns {HTMLElement}\n */\nfunction renderCustomElementWithProps(\n def: JxElement,\n state: JxScope,\n options?: JxRenderOptions,\n path?: JxPath,\n) {\n const el = document.createElement(resolveTagName(def.tagName, state));\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path ?? [], def, state);\n }\n\n // Set JS properties from $props (before connection)\n for (const [key, val] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(key, \"$props\")) {\n continue;\n }\n /* The same resolution `bindProperty` gives an ordinary element. A `$props: { src }` on a custom\n element is an asset reference authored at the USAGE site, so it belongs to the document that\n wrote it — a media prop the component forwards into its own `<img>` is resolved separately,\n inside the component's render, against the same context. */\n const write = (resolved: unknown): void => {\n (el as unknown as Record<string, unknown>)[key] =\n typeof resolved === \"string\" ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n };\n if (isRefObj(val)) {\n const refVal = val;\n write(resolveRef(refVal.$ref, state));\n // Reactive forwarding: re-set the property when the source changes\n effect(() => {\n write(resolveRef(refVal.$ref, state));\n });\n } else if (isTemplateString(val)) {\n effect(() => {\n write(evaluateTemplate(val, state));\n });\n } else {\n write(val);\n }\n }\n\n /* Apply host-level style and attributes from the usage site.\n Also REMEMBERED, because `connectedCallback` applies the definition's style through the same\n interning path and `applyStyleInto` releases the element's existing rules first — so without\n this the call site's declarations were written here and deleted a moment later, and a document\n could not style an element instance at all. See {@link callSiteStyles}. */\n if (def.style) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(el, def.style ?? {}, (state[\"$media\"] as Record<string, string>) ?? {}, state);\n applyAttributes(el, def.attributes ?? {}, state);\n /* And its ordinary properties and handlers — `id`, `hidden`, `className`, an `onselect` — exactly\n as an ordinary element gets them. A custom element used in a document is still an element in\n that document; only `$props` are the definition's to absorb. */\n applyProperties(el, def, state);\n\n // Append slotted children. A mapped array is not a node: its rows are rendered in place, ahead of\n // Their anchor, exactly as they are under an ordinary element — so a `$map` of menu rows inside a\n // `jx-menu` is a list of rows, not one `<div>` standing where the list should be.\n const children = Array.isArray(def.children) ? def.children : [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i]!;\n const childOpts = options && path ? { ...options, _path: [...path, \"children\", i] } : undefined;\n if (isMappedArray(child)) {\n renderMappedArrayInto(el, child, state, childOpts);\n } else {\n el.append(renderNode(child, state, childOpts));\n }\n }\n\n return el;\n}\n\n/**\n * Light DOM slot distribution.\n *\n * @param {HTMLElement} host\n * @param {ChildNode[]} slottedChildren\n */\nfunction distributeSlots(host: HTMLElement, slottedChildren: ChildNode[]) {\n /* No early return when nothing was slotted. A slot leaves no node WHETHER OR NOT it received\n anything — an unmatched one unwraps to its own fallback children, and a host given nothing at\n all is just every slot unmatched. Returning early here left the slot standing in exactly the\n case an element most wants to detect: `[part=\"label\"]:empty` answered false for a control with\n no label, because the surviving slot was still a child. */\n const slots = host.querySelectorAll(\"slot\");\n if (slots.length === 0) {\n return;\n }\n\n const named = new Map<string | null, ChildNode[]>();\n const unnamed: ChildNode[] = [];\n\n for (const child of slottedChildren) {\n if (child.nodeType === Node.ELEMENT_NODE && (child as Element).getAttribute(\"slot\")) {\n const name = (child as Element).getAttribute(\"slot\");\n if (!named.has(name)) {\n named.set(name, []);\n }\n (named.get(name) as ChildNode[]).push(child);\n } else {\n unnamed.push(child);\n }\n }\n\n /* A `<slot>` UNWRAPS: its matches stand in its place and the slot itself leaves no node.\n It used to survive, holding its matches as children. The box tree looked right, because a\n slot is `display: contents` — but the SELECTOR tree did not, so every `& > x` rule in a\n definition silently stopped matching a slotted child, which is now a grandchild. Measured on\n the field row: 68.40px where the class form gives 88.40px, and its help text 80px wide\n instead of 260px, with `[data-span]` dead. An unmatched slot unwraps to its own fallback\n children, which is what the platform's slot does when nothing is assigned to it. */\n for (const slot of slots) {\n const name = slot.getAttribute(\"name\");\n const matches = name ? (named.get(name) ?? []) : unnamed;\n slot.replaceWith(...(matches.length > 0 ? matches : [...slot.childNodes]));\n }\n}\n"
|
|
15
|
+
"/// <reference lib=\"dom\" />\n/**\n * Jx — JSON-native reactive web component runtime\n * @version 3.0.0\n * @license MIT\n *\n * Four-step pipeline:\n * 1. resolve — fetch JSON source (or accept raw object)\n * 2. buildScope — state detection + reactive proxy construction\n * 3. render — walk resolved tree, build DOM, wire reactive effects\n * 4. output — append to target\n *\n * @module jx\n */\n\nimport {\n computed,\n effect,\n effectScope,\n isReactive,\n isRef,\n onEffectCleanup,\n onScopeDispose,\n pauseTracking,\n reactive,\n ref,\n resetTracking,\n shallowReactive,\n toRaw,\n} from \"@vue/reactivity\";\nimport {\n buildStyleRules,\n cssPropertyName,\n hashCss,\n isNestedSelectorKey,\n transposeCanvasOverlaySelector,\n} from \"./css.ts\";\nimport { evaluateExpression, evaluateOperand, isMutating } from \"./expression.ts\";\nimport { readPath } from \"./pointer.ts\";\nimport type {\n DynamicClass,\n JxContext,\n JxEventHandler,\n JxMount,\n JxMountOptions,\n JxPath,\n JxRenderOptions,\n JxScope,\n} from \"./types.ts\";\nimport {\n bodyReturnsValue,\n hasStructuredBody,\n isExpressionDef,\n isFunctionDef,\n isJsonObject,\n isMappedArray,\n isNamedFormulaDef,\n isPrivateStateKey,\n isPrototypeDef,\n isRef as isRefValue,\n isServerFnDef,\n isTagExpression,\n isTemplateString,\n paramNames,\n} from \"@jxsuite/schema/guards\";\nimport { formatSrcset, parseSrcset } from \"@jxsuite/schema/asset-paths\";\nimport { runStatements } from \"./statements.ts\";\nimport { readCookie, serializeCookie } from \"./cookie.ts\";\nimport type {\n JxAttributeValue,\n JxClassDef,\n JxDocument,\n JxElement,\n JxFunctionDef,\n JxHeadEntry,\n JxMappedArray,\n JxPrototypeDef,\n JxRef,\n JxServerFnDef,\n JxStyle,\n} from \"@jxsuite/schema/types\";\nimport type { EffectScope, Ref } from \"@vue/reactivity\";\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Mount a Jx document into a DOM container.\n *\n * @example\n * import { Jx } from \"@jxsuite/runtime\";\n * const state = await Jx(\"./counter.json\", document.getElementById(\"app\"));\n *\n * @param {string | JxDocument} source - Path to .json file, URL, or raw document object\n * @param {HTMLElement} [target] Default is `document.body`\n * @param {JxRenderOptions} [options]\n * @returns {Promise<JxScope>} Resolves with the live component scope (state reactive\n * proxy)\n */\n/** The document-schema version this runtime understands (the `/schema/vN` in a hosted `$schema`). */\nexport const SUPPORTED_SCHEMA_VERSION = 1;\nlet _schemaVersionWarned = false;\n\n/**\n * Warn once when a document declares a hosted `$schema` whose version differs from the one this\n * runtime supports. A relative or non-hosted `$schema` (local dev schema paths) is ignored. This is\n * a diagnostic only — there is no document-format migration story yet (see spec §3.2 / §21.4).\n */\nfunction checkSchemaVersion($schema: unknown): void {\n if (_schemaVersionWarned || typeof $schema !== \"string\") {\n return;\n }\n const match = $schema.match(/\\/schema\\/v(\\d+)\\b/);\n if (match && Number(match[1]) !== SUPPORTED_SCHEMA_VERSION) {\n _schemaVersionWarned = true;\n console.warn(\n `Jx: document $schema is version v${match[1]} but this runtime supports ` +\n `v${SUPPORTED_SCHEMA_VERSION}. Behavior may be undefined; there is no format migrator yet.`,\n );\n }\n}\n\nexport async function Jx(\n source: string | JxDocument,\n target: HTMLElement = document.body,\n options?: JxRenderOptions,\n) {\n const base = options?.base\n ? new URL(options.base, location.href).href\n : typeof source === \"string\"\n ? new URL(source, location.href).href\n : location.href;\n const doc = await resolve(source);\n\n /* The module-level fallback is still written here, on purpose: a component defined LATER with\n `@--name` blocks and no own `$media` reads it (setRootMedia). `mount()` never writes it — a\n mount's `$media` travels in its context, which is the whole point of having one. */\n if (doc.$media) {\n _rootMedia = doc.$media;\n }\n\n const mounted = await mount(doc, target, {\n base,\n ...(options?.onNodeCreated ? { onNodeCreated: options.onNodeCreated } : {}),\n ...(options?.signal ? { signal: options.signal } : {}),\n });\n return mounted.scope;\n}\n\n/** Host-scope keys the runtime owns: `$media`, `$map`, the `$`-locals and `#`-private entries. */\nconst HOST_SCOPE_RESERVED = /^[$#]/;\n\nfunction assertHostScope(scope: Record<string, unknown>): void {\n for (const key of Object.keys(scope)) {\n if (HOST_SCOPE_RESERVED.test(key)) {\n throw new TypeError(\n `Jx mount: host scope key \"${key}\" is reserved — names beginning with \"$\" or \"#\" are ` +\n `runtime vocabulary`,\n );\n }\n }\n}\n\n/**\n * Mount a document into a host-owned node and hand back the live scope with a disposer.\n *\n * This is the embedding contract (specs/embedding.md): the host supplies its own reactive records\n * and functions as `options.scope`, a per-mount base, `$media` and document resolver, and gets a\n * root it can remove and a `dispose()` that stops every effect the render created. Nothing here\n * writes a module global, so a shell can hold many roots with different needs at once.\n *\n * @param {JxDocument} doc - The document to render (already an object; use {@link resolve} for a\n * URL)\n * @param {ParentNode} target - Where the rendered root is appended\n * @param {JxMountOptions} [options]\n * @returns {Promise<JxMount>}\n * @docs extending/embedding/runtime-host\n */\nexport async function mount(\n doc: JxDocument,\n target: ParentNode,\n options: JxMountOptions = {},\n): Promise<JxMount> {\n const hostScope = options.scope ?? {};\n assertHostScope(hostScope);\n const base = options.base ? new URL(options.base, location.href).href : location.href;\n const ctx: JxContext = {\n base,\n media: options.media ?? doc.$media ?? null,\n root: null,\n ...(options.resolver ? { resolver: options.resolver } : {}),\n ...(options.skipServerFunctions === undefined\n ? {}\n : { skipServerFunctions: options.skipServerFunctions }),\n ...(options.skipAutoRequests === undefined\n ? {}\n : { skipAutoRequests: options.skipAutoRequests }),\n };\n checkSchemaVersion(doc.$schema);\n\n // Register custom elements declared in $elements (depth-first)\n if (doc.$elements) {\n await registerElements(doc.$elements, base, ctx);\n }\n\n // Inject <head> elements declared in $head (link, meta, script, etc.)\n if (doc.$head) {\n injectHead(doc.$head, base);\n }\n\n const scope = await buildScope(doc, hostScope, base, ctx);\n\n const elements = new Set<string>();\n const renderOptions: JxRenderOptions = {\n _ctx: ctx,\n onNodeCreated: (el, path, def, state) => {\n if (el instanceof Element && el.tagName.includes(\"-\")) {\n elements.add(el.tagName.toLowerCase());\n }\n options.onNodeCreated?.(el, path, def, state);\n },\n ...(options.onNodeMoved ? { onNodeMoved: options.onNodeMoved } : {}),\n };\n const { result: root, stop } = runScoped(() => renderNode(doc, scope, renderOptions));\n ctx.root = root;\n\n let mounted = false;\n let disposed = false;\n const dispose = (): void => {\n if (disposed) {\n return;\n }\n disposed = true;\n options.signal?.removeEventListener(\"abort\", dispose);\n stop();\n if (mounted && typeof scope.onUnmount === \"function\") {\n (scope.onUnmount as (s: JxScope) => unknown)(scope);\n }\n root.remove();\n };\n\n if (options.signal?.aborted) {\n // Aborted before it could be attached: tear the effects down and attach nothing.\n dispose();\n } else {\n options.signal?.addEventListener(\"abort\", dispose, { once: true });\n target.append(root);\n mounted = true;\n if (typeof scope.onMount === \"function\") {\n (scope.onMount as (s: JxScope) => unknown)(scope);\n }\n }\n return { scope, root, elements, dispose };\n}\n\n// ─── Step 1: Resolve ──────────────────────────────────────────────────────────\n\nconst _resolveCache = new Map<string, Promise<JxDocument>>();\n\n/**\n * Seed the resolve cache with a document a host already holds, under the URL its references use.\n *\n * A bundled document — one imported as JSON rather than fetched — still names its dependencies by\n * URL: an `$elements` entry, a `$switch` case. Preloading those under the same URLs lets every such\n * reference resolve with no network, and lets `defineElement(\"<url>\")` dedupe on the source it\n * would otherwise have fetched. The key is stored as given and, when it parses as a URL, in its\n * absolute form too, because the two lookup paths spell it differently.\n *\n * @param {string} url - The URL the document is known by\n * @param {JxDocument} doc\n */\nexport function preloadDocument(url: string, doc: JxDocument): void {\n const settled = Promise.resolve(doc);\n _resolveCache.set(url, settled);\n try {\n _resolveCache.set(new URL(url, location.href).href, settled);\n } catch {\n // Not a URL at all — the raw key still serves the lookup that uses it.\n }\n}\n\nexport async function resolve(source: string | JxDocument, ctx?: JxContext): Promise<JxDocument> {\n if (typeof source !== \"string\") {\n return source;\n }\n // A mount's resolver answers for THIS mount and its hit never enters the shared cache.\n const served = ctx?.resolver?.(source);\n if (served) {\n return served;\n }\n if (_resolveCache.has(source)) {\n return _resolveCache.get(source)!;\n }\n const p = fetch(source).then(async (res) => {\n if (!res.ok) {\n throw new Error(`Jx: failed to fetch ${source} (${res.status})`);\n }\n /*\n * `res.ok` is not enough on a single-page host. A static host configured with an SPA fallback\n * answers a path it does not have with the APPLICATION SHELL at HTTP 200, so a missing document\n * arrives looking like a successful fetch and dies inside `res.json()` as\n * `Unexpected token '<', \"<!doctype \"... is not valid JSON` — a parser error for what is\n * actually a 404. Jx Cloud did this to every component `$ref` in the canvas.\n *\n * Checked on the content type rather than by sniffing the body: a host that says `text/html`\n * has told us plainly, and saying so costs nothing.\n */\n // Optional-chained: a response that carries no headers at all is one we have no EVIDENCE\n // About, and guessing is worse than proceeding. Every real `Response` has them.\n const contentType = res.headers?.get(\"Content-Type\") ?? \"\";\n if (contentType.includes(\"text/html\")) {\n throw new Error(\n `Jx: ${source} returned HTML, not a document — the host answered a missing file with its ` +\n `app shell (a single-page fallback), so this path is not served.`,\n );\n }\n // Trust boundary: fetched sources are Jx documents by contract.\n return (await res.json()) as JxDocument;\n });\n _resolveCache.set(source, p);\n return p;\n}\n\n// ─── Step 2: Build scope ──────────────────────────────────────────────────────\n\n/** JSON Schema keywords used to identify pure type definitions (Shape 2b). */\nconst SCHEMA_KEYWORDS = new Set([\n \"type\",\n \"properties\",\n \"items\",\n \"enum\",\n \"minimum\",\n \"maximum\",\n \"minLength\",\n \"maxLength\",\n \"pattern\",\n \"required\",\n \"examples\",\n]);\n\n/** /** @type {{ skip: boolean }} */\nconst _serverFnConfig = { skip: false };\n/** Set to true to suppress timing: \"server\" resolution (used by Studio edit mode). */\nexport function setSkipServerFunctions(v: boolean) {\n _serverFnConfig.skip = v;\n}\n\n/** @type {{ skip: boolean }} */\nconst _autoRequestConfig = { skip: false };\n/**\n * Set to true to suppress AUTOMATIC `$prototype: \"Request\"` fetches — the sibling of\n * {@link setSkipServerFunctions}, and used by Studio for the same reason.\n *\n * `buildScope` re-resolves every `state` entry on each full canvas render, so an auto-request\n * re-issued its HTTP call every time the canvas rebuilt. In edit/design mode that meant authoring\n * actions — a signal edit, or pressing Enter inside component-wrapped content, both of which force\n * a full render — fired network requests. Live data belongs to preview and to the deployed site.\n *\n * Only non-`manual` requests are gated: a `manual` one fires from an event handler, and edit mode\n * strips handlers before rendering. The returned ref is unchanged either way — it simply stays at\n * its initial `null`, which is the same state bindings observe before any fetch resolves.\n */\nexport function setSkipAutoRequests(v: boolean) {\n _autoRequestConfig.skip = v;\n}\n\n// ─── Dev-proxy auth token (Studio cross-origin canvas) ────────────────────────\n// The Studio canvas iframe is served from a token-gated loopback origin (createProjectServer): its\n// POST /__jx_resolve__ + /__jx_server__ routes 403 without ?token=<rpcToken>. The iframe boot reads\n// The token from its URL and calls setResolveToken so these dev-proxy fetches authenticate. Unset by\n// Default, leaving production + same-origin dev untouched (bare path, no query appended).\nlet _resolveToken: string | null = null;\nexport function setResolveToken(token: string | null) {\n _resolveToken = token || null;\n}\n/** Append the dev-proxy auth token to a privileged resolve path when one is configured. */\nfunction resolveProxyPath(path: string): string {\n return _resolveToken ? `${path}?token=${encodeURIComponent(_resolveToken)}` : path;\n}\n\n/** @deprecated No longer needed — ContentCollection/ContentEntry resolve via generic class path */\nexport function setSkipContentResolution(_v: boolean) {\n // No-op retained for API compatibility\n}\n\n/**\n * Observe runtime-created reactive values: runs `fn` immediately inside a reactive effect and\n * re-runs it whenever a tracked value changes; returns a disposer. Dep tracking in @vue/reactivity\n * is per module INSTANCE, so an effect created from another copy of the package (e.g. the studio's\n * own pin) can never track a ref/reactive created here — consumers that want to observe\n * runtime-resolved scope values (the Studio canvas iframe's dataScope re-post) must use this.\n *\n * @param {() => void} fn - Read the reactive values to observe inside this callback.\n * @returns {() => void} Disposer — stops the effect and its scope.\n */\nexport function observeScope(fn: () => void): () => void {\n const scope = effectScope(true);\n scope.run(() => {\n effect(fn);\n });\n return () => scope.stop();\n}\n\n/**\n * Run `fn` inside a detached reactive scope of THIS module's reactivity instance, returning its\n * result plus a disposer that stops every effect `fn` created. Callers that render via\n * {@link renderNode} and later tear the render down (the Studio canvas full render and its surgical\n * subtree re-renders) MUST use this instead of their own effectScope: scope collection is per\n * vue-reactivity module instance, so a scope from another copy of the package collects NOTHING and\n * its stop() silently leaks every binding effect of the superseded render.\n *\n * @param {() => T} fn - Work that may create reactive effects (typically a renderNode call).\n * @returns {{ result: T; stop: () => void }} The callback result and the scope disposer.\n */\nexport function runScoped<T>(fn: () => T): { result: T; stop: () => void } {\n const scope = effectScope(true);\n try {\n const result = scope.run(fn) as T;\n return { result, stop: () => scope.stop() };\n } catch (error) {\n // A throwing fn would otherwise leak the effects it created before failing.\n scope.stop();\n throw error;\n }\n}\n\n/**\n * Studio-canvas viewport-unit transpose. The canvas iframe is sized to its document's height, so\n * any viewport unit (`vh`/`vw`/`vmin`/`vmax`/`svh`/…) — which resolves against the iframe ELEMENT —\n * would feed back into an ever-growing height. When this is on, the runtime transposes them to\n * CONTAINER units (`cqh`/`cqw`/…) that resolve against the canvas's fixed-size query container (see\n * `canvas.html`): a predictable, feedback-free stand-in for the viewport. Off (the default) leaves\n * CSS untouched for real production rendering.\n */\nlet _canvasViewportTranspose = false;\nexport function setCanvasViewportTranspose(on: boolean) {\n _canvasViewportTranspose = on;\n}\n\nconst VIEWPORT_UNIT_RE = /(-?\\d*\\.?\\d+)(?:s|l|d)?v(h|w|min|max|i|b)\\b/gi;\nconst VIEWPORT_UNIT_MAP: Record<string, string> = {\n b: \"cqb\",\n h: \"cqh\",\n i: \"cqi\",\n max: \"cqmax\",\n min: \"cqmin\",\n w: \"cqw\",\n};\n\n/**\n * Transpose CSS viewport units → container-query units in a value string, but only when the\n * studio-canvas flag is set (otherwise the value is returned untouched). `100vh` → `100cqh`,\n * `50svw` → `50cqw`, `10vmin` → `10cqmin`, etc.\n */\nexport function transposeCanvasUnits(value: string): string {\n if (!_canvasViewportTranspose || !value.includes(\"v\")) {\n return value;\n }\n return value.replace(\n VIEWPORT_UNIT_RE,\n (_m, num: string, dim: string) => `${num}${VIEWPORT_UNIT_MAP[dim.toLowerCase()] ?? `cq${dim}`}`,\n );\n}\n\n/**\n * Studio-canvas anchor de-linking. In the editor canvas a rendered `<a href>` would navigate the\n * iframe when clicked, fighting element selection. When this is on, the runtime stamps the value on\n * `data-jx-href` instead of `href` so the anchor is inert (selectable, not a live link) while the\n * original target stays recoverable for richer link handling later. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _canvasDelinkAnchors = false;\nexport function setCanvasDelinkAnchors(on: boolean) {\n _canvasDelinkAnchors = on;\n}\n\n/**\n * Studio-canvas popover de-linking — `setCanvasDelinkAnchors`'s rule applied to `popover`.\n *\n * An OPEN popover is in the top layer, and CSS Position 4 §3.1 gives a top-layer element the\n * VIEWPORT as its containing block whatever its ancestors say. In the editor canvas that viewport\n * is a fiction: the frame is sized to its own content height, so a drawer pinned with `inset: 0`\n * lands halfway down a 6000px page, and a panel taller than a short component frame is clipped by\n * the `overflow: hidden` the canvas document needs. Worse, a top-layer box contributes nothing to\n * any ancestor's scrollable overflow, so the artboard can never grow to fit one.\n *\n * When this is on, the runtime stamps `popover` on `data-jx-popover` for nodes the studio can\n * ADDRESS — those carrying a stamped `data-jx-path`. That drops every `[popover]` UA rule at once,\n * and the one that matters most is `position: fixed`: with it gone the panel lays out in NORMAL\n * FLOW at its document position, which is what makes it contribute to `#jx-canvas-root`'s\n * scrollHeight so the host can grow the artboard to fit it. Leaving the top layer is necessary but\n * not sufficient — a fixed box contributes nothing to an ancestor's overflow either.\n *\n * It is worth saying what does NOT rescue this, because it is the intuitive answer and it is wrong:\n * `container-type: size` on the canvas's query container does NOT make it a containing block for\n * fixed descendants. Measured in Chrome 151 — `getComputedStyle(container).contain` is `none`, and\n * a `position: fixed` child inside it measures the WINDOW, not the container. So a panel that stays\n * fixed stays laid out against the frame's own viewport, which in an editable mode is the\n * document's full height. `iframe-render.ts` therefore FORCES `position` on the open panel rather\n * than relying on any containment.\n *\n * The studio re-supplies the one UA rule that matters — `display: none` while closed — inside a\n * cascade LAYER, so author declarations still beat it exactly as they beat the real UA rule on the\n * shipped page. That is deliberate: a popover whose base rule sets `display` is broken in\n * production, and the canvas has to show that rather than paper over it.\n *\n * The gate on `data-jx-path` is what keeps this out of documents the studio does not own: a popover\n * rendered inside a component's own template is never stamped, so it keeps its native behaviour.\n *\n * It also drives {@link transposeCanvasPopoverSelector}. The two are one transform — an attribute\n * renamed without its selectors transposed is a popover that can never be styled open.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkPopovers = false;\nexport function setCanvasDelinkPopovers(on: boolean) {\n _canvasDelinkPopovers = on;\n}\n\n/**\n * Studio-canvas de-linking of invoker commands, `inert` and a dialog's `open` — the dialog half of\n * {@link setCanvasDelinkPopovers}.\n *\n * A `<button command=\"show-modal\" commandfor=\"…\">` is the platform's own invoker: clicking it calls\n * `showModal()` on its target, which puts the dialog in the top layer and makes the rest of the\n * page INERT — the two things an editable canvas can least afford, since the first is the geometry\n * the popover comment above describes and the second makes every other element unclickable. So on a\n * stamped node `commandfor` is renamed to `data-jx-commandfor`: a button with `command` and no\n * target does nothing, and the studio's frame reports the click instead, so the host's single\n * writer of open state can answer it. `popovertarget` is left alone on purpose — its target has no\n * `popover` attribute on the canvas, so the platform already does nothing with it.\n *\n * `inert` becomes `data-jx-inert` for the same reason: an author's inert region is a region the\n * editor could not select into. And a `<dialog open>` becomes `<dialog data-jx-open>`, so the UA's\n * `dialog:not([open]) { display: none }` keeps every dialog closed until the canvas opens ONE with\n * `data-jx-dialog-open`, exactly as it opens one popover. `<details open>` is untouched: its `open`\n * is content, not an overlay state.\n *\n * Gated on `data-jx-path` like the popover rewrite, and driving\n * {@link transposeCanvasOverlaySelector} with it: an attribute renamed without its selectors\n * transposed is a dialog that can never be styled open, or a region that can never be styled inert.\n * Both renames travel with their selectors there — `[open]` on a dialog's own rules, `[inert]`\n * wherever it appears.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkCommands = false;\nexport function setCanvasDelinkCommands(on: boolean) {\n _canvasDelinkCommands = on;\n}\n\n/**\n * Raised while a defined element renders its own children, so the canvas de-link reaches them.\n *\n * The de-link rules gate on `data-jx-path`, which a document node carries and an element's INTERNAL\n * node never can: the internals belong to the definition, not to the page being edited, so the\n * studio's stamper never sees them. Without this a kit element that declares `popover` on a panel\n * inside itself opens a genuine top-layer popover inside an editable canvas, while Studio's single\n * writer of open state learns nothing about it.\n *\n * A module-scoped flag is sound here because `canvasAttrName` is called once per attribute OUTSIDE\n * the effect that binds it, and a definition renders its children synchronously — so the flag is\n * never read across a suspension point.\n */\nlet _canvasInsideStampedHost = false;\n\n/** Whether the node being rendered is inside a stamped host, and so part of the edited page. */\nfunction canvasStamped(el: HTMLElement): boolean {\n return _canvasInsideStampedHost || el.dataset.jxPath !== undefined;\n}\n\n/** The attribute name to stamp `key` on `el` under — `href` → `data-jx-href` on de-linked anchors. */\nfunction canvasAttrName(el: HTMLElement, key: string): string {\n if (_canvasDelinkAnchors && key === \"href\" && (el.tagName === \"A\" || el.tagName === \"AREA\")) {\n return \"data-jx-href\";\n }\n /* `dataset.jxPath` is already stamped here: `onNodeCreated` fires before `applyAttributes` in\n `renderNode`, and the studio's stamper writes the attribute synchronously inside it. That\n ordering is an unwritten contract between two packages, so `runtime-canvas.test.ts` asserts it\n directly rather than trusting it. */\n if (_canvasDelinkPopovers && key === \"popover\" && canvasStamped(el)) {\n return \"data-jx-popover\";\n }\n if (_canvasDelinkCommands && canvasStamped(el)) {\n if (key === \"commandfor\") {\n return \"data-jx-commandfor\";\n }\n if (key === \"inert\") {\n return \"data-jx-inert\";\n }\n if (key === \"open\" && el.tagName === \"DIALOG\") {\n return \"data-jx-open\";\n }\n }\n return key;\n}\n\n/**\n * Rewrite one asset reference for a host that does not serve the site's own URL space.\n *\n * The runtime writes a reference VERBATIM — `el.src = \"/hero.jpg\"` — so the browser resolves it\n * against the document, and the document is whatever page the renderer happens to be running in. On\n * a real site and on an editing server that serves the project tree, that is correct and this hook\n * stays null. On a multi-tenant editor origin it is not: `/hero.jpg` resolves against the editor,\n * misses, and — behind a single-page-app fallback — comes back as HTML at HTTP 200, so the image\n * renders broken and nothing is logged.\n *\n * A function rather than data because it cannot be one: the values it must fix are produced INSIDE\n * reactive effects (`{\"$ref\": \"#/state/hero\"}` is not a string until the effect runs), so no\n * document walk can see them. The Studio canvas iframe sets this at render time.\n *\n * Returning null leaves the value exactly as written, and a null resolver makes every call site\n * below the identity — so production rendering is byte-identical.\n *\n * @param {CanvasAssetResolver | null} fn - The resolver, or null to restore verbatim rendering\n */\nexport type CanvasAssetResolver = (value: string, key: string) => string | null;\n\nlet _canvasAssetResolver: CanvasAssetResolver | null = null;\nexport function setCanvasAssetResolver(fn: CanvasAssetResolver | null) {\n _canvasAssetResolver = fn;\n}\n\n/** Attribute/property names whose value is an asset reference, on any element. */\nconst ASSET_KEYS = new Set([\"src\", \"poster\", \"data\"]);\n\n/** Names whose value is a `srcset`-shaped candidate list rather than one reference. */\nconst SRCSET_KEYS = new Set([\"srcset\", \"imagesrcset\"]);\n\n/**\n * Elements on which `href` names an ASSET rather than a destination.\n *\n * `<a href>` and `<area href>` are places to go, not files to load; rewriting one would send a\n * click at the file that backs the page instead of at the page. `<link href>` is the opposite — a\n * stylesheet, an icon, a preload — and is the reason `$head` needs this at all.\n */\nconst HREF_ASSET_TAGS = new Set([\"LINK\"]);\n\n/** True when writing `key` on a `<tagName>` writes an asset reference. */\nfunction isAssetKey(tagName: string, key: string): boolean {\n return ASSET_KEYS.has(key) || (key === \"href\" && HREF_ASSET_TAGS.has(tagName));\n}\n\n/**\n * The value to actually write for `key` on a `<tagName>` — resolved when it is an asset reference,\n * and the input itself in every other case, including whenever no resolver is installed.\n *\n * `srcset` is split into its candidates and resolved one at a time, because it is N references in\n * one attribute and a resolver handed the whole string would have to re-implement HTML's parser to\n * find them.\n */\nfunction canvasAssetValue(tagName: string, key: string, value: string): string {\n if (!_canvasAssetResolver || value === \"\") {\n return value;\n }\n const name = key.toLowerCase();\n if (SRCSET_KEYS.has(name)) {\n const candidates = parseSrcset(value);\n let changed = false;\n const next = candidates.map((candidate) => {\n const resolved = _canvasAssetResolver?.(candidate.url, name) ?? null;\n if (resolved === null || resolved === candidate.url) {\n return candidate;\n }\n changed = true;\n return { descriptor: candidate.descriptor, url: resolved };\n });\n return changed ? formatSrcset(next) : value;\n }\n if (!isAssetKey(tagName, name)) {\n return value;\n }\n return _canvasAssetResolver(value, name) ?? value;\n}\n\n/** Every `url(...)` inside a CSS value, unquoted or quoted with either quote. */\nconst CSS_URL_RE = /\\burl\\(\\s*(?<q>[\"']?)(?<u>[^\"')]*)\\k<q>\\s*\\)/g;\n\n/**\n * Resolve every `url()` inside a CSS value.\n *\n * Applied to CSS rather than to a list of properties because in CSS a `url()` is ALWAYS a resource\n * reference — `background-image`, `mask`, `cursor`, `@font-face src`, `list-style-image` and every\n * shorthand that contains them — so enumerating the properties would be a list that goes stale\n * while the syntax does not.\n */\nfunction canvasStyleUrls(value: string): string {\n if (!_canvasAssetResolver || !value.includes(\"url(\")) {\n return value;\n }\n return value.replaceAll(CSS_URL_RE, (whole, quote: string, url: string) => {\n const resolved = url === \"\" ? null : (_canvasAssetResolver?.(url, \"url()\") ?? null);\n return resolved === null ? whole : `url(${quote}${resolved}${quote})`;\n });\n}\n\n/**\n * A style scalar as the canvas wants it written: assets resolved, then viewport units transposed.\n *\n * Exported because the canvas emits some CSS itself — the site-level `style` block, which never\n * passes through {@link applyStyle} — and a second implementation of \"what the canvas does to a\n * style value\" is a second thing to keep in step.\n *\n * @param {string} value - A CSS declaration value\n * @returns {string} The value as the canvas should write it\n */\nexport function canvasStyleValue(value: string): string {\n return transposeCanvasUnits(canvasStyleUrls(value));\n}\n\n/**\n * Studio-canvas prop-binding markers. When on, `bindProperty` stamps `data-jx-bound-prop=\"<key>\"`\n * on elements whose `textContent` is an invertible single-key state binding — the pure template\n * `\"${state.key}\"` or `{ \"$ref\": \"#/state/key\" }`. The studio canvas uses the marker to offer\n * inline editing of component-instance prop values; the rendered text must BE the prop value\n * verbatim, so mixed templates and deep paths are never stamped. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _stampPropBindings = false;\nexport function setStampPropBindings(on: boolean) {\n _stampPropBindings = on;\n}\n\n/** The single invertible template form: the whole string is exactly one `${state.key}` access. */\nconst PURE_STATE_TEMPLATE = /^\\s*\\$\\{\\s*state\\.(\\w+)\\s*\\}\\s*$/;\n\n/** The state key of an invertible `textContent` binding, or null (mixed template, deep path). */\nfunction boundPropKey(key: string, val: unknown, state: JxScope): string | null {\n if (!_stampPropBindings || key !== \"textContent\") {\n return null;\n }\n let sub: string | null = null;\n if (isRefObj(val)) {\n if (!val.$ref.startsWith(\"#/state/\")) {\n return null;\n }\n const rest = val.$ref.slice(\"#/state/\".length);\n sub = rest && !rest.includes(\"/\") ? rest : null;\n } else if (typeof val === \"string\") {\n sub = PURE_STATE_TEMPLATE.exec(val)?.[1] ?? null;\n }\n if (!sub) {\n return null;\n }\n // Only plain writable data entries are per-instance props. Computed/signal entries live as refs\n // In the raw scope (auto-unwrapped by the reactive proxy), and function/object entries (handlers,\n // $prototype instances) are not prop-overridable either — an instance $props write against any of\n // Them would clobber the definition's behavior, so their bindings are never marked editable.\n const stored = (toRaw(state) as Record<string, unknown>)[sub];\n if (isRef(stored) || typeof stored === \"function\") {\n return null;\n }\n if (typeof stored === \"object\" && stored !== null) {\n return null;\n }\n return sub;\n}\n\n/**\n * Build the reactive scope (state) from the document using the five-shape detection algorithm.\n *\n * @param {JxDocument} doc\n * @param {JxScope} [parentScope] Default is `{}`\n * @param {string} [base] Base URL for resolving $src imports. Default is `location.href`\n * @param {JxContext} [ctx] The mount context; absent on the legacy direct path\n * @returns {Promise<JxScope>} Reactive proxy (state)\n */\nexport async function buildScope(\n doc: JxDocument,\n parentScope: JxScope = {},\n base: string = location.href,\n ctx?: JxContext,\n) {\n // A body run without an event dispatches from the mount's root, read when it fires.\n const dispatchRoot = (): EventTarget | null => ctx?.root ?? null;\n const raw: JxScope = {};\n const defs = doc.state ?? {};\n\n /* Merge parent scope properties. A REACTIVE parent stays live: its members are read through\n accessors rather than copied, so a host that hands in a reactive record as the scope sees the\n document follow every field of it, not a snapshot of the primitives it held at mount time. A\n member the document declares itself is copied instead, so the document's own entry can still\n overwrite it — the document wins (embedding.md §3). */\n const linked = isReactive(parentScope);\n for (const key of Object.keys(parentScope)) {\n if (linked && !(key in defs)) {\n Object.defineProperty(raw, key, {\n configurable: true,\n enumerable: true,\n get: () => parentScope[key],\n set: (value: unknown) => {\n parentScope[key] = value;\n },\n });\n } else {\n raw[key] = parentScope[key];\n }\n }\n\n // Pass 0: resolve bare $prototype names via import map\n const imports = doc.imports ?? {};\n for (const [, def] of Object.entries(defs)) {\n if (isPrototypeDef(def) && !def.$src) {\n const mapped = imports[def.$prototype];\n if (mapped) {\n if (!mapped.endsWith(\".class.json\")) {\n console.warn(\n `Jx: import \"${def.$prototype}\" must map to a .class.json path, got \"${mapped}\"`,\n );\n continue;\n }\n def.$src = mapped;\n }\n }\n }\n\n // First pass: collect naked values, expanded defaults, plain objects\n for (const [key, def] of Object.entries(defs)) {\n // 1. String value\n if (typeof def === \"string\") {\n if (!def.includes(\"${\")) {\n raw[key] = def;\n } // Shape 1: naked string\n continue; // Template strings handled in second pass\n }\n\n // 2. Number, boolean, null\n if (typeof def === \"number\" || typeof def === \"boolean\" || def === null) {\n raw[key] = def;\n continue;\n }\n\n // 3. Array\n if (Array.isArray(def)) {\n raw[key] = def;\n continue;\n }\n\n // 4. Object\n if (typeof def === \"object\") {\n if (def.$prototype) {\n continue;\n } // Handled in later passes\n if (isExpressionDef(def)) {\n continue;\n } // Handled in pass 2.5\n if (isServerFnDef(def)) {\n continue;\n } // Handled in fifth pass\n if (\"default\" in def) {\n raw[key] = def.default;\n continue;\n } // Shape 2: expanded signal\n if (hasSchemaKeywords(def)) {\n continue;\n } // Shape 2b: pure type def\n raw[key] = def; // Shape 1: plain object\n }\n }\n\n // Wrap in Vue reactive proxy — deep reactivity from this point on\n const state = reactive(raw);\n\n // Second pass: template strings → computed\n for (const [key, def] of Object.entries(defs)) {\n if (typeof def === \"string\" && def.includes(\"${\")) {\n state[key] = computed(() => evaluateTemplate(def, state));\n }\n }\n\n // Pass 2.5: $expression entries (Shape 5)\n for (const [key, def] of Object.entries(defs)) {\n if (isExpressionDef(def)) {\n const node = def.$expression;\n if (isNamedFormulaDef(def)) {\n // A named formula: callable with positional args mapped onto its declared parameters.\n const params = def.parameters as (string | { name?: string; default?: unknown })[];\n state[key] = (...argValues: unknown[]) => {\n const args: Record<string, unknown> = {};\n for (const [i, p] of params.entries()) {\n const name = typeof p === \"string\" ? p : (p?.name ?? \"\");\n if (!name) {\n continue;\n }\n args[name] =\n argValues[i] === undefined && typeof p === \"object\" && p !== null && \"default\" in p\n ? p.default\n : argValues[i];\n }\n return evaluateExpression(node, state, null, { args });\n };\n } else if (isMutating(node.operator)) {\n const handler: JxEventHandler = (s, event) => evaluateExpression(node, s, event);\n state[key] = handler;\n } else {\n state[key] = computed(() => evaluateExpression(node, state, null));\n }\n }\n }\n\n // Third pass: $prototype: \"Function\" entries\n for (const [key, def] of Object.entries(defs)) {\n if (hasStructuredBody(def)) {\n // Structured body (spec §20): with parameters → a callable mapping positional args onto\n // $args names (invoked via the call operator); without → an event handler.\n const { body } = def;\n if (Array.isArray(def.parameters) && def.parameters.length > 0) {\n const params = def.parameters as (string | { name?: string; default?: unknown })[];\n state[key] = (...argValues: unknown[]) => {\n const args: Record<string, unknown> = {};\n for (const [i, p] of params.entries()) {\n const name = typeof p === \"string\" ? p : (p?.name ?? \"\");\n if (!name) {\n continue;\n }\n args[name] =\n argValues[i] === undefined && typeof p === \"object\" && p !== null && \"default\" in p\n ? p.default\n : argValues[i];\n }\n return runStatements(body, state, null, { args, target: dispatchRoot });\n };\n } else {\n const handler: JxEventHandler = (s, event) => {\n void runStatements(body, s, event ?? null, { target: dispatchRoot });\n };\n state[key] = handler;\n }\n } else if (isFunctionDef(def)) {\n state[key] = await resolveFunction(def, state, key, base);\n }\n }\n\n // Fourth pass: other $prototype entries (Request, Set, Map, etc.)\n for (const [key, def] of Object.entries(defs)) {\n if (isPrototypeDef(def)) {\n state[key] = await resolvePrototype(def, state, key, base, ctx);\n }\n }\n\n // Fifth pass: timing: \"server\" entries (dev mode — execute client-side, boundary unenforced)\n if (!(ctx?.skipServerFunctions ?? _serverFnConfig.skip)) {\n for (const [key, def] of Object.entries(defs)) {\n if (isServerFnDef(def)) {\n state[key] = await resolveServerFunction(def, state, key, base);\n }\n }\n }\n\n const rootMedia = ctx?.media ?? _rootMedia;\n if (doc.$media) {\n state[\"$media\"] = doc.$media;\n } else if (!state[\"$media\"] && Object.keys(rootMedia).length > 0) {\n state[\"$media\"] = rootMedia;\n }\n\n return state;\n}\n\n/**\n * Check whether an object contains any JSON Schema keywords. Used to discriminate Shape 2b (pure\n * type definition) from Shape 1 (naked object).\n *\n * @param {JxScope} obj\n * @returns {boolean}\n */\nfunction hasSchemaKeywords(obj: object) {\n for (const k of Object.keys(obj)) {\n if (SCHEMA_KEYWORDS.has(k)) {\n return true;\n }\n }\n return false;\n}\nexport { hasSchemaKeywords };\n\n/**\n * Evaluate a template string in the context of state and optional $map. Templates use\n * `state.varName` and `$map.item` syntax.\n *\n * @param {string} str\n * @param {JxScope} state\n * @returns {string}\n */\nfunction evaluateTemplate(str: string, state: JxScope): string {\n const $map = state?.$map as { item?: unknown; index?: number } | undefined;\n const fn = new Function(\"state\", \"$map\", \"item\", \"index\", `return \\`${str}\\``) as (\n state: JxScope,\n $map: unknown,\n item: unknown,\n index: number | undefined,\n ) => string;\n return fn(state, $map, $map?.item, $map?.index);\n}\n\n/**\n * Whether a template is ONE expression end to end — `\"${a.b}\"` rather than `\"a ${b}\"` or\n * `\"${a}${b}\"`.\n *\n * Depth-counted rather than pattern-matched. A greedy `/^\\$\\{(.+)\\}$/` also matched `\"${a} /\n * ${b}\"`, spliced the interior into `return (a} / ${b)`, and the SyntaxError became a silent null:\n * the node rendered empty and a `$head` entry shipped its own template text. A brace scan is exact\n * where a tightened regex is not — `\"${`${a}-x`}\"` is still one expression, and must keep its raw\n * value.\n *\n * Lives here rather than in the compiler because both renderers must draw the line in the same\n * place. It is what decides whether a value keeps its own type, and a value that is a boolean in\n * one renderer and the string `\"false\"` in the other is a page that changes meaning as it\n * hydrates.\n *\n * @param {string} str - Template source\n * @returns {boolean} True when the whole string is a single `${…}`\n */\nexport function isSingleExpression(str: string): boolean {\n if (!str.startsWith(\"${\") || !str.endsWith(\"}\")) {\n return false;\n }\n let depth = 0;\n for (let i = 1; i < str.length; i += 1) {\n const c = str[i];\n if (c === \"{\") {\n depth += 1;\n } else if (c === \"}\") {\n depth -= 1;\n if (depth === 0) {\n return i === str.length - 1;\n }\n }\n }\n return false;\n}\n\n/**\n * Evaluate a template for an ATTRIBUTE, keeping the expression's own type.\n *\n * `evaluateTemplate` interpolates into a string, which is what text wants and what an attribute\n * cannot afford: `\"${state.expanded}\"` has to arrive as the boolean `false`, or `booleanAttrValue`\n * never sees a boolean, `open=\"false\"` is written, and HTML reads that as open. Only a single\n * expression can carry a type at all — `\"a ${b}\"` is text by construction — which is the same line\n * `evaluateStaticTemplate` draws in the compiler, and drawing it identically is what keeps a\n * prerendered page and the same document rendered live in agreement.\n *\n * @param {string} str - Template source\n * @param {JxScope} state - Reactive scope\n * @returns {unknown} The expression's value, or the interpolated string\n */\nfunction evaluateAttrTemplate(str: string, state: JxScope): unknown {\n if (!isSingleExpression(str)) {\n return evaluateTemplate(str, state);\n }\n const $map = state?.$map as { item?: unknown; index?: number } | undefined;\n const fn = new Function(\"state\", \"$map\", \"item\", \"index\", `return (${str.slice(2, -1)})`) as (\n state: JxScope,\n $map: unknown,\n item: unknown,\n index: number | undefined,\n ) => unknown;\n return fn(state, $map, $map?.item, $map?.index);\n}\n\n// ─── Step 2b: Function resolution (Shape 4) ─────────────────────────────────\n\n/** Shape of a dynamically imported module: named exports plus an optional default. */\ntype ImportedModule = Record<string, unknown> & { default?: Record<string, unknown> };\n\n/** Minimal contract an externally-imported resolver class may implement. */\ninterface ExternalClassInstance {\n value?: unknown;\n resolve?: () => unknown;\n subscribe?: (cb: (newVal: unknown) => void) => void;\n}\n\n/** Module cache for $src imports (shared with external class resolution). */\nconst _moduleCache = new Map<string, ImportedModule>();\n\n/** A module the host will import on first use, keyed as the document spells its `$src`. */\ntype ModuleLoader = () => Promise<Record<string, unknown>>;\n\n/**\n * Lazy registrations: a loader until it runs, then the in-flight load, so two entries resolving the\n * same sidecar in one tick share one import rather than racing two.\n */\nconst _moduleLoaders = new Map<string, ModuleLoader | Promise<ImportedModule>>();\n\n/**\n * Seed the `$src` module cache with a module the host already imported, under the specifier the\n * document spells. A bundled document cannot have its sidecar fetched by URL — the bundler saw\n * neither the string nor the file — so the host imports the sidecar itself and registers it here,\n * and `$src` then resolves exactly as it would have from the network.\n *\n * Given a FUNCTION instead of a namespace, the registration is lazy: nothing is imported until a\n * document names the specifier, and the loader runs once. That is the shape for a host that can\n * bundle a sidecar as its own chunk but should not pay for it until something renders — Studio's\n * canvas frame registers every kit behaviour this way, so a page that uses no kit element loads\n * none of them (embedding.md §6).\n *\n * @param {string} specifier - The `$src` value as written in the document\n * @param {Record<string, unknown> | (() => Promise<Record<string, unknown>>)} mod - The imported\n * module namespace, or a loader that imports it on first use\n */\nexport function preloadModule(\n specifier: string,\n mod: Record<string, unknown> | ModuleLoader,\n): void {\n if (typeof mod === \"function\") {\n _moduleCache.delete(specifier);\n _moduleLoaders.set(specifier, mod);\n return;\n }\n _moduleLoaders.delete(specifier);\n _moduleCache.set(specifier, mod as ImportedModule);\n}\n\n/**\n * The module a specifier was seeded with — imported, or lazily registered — or undefined when the\n * host said nothing about it and the network is the answer.\n *\n * SYNCHRONOUS for a namespace the host imported, and that is load-bearing rather than tidy: a cache\n * hit used to be a `Map#has` on the way through `resolveFunction`, and an `await` there — even of a\n * value that is not a promise — defers one microtask, which reorders every element's scope\n * construction against its siblings'. The kit's field naming its slotted control is one thing that\n * order decides. Only a loader is a promise, because only a loader has to be.\n *\n * @param {string} src\n * @returns {ImportedModule | Promise<ImportedModule> | undefined}\n */\nfunction seededModule(src: string): ImportedModule | Promise<ImportedModule> | undefined {\n const cached = _moduleCache.get(src);\n if (cached) {\n return cached;\n }\n const pending = _moduleLoaders.get(src);\n if (!pending) {\n return undefined;\n }\n if (typeof pending !== \"function\") {\n return pending;\n }\n /* `Promise.resolve` so a thenable from a host's loader is still a Promise the call sites can\n tell from a namespace. */\n const load = Promise.resolve(pending()).then(\n (mod) => {\n _moduleCache.set(src, mod as ImportedModule);\n _moduleLoaders.delete(src);\n return mod as ImportedModule;\n },\n (error: unknown) => {\n /* A failed load — a chunk the network dropped — puts the loader back, so the next document to\n name the specifier tries again rather than inheriting this rejection for good. */\n _moduleLoaders.set(src, pending);\n throw error;\n },\n );\n _moduleLoaders.set(src, load);\n return load;\n}\n\n/**\n * Resolve a $prototype: \"Function\" entry into a function or computed.\n *\n * Functions receive state as their first parameter at call time. Functions with a return statement\n * in their body are wrapped in computed() for reactive evaluation.\n *\n * @param {JxFunctionDef} def - State entry with $prototype: \"Function\"\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key name\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<unknown>}\n */\nasync function resolveFunction(def: JxFunctionDef, state: JxScope, key: string, base?: string) {\n if (def.body && def.$src) {\n throw new Error(`Jx: '${key}' declares both body and $src — these are mutually exclusive`);\n }\n if (!def.body && !def.$src) {\n const params = resolveParamNames(def);\n const noop = new Function(...params, \"\");\n Object.defineProperty(noop, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n return noop;\n }\n\n let fn: ((...args: unknown[]) => unknown) | undefined;\n\n if (typeof def.body === \"string\") {\n const params = resolveParamNames(def);\n fn = new Function(...params, def.body) as (...args: unknown[]) => unknown;\n Object.defineProperty(fn, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n } else {\n // $src: dynamic import (the body/$src dichotomy was validated above)\n const src = def.$src;\n if (!src) {\n throw new Error(`Jx: '${key}' has neither body nor $src`);\n }\n const exportName = def.$export ?? key;\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n if (base) {\n const resolvedSrc = new URL(src, base).href;\n try {\n mod = (await import(resolvedSrc)) as ImportedModule;\n } catch {\n mod = (await import(src)) as ImportedModule;\n }\n } else {\n mod = (await import(src)) as ImportedModule;\n }\n _moduleCache.set(src, mod);\n }\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (typeof candidate !== \"function\") {\n throw new TypeError(`Jx: export \"${exportName}\" not found or not a function in \"${src}\"`);\n }\n fn = candidate as (...args: unknown[]) => unknown;\n }\n\n // Detect computed: body contains a return statement, or $src function introspection.\n // Functions with parameters (event handlers, callbacks) are never computed.\n const hasParams = (def.parameters ?? def.arguments ?? []).length > 0;\n let isComputed = false;\n if (!hasParams) {\n if (typeof def.body === \"string\") {\n isComputed = bodyReturnsValue(def.body);\n } else if (fn) {\n isComputed = fn.length <= 1 && bodyReturnsValue(fn.toString());\n }\n }\n if (isComputed) {\n return computed(() => fn(state));\n }\n\n return fn;\n}\n\n// ─── Step 3: Render ───────────────────────────────────────────────────────────\n\n/**\n * Extract parameter names from a function definition. Supports both legacy \"arguments\" (string\n * array) and CEM-compatible \"parameters\" (object array). Always ensures \"state\" is the first\n * parameter.\n *\n * @param {JxFunctionDef | JxPrototypeDef} def\n * @returns {string[]}\n */\nfunction resolveParamNames(def: JxFunctionDef | JxPrototypeDef) {\n const names = def.parameters ? paramNames(def.parameters) : (def.arguments ?? []);\n return names.length > 0 && names[0] === \"state\" ? names : [\"state\", ...names];\n}\n\n/**\n * Reserved Jx keys — never set as DOM properties.\n *\n * @type {Set<string>}\n */\nexport const RESERVED_KEYS = new Set([\n \"$schema\",\n \"$id\",\n \"$defs\",\n \"state\",\n \"$ref\",\n \"$props\",\n \"$elements\",\n \"$title\",\n \"$description\",\n \"$switch\",\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"$media\",\n \"$map\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n \"tagName\",\n \"children\",\n \"style\",\n \"attributes\",\n \"items\",\n \"map\",\n \"filter\",\n \"sort\",\n \"cases\",\n \"observedAttributes\",\n]);\n\n/**\n * Recursively render a Jx element definition into a DOM element.\n *\n * @param {JxElement | string | number | boolean} def\n * @param {JxScope} state - Reactive scope proxy (or child scope via Object.create)\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement | Text}\n */\n/** Refs already warned about, so the §13 diagnostic fires once per distinct target. */\nconst warnedRefChildren = new Set<string>();\n\n/** Foreign-content namespaces the HTML parser switches into, and the runtime must too. */\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\nconst MATHML_NS = \"http://www.w3.org/1998/Math/MathML\";\n\n/**\n * The namespace an element belongs in, given the one its parent established.\n *\n * The static build emits markup text, so the HTML parser applied foreign-content rules for it and\n * SVG worked there. The runtime built every node with `document.createElement`, which is HTML-only,\n * so the same document rendered blank in the Studio canvas and in any hydrated component — the\n * editor and the deployed site disagreeing, with only the editor wrong.\n *\n * @param {string} tagName\n * @param {string | null | undefined} inherited - The namespace the parent element established\n * @returns {string | null} Null means HTML\n */\nfunction elementNamespace(tagName: string, inherited: string | null | undefined): string | null {\n if (tagName === \"svg\") {\n return SVG_NS;\n }\n if (tagName === \"math\") {\n return MATHML_NS;\n }\n return inherited ?? null;\n}\n\nexport function renderNode(\n def: JxElement | string | number | boolean,\n state: JxScope,\n options?: JxRenderOptions,\n): HTMLElement | Text {\n const path = options?._path ?? [];\n\n // Text node children: bare strings/numbers/booleans produce DOM Text nodes\n if (typeof def === \"string\" || typeof def === \"number\" || typeof def === \"boolean\") {\n const textNode = document.createTextNode(String(def));\n if (typeof def === \"string\" && isTemplateString(def)) {\n effect(() => {\n textNode.textContent = evaluateTemplate(def, state);\n });\n }\n return textNode;\n }\n\n // Extend scope with any $-prefixed local bindings declared on this node\n let localState: JxScope = state;\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"$\") && !RESERVED_KEYS.has(key)) {\n if (localState === state) {\n localState = Object.create(state) as JxScope;\n }\n localState[key] = isRefObj(val) ? resolveRef(val.$ref, state) : val;\n }\n }\n\n /*\n * §13 diagnostic: a node-level external `$ref` (the withdrawn component-instance syntax) has no\n * tagName and silently renders an empty <div>. Warn once per target instead of failing silently —\n * the supported mechanism is $elements + a custom-element tag (see spec §13).\n */\n if (\"$ref\" in def && !def.tagName) {\n const refTarget = String((def as { $ref?: unknown }).$ref ?? \"\");\n if (!warnedRefChildren.has(refTarget)) {\n warnedRefChildren.add(refTarget);\n console.warn(\n `Jx: a $ref child (\"${refTarget}\") is not a supported component instance; register the ` +\n `component in $elements and use its custom-element tag instead (spec §13).`,\n );\n }\n }\n\n /* RESOLVED ONCE, HERE, before anything branches on it.\n A tag may be a name or a choice between names (`ElementTagName`). Resolving at the top means\n every test below — the hyphen check that routes to the custom-element path, `customElements.get`,\n `createElement` itself — sees a literal, exactly as it did when a tag could only be written out.\n\n It is not tracked. `tagName` is in RESERVED_KEYS so no binding sweep reaches it, and a tag that\n changed after mount would mean replacing the node: the subtree's listeners, its focus, its typed\n input values and its component instances all go with it, and this runtime has no dispose walk to\n pay that bill (renderSwitch, two hundred lines up, still leaks its previous case's effects).\n `jx validate` warns when a tag discriminant is also an assignment target, so the case where this\n rule bites is caught before it ships rather than found as a `<div>` that never became an `<a>`. */\n const tagName = resolveTagName(def.tagName, localState);\n const isCustomEl = tagName.includes(\"-\") && customElements.get(tagName);\n\n if (def.$props && isCustomEl) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n\n if (def.$props) {\n // A hyphenated tag carrying $props is a component instance whose definition has not finished\n // Registering yet (async defineElement — e.g. the Studio desktop canvas, where the component\n // Fetch can land after this node renders). Render via the property-first path anyway: it sets\n // The instance props as JS properties on the bare element, which the eventual upgrade's\n // ConnectedCallback reads back off `this` (see the def.state merge below), so the instance's\n // Props win. The old branch stripped the props here, so a late upgrade painted the component's\n // State DEFAULTS instead (\"0\"/\"DESCRIPTION\" for every instance). A non-custom tag can never\n // Upgrade, so it keeps the historical mergeProps-into-scope behavior.\n if (tagName.includes(\"-\")) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n const { $props: _$props, ...rest } = def;\n return renderNode(rest, mergeProps(def, localState), options);\n }\n if (def.$switch) {\n return renderSwitch(def, localState, options);\n }\n\n const ns = elementNamespace(tagName, options?._ns);\n /*\n * `foreignObject` is itself an SVG element, and is the documented way back into HTML: its\n * DESCENDANTS are HTML, so the element and its children carry different namespaces.\n */\n const childNs = tagName === \"foreignObject\" ? null : ns;\n /*\n * A namespaced node comes back as Element; every apply* helper below is typed for HTMLElement\n * and touches only members both share (style, dataset, setAttribute, append).\n */\n const el = (ns\n ? document.createElementNS(ns, tagName)\n : document.createElement(tagName)) as unknown as HTMLElement;\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path, def, localState);\n }\n\n applyProperties(el, def, localState);\n /* A custom element's own definition applies its style at connection, through the same interning\n path — which releases whatever is already on the element. So the call site's style is\n remembered here and merged there; see {@link callSiteStyles}. */\n if (def.style && tagName.includes(\"-\")) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(\n el,\n def.style ?? {},\n (localState[\"$media\"] as Record<string, string>) ?? {},\n localState,\n );\n applyAttributes(el, def.attributes ?? {}, localState);\n\n const kids = def.children;\n if (isMappedArray(kids)) {\n // Legacy whole-children repeater: the items render directly into `el` (which keeps its own\n // TagName, e.g. <ul>), with no extra wrapper element.\n const arrOpts =\n options || childNs ? { ...options, _ns: childNs, _path: [...path, \"children\"] } : undefined;\n renderMappedArrayInto(el, kids, localState, arrOpts);\n } else if (Array.isArray(kids)) {\n for (let i = 0; i < kids.length; i++) {\n const child = kids[i]!;\n const childOpts =\n options || childNs\n ? { ...options, _ns: childNs, _path: [...path, \"children\", i] }\n : undefined;\n if (isMappedArray(child)) {\n // Array pseudo-element among siblings: expand inline, no wrapper.\n renderMappedArrayInto(el, child, localState, childOpts);\n } else {\n el.append(renderNode(child, localState, childOpts));\n }\n }\n }\n\n return el;\n}\n\n// ─── Template string utilities ────────────────────────────────────────────────\n\n/**\n * Check if a value is a template string (contains ${}).\n *\n * @param {unknown} val\n * @returns {boolean}\n */\n// ─── Property / style / attribute application ─────────────────────────────────\n\n/**\n * @param {HTMLElement} el\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction applyProperties(el: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (RESERVED_KEYS.has(key)) {\n continue;\n }\n if (key.startsWith(\"$\")) {\n continue;\n } // Scope bindings — handled in renderNode\n\n if (key.startsWith(\"on\") && bindHandler(el, key, val, state)) {\n continue;\n }\n\n bindProperty(el, key, val, state);\n }\n}\n\n/**\n * Attach an `on*` key as an event listener, in any of the four spellings a handler has: a `$ref` to\n * a function, a structured body (spec §20), a string body, or an `$expression`. Returns false for a\n * value that is none of those, which the caller then writes as a plain property.\n *\n * @param {HTMLElement} el\n * @param {string} key The `on`-prefixed key\n * @param {unknown} val\n * @param {JxScope} state\n * @returns {boolean} Whether a listener was attached\n */\nfunction bindHandler(el: HTMLElement, key: string, val: unknown, state: JxScope): boolean {\n const type = key.slice(2);\n const scope = state;\n if (isRefObj(val)) {\n const handler = resolveRef(val.$ref, state);\n if (typeof handler === \"function\") {\n const handlerFn = handler as (s: JxScope, e: Event) => unknown;\n el.addEventListener(type, (e) => handlerFn(scope, e));\n }\n return true;\n }\n if (hasStructuredBody(val)) {\n const { body } = val;\n el.addEventListener(type, (e) => {\n void runStatements(body, scope, e);\n });\n return true;\n }\n if (isFunctionDef(val) && typeof val.body === \"string\") {\n const params = resolveParamNames(val);\n const fn = new Function(...params, val.body) as (s: JxScope, e: Event) => unknown;\n el.addEventListener(type, (e) => fn(scope, e));\n return true;\n }\n if (isExpressionDef(val)) {\n const node = val.$expression;\n el.addEventListener(type, (e) => evaluateExpression(node, scope, e));\n return true;\n }\n return false;\n}\n\n/**\n * A definition's root-level `on*` keys listen on the HOST element, exactly as they would on an\n * element in a document. Only handler keys are read here: the rest of a definition's root —\n * `observedAttributes`, `emits`, `description` — describes the element rather than styling an\n * instance, and is not written onto it.\n *\n * @param {HTMLElement} host\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction bindDefinitionHandlers(host: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"on\") && !RESERVED_KEYS.has(key)) {\n bindHandler(host, key, val, state);\n }\n }\n}\n\n/**\n * @param {HTMLElement} el\n * @param {string} key\n * @param {unknown} val\n * @param {JxScope} state\n */\nfunction bindProperty(el: HTMLElement, key: string, val: unknown, state: JxScope) {\n const target = el as unknown as Record<string, unknown>;\n const boundProp = boundPropKey(key, val, state);\n if (boundProp) {\n el.dataset.jxBoundProp = boundProp;\n }\n /* An `<img>` in a document says `{\"tagName\": \"img\", \"src\": \"/hero.jpg\"}`, so `src` arrives HERE\n as a top-level key and is written as a DOM PROPERTY — `attributes: { src }` is the rarer\n spelling. Both are the same reference and both need the same resolution. */\n const asAsset = (resolved: unknown): unknown =>\n typeof resolved === \"string\" ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n /*\n * `className` on an SVGElement is a read-only SVGAnimatedString, so assigning it throws in the\n * strict mode an ES module always runs under. It is the most common Jx element property, so the\n * attribute form is the only one that works on both.\n */\n const write = (resolved: unknown): void => {\n const node = el as unknown as Element;\n if (key === \"className\" && !(node instanceof HTMLElement)) {\n node.setAttribute(\"class\", resolved == null ? \"\" : String(resolved));\n return;\n }\n /* An equal write is skipped. A binding re-runs whenever anything it read changes, not only\n when its own result does, and re-setting `value` on a focused control is not free: it can\n move the caret and collapse the selection. A control that already holds the value has\n nothing to learn from being told again. */\n if (target[key] === resolved) {\n return;\n }\n target[key] = resolved;\n };\n if (isRefObj(val)) {\n const refVal = val as { $ref: string };\n if (key === \"id\") {\n target[key] = resolveRef(refVal.$ref, state) as string;\n return;\n }\n effect(() => {\n write(asAsset(resolveRef(refVal.$ref, state)));\n });\n return;\n }\n\n // Universal ${} reactivity — template strings in element properties\n if (isTemplateString(val)) {\n effect(() => {\n write(asAsset(evaluateTemplate(val as string, state)));\n });\n return;\n }\n\n write(asAsset(val));\n}\n\n/*\n * ─── The Stylesheet Engine ───────────────────────────────────────────────────\n *\n * An authored `style` object becomes REAL CSS RULES, delivered through the document's\n * `adoptedStyleSheets`. Everything below exists to make that true, and the reason it has to be\n * true is a cascade inversion rather than a missing feature.\n *\n * `applyStyle` used to split one style object across two cascade ORIGINS: a top-level scalar went\n * inline (`el.style.color = …`) while an object-valued key became a per-element `<style>` tag. An\n * inline declaration beats any non-`!important` rule, so\n *\n * { \"backgroundColor\": \"#6e0303\", \":hover\": { \"backgroundColor\": \"#15164a\" } }\n *\n * emitted a perfectly correct `:hover` rule that could never win. Nesting was not missing; it was\n * outranked. The one existing defence, `mediaOverriddenProps`, moved a base property out of inline\n * when an `@`-block overrode it — one level deep, `@`-keys only, never `:hover` — which is the\n * shape of the bug rather than a fix for it. Every style assertion in the suite read the `<style>`\n * tag's text, so the inversion was invisible to all of them.\n *\n * With every declaration in a rule, `:hover` versus base is an ordinary equal-specificity pair and\n * source order decides, exactly as it does on the compiled page.\n *\n * **Three sheet roles, because mutation cost scales with sheet size.** Measured in Chrome 152 over\n * 500 styled elements: 500 `<style>` tags cost 86.0ms to build, one adopted sheet with hash dedup\n * costs 1.7ms, and 500 separate adopted sheets cost 6.2ms to build but 84.1ms per style recalc\n * because each one is walked. On the update path (300 value edits, the Style-panel hot path)\n * mutating a rule inside one big shared sheet costs 295.7ms, because Chrome rebuilds the whole\n * sheet's RuleSet on any mutation. So:\n *\n * - the SHARED sheet holds every static, interned rule set and is grown but never rewritten;\n * - a reactive declaration is indirected through a custom property, so the rule is static text\n * and the update writes `el.style.setProperty(\"--jx-r0-0\", v)` — 12.4ms, and independent of\n * sheet size (the same mechanism that makes `${…}` work inside a nested block at all);\n * - the SCRATCH sheet takes the elements under live Studio edit and is rewritten with\n * `replaceSync`, 7.5ms per 100 structural edits against 76.9ms for delete+insert in the big one.\n *\n * **The handle stays `data-jx`, and its value becomes a content hash.** Not a generated class:\n * `applyAttributes` runs after `applyStyle`, so a static `attributes: { class: … }` would wipe a\n * class handle. `data-jx` is already there, is specificity (0,1,0), and is not author-writable.\n * Hashing the built rule text rather than calling `Math.random()` is what gives dedup and SSR\n * stability, and it covers everything that varies per call site by construction — the authored\n * object, the resolved `$media` map and the canvas transposer state are all inputs to that text.\n *\n * **Jx emits no cascade layer of its own.** Third-party CSS arrives through `$head` unlayered, and\n * an unlayered rule beats a layered one at any specificity — so layering Jx's own rules would hand\n * every page's `$head` a win it does not have today. It is also what keeps the canvas's\n * `@layer jx-canvas-ua` UA emulation working now that base declarations are unlayered rules rather\n * than inline styles: unlayered still beats layered, which is the same direction author origin\n * beats UA origin on the shipped page.\n */\n\n/** A rule set as it was written into a sheet: the texts, plus the live rules when there are any. */\ninterface InsertedRules {\n texts: readonly string[];\n rules: CSSRule[];\n}\n\n/** A place rules can be written. Two implementations: the CSSOM, and `<style>` text. */\ninterface StyleSink {\n insert: (texts: readonly string[]) => InsertedRules;\n remove: (inserted: InsertedRules) => void;\n /** Rewrite the whole sink. Used only by the scratch sheet. */\n replaceAll: (texts: readonly string[]) => void;\n /** Everything written, in sheet order. See {@link documentStyleText}. */\n text: () => string;\n detach: () => void;\n}\n\n/**\n * A sink over a real `CSSStyleSheet` — constructable and adopted, or a `<style>` element's own.\n *\n * @param {CSSStyleSheet} sheet\n * @param {() => void} detach\n * @returns {StyleSink}\n */\nfunction cssomSink(sheet: CSSStyleSheet, detach: () => void): StyleSink {\n const entries: InsertedRules[] = [];\n return {\n detach,\n insert(texts) {\n const rules: CSSRule[] = [];\n for (const text of texts) {\n const index = sheet.cssRules.length;\n try {\n sheet.insertRule(text, index);\n } catch {\n /* One unparseable rule must not take the other twenty with it. A `<style>` element drops\n exactly the offending rule and keeps going; `insertRule` throws, so this restores the\n tolerance an author's stylesheet has always had. */\n continue;\n }\n const rule = sheet.cssRules[index];\n if (rule) {\n rules.push(rule);\n }\n }\n const inserted: InsertedRules = { rules, texts };\n entries.push(inserted);\n return inserted;\n },\n remove(inserted) {\n const at = entries.indexOf(inserted);\n if (at !== -1) {\n entries.splice(at, 1);\n }\n if (inserted.rules.length === 0) {\n return;\n }\n /* An index scan of a 302-rule sheet measures 0.04ms, so finding the rules costs nothing next\n to the RuleSet rebuild the deletion itself forces. Descending, or each deletion shifts the\n indices still to be removed. */\n const list = [...sheet.cssRules];\n const indices = inserted.rules\n .map((rule) => list.indexOf(rule))\n .filter((index) => index >= 0)\n .toSorted((a, b) => b - a);\n for (const index of indices) {\n sheet.deleteRule(index);\n }\n inserted.rules.length = 0;\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n sheet.replaceSync(texts.join(\"\\n\"));\n },\n text() {\n return entries.flatMap((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n },\n };\n}\n\n/**\n * The last resort: a `<style>` element whose text is rewritten. No CSSOM required.\n *\n * @param {HTMLStyleElement} tag\n * @returns {StyleSink}\n */\nfunction textSink(tag: HTMLStyleElement): StyleSink {\n const entries: InsertedRules[] = [];\n const write = () => {\n tag.textContent = entries.map((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n };\n return {\n detach() {\n tag.remove();\n },\n insert(texts) {\n const inserted: InsertedRules = { rules: [], texts };\n entries.push(inserted);\n write();\n return inserted;\n },\n remove(inserted) {\n const index = entries.indexOf(inserted);\n if (index !== -1) {\n entries.splice(index, 1);\n write();\n }\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n write();\n },\n text() {\n return tag.textContent ?? \"\";\n },\n };\n}\n\n/**\n * Open a sheet on `doc`, preferring a constructable one.\n *\n * A constructable stylesheet cannot be adopted into another document, which is why the registry\n * below is keyed on the document and never cached at module scope: the Studio iframe, the live\n * preview tab and the parent page each open their own.\n *\n * @param {Document} doc\n * @returns {StyleSink}\n */\nfunction openSink(doc: Document): StyleSink {\n const view = doc.defaultView as (Window & { CSSStyleSheet?: typeof CSSStyleSheet }) | null;\n const SheetConstructor = view?.CSSStyleSheet;\n if (typeof SheetConstructor === \"function\" && Array.isArray(doc.adoptedStyleSheets)) {\n try {\n const sheet = new SheetConstructor();\n doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];\n return cssomSink(sheet, () => {\n doc.adoptedStyleSheets = doc.adoptedStyleSheets.filter((s) => s !== sheet);\n });\n } catch {\n // No constructable stylesheets, or a frozen adoptedStyleSheets. Fall through to a tag.\n }\n }\n const tag = doc.createElement(\"style\");\n tag.dataset.jxSheet = \"\";\n (doc.head ?? doc.documentElement).append(tag);\n return tag.sheet ? cssomSink(tag.sheet, () => tag.remove()) : textSink(tag);\n}\n\n/** One interned rule set: the rules as written, and how many elements point at them. */\ninterface InternEntry {\n inserted: InsertedRules;\n refs: number;\n}\n\n/** Everything one document's rules are kept in. */\ninterface SheetState {\n shared: StyleSink;\n /** Opened on the first live edit, and only then — most documents never have one. */\n scratch: StyleSink | null;\n /** Elements living on the scratch sheet, in the order their rules are written. */\n scratchOwners: Map<HTMLElement, readonly string[]>;\n /** Scope handle to the rule set it names. */\n interned: Map<string, InternEntry>;\n /** Declaration-body at-rule text to the one copy of it. */\n hoisted: Map<string, InternEntry>;\n /** Distinguishes `--jx-r<serial>-<n>` variables between elements. */\n serial: number;\n}\n\n/**\n * The per-document registry. A `WeakMap` rather than a module-level singleton because one process\n * renders into several documents (canvas iframe, preview tab, parent) and a constructable sheet\n * belongs to exactly one of them.\n */\nconst sheetStates = new WeakMap<Document, SheetState>();\n\n/**\n * @param {Document} doc\n * @returns {SheetState}\n */\nfunction sheetStateFor(doc: Document): SheetState {\n const existing = sheetStates.get(doc);\n if (existing) {\n return existing;\n }\n const created: SheetState = {\n hoisted: new Map(),\n interned: new Map(),\n scratch: null,\n scratchOwners: new Map(),\n serial: 0,\n shared: openSink(doc),\n };\n sheetStates.set(doc, created);\n return created;\n}\n\n/** What one element holds, so that releasing it is exact rather than approximate. */\ninterface ElementStyleEntry {\n doc: Document;\n /** The state this entry's handles belong to; a reset replaces it and orphans them. */\n state: SheetState;\n uid: string;\n /** The interning key in the shared sheet, or null when the element is on the scratch sheet. */\n interned: string | null;\n /** Hoisted declaration at-rules this element holds a reference to. */\n hoisted: readonly string[];\n /** The `--jx-r…` custom properties its effects write inline. */\n vars: readonly string[];\n /** Stops those effects. */\n stop: (() => void) | null;\n}\n\n/**\n * Per-element style bookkeeping. The replacement for the old `elementStyleTags`, which exported a\n * `<style>` element and let its importers remove it by hand; {@link releaseElementStyles} is the\n * documented teardown in its place, because a rule set is now refcounted and dropping one by hand\n * would either leak it or take it away from another element that shares it.\n */\nconst elementStyles = new WeakMap<HTMLElement, ElementStyleEntry>();\n\n/** The scope handle `buildStyleRules` writes, before the hash of its own output replaces it. */\nconst SCOPE_TOKEN = \"\u0001jx-scope\u0001\";\n\n/**\n * Rewrite the scratch sheet from its owners.\n *\n * `scratchOwners` is a STRONG map — it has to be, since the sheet's whole text is rebuilt from it —\n * so an element only leaves it through {@link releaseElementStyles}. That is not a hole: every way\n * an edited element can go away calls it. `applyStyle` registers it with the enclosing reactive\n * scope, Studio's `disposeSubtree` calls it per element, and `resetDocumentStyles` drops the map\n * wholesale. Sweeping on `isConnected` instead would be wrong rather than merely redundant: an\n * element is routinely styled before it is inserted.\n *\n * Both call sites reach this only once an element is already IN `scratchOwners`, and the only place\n * that happens (`scratchOwners.set`, below) always opens `scratch` first — so it is never still\n * null here.\n *\n * @param {SheetState} state\n */\nfunction rewriteScratch(state: SheetState) {\n state.scratch!.replaceAll([...state.scratchOwners.values()].flat());\n}\n\n/**\n * Drop one reference to an interned rule set, removing its rules when the last one goes.\n *\n * `key` always names an entry `retainInterned` already created: {@link releaseElementStyles}'s two\n * call sites pass back exactly the `entry.interned`/`entry.hoisted` keys it was handed at\n * `retainInterned` time, and a stale `state` (one `resetDocumentStyles` already replaced) is turned\n * away before either call site is reached.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n */\nfunction releaseInterned(state: SheetState, table: Map<string, InternEntry>, key: string) {\n const entry = table.get(key)!;\n entry.refs -= 1;\n if (entry.refs <= 0) {\n table.delete(key);\n state.shared.remove(entry.inserted);\n }\n}\n\n/**\n * Take one reference to a rule set, inserting it the first time it is asked for.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n * @param {readonly string[]} texts\n */\nfunction retainInterned(\n state: SheetState,\n table: Map<string, InternEntry>,\n key: string,\n texts: readonly string[],\n) {\n const existing = table.get(key);\n if (existing) {\n existing.refs += 1;\n return;\n }\n table.set(key, { inserted: state.shared.insert(texts), refs: 1 });\n}\n\n/**\n * Release everything {@link applyStyle} gave an element: its rules, its scope handle, and the inline\n * custom properties and effects behind its reactive declarations.\n *\n * This is the teardown API `elementStyleTags` used to stand in for, and it is exported because\n * removing a rule set by hand is no longer possible: sets are shared between elements that style\n * alike, so the only safe removal is a refcounted one. Calling it on an element that has no styles\n * is a no-op, which is what makes `applyStyle` safe to call twice.\n *\n * Callers rarely need it. `applyStyle` registers it with the enclosing reactive scope, so an\n * element discarded by a re-rendering mapped array or a disposed Studio subtree releases itself.\n *\n * @param {HTMLElement} el\n * @param {ElementStyleEntry} [only] - Release only if this is still the element's current entry\n */\nexport function releaseElementStyles(el: HTMLElement, only?: ElementStyleEntry): void {\n const entry = elementStyles.get(el);\n if (!entry || (only !== undefined && entry !== only)) {\n return;\n }\n elementStyles.delete(el);\n entry.stop?.();\n for (const name of entry.vars) {\n el.style.removeProperty(name);\n }\n delete el.dataset.jx;\n /* A `resetDocumentStyles` between the two replaces the state, and its sheets are already gone —\n so the element-local half above always runs and the sheet half is skipped as already done. */\n if (sheetStates.get(entry.doc) !== entry.state) {\n return;\n }\n const { state } = entry;\n if (entry.interned === null) {\n if (state.scratchOwners.delete(el)) {\n rewriteScratch(state);\n }\n } else {\n releaseInterned(state, state.interned, entry.interned);\n }\n for (const key of entry.hoisted) {\n releaseInterned(state, state.hoisted, key);\n }\n}\n\n/**\n * Discard every sheet this runtime opened on a document, and orphan the element entries that point\n * into them.\n *\n * A full re-render replaces the whole tree, so the alternative is a shared sheet that only ever\n * grows. The element `WeakMap` cannot be enumerated to be cleared, so entries are invalidated\n * instead: each one records the `SheetState` it was written into, and a release that finds a\n * different state registered for the document does the element-local half only. That is what stops\n * a surviving element from later handing `deleteRule` an index into a sheet nobody is reading.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n */\nexport function resetDocumentStyles(doc: Document = document): void {\n const state = sheetStates.get(doc);\n if (!state) {\n return;\n }\n sheetStates.delete(doc);\n for (const el of state.scratchOwners.keys()) {\n elementStyles.delete(el);\n delete el.dataset.jx;\n }\n state.scratchOwners.clear();\n state.interned.clear();\n state.hoisted.clear();\n state.shared.detach();\n state.scratch?.detach();\n}\n\n/**\n * The CSS this engine has written into a document, in sheet order.\n *\n * It reports what the engine ASKED the document to adopt, not what the document managed to parse,\n * and the difference is the point: `insertRule` throws on a rule the host cannot parse, and the\n * sink swallows that so one bad rule cannot take the rest of an element's set with it. The test DOM\n * rejects `@position-try` outright, so reading it back off `cssRules` there would report a block\n * that a browser adopts perfectly well as missing.\n *\n * It is also the honest answer to \"what CSS did my style object become\", which is a question the\n * Studio style inspector asks and, before this, nothing could answer without scraping `<style>`\n * tags out of the head.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n * @returns {string} One rule per line, shared sheet first\n * @docs framework/concepts/styling\n */\nexport function documentStyleText(doc: Document = document): string {\n const state = sheetStates.get(doc);\n if (!state) {\n return \"\";\n }\n return [state.shared.text(), state.scratch?.text() ?? \"\"].filter(Boolean).join(\"\\n\");\n}\n\n/**\n * Whether a style object declares `display` anywhere in it.\n *\n * `defineElement` gives a custom element `display: block` because a custom element defaults to\n * `inline` and Jx containers behave like `<div>`. It used to test `this.style.display`, which was a\n * correct test only while the author's own `display` was written inline — the moment it became a\n * rule the guard stopped seeing it and the default started overriding the author. The test is now\n * on the source rather than on the element, and it is a deep one on purpose: an inline default\n * would beat a `:hover` or `@media` `display` just as surely as a base one.\n *\n * A `@keyframes` block is the one thing the walk does NOT descend into. A `display` in a keyframe\n * stop is a point on a timeline, not a declaration on this element — animating `display` is the\n * ordinary shape of an `allow-discrete` reveal — so counting one as the author's own left the\n * element with no `display` at all, and a custom element with no `display` is `inline`. The element\n * laid out wrongly whenever it was still, which is most of the time.\n *\n * @param {JxStyle | undefined} style\n * @returns {boolean}\n */\nfunction declaresDisplay(style: JxStyle | undefined): boolean {\n /* The BASE block only. A deep walk read a `display` that exists solely inside `&:hover` or an\n `@media` block as \"the author supplied one\", so the element stayed `inline` at rest and\n became a block on hover — a live trap rather than a subtlety. An author who wants the\n platform's own default writes `display: revert` in the base block, which this sees. */\n return Boolean(style) && typeof style === \"object\" && \"display\" in style;\n}\n\n/**\n * The `style` object a USAGE SITE wrote on a custom element, kept until the element connects.\n *\n * Weak in the element, so an instance that is never connected is collected with its entry.\n */\nconst callSiteStyles = new WeakMap<HTMLElement, JxStyle>();\n\n/**\n * Merge two style objects, `over` winning.\n *\n * Deep, because a nested selector block is a rule of its own: a call site that declares `&:hover`\n * must not delete the definition's `&:hover`, only the declarations it repeats inside it. A scalar\n * always replaces, which is what \"the call site wins\" means.\n *\n * @param base The definition's style.\n * @param over The usage site's, if any.\n * @returns {JxStyle} A new object; neither argument is mutated.\n */\nfunction mergeStyle(base: JxStyle, over: JxStyle | undefined): JxStyle {\n if (!over) {\n return base;\n }\n const out: Record<string, unknown> = { ...(base as Record<string, unknown>) };\n for (const [key, value] of Object.entries(over as Record<string, unknown>)) {\n const prior = out[key];\n out[key] =\n prior !== null &&\n typeof prior === \"object\" &&\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value)\n ? mergeStyle(prior as JxStyle, value as JxStyle)\n : value;\n }\n return out as JxStyle;\n}\n\n/**\n * Turn an element's `style` object into CSS rules and adopt them.\n *\n * Nothing is written inline except the `--jx-r…` custom properties that carry reactive values, so\n * an authored `:hover`, `@media` or `@supports` block overrides its own base declaration by\n * ordinary cascade rules — which is what the emitted CSS always said and the inline write always\n * prevented. See the engine essay above for the sheet roles and the measurements behind them.\n *\n * Calling it twice on one element is safe: the first call's rules are released first.\n *\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} [mediaQueries] Named breakpoints from root $media. Default is\n * `{}`\n * @param {JxScope} [state] Component scope for template string evaluation. Default is `{}`\n * @docs framework/concepts/styling\n */\nexport function applyStyle(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef, mediaQueries, state, false);\n}\n\n/**\n * Re-apply an element's style definition in place.\n *\n * The Studio Style panel calls this per keystroke, so its rules go to the SCRATCH sheet, which is\n * rewritten whole with `replaceSync` rather than edited rule by rule inside the shared one: 7.5ms\n * per 100 structural edits against 76.9ms. The previous rule set is released first — without that\n * this would leak a set into the shared sheet on every keypress, which is the opposite of the\n * `<style>`-tag leak it replaced.\n *\n * Inline styles are NOT cleared wholesale any more. `el.style.cssText = \"\"` also destroyed an\n * author's own `attributes: { style: \"…\" }` and would now take the custom-element `display` default\n * with it; only the `--jx-r…` properties this engine wrote are removed.\n *\n * @param {HTMLElement} el\n * @param {JxStyle | undefined} styleDef\n * @param {Record<string, string>} [mediaQueries]\n * @param {JxScope} [state]\n */\nexport function reapplyStyle(\n el: HTMLElement,\n styleDef: JxStyle | undefined,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef ?? {}, mediaQueries, state, true);\n}\n\n/**\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} mediaQueries\n * @param {JxScope} state\n * @param {boolean} live - Write to the scratch sheet (the Studio edit path) rather than intern\n */\nfunction applyStyleInto(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string>,\n state: JxScope,\n live: boolean,\n) {\n releaseElementStyles(el);\n const doc = el.ownerDocument ?? document;\n const sheetState = sheetStateFor(doc);\n\n /* One gate for the whole call, so every recursion answers alike. Off in production and in\n preview, where the selector is written exactly as authored.\n\n The SAME predicate the attribute rename uses, and it has to be: an attribute renamed without\n its selectors transposed is a panel that can never be styled open. They disagreed while the\n rename learned to reach inside a defined element and this did not, so a kit popover rendered\n within another definition's template would have been de-linked and then left with a\n `:popover-open` rule that could no longer match. */\n const transposeSelector =\n (_canvasDelinkPopovers || _canvasDelinkCommands) && canvasStamped(el)\n ? (selector: string) =>\n transposeCanvasOverlaySelector(selector, {\n dialog: el.tagName === \"DIALOG\",\n })\n : (selector: string) => selector;\n\n /* Reactive declarations become `var()` reads of a custom property this element sets inline. The\n variable inherits, which is correct, and the declaration stays in the rule where `:hover` can\n override it. The serial keeps two elements' variables apart: a descendant rule reads `var()`\n from the nearest ancestor that set it, and without it a styled child would shadow its parent's\n `--jx-r0` with its own. It also makes the rule text — and so the scope handle hashed from it —\n unique per element, which is exactly the sharing a reactive rule set must not have. */\n let serial = -1;\n let indirect = 0;\n const sources: { name: string; value: string | JxRef }[] = [];\n const rules = buildStyleRules(styleDef, {\n mediaQueries,\n resolveValue: (property, value, target) => {\n /* A reactive value on a CUSTOM PROPERTY, in a rule targeting the element itself, is written\n inline under the AUTHOR'S OWN NAME and contributes no declaration. That keeps the rule\n text free of anything per-element, so every row of a repeater interns ONE rule instead of\n one each: the serial below is in the rule text, the interning handle is a hash of that\n text, and so no two reactive elements could ever share a rule set. Measured before this:\n three font rows produced three handles and three rules.\n The declaration that READS the variable — `font-family: var(--row-face, inherit)` — lives\n in the owning element's own style, is identical across rows, and interns once.\n Only a SELF-target rule qualifies. A descendant rule keeps the indirection, because its\n variable must not be set on the element that carries the rule: a `var()` resolves from the\n nearest ancestor that set it, and a shared descendant rule would read the wrong one. */\n if (target === \"self\" && property.startsWith(\"--\")) {\n sources.push({ name: property, value });\n return null;\n }\n if (serial < 0) {\n ({ serial } = sheetState);\n sheetState.serial += 1;\n }\n /* Counted separately from `sources`, so an inline custom property before it cannot shift the\n name of an indirected one. The name is IN the rule text, and the interning handle is a\n hash of that text — a number that moved with unrelated declarations would give two\n otherwise identical styles two rules. */\n const name = `--jx-r${serial}-${indirect}`;\n indirect += 1;\n sources.push({ name, value });\n return `var(${name})`;\n },\n scope: SCOPE_TOKEN,\n transposeSelector,\n transposeValue: canvasStyleValue,\n });\n /* `sources.length` too, not `rules.length` alone: a style whose ONLY reactive declaration is a\n custom property on the element itself emits no rule at all, and returning here would install\n no effect, so the variable would be written once and never track its source again. */\n if (rules.length === 0 && sources.length === 0) {\n return;\n }\n\n /* Declaration-body at-rules declare a document-global NAME — `@position-try --flip`,\n `@font-face` — so they are written once for the whole document and refcounted, rather than\n once per element that mentions them. */\n const scoped = rules.filter((rule) => rule.target !== \"unscoped\");\n const unscoped = rules.filter((rule) => rule.target === \"unscoped\");\n for (const rule of unscoped) {\n retainInterned(sheetState, sheetState.hoisted, rule.text, [rule.text]);\n }\n\n const uid = `jx-${hashCss(scoped.map((rule) => rule.key).join(\"|\"))}`;\n const texts = scoped.map((rule) => rule.text.replaceAll(SCOPE_TOKEN, `[data-jx=\"${uid}\"]`));\n if (texts.length > 0) {\n el.dataset.jx = uid;\n if (live) {\n sheetState.scratch ??= openSink(doc);\n sheetState.scratchOwners.set(el, texts);\n rewriteScratch(sheetState);\n } else {\n retainInterned(sheetState, sheetState.interned, uid, texts);\n }\n }\n\n const entry: ElementStyleEntry = {\n doc,\n hoisted: unscoped.map((rule) => rule.text),\n interned: texts.length > 0 && !live ? uid : null,\n state: sheetState,\n stop: null,\n uid,\n vars: sources.map((source) => source.name),\n };\n if (sources.length > 0) {\n const scope = effectScope();\n scope.run(() => {\n for (const { name, value } of sources) {\n effect(() => {\n const resolved = isRefObj(value)\n ? resolveRef(value.$ref, state)\n : evaluateTemplate(value, state);\n el.style.setProperty(name, canvasStyleValue(String(resolved ?? \"\")));\n });\n }\n });\n entry.stop = () => scope.stop();\n }\n elementStyles.set(el, entry);\n /* Ties the rules to the render that made them: a mapped array's discarded generation, or a\n Studio subtree being replaced, stops its scope and the rule set goes with it. Guarded on the\n entry so a later `reapplyStyle` is not undone by an older scope disposing after it. */\n onScopeDispose(() => releaseElementStyles(el, entry), true);\n}\n\n/*\n * HTML carries a boolean two incompatible ways, and writing one as the other inverts it in silence.\n *\n * A *boolean attribute* — `open`, `disabled`, `hidden`, `required` — is read by PRESENCE. Any value\n * at all counts as true, `\"false\"` included, so `<details open=\"false\">` is an OPEN `<details>`.\n * The value must never be written; absence is the only way to say false.\n *\n * An *enumerated* attribute carries the word in its own text and reads an empty value as unset, so\n * the presence form is the broken one here: bare `aria-hidden` is NOT hidden, and a dropped\n * `contenteditable` means \"inherit from the parent\" rather than `false`. Every `aria-*` is in this\n * family — ARIA has no presence attributes at all — along with the three HTML attributes below.\n *\n * **`popover` is enumerated and is deliberately NOT in this set**, which looks like an oversight\n * and is not. Its keywords are `auto`, `manual` and `hint`; its MISSING-value default is `auto`, so\n * a bare `popover` and `popover=\"\"` are both auto popovers — which is what the presence branch\n * below already produces for `true`, correctly. Its INVALID-value default is `manual`, so moving it\n * here would emit `popover=\"true\"`, which is not a keyword, and every popover written as a boolean\n * would silently stop light-dismissing and stop answering Escape. The right answer to a boolean\n * `popover` is not a different emission, it is not writing one: `@jxsuite/schema/overlays` reports\n * it as `invalid-mode`, and the house spelling is `\"auto\"`.\n *\n * That also corrects the paragraph above for this one attribute: a presence attribute counts any\n * value as true, but `popover=\"false\"` is a *manual* popover rather than a true-ish one, because it\n * is enumerated even though it is emitted through the presence branch.\n *\n * @docs framework/concepts/elements\n */\nconst ENUMERATED_ATTRS = new Set([\"contenteditable\", \"draggable\", \"spellcheck\"]);\n\n/**\n * The enumerated-attribute names, for a code generator that cannot import this module.\n *\n * The compiler's element and client targets emit standalone ES modules that a built site loads\n * without `@jxsuite/runtime`, so they inline the boolean decision instead of calling it. They\n * serialize THIS array into that inlined helper, and `compile-element.test.ts` asserts the emitted\n * literal still equals it — which is what keeps the four writers of the rule one decision rather\n * than four, in the one place a shared function could not reach.\n *\n * @returns {string[]} The names, sorted, so the emitted output is stable.\n */\nexport function enumeratedAttrNames(): string[] {\n return [...ENUMERATED_ATTRS].toSorted();\n}\n\n/**\n * The text an attribute's boolean value must be written with, or `null` when saying it means\n * removing the attribute instead.\n *\n * An empty string is the bare form: `setAttribute(name, \"\")` is how the DOM spells the `open` that\n * HTML source writes with no `=`.\n *\n * Shared rather than restated because two renderers must agree. The compiler writes attributes into\n * a string of HTML and this file writes them onto live elements; were they to disagree about which\n * family an attribute belongs to, a prerendered page would change meaning as it hydrated.\n *\n * @param {string} name - Attribute name, already resolved to what will be written\n * @param {boolean} value - The resolved boolean\n * @returns {string | null} Text to write, or null to omit the attribute\n */\nexport function booleanAttrValue(name: string, value: boolean): string | null {\n const lower = name.toLowerCase();\n if (lower.startsWith(\"aria-\") || ENUMERATED_ATTRS.has(lower)) {\n return String(value);\n }\n return value ? \"\" : null;\n}\n\n/**\n * @param {HTMLElement} el\n * @param {Record<string, import(\"@jxsuite/schema/types\").JxAttributeValue>} attrs\n * @param {JxScope} state\n */\nfunction applyAttributes(el: HTMLElement, attrs: Record<string, JxAttributeValue>, state: JxScope) {\n for (const [k, v] of Object.entries(attrs)) {\n const attr = canvasAttrName(el, k);\n /* Inside the effects, not before them. A `$ref` or `${…}` value is not a string until the\n effect runs — which is exactly why the document walk this replaced could never see it. */\n const write = (resolved: unknown) => {\n if (resolved === null || resolved === undefined) {\n /* Nothing is an attribute the element does not have. A binding that resolves to `null`\n has to take the attribute WITH it, for the same reason a `false` does below — and an\n `aria-checked=\"\"` or `title=\"\"` left behind is not absence, it is a wrong value. */\n el.removeAttribute(attr);\n return;\n }\n if (typeof resolved === \"boolean\") {\n const text = booleanAttrValue(attr, resolved);\n /* `removeAttribute`, not `setAttribute(attr, \"false\")`. A binding that flips back has to\n take the attribute WITH it: the element is being re-used, so anything left behind is the\n state the page just said it had left. Asset rewriting is skipped because a boolean names\n no asset — `canvasAssetValue` reads `src`/`href` values, which are never booleans. */\n if (text === null) {\n el.removeAttribute(attr);\n } else {\n el.setAttribute(attr, text);\n }\n return;\n }\n el.setAttribute(attr, canvasAssetValue(el.tagName, k, String(resolved)));\n };\n if (isRefObj(v)) {\n effect(() => write(resolveRef(v.$ref, state)));\n } else if (isTemplateString(v)) {\n effect(() => write(evaluateAttrTemplate(v, state)));\n } else {\n write(v);\n }\n }\n}\n\n// ─── Array mapping ────────────────────────────────────────────────────────────\n\n/**\n * Render a mapped array (repeater) wrapper-less: its item instances are inserted directly into\n * `parentEl`, in place, ahead of an anchor comment that marks the array's position among the\n * parent's other children.\n *\n * Rows are RECONCILED, not rebuilt. Each row is keyed — by the `key` pointer the array declares,\n * else by its index — and owns a detached effect scope and a reactive `$map` context. When `items`\n * (or the filter/sort sources, or a key) change, a row whose key survives keeps its node and its\n * effects: a reorder moves the node, an insertion creates only the new rows, a removal stops only\n * the removed ones, and a moved row's `$map.index` is updated in place. That is what lets focus,\n * scroll position and a half-typed value survive a change to the list.\n *\n * Reads made while a row is constructed are made with tracking PAUSED. `effectScope.run()` does not\n * reset the active subscriber, so without this every top-level read a row performs — a `$props`\n * write, a tag discriminant, a `$`-local — subscribed the LIST effect, and one row's data changing\n * rebuilt the whole list. The bindings inside a row are effects of their own and re-enable tracking\n * when they run, so a row still updates itself.\n *\n * `options._path` is the array node's own document path (`[…, \"children\", i]`, or `[…, \"children\"]`\n * for a legacy whole-children repeater); item instances render at `[…that…, \"map\", index]`, and a\n * row that moves reports its new path through `options.onNodeMoved`.\n *\n * @param {HTMLElement} parentEl\n * @param {import(\"@jxsuite/schema/types\").JxMappedArray} arrayDef\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n */\nfunction renderMappedArrayInto(\n parentEl: HTMLElement,\n arrayDef: JxMappedArray,\n state: JxScope,\n options?: JxRenderOptions,\n) {\n const path = options?._path ?? [];\n const anchor = document.createComment(\"jx-array\");\n parentEl.append(anchor);\n const { items: itemsSrc, map: mapDef, filter: filterRef, sort: sortRef, key: keyRef } = arrayDef;\n const keyPointer = isRefObj(keyRef) ? keyRef.$ref : null;\n /* The instantiation chain the list belongs to (spec.md §16.9), for the same reason\n {@link renderSwitch} keeps one: a row that arrives with new data is inserted from an effect\n re-run, and the instance it holds must connect under the chain of the definition that drew\n the list. */\n const instancePath = _instancePath;\n\n let warned = false;\n const warnOnce = (message: string): void => {\n if (!warned) {\n warned = true;\n console.warn(`Jx $map: ${message}`);\n }\n };\n\n /** The rows currently rendered, in DOM order. */\n let rows: MappedRow[] = [];\n\n const teardown = (row: MappedRow): void => {\n row.scope.stop();\n row.node.remove();\n };\n\n const createRow = (key: unknown, item: unknown, index: number): MappedRow => {\n const map = shallowReactive({ index, item });\n const child = Object.create(state) as JxScope;\n child.$map = map;\n // The flat aliases stay readable by legacy readers, and follow the reactive context.\n Object.defineProperty(child, \"$map/item\", { enumerable: true, get: () => map.item });\n Object.defineProperty(child, \"$map/index\", { enumerable: true, get: () => map.index });\n const scope = effectScope(true);\n const childOpts = options ? { ...options, _path: [...path, \"map\", index] } : undefined;\n const node = scope.run(() => renderNode(mapDef!, child, childOpts))!;\n return { key, map, node, scope };\n };\n\n const reconcile = (list: unknown[], keys: unknown[]): void => {\n const previous = new Map<unknown, MappedRow>();\n for (const row of rows) {\n previous.set(row.key, row);\n }\n const next: MappedRow[] = [];\n for (let index = 0; index < list.length; index++) {\n const key = keys[index];\n const item = list[index];\n const existing = previous.get(key);\n if (existing) {\n previous.delete(key);\n if (existing.map.item !== item) {\n existing.map.item = item;\n }\n if (existing.map.index !== index) {\n existing.map.index = index;\n options?.onNodeMoved?.(existing.node, [...path, \"map\", index]);\n }\n next.push(existing);\n } else {\n next.push(createRow(key, item, index));\n }\n }\n // Whatever was not claimed is gone.\n for (const row of previous.values()) {\n teardown(row);\n }\n /* Order in one forward pass. The cursor walks the kept nodes in their current order; a row\n already under the cursor is in place, anything else is inserted before it — a new node, or\n a kept node moved forward. Only rows that are out of place move, and a move is the one thing\n that can cost a focused element its focus. */\n let cursor: ChildNode = rows.find((row) => !previous.has(row.key))?.node ?? anchor;\n for (const row of next) {\n if (row.node === cursor) {\n cursor = cursor.nextSibling ?? anchor;\n continue;\n }\n cursor.before(row.node);\n }\n rows = next;\n };\n\n const update = (): void => {\n let items: unknown = isRefObj(itemsSrc) ? resolveRef(itemsSrc.$ref, state) : itemsSrc;\n if (Array.isArray(items) && isRefObj(filterRef)) {\n const fn = resolveRef(filterRef.$ref, state);\n if (typeof fn === \"function\") {\n items = items.filter(fn as (v: unknown) => boolean);\n }\n }\n if (Array.isArray(items) && isRefObj(sortRef)) {\n const fn = resolveRef(sortRef.$ref, state);\n if (typeof fn === \"function\") {\n items = [...(items as unknown[])].toSorted(fn as (a: unknown, b: unknown) => number);\n }\n }\n const list = Array.isArray(items) && mapDef ? (items as unknown[]) : [];\n\n // Keys are read HERE, tracked, so a key that changes reconciles the list.\n const keys = list.map((item, index) => mappedRowKey(keyPointer, item, index, warnOnce));\n const seen = new Set<unknown>();\n for (let i = 0; i < keys.length; i++) {\n if (seen.has(keys[i])) {\n warnOnce(\n `duplicate key ${String(keys[i])} — every occurrence after the first is rebuilt on each change`,\n );\n keys[i] = { duplicate: i };\n } else {\n seen.add(keys[i]);\n }\n }\n\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () => reconcile(list, keys));\n } finally {\n resetTracking();\n }\n };\n\n /* The first render is synchronous; every re-render is coalesced into ONE microtask. A reactive\n array mutated in place — `reverse()`, `sort()`, an index write — triggers once per element it\n touches, and an effect run between two of those writes sees an array that is half of each\n state: a row that is transiently absent would be torn down and then rebuilt, which is exactly\n the identity loss keys exist to prevent. Deferring to a microtask is what a framework scheduler\n does for the same reason; a row's own bindings stay synchronous. */\n let queued = false;\n let stopped = false;\n const runner = effect(update, {\n scheduler: () => {\n if (queued) {\n return;\n }\n queued = true;\n queueMicrotask(() => {\n queued = false;\n if (!stopped) {\n runner();\n }\n });\n },\n });\n\n onScopeDispose(() => {\n stopped = true;\n for (const row of rows) {\n teardown(row);\n }\n rows = [];\n }, true);\n}\n\n/** A rendered row of a mapped array. */\ninterface MappedRow {\n key: unknown;\n /** The row's `$map` context; `item` and `index` are written in place when the row is reused. */\n map: { index: number; item: unknown };\n node: HTMLElement | Text;\n scope: EffectScope;\n}\n\n/**\n * The identity a `key` pointer names for one item: the item itself for `$map/item`, a value read\n * off it for `$map/item/<path>`. Anything else is not a key — an index names a position, not a row\n * — and a key that evaluates to nothing cannot tell rows apart, so both fall back to the index.\n */\nfunction mappedRowKey(\n pointer: string | null,\n item: unknown,\n index: number,\n warnOnce: (message: string) => void,\n): unknown {\n if (pointer === null) {\n return index;\n }\n if (pointer === \"$map/item\") {\n return item;\n }\n if (pointer.startsWith(\"$map/item/\")) {\n const key = readPath(item, pointer.slice(\"$map/item/\".length));\n if (key === undefined || key === null) {\n warnOnce(`key \"${pointer}\" is empty for some items — those rows fall back to their index`);\n return index;\n }\n return key;\n }\n warnOnce(`key \"${pointer}\" is not a $map/item pointer — rows fall back to their index`);\n return index;\n}\n\n/**\n * An element's tag: a name, or the branch of a {@link JxTagExpression} the state selects.\n *\n * Every branch of the expression is itself a `TagName`, so this can only ever return something the\n * schema already held to the tag-name pattern — the property that lets the compiler enumerate the\n * candidates and lets `createElement` be called without a second thought here.\n *\n * @param {unknown} tagName The element's declared tag.\n * @param {JxScope} scope The state the discriminant reads.\n * @returns {string} A literal tag name; `\"div\"` when nothing is declared.\n */\nexport function resolveTagName(tagName: unknown, scope: JxScope): string {\n if (typeof tagName === \"string\") {\n return tagName;\n }\n if (!isTagExpression(tagName)) {\n return \"div\";\n }\n const expression = tagName.$expression;\n if (expression.operator === \"?:\") {\n // `evaluateOperand`, not `evaluateExpression`: the discriminant is an OPERAND — a pointer, a\n // Literal or a nested node — exactly as it is for a `$switch`, whose docstring names this.\n return evaluateOperand(expression.target, scope, null) ? expression.value : expression.initial;\n }\n const key = evaluateOperand(expression.target, scope, null);\n return expression.cases[String(key)] ?? expression.default;\n}\n\n// ─── $switch ──────────────────────────────────────────────────────────────────\n\n/**\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement}\n */\nfunction renderSwitch(def: JxElement, state: JxScope, options?: JxRenderOptions) {\n const path = options?._path ?? [];\n const container = document.createElement(resolveTagName(def.tagName, state));\n /* The instantiation chain this switch belongs to (spec.md §16.9), read now because the effect\n below re-runs with nothing on the stack. A case that flips after the first paint puts it back\n around the insertion, so an instance the new case creates connects under the chain of the\n definition that drew the switch rather than under none. See {@link _instancePath}. */\n const instancePath = _instancePath;\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(container, path, def, state);\n }\n\n applyProperties(container, def, state);\n applyStyle(container, def.style ?? {}, (state[\"$media\"] as Record<string, string>) ?? {}, state);\n applyAttributes(container, def.attributes ?? {}, state);\n /* Every case renders in a detached scope of its own, stopped before the next case renders and\n when the container's own scope stops. A generation counter names the case a pending external\n load belongs to; it moves on EVERY change — an inline case included — so a load that resolves\n after the discriminant moved on cannot paint over what replaced it. */\n let generation = 0;\n let live: EffectScope | null = null;\n /* The key the rendered case was chosen by. A discriminant that re-resolves to the SAME key keeps\n its case: the subtree, its effects and its state — an open submenu, a half-typed value —\n survive. Without this a mapped row whose item was replaced by an equal one (a host rebuilding\n its projection) rebuilt every switch inside it, and the popover the case rendered closed. */\n let renderedKey: string | null = null;\n const retire = (): void => {\n live?.stop();\n live = null;\n };\n\n effect(() => {\n if (!isRefObj(def.$switch)) {\n retire();\n container.replaceChildren();\n generation += 1;\n return;\n }\n const key = String(resolveRef(def.$switch.$ref, state));\n if (key === renderedKey) {\n return;\n }\n renderedKey = key;\n retire();\n /* `replaceChildren()` rather than `innerHTML = \"\"`: identical semantics, and it is not a\n Trusted Types injection sink — under `require-trusted-types-for 'script'` an innerHTML write\n needs a policy even when the string is empty. Four sinks that were never injecting anything\n is four fewer things a policy has to be permissive about. */\n container.replaceChildren();\n generation += 1;\n const caseDef = def.cases?.[key];\n if (!caseDef) {\n return;\n }\n const gen = generation;\n const scope = effectScope(true);\n live = scope;\n const childOpts = options ? { ...options, _path: [...path, \"cases\", key] } : undefined;\n\n if (isRefObj(caseDef)) {\n // External $ref — fetch and render asynchronously, against the mount's base so a bundled\n // Document need not live at the page URL.\n const { href } = new URL(caseDef.$ref, options?._ctx?.base ?? location.href);\n resolve(href, options?._ctx)\n .then(async (doc) => {\n if (gen !== generation) {\n return;\n }\n const childScope = await buildScope(doc, {}, href, options?._ctx);\n if (gen !== generation) {\n return;\n }\n container.replaceChildren();\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(doc, childScope, childOpts))),\n );\n })\n .catch((error: unknown) =>\n console.error(\"Jx $switch: failed to load external case\", caseDef.$ref, error),\n );\n return;\n }\n\n // Tracking is paused for the same reason it is for a mapped row: a top-level read the case\n // Makes while it renders must not subscribe THIS effect, or the case re-renders on every\n // Change to anything it read. The bindings inside it track for themselves.\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(caseDef, state, childOpts))),\n );\n } finally {\n resetTracking();\n }\n });\n onScopeDispose(retire, true);\n\n return container;\n}\n\n// ─── Prototype namespaces (Shape 5) ──────────────────────────────────────────\n\n/**\n * Resolve a $prototype definition into a value for the reactive scope.\n *\n * Returns a ref() for async/persistent entries (Request, Storage, Cookie, IndexedDB), or a plain\n * value for simple entries (Set, Map, FormData, Blob).\n *\n * @param {JxPrototypeDef} def - State entry with $prototype\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key (for diagnostics)\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<unknown>}\n */\nexport async function resolvePrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n ctx?: JxContext,\n) {\n // ── External class via $src ─────────────────────────────────────────────────\n if (def.$src) {\n return resolveExternalPrototype(def, state, key, base);\n }\n\n switch (def.$prototype) {\n case \"Request\": {\n const s: Ref<unknown> = ref(null);\n const debounceMs = def.debounce ?? 0;\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n if (!def.manual && !(ctx?.skipAutoRequests ?? _autoRequestConfig.skip)) {\n effect(() => {\n let url: string | undefined;\n if (isTemplateString(def.url)) {\n url = evaluateTemplate(def.url, state);\n } else {\n ({ url } = def);\n }\n if (!url || url === \"undefined\" || url.includes(\"undefined\")) {\n return;\n }\n\n const controller = new AbortController();\n onEffectCleanup(() => {\n controller.abort();\n if (debounceTimer !== null) {\n clearTimeout(debounceTimer);\n }\n });\n\n const doFetch = () =>\n fetch(url, {\n method: def.method ?? \"GET\",\n signal: controller.signal,\n ...(def.headers && { headers: def.headers }),\n ...(def.body && {\n body: typeof def.body === \"object\" ? JSON.stringify(def.body) : def.body,\n }),\n })\n .then((r) => (r.ok ? r.json() : Promise.reject(r.statusText)))\n .then((d) => {\n s.value = d;\n })\n .catch((error: unknown) => {\n if (!(error instanceof Error && error.name === \"AbortError\")) {\n s.value = { error: String(error) };\n }\n });\n\n if (debounceMs > 0) {\n debounceTimer = setTimeout(doFetch, debounceMs);\n } else {\n void doFetch();\n }\n });\n }\n\n return s;\n }\n\n case \"URLSearchParams\": {\n return computed(() => {\n const p: Record<string, string> = {};\n for (const [k, v] of Object.entries(def)) {\n if (k !== \"$prototype\") {\n p[k] = (\n isRefObj(v)\n ? resolveRef(v.$ref, state)\n : isTemplateString(v)\n ? evaluateTemplate(v, state)\n : v\n ) as string;\n }\n }\n return new URLSearchParams(p).toString();\n });\n }\n\n case \"LocalStorage\":\n case \"SessionStorage\": {\n const store = def.$prototype === \"LocalStorage\" ? localStorage : sessionStorage;\n const k = def.key ?? key;\n let init: unknown;\n try {\n const s = store.getItem(k);\n init = s !== null ? (JSON.parse(s) as unknown) : (def.default ?? null);\n } catch {\n init = def.default ?? null;\n }\n const storageState: Ref<unknown> = ref(init);\n // Persist on change\n effect(() => {\n const v = storageState.value;\n if (v === null) {\n try {\n store.removeItem(k);\n } catch {}\n } else {\n try {\n store.setItem(k, JSON.stringify(v));\n } catch {}\n }\n });\n return storageState;\n }\n\n case \"Cookie\": {\n const name = def.name ?? key;\n const read = () => {\n const raw = readCookie(document.cookie, name);\n if (raw === null) {\n return null;\n }\n try {\n return JSON.parse(decodeURIComponent(raw));\n } catch {\n return raw;\n }\n };\n const cookieState: Ref<unknown> = ref(read() ?? def.default ?? null);\n // Persist on change\n effect(() => {\n // oxlint-disable-next-line unicorn/no-document-cookie -- the Cookie $prototype IS the cookie store binding\n document.cookie = serializeCookie(name, cookieState.value, def);\n });\n return cookieState;\n }\n\n case \"IndexedDB\": {\n const idbState: Ref<unknown> = ref(null);\n const {\n database,\n store,\n version = 1,\n keyPath = \"id\",\n autoIncrement = true,\n indexes = [],\n } = def;\n if (!database || !store) {\n throw new Error(`Jx: IndexedDB entry '${key}' requires database and store`);\n }\n const req = indexedDB.open(database, version);\n req.addEventListener(\"upgradeneeded\", (e) => {\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n if (!db.objectStoreNames.contains(store)) {\n const os = db.createObjectStore(store, { autoIncrement, keyPath });\n for (const i of indexes) {\n os.createIndex(i.name, i.keyPath, { unique: i.unique ?? false });\n }\n }\n });\n req.addEventListener(\"success\", (e) => {\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n idbState.value = {\n database,\n getStore: (mode: IDBTransactionMode = \"readwrite\") =>\n Promise.resolve(db.transaction(store, mode).objectStore(store)),\n isReady: true,\n store,\n version,\n };\n });\n req.addEventListener(\"error\", () => {\n idbState.value = { error: req.error?.message };\n });\n return idbState;\n }\n\n case \"Set\": {\n return new Set(Array.isArray(def.default) ? def.default : []);\n }\n\n case \"Map\": {\n return new Map(Object.entries(isJsonObject(def.default) ? def.default : {}));\n }\n\n case \"FormData\": {\n const fd = new FormData();\n for (const [k, v] of Object.entries(def.fields ?? {})) {\n fd.append(k, v as string);\n }\n return fd;\n }\n\n case \"Blob\": {\n return new Blob((def.parts as BlobPart[]) ?? [], {\n type: typeof def.type === \"string\" ? def.type : \"text/plain\",\n });\n }\n\n case \"ReadableStream\": {\n return null;\n }\n\n default: {\n console.warn(\n `Jx: unknown $prototype \"${def.$prototype}\" for \"${key}\". Did you mean to add '$src'?`,\n );\n return ref(null);\n }\n }\n}\n\n// ─── External class resolution ────────────────────────────────────────────────\n\n/** Reserved keys stripped from the config object passed to external class constructors. */\nconst EXTERNAL_RESERVED = new Set([\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n]);\n\n/**\n * Resolve an external class prototype via $src.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveExternalPrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n\n // Non-Function $prototype must use .class.json as entrypoint\n if (!src || !src.endsWith(\".class.json\")) {\n throw new Error(\n `Jx: $prototype \"${def.$prototype}\" requires a .class.json $src, got \"${src}\". ` +\n `Wrap the class in a .class.json schema with $implementation.`,\n );\n }\n\n return resolveClassJson(def, state, key, base);\n}\n\n/**\n * Import a JS module and instantiate a class from it. Internal helper used by resolveClassJson for\n * $implementation.\n *\n * @param {JxScope} def - Original state entry (for config extraction)\n * @param {string} src - JS module URL to import\n * @param {string} exportName - Export name to look up\n * @param {string} [base] - Base URL for resolution\n * @returns {Promise<unknown>}\n */\nasync function importAndInstantiate(def: JxScope, src: string, exportName: string, base?: string) {\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n try {\n mod = (await import(src)) as ImportedModule;\n } catch {\n if (base) {\n const resolvedSrc = new URL(src, base).href;\n mod = (await import(resolvedSrc)) as ImportedModule;\n } else {\n throw new Error(`Failed to import \"${src}\"`);\n }\n }\n _moduleCache.set(src, mod);\n }\n\n const ExportedClass = mod[exportName] ?? mod.default?.[exportName];\n if (!ExportedClass) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\"`);\n }\n if (typeof ExportedClass !== \"function\") {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a class`);\n }\n\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n\n const Ctor = ExportedClass as new (config: JxScope) => ExternalClassInstance;\n const instance = new Ctor(config);\n\n let value: unknown;\n if (typeof instance.resolve === \"function\") {\n value = await instance.resolve();\n } else if (\"value\" in instance) {\n ({ value } = instance);\n } else {\n value = instance;\n }\n\n // Always wrap in ref for reactivity with external classes\n const s: Ref<unknown> = ref(value);\n if (typeof instance.subscribe === \"function\") {\n instance.subscribe((newVal: unknown) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Resolve a .class.json schema-defined class. Fetches the schema, follows $implementation if\n * hybrid, or constructs dynamically if self-contained.\n *\n * Its one caller, {@link resolveExternalPrototype}, already rejects a missing `$src` before this\n * runs, so `def.$src` is never empty here.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveClassJson(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const src = def.$src!;\n let classDef: JxClassDef;\n\n // Bare specifiers (package references like @scope/pkg/file) can't be fetched directly —\n // Go straight to dev proxy which can resolve them via node_modules.\n const isBareSpecifier =\n !src.startsWith(\".\") &&\n !src.startsWith(\"/\") &&\n !src.startsWith(\"http\") &&\n !src.startsWith(\"file:\");\n if (isBareSpecifier) {\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Try fetching the .class.json file directly\n try {\n const url = base ? new URL(src, base).href : src;\n const res = await fetch(url);\n if (!res.ok) {\n throw new Error(`HTTP ${res.status}`);\n }\n // Trust boundary: fetched .class.json sources are class definitions by contract.\n classDef = (await res.json()) as JxClassDef;\n } catch {\n // Fall back to dev proxy (server will handle .class.json resolution)\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Hybrid mode: $implementation points to the real JS module\n if (classDef.$implementation) {\n // If the schema references $context (e.g. content types), the browser cannot provide\n // The required server-side context — go directly to dev proxy.\n const schemaStr = JSON.stringify(classDef);\n if (schemaStr.includes('\"#/$context/')) {\n return resolveViaDevProxy(def, state, key, base);\n }\n const schemaUrl = base ? new URL(src, base).href : new URL(src, location.href).href;\n const implSrc = new URL(classDef.$implementation, schemaUrl).href;\n const exportName = def.$export ?? classDef.title ?? def.$prototype;\n try {\n return await importAndInstantiate(def, implSrc, exportName, base);\n } catch {\n return resolveViaDevProxy(def, state, key, base);\n }\n }\n\n // Self-contained: construct class dynamically from schema\n const DynClass = classFromSchema(classDef);\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n const instance = new DynClass(config) as ExternalClassInstance;\n\n let value: unknown;\n if (typeof instance.resolve === \"function\") {\n value = await instance.resolve();\n } else if (\"value\" in instance) {\n ({ value } = instance);\n } else {\n value = instance;\n }\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(value);\n if (typeof instance.subscribe === \"function\") {\n instance.subscribe((newVal: unknown) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Dynamically construct a class from a .class.json schema definition. Browser-side: maps private\n * fields to _-prefixed public fields.\n *\n * @param {import(\"@jxsuite/schema/types\").JxClassDef} classDef\n * @returns {DynamicClass}\n */\nfunction classFromSchema(classDef: JxClassDef) {\n const fields = classDef.$defs?.fields ?? {};\n // JSON objects inherit Object.prototype.constructor — only an own object value counts.\n const rawCtor = classDef.$defs?.constructor;\n const ctor = typeof rawCtor === \"object\" ? rawCtor : undefined;\n const methods = classDef.$defs?.methods ?? {};\n\n // oxlint-disable-next-line typescript/no-extraneous-class -- methods are attached to the prototype dynamically below\n class DynClass {\n constructor(config: Record<string, unknown> = {}) {\n for (const [key, typedField] of Object.entries(fields)) {\n const id = typedField.identifier ?? key;\n const propName = typedField.access === \"private\" ? `_${id}` : id;\n if (config[id] !== undefined) {\n (this as Record<string, unknown>)[propName] = config[id];\n } else if (typedField.initializer !== undefined) {\n (this as Record<string, unknown>)[propName] = typedField.initializer;\n } else if (typedField.default !== undefined) {\n (this as Record<string, unknown>)[propName] = structuredClone(typedField.default);\n } else {\n (this as Record<string, unknown>)[propName] = null;\n }\n }\n if (ctor?.body) {\n const bodyStr = Array.isArray(ctor.body) ? ctor.body.join(\"\\n\") : ctor.body;\n (\n new Function(\"config\", bodyStr) as (\n this: unknown,\n config: Record<string, unknown>,\n ) => void\n ).call(this, config);\n }\n }\n }\n\n for (const [key, typedMethod] of Object.entries(methods)) {\n const name = typedMethod.identifier ?? key;\n const params = (typedMethod.parameters ?? []).map((p) => {\n if (p.$ref) {\n return p.$ref.split(\"/\").pop() as string;\n }\n const n = p.identifier ?? p.name;\n return typeof n === \"string\" ? n : \"arg\";\n });\n const bodyStr = Array.isArray(typedMethod.body)\n ? typedMethod.body.join(\"\\n\")\n : (typedMethod.body ?? \"\");\n\n if (typedMethod.role === \"accessor\") {\n const descriptor: PropertyDescriptor = {};\n if (typedMethod.getter) {\n descriptor.get = new Function(typedMethod.getter.body ?? \"\") as () => unknown;\n }\n if (typedMethod.setter) {\n const sp = (typedMethod.setter.parameters ?? []).map(\n (p) => p.$ref?.split(\"/\").pop() ?? \"v\",\n );\n descriptor.set = new Function(...sp, typedMethod.setter.body ?? \"\") as (v: unknown) => void;\n }\n Object.defineProperty(DynClass.prototype, name, {\n ...descriptor,\n configurable: true,\n });\n } else if (typedMethod.scope === \"static\") {\n (DynClass as unknown as DynamicClass)[name] = new Function(...params, bodyStr);\n } else {\n (DynClass as unknown as DynamicClass).prototype[name] = new Function(...params, bodyStr);\n }\n }\n\n Object.defineProperty(DynClass, \"name\", {\n configurable: true,\n value: classDef.title,\n });\n const dynCtor = DynClass as unknown as DynamicClass;\n return dynCtor;\n}\n\n/**\n * Dev-mode fallback: when an $src module cannot run in the browser, proxy the resolve() call\n * through the Jx dev server (POST /**jx_resolve**). Supports reactive template strings in config\n * values via Vue effect().\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveViaDevProxy(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n\n const hasTemplates = Object.values(config).some((v: unknown) => isTemplateString(v));\n\n /** @param {JxScope} resolvedConfig */\n const doResolve = (resolvedConfig: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_resolve__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $prototype: def.$prototype,\n $src: def.$src,\n ...resolvedConfig,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r) => {\n if (!r.ok) {\n throw new Error(`Jx dev proxy ${r.status} for \"${key}\"`);\n }\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(null);\n if (hasTemplates) {\n effect(() => {\n const resolvedConfig: JxScope = {};\n for (const [k, v] of Object.entries(config)) {\n resolvedConfig[k] = isTemplateString(v) ? evaluateTemplate(v, state) : v;\n }\n doResolve(resolvedConfig)\n .then((value: unknown) => {\n s.value = value;\n })\n .catch((error: unknown) => console.error(\"Jx dev proxy:\", error));\n });\n } else {\n doResolve(config)\n .then((value: unknown) => {\n s.value = value;\n })\n .catch((error: unknown) => console.error(\"Jx dev proxy:\", error));\n }\n return s;\n}\n\n// ─── Server function resolution (dev mode) ────────────────────────────────────\n\n/**\n * Resolve a timing: \"server\" entry in dev mode by executing the function client-side. In\n * production, the compiler replaces this with a fetch to the generated server handler.\n *\n * @param {JxScope} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveServerFunction(\n def: JxServerFnDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n const exportName = def.$export;\n\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n try {\n mod = (await import(src)) as ImportedModule;\n } catch {\n if (base) {\n try {\n const resolvedSrc = new URL(src, base).href;\n mod = (await import(resolvedSrc)) as ImportedModule;\n } catch {\n // Module cannot run in the browser — fall back to dev server proxy\n return resolveServerFunctionViaProxy(def, state, key, base);\n }\n } else {\n return resolveServerFunctionViaProxy(def, state, key, base);\n }\n }\n _moduleCache.set(src, mod);\n }\n\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (!candidate) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\" for \"${key}\"`);\n }\n if (typeof candidate !== \"function\") {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a function`);\n }\n const fn = candidate as (args: JxScope) => Promise<unknown>;\n\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v: unknown) => isRefObj(v));\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefObj(v) ? resolveRef(v.$ref, state) : v;\n }\n return args;\n };\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(null);\n if (hasReactiveArg) {\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n fn(args)\n .then((result: unknown) => {\n s.value = result;\n })\n .catch(() => {});\n });\n } else {\n s.value = await fn(resolveArgs());\n }\n return s;\n}\n\n/**\n * Dev-mode fallback: when a timing: \"server\" module cannot run in the browser, proxy the function\n * call through the Jx dev server (POST /**jx_server**). Supports reactive $ref arguments via Vue\n * effect().\n *\n * @param {JxScope} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<unknown>}\n */\nasync function resolveServerFunctionViaProxy(\n def: JxScope,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v: unknown) => isRefObj(v));\n\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefObj(v) ? resolveRef((v as { $ref: string }).$ref, state) : v;\n }\n return args;\n };\n\n /** @param {JxScope} args */\n const doResolve = (args: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_server__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $src: def.$src,\n arguments: args,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r) => {\n if (!r.ok) {\n throw new Error(`Jx server proxy ${r.status} for \"${key}\"`);\n }\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<unknown> = ref(null);\n if (hasReactiveArg) {\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n doResolve(args)\n .then((result: unknown) => {\n s.value = result;\n })\n .catch((error: unknown) => console.error(\"Jx server proxy:\", error));\n });\n } else {\n doResolve(resolveArgs())\n .then((result: unknown) => {\n s.value = result;\n })\n .catch((error: unknown) => console.error(\"Jx server proxy:\", error));\n }\n return s;\n}\n\n/**\n * Resolve a $ref string to a value in scope.\n *\n * With Vue reactivity, this reads directly from the reactive proxy. When called inside a effect or\n * computed, the read is tracked.\n *\n * @param {string} ref\n * @param {JxScope} state - Reactive scope proxy (or child scope)\n * @returns {unknown}\n */\nexport function resolveRef(refPath: string, state: JxScope) {\n if (typeof refPath !== \"string\") {\n return refPath;\n }\n if (refPath.startsWith(\"$map/\") || refPath.startsWith(\"#/$map/\")) {\n /* Both spellings. `#/` is the documented JSON Pointer prefix everywhere else in the schema,\n so a `#/$map/item/x` fell through to `readPath`, returned null, and a `$map` over it\n rendered ZERO rows with no warning. */\n const parts = (refPath.startsWith(\"#/\") ? refPath.slice(2) : refPath).split(\"/\");\n const [, key] = parts; // \"item\" or \"index\"\n const map = state.$map as Record<string, unknown> | undefined;\n const base = map?.[key!] ?? state[`$map/${key}`];\n return parts.length > 2 ? getPath(base, parts.slice(2).join(\"/\")) : base;\n }\n if (refPath.startsWith(\"#/state/\")) {\n // One call, not a hand-split leading token: slicing at the first `/` skipped unescaping it, so\n // `#/state/a~1b/c` looked for a member called `a~1b` rather than `a/b`.\n return readPath(state, refPath.slice(\"#/state/\".length));\n }\n if (refPath.startsWith(\"parent#/\")) {\n /*\n * A prop name may be a path into the prop. This read the whole path as one key and returned\n * undefined for `parent#/user/name`, while the compiler lowered it to a walk.\n */\n return readPath(state, refPath.slice(\"parent#/\".length));\n }\n if (refPath.startsWith(\"window#/\")) {\n return getPath(globalThis.window, refPath.slice(\"window#/\".length));\n }\n if (refPath.startsWith(\"document#/\")) {\n return getPath(globalThis.document, refPath.slice(\"document#/\".length));\n }\n return readPath(state, refPath) ?? null;\n}\n\n// ─── Utilities ────────────────────────────────────────────────────────────────\n\n/**\n * Check if v is a Vue ref (including computed).\n *\n * @param {unknown} v\n * @returns {boolean}\n */\nexport function isSignal(v: unknown) {\n return isRef(v);\n}\n\n/**\n * @param {unknown} v\n * @returns {v is import(\"@jxsuite/schema/types\").JxRef}\n */\nfunction isRefObj(v: unknown): v is JxRef {\n return isRefValue(v);\n}\n\n/**\n * Walk a path off a value. Delegates to the one tokenizer (`pointer.ts`) — this used to split on\n * `/[./]/`, which no other path in the codebase agreed with.\n *\n * @param {unknown} obj\n * @param {string} path\n * @returns {unknown}\n */\nfunction getPath(obj: unknown, path: string) {\n return readPath(obj, path);\n}\n\n/**\n * Write an observed attribute into element state, coerced by the type the state entry already holds\n * (spec §16.5): a number parses, a boolean is presence (`\"false\"` counts as absent), and anything\n * else is the string. Shared by connection and `attributeChangedCallback` so the two cannot\n * disagree.\n *\n * REMOVING an attribute restores the entry's DECLARED DEFAULT rather than writing the absence\n * through. `attributeChangedCallback` reports a removal as `null`, and writing that through gave a\n * `type: \"string\"` entry the value `null` and a `type: \"number\"` entry `Number(null)`, which is 0 —\n * so a numeric prop could never express \"unset\" and a string prop stopped matching its own declared\n * type. The default is the value the entry had before anyone set the attribute, which is what the\n * removal is asking to go back to.\n *\n * @param defaults The declared defaults by state key; a key absent from it has none.\n */\nfunction absorbAttribute(\n state: JxScope,\n name: string,\n value: string | null,\n defaults?: ReadonlyMap<string, unknown>,\n): void {\n const camelKey = name.replaceAll(/-([a-z])/g, (_: string, c: string) => c.toUpperCase());\n const current = state[camelKey];\n if (typeof current === \"boolean\") {\n // Presence IS the value for a boolean, so a removal is already spelled by the same rule.\n state[camelKey] = value !== null && value !== \"false\";\n return;\n }\n if (value === null) {\n const declared = defaults?.get(camelKey);\n state[camelKey] = declared === undefined ? (typeof current === \"number\" ? 0 : \"\") : declared;\n return;\n }\n state[camelKey] = typeof current === \"number\" ? Number(value) : value;\n}\n\n/**\n * The declared default of every state entry that has one, by state key.\n *\n * @param def The element definition\n * @returns {Map<string, unknown>} Key → default\n */\nfunction declaredDefaults(def: JxElement): Map<string, unknown> {\n const out = new Map<string, unknown>();\n for (const [key, entry] of Object.entries(def.state ?? {})) {\n if (entry !== null && typeof entry === \"object\") {\n const obj = entry as Record<string, unknown>;\n if (\"default\" in obj) {\n out.set(key, obj[\"default\"]);\n continue;\n }\n // A computed entry has no default: its value is produced, and a removal leaves it alone.\n if (COMPUTED_STATE_KEYS.some((marker) => marker in obj)) {\n continue;\n }\n }\n // The shorthand `{ \"label\": \"none\" }` IS the default, the same way `buildScope` reads it.\n out.set(key, entry);\n }\n return out;\n}\n\n/** The markers that make a state entry produced rather than authored. */\nconst COMPUTED_STATE_KEYS = [\"$expression\", \"$prototype\", \"$ref\", \"$src\"] as const;\n\n/** Keys already reported, so a component rendered in a loop warns once rather than per instance. */\nconst _privatePropWarned = new Set<string>();\n\n/**\n * Refuse a `$props` write against a private (`#`) state key — `spec.md` §5.6.\n *\n * Ignored rather than thrown. A `$props` block naming a private entry is an authoring mistake, not\n * a broken document: the rest of the instance is well-formed and refusing to render it would turn a\n * typo into a blank page. But silence was the previous behavior and it is the wrong kind — the\n * author sees a prop that looks accepted and does nothing — so the write is dropped and named.\n *\n * @param {string} key\n * @param {string} [where] - The site refusing it, for a message that points somewhere\n * @returns {boolean} True when the key is private and the caller must skip it\n */\n/**\n * Whether the instance genuinely CARRIES `key`, rather than the prototype merely having an accessor\n * for it.\n *\n * `key in el` cannot tell those apart, and for a REFLECTED DOM property — `title`, `role`, `id`,\n * `lang`, `dir`, `slot`, `hidden` — the accessor answers `\"\"` when nothing is set. `\"\" !==\n * undefined`, so a component declaring `state.title` never rendered its own default: the empty\n * string won. `quote` next to it kept its default, which is what made the bug look like bad\n * content.\n *\n * The test is NOT `Object.hasOwn` alone, and that distinction is the whole subtlety. Assigning a\n * reflected name goes through the prototype accessor and creates no own property, so a legitimate\n * `$props.title` would be discarded by an own-property test — silently, for every component that\n * declares one. What the accessor DOES do is write the attribute, so the attribute is the evidence\n * that somebody set it, whether that was `$props` before connection or the author in the document.\n *\n * @param {HTMLElement} el - The instance being connected.\n * @param {string} key - A state key declared by the component definition.\n * @returns {boolean}\n */\nfunction instanceSupplies(el: HTMLElement, key: string): boolean {\n if (Object.hasOwn(el, key)) {\n return true;\n }\n if (el.hasAttribute(key)) {\n return true;\n }\n // ARIA-style reflections carry a kebab attribute for a camelCase property (`ariaLabel` →\n // `aria-label`), so the direct name lookup above would miss a value that really was set.\n const kebab = key.replaceAll(/[A-Z]/gu, (c) => `-${c.toLowerCase()}`);\n return kebab !== key && el.hasAttribute(kebab);\n}\n\nfunction refusePrivateProp(key: string, where?: string): boolean {\n if (!isPrivateStateKey(key)) {\n return false;\n }\n const seen = where === undefined ? key : `${where}:${key}`;\n if (!_privatePropWarned.has(seen)) {\n _privatePropWarned.add(seen);\n console.warn(\n `Jx: \"${key}\" is private state (spec.md §5.6) and cannot be set through $props` +\n `${where === undefined ? \"\" : ` (${where})`}. The write was ignored; rename the entry ` +\n \"without the leading # to make it part of the component's interface.\",\n );\n }\n return true;\n}\n\n/** Tests only — the warn-once set outlives a single render by design. */\nexport function _resetPrivatePropWarnings(): void {\n _privatePropWarned.clear();\n}\n\n/**\n * @param {JxElement} def\n * @param {JxScope} parentState\n * @returns {JxScope}\n */\nfunction mergeProps(def: JxElement, parentState: JxScope): JxScope {\n const child = Object.create(parentState) as JxScope;\n for (const [k, v] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(k, \"$props\")) {\n continue;\n }\n child[k] = isRefObj(v) ? resolveRef(v.$ref, parentState) : v;\n }\n return child;\n}\n\n/*\n * The CSS-authoring rules live in `./css.ts`, whose only import is a pair of type guards. They are\n * re-exported\n * here because they always were part of this module's surface and moving them must not break a\n * consumer; a host that cannot afford the DOM runtime imports `@jxsuite/runtime/css` instead.\n */\nexport {\n buildStyleRules,\n camelToKebab,\n COLOR_SCHEME_ATTR,\n COLOR_SCHEME_STORAGE_KEY,\n cssPropertyName,\n cssRuleText,\n hashCss,\n isDeclarationAtRule,\n isKeyframesAtRule,\n isNestedSelectorKey,\n pureSchemeOf,\n resolveAtQuery,\n resolveNestedSelector,\n schemeSelectors,\n splitSelectorList,\n transposeCanvasOverlaySelector,\n transposeCanvasPopoverSelector,\n} from \"./css.ts\";\nexport type { CssBuildOptions, CssKeyframeBlock, CssRule, CssRuleTarget } from \"./css.ts\";\n\n/**\n * Convert a style rules object to a CSS text string (skipping nested selectors).\n *\n * Kept for consumers; nothing in this repository composes a rule this way any more, because\n * `buildStyleRules` answers the same question for a whole style object rather than one flat level\n * of it. It shares that function's property spelling — `cssPropertyName`, not `camelToKebab` — so a\n * custom property survives it: `--fooBar` and `--foo-bar` are two different properties, and\n * kebab-casing one renames it out from under the `var()` that reads it.\n *\n * @param {Record<string, unknown> | object} rules\n * @returns {string}\n */\nexport function toCSSText(rules: Record<string, unknown> | object) {\n return Object.entries(rules)\n .filter(([k, v]) => !isNestedSelectorKey(k) && (v === null || typeof v !== \"object\"))\n .map(([p, v]) => `${cssPropertyName(p)}: ${canvasStyleValue(String(v))}`)\n .join(\"; \");\n}\n\n// ─── Custom Element Registration ──────────────────────────────────────────────\n\nlet _rootMedia: Record<string, string> = {};\n/**\n * Every defined element's CURRENT definition, read at connection — which is what lets a definition\n * be replaced.\n */\nconst _elementDefs = new Map<string, { base: string; doc: JxDocument }>();\n\n/**\n * The definition an element tag renders from, as most recently defined or redefined.\n *\n * @param {string} tagName\n * @returns {{ base: string; doc: JxDocument } | undefined}\n */\nexport function elementDefinition(tagName: string): { base: string; doc: JxDocument } | undefined {\n return _elementDefs.get(tagName);\n}\n\n/**\n * Replace an element's definition (embedding.md §7). `customElements.define` is one-shot, so the\n * generated class reads its definition through the registry at connection time: an instance\n * connected after this call renders the new document; one already on the page keeps the definition\n * it rendered until it is re-mounted. `observedAttributes` is the one thing the platform freezes at\n * first definition, so a changed list is reported and takes effect only in a fresh realm. A tag not\n * yet defined is simply defined.\n *\n * @param {JxDocument} doc\n * @param {string} [baseUrl]\n * @returns {Promise<void>}\n */\nexport async function redefineElement(doc: JxDocument, baseUrl?: string): Promise<void> {\n const base = baseUrl ?? location.href;\n const { tagName } = doc;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx redefineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (!customElements.get(tagName)) {\n await defineElement(doc, base);\n return;\n }\n if (doc.$elements) {\n await registerElements(doc.$elements, base);\n }\n const before = _elementDefs.get(tagName)?.doc.observedAttributes ?? [];\n const after = doc.observedAttributes ?? [];\n if (JSON.stringify(before) !== JSON.stringify(after)) {\n console.warn(\n `Jx redefineElement: <${tagName}> keeps observedAttributes [${before.join(\", \")}] as first defined; [${after.join(\", \")}] takes effect only in a fresh realm`,\n );\n }\n _elementDefs.set(tagName, { base, doc });\n}\n\n/**\n * Seed the module-level root `$media` map used as the fallback for components that declare their\n * own `@--name` style blocks but carry no own `$media` (buildScope ~279-280). `Jx()` sets this from\n * the document during a full top-level render, but the Studio iframe canvas calls `buildScope`/\n * `renderNode` directly (never `Jx()`), so without seeding it a component's `@--md` would resolve\n * to the invalid `@media md`. Callers on the direct path MUST set it (with the merged `$media`)\n * before `buildScope`, and re-set it every render so a stale map from a previous document cannot\n * leak.\n *\n * @param {Record<string, string>} map\n */\nexport function setRootMedia(map: Record<string, string>): void {\n _rootMedia = map ?? {};\n}\n\n/**\n * Resolve and register $elements entries (depth-first).\n *\n * @param {JxDocument[\"$elements\"]} elements\n * @param {string} base\n * @returns {Promise<void>}\n */\nasync function registerElements(\n elements: NonNullable<JxDocument[\"$elements\"]>,\n base: string,\n ctx?: JxContext,\n) {\n for (const entry of elements) {\n // Bare string: npm package side-effect import (registers custom elements)\n if (typeof entry === \"string\") {\n try {\n // Bare specifiers need a URL path for the browser; the dev server resolves\n // /node_modules/<pkg> to the package entry point via exports/module/main.\n const specifier =\n entry.startsWith(\"/\") || entry.startsWith(\".\") ? entry : `/node_modules/${entry}`;\n await import(specifier);\n } catch (error) {\n console.warn(`Jx: failed to import package \"${entry}\"`, error);\n }\n continue;\n }\n if (!isRefObj(entry)) {\n continue;\n }\n const { href } = new URL(entry.$ref, base);\n const doc = await resolve(href, ctx);\n if (!doc.tagName || !doc.tagName.includes(\"-\")) {\n continue;\n }\n if (customElements.get(doc.tagName)) {\n continue;\n }\n\n // Depth-first: register sub-dependencies first\n if (doc.$elements) {\n await registerElements(doc.$elements, href, ctx);\n }\n\n await defineElement(doc, href);\n }\n}\n\n/**\n * Inject head elements from $head declarations. Each entry is { tagName, attributes } — bare npm\n * specifiers in href/src are rewritten to /node_modules/ paths for the dev server.\n *\n * @param {import(\"@jxsuite/schema/types\").JxHeadEntry[]} entries\n * @param {string} _base - Document base URL for resolving relative paths\n */\nfunction injectHead(entries: JxHeadEntry[], _base: string) {\n for (const entry of entries) {\n if (!entry || !entry.tagName) {\n continue;\n }\n const tag = entry.tagName.toLowerCase();\n const attrs = { ...entry.attributes };\n // Resolve href/src: bare npm specifiers -> /node_modules/ path\n for (const key of [\"href\", \"src\"] as const) {\n const v = attrs[key];\n if (typeof v !== \"string\" || v === \"\") {\n continue;\n }\n if (!v.startsWith(\"/\") && !v.startsWith(\".\") && !v.startsWith(\"http\")) {\n /* The bare-specifier lane owns `/node_modules/<pkg>`, which is the HOST's URL space and\n not the project's. A canvas resolver must never claim it: the file is not in the\n repository, so there is nothing for it to resolve to. */\n attrs[key] = `/node_modules/${v}`;\n continue;\n }\n attrs[key] = canvasAssetValue(tag.toUpperCase(), key, v);\n }\n\n // Deduplicate: skip if an identical element already exists\n const selector = `${tag}${attrs.href ? `[href=\"${attrs.href}\"]` : \"\"}${attrs.src ? `[src=\"${attrs.src}\"]` : \"\"}`;\n if (selector !== tag && document.head.querySelector(selector)) {\n continue;\n }\n\n const el = document.createElement(tag);\n for (const [k, v] of Object.entries(attrs)) {\n el.setAttribute(k, String(v));\n }\n if (entry.textContent) {\n // An object is a structured data block (JSON-LD, site-architecture.md §8.5). The compiler\n // Serializes it the same way, so the interpreted page and the built page agree.\n el.textContent =\n typeof entry.textContent === \"object\"\n ? JSON.stringify(entry.textContent, null, 2)\n : entry.textContent;\n }\n document.head.append(el);\n }\n}\n\n// ─── Instantiation chain (spec.md §16.9) ─────────────────────────────────────\n\n/**\n * How deep component nesting may go before an instance refuses to render.\n *\n * The same number the compiler holds in `MAX_COMPONENT_NESTING` (`@jxsuite/compiler`, `shared.ts`),\n * and for the same reason: the cycle check in {@link extendInstancePath} catches a definition that\n * renders ITSELF — same tag, same props — which is the only shape that can never terminate, while a\n * self-reference whose props change at every level is data-driven recursion that a `$switch` may or\n * may not bottom out. The seen-set cannot tell those apart, so this cap is what turns a forgotten\n * stop into a diagnostic instead of a page that never settles. It is written twice because the\n * compiler depends on the runtime and not the other way round, and the runtime's browser bundle\n * cannot reach into the build tool; spec.md §16.9 is the one statement both are held to, and the\n * compiler's `nesting-cap-agreement.test.ts` asserts its copy against this export, so the two\n * numbers cannot part without a red test in the workspace that owns the copy.\n */\nexport const MAX_COMPONENT_NESTING = 32;\n\n/** One instance on the chain: its tag, and the props it was given, as an identity. */\ninterface InstanceFrame {\n tag: string;\n /** Every value the instance supplied that its definition's state read (§16.9). */\n props: Record<string, unknown>;\n}\n\n/**\n * The chain an instance is created under, and where on it the current expansion began.\n *\n * `frames` is every instance from the page-level one down, outermost first. `expansion` is the\n * index of the first frame that belongs to the SAME synchronous pass as the instance being created:\n * the cycle check (§16.9 rule 1) looks back no further than that, while the cap (rule 2) counts\n * every frame. The distinction is what an effect re-run does to certainty. Along one pass a\n * repeated frame is a render that repeats itself, deterministically, forever. Across a re-run it is\n * not: the frames above the boundary rendered to completion once, and whether the page asks for one\n * of them again is its data — an `onMount` that flips a `$switch` into the same tag every time, or\n * a click that opens one more level of a node that starts closed — which the runtime cannot tell\n * apart. So the cycle check is not asked across the boundary, and the loop that lives in re-runs is\n * ended by the cap instead: thirty-three empty hosts and a diagnostic, not a page that never\n * settles.\n */\ninterface InstancePath {\n frames: readonly InstanceFrame[];\n expansion: number;\n}\n\n/** The chain a page-level render runs under: nothing above it. */\nconst ROOT_INSTANCE_PATH: InstancePath = { expansion: 0, frames: [] };\n\n/**\n * The chain of instances whose definitions are being rendered RIGHT NOW.\n *\n * A module-level stack rather than a WeakMap from element to chain, and it is worth saying why that\n * survives `connectedCallback` being async. The callback awaits `buildScope` before it touches the\n * DOM, and by the time it resumes, whatever the enclosing instance pushed here has long been popped\n * — so the stack alone would be empty for every instance and catch nothing. What saves it is WHEN\n * an instance connects: `this.append(child)` in the enclosing render runs the child's\n * `connectedCallback` synchronously, and every way a definition brings an instance into being —\n * `renderCustomElementWithProps`, the bare-tag branch of `renderNode`, a nested element inside\n * either, and a prerendered host drawing its children again as it upgrades — appends it inside that\n * same synchronous stretch. So the callback reads the stack ONCE, before its first `await`, and\n * carries the copy across the gap. A WeakMap would need a write at each of those creation sites to\n * say the same thing.\n *\n * A subtree an effect renders LATER — a `$switch` case that flips after the first paint, a `$map`\n * row that arrives with new data — connects with nothing on the stack, because no enclosing render\n * is running when the effect re-runs; a write from `onMount` or a click is what triggered it. So\n * the two renderers that create nodes from an effect each capture the stack when they are first\n * rendered (which is inside the enclosing pass) and put it back, re-expanded, around every later\n * insertion ({@link underInstancePath}). That is the one thing this stack needs beyond the\n * synchronous stretch, and it is what makes the `onMount`-flip shape a diagnostic rather than a\n * hang. Reading `@vue/reactivity`'s `getCurrentScope()` there instead would find nothing: an effect\n * re-run restores no scope, and a case or a row renders in a DETACHED scope with no parent.\n */\nlet _instancePath: InstancePath = ROOT_INSTANCE_PATH;\n\n/**\n * Run `fn` with `path` as the chain, so every instance that CONNECTS during it reads that chain.\n *\n * Restored rather than cleared afterwards: the enclosing render's chain is what was there, and a\n * restore needs no argument about whether anything was.\n *\n * @param {InstancePath} path - The chain the instances `fn` connects are created under\n * @param {() => T} fn - The render, or the insertion that connects what a render made\n * @returns {T} What `fn` returned\n */\nfunction underInstancePath<T>(path: InstancePath, fn: () => T): T {\n const was = _instancePath;\n _instancePath = path;\n try {\n return fn();\n } finally {\n _instancePath = was;\n }\n}\n\n/**\n * The chain a later insertion runs under: the same frames, with the expansion beginning now.\n *\n * Called on EVERY run of a `$switch` case or a `$map` reconcile, the first one included — harmless\n * there, because a first run builds into a detached container and nothing connects until the\n * enclosing pass appends it, under the enclosing pass's own chain.\n *\n * @param {InstancePath} path - The chain captured when the renderer was first rendered\n * @returns {InstancePath}\n */\nfunction reexpand(path: InstancePath): InstancePath {\n return { expansion: path.frames.length, frames: path.frames };\n}\n\n/**\n * Whether two prop values are the same input to a definition.\n *\n * Reference equality first — a `$ref` into the parent's state forwards the same primitive, the same\n * reactive proxy or the same function to the next level — and structural equality for plain data\n * rebuilt at each level (`data-jx-props` parsed twice is two objects with one meaning). Plain data\n * is what JSON can describe: an array, or an object with no prototype but `Object`'s, reactive or\n * raw. Anything else — a `Map`, a `Set`, a class instance, a circular object — is different from\n * everything but itself, because its JSON form would not say what it holds and two different values\n * that serialise alike would close a cycle that was never there. The cost of that policy is a loop\n * the depth cap catches instead; the alternative is a false diagnostic on a page that would have\n * ended. Inside plain data the comparison IS the JSON form, so a member JSON cannot see (a\n * function, a `Map` two levels down) is not seen here either; §16.9 says so.\n *\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nfunction samePropValue(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n if (!isPlainData(a) || !isPlainData(b)) {\n return false;\n }\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a value is an array or a plain object — the shapes whose JSON form is the whole value.\n *\n * @param {unknown} value\n * @returns {value is object}\n */\nfunction isPlainData(value: unknown): value is object {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const raw: unknown = toRaw(value);\n if (Array.isArray(raw)) {\n return true;\n }\n const proto: unknown = Object.getPrototypeOf(raw);\n return proto === Object.prototype || proto === null;\n}\n\n/**\n * Whether two frames are the same instance: one tag, one set of prop names, equal values.\n *\n * @param {InstanceFrame} a\n * @param {InstanceFrame} b\n * @returns {boolean}\n */\nfunction sameFrame(a: InstanceFrame, b: InstanceFrame): boolean {\n if (a.tag !== b.tag) {\n return false;\n }\n const keys = Object.keys(a.props);\n if (keys.length !== Object.keys(b.props).length) {\n return false;\n }\n return keys.every(\n (key) => Object.hasOwn(b.props, key) && samePropValue(a.props[key], b.props[key]),\n );\n}\n\n/**\n * The chain an instance's own render runs under: the enclosing chain plus itself — or the\n * diagnostic that says why it must not render at all.\n *\n * The two messages are the compiler's, word for word (`renderComponentInstance` in\n * `@jxsuite/compiler`), so a page that fails to build and a canvas that fails to paint say the same\n * thing about the same definition. Meeting a frame already on the chain, within the current\n * expansion, is the instance rendering itself with the same props, which never ends; a chain at the\n * cap is a self-reference whose props change — or whose repeats live in re-runs, where the cycle\n * check is not asked ({@link InstancePath}) — and whose stop case never came.\n *\n * @param {InstancePath} path - The chain the instance was created under\n * @param {InstanceFrame} frame - The instance about to render\n * @returns {InstancePath} The chain its children render under\n * @throws {Error} The named diagnostic — never a stack overflow, never a hang\n * @docs framework/concepts/components\n */\nfunction extendInstancePath(path: InstancePath, frame: InstanceFrame): InstancePath {\n const chain = [...path.frames.map((f) => f.tag), frame.tag].join(\" → \");\n if (path.frames.slice(path.expansion).some((f) => sameFrame(f, frame))) {\n throw new Error(\n `Component <${frame.tag}> renders itself: ${chain}. A component cannot appear inside its own ` +\n `definition with the same props — the expansion would never end.`,\n );\n }\n if (path.frames.length >= MAX_COMPONENT_NESTING) {\n throw new Error(\n `Component nesting exceeds ${MAX_COMPONENT_NESTING} levels: ${chain}. A component that ` +\n `renders itself with changing props needs a case that stops.`,\n );\n }\n return { expansion: path.expansion, frames: [...path.frames, frame] };\n}\n\n/**\n * Register a custom element from a Jx document.\n *\n * @param {string | JxDocument} source - URL to .json file, or raw document object\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<void>}\n */\nconst _definedSources = new Set<string>();\n\nexport async function defineElement(source: string | JxDocument, baseUrl?: string) {\n let base = baseUrl;\n let doc = source;\n if (typeof source === \"string\") {\n base = new URL(source, base ?? location.href).href;\n if (_definedSources.has(base)) {\n return;\n }\n _definedSources.add(base);\n doc = await resolve(source);\n }\n base ??= location.href;\n\n const source_: JxDocument = doc as JxDocument;\n\n const { tagName } = source_;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx defineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (customElements.get(tagName)) {\n return;\n }\n\n // Register sub-dependencies first\n if (source_.$elements) {\n await registerElements(source_.$elements, base);\n }\n\n _elementDefs.set(tagName, { base, doc: source_ });\n\n // The definition as first given. The class reads the CURRENT one at connection (see\n // `redefineElement`); only `observedAttributes` is frozen here, because the platform freezes it.\n const initialDef = source_;\n const initialBase = base;\n const observedAttrs = initialDef.observedAttributes ?? [];\n\n const ElementClass = class extends HTMLElement {\n _jxInitialized = false;\n _state: JxScope | null = null;\n\n static get observedAttributes() {\n return observedAttrs;\n }\n\n async connectedCallback() {\n // An element carrying `data-jx-definition-root` IS the definition being rendered by an\n // External renderer (the studio canvas editing this component's own document) — its subtree\n // Is authored DOM, not an instantiation site. Self-initializing here would wipe that tree\n // And re-render it with default state (the \"component editor shows a live instance\" bug).\n if (this.dataset.jxDefinitionRoot !== undefined) {\n return;\n }\n if (this._jxInitialized) {\n return;\n }\n this._jxInitialized = true;\n\n /* The chain this instance was created under, read BEFORE the first `await`: the enclosing\n render is still on the stack now and will not be when this callback resumes. See\n {@link _instancePath} for why that ordering is the whole mechanism. */\n const enclosingPath = _instancePath;\n /* What this instance was given, recorded beside each write into state below. It is the\n instance's identity on the chain (§16.9): two nested instances of one tag that were given\n the same values render the same thing, forever. Only a value the definition's state READS\n is recorded — a `$props` key no state entry declares changes nothing about the render, so\n a definition that \"varies\" one at each level is still rendering itself. */\n const supplied: Record<string, unknown> = {};\n\n // The definition as it stands NOW — a redefinition since this class was made is honoured.\n const live = _elementDefs.get(tagName) ?? { base: initialBase, doc: initialDef };\n const def = live.doc;\n const defBase = live.base;\n\n // The element is its own dispatch root: a body run without an event emits from the host.\n const state = await buildScope(def, {}, defBase, { base: defBase, media: null, root: this });\n\n // Read properties from the data-jx-props payload the site build writes on a\n // Non-static instance, so an upgrade re-renders with the authored props, not the defaults.\n /* Observed attributes already on the element are read now. `attributeChangedCallback` fires\n for an attribute set before connection too — but on an instance with no state yet, so it\n had nothing to write into, and `<jx-icon name=\"plus\">` rendered with the default. Before\n the `$props` merges below, so a property a parent set still wins (spec §16.2). */\n for (const attr of observedAttrs) {\n if (this.hasAttribute(attr)) {\n absorbAttribute(state, attr, this.getAttribute(attr));\n // The raw string, not the coerced value: coercion is a function of it, so two equal\n // Strings are one input.\n supplied[attr] = this.getAttribute(attr);\n }\n }\n\n const propsAttr = this.dataset.jxProps;\n if (propsAttr) {\n try {\n const props = JSON.parse(propsAttr) as Record<string, unknown>;\n for (const [key, val] of Object.entries(props)) {\n if (refusePrivateProp(key, \"data-jx-props\")) {\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = val;\n supplied[key] = val;\n }\n }\n } catch {}\n delete this.dataset.jxProps;\n }\n\n // Read literal `props.*` attributes (JSON-authored instances pass props this way; the\n // Compiler lifts them into $props at build, and this is the live-render mirror). String\n // Values only — HTML lowercases attribute names, so state keys must be lowercase to match.\n // Collect first: removing while iterating the live NamedNodeMap skips entries.\n const propAttrNames = this.getAttributeNames().filter(\n (name) => name.startsWith(\"props.\") && name.length > \"props.\".length,\n );\n for (const name of propAttrNames) {\n const key = name.slice(\"props.\".length);\n if (refusePrivateProp(key, \"props.* attribute\")) {\n this.removeAttribute(name);\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = this.getAttribute(name);\n supplied[key] = this.getAttribute(name);\n this.removeAttribute(name);\n }\n }\n\n // Merge $props set as JS properties by parent before connection\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n if (\n key in this &&\n (this as Record<string, unknown>)[key] !== undefined &&\n instanceSupplies(this, key)\n ) {\n state[key] = (this as Record<string, unknown>)[key];\n supplied[key] = (this as Record<string, unknown>)[key];\n }\n }\n\n /* Every input is known now, so this is where an instance that would never finish is\n refused (§16.9): before it has a state, a style or a child, so a refused host is an empty\n element the page renders around — emptied of what the definition wrote into it for its\n slots too, since nothing will distribute that. The diagnostic is REPORTED rather than\n thrown onward: a throw from an async `connectedCallback` is an unhandled rejection that\n names no element and stops nothing. It goes two ways. The console is the runtime's\n surface for a render that fails after the page has settled (`$switch` external cases and\n the dev proxies report there too). The `jx-error` event is the surface a HOST can hold:\n it bubbles from the refused element with the error on it, so a page, or the studio canvas\n wrapping one, can collect it where a console line inside an iframe reaches nobody. The\n rest of the page keeps rendering, which is the point.\n\n Neither surface is used for a host that is no longer in the document. A refused instance\n was connected when this callback began, and one that is not by the time the verdict is in\n belongs to a subtree the page discarded during the `await` above: a prerendered host of the\n same tag that was parsed INSIDE another and re-rendered from the definition by the outer\n one's upgrade, which captures it as slot content and empties itself. Its replacement is\n the instance that reports, on the chain the outer upgrade draws; reporting from the\n discarded copy too said one defect twice. The refusal itself still stands, so a host\n re-attached later is an empty element and not a hang. */\n let ownPath: InstancePath;\n try {\n ownPath = extendInstancePath(enclosingPath, { props: supplied, tag: tagName });\n } catch (error) {\n this.replaceChildren();\n if (!this.isConnected) {\n return;\n }\n console.error(`Jx: <${tagName}> was not rendered:`, error);\n this.dispatchEvent(\n new ErrorEvent(\"jx-error\", {\n bubbles: true,\n composed: true,\n error,\n message: error instanceof Error ? error.message : String(error),\n }),\n );\n return;\n }\n /*\n * Set up property getters/setters that forward into reactive state. Private entries get NO\n * accessor: the property-first interface IS the props mechanism, so defining one would leave\n * `el[\"#cache\"] = x` writing straight through everything above.\n */\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n if (!(key in HTMLElement.prototype)) {\n Object.defineProperty(this, key, {\n configurable: true,\n get: () => state[key],\n set: (v: unknown) => {\n state[key] = v;\n },\n });\n }\n }\n\n this._state = state;\n\n // Capture light DOM children (for slot distribution) before rendering\n const slottedChildren = [...this.childNodes];\n this.replaceChildren();\n\n /* Custom elements default to `display: inline`; a Jx container behaves like a `<div>`, so\n one is supplied. It goes in the element's OWN RULE rather than inline: an inline\n declaration is beaten only by `!important`, so a consumer could not override the default\n without one. At (0,1,0) a consumer's rule, a cascade layer or a parent's descendant rule\n all win normally, and the definition's own `display` still wins because it is written into\n the same rule after this. */\n const defStyle = declaresDisplay(def.style) ? def.style : { display: \"block\", ...def.style };\n /* Definition first, call site second, so the call site wins at equal specificity by source\n order — the promise §9.2 already makes for base-before-nested. Merged into ONE call\n because each `applyStyle` releases what the last one interned. */\n const hostStyle = mergeStyle(defStyle as JxStyle, callSiteStyles.get(this));\n\n // Render template into light DOM (once, not in effect — inner effects handle reactivity)\n applyStyle(this, hostStyle, (state[\"$media\"] as Record<string, string>) ?? {}, state);\n applyAttributes(this, def.attributes ?? {}, state);\n bindDefinitionHandlers(this, def, state);\n\n /*\n * Root-level `textContent` is a definition's content just as much as `children` is — it is\n * the shape spec.md §17.2 recommends when every child would be a bare string — and it was\n * dropped here, so such a component rendered empty everywhere the interpreter runs.\n */\n if (!Array.isArray(def.children) && def.textContent !== undefined) {\n bindProperty(this, \"textContent\", def.textContent, state);\n }\n const children = Array.isArray(def.children) ? def.children : [];\n /* An instance the studio stamped is part of the page being edited, so everything the\n definition draws inside it is too — and the de-link rules cannot see that from the nodes\n themselves. Restored rather than cleared, because one definition may render another. */\n const wasInside = _canvasInsideStampedHost;\n _canvasInsideStampedHost ||= this.dataset.jxPath !== undefined;\n /* And the chain, for the same span: an instance this definition draws connects inside\n `this.append` below and reads it there ({@link underInstancePath}). */\n try {\n underInstancePath(ownPath, () => {\n for (const childDef of children) {\n this.append(renderNode(childDef, state));\n }\n });\n } finally {\n _canvasInsideStampedHost = wasInside;\n }\n\n // Slot distribution (light DOM)\n distributeSlots(this, slottedChildren);\n\n /* Lifecycle: onMount, with the HOST as its second argument.\n A sidecar that must reach the element it belongs to had no way to: the runtime handed it\n the scope alone, so elements resorted to dispatching a `jx-ready` event at themselves and\n catching it with a root handler purely to learn `currentTarget`. The host is what the\n callback needed; the event round trip was the workaround. */\n const { onMount } = state;\n if (typeof onMount === \"function\") {\n queueMicrotask(() => (onMount as (s: JxScope, host: HTMLElement) => unknown)(state, this));\n }\n }\n\n disconnectedCallback() {\n if (typeof this._state?.onUnmount === \"function\") {\n (this._state.onUnmount as (s: JxScope) => unknown)(this._state);\n }\n }\n\n adoptedCallback() {\n if (typeof this._state?.onAdopted === \"function\") {\n (this._state.onAdopted as (s: JxScope) => unknown)(this._state);\n }\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n if (!this._state || oldVal === newVal) {\n return;\n }\n // The CURRENT definition's defaults, so a redefinition (embedding.md §7) that changes one\n // Reaches an instance that is already connected.\n absorbAttribute(\n this._state,\n name,\n newVal,\n declaredDefaults(_elementDefs.get(tagName)?.doc ?? initialDef),\n );\n }\n };\n\n customElements.define(tagName, ElementClass);\n}\n\n/**\n * Render a registered custom element with $props (property-first interface).\n *\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @param {JxPath} [path]\n * @returns {HTMLElement}\n */\nfunction renderCustomElementWithProps(\n def: JxElement,\n state: JxScope,\n options?: JxRenderOptions,\n path?: JxPath,\n) {\n const el = document.createElement(resolveTagName(def.tagName, state));\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path ?? [], def, state);\n }\n\n // Set JS properties from $props (before connection)\n for (const [key, val] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(key, \"$props\")) {\n continue;\n }\n /* The same resolution `bindProperty` gives an ordinary element. A `$props: { src }` on a custom\n element is an asset reference authored at the USAGE site, so it belongs to the document that\n wrote it — a media prop the component forwards into its own `<img>` is resolved separately,\n inside the component's render, against the same context. */\n const write = (resolved: unknown): void => {\n (el as unknown as Record<string, unknown>)[key] =\n typeof resolved === \"string\" ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n };\n if (isRefObj(val)) {\n const refVal = val;\n write(resolveRef(refVal.$ref, state));\n // Reactive forwarding: re-set the property when the source changes\n effect(() => {\n write(resolveRef(refVal.$ref, state));\n });\n } else if (isTemplateString(val)) {\n effect(() => {\n write(evaluateTemplate(val, state));\n });\n } else {\n write(val);\n }\n }\n\n /* Apply host-level style and attributes from the usage site.\n Also REMEMBERED, because `connectedCallback` applies the definition's style through the same\n interning path and `applyStyleInto` releases the element's existing rules first — so without\n this the call site's declarations were written here and deleted a moment later, and a document\n could not style an element instance at all. See {@link callSiteStyles}. */\n if (def.style) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(el, def.style ?? {}, (state[\"$media\"] as Record<string, string>) ?? {}, state);\n applyAttributes(el, def.attributes ?? {}, state);\n /* And its ordinary properties and handlers — `id`, `hidden`, `className`, an `onselect` — exactly\n as an ordinary element gets them. A custom element used in a document is still an element in\n that document; only `$props` are the definition's to absorb. */\n applyProperties(el, def, state);\n\n // Append slotted children. A mapped array is not a node: its rows are rendered in place, ahead of\n // Their anchor, exactly as they are under an ordinary element — so a `$map` of menu rows inside a\n // `jx-menu` is a list of rows, not one `<div>` standing where the list should be.\n const children = Array.isArray(def.children) ? def.children : [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i]!;\n const childOpts = options && path ? { ...options, _path: [...path, \"children\", i] } : undefined;\n if (isMappedArray(child)) {\n renderMappedArrayInto(el, child, state, childOpts);\n } else {\n el.append(renderNode(child, state, childOpts));\n }\n }\n\n return el;\n}\n\n/**\n * Light DOM slot distribution.\n *\n * @param {HTMLElement} host\n * @param {ChildNode[]} slottedChildren\n */\nfunction distributeSlots(host: HTMLElement, slottedChildren: ChildNode[]) {\n /* No early return when nothing was slotted. A slot leaves no node WHETHER OR NOT it received\n anything — an unmatched one unwraps to its own fallback children, and a host given nothing at\n all is just every slot unmatched. Returning early here left the slot standing in exactly the\n case an element most wants to detect: `[part=\"label\"]:empty` answered false for a control with\n no label, because the surviving slot was still a child. */\n const slots = host.querySelectorAll(\"slot\");\n if (slots.length === 0) {\n return;\n }\n\n const named = new Map<string | null, ChildNode[]>();\n const unnamed: ChildNode[] = [];\n\n for (const child of slottedChildren) {\n if (child.nodeType === Node.ELEMENT_NODE && (child as Element).getAttribute(\"slot\")) {\n const name = (child as Element).getAttribute(\"slot\");\n if (!named.has(name)) {\n named.set(name, []);\n }\n (named.get(name) as ChildNode[]).push(child);\n } else {\n unnamed.push(child);\n }\n }\n\n /* A `<slot>` UNWRAPS: its matches stand in its place and the slot itself leaves no node.\n It used to survive, holding its matches as children. The box tree looked right, because a\n slot is `display: contents` — but the SELECTOR tree did not, so every `& > x` rule in a\n definition silently stopped matching a slotted child, which is now a grandchild. Measured on\n the field row: 68.40px where the class form gives 88.40px, and its help text 80px wide\n instead of 260px, with `[data-span]` dead. An unmatched slot unwraps to its own fallback\n children, which is what the platform's slot does when nothing is assigned to it. */\n for (const slot of slots) {\n const name = slot.getAttribute(\"name\");\n const matches = name ? (named.get(name) ?? []) : unnamed;\n slot.replaceWith(...(matches.length > 0 ? matches : [...slot.childNodes]));\n }\n}\n"
|
|
16
16
|
],
|
|
17
|
-
"mappings": ";AAMA,SAAS,OAAO,CAAC,KAAK;AAAA,EACpB,MAAM,sBAAsB,OAAO,OAAO,IAAI;AAAA,EAC9C,WAAW,OAAO,IAAI,MAAM,GAAG;AAAA,IAAG,IAAI,OAAO;AAAA,EAC7C,OAAO,CAAC,SAAQ,OAAO;AAAA;AAGzB,IAAM,YAAwD,OAAO,OAAO,CAAC,CAAC;AAC9E,IAAM,YAAwD,OAAO,OAAO,CAAC,CAAC;AAO9E,IAAM,SAA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