mathjson-tree-builder 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/data-model/classify.d.ts +8 -0
- package/dist/data-model/path.d.ts +57 -0
- package/dist/data-model/symbols.d.ts +17 -0
- package/dist/element.d.ts +65 -0
- package/dist/index.d.ts +13 -0
- package/dist/mathjson-tree-builder.js +3720 -0
- package/dist/mathjson-tree-builder.js.map +1 -0
- package/dist/registry/constructs.generated.d.ts +11 -0
- package/dist/registry/curated-args.d.ts +10 -0
- package/dist/registry/display-names.d.ts +10 -0
- package/dist/registry/notation-shape.d.ts +11 -0
- package/dist/registry/notation.d.ts +29 -0
- package/dist/registry/registry.d.ts +54 -0
- package/dist/styles.d.ts +1 -0
- package/dist/types.d.ts +77 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mathjson-tree-builder.js","names":["t","e","s","o","n","r","i","S","c","i","e","h","r","o","n","a","c","l","p","d","u","f","b","y","t","s","i","s","o","n","r","t","e","r","o","e","t","r","t"],"sources":["../node_modules/@lit/reactive-element/css-tag.js","../node_modules/@lit/reactive-element/reactive-element.js","../node_modules/lit-html/lit-html.js","../node_modules/lit-element/lit-element.js","../node_modules/@lit/reactive-element/decorators/property.js","../node_modules/@lit/reactive-element/decorators/state.js","../src/types.ts","../src/data-model/path.ts","../src/data-model/symbols.ts","../src/data-model/classify.ts","../src/registry/constructs.generated.ts","../src/registry/curated-args.ts","../src/registry/display-names.ts","../src/registry/notation.ts","../src/registry/registry.ts","../src/registry/notation-shape.ts","../src/styles.ts","../src/element.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new n(\"string\"==typeof t?t:t+\"\",void 0,s),i=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(s)+t[o+1],t[0]);return new n(o,t,s)},S=(s,o)=>{if(e)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement(\"style\"),n=t.litNonce;void 0!==n&&o.setAttribute(\"nonce\",n),o.textContent=e.cssText,s.appendChild(o)}},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{n as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n","import{getCompatibleStyle as t,adoptStyles as s}from\"./css-tag.js\";export{CSSResult,css,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:\"\",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},f=(t,s)=>!i(t,s),b={attribute:!0,type:String,converter:u,reflect:!1,useDefault:!1,hasChanged:f};Symbol.metadata??=Symbol(\"metadata\"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h)}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d(\"elementProperties\")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(d(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d(\"properties\"))){const t=this.properties,s=[...r(t),...o(t)];for(const i of s)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(t(s))}else void 0!==s&&i.push(t(s));return i}static _$Eu(t,s){const i=s.attribute;return!1===i?void 0:\"string\"==typeof i?i:\"string\"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null}}requestUpdate(t,s,i,e=!1,h){if(void 0!==t){const r=this.constructor;if(!1===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:\"open\"},y[d(\"elementProperties\")]=new Map,y[d(\"finalized\")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push(\"2.1.2\");export{y as ReactiveElement,s as adoptStyles,u as defaultConverter,t as getCompatibleStyle,f as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,i=t=>t,s=t.trustedTypes,e=s?s.createPolicy(\"lit-html\",{createHTML:t=>t}):void 0,h=\"$lit$\",o=`lit$${Math.random().toFixed(9).slice(2)}$`,n=\"?\"+o,r=`<${n}>`,l=document,c=()=>l.createComment(\"\"),a=t=>null===t||\"object\"!=typeof t&&\"function\"!=typeof t,u=Array.isArray,d=t=>u(t)||\"function\"==typeof t?.[Symbol.iterator],f=\"[ \\t\\n\\f\\r]\",v=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\\\s\"'>=/]+)(${f}*=${f}*(?:[^ \\t\\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),g=/'/g,$=/\"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),w=x(2),T=x(3),E=Symbol.for(\"lit-noChange\"),A=Symbol.for(\"lit-nothing\"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return void 0!==e?e.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?\"<svg>\":3===i?\"<math>\":\"\",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?\"!--\"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp(\"</\"+u[2],\"g\")),c=p):void 0!==u[3]&&(c=p):c===p?\">\"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'\"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith(\"/>\")?\" \":\"\";l+=c===v?s+r:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o+x):s+o+(-2===d?i:x)}return[V(t,l+(t[s]||\"<?>\")+(2===i?\"</svg>\":3===i?\"</math>\":\"\")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h)){const i=v[a++],s=r.getAttribute(t).split(o),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:\".\"===e[1]?I:\"?\"===e[1]?L:\"@\"===e[1]?z:H}),r.removeAttribute(t)}else t.startsWith(o)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o),i=t.length-1;if(i>0){r.textContent=s?s.emptyScript:\"\";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c())}}}else if(8===r.nodeType)if(r.data===n)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=r.data.indexOf(o,t+1));)d.push({type:7,index:l}),t+=o.length-1}l++}}static createElement(t,i){const s=l.createElement(\"template\");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,!0);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n]}o!==r?.index&&(h=P.nextNode(),o++)}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M(this,t,i),a(t)?t===A||null==t||\"\"===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t}$(t){const{values:i,_$litType$:s}=t,e=\"number\"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else{const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c()),this.O(c()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){const s=i(t).nextSibling;i(t).remove(),t=s}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||\"\"!==s[0]||\"\"!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else{const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??\"\")+h[n+1]),this._$AH[n]=r}o&&!e&&this.j(t)}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??\"\")}}class I extends H{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===A?void 0:t}}class L extends H{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A)}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){\"function\"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const j={M:h,P:o,A:n,C:1,L:N,R,D:d,V:M,I:k,H,N:L,U:z,B:I,F:Z},B=t.litHtmlPolyfillSupport;B?.(S,k),(t.litHtmlVersions??=[]).push(\"3.3.3\");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c(),t),t,void 0,s??{})}return h._$AI(t),h};export{j as _$LH,b as html,T as mathml,E as noChange,A as nothing,D as render,w as svg};\n//# sourceMappingURL=lit-html.js.map\n","import{ReactiveElement as t}from\"@lit/reactive-element\";export*from\"@lit/reactive-element\";import{render as e,noChange as r}from\"lit-html\";export*from\"lit-html\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const s=globalThis;class i extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=e(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return r}}i._$litElement$=!0,i[\"finalized\"]=!0,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});const n={_$AK:(t,e,r)=>{t._$AK(e,r)},_$AL:t=>t._$AL};(s.litElementVersions??=[]).push(\"4.2.2\");export{i as LitElement,n as _$LE};\n//# sourceMappingURL=lit-element.js.map\n","import{notEqual as t,defaultConverter as e}from\"../reactive-element.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o={attribute:!0,type:String,converter:e,reflect:!1,hasChanged:t},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),\"setter\"===n&&((t=Object.create(t)).wrapped=!0),s.set(r.name,t),\"accessor\"===n){const{name:o}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,!0,r)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if(\"setter\"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,!0,r)}}throw Error(\"Unsupported decorator location: \"+n)};function n(t){return(e,o)=>\"object\"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}export{n as property,r as standardProperty};\n//# sourceMappingURL=property.js.map\n","import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n","/**\n * Core types for mathjson-tree-builder.\n */\n\n/**\n * A MathJSON expression, restricted to the \"array form\" this editor\n * operates on directly (no LaTeX, no boxed/canonical forms):\n *\n * - a number literal\n * - a boolean literal\n * - a string — either a literal string *value*, or a bare symbol\n * reference (e.g. a named survey question). Disambiguating the two is\n * the host application's job via the symbol resolver, not this\n * editor's — see `resolveSymbol` in `data-model/symbols.ts`.\n * - a compound expression `[constructName, ...args]`\n */\nexport type MathJsonExpression =\n | number\n | boolean\n | string\n | MathJsonExpression[];\n\n/** True for a compound expression `[constructName, ...args]`. */\nexport function isCompound(\n expr: MathJsonExpression,\n): expr is MathJsonExpression[] {\n return Array.isArray(expr) && typeof expr[0] === \"string\";\n}\n\n/**\n * Type-guard for arbitrary parsed JSON (e.g. from the raw-JSON escape\n * hatch): true for a number, boolean, string, or an array recursively made\n * of the same — false for `null`, a plain object, or `undefined`. This is\n * deliberately just a shape check, not semantic validation (a compound\n * expression's first element isn't required to be a known construct name)\n * — the raw-JSON view's job is catching malformed JSON, not building a\n * MathJSON linter.\n */\nexport function isValidMathJson(value: unknown): value is MathJsonExpression {\n if (\n typeof value === \"number\" ||\n typeof value === \"boolean\" ||\n typeof value === \"string\"\n ) {\n return true;\n }\n return Array.isArray(value) && value.every(isValidMathJson);\n}\n\n/**\n * A path from the root to a node: an array of indices. `[]` addresses the\n * root itself. `[i]` addresses element `i` of the root (index `0` is the\n * construct name for a compound root). Nested paths descend the same way.\n */\nexport type Path = readonly number[];\n\n/** Metadata for one argument of a construct, for nicer generic-mode labels. */\nexport interface ArgSpec {\n label: string;\n /** True on the last entry of a genuinely unbounded (variadic) construct. */\n variadic?: boolean;\n /**\n * True for a trailing argument that may be omitted (e.g. `Round`'s\n * `digits`) — only meaningful on the last entry/entries; arity bounds\n * (`argBounds` in the registry) assume optional args are trailing.\n */\n optional?: boolean;\n defaultValue?: MathJsonExpression;\n}\n\n/**\n * Registry entry for one MathJSON construct. `args` and `notation` are\n * optional, best-effort metadata — a construct with neither still renders\n * correctly through the fully generic fallback.\n */\nexport interface ConstructDescriptor {\n name: string;\n category: string;\n args?: ArgSpec[];\n}\n\n/**\n * A host-supplied named reference the user can insert into an expression\n * (e.g. a survey question, a spreadsheet cell, a form field) — see\n * `resolveSymbol` in `data-model/symbols.ts`.\n * Inserted verbatim as a bare MathJSON string (`id`).\n */\nexport interface SymbolReference {\n id: string;\n label: string;\n type?: string;\n group?: string;\n}\n\n/** Result of an optional host-wired evaluator. */\nexport type EvalResult =\n | { result: MathJsonExpression }\n | { error: string; path?: Path };\n\nexport type Evaluator = (\n expr: MathJsonExpression,\n parameters: Record<string, MathJsonExpression>,\n) => Promise<EvalResult>;\n","/**\n * Generic, path-based tree mutation.\n *\n * This is the *only* place that knows how to read/write a node given its\n * path from the root. Node rendering code calls these, and only these —\n * there is deliberately no per-construct-name mutation logic anywhere else\n * (contrast with prior art, which re-derived \"where in\n * the parent array does this go\" via a giant if/else keyed on construct\n * name).\n */\nimport { isCompound, type MathJsonExpression, type Path } from \"../types.js\";\n\n/** Read the node at `path`, relative to `root`. `path: []` returns `root`. */\nexport function getAtPath(\n root: MathJsonExpression,\n path: Path,\n): MathJsonExpression {\n let node = root;\n for (const key of path) {\n if (!Array.isArray(node)) {\n throw new Error(\n `getAtPath: cannot descend into a non-array node at index ${key}`,\n );\n }\n const next = node[key];\n if (next === undefined) {\n throw new Error(`getAtPath: no element at index ${key}`);\n }\n node = next;\n }\n return node;\n}\n\n/**\n * Return a new root with the node at `path` replaced by `value`. Does not\n * mutate `root`. `path: []` replaces the whole root — wrapping the root in\n * a new parent construct (the \"add parent node\" operation) is therefore\n * the exact same call as wrapping any other node, just with an empty path;\n * callers reassign `el.value` to the result either way.\n *\n * Uses shallow copy-on-the-path-only structural sharing: only the arrays\n * along `path` are cloned, every sibling subtree is reused as-is.\n */\nexport function setAtPath(\n root: MathJsonExpression,\n path: Path,\n value: MathJsonExpression,\n): MathJsonExpression {\n if (path.length === 0) return value;\n const head = path[0]!;\n const rest = path.slice(1);\n if (!Array.isArray(root)) {\n throw new Error(\n `setAtPath: cannot descend into a non-array node at index ${head}`,\n );\n }\n const copy = root.slice();\n copy[head] = setAtPath(copy[head] ?? 0, rest, value);\n return copy;\n}\n\n/**\n * Append a new argument to the compound expression at `path`.\n * `node` must be `[constructName, ...args]`; the new value is added last.\n */\nexport function withArgAdded(\n node: MathJsonExpression[],\n value: MathJsonExpression,\n): MathJsonExpression[] {\n return [...node, value];\n}\n\n/**\n * Remove the argument at `argIndex` (an index into the compound array\n * itself, so `1` is the first argument — index `0` is the construct name\n * and is never a valid `argIndex`).\n */\nexport function withArgRemoved(\n node: MathJsonExpression[],\n argIndex: number,\n): MathJsonExpression[] {\n if (argIndex <= 0) {\n throw new Error(\"withArgRemoved: argIndex must be >= 1\");\n }\n return node.filter((_, i) => i !== argIndex);\n}\n\n/**\n * Wrap the node currently at `path` in a new parent construct `X`, so it\n * becomes `X`'s first argument: `V` -> `[X, V, ...extraArgs]`. This is the\n * one and only implementation of the \"add parent node\" operation — it\n * works identically whether `path` addresses the root (`[]`) or any nested\n * node, because it's built directly on `getAtPath`/`setAtPath`.\n */\nexport function wrapAtPath(\n root: MathJsonExpression,\n path: Path,\n constructName: string,\n extraArgs: MathJsonExpression[] = [],\n): MathJsonExpression {\n const current = getAtPath(root, path);\n return setAtPath(root, path, [constructName, current, ...extraArgs]);\n}\n\n/**\n * Swap the construct name of the compound node at `path`, keeping its\n * arguments unchanged: `[Greater, a, b]` -> `[LessEqual, a, b]`. Meant for\n * switching among arity-compatible siblings (the curated comparison/infix\n * groups in `registry/notation.ts`'s `swapTargets`) — this doesn't check\n * compatibility itself, it's a pure rename of index 0.\n *\n * `reverseFirstTwoArgs` additionally swaps the first two arguments —\n * needed for the one pair in that group with a different calling\n * convention (`Contains`'s collection-first order vs. everything else's\n * value-first order; see `registry/notation.ts`'s `swapNeedsArgReversal`),\n * where keeping the args as-is would silently reverse the meaning.\n */\nexport function swapOperator(\n root: MathJsonExpression,\n path: Path,\n newName: string,\n reverseFirstTwoArgs = false,\n): MathJsonExpression {\n const current = getAtPath(root, path);\n if (!isCompound(current)) {\n throw new Error(\"swapOperator: node at path is not a compound expression\");\n }\n const args = current.slice(1);\n if (reverseFirstTwoArgs && args.length >= 2) {\n [args[0], args[1]] = [args[1]!, args[0]!];\n }\n return setAtPath(root, path, [newName, ...args]);\n}\n","/**\n * Symbol reference resolution.\n *\n * A MathJSON string leaf is ambiguous on its own — it's either a literal\n * string *value* or a bare symbol reference. This editor doesn't decide\n * that itself; it just checks the string against the host-supplied\n * `symbols` list and renders accordingly (a matching id renders as a\n * labeled chip, a non-matching string renders as a plain literal input).\n */\nimport type { SymbolReference } from \"../types.js\";\n\nexport function resolveSymbol(\n symbols: readonly SymbolReference[],\n value: string,\n): SymbolReference | undefined {\n return symbols.find((s) => s.id === value);\n}\n\n/**\n * Filter/sort `symbols` for a given search term and optional expected\n * `type` hint (a soft hint, not a hard validation rule — matching\n * entries sort first, non-matching entries are still included).\n */\nexport function searchSymbols(\n symbols: readonly SymbolReference[],\n query: string,\n expectedType?: string,\n): SymbolReference[] {\n const q = query.trim().toLowerCase();\n const matches = (s: SymbolReference) =>\n !q ||\n s.label.toLowerCase().includes(q) ||\n s.id.toLowerCase().includes(q);\n\n return symbols\n .filter(matches)\n .slice()\n .sort((a, b) => {\n if (expectedType) {\n const aFits = a.type === expectedType ? 0 : 1;\n const bFits = b.type === expectedType ? 0 : 1;\n if (aFits !== bFits) return aFits - bFits;\n }\n return a.label.localeCompare(b.label);\n });\n}\n","/**\n * Classify a node's current \"kind\" for rendering/editing purposes. This is\n * the one place that decides literal-vs-symbol-vs-function for a value —\n * see `resolveSymbol` for why a string is ambiguous on its own.\n */\nimport type { MathJsonExpression, SymbolReference } from \"../types.js\";\nimport { resolveSymbol } from \"./symbols.js\";\n\nexport type NodeKind = \"number\" | \"boolean\" | \"text\" | \"symbol\" | \"function\";\n\nexport function classifyValue(\n value: MathJsonExpression,\n symbols: readonly SymbolReference[],\n): NodeKind {\n if (Array.isArray(value)) return \"function\";\n if (typeof value === \"number\") return \"number\";\n if (typeof value === \"boolean\") return \"boolean\";\n return resolveSymbol(symbols, value) ? \"symbol\" : \"text\";\n}\n","/**\n * GENERATED FILE — do not hand-edit.\n *\n * Produced by `scripts/extract-registry.py` from mathjson-solver's own\n * `constructs` dict (`src/mathjson_solver/__main__.py`). Regenerate with:\n *\n * python3 scripts/extract-registry.py <path-to-mathjson-solver-checkout>\n */\nimport type { ConstructDescriptor } from \"../types.js\";\n\nexport const CATEGORY_LABELS: Record<string, string> = {\n \"arithmetic\": \"Arithmetic\",\n \"array_arithmetic\": \"Array Arithmetic\",\n \"boolean_logic\": \"Boolean Logic\",\n \"collection\": \"Collections\",\n \"combinatorics\": \"Combinatorics\",\n \"comparison\": \"Comparisons\",\n \"constants\": \"Constants\",\n \"control_flow\": \"Control Flow\",\n \"core\": \"Core\",\n \"datetime\": \"Date & Time\",\n \"functional\": \"Functional\",\n \"number_theory\": \"Number Theory\",\n \"special_function\": \"Special Functions\",\n \"statistics\": \"Statistics\",\n \"string\": \"Strings\",\n \"trigonometric\": \"Trigonometric\",\n};\n\n// 338 constructs, extracted from mathjson-solver.\nexport const GENERATED_CONSTRUCTS: readonly ConstructDescriptor[] = [\n { name: \"Abs\", category: \"arithmetic\" },\n { name: \"Add\", category: \"arithmetic\" },\n { name: \"Average\", category: \"arithmetic\" },\n { name: \"Ceil\", category: \"arithmetic\" },\n { name: \"Clamp\", category: \"arithmetic\" },\n { name: \"Denominator\", category: \"arithmetic\" },\n { name: \"Divide\", category: \"arithmetic\" },\n { name: \"Equal\", category: \"arithmetic\" },\n { name: \"Exp\", category: \"arithmetic\" },\n { name: \"Float\", category: \"arithmetic\" },\n { name: \"Floor\", category: \"arithmetic\" },\n { name: \"If\", category: \"arithmetic\" },\n { name: \"Int\", category: \"arithmetic\" },\n { name: \"IsFalse\", category: \"arithmetic\" },\n { name: \"IsTrue\", category: \"arithmetic\" },\n { name: \"Lb\", category: \"arithmetic\" },\n { name: \"Lg\", category: \"arithmetic\" },\n { name: \"List\", category: \"arithmetic\" },\n { name: \"Ln\", category: \"arithmetic\" },\n { name: \"Log\", category: \"arithmetic\" },\n { name: \"Log10\", category: \"arithmetic\" },\n { name: \"Log2\", category: \"arithmetic\" },\n { name: \"LogOnePlus\", category: \"arithmetic\" },\n { name: \"Max\", category: \"arithmetic\" },\n { name: \"Mean\", category: \"arithmetic\" },\n { name: \"Median\", category: \"arithmetic\" },\n { name: \"Min\", category: \"arithmetic\" },\n { name: \"Multiply\", category: \"arithmetic\" },\n { name: \"Negate\", category: \"arithmetic\" },\n { name: \"NotEqual\", category: \"arithmetic\" },\n { name: \"Numerator\", category: \"arithmetic\" },\n { name: \"Power\", category: \"arithmetic\" },\n { name: \"Product\", category: \"arithmetic\" },\n { name: \"Rational\", category: \"arithmetic\" },\n { name: \"Root\", category: \"arithmetic\" },\n { name: \"Round\", category: \"arithmetic\" },\n { name: \"Sqrt\", category: \"arithmetic\" },\n { name: \"Square\", category: \"arithmetic\" },\n { name: \"StrictEqual\", category: \"arithmetic\" },\n { name: \"Subtract\", category: \"arithmetic\" },\n { name: \"Sum\", category: \"arithmetic\" },\n { name: \"AddArray\", category: \"array_arithmetic\" },\n { name: \"AddScalar\", category: \"array_arithmetic\" },\n { name: \"AtIndex\", category: \"array_arithmetic\" },\n { name: \"CumulativeProduct\", category: \"array_arithmetic\" },\n { name: \"CumulativeSum\", category: \"array_arithmetic\" },\n { name: \"FindIntervalIndex\", category: \"array_arithmetic\" },\n { name: \"GenerateRange\", category: \"array_arithmetic\" },\n { name: \"Interp\", category: \"array_arithmetic\" },\n { name: \"MultiplyByArray\", category: \"array_arithmetic\" },\n { name: \"MultiplyByScalar\", category: \"array_arithmetic\" },\n { name: \"Slice\", category: \"array_arithmetic\" },\n { name: \"SubtractArray\", category: \"array_arithmetic\" },\n { name: \"SubtractScalar\", category: \"array_arithmetic\" },\n { name: \"TrapezoidalIntegrate\", category: \"array_arithmetic\" },\n { name: \"Equivalent\", category: \"boolean_logic\" },\n { name: \"Implies\", category: \"boolean_logic\" },\n { name: \"Nand\", category: \"boolean_logic\" },\n { name: \"Nor\", category: \"boolean_logic\" },\n { name: \"Xor\", category: \"boolean_logic\" },\n { name: \"All\", category: \"collection\" },\n { name: \"Any\", category: \"collection\" },\n { name: \"Append\", category: \"collection\" },\n { name: \"Appended\", category: \"collection\" },\n { name: \"ArgMax\", category: \"collection\" },\n { name: \"ArgMin\", category: \"collection\" },\n { name: \"Array\", category: \"collection\" },\n { name: \"At\", category: \"collection\" },\n { name: \"Chunk\", category: \"collection\" },\n { name: \"ChunkBy\", category: \"collection\" },\n { name: \"Contains\", category: \"collection\" },\n { name: \"ContainsAllOf\", category: \"collection\" },\n { name: \"ContainsAnyOf\", category: \"collection\" },\n { name: \"ContainsNoneOf\", category: \"collection\" },\n { name: \"Contains_all_of\", category: \"collection\" },\n { name: \"Contains_any_of\", category: \"collection\" },\n { name: \"Contains_none_of\", category: \"collection\" },\n { name: \"Count\", category: \"collection\" },\n { name: \"CountIf\", category: \"collection\" },\n { name: \"Dedup\", category: \"collection\" },\n { name: \"DeleteAt\", category: \"collection\" },\n { name: \"Differences\", category: \"collection\" },\n { name: \"Drop\", category: \"collection\" },\n { name: \"DropWhile\", category: \"collection\" },\n { name: \"Element\", category: \"collection\" },\n { name: \"Find\", category: \"collection\" },\n { name: \"First\", category: \"collection\" },\n { name: \"FlatMap\", category: \"collection\" },\n { name: \"GroupBy\", category: \"collection\" },\n { name: \"HasMatchingSublist\", category: \"collection\" },\n { name: \"In\", category: \"collection\" },\n { name: \"IndexOf\", category: \"collection\" },\n { name: \"IndexWhere\", category: \"collection\" },\n { name: \"Insert\", category: \"collection\" },\n { name: \"Intersection\", category: \"collection\" },\n { name: \"Interval\", category: \"collection\" },\n { name: \"IsEmpty\", category: \"collection\" },\n { name: \"Join\", category: \"collection\" },\n { name: \"Last\", category: \"collection\" },\n { name: \"Length\", category: \"collection\" },\n { name: \"MaxBy\", category: \"collection\" },\n { name: \"MinBy\", category: \"collection\" },\n { name: \"Most\", category: \"collection\" },\n { name: \"NotElement\", category: \"collection\" },\n { name: \"NotIn\", category: \"collection\" },\n { name: \"NotSubset\", category: \"collection\" },\n { name: \"NotSuperset\", category: \"collection\" },\n { name: \"Not_in\", category: \"collection\" },\n { name: \"Open\", category: \"collection\" },\n { name: \"Ordering\", category: \"collection\" },\n { name: \"Partition\", category: \"collection\" },\n { name: \"Position\", category: \"collection\" },\n { name: \"Range\", category: \"collection\" },\n { name: \"ReplaceAt\", category: \"collection\" },\n { name: \"Rest\", category: \"collection\" },\n { name: \"Reverse\", category: \"collection\" },\n { name: \"RotateLeft\", category: \"collection\" },\n { name: \"RotateRight\", category: \"collection\" },\n { name: \"Scan\", category: \"collection\" },\n { name: \"Second\", category: \"collection\" },\n { name: \"SetMinus\", category: \"collection\" },\n { name: \"Sort\", category: \"collection\" },\n { name: \"Subset\", category: \"collection\" },\n { name: \"SubsetEqual\", category: \"collection\" },\n { name: \"Superset\", category: \"collection\" },\n { name: \"SupersetEqual\", category: \"collection\" },\n { name: \"SymmetricDifference\", category: \"collection\" },\n { name: \"Take\", category: \"collection\" },\n { name: \"TakeWhile\", category: \"collection\" },\n { name: \"Tally\", category: \"collection\" },\n { name: \"Third\", category: \"collection\" },\n { name: \"Union\", category: \"collection\" },\n { name: \"Unique\", category: \"collection\" },\n { name: \"Zip\", category: \"collection\" },\n { name: \"BellNumber\", category: \"combinatorics\" },\n { name: \"CartesianProduct\", category: \"combinatorics\" },\n { name: \"Choose\", category: \"combinatorics\" },\n { name: \"Combinations\", category: \"combinatorics\" },\n { name: \"Fibonacci\", category: \"combinatorics\" },\n { name: \"Multinomial\", category: \"combinatorics\" },\n { name: \"Permutations\", category: \"combinatorics\" },\n { name: \"PowerSet\", category: \"combinatorics\" },\n { name: \"Subfactorial\", category: \"combinatorics\" },\n { name: \"And\", category: \"comparison\" },\n { name: \"Congruent\", category: \"comparison\" },\n { name: \"Greater\", category: \"comparison\" },\n { name: \"GreaterEqual\", category: \"comparison\" },\n { name: \"IdenticallyEqual\", category: \"comparison\" },\n { name: \"IsDefined\", category: \"comparison\" },\n { name: \"IsUndefined\", category: \"comparison\" },\n { name: \"Less\", category: \"comparison\" },\n { name: \"LessEqual\", category: \"comparison\" },\n { name: \"Not\", category: \"comparison\" },\n { name: \"Or\", category: \"comparison\" },\n { name: \"CatalanConstant\", category: \"constants\" },\n { name: \"Degrees\", category: \"constants\" },\n { name: \"EulerGamma\", category: \"constants\" },\n { name: \"ExponentialE\", category: \"constants\" },\n { name: \"GoldenRatio\", category: \"constants\" },\n { name: \"MachineEpsilon\", category: \"constants\" },\n { name: \"Constants\", category: \"control_flow\" },\n { name: \"Function\", category: \"control_flow\" },\n { name: \"StrictSwitch\", category: \"control_flow\" },\n { name: \"Switch\", category: \"control_flow\" },\n { name: \"Variable\", category: \"control_flow\" },\n { name: \"Which\", category: \"control_flow\" },\n { name: \"Head\", category: \"core\" },\n { name: \"Hold\", category: \"core\" },\n { name: \"Identity\", category: \"core\" },\n { name: \"IsSame\", category: \"core\" },\n { name: \"Same\", category: \"core\" },\n { name: \"Tail\", category: \"core\" },\n { name: \"Type\", category: \"core\" },\n { name: \"Now\", category: \"datetime\" },\n { name: \"Strftime\", category: \"datetime\" },\n { name: \"Strptime\", category: \"datetime\" },\n { name: \"TimeDeltaDays\", category: \"datetime\" },\n { name: \"TimeDeltaHours\", category: \"datetime\" },\n { name: \"TimeDeltaMinutes\", category: \"datetime\" },\n { name: \"TimeDeltaWeeks\", category: \"datetime\" },\n { name: \"Today\", category: \"datetime\" },\n { name: \"Filter\", category: \"functional\" },\n { name: \"Fold\", category: \"functional\" },\n { name: \"Map\", category: \"functional\" },\n { name: \"Reduce\", category: \"functional\" },\n { name: \"StrictMap\", category: \"functional\" },\n { name: \"BernoulliB\", category: \"number_theory\" },\n { name: \"Binomial\", category: \"number_theory\" },\n { name: \"CarmichaelLambda\", category: \"number_theory\" },\n { name: \"CatalanNumber\", category: \"number_theory\" },\n { name: \"ChineseRemainder\", category: \"number_theory\" },\n { name: \"Chop\", category: \"number_theory\" },\n { name: \"ContinuedFraction\", category: \"number_theory\" },\n { name: \"DigitCount\", category: \"number_theory\" },\n { name: \"DigitSum\", category: \"number_theory\" },\n { name: \"Divides\", category: \"number_theory\" },\n { name: \"DivisorSigma\", category: \"number_theory\" },\n { name: \"Divisors\", category: \"number_theory\" },\n { name: \"Erf\", category: \"number_theory\" },\n { name: \"Erfc\", category: \"number_theory\" },\n { name: \"ExtendedGCD\", category: \"number_theory\" },\n { name: \"FactorInteger\", category: \"number_theory\" },\n { name: \"Factorial\", category: \"number_theory\" },\n { name: \"FromContinuedFraction\", category: \"number_theory\" },\n { name: \"FromDigits\", category: \"number_theory\" },\n { name: \"GCD\", category: \"number_theory\" },\n { name: \"IntegerDigits\", category: \"number_theory\" },\n { name: \"IntegerSqrt\", category: \"number_theory\" },\n { name: \"IsAbundant\", category: \"number_theory\" },\n { name: \"IsCenteredSquare\", category: \"number_theory\" },\n { name: \"IsHappy\", category: \"number_theory\" },\n { name: \"IsOctahedral\", category: \"number_theory\" },\n { name: \"IsPentagonal\", category: \"number_theory\" },\n { name: \"IsPerfect\", category: \"number_theory\" },\n { name: \"IsPerfectPower\", category: \"number_theory\" },\n { name: \"IsPrime\", category: \"number_theory\" },\n { name: \"IsSquare\", category: \"number_theory\" },\n { name: \"IsSquareFree\", category: \"number_theory\" },\n { name: \"IsTriangular\", category: \"number_theory\" },\n { name: \"JacobiSymbol\", category: \"number_theory\" },\n { name: \"LCM\", category: \"number_theory\" },\n { name: \"LegendreSymbol\", category: \"number_theory\" },\n { name: \"LucasL\", category: \"number_theory\" },\n { name: \"Mod\", category: \"number_theory\" },\n { name: \"ModularInverse\", category: \"number_theory\" },\n { name: \"MultiplicativeOrder\", category: \"number_theory\" },\n { name: \"NextPrime\", category: \"number_theory\" },\n { name: \"NthPrime\", category: \"number_theory\" },\n { name: \"PowerMod\", category: \"number_theory\" },\n { name: \"PrimeFactors\", category: \"number_theory\" },\n { name: \"PrimeNu\", category: \"number_theory\" },\n { name: \"PrimeOmega\", category: \"number_theory\" },\n { name: \"PrimePi\", category: \"number_theory\" },\n { name: \"PrimitiveRoot\", category: \"number_theory\" },\n { name: \"Radical\", category: \"number_theory\" },\n { name: \"Sigma0\", category: \"number_theory\" },\n { name: \"Sigma1\", category: \"number_theory\" },\n { name: \"SigmaMinus1\", category: \"number_theory\" },\n { name: \"Totient\", category: \"number_theory\" },\n { name: \"AGM\", category: \"special_function\" },\n { name: \"AiryAi\", category: \"special_function\" },\n { name: \"AiryAiPrime\", category: \"special_function\" },\n { name: \"AiryBi\", category: \"special_function\" },\n { name: \"AiryBiPrime\", category: \"special_function\" },\n { name: \"BesselI\", category: \"special_function\" },\n { name: \"BesselJ\", category: \"special_function\" },\n { name: \"BesselK\", category: \"special_function\" },\n { name: \"BesselY\", category: \"special_function\" },\n { name: \"Beta\", category: \"special_function\" },\n { name: \"BetaRegularized\", category: \"special_function\" },\n { name: \"EllipticE\", category: \"special_function\" },\n { name: \"EllipticK\", category: \"special_function\" },\n { name: \"ErfInv\", category: \"special_function\" },\n { name: \"Factorial2\", category: \"special_function\" },\n { name: \"Gamma\", category: \"special_function\" },\n { name: \"GammaLn\", category: \"special_function\" },\n { name: \"GammaRegularized\", category: \"special_function\" },\n { name: \"Hypergeometric1F1\", category: \"special_function\" },\n { name: \"Hypergeometric2F1\", category: \"special_function\" },\n { name: \"LambertW\", category: \"special_function\" },\n { name: \"Zeta\", category: \"special_function\" },\n { name: \"BinomialDistribution\", category: \"statistics\" },\n { name: \"CDF\", category: \"statistics\" },\n { name: \"Correlation\", category: \"statistics\" },\n { name: \"Covariance\", category: \"statistics\" },\n { name: \"ExponentialDistribution\", category: \"statistics\" },\n { name: \"InterquartileRange\", category: \"statistics\" },\n { name: \"Kurtosis\", category: \"statistics\" },\n { name: \"LinearRegression\", category: \"statistics\" },\n { name: \"Mode\", category: \"statistics\" },\n { name: \"NormalDistribution\", category: \"statistics\" },\n { name: \"PDF\", category: \"statistics\" },\n { name: \"PoissonDistribution\", category: \"statistics\" },\n { name: \"PolynomialFit\", category: \"statistics\" },\n { name: \"PopulationStandardDeviation\", category: \"statistics\" },\n { name: \"PopulationVariance\", category: \"statistics\" },\n { name: \"Quantile\", category: \"statistics\" },\n { name: \"Quartiles\", category: \"statistics\" },\n { name: \"Skewness\", category: \"statistics\" },\n { name: \"StandardDeviation\", category: \"statistics\" },\n { name: \"UniformDistribution\", category: \"statistics\" },\n { name: \"Variance\", category: \"statistics\" },\n { name: \"Arctan2\", category: \"string\" },\n { name: \"CaseFold\", category: \"string\" },\n { name: \"Characters\", category: \"string\" },\n { name: \"DigitsFrom\", category: \"string\" },\n { name: \"GraphemeClusters\", category: \"string\" },\n { name: \"IntegerString\", category: \"string\" },\n { name: \"IsMatch\", category: \"string\" },\n { name: \"NumberFrom\", category: \"string\" },\n { name: \"PadEnd\", category: \"string\" },\n { name: \"PadStart\", category: \"string\" },\n { name: \"RegExp\", category: \"string\" },\n { name: \"Str\", category: \"string\" },\n { name: \"String\", category: \"string\" },\n { name: \"StringCompare\", category: \"string\" },\n { name: \"StringFrom\", category: \"string\" },\n { name: \"StringJoin\", category: \"string\" },\n { name: \"StringMatch\", category: \"string\" },\n { name: \"StringMatchAll\", category: \"string\" },\n { name: \"StringRepeat\", category: \"string\" },\n { name: \"StringReplace\", category: \"string\" },\n { name: \"StringSplit\", category: \"string\" },\n { name: \"ToLowerCase\", category: \"string\" },\n { name: \"ToUpperCase\", category: \"string\" },\n { name: \"Trim\", category: \"string\" },\n { name: \"TrimEnd\", category: \"string\" },\n { name: \"TrimStart\", category: \"string\" },\n { name: \"UnicodeScalars\", category: \"string\" },\n { name: \"Utf16\", category: \"string\" },\n { name: \"Utf8\", category: \"string\" },\n { name: \"Arccos\", category: \"trigonometric\" },\n { name: \"Arccot\", category: \"trigonometric\" },\n { name: \"Arccsc\", category: \"trigonometric\" },\n { name: \"Arcosh\", category: \"trigonometric\" },\n { name: \"Arcoth\", category: \"trigonometric\" },\n { name: \"Arcsch\", category: \"trigonometric\" },\n { name: \"Arcsec\", category: \"trigonometric\" },\n { name: \"Arcsin\", category: \"trigonometric\" },\n { name: \"Arctan\", category: \"trigonometric\" },\n { name: \"Arsech\", category: \"trigonometric\" },\n { name: \"Arsinh\", category: \"trigonometric\" },\n { name: \"Artanh\", category: \"trigonometric\" },\n { name: \"Cos\", category: \"trigonometric\" },\n { name: \"Cosh\", category: \"trigonometric\" },\n { name: \"Cot\", category: \"trigonometric\" },\n { name: \"Coth\", category: \"trigonometric\" },\n { name: \"Csc\", category: \"trigonometric\" },\n { name: \"Csch\", category: \"trigonometric\" },\n { name: \"Hypot\", category: \"trigonometric\" },\n { name: \"Pi\", category: \"trigonometric\" },\n { name: \"Sec\", category: \"trigonometric\" },\n { name: \"Sech\", category: \"trigonometric\" },\n { name: \"Sin\", category: \"trigonometric\" },\n { name: \"Sinc\", category: \"trigonometric\" },\n { name: \"Sinh\", category: \"trigonometric\" },\n { name: \"Tan\", category: \"trigonometric\" },\n { name: \"Tanh\", category: \"trigonometric\" },\n];\n","/**\n * Hand-authored `args` metadata: proper argument labels for the ~20-30\n * constructs a typical formula actually uses. Everything else falls back\n * to generic numbered labels (`arg1`, `arg2`, ...) via the registry —\n * this file is an incremental enhancement, not a completeness requirement.\n *\n * Keyed by construct name; extend this as real usage data comes in.\n */\nimport type { ArgSpec } from \"../types.js\";\n\nexport const CURATED_ARGS: Record<string, ArgSpec[]> = {\n Add: [{ label: \"value\", variadic: true }],\n Subtract: [{ label: \"value\", variadic: true }],\n Multiply: [{ label: \"value\", variadic: true }],\n Divide: [{ label: \"numerator\" }, { label: \"denominator\" }],\n Negate: [{ label: \"value\" }],\n Power: [{ label: \"base\" }, { label: \"exponent\" }],\n Sqrt: [{ label: \"value\" }],\n Square: [{ label: \"value\" }],\n Root: [{ label: \"value\" }, { label: \"degree\" }],\n Round: [{ label: \"value\" }, { label: \"digits\", optional: true, defaultValue: 0 }],\n Floor: [{ label: \"value\" }],\n Ceil: [{ label: \"value\" }],\n Abs: [{ label: \"value\" }],\n Min: [{ label: \"value\", variadic: true }],\n Max: [{ label: \"value\", variadic: true }],\n Average: [{ label: \"value\", variadic: true }],\n Median: [{ label: \"value\", variadic: true }],\n Sum: [{ label: \"value\", variadic: true }],\n Product: [{ label: \"values\" }],\n Clamp: [{ label: \"value\" }, { label: \"min\" }, { label: \"max\" }],\n Mod: [{ label: \"value\" }, { label: \"divisor\" }],\n\n If: [\n { label: \"condition\", defaultValue: true },\n { label: \"then\" },\n { label: \"else\" },\n ],\n Switch: [{ label: \"value / case / result ...\", variadic: true }],\n Which: [{ label: \"condition / result ...\", variadic: true }],\n\n Equal: [{ label: \"a\" }, { label: \"b\" }],\n NotEqual: [{ label: \"a\" }, { label: \"b\" }],\n Greater: [{ label: \"a\" }, { label: \"b\" }],\n GreaterEqual: [{ label: \"a\" }, { label: \"b\" }],\n Less: [{ label: \"a\" }, { label: \"b\" }],\n LessEqual: [{ label: \"a\" }, { label: \"b\" }],\n And: [{ label: \"condition\", variadic: true }],\n Or: [{ label: \"condition\", variadic: true }],\n Not: [{ label: \"condition\" }],\n\n StringJoin: [{ label: \"value\", variadic: true }],\n ToUpperCase: [{ label: \"text\" }],\n ToLowerCase: [{ label: \"text\" }],\n Trim: [{ label: \"text\" }],\n};\n","/**\n * Hand-authored, human-readable names for constructs whose raw MathJSON\n * name doesn't read naturally on its own — chiefly the curated notation\n * set, since those render with no name label at all (a fraction, an\n * infix row, ... show no text saying \"Divide\"/\"Add\"), so their context\n * menu is the only place a name can appear. `displayName()` in\n * `registry.ts` falls back to the raw construct name for everything else\n * (generic mode already shows that name in its own header).\n */\nexport const CONSTRUCT_DISPLAY_NAMES: Record<string, string> = {\n Add: \"Addition\",\n Subtract: \"Subtraction\",\n Multiply: \"Multiplication\",\n And: \"And\",\n Or: \"Or\",\n Divide: \"Division\",\n Power: \"Power\",\n Square: \"Square\",\n Sqrt: \"Square Root\",\n Root: \"Root\",\n Sum: \"Sum\",\n Product: \"Product\",\n Equal: \"Equal To\",\n NotEqual: \"Not Equal To\",\n Greater: \"Greater Than\",\n GreaterEqual: \"Greater Than or Equal To\",\n Less: \"Less Than\",\n LessEqual: \"Less Than or Equal To\",\n In: \"In\",\n NotIn: \"Not In\",\n Contains: \"Contains\",\n ContainsAnyOf: \"Contains Any Of\",\n ContainsAllOf: \"Contains All Of\",\n ContainsNoneOf: \"Contains None Of\",\n Subset: \"Subset Of\",\n SubsetEqual: \"Subset Of Or Equal To\",\n Superset: \"Superset Of\",\n SupersetEqual: \"Superset Of Or Equal To\",\n NotSubset: \"Not A Subset Of\",\n NotSuperset: \"Not A Superset Of\",\n Element: \"In Range\",\n NotElement: \"Not In Range\",\n Array: \"List\",\n List: \"List\",\n};\n","/**\n * The curated notation set — a deliberately small list of constructs\n * with real, widely-recognized mathematical notation. A construct's\n * absence here is the signal to fall back to generic rendering; this is\n * the one and only place that decision is made.\n *\n * Quality bar: adequate readability, not LaTeX-level typesetting.\n */\n\nexport type NotationKind =\n | \"infix\"\n | \"fraction\"\n | \"power\"\n | \"sqrt\"\n | \"root\"\n | \"reducer\"\n | \"comparison\"\n | \"array\";\n\nexport interface NotationSpec {\n kind: NotationKind;\n /** Infix/comparison operator glyph or word, or reducer glyph (Σ/Π). Unused for \"array\". */\n symbol?: string;\n}\n\nexport const NOTATION: Record<string, NotationSpec> = {\n // Infix, variadic (Add/Subtract/Multiply are plain variadic in\n // mathjson-solver's own source — verified against _arithmetic_constructs.py).\n Add: { kind: \"infix\", symbol: \"+\" },\n Subtract: { kind: \"infix\", symbol: \"−\" }, // −\n Multiply: { kind: \"infix\", symbol: \"·\" }, // ·\n And: { kind: \"infix\", symbol: \"∧\" }, // ∧\n Or: { kind: \"infix\", symbol: \"∨\" }, // ∨\n\n // Fraction — the one non-negotiable notation requirement.\n // Divide is fixed at exactly two arguments.\n Divide: { kind: \"fraction\" },\n\n // Power/roots.\n Power: { kind: \"power\" },\n Square: { kind: \"power\", symbol: \"2\" }, // fixed exponent, single arg\n Sqrt: { kind: \"sqrt\" },\n Root: { kind: \"root\" },\n\n // Reducers with an established symbol.\n Sum: { kind: \"reducer\", symbol: \"Σ\" }, // Σ — variadic OR single Array arg\n Product: { kind: \"reducer\", symbol: \"Π\" }, // Π — single Array arg ONLY\n\n // A literal list, e.g. as In/Contains's collection operand: (1, 2, 3).\n // List is Array's own CortexJS-name alias for the exact same function —\n // both get the same notation so either spelling reads the same way.\n Array: { kind: \"array\" },\n List: { kind: \"array\" },\n\n // Comparisons.\n Equal: { kind: \"comparison\", symbol: \"=\" },\n NotEqual: { kind: \"comparison\", symbol: \"≠\" },\n Greater: { kind: \"comparison\", symbol: \">\" },\n GreaterEqual: { kind: \"comparison\", symbol: \"≥\" },\n Less: { kind: \"comparison\", symbol: \"<\" },\n LessEqual: { kind: \"comparison\", symbol: \"≤\" },\n\n // Membership/containment — words, not symbols: this group (unlike the\n // six comparisons above) isn't standard notation a non-mathematician\n // would already recognize, so it reads as English instead.\n In: { kind: \"comparison\", symbol: \"in\" },\n NotIn: { kind: \"comparison\", symbol: \"not in\" },\n Contains: { kind: \"comparison\", symbol: \"contains\" },\n ContainsAnyOf: { kind: \"comparison\", symbol: \"contains any of\" },\n ContainsAllOf: { kind: \"comparison\", symbol: \"contains all of\" },\n ContainsNoneOf: { kind: \"comparison\", symbol: \"contains none of\" },\n\n // Subset/superset: real, if less common, math notation — symbols.\n Subset: { kind: \"comparison\", symbol: \"⊂\" },\n SubsetEqual: { kind: \"comparison\", symbol: \"⊆\" },\n Superset: { kind: \"comparison\", symbol: \"⊃\" },\n SupersetEqual: { kind: \"comparison\", symbol: \"⊇\" },\n NotSubset: { kind: \"comparison\", symbol: \"⊄\" },\n NotSuperset: { kind: \"comparison\", symbol: \"⊅\" },\n};\n\n/**\n * The comparison/membership/subset group — every construct here is\n * exactly 2 arguments and boolean-producing (verified against\n * mathjson-solver's own source, `_collection_constructs.py` for the\n * membership/subset ones), so swapping among any of them is always safe.\n * `In`/`NotIn`/`Contains`/`ContainsAnyOf`/`ContainsAllOf`/`ContainsNoneOf`/\n * `Subset`/`SubsetEqual`/`Superset`/`SupersetEqual`/`NotSubset`/\n * `NotSuperset` are additions on top of mathjson-solver's original\n * comparison operators (as of the `sets-interval-subset` branch merged to\n * its `main`, ahead of the 2.2.1 PyPI release at the time this was\n * written — regenerate the registry against a current checkout, not an\n * installed package, to pick these up).\n */\nconst COMPARISON_GROUP = [\n \"Equal\",\n \"NotEqual\",\n \"Greater\",\n \"GreaterEqual\",\n \"Less\",\n \"LessEqual\",\n \"In\",\n \"NotIn\",\n \"Contains\",\n \"ContainsAnyOf\",\n \"ContainsAllOf\",\n \"ContainsNoneOf\",\n \"Subset\",\n \"SubsetEqual\",\n \"Superset\",\n \"SupersetEqual\",\n \"NotSubset\",\n \"NotSuperset\",\n];\n\n/**\n * Groups of constructs it's always safe to swap a node between — same\n * arity/shape requirements, so swapping never leaves a node in an invalid\n * shape. Used for the \"Change operator\" menu: picking `<` for a node\n * currently rendered as `>` keeps its two operands and just swaps index 0\n * (`swapOperator` in data-model/path.ts) — rebuilding a condition from\n * scratch just to flip a comparison is real friction (e.g. `If`'s\n * condition) this exists to remove.\n */\nconst OPERATOR_SWAP_GROUPS: readonly (readonly string[])[] = [\n [\"Add\", \"Subtract\", \"Multiply\"],\n [\"And\", \"Or\"],\n COMPARISON_GROUP,\n];\n\n/** The other constructs `name` can be freely swapped to, or `[]` if it's in no group. */\nexport function swapTargets(name: string): readonly string[] {\n const group = OPERATOR_SWAP_GROUPS.find((g) => g.includes(name));\n return group ? group.filter((n) => n !== name) : [];\n}\n\n/** Whether `name` is in the comparison/membership/subset group specifically. */\nexport function isComparisonLike(name: string): boolean {\n return COMPARISON_GROUP.includes(name);\n}\n\n/**\n * `Contains` takes its two arguments collection-first (`[array, value]`,\n * CortexJS's own convention) where every other member of the comparison\n * group is value-first (`[value, array]` for `In`, `[a, b]` for a plain\n * comparison). Swapping into or out of `Contains` has to also swap the\n * two operands, or the meaning silently reverses (`Contains(a, b)` means\n * something different from `In(a, b)` even though both are just \"rename\n * index 0\" as far as `swapOperator` itself knows).\n */\nconst REVERSED_ARG_ORDER = new Set([\"Contains\"]);\n\n/** Whether swapping construct `from` to `to` needs its first two arguments reversed. */\nexport function swapNeedsArgReversal(from: string, to: string): boolean {\n return REVERSED_ARG_ORDER.has(from) !== REVERSED_ARG_ORDER.has(to);\n}\n\n/**\n * The label for a \"Change operator\" button — the same symbol/word the\n * construct renders with inline in the tree (`NOTATION`'s own `symbol`),\n * so the button never shows something different from what picking it\n * actually produces; falls back to the raw name for a group member with\n * no curated notation of its own.\n */\nexport function operatorGlyph(name: string): string {\n return NOTATION[name]?.symbol ?? name;\n}\n","/**\n * The construct registry — the single source of\n * truth for \"how does construct X render and how many/which arguments\n * does it take.\" Layers the generated construct list (kept in sync\n * with mathjson-solver's own source, not hand-transcribed) with the small\n * hand-authored `args` and `notation` overlays.\n */\nimport type { ConstructDescriptor, MathJsonExpression } from \"../types.js\";\nimport { CATEGORY_LABELS, GENERATED_CONSTRUCTS } from \"./constructs.generated.js\";\nimport { CURATED_ARGS } from \"./curated-args.js\";\nimport { CONSTRUCT_DISPLAY_NAMES } from \"./display-names.js\";\nimport {\n NOTATION,\n isComparisonLike,\n operatorGlyph,\n swapNeedsArgReversal,\n swapTargets,\n type NotationSpec,\n} from \"./notation.js\";\n\nexport { CATEGORY_LABELS, isComparisonLike, operatorGlyph, swapNeedsArgReversal, swapTargets };\nexport type { NotationSpec };\n\nconst byName = new Map<string, ConstructDescriptor>(\n GENERATED_CONSTRUCTS.map((c) => [\n c.name,\n { ...c, args: CURATED_ARGS[c.name] },\n ]),\n);\n\n/** Every construct mathjson-solver implements, name + category only. */\nexport function allConstructs(): readonly ConstructDescriptor[] {\n return GENERATED_CONSTRUCTS;\n}\n\n/** Look up one construct's registry entry, if any. */\nexport function getConstruct(name: string): ConstructDescriptor | undefined {\n return byName.get(name);\n}\n\n/** The curated notation renderer for `name`, if it's in the small curated set. */\nexport function getNotation(name: string): NotationSpec | undefined {\n return NOTATION[name];\n}\n\nexport function categoryLabel(slug: string): string {\n return CATEGORY_LABELS[slug] ?? slug;\n}\n\n/**\n * A human-readable name for construct `name` — e.g. \"Division\" for\n * `Divide`. Falls back to the raw construct name when no curated entry\n * exists (see `display-names.ts`).\n */\nexport function displayName(name: string): string {\n return CONSTRUCT_DISPLAY_NAMES[name] ?? name;\n}\n\n/**\n * The minimum and maximum number of arguments construct `name` accepts, if\n * it has curated `args` metadata to derive that from — `undefined` when it\n * doesn't (the vast majority of the registry), in which case the generic\n * renderer stays fully permissive rather than guess at an unverified\n * arity (\"prefer erring toward permissive\" over guessing wrong). A trailing\n * `variadic` entry means unbounded (`max: Infinity`, `min` counting that\n * slot as needing at least one instance); otherwise `max` is the curated\n * entry count and `min` subtracts however many are marked `optional`\n * (assumed trailing, e.g. `Round`'s `digits`).\n */\nexport function argBounds(name: string): { min: number; max: number } | undefined {\n const args = getConstruct(name)?.args;\n if (!args || args.length === 0) return undefined;\n if (args[args.length - 1]?.variadic) {\n return { min: args.length, max: Infinity };\n }\n const optionalCount = args.filter((a) => a.optional).length;\n return { min: args.length - optionalCount, max: args.length };\n}\n\n/**\n * Search the palette by name/category, honoring the host's `blacklist` (mirrors\n * mathjson-solver's own `create_solver(blacklist=...)`).\n */\nexport function searchConstructs(\n query: string,\n blacklist: readonly string[] = [],\n): ConstructDescriptor[] {\n const q = query.trim().toLowerCase();\n const excluded = new Set(blacklist);\n return GENERATED_CONSTRUCTS.filter((c) => {\n if (excluded.has(c.name)) return false;\n if (!q) return true;\n return (\n c.name.toLowerCase().includes(q) ||\n categoryLabel(c.category).toLowerCase().includes(q)\n );\n });\n}\n\n/**\n * A reasonable, best-effort set of default arguments for freshly inserting\n * construct `name` (via the function picker or the wrap-in-parent action).\n * Notation shape takes priority where present, since those\n * constructs have arity/shape requirements verified against\n * mathjson-solver's own source (e.g. `Product` needs a single `Array` arg).\n * Falls back to hand-authored `args` defaults, then to a single `0`.\n */\nexport function defaultArgsFor(name: string): MathJsonExpression[] {\n const notation = getNotation(name);\n if (notation) {\n switch (notation.kind) {\n case \"fraction\":\n return [0, 1];\n case \"power\":\n return name === \"Square\" ? [0] : [0, 2];\n case \"sqrt\":\n return [0];\n case \"root\":\n return [0, 2];\n case \"comparison\":\n return [0, 0];\n case \"infix\":\n return name === \"And\" || name === \"Or\" ? [true, true] : [0, 0];\n case \"reducer\":\n return name === \"Product\" ? [[\"Array\", 1]] : [0];\n }\n }\n const desc = getConstruct(name);\n if (desc?.args?.length) {\n return desc.args.map((a) => a.defaultValue ?? 0);\n }\n return [0];\n}\n","/**\n * Whether `node` actually has the arity/shape a given notation spec\n * expects. A node whose construct is in the curated set but whose current\n * shape doesn't match (e.g. `Add` with a single argument, or `Product`\n * before its argument has been normalized to an `Array`) falls back to\n * generic rendering rather than rendering broken notation — this is\n * the one place that fallback decision is made.\n */\nimport { isCompound, type MathJsonExpression } from \"../types.js\";\nimport type { NotationSpec } from \"./notation.js\";\n\nexport function notationShapeOk(\n name: string,\n spec: NotationSpec,\n node: readonly MathJsonExpression[],\n): boolean {\n switch (spec.kind) {\n case \"infix\":\n // Needs at least two operands to read as infix notation.\n return node.length >= 3;\n case \"fraction\":\n case \"comparison\":\n return node.length === 3;\n case \"power\":\n // Square is unary (fixed exponent 2); Power is binary.\n return name === \"Square\" ? node.length === 2 : node.length === 3;\n case \"sqrt\":\n return node.length === 2;\n case \"root\":\n return node.length === 3;\n case \"reducer\":\n if (name === \"Product\") {\n // Product only accepts a single `Array` argument (verified\n // against mathjson-solver's _arithmetic_constructs.py — no\n // bare-variadic form).\n const arr = node[1];\n return (\n node.length === 2 &&\n arr !== undefined &&\n isCompound(arr) &&\n arr[0] === \"Array\"\n );\n }\n // Sum: variadic scalars, OR a single Array argument (both unwrap\n // element-wise) — either shape is fine to render as Σ(...).\n return node.length >= 2;\n case \"array\":\n // Array/List accept any number of elements, including zero.\n return true;\n }\n}\n","/**\n * Shadow DOM styling: encapsulated by default, with a deliberately\n * designed set of exposed CSS custom properties so a host page can\n * restyle the widget without arbitrary CSS reaching in.\n *\n * Notation layout uses plain CSS (`inline-grid`/flex) rather than any\n * post-render JS measurement, and it holds up fine in current browsers.\n */\nimport { css } from \"lit\";\n\nexport const styles = css`\n :host {\n --mjtb-font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;\n --mjtb-font-size: 14px;\n --mjtb-text: light-dark(#1f2023, #e7e7ea);\n --mjtb-bg: light-dark(#ffffff, #1c1c1f);\n --mjtb-node-bg: light-dark(#f7f7f9, #29292e);\n --mjtb-node-border: light-dark(#dcdce1, #3c3c42);\n --mjtb-accent: light-dark(#4f46e5, #8583f0);\n --mjtb-danger: light-dark(#dc2626, #f87171);\n --mjtb-radius: 6px;\n\n color-scheme: light dark;\n display: inline-block;\n font-family: var(--mjtb-font-family);\n font-size: var(--mjtb-font-size);\n color: var(--mjtb-text);\n background: var(--mjtb-bg);\n }\n\n * {\n box-sizing: border-box;\n }\n\n .mjtb-root {\n display: inline-block;\n }\n\n .mjtb-toolbar {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 8px;\n }\n\n .mode-toggle {\n font: inherit;\n padding: 3px 9px;\n border-radius: 4px;\n border: 1px solid var(--mjtb-node-border);\n background: var(--mjtb-bg);\n color: inherit;\n cursor: pointer;\n }\n\n .mode-toggle:hover {\n border-color: var(--mjtb-accent);\n }\n\n .mode-toggle:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .json-error-hint {\n font-size: 0.85em;\n color: var(--mjtb-danger);\n }\n\n .json-view {\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n .json-textarea {\n display: block;\n width: 100%;\n min-width: 320px;\n min-height: 200px;\n box-sizing: border-box;\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.95em;\n line-height: 1.4;\n tab-size: 2;\n padding: 10px;\n border: 1px solid var(--mjtb-node-border);\n border-radius: var(--mjtb-radius);\n background: var(--mjtb-node-bg);\n color: inherit;\n resize: vertical;\n }\n\n .json-textarea:focus-visible {\n outline: 2px solid var(--mjtb-accent);\n outline-offset: 1px;\n }\n\n .json-error {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.85em;\n color: var(--mjtb-danger);\n background: color-mix(in srgb, var(--mjtb-danger) 10%, transparent);\n border: 1px solid var(--mjtb-danger);\n border-radius: 4px;\n padding: 6px 8px;\n white-space: pre-wrap;\n }\n\n /*\n * Shared base: every construct box is an inline-flex row with its menu\n * trailing alongside it. Only .generic (the boxed fallback) opts into\n * the bordered-card chrome and column stacking — the curated notation\n * kinds stay visually plain so they read as math, not as nested\n * cards. Every node is click-to-edit: plain content until it's the\n * active one, so a hover tint is a notation box's only \"this is\n * clickable\" hint (.generic already reads as a box on its own).\n */\n .node.construct {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n vertical-align: middle;\n border-radius: 4px;\n cursor: pointer;\n /* Positioning context for .construct-menu's .popover below — anchors\n the open menu to the whole node's own box, not to the small\n trailing trigger it no longer visibly has. */\n position: relative;\n }\n\n .node.construct.generic {\n flex-direction: column;\n align-items: stretch;\n gap: 4px;\n padding: 6px 8px;\n background: var(--mjtb-node-bg);\n border: 1px solid var(--mjtb-node-border);\n border-radius: var(--mjtb-radius);\n }\n\n /*\n * :hover is true for every ancestor box the pointer happens to be\n * over, not just the innermost one under the cursor — nested notation\n * boxes overlap almost entirely (e.g. a comparison as the last operand\n * of an And chain), so without :has() here, hovering the innermost one\n * would light up every construct wrapping it too, all the way up,\n * reading as \"the whole expression\" rather than the specific node a\n * click would activate. :has(...:hover) lets an ancestor notice it\n * contains a more specific hover target and step aside so only the\n * true innermost one highlights.\n */\n .node.construct:not(.generic):hover:not(:has(.node.construct:hover, .value-text:hover)) {\n background: var(--mjtb-node-bg);\n }\n\n .construct-header {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n }\n\n .construct-name {\n font-weight: 600;\n }\n\n .construct-category {\n font-size: 0.75em;\n opacity: 0.6;\n }\n\n .construct-args {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding-left: 14px;\n border-left: 2px solid var(--mjtb-node-border);\n }\n\n /* Constants: named, individually collapsible bindings, then a\n final expression — visually distinct from a plain argument list so\n a name reads as a name, not an anonymous positional argument. */\n .constants-bindings {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin: 2px 0;\n }\n\n .constant-card {\n border: 1px solid var(--mjtb-node-border);\n border-radius: 4px;\n padding: 4px 6px;\n background: var(--mjtb-bg);\n }\n\n .constant-header {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .fold-toggle {\n font: inherit;\n line-height: 1;\n padding: 2px 6px;\n border-radius: 4px;\n border: 1px solid var(--mjtb-node-border);\n background: var(--mjtb-bg);\n color: inherit;\n cursor: pointer;\n }\n\n .fold-toggle:hover {\n border-color: var(--mjtb-accent);\n }\n\n .constant-name .value-text,\n .constant-name input {\n font-weight: 600;\n }\n\n .small-remove {\n font: inherit;\n line-height: 1;\n margin-left: auto;\n padding: 2px 6px;\n border-radius: 4px;\n border: 1px solid var(--mjtb-node-border);\n background: var(--mjtb-bg);\n color: var(--mjtb-danger);\n cursor: pointer;\n }\n\n .small-remove:hover {\n border-color: var(--mjtb-danger);\n }\n\n .constant-value {\n display: block;\n margin-top: 4px;\n padding-left: 14px;\n border-left: 2px solid var(--mjtb-node-border);\n }\n\n .constants-final {\n display: flex;\n align-items: center;\n gap: 6px;\n margin-top: 6px;\n padding-top: 6px;\n border-top: 1px dashed var(--mjtb-node-border);\n }\n\n /* If (both the flat CortexJS form and the pair/elseif-chain form share\n this same row layout — see #renderIf). */\n .if-branches {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n\n .if-row {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n }\n\n .if-keyword {\n font-size: 0.75em;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.02em;\n opacity: 0.6;\n }\n\n .slot {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex-wrap: wrap;\n }\n\n .arg-label {\n font-size: 0.75em;\n opacity: 0.6;\n }\n\n input[type=\"number\"],\n input[type=\"text\"],\n input[type=\"search\"] {\n font: inherit;\n padding: 2px 4px;\n border: 1px solid var(--mjtb-node-border);\n border-radius: 4px;\n background: var(--mjtb-bg);\n color: inherit;\n width: 6em;\n }\n\n input[type=\"search\"] {\n width: 12em;\n }\n\n .symbol-select {\n font: inherit;\n padding: 2px 4px;\n border: 1px solid var(--mjtb-accent);\n border-radius: 4px;\n background: var(--mjtb-bg);\n color: inherit;\n max-width: 16em;\n }\n\n .symbol-chip {\n background: color-mix(in srgb, var(--mjtb-accent) 15%, transparent);\n border: 1px solid var(--mjtb-accent);\n border-radius: 999px;\n padding: 1px 10px;\n white-space: nowrap;\n cursor: pointer;\n }\n\n /* Read-mode literal: plain text, not an input, until activated. */\n .value-text {\n display: inline-block;\n min-width: 0.75em;\n min-height: 1.2em;\n padding: 1px 4px;\n margin: -1px -4px;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .value-text:hover {\n background: var(--mjtb-node-bg);\n }\n\n [tabindex=\"0\"]:focus-visible {\n outline: 2px solid var(--mjtb-accent);\n outline-offset: 2px;\n border-radius: 4px;\n }\n\n .bool-toggle {\n font: inherit;\n line-height: 1;\n padding: 3px 7px;\n border-radius: 4px;\n border: 1px solid var(--mjtb-node-border);\n background: var(--mjtb-bg);\n color: inherit;\n cursor: pointer;\n }\n\n .bool-toggle:hover {\n border-color: var(--mjtb-accent);\n }\n\n /*\n * Every slot/node exposes exactly one visible affordance — a \"⋯\" trigger\n * — rather than a row of individual icon buttons, to keep a deeply\n * nested tree from turning into a wall of buttons. Everything that used\n * to be its own button (change type, insert symbol, wrap, remove, ...)\n * is a labeled item in this one popover instead.\n */\n .picker {\n position: relative;\n display: inline-block;\n /* A context menu is UI chrome, not notation content — it must never\n shrink just because it's nested inside a scaled-down exponent/\n degree/reducer-symbol (or several, compounded). Resetting the size\n here, not just at those individual rules, keeps it correct no\n matter what scaling exists elsewhere now or is added later. */\n font-size: var(--mjtb-font-size);\n }\n\n .picker > summary {\n list-style: none;\n cursor: pointer;\n font: inherit;\n padding: 3px 7px;\n border-radius: 4px;\n border: 1px solid var(--mjtb-node-border);\n background: var(--mjtb-bg);\n }\n\n .picker > summary::-webkit-details-marker {\n display: none;\n }\n\n .picker .popover {\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n z-index: 10;\n display: block;\n background: var(--mjtb-bg);\n border: 1px solid var(--mjtb-node-border);\n border-radius: 4px;\n padding: 4px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n\n /*\n * The construct-level menu opens the instant its node activates (see\n * #customMenu), so — unlike the leaf menu — it has no click-to-open\n * trigger left to show. Hiding the summary and giving up this\n * element's own position: relative (falling back to .node.construct's,\n * set above) means .popover anchors to the whole node's own box: it\n * collapses to zero size (an empty inline-block with an\n * absolutely-positioned-only child needs no help from display:contents\n * to do that) and the menu appears directly under whatever you\n * actually clicked, not trailing off after it.\n */\n .picker.construct-menu {\n position: static;\n }\n\n .picker.construct-menu > summary {\n display: none;\n }\n\n /* Centered under the whole node rather than left-aligned to it — for a\n long infix/comparison chain, the click that opened this could have\n landed anywhere along the line, so centering under the full node\n reads as closer to \"under what you clicked\" than always jumping to\n the line's start would. */\n .picker.construct-menu .popover {\n left: 50%;\n transform: translateX(-50%);\n }\n\n .menu-popover {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 160px;\n }\n\n .menu-item {\n display: block;\n width: 100%;\n text-align: left;\n font: inherit;\n padding: 6px 8px;\n border: none;\n border-radius: 4px;\n background: none;\n color: inherit;\n cursor: pointer;\n }\n\n .menu-item:hover {\n background: var(--mjtb-node-bg);\n }\n\n .menu-item.danger {\n color: var(--mjtb-danger);\n }\n\n /* Non-clickable: identifies which node this menu belongs to. */\n .menu-header {\n padding: 4px 8px 6px;\n margin-bottom: 2px;\n border-bottom: 1px solid var(--mjtb-node-border);\n font-size: 0.75em;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.02em;\n opacity: 0.6;\n cursor: default;\n user-select: none;\n white-space: nowrap;\n }\n\n /* A submenu is a menu item that expands into its own search popover. */\n .submenu {\n position: relative;\n }\n\n .submenu > summary {\n list-style: none;\n cursor: pointer;\n font: inherit;\n display: block;\n padding: 6px 8px;\n border-radius: 4px;\n }\n\n .submenu > summary::-webkit-details-marker {\n display: none;\n }\n\n .submenu > summary:hover {\n background: var(--mjtb-node-bg);\n }\n\n .submenu .popover {\n top: 0;\n left: calc(100% + 4px);\n }\n\n /* \"Change operator…\" (swapTargets): a small known set, so a flat grid of\n symbol/short-text buttons beats a searchable picker. For the\n comparison/membership/subset group, \"In range…\"/\"Not in range…\"\n (structural conversions, not plain renames) stack below the grid as\n regular full-width menu items instead. */\n .operator-menu {\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n .operator-grid {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n width: 11em;\n }\n\n .operator-btn {\n flex: 1 0 calc(33% - 4px);\n font: inherit;\n font-size: 1.1em;\n line-height: 1;\n padding: 4px 8px;\n border-radius: 4px;\n border: 1px solid var(--mjtb-node-border);\n background: var(--mjtb-bg);\n color: inherit;\n cursor: pointer;\n white-space: nowrap;\n }\n\n .operator-btn:hover {\n border-color: var(--mjtb-accent);\n }\n\n /* --- notation --- */\n\n .infix-row {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n }\n\n .infix-stacked {\n display: inline-flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n }\n\n .infix-stacked-row {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n }\n\n .op {\n opacity: 0.75;\n padding: 0 2px;\n }\n\n .reducer-symbol {\n /* Anchored to the fixed component base, not em off the current\n (possibly already-scaled) context - a reducer nested inside another\n reducer (or an exponent, or several) must not keep compounding\n bigger/smaller each level. Same reasoning throughout this file\n wherever notation scales a nested subtree: .power-exp,\n .radical-degree. */\n font-size: calc(var(--mjtb-font-size) * 1.3);\n font-weight: 600;\n margin-right: 2px;\n }\n\n .comma {\n opacity: 0.6;\n }\n\n .frac {\n display: inline-grid;\n grid-template-rows: auto auto auto;\n justify-items: center;\n vertical-align: middle;\n padding: 2px 4px;\n }\n .frac-line {\n width: 100%;\n border-bottom: 1.5px solid currentColor;\n margin: 2px 0;\n }\n\n /*\n * Real flex top-alignment, not a transform: .power-base and .power-exp\n * start from the same top edge, and the exponent's smaller font-size\n * alone makes it read as raised - no extra shift needed. This matters\n * for two things a transform gets wrong: (1) a transform repositions\n * pixels without resizing the box, so an ancestor (e.g. a fraction's\n * denominator row) wouldn't grow to fit a raised exponent and it could\n * visually cross above the dividing line; (2) flex-start aligns to the\n * TOP of whichever sibling is tallest, so a compound, parenthesized,\n * multi-line base (e.g. (1/2)^2) still gets its exponent placed at the\n * base's top-right, not vertically centered against it. Do not add\n * vertical-align here instead: .power-base is itself a flex container\n * (for the stretchy parens below) whose first child is an empty\n * decorative span, and flexbox synthesizes a container's baseline from\n * its first item's margin edge when that item has no real one - here\n * that's the *bottom* of the stretched paren, so vertical-align would\n * raise the exponent relative to the wrong (bottom-anchored) baseline\n * and it would barely lift off the bottom at all.\n */\n .power-frame {\n display: inline-flex;\n align-items: flex-start;\n }\n\n .power-exp {\n /* calc() off the fixed base, not em off the parent - see the\n .reducer-symbol comment above. Without this, nesting Power inside\n its own exponent a few times shrinks the text (and the menu\n inside it, before the .picker fix above) to unreadable. */\n font-size: calc(var(--mjtb-font-size) * 0.7);\n }\n\n /*\n * Marks the boundary of a compound base, e.g. (x+y)^2 - without this,\n * a base that's itself a multi-term expression reads ambiguously once\n * a bare exponent is stacked on top of it. .paren (an inline SVG, see\n * the PAREN_OPEN/PAREN_CLOSE doc comment in element.ts) is stretched to\n * the full height of .power-base by that flex container's default\n * align-items:stretch - a plain text glyph sits at one fixed\n * line-height and would only ever wrap the *first line* of a tall\n * base (e.g. a fraction), never visually embracing all of it.\n */\n .power-base {\n display: inline-flex;\n align-items: stretch;\n }\n\n .paren {\n width: 0.3em;\n overflow: visible;\n opacity: 0.7;\n }\n\n .paren path {\n fill: none;\n stroke: currentColor;\n stroke-width: 1.6;\n stroke-linecap: round;\n vector-effect: non-scaling-stroke;\n }\n\n /*\n * A dedicated span, not the outer \"node construct radical\" element\n * itself: .node.construct's own align-items: center (two classes)\n * would otherwise beat this rule's align-items: stretch (one class)\n * in the cascade no matter the source order, same as .power-base.\n *\n * align-items: stretch (not flex-end, as this used to be): the hook's\n * SVG needs to be told to actually fill the row's full height — same\n * reasoning as .power-base above. Without it, a tall radicand (e.g.\n * one containing a fraction) grows past a hook that stayed pinned to\n * one fixed line-height, exactly the \"broken roots\" this replaced.\n */\n .radical-frame {\n display: inline-flex;\n align-items: stretch;\n }\n\n .radical-degree {\n /* Stays pinned near the top notch regardless of how tall the row\n stretches — real typesetting keeps the degree small and near the\n top no matter how large the radicand is, it never scales with it. */\n align-self: flex-start;\n font-size: calc(var(--mjtb-font-size) * 0.65);\n margin-right: -0.15em;\n position: relative;\n top: -0.15em;\n }\n\n .radical-hook {\n width: 0.5em;\n overflow: visible;\n flex-shrink: 0;\n }\n\n .radical-hook path {\n fill: none;\n stroke: currentColor;\n stroke-width: 1.6;\n stroke-linecap: round;\n stroke-linejoin: round;\n vector-effect: non-scaling-stroke;\n }\n\n .radical-sign {\n /* Flush against the hook's top-right point (see ROOT_HOOK's own\n comment) so the vinculum reads as one continuous line, not two\n disconnected pieces. A little padding-top, though, so the radicand\n itself doesn't touch the vinculum — same reason a fraction bar\n doesn't sit flush against its numerator. */\n border-top: 1.5px solid currentColor;\n padding: 2px 3px 0 2px;\n }\n\n .comparison {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n }\n`;\n","/**\n * `<mathjson-tree-builder>` — the custom element.\n *\n * Node rendering is implemented as a recursive private template method\n * (`#renderSlot`) rather than as separate nested custom elements — one\n * shadow root for the whole widget, one component recursively renders\n * itself per node at the template level. This keeps the \"every mutation\n * goes through one path-based function\" contract simple: every\n * rendering call closes directly over its own `path` and calls `#commit`,\n * with no event-bubbling-across-shadow-boundaries plumbing needed.\n *\n * Rendering is also click-to-edit: an unfocused node renders as plain\n * content (no inputs, no \"⋯\" menu) — only the currently *active* node\n * (the one that has focus, per `activePath`) shows its editable control\n * and its menu. See the `activePath` state and `#onFocusIn` below.\n */\nimport { LitElement, html, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport {\n isCompound,\n isValidMathJson,\n type Evaluator,\n type MathJsonExpression,\n type Path,\n type SymbolReference,\n} from \"./types.js\";\nimport {\n getAtPath,\n setAtPath,\n swapOperator,\n withArgAdded,\n withArgRemoved,\n wrapAtPath,\n} from \"./data-model/path.js\";\nimport { resolveSymbol } from \"./data-model/symbols.js\";\nimport { classifyValue } from \"./data-model/classify.js\";\nimport {\n argBounds,\n categoryLabel,\n defaultArgsFor,\n displayName,\n getConstruct,\n getNotation,\n isComparisonLike,\n operatorGlyph,\n searchConstructs,\n swapNeedsArgReversal,\n swapTargets,\n} from \"./registry/registry.js\";\nimport { notationShapeOk } from \"./registry/notation-shape.js\";\nimport type { NotationSpec } from \"./registry/notation.js\";\nimport { styles } from \"./styles.js\";\n\nconst pathKey = (path: Path): string => (path.length ? path.join(\".\") : \"root\");\n\n/** The non-clickable header shown at the top of a leaf's context menu. */\nconst LEAF_KIND_LABELS: Record<\"number\" | \"boolean\" | \"text\" | \"symbol\", string> = {\n number: \"Number\",\n boolean: \"Boolean\",\n text: \"Text\",\n symbol: \"Symbol\",\n};\n\n/**\n * A stretchy parenthesis (no JS-measured layout — this scales to\n * any height purely via CSS/SVG). A single quadratic-bezier curve, not a\n * border-radius shape: a tall thin box's corner radius is capped by its\n * own width, so it only curves a little near the very top/bottom and\n * reads as a square bracket: `[` — an SVG path curves smoothly along the\n * entire height at any aspect ratio, the same way real stretchy math\n * delimiters do. `preserveAspectRatio=\"none\"` lets it stretch vertically\n * (via the flex `align-items: stretch` on `.power-base`) independently of\n * its fixed CSS width.\n */\nconst PAREN_OPEN = html`<svg class=\"paren\" viewBox=\"0 0 10 100\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n <path d=\"M 7,3 Q 1,50 7,97\" />\n</svg>`;\nconst PAREN_CLOSE = html`<svg class=\"paren\" viewBox=\"0 0 10 100\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n <path d=\"M 3,3 Q 9,50 3,97\" />\n</svg>`;\n\n/**\n * The stretchy \"hook\" of a radical sign (√), same technique as the\n * parens above: a fixed-width SVG stretched to the radicand's actual\n * height via `preserveAspectRatio=\"none\"` + flex `align-items: stretch`\n * on `.radical-frame`, rather than a fixed-size Unicode \"√\" glyph that stayed\n * small while a tall radicand (e.g. one containing a fraction) grew past\n * it. Two strokes — a short dip down to the checkmark's low point, then\n * the long diagonal back up to the top — matching how a real radical\n * sign reads regardless of how tall it's stretched. The horizontal\n * vinculum isn't part of this SVG: `.radical-sign`'s own `border-top`\n * continues it flush from where this hook's top-right point lands.\n */\nconst ROOT_HOOK = html`<svg class=\"radical-hook\" viewBox=\"0 0 20 100\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n <path d=\"M 0,55 L 6,97 L 19,3\" />\n</svg>`;\n\n/** A fresh, non-colliding name for a newly-added Constants binding. */\nfunction nextConstantName(existingBindings: readonly MathJsonExpression[]): string {\n const used = new Set(\n existingBindings\n .map((p) => (Array.isArray(p) && typeof p[0] === \"string\" ? p[0] : null))\n .filter((n): n is string => n !== null),\n );\n if (!used.has(\"constant\")) return \"constant\";\n let i = 2;\n while (used.has(`constant_${i}`)) i++;\n return `constant_${i}`;\n}\n\n/**\n * True when `s1` (an `If` node's first argument) is a flat-form CortexJS\n * condition rather than the first `[condition, value]` pair of\n * mathjson-solver's extended pair-form — the exact same test\n * `__main__.py`'s own `If` uses to tell the two shapes apart: not a list\n * at all, or a list whose own first element is a known construct name\n * (so it reads as a condition like `[\"Greater\", \"age\", 18]`, not as a\n * `[condition, value]` pair whose own condition happens to be a bare\n * parameter reference).\n */\nfunction isCortexJsIfCondition(s1: MathJsonExpression | undefined): boolean {\n if (!Array.isArray(s1)) return true;\n return s1.length > 0 && typeof s1[0] === \"string\" && getConstruct(s1[0]) !== undefined;\n}\n\n/**\n * Close a `<details>` popover chain: walks up from `target` through every\n * ancestor `<details>` (a nested submenu and the outer \"⋯\" menu it lives\n * in) and closes each one. Used after committing an action from inside the\n * consolidated per-slot menu, so picking e.g. \"Insert symbol…\" closes both\n * the symbol submenu and the menu it was opened from, not just itself.\n */\nfunction closeMenus(target: EventTarget | null): void {\n let node = target as HTMLElement | null;\n while (node) {\n if (node instanceof HTMLDetailsElement) node.open = false;\n node = node.parentElement;\n }\n}\n\nexport class MathJsonTreeBuilderElement extends LitElement {\n static styles = styles;\n\n @property({ attribute: false })\n value: MathJsonExpression = 0;\n\n @property({ attribute: false })\n symbols: SymbolReference[] = [];\n\n @property({ attribute: false })\n blacklist: string[] = [];\n\n @property({ attribute: false })\n evaluate?: Evaluator;\n\n /**\n * Operand count above which `And`/`Or` switch from the compact inline\n * `a ∧ b ∧ c` form to a vertical stacked list (one operand per line) —\n * the inline form wraps mid-row once it runs out of width, which reads\n * fine for a couple of conditions but ragged for a long chain. A real\n * HTML attribute (not `attribute: false` like the object-typed\n * properties above) since it's a plain number a host page can set\n * declaratively: `<mathjson-tree-builder inline-to-stacked-threshold=\"5\">`.\n */\n @property({ type: Number, attribute: \"inline-to-stacked-threshold\" })\n inlineToStackedThreshold = 3;\n\n /**\n * The path (as a `pathKey` string) of the currently focused/active node,\n * or `null` when nothing in this widget has focus. Drives both which\n * node renders its editable control instead of plain text, and which\n * node's \"⋯\" menu is shown — see the class doc comment.\n */\n @state()\n private activePath: string | null = null;\n\n /** Raw-JSON escape hatch: true while showing the textarea instead of the tree. */\n @state()\n private jsonMode = false;\n\n /** The textarea's current (possibly invalid, uncommitted) content while in JSON mode. */\n @state()\n private jsonDraft = \"\";\n\n /** Parse/shape error for `jsonDraft`, or `null` when it's valid and already committed. */\n @state()\n private jsonError: string | null = null;\n\n /**\n * Path keys of explicitly expanded `Constants` bindings — purely\n * a view concern, never touches `value`. Absent = collapsed, so a big\n * formula reads as just its constant names until you open one — the\n * point of naming a piece of it in the first place.\n */\n @state()\n private expandedConstants = new Set<string>();\n\n #toggleConstantFold(key: string): void {\n const next = new Set(this.expandedConstants);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n this.expandedConstants = next;\n }\n\n // --- mutation (all edits funnel through these two) -----------------\n\n #commit(path: Path, value: MathJsonExpression): void {\n this.value = setAtPath(this.value, path, value);\n this.#fireChange();\n }\n\n #fireChange(): void {\n this.dispatchEvent(\n new CustomEvent(\"change\", {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n #removeArg(path: Path): void {\n // The only way to reach \"Remove\" for a node is to have activated that\n // exact node first (its menu is only visible while active), so the\n // active path is always stale after this — clear it rather than let\n // it dangle on a now-shifted sibling index.\n this.activePath = null;\n const parentPath = path.slice(0, -1);\n const idx = path[path.length - 1]!;\n const parentNode = getAtPath(this.value, parentPath) as MathJsonExpression[];\n this.#commit(parentPath, withArgRemoved(parentNode, idx));\n }\n\n // --- activation (click-to-edit) ---------------------------------------\n\n /**\n * Bubbling `focusin` on the root: resolves the focused element to its\n * nearest enclosing node (`closest('[data-path]')`) and activates it.\n * One listener handles every node uniformly — mouse click and keyboard\n * Tab both end in a native `focus()` call, so both \"just work\".\n */\n #onFocusIn = (e: FocusEvent): void => {\n const marked = (e.target as HTMLElement).closest(\"[data-path]\") as HTMLElement | null;\n if (marked) this.activePath = marked.dataset.path ?? null;\n };\n\n /** Escape: explicitly collapse the active node back to read mode. */\n #onKeydown = (e: KeyboardEvent): void => {\n if (e.key === \"Escape\" && this.activePath) {\n this.activePath = null;\n (this.shadowRoot?.activeElement as HTMLElement | null)?.blur();\n }\n };\n\n /**\n * A genuine click outside the whole component deactivates it. Driven by\n * click position (not focus-change timing), so it's unaffected by the\n * read-mode-span-swapped-for-a-real-input re-render that activation\n * itself causes.\n */\n #onDocumentClick = (e: MouseEvent): void => {\n if (this.activePath && !e.composedPath().includes(this)) {\n this.activePath = null;\n }\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener(\"click\", this.#onDocumentClick);\n }\n\n disconnectedCallback(): void {\n document.removeEventListener(\"click\", this.#onDocumentClick);\n super.disconnectedCallback();\n }\n\n protected updated(changed: PropertyValues): void {\n if (!changed.has(\"activePath\") || !this.activePath) return;\n // The node that just became active re-rendered its plain-text span (or\n // symbol chip) as a real control — reclaim focus onto it so keyboard\n // interaction continues seamlessly, selecting a literal's content so\n // typing immediately replaces the old value.\n const control = this.shadowRoot?.querySelector<HTMLInputElement | HTMLSelectElement>(\n '.slot-leaf.active > input[type=\"number\"], .slot-leaf.active > input[type=\"text\"], .slot-leaf.active > select',\n );\n if (control && this.shadowRoot?.activeElement !== control) {\n control.focus();\n if (control instanceof HTMLInputElement) control.select();\n }\n }\n\n // --- raw-JSON escape hatch ---------------------------------------------\n\n /**\n * Enter JSON mode (seeding the textarea from the current value) or leave\n * it — leaving is refused while `jsonDraft` doesn't currently parse to a\n * valid expression, so a bad edit can never silently clobber the tree.\n */\n #toggleJsonMode(): void {\n if (this.jsonMode) {\n if (this.jsonError) return;\n this.jsonMode = false;\n return;\n }\n this.activePath = null;\n this.jsonDraft = JSON.stringify(this.value, null, 2);\n this.jsonError = null;\n this.jsonMode = true;\n }\n\n #onJsonInput(text: string): void {\n this.jsonDraft = text;\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch (err) {\n this.jsonError = err instanceof Error ? err.message : \"Invalid JSON\";\n return;\n }\n if (!isValidMathJson(parsed)) {\n this.jsonError =\n \"Not a valid MathJSON expression — expected a number, boolean, string, or array.\";\n return;\n }\n this.jsonError = null;\n this.value = parsed;\n this.#fireChange();\n }\n\n #renderJsonView(): TemplateResult {\n return html`<div class=\"json-view\">\n <textarea\n class=\"json-textarea\"\n spellcheck=\"false\"\n .value=${this.jsonDraft}\n @input=${(e: Event) => this.#onJsonInput((e.currentTarget as HTMLTextAreaElement).value)}\n ></textarea>\n ${this.jsonError ? html`<div class=\"json-error\">${this.jsonError}</div>` : nothing}\n </div>`;\n }\n\n // --- render ----------------------------------------------------------\n\n protected render(): TemplateResult {\n return html`<div class=\"mjtb-toolbar\">\n <button class=\"mode-toggle\" ?disabled=${this.jsonMode && !!this.jsonError} @click=${() => this.#toggleJsonMode()}>\n ${this.jsonMode ? \"Tree view\" : \"JSON view\"}\n </button>\n ${this.jsonMode && this.jsonError\n ? html`<span class=\"json-error-hint\">Fix the error below to switch back</span>`\n : nothing}\n </div>\n ${this.jsonMode\n ? this.#renderJsonView()\n : html`<div class=\"mjtb-root\" @focusin=${this.#onFocusIn} @keydown=${this.#onKeydown}>\n ${this.#renderSlot(this.value, [], undefined, false)}\n </div>`}`;\n }\n\n /**\n * Render one argument slot: dispatches to either the leaf editor or a\n * nested construct box. Every slot is reachable at every argument slot\n * in both generic and notation rendering, because every slot goes\n * through this one method regardless of who calls it. An inactive leaf\n * renders as plain, unadorned text; only the active one shows its real\n * control and its \"⋯\" menu.\n */\n #renderSlot(\n value: MathJsonExpression,\n path: Path,\n argLabel: string | undefined,\n removable: boolean,\n ): TemplateResult {\n const kind = classifyValue(value, this.symbols);\n const key = pathKey(path);\n const isActive = this.activePath === key;\n\n if (kind === \"function\") {\n return html`<span class=\"slot slot-function\">\n ${argLabel ? html`<span class=\"arg-label\">${argLabel}</span>` : nothing}\n ${this.#renderConstruct(value as MathJsonExpression[], path, removable)}\n </span>`;\n }\n\n if (kind === \"symbol\") {\n const ref = resolveSymbol(this.symbols, value as string)!;\n\n if (!isActive) {\n return html`<span class=\"slot slot-leaf\" data-kind=\"symbol\" data-path=${key}>\n ${argLabel ? html`<span class=\"arg-label\">${argLabel}</span>` : nothing}\n <span class=\"symbol-chip\" tabindex=\"0\" title=${ref.id}>${ref.label}</span>\n </span>`;\n }\n\n // Active mode: the chip becomes a real dropdown over every available\n // symbol, not just a fixed label — picking a different one commits\n // immediately, same as typing over a literal input.\n return html`<span class=\"slot slot-leaf active\" data-kind=\"symbol\" data-path=${key}>\n ${argLabel ? html`<span class=\"arg-label\">${argLabel}</span>` : nothing}\n <select\n class=\"symbol-select\"\n @change=${(e: Event) =>\n this.#commit(path, (e.currentTarget as HTMLSelectElement).value)}\n >\n ${this.symbols.map(\n (s) => html`<option value=${s.id} ?selected=${s.id === ref.id}>${s.label}</option>`,\n )}\n </select>\n ${this.#leafMenu(path, kind, removable)}\n </span>`;\n }\n\n if (!isActive) {\n const text =\n kind === \"number\"\n ? String(value)\n : kind === \"boolean\"\n ? value\n ? \"true\"\n : \"false\"\n : (value as string);\n return html`<span class=\"slot slot-leaf\" data-kind=${kind} data-path=${key}>\n ${argLabel ? html`<span class=\"arg-label\">${argLabel}</span>` : nothing}\n <span class=\"value-text\" tabindex=\"0\">${text || nothing}</span>\n </span>`;\n }\n\n let control: TemplateResult;\n if (kind === \"number\") {\n control = html`<input\n type=\"number\"\n .valueAsNumber=${value as number}\n @change=${(e: Event) =>\n this.#commit(path, (e.currentTarget as HTMLInputElement).valueAsNumber)}\n />`;\n } else if (kind === \"boolean\") {\n control = html`<button\n class=\"bool-toggle\"\n @click=${() => this.#commit(path, !(value as boolean))}\n >\n ${value ? \"true\" : \"false\"}\n </button>`;\n } else {\n control = html`<input\n type=\"text\"\n .value=${value as string}\n @change=${(e: Event) =>\n this.#commit(path, (e.currentTarget as HTMLInputElement).value)}\n />`;\n }\n\n return html`<span class=\"slot slot-leaf active\" data-kind=${kind} data-path=${key}>\n ${argLabel ? html`<span class=\"arg-label\">${argLabel}</span>` : nothing}\n ${control}\n ${this.#leafMenu(path, kind, removable)}\n </span>`;\n }\n\n /** The consolidated \"⋯\" menu for one leaf slot — one trigger, not five buttons. */\n #leafMenu(\n path: Path,\n kind: \"number\" | \"boolean\" | \"text\" | \"symbol\",\n removable: boolean,\n ): TemplateResult {\n const typeItem =\n kind === \"symbol\"\n ? html`<button\n class=\"menu-item\"\n @click=${(e: Event) => {\n this.#commit(path, \"\");\n closeMenus(e.currentTarget);\n }}\n >\n Convert to literal\n </button>`\n : html`<button\n class=\"menu-item\"\n @click=${(e: Event) => {\n this.#cycleType(path, kind);\n closeMenus(e.currentTarget);\n }}\n >\n Change type\n </button>`;\n\n return html`<details class=\"picker menu\" @click=${(e: Event) => e.stopPropagation()}>\n <summary title=\"Actions\">…</summary>\n <div class=\"popover menu-popover\">\n <div class=\"menu-header\">${LEAF_KIND_LABELS[kind]}</div>\n ${typeItem}\n ${this.symbols.length ? this.#symbolSubmenu(path) : nothing}\n ${this.#functionSubmenu(path)}\n ${this.#wrapSubmenu(path)}\n ${removable\n ? html`<button\n class=\"menu-item danger\"\n @click=${(e: Event) => {\n this.#removeArg(path);\n closeMenus(e.currentTarget);\n }}\n >\n Remove\n </button>`\n : nothing}\n </div>\n </details>`;\n }\n\n #cycleType(path: Path, kind: \"number\" | \"boolean\" | \"text\"): void {\n const order = [\"number\", \"text\", \"boolean\"] as const;\n const next = order[(order.indexOf(kind) + 1) % order.length]!;\n const value = next === \"number\" ? 0 : next === \"text\" ? \"\" : true;\n this.#commit(path, value);\n }\n\n /** A compound expression `[name, ...args]` — generic or notation form. */\n #renderConstruct(\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const name = node[0] as string;\n // Constants and If each have a shape no other construct does, and\n // need a dedicated renderer — checked first, ahead of notation/generic\n // dispatch, same as those are.\n if (name === \"Constants\" && node.length >= 2) {\n return this.#renderConstants(node, path, removable);\n }\n if (name === \"If\" && node.length >= 3) {\n return this.#renderIf(node, path, removable);\n }\n const notation = getNotation(name);\n if (notation && notationShapeOk(name, notation, node)) {\n return this.#renderNotation(name, notation, node, path, removable);\n }\n return this.#renderGeneric(name, node, path, removable);\n }\n\n #renderGeneric(\n name: string,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const desc = getConstruct(name);\n const args = node.slice(1);\n // A construct we have curated arity for is capped at its real\n // max, so e.g. Round can't grow past 2 args; one we know nothing about\n // stays fully permissive rather than guess.\n const bounds = argBounds(name);\n const isVariadic = desc?.args?.at(-1)?.variadic ?? false;\n const onAdd =\n !bounds || args.length < bounds.max\n ? () => this.#commit(path, withArgAdded(node, 0))\n : undefined;\n // Below the minimum, nothing is removable. At/above it, a variadic\n // construct's args are interchangeable (any may go); a fixed one with\n // a trailing optional arg (e.g. Round's digits) only lets that trailing\n // slot go, since removing an earlier required one would shift the rest\n // into the wrong position.\n const argRemovable = (i: number): boolean => {\n if (!bounds) return true;\n if (args.length <= bounds.min) return false;\n return isVariadic || i === args.length - 1;\n };\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct generic\" tabindex=\"0\" data-path=${key}>\n <span class=\"construct-header\">\n <span class=\"construct-name\">${name}</span>\n ${desc ? html`<span class=\"construct-category\">${categoryLabel(desc.category)}</span>` : nothing}\n ${isActive ? this.#constructMenu(name, path, removable, onAdd) : nothing}\n </span>\n <span class=\"construct-args\">\n ${args.map((a, i) =>\n this.#renderSlot(a, [...path, i + 1], desc?.args?.[i]?.label, argRemovable(i)),\n )}\n </span>\n </span>`;\n }\n\n /**\n * `[\"Constants\", [name1, value1], [name2, value2], ..., finalExpr]`\n * — bind names once, in order (each can reference the ones before it),\n * then evaluate finalExpr with all of them in scope. Every binding is an\n * independently collapsible, named card; the final expression is a\n * normal slot. This is the tool's primary answer to \"this formula is\n * too big to read at once\" — folding an anonymous subtree is possible\n * too (any construct can be wrapped in Constants and named), but giving\n * a piece of the formula a name is the encouraged path.\n */\n #renderConstants(\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const bindings = node.slice(1, -1);\n const finalIndex = node.length - 1;\n const finalExpr = node[finalIndex]!;\n const onAdd = () => {\n const freshName = nextConstantName(bindings);\n this.#commit(path, [\n ...node.slice(0, -1),\n [freshName, 0],\n node[finalIndex]!,\n ]);\n };\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct generic constants\" tabindex=\"0\" data-path=${key}>\n <span class=\"construct-header\">\n <span class=\"construct-name\">Constants</span>\n ${isActive ? this.#constructMenu(\"Constants\", path, removable, onAdd, \"Add constant\") : nothing}\n </span>\n <span class=\"constants-bindings\">\n ${bindings.map((pair, i) => this.#renderConstantBinding(pair, [...path, i + 1]))}\n </span>\n <span class=\"constants-final\">\n <span class=\"arg-label\">result</span>\n ${this.#renderSlot(finalExpr, [...path, finalIndex], undefined, false)}\n </span>\n </span>`;\n }\n\n #renderConstantBinding(pair: MathJsonExpression, bindingPath: Path): TemplateResult {\n // Defensive: a malformed binding (e.g. hand-edited via the raw-JSON\n // view into something that isn't a [name, value] pair) still renders\n // — as a normal generic slot, so it's visibly wrong and fixable\n // rather than crashing the whole tree.\n if (!Array.isArray(pair) || pair.length !== 2 || typeof pair[0] !== \"string\") {\n return this.#renderSlot(pair, bindingPath, undefined, true);\n }\n const [bindingName, value] = pair as [string, MathJsonExpression];\n const namePath = [...bindingPath, 0];\n const valuePath = [...bindingPath, 1];\n const foldKey = pathKey(bindingPath);\n const collapsed = !this.expandedConstants.has(foldKey);\n return html`<span class=\"constant-card\">\n <span class=\"constant-header\">\n <button\n class=\"fold-toggle\"\n title=${collapsed ? \"Expand\" : \"Collapse\"}\n @click=${() => this.#toggleConstantFold(foldKey)}\n >\n ${collapsed ? \"▸\" : \"▾\"}\n </button>\n ${this.#renderConstantName(bindingName, namePath)}\n <button\n class=\"small-remove\"\n title=\"Remove this constant\"\n @click=${() => this.#removeArg(bindingPath)}\n >\n ×\n </button>\n </span>\n ${collapsed\n ? nothing\n : html`<span class=\"constant-value\">${this.#renderSlot(value, valuePath, undefined, false)}</span>`}\n </span>`;\n }\n\n /** A constant's name: click-to-edit plain text, same as any literal — no menu, renaming is the only action. */\n #renderConstantName(value: string, path: Path): TemplateResult {\n const key = pathKey(path);\n const isActive = this.activePath === key;\n if (!isActive) {\n return html`<span class=\"slot slot-leaf constant-name\" data-path=${key}>\n <span class=\"value-text\" tabindex=\"0\">${value}</span>\n </span>`;\n }\n return html`<span class=\"slot slot-leaf active constant-name\" data-path=${key}>\n <input\n type=\"text\"\n .value=${value}\n @change=${(e: Event) => this.#commit(path, (e.currentTarget as HTMLInputElement).value)}\n />\n </span>`;\n }\n\n /**\n * `If` has two distinct valid shapes in mathjson-solver, and which one a\n * given node is in has to be detected the same way mathjson-solver's own\n * evaluator does it (`__main__.py`'s `If`): flat CortexJS form\n * `[If, cond, then, else?]`, or the Python \"pair\" form\n * `[If, [cond1, val1], [cond2, val2], ..., elseVal]` for unlimited\n * elseif branches. `s[1]` (the first argument) disambiguates: not a\n * list at all, or a list whose own first element is a known construct\n * name, means it IS the (flat-form) condition; otherwise it's the first\n * `[condition, value]` pair of pair-form.\n */\n #renderIf(node: MathJsonExpression[], path: Path, removable: boolean): TemplateResult {\n if (isCortexJsIfCondition(node[1])) {\n return this.#renderIfFlat(node, path, removable);\n }\n return this.#renderIfPairs(node, path, removable);\n }\n\n #renderIfFlat(\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const hasElse = node.length === 4;\n const items: (TemplateResult | typeof nothing)[] = [\n !hasElse\n ? html`<button\n class=\"menu-item\"\n @click=${(e: Event) => {\n this.#commit(path, withArgAdded(node, 0));\n closeMenus(e.currentTarget);\n }}\n >\n Add else\n </button>`\n : nothing,\n html`<button\n class=\"menu-item\"\n @click=${(e: Event) => {\n // Converts to pair-form: the existing condition/then becomes the\n // first branch, a fresh placeholder branch is added after it,\n // and the existing (or default) else carries over unchanged.\n const cond = node[1]!;\n const thenVal = node[2]!;\n const elseVal = hasElse ? node[3]! : 0;\n this.#commit(path, [\"If\", [cond, thenVal], [true, 0], elseVal]);\n closeMenus(e.currentTarget);\n }}\n >\n Add elseif\n </button>`,\n ];\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct generic if-block\" tabindex=\"0\" data-path=${key}>\n <span class=\"construct-header\">\n <span class=\"construct-name\">If</span>\n ${isActive ? this.#customMenu(\"If\", path, removable, items) : nothing}\n </span>\n <span class=\"if-branches\">\n <span class=\"if-row\">\n <span class=\"if-keyword\">if</span>\n ${this.#renderSlot(node[1]!, [...path, 1], undefined, false)}\n </span>\n <span class=\"if-row\">\n <span class=\"if-keyword\">then</span>\n ${this.#renderSlot(node[2]!, [...path, 2], undefined, false)}\n </span>\n ${hasElse\n ? html`<span class=\"if-row\">\n <span class=\"if-keyword\">else</span>\n ${this.#renderSlot(node[3]!, [...path, 3], undefined, true)}\n </span>`\n : nothing}\n </span>\n </span>`;\n }\n\n #renderIfPairs(\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const branches = node.slice(1, -1);\n const finalIndex = node.length - 1;\n const canRemoveBranch = branches.length > 1;\n const items = [\n html`<button\n class=\"menu-item\"\n @click=${(e: Event) => {\n this.#commit(path, [...node.slice(0, -1), [true, 0], node[finalIndex]!]);\n closeMenus(e.currentTarget);\n }}\n >\n Add elseif\n </button>`,\n ];\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct generic if-block\" tabindex=\"0\" data-path=${key}>\n <span class=\"construct-header\">\n <span class=\"construct-name\">If</span>\n ${isActive ? this.#customMenu(\"If\", path, removable, items) : nothing}\n </span>\n <span class=\"if-branches\">\n ${branches.map((branch, i) =>\n this.#renderIfBranch(branch, [...path, i + 1], i === 0, canRemoveBranch),\n )}\n <span class=\"if-row\">\n <span class=\"if-keyword\">else</span>\n ${this.#renderSlot(node[finalIndex]!, [...path, finalIndex], undefined, false)}\n </span>\n </span>\n </span>`;\n }\n\n #renderIfBranch(\n branch: MathJsonExpression,\n branchPath: Path,\n isFirst: boolean,\n removable: boolean,\n ): TemplateResult {\n if (!Array.isArray(branch) || branch.length !== 2) {\n // Defensive: a hand-edited (e.g. via the raw-JSON view) malformed\n // branch still renders, as a plain generic slot, rather than crashing.\n return html`<span class=\"if-row\">${this.#renderSlot(branch, branchPath, undefined, removable)}</span>`;\n }\n const [cond, value] = branch as [MathJsonExpression, MathJsonExpression];\n return html`<span class=\"if-row\">\n <span class=\"if-keyword\">${isFirst ? \"if\" : \"else if\"}</span>\n ${this.#renderSlot(cond, [...branchPath, 0], undefined, false)}\n <span class=\"if-keyword\">then</span>\n ${this.#renderSlot(value, [...branchPath, 1], undefined, false)}\n ${removable\n ? html`<button\n class=\"small-remove\"\n title=\"Remove this branch\"\n @click=${() => this.#removeArg(branchPath)}\n >\n ×\n </button>`\n : nothing}\n </span>`;\n }\n\n #renderNotation(\n name: string,\n spec: NotationSpec,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n switch (spec.kind) {\n case \"infix\":\n return this.#renderInfix(name, spec, node, path, removable);\n case \"fraction\":\n return this.#renderFraction(name, node, path, removable);\n case \"power\":\n return this.#renderPower(name, node, path, removable);\n case \"sqrt\":\n case \"root\":\n return this.#renderRadical(name, node, path, removable);\n case \"reducer\":\n return this.#renderReducer(name, spec, node, path, removable);\n case \"comparison\":\n return this.#renderComparison(name, spec, node, path, removable);\n case \"array\":\n return this.#renderArray(name, node, path, removable);\n }\n }\n\n #renderInfix(\n name: string,\n spec: NotationSpec,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const args = node.slice(1);\n const seedsBoolean = typeof args[0] === \"boolean\";\n const onAdd = () => this.#commit(path, withArgAdded(node, seedsBoolean ? true : 0));\n const canRemove = args.length > 2;\n const key = pathKey(path);\n const isActive = this.activePath === key;\n // Long And/Or chains wrap mid-row in the compact inline form once\n // they run out of width — fine for a couple of conditions, ragged for\n // a long list. Past the threshold, stack one operand per line\n // instead (Add/Subtract/Multiply chains stay inline regardless; they\n // don't tend to get long enough for this to matter).\n const stacked =\n (name === \"And\" || name === \"Or\") && args.length > this.inlineToStackedThreshold;\n const rows = args.map(\n (a, i) => html`\n ${i > 0 ? html`<span class=\"op\">${spec.symbol}</span>` : nothing}\n ${this.#renderSlot(a, [...path, i + 1], undefined, canRemove)}\n `,\n );\n return html`<span class=\"node construct infix\" tabindex=\"0\" data-path=${key}>\n <span class=\"${stacked ? \"infix-stacked\" : \"infix-row\"}\">\n ${stacked ? rows.map((row) => html`<span class=\"infix-stacked-row\">${row}</span>`) : rows}\n </span>\n ${isActive ? this.#constructMenu(name, path, removable, onAdd) : nothing}\n </span>`;\n }\n\n #renderFraction(\n name: string,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct fraction\" tabindex=\"0\" data-path=${key}>\n <span class=\"frac\">\n <span class=\"frac-num\">${this.#renderSlot(node[1]!, [...path, 1], undefined, false)}</span>\n <span class=\"frac-line\"></span>\n <span class=\"frac-den\">${this.#renderSlot(node[2]!, [...path, 2], undefined, false)}</span>\n </span>\n ${isActive ? this.#constructMenu(name, path, removable, undefined) : nothing}\n </span>`;\n }\n\n #renderPower(\n name: string,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const isSquare = name === \"Square\";\n const base = node[1]!;\n // The base is the thing actually being exponentiated — if it's itself\n // a compound expression (e.g. Add, or another Power), a bare\n // superscript stacked on top of it reads ambiguously (is x+y² meaning\n // x+(y²) or (x+y)²?) — parenthesize it, same as writing (x+y)^2 by\n // hand. The exponent itself doesn't need this: a^(b^c) is already\n // unambiguous by the usual right-to-left reading of a tower of\n // exponents, so a nested Power there reads fine without extra parens.\n const needsParens = isCompound(base);\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct power\" tabindex=\"0\" data-path=${key}>\n <span class=\"power-frame\">\n <span class=\"power-base\">\n ${needsParens ? PAREN_OPEN : nothing}${this.#renderSlot(base, [...path, 1], undefined, false)}${needsParens ? PAREN_CLOSE : nothing}\n </span>\n <span class=\"power-exp\">\n ${isSquare ? html`<span class=\"literal-exp\">2</span>` : this.#renderSlot(node[2]!, [...path, 2], undefined, false)}\n </span>\n </span>\n ${isActive ? this.#constructMenu(name, path, removable, undefined) : nothing}\n </span>`;\n }\n\n #renderRadical(\n name: string,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const hasDegree = name === \"Root\";\n const key = pathKey(path);\n const isActive = this.activePath === key;\n // The stretch row lives on its own .radical-frame span, not directly\n // on the outer \"node construct\" one (and not reusing the \"radical\"\n // class the outer span already carries, so the two never collide) —\n // .node.construct's own align-items: center (two classes, higher\n // specificity) would otherwise beat a same-element align-items:\n // stretch (one class) in the cascade regardless of source order,\n // leaving the hook at its aspect-ratio-only size instead of actually\n // stretching. Same reason .power-base is its own span rather than\n // living on \"node construct power\" directly.\n return html`<span class=\"node construct radical\" tabindex=\"0\" data-path=${key}>\n <span class=\"radical-frame\">\n ${hasDegree\n ? html`<span class=\"radical-degree\">${this.#renderSlot(node[2]!, [...path, 2], undefined, false)}</span>`\n : nothing}\n ${ROOT_HOOK}\n <span class=\"radical-sign\">\n <span class=\"radicand\">${this.#renderSlot(node[1]!, [...path, 1], undefined, false)}</span>\n </span>\n </span>\n ${isActive ? this.#constructMenu(name, path, removable, undefined) : nothing}\n </span>`;\n }\n\n #renderReducer(\n name: string,\n spec: NotationSpec,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const el1 = node[1];\n const arrayWrapped = el1 !== undefined && isCompound(el1) && el1[0] === \"Array\";\n const elementsPath = arrayWrapped ? ([...path, 1] as Path) : path;\n const elementsNode = arrayWrapped ? (node[1] as MathJsonExpression[]) : node;\n const elements = elementsNode.slice(1);\n const onAdd = () => this.#commit(elementsPath, withArgAdded(elementsNode, 0));\n const canRemoveEl = elements.length > (arrayWrapped ? 0 : 1);\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct reducer\" tabindex=\"0\" data-path=${key}>\n <span class=\"reducer-symbol\">${spec.symbol}</span>(<span class=\"reducer-args\">\n ${elements.map(\n (el, i) => html`\n ${i > 0 ? html`<span class=\"comma\">, </span>` : nothing}\n ${this.#renderSlot(el, [...elementsPath, i + 1], undefined, canRemoveEl)}\n `,\n )}\n </span>)\n ${isActive ? this.#constructMenu(name, path, removable, onAdd) : nothing}\n </span>`;\n }\n\n #renderComparison(\n name: string,\n spec: NotationSpec,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct comparison\" tabindex=\"0\" data-path=${key}>\n ${this.#renderSlot(node[1]!, [...path, 1], undefined, false)}\n <span class=\"op\">${spec.symbol}</span>\n ${this.#renderSlot(node[2]!, [...path, 2], undefined, false)}\n ${isActive ? this.#constructMenu(name, path, removable, undefined) : nothing}\n </span>`;\n }\n\n /**\n * A literal list, e.g. `(1, 2, 3)` — most visible as the collection\n * operand of `In`/`Contains`/etc. once those are rendered via\n * `#renderComparison` too, since a slot's own value simply recurses\n * through `#renderSlot` regardless of which parent construct it's in.\n */\n #renderArray(\n name: string,\n node: MathJsonExpression[],\n path: Path,\n removable: boolean,\n ): TemplateResult {\n const elements = node.slice(1);\n const onAdd = () => this.#commit(path, withArgAdded(node, 0));\n const key = pathKey(path);\n const isActive = this.activePath === key;\n return html`<span class=\"node construct array-list\" tabindex=\"0\" data-path=${key}\n >(<span class=\"list-elements\">\n ${elements.map(\n (el, i) => html`\n ${i > 0 ? html`<span class=\"comma\">, </span>` : nothing}\n ${this.#renderSlot(el, [...path, i + 1], undefined, true)}\n `,\n )}\n </span>)${isActive ? this.#constructMenu(name, path, removable, onAdd) : nothing}\n </span>`;\n }\n\n /** The consolidated \"⋯\" menu for one construct box — add/wrap/remove. */\n #constructMenu(\n name: string,\n path: Path,\n removable: boolean,\n onAdd: (() => void) | undefined,\n addLabel = \"Add argument\",\n ): TemplateResult {\n const items = onAdd\n ? [\n html`<button\n class=\"menu-item\"\n @click=${(e: Event) => {\n onAdd();\n closeMenus(e.currentTarget);\n }}\n >\n ${addLabel}\n </button>`,\n ]\n : [];\n return this.#customMenu(name, path, removable, items);\n }\n\n /**\n * The general form `#constructMenu` is a thin wrapper over: a header\n * naming the node, then whatever construct-specific items the caller\n * needs (e.g. `If`'s \"Add else\"/\"Add elseif\", which don't fit the\n * single add-button shape every other construct uses), then the\n * \"Change operator\" submenu (only for constructs with `swapTargets`),\n * wrap-in-parent, and remove.\n */\n #customMenu(\n name: string,\n path: Path,\n removable: boolean,\n items: readonly (TemplateResult | typeof nothing)[],\n ): TemplateResult {\n // `open`, not left to a click on the summary: this whole element only\n // exists in the DOM while its node is active (every caller guards it\n // behind `isActive ? ... : nothing`), and unlike a leaf, a construct\n // has no other \"real control\" activation reveals — the menu *is* the\n // point of activating it, so open it the same click that activates\n // the node instead of making that click a no-op that only shows a\n // still-closed trigger. Native <details> toggling still lets a user\n // collapse it manually (e.g. to read the expression under it) without\n // deactivating; Lit leaves a plain attribute like this alone on\n // re-render, so that manual collapse isn't fought on the next update.\n //\n // No visible \"…\" trigger for this one (unlike the leaf menu) — since\n // it's already open the moment the node is active, a button that\n // does nothing on click but sit at the tail end of the node (often\n // far from wherever within it was actually clicked, e.g. the third\n // \"∧\" of a long And chain) is pure clutter. `construct-menu` in\n // styles.ts hides the summary and collapses this element to zero\n // size, and anchors `.popover` to the whole node's own box (`.popover\n // { position: absolute }` resolves to the nearest positioned\n // ancestor, which is `.node.construct` once this element stops being\n // one) instead of to this now-invisible spot.\n return html`<details class=\"picker menu construct-menu\" open @click=${(e: Event) => e.stopPropagation()}>\n <summary title=\"Actions\">…</summary>\n <div class=\"popover menu-popover\">\n <div class=\"menu-header\">${displayName(name)}</div>\n ${items}\n ${this.symbols.length ? this.#symbolSubmenu(path, \"Replace with symbol…\") : nothing}\n ${this.#functionSubmenu(path)}\n ${this.#operatorSubmenu(name, path)}\n ${this.#wrapSubmenu(path)}\n ${removable\n ? html`<button\n class=\"menu-item danger\"\n @click=${(e: Event) => {\n this.#removeArg(path);\n closeMenus(e.currentTarget);\n }}\n >\n Remove\n </button>`\n : nothing}\n </div>\n </details>`;\n }\n\n /**\n * \"Change operator…\": swap `name` for an arity-compatible sibling (e.g.\n * `Greater` -> `LessEqual`), keeping its arguments — see `swapTargets`.\n * A flat row of small symbol buttons, not a searchable picker like the\n * other submenus: the candidate list is always small and fully known\n * ahead of time, so a search box would be pure friction here.\n *\n * For the comparison/membership/subset group specifically (see\n * `isComparisonLike`), two more things join the same submenu: \"In\n * range…\"/\"Not in range…\" (there's no plain-rename target for these —\n * they build `[Element, value, [Interval, lo, hi]]`, CortexJS's own\n * convention for range membership, reusing the first two existing\n * operands as value/lo and adding a fresh hi) and \"true\"/\"false\"\n * (collapsing the whole condition to a constant — a full replace, not a\n * rename, since there's no argument-preserving reading of \"always\n * true\").\n */\n #operatorSubmenu(name: string, path: Path): TemplateResult | typeof nothing {\n const targets = swapTargets(name);\n const comparisonLike = isComparisonLike(name);\n if (targets.length === 0 && !comparisonLike) return nothing;\n const swap = (e: Event, target: string) => {\n this.value = swapOperator(this.value, path, target, swapNeedsArgReversal(name, target));\n this.#fireChange();\n closeMenus(e.currentTarget);\n };\n return html`<details class=\"submenu\">\n <summary>Change operator…</summary>\n <span class=\"popover operator-menu\">\n <span class=\"operator-grid\">\n ${targets.map(\n (target) => html`<button\n class=\"operator-btn\"\n title=${displayName(target)}\n @click=${(e: Event) => swap(e, target)}\n >\n ${operatorGlyph(target)}\n </button>`,\n )}\n ${comparisonLike\n ? html`\n <button\n class=\"operator-btn\"\n title=\"Always true\"\n @click=${(e: Event) => {\n this.#commit(path, true);\n closeMenus(e.currentTarget);\n }}\n >\n true\n </button>\n <button\n class=\"operator-btn\"\n title=\"Always false\"\n @click=${(e: Event) => {\n this.#commit(path, false);\n closeMenus(e.currentTarget);\n }}\n >\n false\n </button>\n `\n : nothing}\n </span>\n ${comparisonLike\n ? html`\n <button\n class=\"menu-item\"\n @click=${(e: Event) => {\n const args = (getAtPath(this.value, path) as MathJsonExpression[]).slice(1);\n this.#commit(path, [\n \"Element\",\n args[0] ?? 0,\n [\"Interval\", args[1] ?? 0, 0],\n ]);\n closeMenus(e.currentTarget);\n }}\n >\n In range…\n </button>\n <button\n class=\"menu-item\"\n @click=${(e: Event) => {\n const args = (getAtPath(this.value, path) as MathJsonExpression[]).slice(1);\n this.#commit(path, [\n \"NotElement\",\n args[0] ?? 0,\n [\"Interval\", args[1] ?? 0, 0],\n ]);\n closeMenus(e.currentTarget);\n }}\n >\n Not in range…\n </button>\n `\n : nothing}\n </span>\n </details>`;\n }\n\n // --- submenus (native <details>/<datalist> — no extra reactive state) --\n\n #symbolSubmenu(path: Path, label = \"Insert symbol…\"): TemplateResult {\n const listId = `mjtb-sym-${pathKey(path)}`;\n return html`<details class=\"submenu\">\n <summary>${label}</summary>\n <span class=\"popover\">\n <input\n type=\"search\"\n list=${listId}\n placeholder=\"Symbol…\"\n @change=${(e: Event) => {\n const input = e.currentTarget as HTMLInputElement;\n const match = this.symbols.find((s) => s.label === input.value);\n if (match) this.#commit(path, match.id);\n input.value = \"\";\n closeMenus(input);\n }}\n />\n <datalist id=${listId}>\n ${this.symbols.map((s) => html`<option value=${s.label}></option>`)}\n </datalist>\n </span>\n </details>`;\n }\n\n #functionSubmenu(path: Path): TemplateResult {\n const listId = `mjtb-fn-${pathKey(path)}`;\n return html`<details class=\"submenu\">\n <summary>Turn into function…</summary>\n <span class=\"popover\">\n <input\n type=\"search\"\n list=${listId}\n placeholder=\"Function…\"\n @change=${(e: Event) => {\n const input = e.currentTarget as HTMLInputElement;\n const name = input.value;\n if (getConstruct(name) && !this.blacklist.includes(name)) {\n this.#commit(path, [name, ...defaultArgsFor(name)]);\n }\n input.value = \"\";\n closeMenus(input);\n }}\n />\n <datalist id=${listId}>\n ${searchConstructs(\"\", this.blacklist).map((c) => html`<option value=${c.name}></option>`)}\n </datalist>\n </span>\n </details>`;\n }\n\n #wrapSubmenu(path: Path): TemplateResult {\n const listId = `mjtb-wrap-${pathKey(path)}`;\n return html`<details class=\"submenu\">\n <summary>Wrap in…</summary>\n <span class=\"popover\">\n <input\n type=\"search\"\n list=${listId}\n placeholder=\"Wrap in…\"\n @change=${(e: Event) => {\n const input = e.currentTarget as HTMLInputElement;\n const name = input.value;\n if (getConstruct(name) && !this.blacklist.includes(name)) {\n const extra = defaultArgsFor(name).slice(1);\n this.value = wrapAtPath(this.value, path, name, extra);\n this.#fireChange();\n }\n input.value = \"\";\n closeMenus(input);\n }}\n />\n <datalist id=${listId}>\n ${searchConstructs(\"\", this.blacklist).map((c) => html`<option value=${c.name}></option>`)}\n </datalist>\n </span>\n </details>`;\n }\n}\n\nif (!customElements.get(\"mathjson-tree-builder\")) {\n customElements.define(\"mathjson-tree-builder\", MathJsonTreeBuilderElement);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"mathjson-tree-builder\": MathJsonTreeBuilderElement;\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":";AAKA,IAAMA,IAAE,YAAWC,IAAED,EAAE,eAAsBA,EAAE,aAAX,KAAK,KAAgBA,EAAE,SAAS,iBAAe,wBAAuB,SAAS,aAAW,aAAY,cAAc,WAAUE,IAAE,OAAO,GAAEC,oBAAE,IAAI,QAAM,GAAQC,IAAN,MAAO;CAAC,YAAY,GAAE,GAAE,GAAE;EAAC,IAAG,KAAK,eAAa,CAAC,GAAE,MAAIF,GAAE,MAAM,MAAM,mEAAmE;EAAE,KAAK,UAAQ,GAAE,KAAK,IAAE;CAAC;CAAC,IAAI,aAAY;EAAC,IAAI,IAAE,KAAK,GAAQ,IAAE,KAAK;EAAE,IAAGD,KAAY,MAAT,KAAK,GAAM;GAAC,IAAM,IAAW,MAAT,KAAK,KAAW,EAAE,WAAN;GAAa,MAAI,IAAEE,EAAE,IAAI,CAAC,IAAY,MAAT,KAAK,OAAS,KAAK,IAAE,IAAE,IAAI,cAAY,EAAA,CAAG,YAAY,KAAK,OAAO,GAAE,KAAGA,EAAE,IAAI,GAAE,CAAC;EAAE;EAAC,OAAO;CAAC;CAAC,WAAU;EAAC,OAAO,KAAK;CAAO;AAAC,GAAOE,KAAE,MAAG,IAAID,EAAY,OAAO,KAAjB,WAAmB,IAAE,IAAE,IAAG,KAAK,GAAEF,CAAC,GAAEI,KAAG,GAAE,GAAG,MAAiU,IAAIF,EAApT,EAAE,WAAN,IAAa,EAAE,KAAG,EAAE,QAAQ,GAAE,GAAE,MAAI,MAAG,MAAG;CAAC,IAAG,CAAC,MAAI,EAAE,cAAa,OAAO,EAAE;CAAQ,IAAa,OAAO,KAAjB,UAAmB,OAAO;CAAE,MAAM,MAAM,qEAAmE,IAA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MAAM,CAAI,iBAAiB,EAAE,KAAK,WAAW,EAAE;;;;CAInG;AACF;AAtoCG,EAAA,CAAA,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GAG7B,EAAA,CAAA,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GAG7B,EAAA,CAAA,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAG7B,EAAA,CAAA,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAY7B,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,WAAW;AAA8B,CAAC,CAAA,GAAA,EAAA,WAAA,4BAAA,KAAA,CAAA,GASnE,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GAIN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAIN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAIN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GASN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,qBAAA,KAAA,CAAA,GAqlCJ,eAAe,IAAI,uBAAuB,KAC7C,eAAe,OAAO,yBAAyB,CAA0B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — do not hand-edit.
|
|
3
|
+
*
|
|
4
|
+
* Produced by `scripts/extract-registry.py` from mathjson-solver's own
|
|
5
|
+
* `constructs` dict (`src/mathjson_solver/__main__.py`). Regenerate with:
|
|
6
|
+
*
|
|
7
|
+
* python3 scripts/extract-registry.py <path-to-mathjson-solver-checkout>
|
|
8
|
+
*/
|
|
9
|
+
import type { ConstructDescriptor } from "../types.js";
|
|
10
|
+
export declare const CATEGORY_LABELS: Record<string, string>;
|
|
11
|
+
export declare const GENERATED_CONSTRUCTS: readonly ConstructDescriptor[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-authored `args` metadata: proper argument labels for the ~20-30
|
|
3
|
+
* constructs a typical formula actually uses. Everything else falls back
|
|
4
|
+
* to generic numbered labels (`arg1`, `arg2`, ...) via the registry —
|
|
5
|
+
* this file is an incremental enhancement, not a completeness requirement.
|
|
6
|
+
*
|
|
7
|
+
* Keyed by construct name; extend this as real usage data comes in.
|
|
8
|
+
*/
|
|
9
|
+
import type { ArgSpec } from "../types.js";
|
|
10
|
+
export declare const CURATED_ARGS: Record<string, ArgSpec[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-authored, human-readable names for constructs whose raw MathJSON
|
|
3
|
+
* name doesn't read naturally on its own — chiefly the curated notation
|
|
4
|
+
* set, since those render with no name label at all (a fraction, an
|
|
5
|
+
* infix row, ... show no text saying "Divide"/"Add"), so their context
|
|
6
|
+
* menu is the only place a name can appear. `displayName()` in
|
|
7
|
+
* `registry.ts` falls back to the raw construct name for everything else
|
|
8
|
+
* (generic mode already shows that name in its own header).
|
|
9
|
+
*/
|
|
10
|
+
export declare const CONSTRUCT_DISPLAY_NAMES: Record<string, string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `node` actually has the arity/shape a given notation spec
|
|
3
|
+
* expects. A node whose construct is in the curated set but whose current
|
|
4
|
+
* shape doesn't match (e.g. `Add` with a single argument, or `Product`
|
|
5
|
+
* before its argument has been normalized to an `Array`) falls back to
|
|
6
|
+
* generic rendering rather than rendering broken notation — this is
|
|
7
|
+
* the one place that fallback decision is made.
|
|
8
|
+
*/
|
|
9
|
+
import { type MathJsonExpression } from "../types.js";
|
|
10
|
+
import type { NotationSpec } from "./notation.js";
|
|
11
|
+
export declare function notationShapeOk(name: string, spec: NotationSpec, node: readonly MathJsonExpression[]): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The curated notation set — a deliberately small list of constructs
|
|
3
|
+
* with real, widely-recognized mathematical notation. A construct's
|
|
4
|
+
* absence here is the signal to fall back to generic rendering; this is
|
|
5
|
+
* the one and only place that decision is made.
|
|
6
|
+
*
|
|
7
|
+
* Quality bar: adequate readability, not LaTeX-level typesetting.
|
|
8
|
+
*/
|
|
9
|
+
export type NotationKind = "infix" | "fraction" | "power" | "sqrt" | "root" | "reducer" | "comparison" | "array";
|
|
10
|
+
export interface NotationSpec {
|
|
11
|
+
kind: NotationKind;
|
|
12
|
+
/** Infix/comparison operator glyph or word, or reducer glyph (Σ/Π). Unused for "array". */
|
|
13
|
+
symbol?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const NOTATION: Record<string, NotationSpec>;
|
|
16
|
+
/** The other constructs `name` can be freely swapped to, or `[]` if it's in no group. */
|
|
17
|
+
export declare function swapTargets(name: string): readonly string[];
|
|
18
|
+
/** Whether `name` is in the comparison/membership/subset group specifically. */
|
|
19
|
+
export declare function isComparisonLike(name: string): boolean;
|
|
20
|
+
/** Whether swapping construct `from` to `to` needs its first two arguments reversed. */
|
|
21
|
+
export declare function swapNeedsArgReversal(from: string, to: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The label for a "Change operator" button — the same symbol/word the
|
|
24
|
+
* construct renders with inline in the tree (`NOTATION`'s own `symbol`),
|
|
25
|
+
* so the button never shows something different from what picking it
|
|
26
|
+
* actually produces; falls back to the raw name for a group member with
|
|
27
|
+
* no curated notation of its own.
|
|
28
|
+
*/
|
|
29
|
+
export declare function operatorGlyph(name: string): string;
|