@rogieking/figui3 8.9.49 → 8.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fig-lab.js CHANGED
@@ -1,3 +1 @@
1
- function U(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function Y(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var ZJ="http://www.w3.org/2000/svg";function $J(J,Q){let Z=($)=>{if($===null||$===void 0||$===!1)return;if(Array.isArray($)){$.forEach(Z);return}J.append($ instanceof Node?$:String($))};return Z(Q),J}function jJ(J,Q={}){for(let[Z,$]of Object.entries(Q)){if($===null||$===void 0||$===!1)continue;if(Z==="className")if(J.namespaceURI===ZJ)J.setAttribute("class",String($));else J.className=String($);else if($===!0)J.setAttribute(Z,"");else J.setAttribute(Z,String($))}return J}function L(J,Q,Z){let $=document.createElement(J);return jJ($,Q),$J($,Z)}function E(J,Q,Z){let $=document.createElementNS(ZJ,J);return jJ($,Q),$J($,Z)}function l(J,Q){let Z=Y(J,"disabled");for(let $ of Q)$?.toggleAttribute("disabled",Z)}function HJ(J,Q,Z){let $=Number(Q),j=Number(Z),_=Number.isFinite($)?Math.max(0,Math.min(1,$)):Number.isFinite(j)?Math.max(0,Math.min(100,j))/100:1,X=Number.isFinite(j)?Math.max(0,Math.min(100,j)):Math.round(_*100);return{color:J,alpha:_,opacity:X}}var n=new WeakMap;function f(J){let Q=n.get(J);if(!Q){let Z=document.createElement("fig-menu");Z.setAttribute("position","bottom left"),Z.setAttribute("offset","0 0");let $=document.createElement("fig-menu-item");$.setAttribute("value","reset-default"),$.textContent="Reset",Z.appendChild($);let j=0,_=()=>{if(j)clearTimeout(j),j=0;window.removeEventListener("pointerup",X,!0),window.removeEventListener("pointercancel",X,!0)},X=()=>{_();let O=Q?.point;if(O)Z.showAt?.(O.x,O.y)};Q={menu:Z,point:null,clearPendingOpen:_,handleContextMenu:(O)=>{if(Y(J,"disabled")||O.target?.closest?.("fig-menu"))return;O.preventDefault(),O.stopPropagation(),O.stopImmediatePropagation?.(),Q.point={x:O.clientX,y:O.clientY},_(),window.addEventListener("pointerup",X,{once:!0,capture:!0}),window.addEventListener("pointercancel",X,{once:!0,capture:!0}),j=window.setTimeout(X,180)},handleChange:(O)=>{if(O.stopPropagation(),O.detail?.value==="reset-default")J.resetToDefault?.()}},n.set(J,Q)}if(Q.menu.parentElement!==J)J.appendChild(Q.menu);J.removeEventListener("contextmenu",Q.handleContextMenu),J.addEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange),Q.menu.addEventListener("change",Q.handleChange)}function D(J){let Q=n.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function g(J,Q){for(let Z of["input","change"])J.dispatchEvent(new CustomEvent(Z,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}function c(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function e(J,Q){let Z=($)=>{if(Array.isArray($))return $.map(Z);if($&&typeof $==="object")return Object.keys($).sort().reduce((j,_)=>{return j[_]=Z($[_]),j},{});return $};try{let $=typeof J==="string"?JSON.parse(J):J,j=typeof Q==="string"?JSON.parse(Q):Q;return JSON.stringify(Z($))===JSON.stringify(Z(j))}catch{return c(J,Q)}}function RJ(J,Q,Z=0.179){if(!J||!Q)return null;let $=document.createElement("span");$.style.cssText="position:absolute;visibility:hidden;pointer-events:none;color:"+Q,J.appendChild($);let j=getComputedStyle($).color;$.remove();let _=j.match(/[\d.]+/g)?.slice(0,3).map(Number),X=j.startsWith("rgb")?_:j.startsWith("color(srgb")&&_?_.map((M)=>M*255):null;if(!X||X.length<3||X.some(Number.isNaN))return null;let[q,B,O]=X.map((M)=>{let k=M/255;return k<=0.04045?k/12.92:((k+0.055)/1.055)**2.4});return 0.2126*q+0.7152*B+0.0722*O<=Z?"light":"dark"}var JJ=0;function _J(J="fig-lab"){return JJ+=1,`${J}-${JJ}`}class XJ extends HTMLElement{}U("fig-ai-prompt",XJ);class BJ extends HTMLElement{}U("fig-ai-context",BJ);class qJ extends HTMLElement{}U("fig-chat-message",qJ);class OJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=null;#j=null;#$=null;#O=this.#L.bind(this);#B=this.#K.bind(this);#G=this.#P.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#Q)this.#X();this.#j.removeEventListener("click",this.#O),this.#j.addEventListener("click",this.#O),this.#q(),this.#Y()}disconnectedCallback(){this.#j?.removeEventListener("click",this.#O),this.#M()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;this.#Y()}#X(){this.#Z=document.createElement("fig-tooltip"),this.#Z.className="fig-attachment-tooltip",this.#Q=document.createElement("fig-image"),this.#Q.setAttribute("aspect-ratio","1/1"),this.#Q.setAttribute("fit","cover"),this.#Q.setAttribute("full",""),this.#J=document.createElement("span"),this.#J.className="fig-attachment-fallback",this.#J.setAttribute("aria-hidden","true"),this.#_=document.createElement("fig-tooltip"),this.#_.className="fig-attachment-remove-tooltip",this.#_.setAttribute("text","Remove attachment"),this.#j=document.createElement("fig-button"),this.#j.className="fig-attachment-remove",this.#j.setAttribute("variant","overlay"),this.#j.setAttribute("size","small"),this.#j.setAttribute("icon","");let J=document.createElement("fig-icon");J.setAttribute("name","close"),J.setAttribute("size","small"),this.#j.append(J),this.#_.append(this.#j),this.#Q.append(this.#J),this.#Z.append(this.#Q),this.replaceChildren(this.#Z,this.#_),this.#j.addEventListener("click",this.#O),this.#q()}#q(){let J=this.#Q?.mediaEl;if(!J||J===this.#$)return;this.#M(),this.#$=J,this.#$.addEventListener("load",this.#B),this.#$.addEventListener("error",this.#G)}#M(){if(!this.#$)return;this.#$.removeEventListener("load",this.#B),this.#$.removeEventListener("error",this.#G),this.#$=null}#Y(){let J=this.getAttribute("src")||"",Q=this.getAttribute("name")||"Attachment",Z=!this.hasAttribute("removable")||Y(this,"removable"),$=Y(this,"disabled");if(this.#Z.setAttribute("text",Q),this.#Q.setAttribute("alt",Q),J)this.#Q.setAttribute("src",J);else this.#Q.removeAttribute("src");if(this.#q(),this.#J.textContent=this.#k(Q),this.#j.hidden=!Z,this.#j.toggleAttribute("disabled",$),this.#j.setAttribute("aria-label",`Remove ${Q}`),this.toggleAttribute("data-fallback",!J),$)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled")}#k(J){let Q=J.split(/[\\/]/).pop()||"",Z=Q.lastIndexOf(".");return(Z>0&&Z<Q.length-1?Q.slice(Z+1).toUpperCase():"FILE").slice(0,4)}#K(){if(this.getAttribute("src"))this.removeAttribute("data-fallback")}#P(){this.setAttribute("data-fallback","")}#L(J){if(J.stopPropagation(),Y(this,"disabled")||this.hasAttribute("removable")&&!Y(this,"removable"))return;this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.getAttribute("value"),name:this.getAttribute("name")||"",src:this.getAttribute("src")||"",attachment:this}}))}}U("fig-attachment",OJ);class YJ extends HTMLElement{#Z=null;connectedCallback(){if(!this.hasAttribute("role"))this.setAttribute("role","list"),this.setAttribute("data-generated-role","");if(this.#Q(),!this.#Z)this.#Z=new MutationObserver(()=>this.#Q()),this.#Z.observe(this,{childList:!0})}disconnectedCallback(){this.#Z?.disconnect(),this.#Z=null}#Q(){for(let J of this.querySelectorAll(":scope > fig-attachment"))if(!J.hasAttribute("role"))J.setAttribute("role","listitem"),J.setAttribute("data-generated-role","")}}U("fig-attachments",YJ);class GJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#U.bind(this);#X=!1;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#K(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#M()}#q(){this.#X=Y(this,"checked");let Q=Array.from(this.childNodes).filter((q)=>q.nodeType!==Node.TEXT_NODE||Boolean(q.textContent?.trim())).find((q)=>q.nodeType===Node.ELEMENT_NODE&&q.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-segmented-control"),_=document.createElement("fig-segment"),X=document.createElement("fig-segment");j.setAttribute("sizing","equal"),_.setAttribute("value","off"),_.textContent="Off",X.setAttribute("value","on"),X.textContent="On",j.append(_,X),Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#Y(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","checked","value","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#J.setAttribute("value",Y(this,"checked")?"on":"off"),this.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value==="on";this.toggleAttribute("checked",Z);let $={checked:Z,value:this.getAttribute("value")??""};this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-segmented-control, fig-menu"))return;let Q=this.#J?.value==="on"?"off":"on";this.#J?.querySelector(`fig-segment[value="${Q}"]`)?.click()}get checked(){return this.#J?this.#J.value==="on":Y(this,"checked")}set checked(J){let Q=Boolean(J);if(this.toggleAttribute("checked",Q),this.#J)this.#J.value=Q?"on":"off"}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){this.setAttribute("value",J??"")}get defaultValue(){return this.hasAttribute("default")?Y(this,"default"):this.#X}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,g(this,{checked:J,value:this.getAttribute("value")??""})}focus(J){(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}U("propskit-switch",GJ);function w(J){let Q=String(J??"").trim();if(/^#[0-9a-fA-F]{8}$/.test(Q))return{color:Q.slice(0,7),alpha:parseInt(Q.slice(7,9),16)/255};if(/^#[0-9a-fA-F]{6}$/.test(Q))return{color:Q,alpha:1};if(/^#[0-9a-fA-F]{3}$/.test(Q))return{color:`#${Q[1]}${Q[1]}${Q[2]}${Q[2]}${Q[3]}${Q[3]}`,alpha:1};return{color:Q||"#D9D9D9",alpha:1}}function VJ(J){let{color:Q,alpha:Z}=w(J);return JSON.stringify({type:"solid",color:Q,alpha:Z})}function t(J){return`url("${String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}")`}function fJ(J){let Q=String(J??"").trim();if(!Q||Q.startsWith("{")||Q.startsWith("#"))return!1;if(Q.startsWith("data:video/"))return!0;try{let Z=new URL(Q,"https://fig.local").pathname;return/\.(mp4|webm|mov|m4v|ogv)$/i.test(Z)}catch{return/\.(mp4|webm|mov|m4v|ogv)(?:[?#]|$)/i.test(Q)}}function CJ(J){return{type:"video",video:{url:J,scaleMode:"fill",scale:50}}}function x(J){if(J&&typeof J==="object")return J;let Q=String(J??"").trim();if(!Q)return{type:"solid",color:"#D9D9D9",alpha:1};if(Q.startsWith("{"))try{let Z=JSON.parse(Q);if(Z&&typeof Z==="object")return Z}catch{}if(Q.startsWith("#")){let{color:Z,alpha:$}=w(Q);return{type:"solid",color:Z,alpha:$}}if(fJ(Q))return CJ(Q);return{type:"solid",color:"#D9D9D9",alpha:1}}function s(J){if(J==null)return"";return typeof J==="string"?J:JSON.stringify(J)}function AJ(J){if(!J)return"";let Q=[...J.stops||[]].sort((Z,$)=>(Z.position??0)-($.position??0)).map((Z)=>`${Z.color} ${Z.position??0}%`).join(", ");if(!Q)return"";switch(J.type){case"radial":return`radial-gradient(circle, ${Q})`;case"angular":return`conic-gradient(from ${J.angle||0}deg, ${Q})`;default:return`linear-gradient(${J.angle??180}deg, ${Q})`}}function QJ(J,Q){switch(J?.type){case"solid":return J.color||"";case"gradient":return J.css||AJ(J.gradient)||"";case"image":return J.image?.url?t(J.image.url):"";case"video":return J.video?.poster?t(J.video.poster):"";case"webcam":return J.webcam?.snapshot?t(J.webcam.snapshot):"";default:return J?.swatchBackground||J?.background||J?.css||Q?.getAttribute("swatch-background")||""}}function EJ(J){if(!J||typeof J!=="object")return null;if(J.type==="image")return J.image;if(J.type==="video")return J.video;if(J.type==="webcam")return J.webcam;return null}function DJ(J){let Q=EJ(J),Z=Number(Q?.scale);switch(Q?.scaleMode){case"fit":return{size:"contain",position:"center"};case"tile":return{size:`${Number.isFinite(Z)?Z:50}%`,position:"top left"};case"fill":case"crop":return{size:"cover",position:"center"};default:return J?.type==="webcam"||J?.type==="image"||J?.type==="video"?{size:"cover",position:"center"}:null}}function IJ(J){switch(J?.type){case"solid":{if(Number.isFinite(J.alpha))return J.alpha;if(Number.isFinite(J.opacity))return J.opacity/100;return 1}case"gradient":return J.gradient?.opacity??J.opacity??1;case"image":return J.image?.opacity??1;case"video":return J.video?.opacity??1;case"webcam":return J.webcam?.opacity??1;default:return J?.opacity??J?.alpha??1}}class MJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#X=this.#H.bind(this);#q=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#Y(),this.#L(),this.#U(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),f(this),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#L()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#S(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#M(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=_,this.#j=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Color")}#k(){return w(this.getAttribute("value"))}#K(){let{color:J,alpha:Q}=this.#k();return JSON.stringify({type:"solid",color:J,alpha:Q})}#P(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","mode","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#L(){if(!this.#J)return;let J=this.#P(),Q=new Set(J);for(let _ of this.#O)if(!Q.has(_))this.#J.removeAttribute(_);for(let _ of J)this.#J.setAttribute(_,this.getAttribute(_)??"");this.#J.setAttribute("mode","solid");let Z=this.#K();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);let{color:$,alpha:j}=this.#k();if(this.#_)this.#_.setAttribute("background",$),this.#_.setAttribute("alpha",String(j));this.#O=Q}#U(){if(!this.#J)return;this.#B??=this.#W.bind(this,"input"),this.#G??=this.#W.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G)}#S(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G)}#T(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return w(Q).color;if(Q&&typeof Q==="object"){if(typeof Q.color==="string"&&Q.color)return Q.color;if(typeof Q.value==="string"&&Q.value)return w(Q.value).color;if(typeof Q.hex==="string"&&Q.hex)return Q.hex}let Z=this.#J?.value;if(Z&&typeof Z==="object"&&typeof Z.color==="string")return Z.color;if(typeof Z==="string"&&Z)return w(Z).color;return this.#k().color}#F(J,Q){let Z=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:void 0,$=Number.isFinite(Z?.alpha)?Math.max(0,Math.min(1,Number(Z.alpha))):this.#k().alpha;return{color:Q,alpha:$,opacity:Math.round($*100)}}#W(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#T(Q),$=this.#F(Q,Z),j=$.alpha<0.996078431372549?Math.round($.alpha*255).toString(16).padStart(2,"0"):"",_=`${$.color.slice(0,7)}${j}`;this.setAttribute("value",_);let X=this.#K();if(this.#J&&this.#J.getAttribute("value")!==X)this.#J.setAttribute("value",X);if(this.#_)this.#_.setAttribute("background",$.color),this.#_.setAttribute("alpha",String($.alpha));this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#H(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??this.#J?.value??this.#J?.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=String(J);this.setAttribute("value",Q),this.#z(Q)}#z(J){if(!this.#J)return;let Q=VJ(J);if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");if(this.#J.setAttribute("value",Q),this.#_){let Z=w(J);this.#_.setAttribute("background",Z.color),this.#_.setAttribute("alpha",String(Z.alpha))}}#V(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#V())}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#z(J),this.dispatchEvent(new CustomEvent("input",{detail:J,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:J,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}U("propskit-color",MJ);class kJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#X=this.#R.bind(this);#q=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#Y(),this.#F(),this.#W(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),f(this),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#F()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#H(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#M(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=_,this.#j=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Fill")}#k(){return x(this.getAttribute("value"))}#K(){return s(this.#k())}#P(){let J=this.#k()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#L(){let J=this.#J?.value;if(J&&typeof J==="object")return J;if(typeof J==="string"&&J)return x(J);return null}#U(J){let Q=this.#L();if(!J||typeof J!=="object")return J;if(J.type!=="webcam")return J;let Z=J.webcam?.snapshot||Q?.webcam?.snapshot;if(!Z||J.webcam?.snapshot)return J;return{...J,webcam:{...Q?.webcam&&typeof Q.webcam==="object"?Q.webcam:{},...J.webcam,snapshot:Z}}}#S(J=this.#k()){if(!this.#_)return;let Q=this.#U(J),Z=QJ(Q,this.#P());if(!Z)Z=QJ(this.#L(),this.#P());if(!Z){let j=this.#_.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#_.setAttribute("background",Z),this.#_.setAttribute("alpha",String(IJ(Q)));let $=DJ(Q||J);if($)this.#_.style.setProperty("--swatch-bg-size",$.size),this.#_.style.setProperty("--swatch-bg-position",$.position)}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#F(){if(!this.#J)return;let J=this.#T(),Q=new Set(J);for(let $ of this.#O)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=this.#K();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);this.#S(),this.#O=Q}#W(){if(!this.#J)return;this.#B??=this.#V.bind(this,"input"),this.#G??=this.#V.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G)}#H(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G)}#z(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(Q&&typeof Q==="object")return Q;if(typeof Q==="string"&&Q)return x(Q);let Z=this.#J?.value;if(Z&&typeof Z==="object")return Z;if(typeof Z==="string"&&Z)return x(Z);return this.#k()}#V(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#U(this.#z(Q)),$=s(Z);if(this.setAttribute("value",$),this.#J&&this.#J.getAttribute("value")!==$)this.#J.setAttribute("value",$);this.#S(Z),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#R(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??s(this.#J?.value)??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value"),this.#S({type:"solid",color:"",alpha:1});return}let Q=s(typeof J==="string"?x(J):J);this.setAttribute("value",Q),this.#D(Q)}#D(J){if(!this.#J)return;let Q=s(x(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#S(x(Q))}#h(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#h())}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#D(J);let Q=x(J);this.dispatchEvent(new CustomEvent("input",{detail:Q,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}U("propskit-fill",kJ);class NJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#S.bind(this);#X=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#K(),this.#X===null)this.#X=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify(this.#J?.value??{});if(this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#q(){let Q=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())).find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-input-gradient");j.anchorElement=this,Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Gradient")}#Y(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J){let $=this.getAttribute(Z)??"";if(Z==="value"&&this.#J.getAttribute("value")===$)continue;this.#J.setAttribute(Z,$)}if(!this.hasAttribute("edit"))this.#J.setAttribute("edit","picker");this.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#U.bind(this,"input"),this.#B??=this.#U.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J){let Q=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:this.#J?.value;if(!Q||typeof Q!=="object")return this.value;return JSON.stringify(Q)}#U(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#L(Q);this.setAttribute("value",Z);let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#S(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-input-gradient, fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.querySelector?.("fig-fill-picker")?.open?.()}get value(){return this.getAttribute("value")??JSON.stringify(this.#J?.value??{})}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=typeof J==="object"?JSON.stringify(J):String(J);if(this.setAttribute("value",Q),this.#J&&this.#J.getAttribute("value")!==Q)this.#J.setAttribute("value",Q)}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J;let Q=this.#J?.value;g(this,Q)}focus(J){this.#J?.focus(J)}}U("propskit-gradient",NJ);class u extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#X=null;#q=this.#I.bind(this);#M=this.#h.bind(this);#Y=!1;#k=null;static get observedAttributes(){return["label","direction","aria-label","options","value"]}static#K(){return["fig-select","fig-select-options","fig-select-option"].every((J)=>{let Q=customElements.get(J);return typeof Q==="function"&&Q.prototype instanceof HTMLElement})}static#P(J){let Q=J||"";if(Q.startsWith("["))try{let $=JSON.parse(Q);return Array.isArray($)?$:[]}catch{}let Z=Q.includes(`
2
- `)?`
3
- `:",";return Q.split(Z).map(($)=>$.trim()).filter(Boolean)}static#L(J){if(J&&typeof J==="object")return String(J.value??J.label??"");return String(J??"")}static#U(J){if(J&&typeof J==="object")return String(J.label??J.value??"");return String(J??"")}connectedCallback(){if(!this.#Z)this.#S();if(this.#T(),this.#H(),this.#z(),this.removeEventListener("click",this.#q),this.addEventListener("click",this.#q),this.removeEventListener("pointerdown",this.#M,!0),this.addEventListener("pointerdown",this.#M,!0),f(this),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="direction"||j==="aria-label")Q=!0;else Z=!0}if(Q)this.#T();if(Z)this.#H()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#V(),this.removeEventListener("click",this.#q),this.removeEventListener("pointerdown",this.#M,!0),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#T();return}if(J==="options"||J==="value")this.#H()}#S(){this.#k=this.getAttribute("value")??"";let J=this.querySelector(":scope > label"),Q=this.querySelector(":scope > fig-select-options"),Z=document.createElement("fig-field"),$=J||document.createElement("label");this.#_=u.#K();let j=document.createElement(this.#_?"fig-select":"fig-dropdown");if(j.setAttribute("full",""),this.#_&&Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#j=Boolean(J),this.replaceChildren(Z)}#T(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#F(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);if(!this.#_)J.add("options");return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#W(){if(!this.#J||this.#_)return;let J=u.#P(this.getAttribute("options"));for(let Z of[...this.#J.children])if(Z.localName==="option"||Z.localName==="optgroup")Z.remove();for(let Z of J){let $=document.createElement("option");$.value=u.#L(Z),$.textContent=u.#U(Z),this.#J.appendChild($)}let Q=this.getAttribute("value");if(Q!=null){let Z=()=>{if(this.#J?.setAttribute("value",Q),this.#J&&"value"in this.#J)this.#J.value=Q};Z(),queueMicrotask(Z)}}#H(){if(!this.#J)return;if(!this.#_)this.#W();let J=this.#F().sort((Z,$)=>{if(Z==="options")return-1;if($==="options")return 1;if(Z==="value")return 1;if($==="value")return-1;return 0}),Q=new Set(J);for(let Z of this.#O)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#O=Q}#z(){if(!this.#J)return;if(this.#B??=this.#R.bind(this,"input"),this.#G??=this.#R.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G),this.#_)this.#X??=this.#R.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#X)}#V(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G);if(this.#X)this.#J.removeEventListener("optionhover",this.#X)}#R(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#D(){if(!this.#J||!this.#_)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#h(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select, fig-dropdown")){this.#Y=!1;return}if(!this.#_)return;this.#Y=this.#D()}#I(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select, fig-dropdown")){this.#Y=!1;return}if(!this.#J||Y(this.#J,"disabled")){this.#Y=!1;return}if(this.#J.focus(),!this.#_)return;if(this.#Y||this.#D()){this.#Y=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0)this.removeAttribute("value");else this.setAttribute("value",String(J))}get defaultValue(){return this.getAttribute("default")??this.#k??""}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;g(this,J)}focus(J){this.#J?.focus(J)}}U("propskit-select",u);class PJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#U.bind(this);#X=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#K(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#q(){this.#X=this.getAttribute("value")??"";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-input-text");for(let _ of J)if(_!==Q)j.appendChild(_);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Text")}#Y(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","multiline","resizable","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-text, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,J)}focus(J){this.#J?.focus(J)}}U("propskit-text",PJ);class LJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#U.bind(this);#X=null;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#K(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#M()}#q(){this.#X=this.getAttribute("value")??this.getAttribute("min")??"0";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-input-number");Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#M(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#Y(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;if(this.#J?.value!==void 0)this.setAttribute("value",String(this.#J.value));this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#X??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,this.#J?.value??J)}focus(J){this.#J?.focus(J)}}U("propskit-number",LJ);class UJ extends HTMLElement{static observedAttributes=["x","y","default","label","units","disabled","size"];#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=!1;#O=this.#W.bind(this,"input");#B=this.#W.bind(this,"change");#G=this.#H.bind(this);connectedCallback(){if(!this.#j)this.#_=this.#q(),this.#Y(this.#_),this.#j=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#T(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(this)}disconnectedCallback(){this.#F(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if((J==="x"||J==="y")&&!this.#$)this.#L();else if(J==="label")this.#P();else if(J==="units")this.#U();else if(J==="disabled")this.#S()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(){let J=this.getAttribute("x"),Q=this.getAttribute("y");return{x:J===null||!J.trim()?50:this.#X(J,50),y:Q===null||!Q.trim()?50:this.#X(Q,50)}}#M(J){if(typeof J!=="string"||!J.trim())return null;try{let Q=JSON.parse(J);if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;return{x:this.#X(Q.x,this.#_?.x??50),y:this.#X(Q.y,this.#_?.y??50)}}catch{return null}}#Y(J){let Q=this.#q(),Z={x:this.#X(J?.x,Q.x),y:this.#X(J?.y,Q.y)};return this.#$=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#$=!1,Z}#k(J,Q){let Z=document.createElement("fig-input-number");if(Z.setAttribute("data-propskit-position-axis",J),Z.setAttribute("value",String(Q)),Z.setAttribute("min","0"),Z.setAttribute("max","100"),Z.setAttribute("step","1"),Z.setAttribute("precision","2"),this.units==="percent")Z.setAttribute("units","%");Z.setAttribute("aria-label",`${J.toUpperCase()} position`);let $=document.createElement("span");if($.setAttribute("slot","prepend"),$.textContent=J.toUpperCase(),Z.append($),Y(this,"disabled"))Z.setAttribute("disabled","");return Z}#K(){let J=this.#q(),Q=document.createElement("fig-field");Q.className="propskit-position-row",Q.setAttribute("direction","horizontal");let Z=document.createElement("label"),$=this.#k("x",J.x),j=this.#k("y",J.y);Q.append(Z,$,j),this.#Z=Q,this.#Q=$,this.#J=j,this.replaceChildren(Q),f(this)}#P(){let J=this.#Z?.querySelector(":scope > label");if(!J)return;let Q=this.getAttribute("label");J.textContent=Q?.trim()||"Position"}#L(){let J=this.#q();this.#Q?.setAttribute("value",String(J.x)),this.#J?.setAttribute("value",String(J.y)),this.#U(),this.#S()}#U(){let J=this.units==="percent"?"%":null;for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J)Q.setAttribute("units",J);else Q.removeAttribute("units")}}#S(){let J=Y(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#J?.toggleAttribute("disabled",J)}#T(){this.#F(),this.#Q?.addEventListener("input",this.#O),this.#Q?.addEventListener("change",this.#B),this.#J?.addEventListener("input",this.#O),this.#J?.addEventListener("change",this.#B)}#F(){this.#Q?.removeEventListener("input",this.#O),this.#Q?.removeEventListener("change",this.#B),this.#J?.removeEventListener("input",this.#O),this.#J?.removeEventListener("change",this.#B)}#W(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#X(Q.currentTarget.value,$[Z]);let j=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...j,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#H(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#q().x}set x(J){this.setAttribute("x",String(this.#X(J,50)))}get y(){return this.#q().y}set y(J){this.setAttribute("y",String(this.#X(J,50)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#q()}}set value(J){let Q=this.#Y(J);this.#L(Q)}get defaultValue(){return this.#M(this.getAttribute("default"))||{...this.#_||{x:50,y:50}}}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,{...J,units:this.units})}focus(J){this.#Q?.focus(J)}}U("propskit-position",UJ);class KJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","disabled","value"];#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=!1;#O=this.#S.bind(this,"input");#B=this.#S.bind(this,"change");#G=this.#T.bind(this);connectedCallback(){if(!this.#_)this.#Y(this.#M()),this.#_=!0;if(!this.#Z)this.#k();this.#K(),this.#P(),this.#L(),this.#U(this.#M()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#Y(this.#M());this.#U($)}return}if(J==="size"){this.#P();return}if(J==="disabled"){this.#L();return}this.#K()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),color:typeof Q.color==="string"&&Q.color.trim()?Q.color.trim():"#D9D9D9"}}#M(){return this.#q(this.getAttribute("value"))}#Y(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#k(){let J=this.#M(),Q=document.createElement("fig-group"),Z=document.createElement("propskit-color"),$=document.createElement("propskit-position");Q.setAttribute("compact",""),Z.setAttribute("label","Color"),Z.setAttribute("value",J.color),Z.setAttribute("data-propskit-color-point-control","color"),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),$.setAttribute("units","percent"),$.setAttribute("data-propskit-color-point-control","position"),this.#Z=Q,this.#Q=Z,this.#J=$,this.#K(),this.#P(),this.#L(),Q.append(Z,$),this.replaceChildren(Q)}#K(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#P(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#L(){l(this,[this.#Q,this.#J])}#U(J){let Q=this.#q(J);if(this.#Q)this.#Q.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#S(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-color-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-color-point-control");if(j==="color")$.color=Z.value||Z.getAttribute("value");else if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else return;let _=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,units:"percent"},bubbles:!0,cancelable:!0,composed:!0}))}#T(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get value(){return{...this.#M()}}set value(J){let Q=this.#Y(J);this.#U(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-color-point",KJ);class SJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=!1;#O=this.#H.bind(this,"input");#B=this.#H.bind(this,"change");#G=this.#z.bind(this);connectedCallback(){if(!this.#_)this.#k(this.#Y()),this.#_=!0;if(!this.#Z)this.#P();this.#L(),this.#U(),this.#S(),this.#T(),this.#F(this.#Y()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#k(this.#Y());this.#F($)}return}if(J==="size"){this.#U();return}if(J==="units"){this.#S();return}if(J==="disabled"){this.#T();return}this.#L()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#X(J,0)}#M(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),radius:this.#q(Q.radius)}}#Y(){return this.#M(this.getAttribute("value"))}#k(J){let Q=this.#M(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#K(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#P(){let J=this.#Y(),Q=this.#K(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-control","radius"),this.#Z=Z,this.#Q=$,this.#J=j,this.#L(),this.#U(),this.#T(),Z.append($,j),this.replaceChildren(Z)}#L(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#U(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#S(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#T(){l(this,[this.#Q,this.#J])}#F(J){let Q=this.#M(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#K(Q.radius);this.#J.value=Z.value}}#W(J,Q){let Z=this.#K(Q).value,$=this.#X(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#H(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-control");if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#W(Z,$.radius);else return;let _=this.#k($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#K(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#z(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#Y()}}set value(J){let Q=this.#k(J);this.#F(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-radius",SJ);class TJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=!1;#O=!1;#B=this.#z.bind(this,"input");#G=this.#z.bind(this,"change");#X=this.#V.bind(this);connectedCallback(){if(!this.#j)this.#K(this.#k()),this.#j=!0;if(!this.#Z)this.#L();this.#U(),this.#S(),this.#T(),this.#F(),this.#W(this.#k()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#G),this.addEventListener("change",this.#G),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#G),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#K(this.#k());this.#W($)}return}if(J==="size"){this.#S();return}if(J==="units"){this.#T();return}if(J==="disabled"){this.#F();return}this.#U()}#q(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#M(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#q(J,0)}#Y(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#q(Q.x,50),y:this.#q(Q.y,50),radius:this.#M(Q.radius),angle:this.#q(Q.angle,0)}}#k(){return this.#Y(this.getAttribute("value"))}#K(J){let Q=this.#Y(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#P(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#L(){let J=this.#k(),Q=this.#P(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number"),_=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-angle-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-angle-control","radius"),_.setAttribute("label","Angle"),_.setAttribute("value",String(J.angle)),_.setAttribute("units","°"),_.setAttribute("units-disallow",""),_.setAttribute("precision","1"),_.setAttribute("data-propskit-point-radius-angle-control","angle"),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=_,this.#U(),this.#S(),this.#F(),Z.append($,j,_),this.replaceChildren(Z)}#U(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#S(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J,this.#_]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#T(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#F(){l(this,[this.#Q,this.#J,this.#_])}#W(J){let Q=this.#Y(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#P(Q.radius);this.#J.value=Z.value}if(this.#_)this.#_.value=Q.angle}#H(J,Q){let Z=this.#P(Q).value,$=this.#q(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#z(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-angle-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-angle-control");if(j==="position")$.x=this.#q(Z.value?.x,$.x),$.y=this.#q(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#H(Z,$.radius);else if(j==="angle")$.angle=this.#q(Z.value,$.angle);else return;let _=this.#K($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#P(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#V(J){if(J.target!==this.#Z||this.#O)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#O=!0,this.setAttribute("open",String(Q)),this.#O=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#k()}}set value(J){let Q=this.#K(J);this.#W(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-radius-angle",TJ);class FJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=!1;#O=this.#F.bind(this,"input");#B=this.#F.bind(this,"change");#G=this.#W.bind(this);connectedCallback(){if(!this.#_)this.#Y(this.#M()),this.#_=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#U(),this.#S(),this.#T(this.#M()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#Y(this.#M());this.#T($)}return}if(J==="size"){this.#L();return}if(J==="units"){this.#U();return}if(J==="disabled"){this.#S();return}this.#P()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),x2:this.#X(Q.x2,75),y2:this.#X(Q.y2,75)}}#M(){return this.#q(this.getAttribute("value"))}#Y(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#k(J,Q,Z,$){let j=document.createElement("propskit-position");if(j.setAttribute("label",J),j.setAttribute("x",String(Z)),j.setAttribute("y",String($)),this.hasAttribute("units"))j.setAttribute("units",this.units);return j.setAttribute("data-propskit-point-point-control",Q),j}#K(){let J=this.#M(),Q=document.createElement("fig-group"),Z=this.#k("Start","start",J.x,J.y),$=this.#k("End","end",J.x2,J.y2);Q.setAttribute("compact",""),this.#Z=Q,this.#Q=Z,this.#J=$,this.#P(),this.#L(),this.#S(),Q.append(Z,$),this.replaceChildren(Q)}#P(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#L(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#U(){for(let J of[this.#Q,this.#J]){if(!J)continue;if(this.hasAttribute("units"))J.setAttribute("units",this.units);else J.removeAttribute("units")}}#S(){l(this,[this.#Q,this.#J])}#T(J){let Q=this.#q(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J)this.#J.value={x:Q.x2,y:Q.y2}}#F(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let $=this.value,j=Z.value,_=Z.getAttribute("data-propskit-point-point-control");if(_==="start")$.x=this.#X(j?.x,$.x),$.y=this.#X(j?.y,$.y);else if(_==="end")$.x2=this.#X(j?.x,$.x2),$.y2=this.#X(j?.y,$.y2);else return;let X=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...X,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#W(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#M()}}set value(J){let Q=this.#Y(J);this.#T(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-point",FJ);class r extends HTMLElement{static observedAttributes=["name","open","show-reset","disabled","size"];static#Z=["propskit-color","propskit-fill","propskit-gradient","propskit-number","propskit-position","propskit-color-point","propskit-point-radius","propskit-point-radius-angle","propskit-point-point","propskit-select","propskit-slider","propskit-switch","propskit-text","propskit-wheel","propskit-oscillator"].join(",");#Q=null;#J=null;#_=null;#j=null;#$=0;#O=()=>this.#X();connectedCallback(){this.#V(),this.#P(),this.#L(),this.#B(),requestAnimationFrame(()=>{this.#T()})}disconnectedCallback(){if(this.#G(),this.#$)cancelAnimationFrame(this.#$),this.#$=0;this.#Q?.removeEventListener("click",this.#M),this.#Q?.removeEventListener("keydown",this.#Y),this.#_?.querySelector("fig-button")?.removeEventListener("click",this.#k)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#Q?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#H(),this.#T();return}if(J==="disabled"){this.#P();return}if(J==="size"){this.#L();return}this.#V()}get open(){let J=this.getAttribute("open");return J!==null&&J!=="false"}set open(J){let Q=this.open;if(J)this.setAttribute("open","true");else this.setAttribute("open","false");if(this.#Q?.setAttribute("aria-expanded",String(!!J)),Q!==!!J)this.dispatchEvent(new CustomEvent("openchange",{detail:{open:!!J},bubbles:!0}))}get showReset(){let J=this.getAttribute("show-reset");if(J===null)return!0;return J!=="false"}set showReset(J){if(J)this.setAttribute("show-reset","true");else this.setAttribute("show-reset","false")}get dirty(){return this.hasAttribute("data-dirty")&&this.getAttribute("data-dirty")!=="false"}resetProperties(){this.#W()}#B(){if(this.removeEventListener("input",this.#O,!0),this.removeEventListener("change",this.#O,!0),this.addEventListener("input",this.#O,!0),this.addEventListener("change",this.#O,!0),!this.#j)this.#j=new MutationObserver(()=>{this.#P(),this.#L(),this.#X()});this.#j.disconnect(),this.#j.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#G(){this.removeEventListener("input",this.#O,!0),this.removeEventListener("change",this.#O,!0),this.#j?.disconnect()}#X(){if(this.#$)return;this.#$=requestAnimationFrame(()=>{this.#$=0,this.#T()})}#q(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#M=(J)=>{if(Y(this,"disabled"))return;if(this.#q(J.target))return;J.stopPropagation(),this.open=!this.open};#Y=(J)=>{if(Y(this,"disabled"))return;if(this.#q(J.target))return;if(J.key!=="Enter"&&J.key!==" ")return;J.preventDefault(),J.stopPropagation(),this.open=!this.open};#k=(J)=>{if(J.preventDefault(),J.stopPropagation(),Y(this,"disabled"))return;this.#W()};#K(){return[...this.querySelectorAll(r.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(r.#Z))}#P(){let J=Y(this,"disabled");for(let Q of this.#K())if(J){if(!Y(Q,"disabled"))Q.setAttribute("disabled",""),Q.setAttribute("data-propskit-group-disabled","")}else if(Q.hasAttribute("data-propskit-group-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-propskit-group-disabled");this.#Q?.setAttribute("aria-disabled",String(J)),this.#Q?.setAttribute("tabindex",J?"-1":"0"),this.#_?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#L(){let J=this.getAttribute("size")==="small";for(let Q of this.#K()){let Z=Q.hasAttribute("data-propskit-group-size");if(J&&!Q.hasAttribute("size"))Q.setAttribute("data-propskit-group-size",""),Q.setAttribute("size","small");else if(J&&Z&&Q.getAttribute("size")!=="small")Q.setAttribute("size","small");else if(!J&&Z)Q.removeAttribute("size"),Q.removeAttribute("data-propskit-group-size")}}#U(J){return J.isDefault===!1}#S(){for(let J of this.#K())if(this.#U(J))return!0;return!1}#T(){if(this.#S())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#H()}#F(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#W(){for(let J of this.#K())this.#F(J);this.#T(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#H(){if(!this.showReset){this.#_?.setAttribute("hidden","");return}this.#z(),this.#_?.removeAttribute("hidden")}#z(){if(!this.#Q||!this.showReset)return;let J=this.#Q.querySelector(":scope > .propskit-group-reset-tooltip");if(!J){J=document.createElement("fig-tooltip"),J.className="propskit-group-reset-tooltip",J.setAttribute("text","Reset properties");let Q=document.createElement("fig-button");Q.className="propskit-group-reset",Q.setAttribute("variant","ghost"),Q.setAttribute("icon",""),Q.setAttribute("aria-label","Reset properties");let Z=document.createElement("fig-icon");Z.setAttribute("name","reset"),Q.appendChild(Z),J.appendChild(Q),this.#Q.appendChild(J),Q.addEventListener("click",this.#k)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#k),Q?.addEventListener("click",this.#k)}this.#_=J}#V(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#Q=Z;else if(!this.#Q||!this.#Q.dataset.generated||this.#Q.parentElement!==this)this.#Q=document.createElement("fig-header"),this.#Q.setAttribute("borderless",""),this.#Q.dataset.generated="true",this.prepend(this.#Q);let $=this.#Q.querySelector(":scope > h3"),j=this.#Q.querySelector(":scope > fig-button.propskit-group-disclosure");if(!$&&j){if($=j.querySelector(":scope > h3"),$)this.#Q.insertBefore($,j);j.remove()}if(!$)$=document.createElement("h3"),this.#Q.prepend($);let _=$.querySelector(":scope > button.propskit-group-disclosure");if(_){while(_.firstChild)$.insertBefore(_.firstChild,_);_.remove()}if(!$.id)$.id=_J("propskit-group");if(this.#Q.dataset.generated)$.textContent=Q;if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",$.id);let X=this.#Q.querySelector(":scope > .propskit-group-chevron")||$.querySelector(":scope > .propskit-group-chevron");if(!X)X=document.createElement("fig-icon"),X.setAttribute("name","chevron"),X.setAttribute("size","small"),X.className="propskit-group-chevron";if(this.#Q.insertBefore(X,$),this.#J=X,this.#H(),this.#Q.setAttribute("role","button"),this.#P(),this.#Q.setAttribute("aria-expanded",String(this.open)),this.#Q.removeEventListener("click",this.#M),this.#Q.addEventListener("click",this.#M),this.#Q.removeEventListener("keydown",this.#Y),this.#Q.addEventListener("keydown",this.#Y),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#Q.setAttribute("aria-expanded","false")}}U("propskit-group",r);class p extends HTMLElement{static#Z=4;static#Q="propskit-slider-dragging";static#J=null;#_=null;#j=null;#$=null;#O=!1;#B=null;#G=new Set;#X=0;#q=0;#M=0;#Y=null;#k=!0;#K=0;#P=1;#L=0;#U=null;#S=null;#T=0;#F=null;#W=null;#H=!1;#z=0;#V=null;#R=0;#D=null;#h=0;#I=null;#f=0;#c=0;#y=!1;#b=!1;#x=0;#E=null;#C=null;#e=this.#CJ.bind(this);#o=this.#RJ.bind(this);#A=this.#m.bind(this);#N=this.#HJ.bind(this);#jJ=this.#TJ.bind(this);#w=this.#MJ.bind(this);#u=this.#KJ.bind(this);#l=this.#fJ.bind(this);#i=this.#DJ.bind(this);#d=this.#WJ.bind(this);#p=new Set(["variant","color","text","full","elastic","size","name","class","data-wave-index","data-active","data-elastic-dragging","default","style"]);static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#_)this.#kJ();if(this.#t(),this.#JJ(),this.#gJ(),this.#QJ(),this.#BJ(),this.#GJ(),this.removeEventListener("pointerdown",this.#e,{capture:!0}),this.addEventListener("pointerdown",this.#e,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#N,{capture:!0}),this.addEventListener("pointerdown",this.#N,{capture:!0}),this.removeEventListener("contextmenu",this.#l),this.addEventListener("contextmenu",this.#l),this.removeEventListener("click",this.#d,!0),this.addEventListener("click",this.#d,!0),this.#S?.removeEventListener("change",this.#i),this.#S?.addEventListener("change",this.#i),!this.#B)this.#B=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#PJ();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#p.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#t();if(Z)this.#JJ(),this.#QJ()});this.#B.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#B?.disconnect(),this.#X)cancelAnimationFrame(this.#X),this.#X=0;if(this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#M)cancelAnimationFrame(this.#M),this.#M=0;this.#Y?.disconnect(),this.#AJ(),this.#FJ(),clearTimeout(this.#x),this.#x=0,this.#YJ(),this.#zJ(),this.#r(),this.#cJ(),this.removeEventListener("pointerdown",this.#e,{capture:!0}),this.removeEventListener("pointerdown",this.#N,{capture:!0}),this.removeEventListener("contextmenu",this.#l),this.removeEventListener("click",this.#d,!0),this.#S?.removeEventListener("change",this.#i)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="label"||J==="direction")this.#t()}#kJ(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#W=this.getAttribute("value")??this.getAttribute("default")??(J==="delta"?"0":this.getAttribute("min")??"0");let Q=Array.from(this.childNodes).filter((X)=>{return X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())}),Z=Q.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),$=document.createElement("fig-field"),j=Z||document.createElement("label"),_=document.createElement("fig-slider");_.setAttribute("text","true");for(let X of this.#OJ()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#_=$,this.#j=j,this.#$=_,this.#O=Boolean(Z),this.replaceChildren($),this.#a();for(let X of Q){if(X===Z)continue;this.#$.appendChild(X)}}#a(){let J=document.createElement("fig-menu");J.setAttribute("position","bottom left"),J.setAttribute("offset","0 0");let Q=document.createElement("fig-menu-item");Q.setAttribute("value","reset-default"),Q.textContent="Reset",J.appendChild(Q),J.addEventListener("change",this.#i),this.#S=J,this.appendChild(J)}#t(){if(!this.#_||!this.#j)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()===""){if(this.#j.parentElement===this.#_)this.#j.remove()}else{if(!this.#O)this.#j.textContent=J?Q??"":"Label";if(this.#j.parentElement!==this.#_)this.#_.prepend(this.#j)}this.#_.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#GJ()}#JJ(){if(!this.#$)return;let J=this.#OJ(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#G)if(!Q.has($))this.#$.removeAttribute($);for(let $ of J){if($==="text"||$==="value")continue;let j=this.getAttribute($)??"";if(this.#$.getAttribute($)!==j)this.#$.setAttribute($,j)}this.#$.removeAttribute("variant"),this.#$.removeAttribute("color"),this.#$.removeAttribute("transform"),this.#$.removeAttribute("full"),this.#$.setAttribute("text","true");let Z=(this.getAttribute("type")||"range").toLowerCase();if(Z==="delta"){let $=Number(this.#$.min),j=Number(this.#$.max),_=Number.isFinite($)&&Number.isFinite(j)?$+(j-$)/2:0;this.#$.setAttribute("default",String(_))}else this.#$.removeAttribute("default");if(Z==="stepper")this.#$.setAttribute("step",this.getAttribute("step")??"10");else if(!this.hasAttribute("step"))this.#$.removeAttribute("step");if(Z==="opacity")this.#$.style.setProperty("--color",this.getAttribute("color")||"var(--figma-color-bg-secondary)");else this.#$.style.removeProperty("--color");this.#v(Z),this.#G=Q,this.#PJ(),this.#SJ(),this.#k=!0,this.#BJ(),this.#GJ()}#v(J){let Q=this.#$?.querySelector("fig-input-number");if(!(J==="hue"||J==="opacity"&&this.hasAttribute("color"))){Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color");return}let $=Number(this.#$?.min),j=Number(this.#$?.max),_=Number(this.#$?.value),X=Number.isFinite($)&&Number.isFinite(j)&&j>$&&Number.isFinite(_)?Math.max(0,Math.min(1,(_-$)/(j-$))):0,q=this.getAttribute("color"),B=J==="hue"?`hsl(${X*360}deg 100% 50%)`:`color-mix(in srgb, ${q} ${X*100}%, var(--figma-color-bg-secondary))`,O=getComputedStyle(this).colorScheme.trim().toLowerCase()==="dark",G=RJ(this.#$,B,J==="hue"?0.35:O?0.2:0.35);if(G){Q?.setAttribute("theme",G);let M=G==="light"&&O||G==="dark"&&!O;this.style.setProperty("--propskit-slider-filled-text-color",M?"var(--figma-color-text)":"var(--figma-color-text-oninverse)")}else Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color")}#NJ(){if(!this.#$)return;let J=Number(this.#$.min),Q=Number(this.#$.max),Z=Number(this.#$.value),$=Number.isFinite(J)&&Number.isFinite(Q)&&Q>J&&Number.isFinite(Z)?Math.max(0,Math.min(1,(Z-J)/(Q-J))):0;this.style.setProperty("--propskit-slider-complete",String($)),this.#v((this.getAttribute("type")||"range").toLowerCase()),this.#GJ()}#BJ(){if(!globalThis.ResizeObserver)return;if(!this.#Y)this.#Y=new ResizeObserver(()=>{this.#k=!0,this.#GJ()});this.#Y.disconnect();for(let J of[this,this.#j,this.#$?.querySelector("fig-input-number"),this.#$?.querySelector("fig-input-number input"),this.#$?.querySelector('input[type="range"]')])if(J)this.#Y.observe(J)}#GJ(){if(this.#M)cancelAnimationFrame(this.#M);this.#M=requestAnimationFrame(()=>{this.#M=0,this.#qJ()})}#qJ(){let J=this.#$?.querySelector('input[type="range"]');if(!J||!this.#$)return;let Q=J.getBoundingClientRect();if(!Q.width)return;let Z=Number(J.min||0),$=Number(J.max||100),j=Number(J.value),_=Number.isFinite(Z)&&Number.isFinite($)&&$>Z&&Number.isFinite(j)?Math.max(0,Math.min(1,(j-Z)/($-Z))):0,X=Q.left+_*Q.width;if(this.#k)this.#K=this.#XJ("--slider-thumb-width",this.#$)/2,this.#P=Math.max(1,this.#XJ("--propskit-slider-handle-fade-start-threshold")),this.#L=Math.min(this.#P,this.#XJ("--propskit-slider-handle-fade-end-threshold")),this.#k=!1;let q=this.#K,B=[],O=this.#j?.parentElement===this.#_?this.#LJ(this.#j):null,G=this.#$.querySelector("fig-input-number input"),M=G?this.#n(G):null;if(O?.width&&O.bottom>Q.top&&O.top<Q.bottom)B.push(X-q-O.right);if(M?.width&&M.bottom>Q.top&&M.top<Q.bottom)B.push(M.left-X-q);let k=this.#P,P=this.#L,N=B.length?Math.min(...B):k,S=Math.max(0.001,k-P),F=Math.max(0,Math.min(1,(N-P)/S));this.style.setProperty("--propskit-slider-handle-proximity",String(F))}#LJ(J){let Q=document.createRange();Q.selectNodeContents(J);let Z=[...Q.getClientRects()].filter((q)=>q.width>0&&q.height>0);if(Q.detach?.(),!Z.length)return null;let $=Math.min(...Z.map((q)=>q.left)),j=Math.max(...Z.map((q)=>q.right)),_=Math.min(...Z.map((q)=>q.top)),X=Math.max(...Z.map((q)=>q.bottom));return{left:$,right:j,top:_,bottom:X,width:j-$,height:X-_}}#n(J){let Q=J.value||J.placeholder||"";if(!Q)return null;let Z=J.getBoundingClientRect(),$=getComputedStyle(J),j=this.#_J(Q,$),_=Z.left+(Number.parseFloat($.borderLeftWidth)||0)+(Number.parseFloat($.paddingLeft)||0),X=Z.right-(Number.parseFloat($.borderRightWidth)||0)-(Number.parseFloat($.paddingRight)||0),q=Math.max(0,X-_),B=Math.min(q,j),O=$.textAlign,G=_;if(O==="right"||O==="end")G=X-B;else if(O==="center")G=_+(q-B)/2;return{left:G,right:G+B,top:Z.top,bottom:Z.bottom,width:B,height:Z.height}}#_J(J,Q){if(!p.#J)p.#J=document.createElement("canvas");let Z=p.#J.getContext("2d");if(!Z)return 0;if(Z.font=Q.font||`${Q.fontStyle} ${Q.fontWeight} ${Q.fontSize} ${Q.fontFamily}`,"fontKerning"in Z)Z.fontKerning=Q.fontKerning;if("fontStretch"in Z)Z.fontStretch=Q.fontStretch;if("fontVariantCaps"in Z)Z.fontVariantCaps=Q.fontVariantCaps;if("letterSpacing"in Z)Z.letterSpacing=Q.letterSpacing;return Z.measureText(J).width}#XJ(J,Q=this){let Z=document.createElement("div");Z.style.setProperty(J,getComputedStyle(Q).getPropertyValue(J)),Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild(Z);let $=Number.parseFloat(getComputedStyle(Z).width);return Z.remove(),Number.isFinite($)?Math.max(0,$):0}#PJ(){if(!this.#$)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#W??"";if(String(this.#$.value)!==J)this.#$.value=J;this.#NJ()}#OJ(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#p.has(Q))}#SJ(){if(this.#X)cancelAnimationFrame(this.#X);this.#X=requestAnimationFrame(()=>{this.#X=0,this.#pJ(),this.#ZJ()})}#QJ(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#ZJ()})}#ZJ(){let J=this.#$?.querySelector('input[type="range"]'),Q=this.#$?.querySelector("fig-input-number input");if(J!==this.#U)this.#UJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")||this.#j?.textContent?.trim()||"Slider";if(!J.hasAttribute("aria-label")&&!J.hasAttribute("aria-labelledby"))J.setAttribute("aria-label",Z)}if(Q)Q.removeAttribute("tabindex"),Q.removeAttribute("aria-hidden")}#WJ(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#b&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#b=!1;return}this.#s()}#s(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!Y(this,"disabled"))this.focus()})})}#UJ(J){if(this.#r(),this.#U=J,!this.#U)return;this.#U.addEventListener("dblclick",this.#u,{capture:!0})}#r(){if(!this.#U)return;this.#U.removeEventListener("dblclick",this.#u,{capture:!0}),this.#U=null}#KJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#xJ()}#HJ(J){if(J.button!==0||J.altKey||Y(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#FJ(),this.#I=J.pointerId,this.#f=J.clientX,this.#c=J.clientY,this.#y=!1,window.addEventListener("pointermove",this.#jJ),window.addEventListener("pointerup",this.#w,{once:!0}),window.addEventListener("pointercancel",this.#w,{once:!0}),window.addEventListener("blur",this.#w,{once:!0})}#TJ(J){if(J.pointerId!==this.#I)return;if(J.buttons===0){this.#MJ(J);return}if(!this.#y){if(Math.hypot(J.clientX-this.#f,J.clientY-this.#c)<4)return;this.#y=!0,this.setAttribute("data-number-scrubbing",""),this.#$J(!0)}this.#EJ(this.#wJ(J),"input")}#MJ(J){if(J?.pointerId!==void 0&&this.#I!==null&&J.pointerId!==this.#I)return;let Q=this.#y;if(this.#FJ(),Q){this.#EJ(this.#$?.value,"change"),this.#b=!0,clearTimeout(this.#x),this.#x=window.setTimeout(()=>{this.#b=!1,this.#x=0},0),this.#s();return}this.#$?.querySelector("fig-input-number input")?.focus()}#FJ(){window.removeEventListener("pointermove",this.#jJ),window.removeEventListener("pointerup",this.#w),window.removeEventListener("pointercancel",this.#w),window.removeEventListener("blur",this.#w),this.#I=null,this.#y=!1,this.removeAttribute("data-number-scrubbing"),this.#$J(!1)}#CJ(J){if(J.button!==0||Y(this,"disabled"))return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#$?.querySelector('input[type="range"]')??this.#U;if(!Q)return;this.#YJ(),this.#zJ(),this.#U=Q,this.#H=!0,this.#D=J.pointerId,this.#h=J.clientX,this.#z=this.getAttribute("elastic")==="false"?0:this.#IJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#V={left:Z.left,right:Z.right,width:Z.width},this.#R=$.width,window.addEventListener("pointermove",this.#o,{passive:!0}),window.addEventListener("pointerup",this.#A,{once:!0}),window.addEventListener("pointercancel",this.#A,{once:!0}),window.addEventListener("blur",this.#A,{once:!0})}#RJ(J){if(!this.#H)return;if(J.pointerId!==this.#D)return;if(J.buttons===0){this.#m(J);return}if(Math.abs(J.clientX-this.#h)>=p.#Z)this.#$J(!0);if(this.#z)this.#bJ(J.clientX)}#m(J){if(J?.pointerId!==void 0&&this.#D!==null&&J.pointerId!==this.#D)return;let Q=J?.type==="pointerup"||J?.type==="pointermove"&&J.buttons===0;if(this.#YJ(),this.#zJ(),Q)this.#s()}#YJ(){window.removeEventListener("pointermove",this.#o),window.removeEventListener("pointerup",this.#A),window.removeEventListener("pointercancel",this.#A),window.removeEventListener("blur",this.#A),this.#H=!1,this.#D=null,this.#h=0,this.#$J(!1)}#$J(J){this.toggleAttribute("data-propskit-slider-dragging",J),document.body.classList.toggle(p.#Q,J)}#fJ(J){if(Y(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#AJ(),this.#g(J.clientX,J.clientY)}#g(J,Q){let Z=!1,$=0,j=()=>{if(Z)return;Z=!0,window.clearTimeout($),window.removeEventListener("pointerup",j,!0),window.removeEventListener("pointercancel",j,!0),requestAnimationFrame(()=>{this.#S?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#DJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#xJ()}#AJ(){if(this.#T)clearTimeout(this.#T),this.#T=0;this.#F=null}#IJ(){let J=getComputedStyle(this).getPropertyValue("--propskit-slider-elastic-distance").trim();if(J.includes("var(")||!J.endsWith("px")){let Z=document.createElement("div");Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:"var(--propskit-slider-elastic-distance)"}),this.appendChild(Z),J=getComputedStyle(Z).width,Z.remove()}let Q=Number.parseFloat(J);return Number.isFinite(Q)?Math.max(0,Q):0}#bJ(J){let Q=this.#V;if(!Q||!this.#z){this.#zJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#VJ();return}let $=Math.max(-this.#z,Math.min(this.#z,Z*0.5)),j=Math.abs($),_=this.#R?(this.#R+j)/this.#R:1;this.dataset.elasticDragging="true",this.style.setProperty("--propskit-slider-elastic-size",`${j}px`),this.style.setProperty("--propskit-slider-elastic-scale",`${_}`),this.style.setProperty("--propskit-slider-elastic-origin",$<0?"right center":"left center")}#zJ(){this.#VJ(),this.#z=0,this.#V=null,this.#R=0,this.#D=null}#VJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#wJ(J){let Q=this.#U;if(!Q)return this.#$?.value??"";let Z=Q.getBoundingClientRect(),$=Z.width?Math.min(1,Math.max(0,(J.clientX-Z.left)/Z.width)):0,j=Number(Q.min||0),_=Number(Q.max||100),X=Q.step==="any"?0:Number(Q.step||1),q=j+(_-j)*$;if(!X)return String(q);let B=Math.round((q-j)/X)*X+j,O=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(O)))}#yJ(){return this.getAttribute("default")??this.#W??this.#U?.min??"0"}#xJ(){this.#AJ(),this.#EJ(this.#yJ(),"input"),this.#EJ(this.#yJ(),"change")}#EJ(J,Q){if(!this.#$||J===null||J===void 0)return;this.#$.value=J,this.setAttribute("value",String(this.#$.value)),this.dispatchEvent(new CustomEvent(Q,{detail:this.#$.value,bubbles:!0,cancelable:!0,composed:!0}))}#pJ(){if(!this.#$)return;let J=this.#$.querySelector("fig-input-number");if(!J)return;if(!(this.hasAttribute("steppers")&&this.getAttribute("steppers")!=="false")){J.removeAttribute("steppers");return}let Z=this.getAttribute("steppers");J.setAttribute("steppers",Z??"")}#gJ(){if(!this.#$)return;if(!this.#E)this.#E=this.#hJ.bind(this,"input");if(!this.#C)this.#C=this.#hJ.bind(this,"change");this.#$.addEventListener("input",this.#E),this.#$.addEventListener("change",this.#C)}#cJ(){if(!this.#$)return;if(this.#E)this.#$.removeEventListener("input",this.#E);if(this.#C)this.#$.removeEventListener("change",this.#C)}#hJ(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;if(J==="change")this.#zJ();let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#$?.value;if(this.#$?.value!==void 0){let $=String(this.#$.value);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}this.#NJ(),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#ZJ();let Q=this.#$?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return this.getAttribute("value")??this.#$?.value??""}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#$)this.#$.value="";return}let Q=String(J);if(this.setAttribute("value",Q),this.#$)this.#$.value=Q}get defaultValue(){return this.#yJ()}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){this.#xJ()}}U("propskit-slider",p);class z extends HTMLElement{static#Z=33;static#Q=60;static#J=0.55;static#_=1.5;static#j=80;static#$=4;static#O="fig-input-wheel-dragging";#B=null;#G=null;#X=null;#q=null;#M=null;#Y=null;#k=null;#K=0;#P=0;#L=0;#U=0;#S=0;#T=null;#F=!1;#W=null;#H=0;#z=0;#V=!1;#R=null;#D=0;#h=null;#I=0;#f=0;#c=this.#qJ.bind(this);#y=this.#LJ.bind(this);#b=this.#_J.bind(this);#x=this.#KJ.bind(this);#E=this.#HJ.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#B)this.#C();if(this.#t(),this.#kJ(),this.#BJ(),this.#T?.disconnect(),globalThis.ResizeObserver)this.#T=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#JJ(Q.width,Q.height)}),this.#T.observe(this);this.#v()}disconnectedCallback(){if(this.#T?.disconnect(),this.#L)cancelAnimationFrame(this.#L);this.#L=0,this.#MJ(),this.#GJ(),this.#XJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#B)return;if(J==="disabled")this.#t();if(J==="value"&&!this.#F)this.#kJ();if(J==="step")this.#a(),this.#v();if(J==="spin")this.#v();if(J==="min"||J==="max")this.#p(this.#N())}#C(){if(this.#B=this,this.#G=this,this.#X=this,this.setAttribute("role","spinbutton"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-label","Value");this.setAttribute("tabindex","0");let J=E("svg",{className:"fig-input-wheel-svg","aria-hidden":"true"}),Q=L("div",{className:"fig-input-wheel-handle"});this.#q=J,this.replaceChildren(J,Q);let Z=document.createElement("div");Z.setAttribute("aria-hidden","true"),Z.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0";let $=document.createElement("div");$.style.height="var(--fig-input-wheel-tick-height)";let j=document.createElement("div");j.style.height="var(--fig-input-wheel-tick-height-min)";let _=document.createElement("div");_.style.width="var(--fig-input-wheel-tick-width)";let X=document.createElement("div");X.style.width="var(--fig-input-wheel-tick-width-min)",Z.append($,j,_,X),this.append(Z),this.#k={maxEl:$,minEl:j,maxWidthEl:_,minWidthEl:X},this.#e()}#e(){if(!this.#q||this.#M)return;this.#M=E("path",{className:"fig-input-wheel-tick"}),this.#q.append(this.#M)}#o(){if(this.#Y)return this.#Y;return this.#Y={maxH:this.#k?.maxEl.getBoundingClientRect().height||8,minH:this.#k?.minEl.getBoundingClientRect().height||4,maxW:this.#k?.maxWidthEl.getBoundingClientRect().width||2,minW:this.#k?.minWidthEl.getBoundingClientRect().width||1},this.#Y}#A(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#N(){let J=Number(this.getAttribute("value")??0);return Number.isFinite(J)?J:0}#jJ(J){if(!this.hasAttribute(J))return null;let Q=this.getAttribute(J);if(Q===null||Q.trim()==="")return null;let Z=Number(Q);return Number.isFinite(Z)?Z:null}#w(){return this.#jJ("min")}#u(){return this.#jJ("max")}#l(J,Q){if(Q===null||Q===void 0||Q===""){this.removeAttribute(J);return}let Z=Number(Q);if(!Number.isFinite(Z)){this.removeAttribute(J);return}this.setAttribute(J,String(Z))}#i(J){let Q=J,Z=this.#w(),$=this.#u();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#d(J){let Q=this.#A();if(Q<=0)return J;let Z=this.#w()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#p(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#d(J):J;$=this.#i($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#a($),this.#v(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#kJ(){let J=this.#N(),Q=this.#i(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#p(Q);return}this.#a(J),this.#v()}#a(J=this.#N()){if(!this.#X)return;let Q=this.#w(),Z=this.#u();if(this.#X.setAttribute("aria-valuenow",String(J)),this.#X.setAttribute("aria-valuetext",String(J)),Q===null)this.#X.removeAttribute("aria-valuemin");else this.#X.setAttribute("aria-valuemin",String(Q));if(Z===null)this.#X.removeAttribute("aria-valuemax");else this.#X.setAttribute("aria-valuemax",String(Z))}#t(){let J=Y(this,"disabled");if(!this.#X)return;if(J){if(this.#F)this.#XJ();this.#MJ(),this.setAttribute("aria-disabled","true"),this.#X.setAttribute("tabindex","-1"),this.#X.setAttribute("aria-disabled","true")}else this.removeAttribute("aria-disabled"),this.#X.setAttribute("tabindex","0"),this.#X.removeAttribute("aria-disabled")}#JJ(J,Q){if(!this.#q||J<1||Q<1)return;if(J===this.#K&&Q===this.#P)return;this.#K=J,this.#P=Q,this.#Y=null,this.#q.setAttribute("viewBox",`0 0 ${J} ${Q}`),this.#q.setAttribute("width",String(J)),this.#q.setAttribute("height",String(Q)),this.#v()}#v(){if(this.#L)return;this.#L=requestAnimationFrame(()=>{if(!this.isConnected){this.#L=0;return}if(this.#K<1||this.#P<1){let J=this.#X?.getBoundingClientRect();if(J)this.#JJ(J.width,J.height)}this.#NJ(),this.#L=0})}#NJ(){if(!this.#M)return;let J=this.#K,Q=this.#P;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#w()??0:this.#R??this.#N(),$=360/z.#Z,j=this.#A(),_=this.#w()??0,X=(Z-_)/j*$,q=z.#J,B=J/2,O=Q/2,{maxH:G,minH:M,maxW:k,minW:P}=this.#o(),N=z.#Q,S=Math.max(J/2,1),F=S*0.84,R=[];for(let W=0;W<z.#Z;W+=1){let T=X+W*$;if(T=((T+180)%360+360)%360-180,T<-N||T>=N)continue;let V=T*Math.PI/180,H=B+F*Math.sin(V)/(1-q*Math.cos(V)),C=Math.min(1,Math.abs(H-B)/Math.max(S,1)),I=Math.cos(C*Math.PI*0.5),A=M+(G-M)*I,d=P+(k-P)*I,o=A/2,b=d/2,y=O-o,m=O+o,i=H-b,a=H+b;R.push(`M ${H} ${y} Q ${a} ${y} ${a} ${y+b} V ${m-b} Q ${a} ${m} ${H} ${m} Q ${i} ${m} ${i} ${m-b} V ${y+b} Q ${i} ${y} ${H} ${y} Z`)}this.#M.setAttribute("d",R.join(" "))}#BJ(){this.#B?.addEventListener("pointerdown",this.#c),this.#X?.addEventListener("wheel",this.#x,{passive:!1}),this.#X?.addEventListener("keydown",this.#E)}#GJ(){this.#B?.removeEventListener("pointerdown",this.#c),this.#X?.removeEventListener("wheel",this.#x),this.#X?.removeEventListener("keydown",this.#E),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b)}#qJ(J){if(Y(this,"disabled"))return;if(J.button!==0)return;if(J.preventDefault(),!this.beginScrub(J))return;this.#B?.setPointerCapture?.(J.pointerId),window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#b),window.addEventListener("pointercancel",this.#b)}beginScrub(J={}){if(Y(this,"disabled"))return!1;let Q=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Q))return!1;this.#MJ(),this.#F=!0,this.#W=J&&typeof J==="object"&&J.pointerId!==void 0?J.pointerId:null,this.#H=Q;let Z=J&&typeof J==="object"?Number(J.startValue):Number.NaN;return this.#z=Number.isFinite(Z)?this.#i(Z):this.#N(),this.#V=!1,this.#WJ(Q),this.#PJ(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.remove(z.#O),this.focus(),!0}updateScrub(J,Q){if(!this.#F)return this.#N();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#N();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#n(Z,$),this.#N()}endScrub(J=!0){if(!this.#F)return this.#N();if(J&&this.#N()!==this.#z)this.#p(this.#N(),{snap:!0,emit:"change"});return this.#XJ(),this.#N()}#LJ(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.updateScrub(J)}#n(J,Q=1){if(!this.#V&&Math.abs(J-this.#H)>=z.#$)this.#V=!0,document.body.classList.add(z.#O);let Z=this.#X?.clientWidth||1,$=z.#Z*(z.#Q*2/360),j=this.#A()*$,_=(J-this.#H)*(j/Z)*Q,X=this.#R??this.#z,q=this.#i(this.#z+_);this.#s(J,Q,q!==X),this.#R=q,this.#p(q,{snap:!0,emit:"input"}),this.#SJ(J)}#_J(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.endScrub()}#XJ(){this.#F=!1,this.#W=null,this.#V=!1,this.#R=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(z.#O),this.#UJ(),this.#QJ(),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),this.#v()}#PJ(){this.#QJ(),this.#D=this.#OJ("--fig-input-wheel-handle-drag-max")}#OJ(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#SJ(J){if(!this.#D){this.#ZJ();return}let Q=J-this.#H;if(!Q){this.#ZJ();return}let Z=this.#D*Math.tanh(Q/Math.max(1,this.#D*3));this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${Z}px`)}#QJ(){this.#ZJ(),this.#D=0}#ZJ(){this.style.removeProperty("--fig-input-wheel-handle-drag-offset")}#WJ(J){this.#UJ(),this.#h=J,this.#I=performance.now()}#s(J,Q,Z){let $=performance.now(),j=$-this.#I,_=this.#h===null?0:Math.abs(J-this.#h);this.#h=J,this.#I=$;let X=j>0?_/j*Math.max(1,Math.abs(Q)):0;if(!Z||X<z.#_){this.#r();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#f),this.#f=window.setTimeout(()=>{this.#r()},z.#j)}#UJ(){this.#h=null,this.#I=0,this.#r()}#r(){clearTimeout(this.#f),this.#f=0,this.removeAttribute("data-fig-input-wheel-fast")}#KJ(J){if(Y(this,"disabled"))return;J.preventDefault();let Q=J.deltaY===0?Math.sign(J.deltaX):Math.sign(J.deltaY);if(!Q)return;let Z=J.shiftKey?10:1;this.#p(this.#N()+this.#A()*Z*Q,{snap:!0,emit:"input"}),this.#p(this.#N(),{emit:"change"})}#HJ(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number"))return;if(J.key==="Home"){let _=this.#w();if(_===null)return;J.preventDefault(),this.#p(_,{snap:!0,emit:"input"}),this.#p(this.#N(),{emit:"change"});return}if(J.key==="End"){let _=this.#u();if(_===null)return;J.preventDefault(),this.#p(_,{snap:!0,emit:"input"}),this.#p(this.#N(),{emit:"change"});return}if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(J.key))return;J.preventDefault();let Z=J.key==="ArrowRight"||J.key==="ArrowUp"?1:-1,$=J.shiftKey?10:1,j=this.#N();this.#p(j+this.#A()*$*Z,{snap:!0,emit:"input"}),this.#TJ(j,this.#N(),Z,$),this.#p(this.#N(),{emit:"change"})}#TJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#MJ();return}if(this.#U)cancelAnimationFrame(this.#U),this.#U=0;clearTimeout(this.#S),this.#S=0,this.removeAttribute("data-fig-input-wheel-keyboard-settling");let _=this.#R??J,X=Number.parseFloat(this.style.getPropertyValue("--fig-input-wheel-handle-drag-offset"))||0,q=$>1?120:90,B=performance.now(),O=j;this.setAttribute("data-fig-input-wheel-keyboard-moving","");let G=(M)=>{let k=Math.min(1,(M-B)/q);if(this.#R=_+(Q-_)*k,O){let P=Math.sin(k*Math.PI/2),N=X+(Z*4-X)*P;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${N}px`)}if(this.#NJ(),k<1){this.#U=requestAnimationFrame(G);return}this.#U=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.setAttribute("data-fig-input-wheel-keyboard-settling",""),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.#S=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#S=0},140),this.#v()};this.#U=requestAnimationFrame(G)}#MJ(){if(this.#U)cancelAnimationFrame(this.#U),this.#U=0;if(clearTimeout(this.#S),this.#S=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.isConnected)this.#v()}get value(){return this.getAttribute("value")??"0"}set value(J){if(J===null||J===void 0||J===""){this.#p(0);return}let Q=Number(J);this.#p(Number.isFinite(Q)?Q:0)}spinTo(J,{animateHandle:Q=!1}={}){let Z=this.#N();this.value=J;let $=this.#N();if(this.getAttribute("spin")==="false")return this.#MJ(),$;let j=Math.sign($-Z);return this.#TJ(Z,$,j,Math.abs($-Z)>this.#A()?10:1,Q),$}get min(){return this.#w()}set min(J){this.#l("min",J)}get max(){return this.#u()}set max(J){this.#l("max",J)}get step(){return this.#A()}focus(J){HTMLElement.prototype.focus.call(this,J)}}U("fig-input-wheel",z);class v extends HTMLElement{static#Z=new Set(["label","size","disabled","variant","elastic","spin","text","default","class","style","id","oninput","onchange"]);static get observedAttributes(){return["label","units","value","disabled","step","precision","min","max","elastic","spin","text"]}#Q=null;#J=null;#_=null;#j=null;#$=!1;#O=null;#B=new Set;#G=null;#X=null;#q=0;#M=null;#Y=0;#k=null;#K=null;#P=0;#L=0;#U=0;#S=!1;#T=!1;#F=0;#W=!1;#H=this.#v.bind(this,"input");#z=this.#v.bind(this,"change");#V=this.#NJ.bind(this,"input");#R=this.#NJ.bind(this,"change");#D=this.#BJ.bind(this);#h=this.#WJ.bind(this);#I=this.#s.bind(this);#f=this.#UJ.bind(this);#c=this.#GJ.bind(this);#y=this.#qJ.bind(this);#b=this.#LJ.bind(this);#x=this.#XJ.bind(this);#E=this.#PJ.bind(this);#C=this.#KJ.bind(this);connectedCallback(){if(!this.#Q)this.#e();this.#o(),this.#A(),this.#jJ(),this.#p(),this.#kJ(),f(this),this.#O?.disconnect(),this.#O=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!v.#Z.has(Z)&&!v.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#p()}),this.#O.observe(this,{attributes:!0})}disconnectedCallback(){this.#O?.disconnect(),this.#n(),this.#QJ(),this.#a(),this.#r(),clearTimeout(this.#F),this.#F=0,this.#J?.endScrub(!1),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label")this.#o();if(J==="text")this.#A();if(J==="elastic"&&Z==="false")this.#QJ();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#jJ();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#p()}#e(){this.#G=this.getAttribute("value")??"0";let J=Array.from(this.childNodes).filter((q)=>q.nodeType!==Node.TEXT_NODE||Boolean(q.textContent?.trim())),Q=J.find((q)=>q.nodeType===Node.ELEMENT_NODE&&q.matches("label")),Z=L("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number"),X=_J("propskit-wheel-label");$.id=X,j.setAttribute("aria-labelledby",X),_.setAttribute("aria-labelledby",X),Z.append($,j,_),this.#Q=Z,this.#J=j,this.#_=$,this.#j=_,this.#$=Boolean(Q),this.replaceChildren(Z);for(let q of J)if(q!==Q)_.appendChild(q)}#o(){if(!this.#_)return;if(!this.#$)this.#_.textContent=this.hasAttribute("label")?this.getAttribute("label")??"":"Value";this.toggleAttribute("data-label-empty",!(this.#_.textContent??"").trim())}#A(){if(!this.#Q||!this.#j)return;let J=this.getAttribute("text")!=="false",Q=this.#j.parentElement===this.#Q;if(J&&!Q)this.#Q.append(this.#j);else if(!J&&Q)this.#j.remove()}#N(J){if(!this.#J)return;if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#jJ(){if(!this.#J)return;this.#J.removeAttribute("units");for(let Q of["min","max","spin"])this.#N(Q);if(this.hasAttribute("step"))this.#N("step");else this.#J.setAttribute("step",String(this.#l()));this.#J.toggleAttribute("disabled",Y(this,"disabled")),this.#J.value=this.getAttribute("value")??"0";let J=this.#J.value;if(this.getAttribute("value")!==J)this.setAttribute("value",J);if(this.#j?.getAttribute("value")!==J)this.#j?.setAttribute("value",J);this.#d()}#w(){return this.getAttributeNames().filter((J)=>!v.#Z.has(J)&&!v.observedAttributes.includes(J)&&!J.startsWith("data-"))}#u(){let J=(this.getAttribute("units")||"").trim(),Q=J.toLowerCase();if(Q==="ms"||Q==="millisecond"||Q==="milliseconds")return"ms";if(Q==="s"||Q==="second"||Q==="seconds")return"s";return J}#l(){let J=this.#u();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#i(){return this.#u()==="s"?2:0}#d(){if(!this.#J)return;let J=Number(this.#J.value),Q=this.#u();this.#J.setAttribute("aria-valuetext",Q?`${J} ${Q==="s"?"seconds":Q==="ms"?"milliseconds":Q}`:String(J))}#p(){if(!this.#j||!this.#J)return;let J=this.#w(),Q=new Set(J);for(let $ of this.#B)if(!Q.has($))this.#j.removeAttribute($);for(let $ of J)this.#j.setAttribute($,this.getAttribute($)??"");let Z=this.#u();if(Z)this.#j.setAttribute("units",Z);else this.#j.removeAttribute("units");if(this.#j.setAttribute("step",String(this.#J.step)),this.hasAttribute("precision"))this.#j.setAttribute("precision",this.getAttribute("precision")??"");else this.#j.setAttribute("precision",String(this.#i()));for(let $ of["min","max"]){let j=this.#J[$];if(j===null)this.#j.removeAttribute($);else this.#j.setAttribute($,String(j))}this.#j.toggleAttribute("disabled",Y(this,"disabled")),this.#j.setAttribute("value",this.#J.value),this.#B=Q}#kJ(){this.#a(),this.#J?.addEventListener("input",this.#H),this.#J?.addEventListener("change",this.#z),this.#j?.addEventListener("input",this.#V),this.#j?.addEventListener("change",this.#R),this.#j?.addEventListener("keydown",this.#D,{capture:!0}),this.addEventListener("pointerdown",this.#c,{capture:!0}),this.addEventListener("pointerdown",this.#h,{capture:!0}),this.addEventListener("click",this.#C,!0)}#a(){this.#J?.removeEventListener("input",this.#H),this.#J?.removeEventListener("change",this.#z),this.#j?.removeEventListener("input",this.#V),this.#j?.removeEventListener("change",this.#R),this.#j?.removeEventListener("keydown",this.#D,{capture:!0}),this.removeEventListener("pointerdown",this.#c,{capture:!0}),this.removeEventListener("pointerdown",this.#h,{capture:!0}),this.removeEventListener("click",this.#C,!0)}#t(J,{spin:Q=!1,animateHandle:Z=!1}={}){let $=Number(J);if(!this.#J){let X=Number.isFinite($)?$:0;return this.setAttribute("value",String(X)),X}let j=Number.isFinite($)?$:0;if(Q)this.#J.spinTo(j,{animateHandle:Z});else this.#J.value=j;let _=this.#J.value;if(this.getAttribute("value")!==_)this.setAttribute("value",_);if(this.#j?.getAttribute("value")!==_)this.#j?.setAttribute("value",_);return this.#d(),Number(_)}#JJ(J,Q){this.dispatchEvent(new CustomEvent(J,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}#v(J,Q){Q.stopImmediatePropagation();let Z=this.#t(Q.detail);this.#JJ(J,Z)}#NJ(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#j?.value,$=this.#t(Z,{spin:J==="input",animateHandle:J==="input"&&this.#W});if(J==="input")this.#W=!1;this.#JJ(J,$)}#BJ(J){this.#W=!Y(this,"disabled")&&(J.key==="ArrowUp"||J.key==="ArrowDown"),window.setTimeout(()=>{this.#W=!1},0)}#GJ(J){if(J.button!==0||Y(this,"disabled")||!(J.target instanceof Element)||J.target.closest("fig-input-number")||J.target.closest(".propskit-wheel-surface")!==this.#Q)return;if(J.preventDefault(),J.stopImmediatePropagation(),this.#n(),!this.#J?.beginScrub({clientX:J.clientX,pointerId:J.pointerId,startValue:Number(this.#J.value)}))return;this.#k=J.pointerId,this.#_J(J.pointerId),window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#b),window.addEventListener("pointercancel",this.#b),window.addEventListener("blur",this.#b)}#qJ(J){if(J.pointerId!==this.#k)return;if(J.buttons===0){this.#LJ(J);return}this.#J?.updateScrub(J)}#LJ(J){if(J?.pointerId!==void 0&&this.#k!==null&&J.pointerId!==this.#k)return;this.#J?.endScrub(),this.#n(),this.#QJ()}#n(){window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),window.removeEventListener("blur",this.#b),this.#k=null}#_J(J){if(this.#QJ(),this.getAttribute("elastic")==="false")return;this.#X=J,this.#q=this.#SJ("--propskit-wheel-elastic-distance");let Q=this.getBoundingClientRect();if(Q)this.#M={left:Q.left,right:Q.right};this.#Y=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#x,{passive:!0}),window.addEventListener("pointerup",this.#E),window.addEventListener("pointercancel",this.#E),window.addEventListener("blur",this.#E)}#XJ(J){if(J.pointerId!==this.#X)return;if(J.buttons===0){this.#PJ(J);return}this.#OJ(J.clientX)}#PJ(J){if(J?.pointerId!==void 0&&this.#X!==null&&J.pointerId!==this.#X)return;this.#QJ()}#OJ(J){let Q=this.#M;if(!Q||!this.#q){this.#ZJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#ZJ();return}let $=Math.min(this.#q,Math.abs(Z)*0.5),j=this.#Y?(this.#Y+$)/this.#Y:1;this.toggleAttribute("data-propskit-wheel-elastic-dragging",!0),this.style.setProperty("--propskit-wheel-elastic-scale",String(j)),this.style.setProperty("--propskit-wheel-elastic-origin",Z<0?"right center":"left center")}#SJ(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#QJ(){window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E),this.#X=null,this.#q=0,this.#M=null,this.#Y=0,this.#ZJ()}#ZJ(){this.removeAttribute("data-propskit-wheel-elastic-dragging"),this.style.removeProperty("--propskit-wheel-elastic-scale"),this.style.removeProperty("--propskit-wheel-elastic-origin")}#WJ(J){if(J.button!==0||J.altKey||Y(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#r(),this.#K=J.pointerId,this.#P=J.clientX,this.#L=J.clientY,this.#U=Number(this.#J?.value??0),window.addEventListener("pointermove",this.#I),window.addEventListener("pointerup",this.#f,{once:!0}),window.addEventListener("pointercancel",this.#f,{once:!0}),window.addEventListener("blur",this.#f,{once:!0})}#s(J){if(J.pointerId!==this.#K)return;if(J.buttons===0){this.#UJ(J);return}if(!this.#S){if(Math.hypot(J.clientX-this.#P,J.clientY-this.#L)<4)return;this.#S=!0,this.setAttribute("data-number-scrubbing",""),this.#_J(J.pointerId),this.#J?.beginScrub({clientX:this.#P,pointerId:J.pointerId,startValue:this.#U})}this.#J?.updateScrub(J),this.#OJ(J.clientX)}#UJ(J){if(J?.pointerId!==void 0&&this.#K!==null&&J.pointerId!==this.#K)return;let Q=this.#S;if(this.#QJ(),this.#r(),Q){this.#J?.endScrub(),this.#T=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#T=!1,this.#F=0},0),requestAnimationFrame(()=>this.#J?.focus());return}this.#j?.querySelector("input")?.focus()}#r(){window.removeEventListener("pointermove",this.#I),window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f),this.#K=null,this.#S=!1,this.removeAttribute("data-number-scrubbing")}#KJ(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#T&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#T=!1;return}if(!(J.target instanceof Element)||!J.target.closest("fig-input-wheel"))this.#J?.focus()}get value(){return this.getAttribute("value")??this.#J?.value??"0"}set value(J){let Q=Number(J);this.#t(Number.isFinite(Q)?Q:0)}get min(){return this.#J?.min??null}set min(J){if(J===null||J===void 0||J==="")this.removeAttribute("min");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("min",String(Q));else this.removeAttribute("min")}}get max(){return this.#J?.max??null}set max(J){if(J===null||J===void 0||J==="")this.removeAttribute("max");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("max",String(Q));else this.removeAttribute("max")}}get defaultValue(){return this.getAttribute("default")??this.#G??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=Number(this.defaultValue),Q=this.#t(Number.isFinite(J)?J:0);g(this,Q)}focus(J){this.#J?.focus(J)}}U("propskit-wheel",v);class zJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping","precision"];#Z=50;#Q=50;#J=75;#_=75;#j=0;#$=!1;#O=0;#B=null;#G=null;#X=null;#q=null;#M=null;#Y=null;#k=null;#K=null;#P=null;#L=!1;#U=!1;#S=!1;#T=!1;#F=null;#W="";#H="";#z=null;#V=null;#R=null;#D="";#h="";#I=null;#f=null;#c=null;get#y(){return this.getAttribute("type")||"point"}get#b(){return this.#y==="point-radius"||this.#y==="point-radius-angle"}get#x(){return this.#y==="point-radius-angle"}get#E(){return this.#y==="point-point"}get#C(){return this.#y==="point-radius-angle"||this.#y==="point-point"}get#e(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#o(){let J=this.getAttribute("snapping");if(J===null)return"false";let Q=J.trim().toLowerCase();if(Q==="modifier")return"modifier";if(Q===""||Q==="true")return"true";return"false"}get#A(){let J=Number(this.getAttribute("precision")??2);if(!Number.isFinite(J))return 2;return Math.max(0,Math.min(8,Math.trunc(J)))}#N(J){let Q=10**this.#A,Z=Math.round(J*Q)/Q;return Object.is(Z,-0)?0:Z}#jJ(){let J=this.getAttribute("precision");for(let Q of[this.#B,this.#X,this.#G]){if(!Q)continue;if(J===null)Q.removeAttribute("precision");else Q.setAttribute("precision",String(this.#A))}}#w(J){let Q=this.#o;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#u(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${this.#N(this.#Z)}%, ${this.#N(this.#Q)}%`}get#l(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${this.#N(this.#J)}%, ${this.#N(this.#_)}%`}get#i(){return this.getAttribute("drag-surface")||"parent"}get#d(){let J=this.#i;if(J==="parent")return this.parentElement;return this.closest(J)}get#p(){let J=this.#i;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#kJ(J){if(this.#$)return this.#j/100*J;return this.#j}#a(){let J=this.#N(this.#j);if(this.#$)return`Radius ${J}%`;return`Radius ${J}`}connectedCallback(){this.#t(),this.#JJ()}disconnectedCallback(){this.#VJ(),this.#bJ(),this.#BJ(),this.#n(),document.body.classList.remove("fig-lab-move-active"),document.body.classList.remove("fig-lab-rotate-active")}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"&&!this.#L&&!this.#U&&!this.#S&&!this.#T)if(this.#t(),this.#B)this.#m();else this.#JJ();if(J==="type")this.#VJ(),this.#t(),this.#JJ();if(J==="color"&&this.#B)if(Z)this.#B.setAttribute("color",Z);else this.#B.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#JJ();if(J==="tooltips")this.#JJ();if(J==="snapping"&&this.#B){if(this.#B.setAttribute("drag-snapping",Z||"false"),this.#G)this.#G.setAttribute("drag-snapping",Z||"false")}if(J==="precision"){if(!this.isConnected)return;this.#jJ(),this.#Z=this.#N(this.#Z),this.#Q=this.#N(this.#Q),this.#J=this.#N(this.#J),this.#_=this.#N(this.#_),this.#j=this.#N(this.#j),this.#O=this.#N(this.#O),this.#m(),this.#g()}if(J==="name"){if(this.#Y)this.#Y.setAttribute("text",this.#u);if(this.#k)this.#k.setAttribute("text",this.#l)}}#t(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#Z=this.#N(Q.x);if(typeof Q.y==="number")this.#Q=this.#N(Q.y);if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#$=!0,this.#j=this.#N(parseFloat(Z));else this.#$=!1,this.#j=this.#N(parseFloat(Z));if(!Number.isFinite(this.#j))this.#j=0}if(typeof Q.angle==="number")this.#O=this.#N(Q.angle);if(typeof Q.x2==="number")this.#J=this.#N(Q.x2);if(typeof Q.y2==="number")this.#_=this.#N(Q.y2);if(this.#y==="color"&&typeof Q.color==="string"&&Q.color.trim()&&this.getAttribute("color")!==Q.color.trim())this.setAttribute("color",Q.color.trim())}catch{}}get value(){let J={x:this.#N(this.#Z),y:this.#N(this.#Q)};if(this.#y==="color"){let Q=this.getAttribute("color")||this.#B?.getAttribute("color");if(Q)J.color=Q}if(this.#b){let Q=this.#N(this.#j);J.radius=this.#$?`${Q}%`:Q}if(this.#x)J.angle=this.#N(this.#O);if(this.#E)J.x2=this.#N(this.#J),J.y2=this.#N(this.#_);return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#JJ(){this.#VJ(),this.replaceChildren(),this.#B=null,this.#G=null,this.#X=null,this.#q=null,this.#M=null,this.#Y=null,this.#k=null,this.#K=null,this.#P=null;let J=Y(this,"disabled"),Q=this.#y,Z=this.#e,$=this.#p,j=document.createElement("fig-handle");if(j.setAttribute("drag","true"),j.setAttribute("drag-surface",$),j.setAttribute("drag-axes","x,y"),j.setAttribute("drag-snapping",this.#o),j.setAttribute("value",`${this.#Z}% ${this.#Q}%`),this.hasAttribute("precision"))j.setAttribute("precision",String(this.#A));if(J)j.setAttribute("disabled","");if(Q==="color"){j.setAttribute("type","color");let _=this.getAttribute("color");if(_)j.setAttribute("color",_)}else j.setAttribute("type","canvas");if(this.#E)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#B=j,this.#b)this.#QJ();if(this.#C)this.#ZJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#u),_.appendChild(j),this.appendChild(_),this.#Y=_}else this.appendChild(j);if(this.#x)this.#s(J,Z,$);if(this.#E)this.#UJ(J,Z,$);this.#v(this.#B),this.#v(this.#X),this.#v(this.#G),this.#DJ(),this.#PJ(),requestAnimationFrame(()=>this.#m())}#v(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#LJ(Q,J);else this.#NJ(Q)},{capture:!0})}#NJ(J){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#F===null)this.#W=document.body.style.getPropertyValue("cursor"),this.#H=document.body.style.getPropertyPriority("cursor");if(this.#F=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#z)this.#z=(Q)=>{if(Q?.pointerId!==void 0&&this.#F!==null&&Q.pointerId!==this.#F)return;if(Q?.type==="blur")this.#BJ();else requestAnimationFrame(()=>this.#BJ())};window.addEventListener("pointerup",this.#z),window.addEventListener("pointercancel",this.#z),window.addEventListener("blur",this.#z)}#BJ(){if(this.#F===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#W)document.body.style.setProperty("cursor",this.#W,this.#H);else document.body.style.removeProperty("cursor");if(this.#F=null,this.#W="",this.#H="",this.#z)window.removeEventListener("pointerup",this.#z),window.removeEventListener("pointercancel",this.#z),window.removeEventListener("blur",this.#z)}#GJ(J){if(!J)return 0;if(J===this.#X)return this.#O;if(!this.#E)return 0;let Q=this.#FJ();return J===this.#B?Q+180:Q}#qJ(){if(this.#V===null)return;let J=this.#KJ(this.#GJ(this.#R));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#LJ(J,Q){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#V===null)this.#D=document.body.style.getPropertyValue("cursor"),this.#h=document.body.style.getPropertyPriority("cursor");if(this.#V=J?.pointerId??-1,this.#R=Q,document.body.classList.add("fig-lab-rotate-active"),this.#qJ(),!this.#I)this.#I=(Z)=>{if(Z?.pointerId!==void 0&&this.#V!==null&&Z.pointerId!==this.#V)return;if(Z?.type==="blur")this.#n();else requestAnimationFrame(()=>this.#n())};window.addEventListener("pointerup",this.#I),window.addEventListener("pointercancel",this.#I),window.addEventListener("blur",this.#I)}#n(){if(this.#V===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#D)document.body.style.setProperty("cursor",this.#D,this.#h);else document.body.style.removeProperty("cursor");if(this.#V=null,this.#R=null,this.#D="",this.#h="",this.#I)window.removeEventListener("pointerup",this.#I),window.removeEventListener("pointercancel",this.#I),window.removeEventListener("blur",this.#I)}#_J(J,Q,Z,$){if(!J)return;let j=()=>!!$?.(),_=()=>{let B=Q();if(!B)return;B.removeAttribute("show"),B.hidePopup?.()},X=()=>{if(j()){_();return}let B=Q();if(!B)return;if(Z)B.setAttribute("text",Z());B.setAttribute("show","true"),B.showPopup?.()},q=()=>{_()};J.addEventListener("pointerenter",X),J.addEventListener("pointerleave",q)}#XJ(){return this.#L||this.#U||this.#S||this.#T}#PJ(){if(this.#B)this.#_J(this.#B,()=>this.#Y,()=>this.#u,()=>this.#XJ()||!!this.#B?.querySelector("fig-color-tip"));if(this.#X)this.#_J(this.#X,()=>this.#P,()=>`Angle ${this.#N(this.#O)}°`,()=>this.#XJ());if(this.#G)this.#_J(this.#G,()=>this.#k,()=>this.#l,()=>this.#XJ());if(this.#q){let J=this.#q.querySelector(".fig-canvas-control-radius-hit");this.#SJ(J||this.#q)}if(this.#y==="color"&&this.#B&&this.#Y)new MutationObserver(()=>{if(this.#B?.querySelector("fig-color-tip"))this.#Y?.removeAttribute("show"),this.#Y?.hidePopup?.()}).observe(this.#B,{childList:!0,subtree:!0})}#OJ(J,Q){let Z=this.#K;if(!Z?.popup)return;let $=Q-8;Z.popup.anchor={getBoundingClientRect:()=>({left:J,top:$,right:J,bottom:$,width:0,height:0,x:J,y:$})},Z.popup.queueReposition?.()}#SJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#K;if(!Z)return;Z.setAttribute("text",this.#a()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#S)return;this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#S)return;let Q=this.#K;if(!Q)return;Q.removeAttribute("show")})}#QJ(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");Q.classList.add("fig-canvas-control-radius"),Q.setAttribute("overflow","visible");let Z=document.createElementNS("http://www.w3.org/2000/svg","circle");Z.classList.add("fig-canvas-control-radius-hit"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","circle");$.classList.add("fig-canvas-control-radius-halo"),Q.appendChild($);let j=document.createElementNS("http://www.w3.org/2000/svg","circle");if(Q.appendChild(j),this.#q=Q,this.#e){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#a()),_.appendChild(Q),this.appendChild(_),this.#K=_}else this.appendChild(Q);this.#IJ(Z)}#ZJ(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");if(Q.classList.add("fig-canvas-control-angle-svg"),Q.setAttribute("overflow","visible"),Q.style.position="absolute",Q.style.pointerEvents="none",this.#E){let j=document.createElementNS("http://www.w3.org/2000/svg","line");j.classList.add("fig-canvas-control-angle-line-hit"),j.setAttribute("stroke","transparent"),j.setAttribute("stroke-width","12"),j.setAttribute("stroke-linecap","round"),j.style.pointerEvents="stroke",Q.appendChild(j),this.#WJ(j)}let Z=document.createElementNS("http://www.w3.org/2000/svg","line");Z.classList.add("fig-canvas-control-angle-line-halo"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","line");$.classList.add("fig-canvas-control-angle-line"),Q.appendChild($),this.#M=Q,this.appendChild(Q)}#WJ(J){J.addEventListener("pointerdown",(Q)=>{if(Y(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#d;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#Q,q=this.#J,B=this.#_;this.#L=!0,this.#U=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let O=(M)=>{let k=Z.getBoundingClientRect(),P=k.width>0?(M.clientX-$)/k.width*100:0,N=k.height>0?(M.clientY-j)/k.height*100:0,S=-Math.min(_,q),F=100-Math.max(_,q),R=-Math.min(X,B),W=100-Math.max(X,B),T=Math.max(S,Math.min(F,P)),V=Math.max(R,Math.min(W,N));this.#Z=this.#N(_+T),this.#Q=this.#N(X+V),this.#J=this.#N(q+T),this.#_=this.#N(B+V),this.#m(),this.#YJ()},G=this.#zJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#L=!1,this.#U=!1,M)this.#g(),this.#$J()});window.addEventListener("pointermove",O,{signal:G.signal}),window.addEventListener("pointerup",()=>G.finish(!0),{signal:G.signal}),window.addEventListener("pointercancel",()=>G.finish(!1),{signal:G.signal})})}#s(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("size","small"),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#A));if(J)$.setAttribute("disabled","");if(this.#X=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",`${this.#N(this.#O)}°`),j.appendChild($),this.appendChild(j),this.#P=j}else this.appendChild($)}#UJ(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("drag-snapping",this.#o),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#_}%`),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#A));if(J)$.setAttribute("disabled","");if(this.#G=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#l),j.appendChild($),this.appendChild(j),this.#k=j}else this.appendChild($)}#r(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.1212 16.9998L11.5607 17.4394C12.1465 18.0252 12.1464 18.975 11.5606 19.5607C10.9748 20.1465 10.0251 20.1465 9.4393 19.5606L6.4393 16.5604C5.85354 15.9746 5.85357 15.0249 6.43938 14.4391L9.43938 11.4393C10.0252 10.8535 10.9749 10.8536 11.5607 11.4394C12.1465 12.0252 12.1464 12.9749 11.5606 13.5607L11.1215 13.9998L20.8786 13.9999L20.4394 13.5607C19.8536 12.9749 19.8535 12.0252 20.4393 11.4394C21.0251 10.8536 21.9749 10.8536 22.5606 11.4394L25.5606 14.4393C25.842 14.7206 26 15.1021 26 15.4999C26 15.8978 25.842 16.2793 25.5607 16.5606L22.5607 19.5607C21.9749 20.1465 21.0251 20.1465 20.4393 19.5607C19.8536 18.9749 19.8535 18.0252 20.4393 17.4394L20.8788 16.9999L11.1212 16.9998Z' fill='white'/%3E%3C/g%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M10.8536 12.1465C11.0488 12.3417 11.0488 12.6583 10.8535 12.8536L8.70715 14.9998L23.2929 14.9999L21.1465 12.8536C20.9512 12.6583 20.9512 12.3417 21.1464 12.1465C21.3417 11.9512 21.6583 11.9512 21.8535 12.1465L24.8535 15.1464C24.9473 15.2402 25 15.3673 25 15.4999C25 15.6326 24.9473 15.7597 24.8536 15.8535L21.8536 18.8536C21.6583 19.0488 21.3417 19.0488 21.1465 18.8536C20.9512 18.6583 20.9512 18.3417 21.1464 18.1465L23.2929 15.9999L8.70705 15.9998L10.8536 18.1465C11.0488 18.3417 11.0488 18.6583 10.8535 18.8536C10.6583 19.0488 10.3417 19.0488 10.1464 18.8535L7.14643 15.8533C6.95118 15.658 6.95119 15.3415 7.14646 15.1462L10.1465 12.1464C10.3417 11.9512 10.6583 11.9512 10.8536 12.1465Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='3' y='9' width='26' height='15' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, nwse-resize`}#KJ(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J-45)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath d='M12.5607 22.4393L12.0216 21.9002C17.1558 21.2216 21.2216 17.1558 21.9002 12.0216L22.4393 12.5607C23.0251 13.1464 23.9749 13.1464 24.5607 12.5607C25.1464 11.9749 25.1464 11.0251 24.5607 10.4393L21.5607 7.43934C20.9749 6.85355 20.0251 6.85355 19.4393 7.43934L16.4393 10.4393C15.8536 11.0251 15.8536 11.9749 16.4393 12.5607C17.0251 13.1464 17.9749 13.1464 18.5607 12.5607L18.8056 12.3157C18.1013 15.5527 15.5527 18.1013 12.3157 18.8056L12.5607 18.5607C13.1464 17.9749 13.1464 17.0251 12.5607 16.4393C11.9749 15.8536 11.0251 15.8536 10.4393 16.4393L7.43934 19.4393C6.85356 20.0251 6.85356 20.9749 7.43934 21.5607L10.4393 24.5607C11.0251 25.1464 11.9749 25.1464 12.5607 24.5607C13.1464 23.9749 13.1464 23.0251 12.5607 22.4393Z' fill='white'/%3E%3C/g%3E%3Cpath d='M23.8536 11.8536C23.6583 12.0488 23.3417 12.0488 23.1464 11.8536L21 9.70711V10.5C21 16.299 16.299 21 10.5 21H9.70711L11.8536 23.1464C12.0488 23.3417 12.0488 23.6583 11.8536 23.8536C11.6583 24.0488 11.3417 24.0488 11.1464 23.8536L8.14645 20.8536C7.95119 20.6583 7.95119 20.3417 8.14645 20.1464L11.1464 17.1464C11.3417 16.9512 11.6583 16.9512 11.8536 17.1464C12.0488 17.3417 12.0488 17.6583 11.8536 17.8536L9.70711 20H10.5C15.7467 20 20 15.7467 20 10.5V9.70711L17.8536 11.8536C17.6583 12.0488 17.3417 12.0488 17.1464 11.8536C16.9512 11.6583 16.9512 11.3417 17.1464 11.1464L20.1464 8.14645C20.3417 7.95119 20.6583 7.95119 20.8536 8.14645L23.8536 11.1464C24.0488 11.3417 24.0488 11.6583 23.8536 11.8536Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='4' y='5' width='24' height='24' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, pointer`}#HJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#TJ(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#HJ(Z,this.#KJ(Q)),this.#R===J)this.#qJ()}#MJ(){if(!this.#X||!this.#x)return;this.#TJ(this.#X,this.#O)}#FJ(){return Math.atan2(this.#_-this.#Q,this.#J-this.#Z)*180/Math.PI}#CJ(){if(!this.#E)return;let J=this.#FJ();this.#B?.style.removeProperty("cursor"),this.#G?.style.removeProperty("cursor"),this.#TJ(this.#B,J+180),this.#TJ(this.#G,J)}#RJ(J,Q,Z,$){J.style.setProperty("--fig-handle-position-translate","-50% -50%"),J.style.left=`${Q/100*$.width}px`,J.style.top=`${Z/100*$.height}px`}#m(){let J=this.#d;if(!J||!this.#B)return;let Q=J.getBoundingClientRect();if(this.#RJ(this.#B,this.#Z,this.#Q,Q),this.#q){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#kJ(Q.width),_=this.#q,X=Math.max(j*2,1);_.style.position="absolute",_.style.width=`${X}px`,_.style.height=`${X}px`,_.style.left=`${Z-j}px`,_.style.top=`${$-j}px`,_.setAttribute("viewBox",`0 0 ${X} ${X}`);let q=_.querySelectorAll("circle");for(let B of q)B.setAttribute("cx",String(j)),B.setAttribute("cy",String(j)),B.setAttribute("r",String(Math.max(j-1,0)))}if(this.#M&&this.#C){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#E)j=this.#J/100*Q.width,_=this.#_/100*Q.height;else{let B=this.#kJ(Q.width),O=this.#O*Math.PI/180;j=Z+B*Math.cos(O),_=$+B*Math.sin(O)}let X=this.#M;X.style.width=`${Q.width}px`,X.style.height=`${Q.height}px`,X.style.left="0",X.style.top="0",X.setAttribute("viewBox",`0 0 ${Q.width} ${Q.height}`);let q=X.querySelectorAll(".fig-canvas-control-angle-line, .fig-canvas-control-angle-line-halo, .fig-canvas-control-angle-line-hit");for(let B of q)B.setAttribute("x1",String(Z)),B.setAttribute("y1",String($)),B.setAttribute("x2",String(j)),B.setAttribute("y2",String(_))}if(this.#X&&this.#x){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#kJ(Q.width),_=this.#O*Math.PI/180,X=Z+j*Math.cos(_),q=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,O=Q.height>0?q/Q.height*100:0;this.#RJ(this.#X,B,O,Q)}if(this.#G&&this.#E)this.#RJ(this.#G,this.#J,this.#_,Q);this.#MJ(),this.#CJ()}#YJ(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#$J(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#fJ(J){return{...this.value,...HJ(J.color,J.alpha,J.opacity)}}#g(){this.setAttribute("value",JSON.stringify(this.value))}#DJ(){if(!this.#B)return;if(this.#B.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#YJ(this.#fJ(J.detail));return}this.#L=!0;let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=this.#N(Math.max(0,Math.min(100,Q*100))),this.#Q=this.#N(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show"),this.#Y.hidePopup?.();this.#m(),this.#YJ()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#$J(this.#fJ(J.detail));return}let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=this.#N(Math.max(0,Math.min(100,Q*100))),this.#Q=this.#N(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show");this.#m(),this.#g(),this.#$J(),requestAnimationFrame(()=>{this.#L=!1})}),this.#X)this.#X.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#d;if(!Q)return;this.#T=!0,this.classList.add("fig-canvas-control-ring-active");let Z=Q.getBoundingClientRect(),$=this.#Z/100*Z.width,j=this.#Q/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#X.offsetWidth/2,B=this.#X.offsetHeight/2,O=_+q-$,G=X+B-j,M=Math.atan2(G,O)*180/Math.PI;if(this.#w(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#O=this.#N(M);let k=Math.sqrt(O*O+G*G);if(this.#w(J.detail?.shiftKey)){let P=this.#$?5:10;if(this.#$){let N=k/Z.width*100;N=Math.round(N/P)*P,k=N/100*Z.width}else k=Math.round(k/P)*P}if(this.#$)this.#j=this.#N(Math.max(0,k/Z.width*100));else this.#j=this.#N(Math.max(0,k));if(this.#P)this.#P.setAttribute("text",`Angle ${this.#N(this.#O)}°`),this.#P.setAttribute("show","true"),this.#P.showPopup?.();this.#m(),this.#YJ()}),this.#X.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#P)this.#P.removeAttribute("show");this.#m(),this.#g(),this.#$J(),requestAnimationFrame(()=>{this.#T=!1})}),this.#X.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#d;if(!Z)return;if(this.#T=!0,this.classList.add("fig-canvas-control-ring-active"),this.#X.setAttribute("selected",""),this.#P)this.#P.setAttribute("show","true"),this.#P.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),q=this.#Z/100*X.width,B=this.#Q/100*X.height,O=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,O)*180/Math.PI;if(this.#w(_.shiftKey))M=Math.round(M/15)*15;if(this.#O=this.#N(M),this.#P)this.#P.setAttribute("text",`Angle ${this.#N(M)}°`);this.#m(),this.#YJ()},j=this.#zJ((_)=>{if(this.#T=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#X.removeAttribute("selected"),this.#P)this.#P.removeAttribute("show");if(_)this.#g(),this.#$J()});window.addEventListener("pointermove",$,{signal:j.signal}),window.addEventListener("pointerup",()=>j.finish(!0),{signal:j.signal}),window.addEventListener("pointercancel",()=>j.finish(!1),{signal:j.signal})});if(this.#G)this.#G.addEventListener("input",(J)=>{J.stopPropagation(),this.#U=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#_/100;if(this.#J=this.#N(Math.max(0,Math.min(100,Q*100))),this.#_=this.#N(Math.max(0,Math.min(100,Z*100))),this.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#m(),this.#YJ()}),this.#G.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#k)this.#k.removeAttribute("show");this.#m(),this.#g(),this.#$J(),requestAnimationFrame(()=>{this.#U=!1})}),this.#AJ(this.#B,!0),this.#AJ(this.#G,!1)}#AJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#d;if(!j)return;this.#L=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#_:this.#Q,B=Q?this.#Z:this.#J,O=Q?this.#Q:this.#_,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,P=O/100*_.height,N=Math.sqrt((k-G)**2+(P-M)**2),S=Q?this.#Y:this.#k;if(S)S.removeAttribute("show"),S.hidePopup?.();let F=(W)=>{let T=j.getBoundingClientRect(),V=X/100*T.width,H=q/100*T.height,C=W.clientX-T.left-V,I=W.clientY-T.top-H,A=Math.atan2(I,C);if(this.#w(W.shiftKey))A=Math.round(A*180/Math.PI/15)*15*Math.PI/180;let d=V+N*Math.cos(A),o=H+N*Math.sin(A),b=Math.max(0,Math.min(100,d/T.width*100)),y=Math.max(0,Math.min(100,o/T.height*100));if(Q)this.#Z=this.#N(b),this.#Q=this.#N(y);else this.#J=this.#N(b),this.#_=this.#N(y);this.#m(),this.#YJ()},R=this.#zJ((W)=>{if(this.#L=!1,S)S.removeAttribute("show");if(W)this.#g(),this.#$J()});window.addEventListener("pointermove",F,{signal:R.signal}),window.addEventListener("pointerup",()=>R.finish(!0),{signal:R.signal}),window.addEventListener("pointercancel",()=>R.finish(!1),{signal:R.signal})})}#IJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#S)return;let $=this.#d;if(!$)return;let j=$.getBoundingClientRect(),_=this.#Z/100*j.width,X=this.#Q/100*j.height,q=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#HJ(J,this.#r(q))});let Q=(Z)=>{if(Y(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#S=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#d;if(!$)return;if(this.#K)this.#K.setAttribute("show","true"),this.#K.showPopup?.(),this.#OJ(Z.clientX,Z.clientY);if(this.#P)this.#P.removeAttribute("show"),this.#P.hidePopup?.();let j=this.#X?.style.pointerEvents,_=this.#X?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#X)this.#X.style.pointerEvents="none";if(_)_.style.pointerEvents="none";let q=document.body.style.cursor;J.style.pointerEvents="none";let B=$.getBoundingClientRect(),O=this.#Z/100*B.width,G=this.#Q/100*B.height,M=Math.atan2(Z.clientY-B.top-G,Z.clientX-B.left-O)*180/Math.PI,k=Math.round(M);document.body.style.cursor=this.#r(k);let P=(S)=>{let F=$.getBoundingClientRect(),R=this.#Z/100*F.width,W=this.#Q/100*F.height,T=S.clientX-F.left-R,V=S.clientY-F.top-W,H=Math.round(Math.atan2(V,T)*180/Math.PI);if(H!==k)k=H,document.body.style.cursor=this.#r(H);let C=Math.sqrt(T*T+V*V);if(this.#w(S.shiftKey)){let I=this.#$?5:10;if(this.#$){let A=C/F.width*100;A=Math.round(A/I)*I,C=A/100*F.width}else C=Math.round(C/I)*I}if(this.#$)this.#j=this.#N(Math.max(0,C/F.width*100));else this.#j=this.#N(Math.max(0,C));if(this.#K)this.#K.setAttribute("text",this.#a()),this.#OJ(S.clientX,S.clientY);this.#m(),this.#YJ()},N=this.#zJ((S)=>{if(this.#S=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#X)this.#X.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=q,this.#K)this.#K.removeAttribute("show");if(S)this.#g(),this.#$J()});window.addEventListener("pointermove",P,{signal:N.signal}),window.addEventListener("pointerup",()=>N.finish(!0),{signal:N.signal}),window.addEventListener("pointercancel",()=>N.finish(!1),{signal:N.signal})};J.addEventListener("pointerdown",Q),this._radiusDragCleanup=()=>J.removeEventListener("pointerdown",Q)}#bJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#zJ(J){this.#VJ();let Q=new AbortController,Z=!1,$=(j=!1)=>{if(Z)return;if(Z=!0,Q.abort(),this.#f===Q)this.#f=null,this.#c=null;J(j)};return this.#f=Q,this.#c=$,{signal:Q.signal,finish:$}}#VJ(){this.#c?.(!1),this.#f?.abort(),this.#f=null,this.#c=null}}U("fig-canvas-control",zJ);class K extends HTMLElement{#Z=[K.#R()];#Q=0;#J=2;#_=240;#j=120;#$={min:-1,max:1};#O=null;#B=null;#G=null;#X=null;#q=0;#M=null;#Y=null;#k=null;#K=null;#P=[];#L=[];#U=[];#S=[];#T=new Set;#F=null;#W=null;#H=null;#z=null;#V=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#R(J="sine"){return{type:J,frequency:1,amplitude:1,phase:0,offset:0}}static get observedAttributes(){return["value","precision","aspect-ratio","edit","disabled"]}connectedCallback(){if(this.#V===null)this.#V=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify({waves:[K.#R()]});this.#J=this.#D("precision",2),this.#y(this.getAttribute("value")),this.#c(),this.#l(),this.#NJ(),f(this)}disconnectedCallback(){if(this.#FJ(),this.#PJ(),this.#F)this.#F.disconnect(),this.#F=null;D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#y(Z),this.isConnected)this.#l();return}if(J==="precision"){if(this.#J=this.#D("precision",2),this.isConnected)this.#m();return}if(J==="aspect-ratio"){if(this.#c(),this.#B)this.#_J();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#l()}}get value(){return JSON.stringify(this.data)}set value(J){this.setAttribute("value",typeof J==="object"&&J!==null?JSON.stringify(J):J)}get defaultValue(){return this.getAttribute("default")??this.#V??""}get isDefault(){let J=this.#b(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#E(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#g("input"),this.#g("change")}get data(){return{waves:this.#Z.map((J)=>this.#E(J))}}get preset(){let J=this.#C;return K.TYPES.find((Q)=>Q.value===J.type)?.name}#D(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#h(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#I(){return this.getAttribute("edit")!=="false"}#f(){return this.#h("disabled",!1)}#c(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#y(J){let Q=this.#b(J);if(!Q)return!1;if(this.#Z=Q,!this.#Z.length)this.#Z=[K.#R()];return this.#Q=Math.min(this.#Q,this.#Z.length-1),!0}#b(J){if(!J)return null;let Q=null;if(typeof J==="string")try{Q=JSON.parse(J)}catch{return null}else if(typeof J==="object")Q=J;if(!Q)return null;return(Array.isArray(Q)?Q:Array.isArray(Q.waves)?Q.waves:[Q]).map(($)=>this.#x($))}#x(J={}){return{type:this.#e(J.type),frequency:this.#o(J.frequency,1,0.1,16),amplitude:this.#o(J.amplitude,1,-4,4),phase:this.#o(J.phase,0,-360,360),offset:this.#o(J.offset,0,-4,4)}}#E(J){return{type:J.type,frequency:this.#A(J.frequency),amplitude:this.#A(J.amplitude),phase:this.#A(J.phase),offset:this.#A(J.offset)}}get#C(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||K.#R()}#e(J){let Q=String(J||"").toLowerCase();return K.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#o(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#A(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#N(J){return K.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#jJ(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=K.#u(J,q),O=5+q*j,G=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${O.toFixed(1)},${G.toFixed(1)}`}return _}static#w(J,Q=24){return E("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},E("path",{d:K.#jJ(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=K.#jJ(J,Q);return`<svg width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}" fill="none"><path d="${Z}" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>`}static#u(J,Q,Z=0){let $=Q+Z/360,j=$-Math.floor($),_=$*Math.PI*2;switch(J){case"square":return Math.sin(_)>=0?1:-1;case"sawtooth":return j*2-1;case"triangle":return 1-Math.abs(j*4-2);default:return Math.sin(_)}}#l(){if(this.#FJ(),this.#PJ(),this.replaceChildren(...this.#d()),this.#t(),this.#BJ(),this.#_J(),this.#WJ(),!this.#f())this.#XJ();f(this)}#i(J,Q){return E("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},L("div",{className:"propskit-oscillator-handle-inner"},L("fig-tooltip",{text:Q},L("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#d(){let J=this.#I()&&!this.#f(),Q=[E("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#_,height:this.#j}),E("line",{className:"propskit-oscillator-baseline"}),E("path",{className:"propskit-oscillator-path"}),E("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#i("amplitude","Amplitude"),this.#i("frequency","Frequency"));let Z=E("svg",{viewBox:`0 0 ${this.#_} ${this.#j}`,className:"propskit-oscillator-svg"},Q),$=[L("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#I())$.push(L("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#p(j,_,!J))));return $}#p(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#Q,_=K.#N(J.type),X=L("fig-tooltip",{text:"Remove form"},L("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},L("fig-icon",{name:"minus"}))),q=L("fig-header",{borderless:!0},[L("h3",{},_),X,this.#kJ(Z,Q)]),B=L("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#a(Q,"frequency","Frequency",0.1,16,0.1,""),this.#a(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#a(Q,"phase","Phase",-360,360,1,"°"),this.#a(Q,"offset","Offset",-4,4,0.1,"")]);return L("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#T.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#kJ(J,Q){let Z=L("fig-tooltip",{text:"Add form"},L("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},L("fig-icon",{name:"plus"}))),$=K.TYPES.map((j)=>L("fig-menu-item",{value:j.value},[K.#w(j.value,24),L("span",{},j.name)]));return L("fig-menu",{className:"propskit-oscillator-add-type",position:"bottom right","data-wave-index":Q,disabled:J},[Z,$])}#a(J,Q,Z,$,j,_,X){let q=this.#Z[J]||K.#R(),B=Q==="amplitude"||Q==="offset";return L("propskit-slider",{className:"propskit-oscillator-field",label:Z,direction:"horizontal",name:Q,"data-wave-index":J,value:this.#A(q[Q]),min:$,max:j,step:_,precision:this.#J,elastic:"false",type:B?"delta":null,default:B?"0":null,units:X||null,disabled:this.#f()})}#t(){this.#B=this.querySelector(".propskit-oscillator-svg"),this.#G=this.querySelector(".propskit-oscillator-path"),this.#X=this.querySelector(".propskit-oscillator-playhead"),this.#M=this.querySelector(".propskit-oscillator-baseline"),this.#Y=this.querySelector(".propskit-oscillator-bounds"),this.#k=this.querySelector('[data-handle="amplitude"]'),this.#K=this.querySelector('[data-handle="frequency"]'),this.#L=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#P=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#S=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#U=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#JJ(J){let Q=new Set;for(let Z of this.#T)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#T=Q}#v(J){let Q=new Set;for(let Z of this.#T)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#T=Q}#NJ(){if(this.#F||!window.ResizeObserver)return;this.#F=new ResizeObserver(()=>{if(this.#BJ())this.#_J()}),this.#F.observe(this)}#BJ(){if(!this.#B)return!1;let J=this.#B.getBoundingClientRect(),Q=Math.max(1,Math.round(J.width||240)),Z=Math.max(1,Math.round(J.height||120)),$=Q!==this.#_||Z!==this.#j;return this.#_=Q,this.#j=Z,this.#B.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#GJ(){let J=1,Q=256;for(let Z=0;Z<=Q;Z++)J=Math.max(J,Math.abs(this.#n(Z/Q)));return{min:-J,max:J}}#qJ(J){let{min:Q,max:Z}=this.#$;return this.#j-(J-Q)/(Z-Q)*this.#j}#LJ(J){let{min:Q,max:Z}=this.#$;return Q+(1-J/this.#j)*(Z-Q)}#n(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=K.#u(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#_J(){if(!this.#B||!this.#G)return;if(this.#BJ(),this.#$=this.#GJ(),this.#Y)this.#Y.setAttribute("width",this.#_),this.#Y.setAttribute("height",this.#j);let J=Math.max(...this.#Z.map((_)=>_.frequency)),Z=this.#Z.some((_)=>_.type==="square"||_.type==="sawtooth")?Math.max(192,Math.ceil(J*64)):Math.max(96,Math.ceil(J*64)),$="";for(let _=0;_<=Z;_++){let X=_/Z,q=X*this.#_,B=this.#qJ(this.#n(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#G.setAttribute("d",$);let j=this.#qJ(0);this.#M?.setAttribute("x1","0"),this.#M?.setAttribute("y1",j),this.#M?.setAttribute("x2",this.#_),this.#M?.setAttribute("y2",j),this.#SJ()}#XJ(){if(this.#q||!this.#X)return;let J=(Q)=>{if(!this.isConnected||!this.#X){this.#q=0;return}this.#OJ(Q%1000/1000),this.#q=requestAnimationFrame(J)};this.#q=requestAnimationFrame(J)}#PJ(){if(!this.#q)return;cancelAnimationFrame(this.#q),this.#q=0}#OJ(J){if(!this.#X)return;let Q=J*this.#_,Z=this.#qJ(this.#n(J));this.#X.setAttribute("cx",Q.toFixed(1)),this.#X.setAttribute("cy",Z.toFixed(1))}#SJ(){let Q=this.#C,Z=this.#QJ(),$=Math.max(8,Math.min(this.#_-8,this.#_/Q.frequency)),j=this.#qJ(this.#n(Z/this.#_)),_=this.#qJ(this.#n($/this.#_));this.#ZJ(this.#k,Z,j,8),this.#ZJ(this.#K,$,_,8)}#QJ(){let J=this.#C,Q=J.phase/360,Z=Math.max(0.1,J.frequency),$=0.25;if(J.type==="triangle")$=0.5;if(J.type==="sawtooth")$=1;let j=($-Q)/Z;while(j<0)j+=1/Z;while(j>1)j-=1/Z;if(j<0||j>1||!Number.isFinite(j))j=0.25;return Math.max(8,Math.min(this.#_-8,j*this.#_))}#ZJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#WJ(){if(!this.#I()||this.#f())return;for(let Q of this.#L)Q.addEventListener("change",(Z)=>{if(this.#f())return;let $=this.#s(Q);this.#r($),this.#Z[$].type=this.#e(Z.detail??Z.target?.value),this.#m(),this.#g("input"),this.#g("change")});for(let Q of this.#P)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#W=Q;try{this.#KJ(this.#s(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#W=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#KJ(this.#s(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#S)Q.addEventListener("pointerdown",()=>{this.#r(this.#s(Q))}),Q.addEventListener("focusin",()=>{this.#r(this.#s(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#s(Q);if(Z.detail?.open)this.#T.add($);else this.#T.delete($)});for(let Q of this.querySelectorAll(".propskit-oscillator-add-type")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.addEventListener("change",($)=>{if($.target!==Q)return;if(this.#f())return;let _=this.#s(Q)+1,X=this.#e($.detail?.value??Q.value);this.#Z.splice(_,0,K.#R(X)),this.#v(_),this.#Q=_,this.#l(),this.#g("input"),this.#g("change")})}for(let Q of this.querySelectorAll(".propskit-oscillator-add-type-button")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.closest("fig-tooltip")?.addEventListener("pointerdown",Z),Q.closest("fig-tooltip")?.addEventListener("click",Z)}for(let Q of this.querySelectorAll(".propskit-oscillator-remove-button"))Q.addEventListener("pointerdown",(Z)=>{Z.stopPropagation()}),Q.addEventListener("click",(Z)=>{if(Z.stopPropagation(),this.#f()||this.#Z.length<=1)return;let $=this.#s(Q);this.#Z.splice($,1),this.#JJ($),this.#Q=Math.min(this.#Q,this.#Z.length-1),this.#l(),this.#g("input"),this.#g("change")});for(let Q of[this.#k,this.#K])this.#UJ(Q);this.querySelector(".propskit-oscillator-svg-container")?.addEventListener("pointerdown",(Q)=>{if(this.#f())return;if(Q.target?.closest?.(".propskit-oscillator-handle, fig-handle"))return;this.#MJ(Q,"offset")})}#s(J){let Q=Number.parseInt(J?.getAttribute("data-wave-index")||"",10);return Number.isFinite(Q)?Math.min(this.#Z.length-1,Math.max(0,Q)):0}#UJ(J){let Q=J?.querySelector("fig-handle"),Z=J?.getAttribute("data-handle");if(!Q||!Z)return;Q.addEventListener("pointerdown",($)=>{if(this.#f())return;$.preventDefault(),$.stopImmediatePropagation(),this.#MJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#f())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#HJ($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#r(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#Q)return;this.#Q=Q,this.#fJ(),this.#SJ()}#KJ(J,Q,Z,$){if(this.#f())return;this.#r(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#$J();return}this.#Z[J]=this.#x({...this.#Z[J],[Q]:j}),this.#m({skipFieldSync:$=="input"}),this.#g($)}#HJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#C;switch(Q){case"amplitude":if(J.key==="ArrowUp")$.amplitude+=Z;else if(J.key==="ArrowDown")$.amplitude-=Z;else if(J.key==="Home")$.amplitude=-4;else if(J.key==="End")$.amplitude=4;else return!1;break;case"offset":if(J.key==="ArrowUp")$.offset+=Z;else if(J.key==="ArrowDown")$.offset-=Z;else if(J.key==="Home")$.offset=-4;else if(J.key==="End")$.offset=4;else return!1;break;case"frequency":if(J.key==="ArrowLeft")$.frequency-=Z;else if(J.key==="ArrowRight")$.frequency+=Z;else if(J.key==="Home")$.frequency=0.1;else if(J.key==="End")$.frequency=16;else return!1;break;default:return!1}return this.#Z[this.#Q]=this.#x($),this.#m(),this.#g("input"),this.#g("change"),!0}#TJ(J){let Q=this.#B?.getScreenCTM();if(!Q)return{x:0,y:0};let Z=Q.inverse();return{x:Z.a*J.clientX+Z.c*J.clientY+Z.e,y:Z.b*J.clientX+Z.d*J.clientY+Z.f}}#MJ(J,Q){this.#FJ(),this.#O=Q,this.#B?.classList.add("dragging");let Z=Q==="frequency"?"ew-resize":Q==="amplitude"?"ns-resize":"",$=document.body.style.cursor;if(Z)document.body.style.cursor=Z;let j=(q)=>{if(!this.#O)return;let B=this.#TJ(q),O=this.#C;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#_,B.x));O.frequency=this.#_/G}else if(Q==="offset"){let G=this.#o(B.x/this.#_,0,0,1),M=this.#RJ(O,G);O.offset=this.#LJ(B.y)-this.#CJ(this.#Q,G)-M*O.amplitude}else if(Q==="amplitude"){let G=this.#o(B.x/this.#_,0,0,1),M=this.#RJ(O,G),k=this.#LJ(B.y)-this.#CJ(this.#Q,G)-O.offset;O.amplitude=Math.abs(M)<0.001?O.amplitude:k/M}this.#Z[this.#Q]=this.#x(O),this.#m(),this.#g("input")},_=new AbortController,X=(q=!1)=>{if(this.#O=null,this.#B?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#H===_)this.#H=null,this.#z=null;if(q)this.#g("change")};this.#H=_,this.#z=X,document.addEventListener("pointermove",j,{signal:_.signal}),document.addEventListener("pointerup",()=>X(!0),{signal:_.signal}),document.addEventListener("pointercancel",()=>X(!1),{signal:_.signal}),window.addEventListener("blur",()=>X(!1),{signal:_.signal})}#FJ(){this.#z?.(!1),this.#H?.abort(),this.#H=null,this.#z=null,this.#O=null,this.#B?.classList.remove("dragging")}#CJ(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=K.#u($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#RJ(J,Q){return K.#u(J.type,Q*J.frequency,J.phase)}#m({skipFieldSync:J=!1}={}){if(this.#YJ(),!J)this.#$J();this.#fJ(),this.#_J()}#YJ(){for(let J of this.#L){let Q=this.#s(J);J.value=this.#Z[Q]?.type||"sine"}}#$J(){for(let J of this.#P){if(J===this.#W)continue;let Q=this.#s(J),Z=J.getAttribute("name"),$=this.#A(this.#Z[Q]?.[Z]??0),j=J.querySelector("fig-slider");if(j)j.value=$;else J.setAttribute("value",String($))}}#fJ(){for(let J of this.#U)if(this.#s(J)===this.#Q)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#g(J){this.dispatchEvent(new CustomEvent(J,{bubbles:!0,detail:{value:this.value,data:this.data,preset:K.#N(this.#C.type)}}))}}U("propskit-oscillator",K);class WJ extends HTMLElement{#Z;#Q;#J=null;#_;#j;#$;#O;#B;#G;#X;#q=null;#M=null;constructor(){super();this.angle=0,this.#Z=1,this.#Q=0,this.isDragging=!1,this.isShiftHeld=!1,this.handle=null,this.angleInput=null,this.plane=null,this.units="°",this.min=null,this.max=null,this.dial=!0,this.showRotations=!1,this.rotationSpan=null,this.#_=this.#h.bind(this),this.#j=this.#e.bind(this),this.#$=this.#o.bind(this),this.#O=this.#jJ.bind(this),this.#B=this.#w.bind(this),this.#G=this.#I.bind(this),this.#X=this.#N.bind(this)}connectedCallback(){requestAnimationFrame(()=>{if(!this.isConnected)return;this.precision=this.getAttribute("precision")||1,this.precision=parseInt(this.precision),this.text=this.getAttribute("text")==="true";let J=this.getAttribute("units")||"°";if(J==="deg")J="°";if(this.units=J,this.min=this.hasAttribute("min")?Number(this.getAttribute("min")):null,this.max=this.hasAttribute("max")?Number(this.getAttribute("max")):null,this.dial=this.#k("dial",!0),this.showRotations=this.#K(),this.#Y(),this.#R(),this.#C(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#A(),this.#D()}#Y(){this.#A(),this.#D();let J=this.#W(),Q=this.#L(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#z(0),j=this.max??this.#z(360),_=[];if(this.dial)_.push(L("div",{className:"fig-input-angle-plane",role:"slider",tabindex:Q?"-1":"0","aria-label":Z,"aria-valuemin":$,"aria-valuemax":j,"aria-valuenow":this.angle,"aria-valuetext":`${this.angle.toFixed(this.precision)}${this.units}`,"aria-disabled":Q?"true":null},L("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(L("fig-input-number",{name:"angle",step:J,value:this.angle,min:this.min,max:this.max,units:this.units,"aria-label":Z,disabled:Q},this.showRotations?L("span",{slot:"append",className:"fig-input-angle-rotations"}):null));this.replaceChildren(..._)}#k(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#K(){if(this.hasAttribute("rotations"))return this.#k("rotations",!1);if(this.hasAttribute("show-rotations"))return this.#k("show-rotations",!1);return!1}#P(){let J=Math.abs(this.#H(this.angle));return Math.floor(J/360)}#L(){return Y(this,"disabled")}#U(J){let Q=Number(J);if(!Number.isFinite(Q))return this.angle;if(this.min!==null&&Number.isFinite(this.min))Q=Math.max(this.min,Q);if(this.max!==null&&Number.isFinite(this.max))Q=Math.min(this.max,Q);return Q}#S(J,{reflect:Q=!0}={}){let Z=this.#U(J);if(this.angle=Z,this.#f(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#C(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#T(),this.#F()}#T(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#F(){if(!this.rotationSpan)return;let J=this.#P();if(J>1)this.rotationSpan.textContent=`×${J}`,this.rotationSpan.style.display="";else this.rotationSpan.textContent="",this.rotationSpan.style.display="none"}#W(){switch(this.units){case"rad":return 0.01;case"turn":return 0.001;default:return 0.1}}#H(J){switch(this.units){case"rad":return J*180/Math.PI;case"turn":return J*360;default:return J}}#z(J){switch(this.units){case"rad":return J*Math.PI/180;case"turn":return J/360;default:return J}}#V(J,Q,Z){let $;switch(Q){case"rad":$=J*180/Math.PI;break;case"turn":$=J*360;break;default:$=J}switch(Z){case"rad":return $*Math.PI/180;case"turn":return $/360;default:return $}}#R(){if(this.handle=this.querySelector(".fig-input-angle-handle"),this.plane=this.querySelector(".fig-input-angle-plane"),this.angleInput=this.querySelector("fig-input-number[name='angle']"),this.rotationSpan=this.querySelector(".fig-input-angle-rotations"),this.#F(),this.plane?.addEventListener("mousedown",this.#j),this.plane?.addEventListener("touchstart",this.#$),this.plane?.addEventListener("keydown",this.#X),window.addEventListener("keydown",this.#O),window.addEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#G),this.angleInput.addEventListener("change",this.#G);this.addEventListener("change",this.#_,!0)}#D(){if(this.plane?.removeEventListener("mousedown",this.#j),this.plane?.removeEventListener("touchstart",this.#$),this.plane?.removeEventListener("keydown",this.#X),window.removeEventListener("keydown",this.#O),window.removeEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#G),this.angleInput.removeEventListener("change",this.#G);this.removeEventListener("change",this.#_,!0)}#h(J){if(!J.target?.matches?.("input"))return;let Z=J.target.value.match(/^(-?\d*\.?\d+)\s*(turn|rad|deg|°)$/i);if(Z){let $=parseFloat(Z[1]),j=Z[2].toLowerCase();if(j==="deg")j="°";if(j!==this.units){let _=this.#V($,j,this.units);J.target.value=String(_)}}}#I(J){if(J.stopPropagation(),this.#L())return;if(this.#S(Number(J.target.value)),J.type==="change")this.#E();else this.#x()}#f(){let Q=this.#H(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#Q=Math.sin(Q)}#c(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#y(J){let Q=this.plane.getBoundingClientRect(),Z=Q.left+Q.width/2,$=Q.top+Q.height/2,j=J.clientX-Z,_=J.clientY-$;return Math.atan2(_,j)*180/Math.PI}#b(J){let Z=(this.#y(J)%360+360)%360;if(Z=this.#c(Z),this.min!==null||this.max!==null)this.angle=this.#U(this.#z(Z));else if(this.#J===null){this.#J=Z;let _=(this.#H(this.angle)%360+360)%360,X=Z-_;if(X>180)X-=360;if(X<-180)X+=360;this.angle=this.#U(this.angle+this.#z(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#U(this.angle+this.#z(j)),this.#J=Z}if(this.#f(),this.setAttribute("value",String(this.angle)),this.#C(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#F(),this.#T(),this.#x()}#x(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#E(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#C(){if(this.handle){let Q=this.#H(this.angle)*Math.PI/180,Z=this.plane.offsetWidth/2-this.handle.offsetWidth/2,$=Math.cos(Q)*Z,j=Math.sin(Q)*Z;this.handle.style.transform=`translate(${$}px, ${j}px)`}}#e(J){if(this.#L()||J.button!==0)return;this.#A(),this.isDragging=!0,this.#J=null,this.#b(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#b(j)},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#q===Z)this.#q=null,this.#M=null;if(j)this.#E()};this.#q=Z,this.#M=$,window.addEventListener("mousemove",Q,{signal:Z.signal}),window.addEventListener("mouseup",()=>$(!0),{signal:Z.signal}),window.addEventListener("blur",()=>$(!1),{signal:Z.signal})}#o(J){if(this.#L())return;J.preventDefault(),this.#A(),this.isDragging=!0,this.#J=null,this.#b(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#b(j.touches[0])},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#q===Z)this.#q=null,this.#M=null;if(j)this.#E()};this.#q=Z,this.#M=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#A(){this.#M?.(!1),this.#q?.abort(),this.#q=null,this.#M=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#N(J){if(this.#L())return;let Q=this.#W()*(J.shiftKey?10:1),Z=this.angle;if(J.key==="ArrowLeft"||J.key==="ArrowDown")Z-=Q;else if(J.key==="ArrowRight"||J.key==="ArrowUp")Z+=Q;else if(J.key==="Home")Z=this.min??this.#z(0);else if(J.key==="End")Z=this.max??this.#z(360);else return;J.preventDefault(),J.stopPropagation(),this.#S(Z),this.#x(),this.#E()}#jJ(J){if(J.key==="Shift")this.isShiftHeld=!0}#w(J){if(J.key==="Shift")this.isShiftHeld=!1}focus(){this.plane?.focus()}static get observedAttributes(){return["value","precision","text","min","max","units","dial","rotations","show-rotations","disabled","aria-label","name"]}get value(){return this.angle}get adjacent(){return this.#Z}get opposite(){return this.#Q}set value(J){if(isNaN(J)){console.error("Invalid value: must be a number.");return}this.#S(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#S(Number(Z),{reflect:!1});break;case"precision":this.precision=parseInt(Z);break;case"text":if(Z!==Q){if(this.text=Z?.toLowerCase()==="true",this.isConnected)this.#Y(),this.#R(),this.#C()}break;case"dial":if(this.dial=this.#k("dial",!0),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#Y(),this.#R(),this.#C();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#S(this.angle),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#S(this.angle),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"disabled":if(this.#A(),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"aria-label":case"name":if(this.isConnected)this.#Y(),this.#R(),this.#C();break;case"rotations":case"show-rotations":if(this.showRotations=this.#K(),this.isConnected)this.#Y(),this.#R(),this.#C();break}}}U("fig-input-angle",WJ);class h extends HTMLElement{static observedAttributes=["axis","handle","disabled"];static#Z=6;static#Q=['[draggable]:not([draggable="false"])','img:not([draggable="false"])','a[href]:not([draggable="false"])','input[type="range"]',"fig-handle","fig-slider","fig-input-number","fig-input-gradient","fig-easing-curve","fig-input-angle","fig-input-wheel","fig-input-joystick","fig-canvas-control","propskit-color-point","propskit-number","propskit-point-point","propskit-point-radius","propskit-point-radius-angle","propskit-position","propskit-slider","propskit-oscillator"];#J=null;#_=new Map;#j=null;#$=null;#O=null;connectedCallback(){if(this.style.display="contents",!this.hasAttribute("role"))this.setAttribute("role","list");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Reorderable list");this.#T(),this.#M(),this.#J=new MutationObserver(()=>this.#M()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#E(),this.#C(),this.#c(),this.#O?.remove(),this.#O=null}attributeChangedCallback(){if(this.isConnected){if(this.#B)this.#C();this.#M()}}get#B(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#G(){return(this.getAttribute("axis")||"vertical").trim().toLowerCase()==="horizontal"?"horizontal":"vertical"}get#X(){return(this.getAttribute("handle")||"").trim()}#q(){return[...this.children].filter((J)=>J.nodeType===Node.ELEMENT_NODE&&!J.hasAttribute("data-reorder-live"))}#M(){let J=this.#q(),Q=new Set(J);for(let[Z,$]of this.#_)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#S($),this.#_.delete(Z);if(this.#K(J),this.#Y(J),this.#B||J.length<2){this.#E();return}for(let Z of J){let $=this.#L(Z),j=this.#_.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#_.delete(Z);if(!$)continue;this.#U(Z,$)}this.#P(J),this.#k(J)}#Y(J){for(let Q of J)if(Q.removeAttribute("data-reorder-item"),Q.hasAttribute("data-reorder-generated-role"))Q.removeAttribute("role"),Q.removeAttribute("data-reorder-generated-role")}#k(J){for(let Q of J)if(Q.setAttribute("data-reorder-item",""),!Q.hasAttribute("role"))Q.setAttribute("role","listitem"),Q.setAttribute("data-reorder-generated-role","")}#K(J){for(let Q of J)Q.querySelectorAll("[data-reorder-handle]").forEach((Z)=>{Z.removeAttribute("data-reorder-handle"),Z.removeAttribute("aria-roledescription")})}#P(J){if(!this.#X)return;for(let Q of J){let Z=Q.querySelector(this.#X);if(Z)Z.setAttribute("data-reorder-handle",""),Z.setAttribute("aria-roledescription","reorder handle")}}#L(J){if(this.#X)return J.querySelector(this.#X);return J}#U(J,Q){let Z=(B)=>{if(this.#B||this.#q().length<2)return;if(B.button!==0)return;if(!this.#X&&this.#W(B.target,J))return;this.#V(B,J,Q)},$=Q.getAttribute("tabindex"),j=Q.getAttribute("aria-label"),_=Q.getAttribute("role"),X=J.getAttribute("aria-label")||J.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";if(Q.setAttribute("tabindex","0"),Q.setAttribute("aria-label",`Move ${X}`),Q!==J&&!Q.hasAttribute("role"))Q.setAttribute("role","button");let q=(B)=>{if(this.#B)return;let O=this.#G==="horizontal",G=O?"ArrowLeft":"ArrowUp",M=O?"ArrowRight":"ArrowDown";if(B.key!==G&&B.key!==M&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let k=this.#q(),P=k.indexOf(J),N=P;if(B.key===G)N=Math.max(0,P-1);else if(B.key===M)N=Math.min(k.length-1,P+1);else if(B.key==="Home")N=0;else if(B.key==="End")N=k.length-1;if(N===P){this.#F(`${X}, position ${P+1} of ${k.length}`);return}this.#b(J,N),this.#M(),this.#L(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:P,newIndex:N,item:J}})),this.#F(`${X}, position ${N+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#_.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#S(J){let{target:Q,originalTabIndex:Z,originalAriaLabel:$,originalRole:j}=J;if(Z===null)Q.removeAttribute("tabindex");else Q.setAttribute("tabindex",Z);if($===null)Q.removeAttribute("aria-label");else Q.setAttribute("aria-label",$);if(j===null)Q.removeAttribute("role");else Q.setAttribute("role",j)}#T(){if(this.#O?.isConnected)return;let J=document.createElement("span");J.setAttribute("data-reorder-live",""),J.setAttribute("role","status"),J.setAttribute("aria-live","polite"),J.setAttribute("aria-atomic","true"),Object.assign(J.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),this.#O=J,document.body.appendChild(J)}#F(J){if(!this.#O)return;this.#O.textContent="",requestAnimationFrame(()=>{if(this.#O)this.#O.textContent=J})}#W(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of h.#Q)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#H="fig-reorder-dragging";static#z(J){document.body.classList.toggle(h.#H,J)}#V(J,Q,Z){this.#C();let $={item:Q,target:Z,pointerId:J.pointerId,oldIndex:this.#q().indexOf(Q),targetIndex:this.#q().indexOf(Q),startX:J.clientX,startY:J.clientY,active:!1,onMove:null,onUp:null,onKeyDown:null};$.onMove=(j)=>{if(j.pointerId!==$.pointerId)return;let _=j.clientX-$.startX,X=j.clientY-$.startY;if(!$.active){if(_*_+X*X<h.#Z*h.#Z)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),h.#z(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#G==="horizontal"?j.clientX:j.clientY,B=this.#R(q);$.targetIndex=B,this.#f(B,Q)},$.onKeyDown=(j)=>{if(j.key!=="Escape"||!$.active)return;j.preventDefault(),this.#x($,!0)},$.onUp=(j)=>{if(j.pointerId!==$.pointerId)return;this.#x($,j.type==="pointercancel")},this.#j=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#R(J){let Q=this.#q(),Z=this.#G==="horizontal";for(let $=0;$<Q.length;$++){let j=Q[$].getBoundingClientRect(),_=Z?j.left+j.width/2:j.top+j.height/2;if(J<_)return $}return Q.length}#D(J,Q){let Z=this.#q(),$=Z.indexOf(J);if($===-1)return!1;let j=Math.max(0,Math.min(Q,Z.length));if(Q===$)return!1;if(j>=Z.length&&$===Z.length-1)return!1;return!0}#h(J){if(!J.length)return null;let Q=1/0,Z=-1/0,$=1/0,j=-1/0;for(let _ of J){let X=_.getBoundingClientRect();Q=Math.min(Q,X.left),Z=Math.max(Z,X.right),$=Math.min($,X.top),j=Math.max(j,X.bottom)}return{left:Q,top:$,width:Z-Q,height:j-$}}#I(){if(this.#$)return this.#$;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#G),document.body.appendChild(J),this.#$=J,J}#f(J,Q){let Z=this.#q();if(!this.#D(Q,J)){this.#c();return}let $=this.#h(Z);if(!$){this.#c();return}let j=this.#I();if(j.setAttribute("data-axis",this.#G),this.#G==="horizontal"){let X;if(J<=0)X=Z[0].getBoundingClientRect().left;else if(J>=Z.length)X=Z[Z.length-1].getBoundingClientRect().right;else X=Z[J].getBoundingClientRect().left;j.style.left=`${X-1}px`,j.style.top=`${$.top}px`,j.style.width="2px",j.style.height=`${$.height}px`;return}let _;if(J<=0)_=Z[0].getBoundingClientRect().top;else if(J>=Z.length)_=Z[Z.length-1].getBoundingClientRect().bottom;else _=Z[J].getBoundingClientRect().top;j.style.left=`${$.left}px`,j.style.top=`${_-1}px`,j.style.width=`${$.width}px`,j.style.height="2px"}#c(){this.#$?.remove(),this.#$=null}#y(J,Q){let Z=this.#q(),$=Math.max(0,Math.min(Q,Z.length));if($>=Z.length){if(Z[Z.length-1]!==J)this.appendChild(J);return}let j=Z[$];if(j!==J)this.insertBefore(J,j)}#b(J,Q){let $=this.#q().filter((j)=>j!==J)[Q]??null;if($)this.insertBefore(J,$);else this.appendChild(J)}#x(J,Q){let{item:Z,oldIndex:$,active:j,onMove:_,onUp:X,onKeyDown:q}=J;if(window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",X),window.removeEventListener("pointercancel",X),window.removeEventListener("keydown",q),j){if(!Q){this.#y(Z,J.targetIndex);let B=this.#q().indexOf(Z);if(B!==-1&&B!==$){this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:$,newIndex:B,item:Z}}));let O=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#F(`${O}, position ${B+1} of ${this.#q().length}`)}}}if(Z.classList.remove("dragging"),h.#z(!1),this.#c(),this.#j===J)this.#j=null}#E(){for(let[,J]of this.#_)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#S(J);this.#_.clear()}#C(){if(!this.#j)return;this.#x(this.#j,!0)}}U("fig-reorder",h);
1
+ function L(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function O(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var qJ="http://www.w3.org/2000/svg";function OJ(J,Q){let Z=($)=>{if($===null||$===void 0||$===!1)return;if(Array.isArray($)){$.forEach(Z);return}J.append($ instanceof Node?$:String($))};return Z(Q),J}function YJ(J,Q={}){for(let[Z,$]of Object.entries(Q)){if($===null||$===void 0||$===!1)continue;if(Z==="className")if(J.namespaceURI===qJ)J.setAttribute("class",String($));else J.className=String($);else if($===!0)J.setAttribute(Z,"");else J.setAttribute(Z,String($))}return J}function N(J,Q,Z){let $=document.createElement(J);return YJ($,Q),OJ($,Z)}function h(J,Q,Z){let $=document.createElementNS(qJ,J);return YJ($,Q),OJ($,Z)}function n(J,Q){let Z=O(J,"disabled");for(let $ of Q)$?.toggleAttribute("disabled",Z)}function xJ(J,Q,Z){let $=Number(Q),j=Number(Z),_=Number.isFinite($)?Math.max(0,Math.min(1,$)):Number.isFinite(j)?Math.max(0,Math.min(100,j))/100:1,X=Number.isFinite(j)?Math.max(0,Math.min(100,j)):Math.round(_*100);return{color:J,alpha:_,opacity:X}}var $J=new WeakMap;function W(J){let Q=$J.get(J);if(!Q){let Z=document.createElement("fig-menu");Z.setAttribute("position","bottom left"),Z.setAttribute("offset","0 0");let $=document.createElement("fig-menu-item");$.setAttribute("value","reset-default"),$.textContent="Reset",Z.appendChild($);let j=0,_=()=>{if(j)clearTimeout(j),j=0;window.removeEventListener("pointerup",X,!0),window.removeEventListener("pointercancel",X,!0)},X=()=>{_();let Y=Q?.point;if(Y)Z.showAt?.(Y.x,Y.y)};Q={menu:Z,point:null,clearPendingOpen:_,handleContextMenu:(Y)=>{if(O(J,"disabled")||Y.target?.closest?.("fig-menu"))return;Y.preventDefault(),Y.stopPropagation(),Y.stopImmediatePropagation?.(),Q.point={x:Y.clientX,y:Y.clientY},_(),window.addEventListener("pointerup",X,{once:!0,capture:!0}),window.addEventListener("pointercancel",X,{once:!0,capture:!0}),j=window.setTimeout(X,180)},handleChange:(Y)=>{if(Y.stopPropagation(),Y.detail?.value==="reset-default")J.resetToDefault?.()}},$J.set(J,Q)}if(Q.menu.parentElement!==J)J.appendChild(Q.menu);J.removeEventListener("contextmenu",Q.handleContextMenu),J.addEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange),Q.menu.addEventListener("change",Q.handleChange)}function f(J){let Q=$J.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function hJ(J,Q=J.value){let Z={control:J.localName,value:Q},$=J.getAttribute("name");if($!==null&&$!=="")Z.name=$;return Z}function K(J,Q,Z=J.value){J.dispatchEvent(new CustomEvent(Q,{detail:hJ(J,Z),bubbles:!0,cancelable:!0,composed:!0}))}function d(J){if(J===null||J===void 0||String(J).trim()==="")return null;let Q=Number(J);return Number.isFinite(Q)?Q:null}function b(J){for(let Q of["input","change"])K(J,Q)}function o(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function m(J,Q){let Z=($)=>{if(Array.isArray($))return $.map(Z);if($&&typeof $==="object")return Object.keys($).sort().reduce((j,_)=>{return j[_]=Z($[_]),j},{});return $};try{let $=typeof J==="string"?JSON.parse(J):J,j=typeof Q==="string"?JSON.parse(Q):Q;return JSON.stringify(Z($))===JSON.stringify(Z(j))}catch{return o(J,Q)}}function wJ(J,Q,Z=0.179){if(!J||!Q)return null;let $=document.createElement("span");$.style.cssText="position:absolute;visibility:hidden;pointer-events:none;color:"+Q,J.appendChild($);let j=getComputedStyle($).color;$.remove();let _=j.match(/[\d.]+/g)?.slice(0,3).map(Number),X=j.startsWith("rgb")?_:j.startsWith("color(srgb")&&_?_.map((M)=>M*255):null;if(!X||X.length<3||X.some(Number.isNaN))return null;let[q,B,Y]=X.map((M)=>{let k=M/255;return k<=0.04045?k/12.92:((k+0.055)/1.055)**2.4});return 0.2126*q+0.7152*B+0.0722*Y<=Z?"light":"dark"}var XJ=0;function GJ(J="fig-lab"){return XJ+=1,`${J}-${XJ}`}class S extends HTMLElement{get name(){return this.getAttribute("name")??""}set name(J){if(J===null||J===void 0||J==="")this.removeAttribute("name");else this.setAttribute("name",String(J))}}function C(J,Q,Z,$=!1){if(!Q||!Z)return null;let j=J.hasAttribute("label"),_=J.getAttribute("label")??"",X=j&&_.trim()==="";if(!$)Z.textContent=j?_:"Label";if(J.toggleAttribute("data-label-empty",X),X)return Z.remove(),null;if(!Z.id)Z.id=GJ(`${J.localName}-label`);if(Z.parentElement!==Q)Q.prepend(Z);return Z.id}function R(J,Q,Z,$="Label"){if(!Q)return;let j=J.getAttribute("aria-label")?.trim();if(j)Q.setAttribute("aria-label",j),Q.removeAttribute("aria-labelledby");else if(Z)Q.setAttribute("aria-labelledby",Z),Q.removeAttribute("aria-label");else Q.setAttribute("aria-label",$),Q.removeAttribute("aria-labelledby")}class MJ extends HTMLElement{}L("fig-ai-prompt",MJ);class kJ extends HTMLElement{}L("fig-ai-context",kJ);class NJ extends HTMLElement{}L("fig-chat-message",NJ);class PJ extends HTMLElement{#Z=null;#$=null;#J=null;#Q=null;#_=null;#j=null;#Y=this.#K.bind(this);#B=this.#U.bind(this);#M=this.#N.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#$)this.#X();this.#_.removeEventListener("click",this.#Y),this.#_.addEventListener("click",this.#Y),this.#q(),this.#O()}disconnectedCallback(){this.#_?.removeEventListener("click",this.#Y),this.#G()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;this.#O()}#X(){this.#Z=document.createElement("fig-tooltip"),this.#Z.className="fig-attachment-tooltip",this.#$=document.createElement("fig-image"),this.#$.setAttribute("aspect-ratio","1/1"),this.#$.setAttribute("fit","cover"),this.#$.setAttribute("full",""),this.#J=document.createElement("span"),this.#J.className="fig-attachment-fallback",this.#J.setAttribute("aria-hidden","true"),this.#Q=document.createElement("fig-tooltip"),this.#Q.className="fig-attachment-remove-tooltip",this.#Q.setAttribute("text","Remove attachment"),this.#_=document.createElement("fig-button"),this.#_.className="fig-attachment-remove",this.#_.setAttribute("variant","overlay"),this.#_.setAttribute("size","small"),this.#_.setAttribute("icon","");let J=document.createElement("fig-icon");J.setAttribute("name","close"),J.setAttribute("size","small"),this.#_.append(J),this.#Q.append(this.#_),this.#$.append(this.#J),this.#Z.append(this.#$),this.replaceChildren(this.#Z,this.#Q),this.#_.addEventListener("click",this.#Y),this.#q()}#q(){let J=this.#$?.mediaEl;if(!J||J===this.#j)return;this.#G(),this.#j=J,this.#j.addEventListener("load",this.#B),this.#j.addEventListener("error",this.#M)}#G(){if(!this.#j)return;this.#j.removeEventListener("load",this.#B),this.#j.removeEventListener("error",this.#M),this.#j=null}#O(){let J=this.getAttribute("src")||"",Q=this.getAttribute("name")||"Attachment",Z=!this.hasAttribute("removable")||O(this,"removable"),$=O(this,"disabled");if(this.#Z.setAttribute("text",Q),this.#$.setAttribute("alt",Q),J)this.#$.setAttribute("src",J);else this.#$.removeAttribute("src");if(this.#q(),this.#J.textContent=this.#k(Q),this.#_.hidden=!Z,this.#_.toggleAttribute("disabled",$),this.#_.setAttribute("aria-label",`Remove ${Q}`),this.toggleAttribute("data-fallback",!J),$)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled")}#k(J){let Q=J.split(/[\\/]/).pop()||"",Z=Q.lastIndexOf(".");return(Z>0&&Z<Q.length-1?Q.slice(Z+1).toUpperCase():"FILE").slice(0,4)}#U(){if(this.getAttribute("src"))this.removeAttribute("data-fallback")}#N(){this.setAttribute("data-fallback","")}#K(J){if(J.stopPropagation(),O(this,"disabled")||this.hasAttribute("removable")&&!O(this,"removable"))return;this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.getAttribute("value"),name:this.getAttribute("name")||"",src:this.getAttribute("src")||"",attachment:this}}))}}L("fig-attachment",PJ);class LJ extends HTMLElement{#Z=null;connectedCallback(){if(!this.hasAttribute("role"))this.setAttribute("role","list"),this.setAttribute("data-generated-role","");if(this.#$(),!this.#Z)this.#Z=new MutationObserver(()=>this.#$()),this.#Z.observe(this,{childList:!0})}disconnectedCallback(){this.#Z?.disconnect(),this.#Z=null}#$(){for(let J of this.querySelectorAll(":scope > fig-attachment"))if(!J.hasAttribute("role"))J.setAttribute("role","listitem"),J.setAttribute("data-generated-role","")}}L("fig-attachments",LJ);class UJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#T.bind(this);#X=!1;static get observedAttributes(){return["label","aria-label","variant"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#k(),this.#N(),this.#K(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#N()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#P(),this.removeEventListener("click",this.#M),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="variant")this.#N();else if(J==="label"||J==="aria-label")this.#k()}#q(){this.#X=O(this,"checked");let Q=Array.from(this.childNodes).filter((j)=>j.nodeType!==Node.TEXT_NODE||Boolean(j.textContent?.trim())).find((j)=>j.nodeType===Node.ELEMENT_NODE&&j.matches("label")),Z=N("div",{className:"propskit-switch-surface"}),$=Q||document.createElement("label");Z.append($),this.#Z=Z,this.#$=$,this.#Q=Boolean(Q),this.replaceChildren(Z),this.#O()}#G(){return this.getAttribute("variant")==="segmented-control"?"segmented-control":"switch"}#O(){let J=this.#G()==="segmented-control"?"fig-segmented-control":"fig-switch";if(this.#J?.localName===J)return;this.#P(),this.#J?.remove();let Q=document.createElement(J);if(J==="fig-segmented-control"){let Z=document.createElement("fig-segment"),$=document.createElement("fig-segment");Q.setAttribute("sizing","equal"),Z.setAttribute("value","off"),Z.textContent="Off",$.setAttribute("value","on"),$.textContent="On",Q.append(Z,$)}if(this.#J=Q,this.#j.clear(),this.#Z?.append(Q),this.isConnected)this.#K()}#k(){let J=C(this,this.#Z,this.#$,this.#Q);if(R(this,this.#J,J,"Switch"),this.#J?.localName==="fig-switch"&&this.#J.input)R(this,this.#J.input,J,"Switch")}#U(){let J=new Set(["label","direction","size","aria-label","oninput","onchange","class","style","id","checked","value","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#N(){if(this.#O(),!this.#J)return;let J=this.#U(),Q=new Set(J);for(let $ of this.#j)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=O(this,"checked");if(this.#J.localName==="fig-switch")this.#J.checked=Z,this.#J.value=Z?"on":"off";else this.#J.setAttribute("value",Z?"on":"off");this.#j=Q,this.#k()}#K(){if(!this.#J)return;this.#Y??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.localName==="fig-switch"?Boolean(this.#J.checked):this.#J?.value==="on";this.toggleAttribute("checked",Z),K(this,J)}#T(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-switch, fig-segmented-control, fig-menu"))return;if(this.#J?.localName==="fig-switch")this.#J.click();else{let Q=this.#J?.value==="on"?"off":"on";this.#J?.querySelector(`fig-segment[value="${Q}"]`)?.click()}}get checked(){if(!this.#J)return O(this,"checked");return this.#J.localName==="fig-switch"?Boolean(this.#J.checked):this.#J.value==="on"}set checked(J){let Q=Boolean(J);if(this.toggleAttribute("checked",Q),!this.#J)return;if(this.#J.localName==="fig-switch")this.#J.checked=Q,this.#J.value=Q?"on":"off";else this.#J.value=Q?"on":"off"}get value(){return this.checked}set value(J){let Q=typeof J==="string"?!["","false","off","0"].includes(J.trim().toLowerCase()):Boolean(J);this.checked=Q}get defaultValue(){return this.hasAttribute("default")?O(this,"default"):this.#X}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,b(this)}focus(J){if(this.#J?.localName==="fig-switch")this.#J.focus(J);else(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}L("propskit-switch",UJ);function v(J){let Q=String(J??"").trim();if(/^#[0-9a-fA-F]{8}$/.test(Q))return{color:Q.slice(0,7),alpha:parseInt(Q.slice(7,9),16)/255};if(/^#[0-9a-fA-F]{6}$/.test(Q))return{color:Q,alpha:1};if(/^#[0-9a-fA-F]{3}$/.test(Q))return{color:`#${Q[1]}${Q[1]}${Q[2]}${Q[2]}${Q[3]}${Q[3]}`,alpha:1};return{color:Q||"#D9D9D9",alpha:1}}function pJ(J){let{color:Q,alpha:Z}=v(J);return JSON.stringify({type:"solid",color:Q,alpha:Z})}function ZJ(J){return`url("${String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}")`}function gJ(J){let Q=String(J??"").trim();if(!Q||Q.startsWith("{")||Q.startsWith("#"))return!1;if(Q.startsWith("data:video/"))return!0;try{let Z=new URL(Q,"https://fig.local").pathname;return/\.(mp4|webm|mov|m4v|ogv)$/i.test(Z)}catch{return/\.(mp4|webm|mov|m4v|ogv)(?:[?#]|$)/i.test(Q)}}function cJ(J){return{type:"video",video:{url:J,scaleMode:"fill",scale:50}}}function u(J){if(J&&typeof J==="object")return J;let Q=String(J??"").trim();if(!Q)return{type:"solid",color:"#D9D9D9",alpha:1};if(Q.startsWith("{"))try{let Z=JSON.parse(Q);if(Z&&typeof Z==="object")return Z}catch{}if(Q.startsWith("#")){let{color:Z,alpha:$}=v(Q);return{type:"solid",color:Z,alpha:$}}if(gJ(Q))return cJ(Q);return{type:"solid",color:"#D9D9D9",alpha:1}}function i(J){if(J==null)return"";return typeof J==="string"?J:JSON.stringify(J)}function mJ(J){if(!J)return"";let Q=[...J.stops||[]].sort((Z,$)=>(Z.position??0)-($.position??0)).map((Z)=>`${Z.color} ${Z.position??0}%`).join(", ");if(!Q)return"";switch(J.type){case"radial":return`radial-gradient(circle, ${Q})`;case"angular":return`conic-gradient(from ${J.angle||0}deg, ${Q})`;default:return`linear-gradient(${J.angle??180}deg, ${Q})`}}function BJ(J,Q){switch(J?.type){case"solid":return J.color||"";case"gradient":return J.css||mJ(J.gradient)||"";case"image":return J.image?.url?ZJ(J.image.url):"";case"video":return J.video?.poster?ZJ(J.video.poster):"";case"webcam":return J.webcam?.snapshot?ZJ(J.webcam.snapshot):"";default:return J?.swatchBackground||J?.background||J?.css||Q?.getAttribute("swatch-background")||""}}function uJ(J){if(!J||typeof J!=="object")return null;if(J.type==="image")return J.image;if(J.type==="video")return J.video;if(J.type==="webcam")return J.webcam;return null}function vJ(J){let Q=uJ(J),Z=Number(Q?.scale);switch(Q?.scaleMode){case"fit":return{size:"contain",position:"center"};case"tile":return{size:`${Number.isFinite(Z)?Z:50}%`,position:"top left"};case"fill":case"crop":return{size:"cover",position:"center"};default:return J?.type==="webcam"||J?.type==="image"||J?.type==="video"?{size:"cover",position:"center"}:null}}function sJ(J){switch(J?.type){case"solid":{if(Number.isFinite(J.alpha))return J.alpha;if(Number.isFinite(J.opacity))return J.opacity/100;return 1}case"gradient":return J.gradient?.opacity??J.opacity??1;case"image":return J.image?.opacity??1;case"video":return J.video?.opacity??1;case"webcam":return J.webcam?.opacity??1;default:return J?.opacity??J?.alpha??1}}class KJ extends S{#Z=null;#$=null;#J=null;#Q=null;#_=!1;#j=null;#Y=new Set;#B=null;#M=null;#X=this.#H.bind(this);#q=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#O(),this.#K(),this.#P(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),W(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#O();if(Z)this.#K()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#L(),this.removeEventListener("click",this.#X),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#O()}#G(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=N("div",{className:"propskit-color-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=_,this.#_=Boolean(Q),this.replaceChildren(Z)}#O(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#_);R(this,this.#J,J,"Color")}#k(){return v(this.getAttribute("value"))}#U(){let{color:J,alpha:Q}=this.#k();return JSON.stringify({type:"solid",color:J,alpha:Q})}#N(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","mode","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#K(){if(!this.#J)return;let J=this.#N(),Q=new Set(J);for(let _ of this.#Y)if(!Q.has(_))this.#J.removeAttribute(_);for(let _ of J)this.#J.setAttribute(_,this.getAttribute(_)??"");this.#J.setAttribute("mode","solid");let Z=this.#U();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);let{color:$,alpha:j}=this.#k();if(this.#Q)this.#Q.setAttribute("background",$),this.#Q.setAttribute("alpha",String(j));this.#Y=Q}#P(){if(!this.#J)return;this.#B??=this.#W.bind(this,"input"),this.#M??=this.#W.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#M)}#L(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#M)this.#J.removeEventListener("change",this.#M)}#T(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return v(Q).color;if(Q&&typeof Q==="object"){if(typeof Q.color==="string"&&Q.color)return Q.color;if(typeof Q.value==="string"&&Q.value)return v(Q.value).color;if(typeof Q.hex==="string"&&Q.hex)return Q.hex}let Z=this.#J?.value;if(Z&&typeof Z==="object"&&typeof Z.color==="string")return Z.color;if(typeof Z==="string"&&Z)return v(Z).color;return this.#k().color}#F(J,Q){let Z=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:void 0,$=Number.isFinite(Z?.alpha)?Math.max(0,Math.min(1,Number(Z.alpha))):this.#k().alpha;return{color:Q,alpha:$,opacity:Math.round($*100)}}#W(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#T(Q),$=this.#F(Q,Z),j=$.alpha<0.996078431372549?Math.round($.alpha*255).toString(16).padStart(2,"0"):"",_=`${$.color.slice(0,7)}${j}`;this.setAttribute("value",_);let X=this.#U();if(this.#J&&this.#J.getAttribute("value")!==X)this.#J.setAttribute("value",X);if(this.#Q)this.#Q.setAttribute("background",$.color),this.#Q.setAttribute("alpha",String($.alpha));K(this,J)}#H(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??this.#J?.value??this.#J?.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=String(J);this.setAttribute("value",Q),this.#z(Q)}#z(J){if(!this.#J)return;let Q=pJ(J);if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");if(this.#J.setAttribute("value",Q),this.#Q){let Z=v(J);this.#Q.setAttribute("background",Z.color),this.#Q.setAttribute("alpha",String(Z.alpha))}}#f(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#f())}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#z(J),b(this)}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}L("propskit-color",KJ);class SJ extends S{#Z=null;#$=null;#J=null;#Q=null;#_=!1;#j=null;#Y=new Set;#B=null;#M=null;#X=this.#R.bind(this);#q=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#O(),this.#F(),this.#W(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),W(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#O();if(Z)this.#F()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#H(),this.removeEventListener("click",this.#X),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#O()}#G(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=N("div",{className:"propskit-fill-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=_,this.#_=Boolean(Q),this.replaceChildren(Z)}#O(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#_);R(this,this.#J,J,"Fill")}#k(){return u(this.getAttribute("value"))}#U(){return i(this.#k())}#N(){let J=this.#k()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#K(){let J=this.#J?.value;if(J&&typeof J==="object")return J;if(typeof J==="string"&&J)return u(J);return null}#P(J){let Q=this.#K();if(!J||typeof J!=="object")return J;if(J.type!=="webcam")return J;let Z=J.webcam?.snapshot||Q?.webcam?.snapshot;if(!Z||J.webcam?.snapshot)return J;return{...J,webcam:{...Q?.webcam&&typeof Q.webcam==="object"?Q.webcam:{},...J.webcam,snapshot:Z}}}#L(J=this.#k()){if(!this.#Q)return;let Q=this.#P(J),Z=BJ(Q,this.#N());if(!Z)Z=BJ(this.#K(),this.#N());if(!Z){let j=this.#Q.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#Q.setAttribute("background",Z),this.#Q.setAttribute("alpha",String(sJ(Q)));let $=vJ(Q||J);if($)this.#Q.style.setProperty("--swatch-bg-size",$.size),this.#Q.style.setProperty("--swatch-bg-position",$.position)}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#F(){if(!this.#J)return;let J=this.#T(),Q=new Set(J);for(let $ of this.#Y)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=this.#U();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);this.#L(),this.#Y=Q}#W(){if(!this.#J)return;this.#B??=this.#f.bind(this,"input"),this.#M??=this.#f.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#M)}#H(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#M)this.#J.removeEventListener("change",this.#M)}#z(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(Q&&typeof Q==="object")return Q;if(typeof Q==="string"&&Q)return u(Q);let Z=this.#J?.value;if(Z&&typeof Z==="object")return Z;if(typeof Z==="string"&&Z)return u(Z);return this.#k()}#f(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#P(this.#z(Q)),$=i(Z);if(this.setAttribute("value",$),this.#J&&this.#J.getAttribute("value")!==$)this.#J.setAttribute("value",$);this.#L(Z),K(this,J)}#R(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??i(this.#J?.value)??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value"),this.#L({type:"solid",color:"",alpha:1});return}let Q=i(typeof J==="string"?u(J):J);this.setAttribute("value",Q),this.#D(Q)}#D(J){if(!this.#J)return;let Q=i(u(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#L(u(Q))}#h(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#h())}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#D(J),b(this)}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}L("propskit-fill",SJ);class TJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#L.bind(this);#X=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#G(),this.#k(),this.#U(),this.#X===null)this.#X=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify(this.#J?.value??{});if(this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#G();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#N(),this.removeEventListener("click",this.#M),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#G()}#q(){let Q=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())).find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=N("div",{className:"propskit-gradient-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-gradient");j.anchorElement=this,Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z)}#G(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Gradient")}#O(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#O(),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J){let $=this.getAttribute(Z)??"";if(Z==="value"&&this.#J.getAttribute("value")===$)continue;this.#J.setAttribute(Z,$)}if(!this.hasAttribute("edit"))this.#J.setAttribute("edit","picker");this.#j=Q}#U(){if(!this.#J)return;this.#Y??=this.#P.bind(this,"input"),this.#B??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#K(J){let Q=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:this.#J?.value;if(!Q||typeof Q!=="object")return this.value;return JSON.stringify(Q)}#P(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#K(Q);this.setAttribute("value",Z),K(this,J)}#L(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-input-gradient, fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.querySelector?.("fig-fill-picker")?.open?.()}get value(){return this.getAttribute("value")??JSON.stringify(this.#J?.value??{})}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=typeof J==="object"?JSON.stringify(J):String(J);if(this.setAttribute("value",Q),this.#J&&this.#J.getAttribute("value")!==Q)this.#J.setAttribute("value",Q)}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,b(this)}focus(J){this.#J?.focus(J)}}L("propskit-gradient",TJ);class jJ extends S{#Z=null;#$=null;#J=null;#Q=[];#_=!1;#j=null;#Y=[];#B=void 0;#M=!1;#X=0;#q=null;#G=null;#O=null;#k=null;#U=this.#m.bind(this);#N=this.#d.bind(this);#K=!1;static get observedAttributes(){return["label","aria-label","options","value","disabled"]}connectedCallback(){if(!this.#Z)this.#P(),this.#Y=this.#L(this.value);if(this.#I(),this.#V(),this.#p(),this.removeEventListener("click",this.#U),this.addEventListener("click",this.#U),this.removeEventListener("pointerdown",this.#N,!0),this.addEventListener("pointerdown",this.#N,!0),W(this),!this.#j)this.#j=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!jJ.observedAttributes.includes(Z)&&!["label","name","options","value","default","size","variant","class","style","id"].includes(Z)&&!Z.startsWith("data-")))this.#V()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#y(),this.removeEventListener("click",this.#U),this.removeEventListener("pointerdown",this.#N,!0),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(this.#M&&J==="value")return;if(J==="label"||J==="aria-label")this.#I();else if(J==="options")this.#f();else if(J==="value")this.#h();else if(J==="disabled")this.#V()}#P(){let J=this.querySelector(":scope > label"),Q=N("div",{className:"propskit-palette-surface"}),Z=J||document.createElement("label"),$=document.createElement("fig-select"),j=this.#H([]);j.setAttribute("slot","trigger"),j.setAttribute("data-propskit-palette-trigger",""),j.hidden=!0,$.setAttribute("full",""),$.setAttribute("subtle",""),$.append(j),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=$,this.#q=j,this.#_=Boolean(J),this.replaceChildren(Q),this.#f()}#L(J){if(!Array.isArray(J))return[];return J.map((Q)=>({...Q}))}#T(J){let Q=document.createElement("fig-input-palette");if(typeof J==="string")Q.setAttribute("value",J);else Q.setAttribute("value",JSON.stringify(J??[]));return this.#L(Q.value)}#F(J){return JSON.stringify(this.#T(J))}#W(){try{let J=JSON.parse(this.getAttribute("options")||"[]");if(!Array.isArray(J))return[];return J.filter((Q)=>Array.isArray(Q)).map((Q)=>this.#T(Q))}catch{return[]}}#H(J){let Q=document.createElement("fig-input-palette");return Q.className="propskit-palette-preview",Q.setAttribute("value",JSON.stringify(J)),Q.setAttribute("fixed",""),Q.setAttribute("disabled",""),Q.setAttribute("full",""),Q.setAttribute("aria-hidden","true"),Q}#z(J){if(!this.#q)return;this.#q.setAttribute("value",JSON.stringify(J)),this.#q.hidden=!J.length}#f(){if(!this.#J)return;let J=++this.#X;this.#Q=this.#W();let Q=document.createElement("fig-select-options");Q.setAttribute("slot","panel"),Q.className="propskit-palette-options",this.#Q.forEach((Z,$)=>{let j=document.createElement("fig-select-option"),_=document.createElement("span");j.setAttribute("value",String($)),j.setAttribute("label",`Palette ${$+1}`),j.setAttribute("aria-label",`Palette ${$+1}`),_.setAttribute("slot","prepend"),_.className="propskit-palette-option-preview",_.append(this.#H(Z)),j.append(_),Q.append(j)}),this.#M=!0,this.#J.replaceChildren(this.#q,Q),this.#h(),queueMicrotask(()=>{if(J!==this.#X)return;this.#h(),this.#M=!1})}#R(J){let Q=this.#T(J);return this.#Q.findIndex((Z)=>m(Z,Q))}#D(J){let Q=this.#F(J);if(this.getAttribute("value")===Q)return;let Z=this.#M;this.#M=!0,this.setAttribute("value",Q),this.#M=Z}#h(){if(!this.#J)return;if(!this.#Q.length){this.#J.removeAttribute("value"),this.#z([]);let $=this.#M;this.#M=!0,this.removeAttribute("value"),this.#M=$;return}let J=this.hasAttribute("value")?this.getAttribute("value"):this.#Q[0],Q=this.#R(J),Z=Q>=0?Q:0;this.#J.setAttribute("value",String(Z)),this.#D(this.#Q[Z]),this.#z(this.#Q[Z])}#I(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#_);R(this,this.#J,J,"Palette"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#$.textContent?.trim()||"Palette"),this.#J.setAttribute("full","")}#V(){if(!this.#J)return;this.#J.toggleAttribute("disabled",O(this,"disabled"));for(let J of["position","offset","closedby"])if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#p(){if(!this.#J)return;this.#G??=this.#C.bind(this,"input"),this.#O??=this.#C.bind(this,"change"),this.#k??=this.#C.bind(this,"optionhover"),this.#J.addEventListener("input",this.#G),this.#J.addEventListener("change",this.#O),this.#J.addEventListener("optionhover",this.#k)}#y(){if(!this.#J)return;if(this.#G)this.#J.removeEventListener("input",this.#G);if(this.#O)this.#J.removeEventListener("change",this.#O);if(this.#k)this.#J.removeEventListener("optionhover",this.#k)}#b(J){return this.#L(this.#Q[J]??[])}#x(J,Q){this.#B=Q;try{K(this,J,Q)}finally{this.#B=void 0}}#C(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),this.#M||O(this,"disabled"))return;let Z=J==="optionhover"&&Q instanceof CustomEvent?Q.detail:this.#J.getAttribute("value"),$=this.#b(Number(Z));if(J!=="optionhover")this.#D($),this.#z($);this.#x(J,$)}#A(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#d(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select")){this.#K=!1;return}this.#K=this.#A()}#m(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu, fig-select")){this.#K=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#K=!1;return}if(this.#J.focus(),this.#K||this.#A()){this.#K=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){if(this.#B!==void 0)return this.#B;let J=Number(this.#J?.getAttribute("value"));if(Number.isInteger(J)&&J>=0)return this.#b(J);if(this.hasAttribute("value"))return this.#T(this.getAttribute("value"));return[]}set value(J){if(J===null||J===void 0){this.removeAttribute("value");return}this.setAttribute("value",this.#F(J))}get defaultValue(){if(this.hasAttribute("default"))return this.#T(this.getAttribute("default"));return this.#L(this.#Y)}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue;for(let J of["input","change"])this.#x(J,this.value)}focus(J){this.#J?.focus(J)}}L("propskit-palette",jJ);class FJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=null;#X=this.#z.bind(this);#q=this.#H.bind(this);#G=!1;#O=void 0;#k=null;static get observedAttributes(){return["label","aria-label","options","value"]}connectedCallback(){if(!this.#Z)this.#U();if(this.#N(),this.#P(),this.#L(),this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),this.removeEventListener("pointerdown",this.#q,!0),this.addEventListener("pointerdown",this.#q,!0),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="aria-label")Q=!0;else if(j==="direction")continue;else Z=!0}if(Q)this.#N();if(Z)this.#P()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#T(),this.removeEventListener("click",this.#X),this.removeEventListener("pointerdown",this.#q,!0),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label"){this.#N();return}if(J==="options"||J==="value")this.#P()}#U(){this.#k=this.getAttribute("value")??"";let J=this.querySelector(":scope > label"),Q=this.querySelector(":scope > fig-select-options"),Z=N("div",{className:"propskit-select-surface"}),$=J||document.createElement("label"),j=document.createElement("fig-select");if(j.setAttribute("full",""),Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(J),this.replaceChildren(Z)}#N(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Select"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#$.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#K(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#P(){if(!this.#J)return;let J=this.#K().sort((Z,$)=>{if(Z==="options")return-1;if($==="options")return 1;if(Z==="value")return 1;if($==="value")return-1;return 0}),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#j=Q}#L(){if(!this.#J)return;this.#Y??=this.#F.bind(this,"input"),this.#B??=this.#F.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B),this.#M??=this.#F.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#M)}#T(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B);if(this.#M)this.#J.removeEventListener("optionhover",this.#M)}#F(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=J==="optionhover"&&Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.value;if(J==="optionhover")this.#O=$;try{K(this,J,$)}finally{this.#O=void 0}}#W(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#H(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select")){this.#G=!1;return}this.#G=this.#W()}#z(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select")){this.#G=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#G=!1;return}if(this.#J.focus(),this.#G||this.#W()){this.#G=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return this.#O??this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0)this.removeAttribute("value");else this.setAttribute("value",String(J))}get defaultValue(){return this.getAttribute("default")??this.#k??""}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;b(this)}focus(J){this.#J?.focus(J)}}L("propskit-select",FJ);class zJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#P.bind(this);#X=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#G(),this.#k(),this.#U(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#G();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#N(),this.removeEventListener("click",this.#M),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#G()}#q(){this.#X=this.getAttribute("value")??"";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=N("div",{className:"propskit-text-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-text");for(let _ of J)if(_!==Q)j.appendChild(_);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z)}#G(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Text")}#O(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","type","aria-label","multiline","autoresize","resizable","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#O(),Q=["multiline","autoresize"],Z=new Set([...J,...Q,"type"]);for(let $ of this.#j)if(!Z.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");for(let $ of Q)this.#J.setAttribute($,this.getAttribute($)??"");this.#J.setAttribute("type","text"),this.#j=Z}#U(){if(!this.#J)return;this.#Y??=this.#K.bind(this,"input"),this.#B??=this.#K.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#K(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z)),K(this,J)}#P(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-text, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,b(this)}focus(J){this.#J?.focus(J)}}L("propskit-text",zJ);class WJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#L.bind(this);#X=this.#T.bind(this);#q=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#O(),this.#U(),this.#N(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),this.removeEventListener("keydown",this.#X),this.addEventListener("keydown",this.#X),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#O();if(Z)this.#U()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#K(),this.removeEventListener("click",this.#M),this.removeEventListener("keydown",this.#X),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#O()}#G(){this.#q=this.getAttribute("value")??this.getAttribute("min")??"0";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=N("div",{className:"propskit-number-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-number");Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#O(){let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Number")}#k(){let J=new Set(["label","direction","size","aria-label","oninput","onchange","class","style","id","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#U(){if(!this.#J)return;let J=this.#k(),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#j=Q}#N(){if(!this.#J)return;this.#Y??=this.#P.bind(this,"input"),this.#B??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#K(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#P(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=d(this.#J?.value);if(Z===null)this.removeAttribute("value");else this.setAttribute("value",String(Z));K(this,J)}#L(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}#T(J){if(!["ArrowUp","ArrowDown"].includes(J.key)||!(J.target instanceof Element)||!J.target.closest("fig-input-number"))return;J.stopPropagation();let Q=this.#J?.querySelector("input");queueMicrotask(()=>{if(this.isConnected&&!O(this,"disabled"))Q?.focus({preventScroll:!0})})}get value(){return d(this.#J?.value??this.getAttribute("value"))}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#q??"0"}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,b(this)}focus(J){this.#J?.focus(J)}}L("propskit-number",WJ);class HJ extends S{static observedAttributes=["x","y","default","label","aria-label","units","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j=null;#Y=!1;#B=!1;#M=this.#z.bind(this,"input");#X=this.#z.bind(this,"change");#q=this.#f.bind(this);connectedCallback(){if(!this.#Y)this.#j=this.#O(),this.#U(this.#j),this.#Y=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#W(),this.removeEventListener("click",this.#q),this.addEventListener("click",this.#q),W(this)}disconnectedCallback(){this.#H(),this.removeEventListener("click",this.#q),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Y)return;if((J==="x"||J==="y")&&!this.#B)this.#L();else if(J==="label"||J==="aria-label")this.#P();else if(J==="units")this.#T();else if(J==="disabled")this.#F()}#G(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(){let J=this.getAttribute("x"),Q=this.getAttribute("y");return{x:J===null||!J.trim()?50:this.#G(J,50),y:Q===null||!Q.trim()?50:this.#G(Q,50)}}#k(J){if(typeof J!=="string"||!J.trim())return null;try{let Q=JSON.parse(J);if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;return{x:this.#G(Q.x,this.#j?.x??50),y:this.#G(Q.y,this.#j?.y??50)}}catch{return null}}#U(J){let Q=this.#O(),Z={x:this.#G(J?.x,Q.x),y:this.#G(J?.y,Q.y)};return this.#B=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#B=!1,Z}#N(J,Q){let Z=document.createElement("fig-input-number");if(Z.setAttribute("data-propskit-position-axis",J),Z.setAttribute("value",String(Q)),Z.setAttribute("min","0"),Z.setAttribute("max","100"),Z.setAttribute("step","1"),Z.setAttribute("precision","2"),this.units==="percent")Z.setAttribute("units","%");Z.setAttribute("aria-label",`${J.toUpperCase()} position`);let $=document.createElement("span");if($.setAttribute("slot","prepend"),$.textContent=J.toUpperCase(),Z.append($),O(this,"disabled"))Z.setAttribute("disabled","");return Z}#K(){let J=this.#O(),Q=this.querySelector(":scope > label"),Z=N("div",{className:"propskit-position-surface",role:"group"}),$=Q||document.createElement("label"),j=this.#N("x",J.x),_=this.#N("y",J.y);Z.append($,j,_),this.#Z=Z,this.#$=$,this.#J=Boolean(Q),this.#Q=j,this.#_=_,this.replaceChildren(Z),W(this)}#P(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Z,J,"Position")}#L(){let J=this.#O();this.#Q?.setAttribute("value",String(J.x)),this.#_?.setAttribute("value",String(J.y)),this.#T(),this.#F()}#T(){let J=this.units==="percent"?"%":null;for(let Q of[this.#Q,this.#_]){if(!Q)continue;if(J)Q.setAttribute("units",J);else Q.removeAttribute("units")}}#F(){let J=O(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#_?.toggleAttribute("disabled",J)}#W(){this.#H(),this.#Q?.addEventListener("input",this.#M),this.#Q?.addEventListener("change",this.#X),this.#_?.addEventListener("input",this.#M),this.#_?.addEventListener("change",this.#X)}#H(){this.#Q?.removeEventListener("input",this.#M),this.#Q?.removeEventListener("change",this.#X),this.#_?.removeEventListener("input",this.#M),this.#_?.removeEventListener("change",this.#X)}#z(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#G(Q.currentTarget.value,$[Z]),this.#U($),K(this,J)}#f(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#O().x}set x(J){this.setAttribute("x",String(this.#G(J,50)))}get y(){return this.#O().y}set y(J){this.setAttribute("y",String(this.#G(J,50)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#O()}}set value(J){let Q=this.#U(J);this.#L(Q)}get defaultValue(){return this.#k(this.getAttribute("default"))||{...this.#j||{x:50,y:50}}}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,b(this)}focus(J){this.#Q?.focus(J)}}L("propskit-position",HJ);class RJ extends S{static observedAttributes=["value","default","label","aria-label","axis-labels","coordinates","precision","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j={x:50,y:50};#Y=!1;#B=this.#W.bind(this,"input");#M=this.#W.bind(this,"change");connectedCallback(){if(!this.#Z)this.#j=this.#q(this.getAttribute("value"),this.#j),this.#G(this.#j),this.#O();this.#k(),this.#U(),this.#T(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#F(),this.#_?.disconnect(),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="value"&&!this.#Y)this.#G(this.#q(Z,this.value)),this.#K();else if(J==="label"||J==="aria-label")this.#k();else if(J==="axis-labels"||J==="coordinates"||J==="precision")this.#N();else if(J==="disabled")this.#P()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#q(J,Q={x:50,y:50}){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{let j=$.split(/[\s,]+/).filter(Boolean),_=(X,q)=>{if(!X)return q;let B=Number.parseFloat(X.replace(/%/g,""));if(!Number.isFinite(B))return q;return X.includes("%")||Math.abs(B)>1?B:B*100};Z={x:_(j[0],Q.x),y:_(j[1]??j[0],Q.y)}}}if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{x:this.#X(Z.x,Q.x),y:this.#X(Z.y,Q.y)}}#G(J){let Q=this.#q(J,this.#j),Z=JSON.stringify(Q);if(this.getAttribute("value")!==Z)this.#Y=!0,this.setAttribute("value",Z),this.#Y=!1;return Q}#O(){let J=this.querySelector(":scope > label"),Q=N("div",{className:"propskit-joystick-surface",role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-joystick");$.setAttribute("fields","true"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#L()),this.#_.observe($,{childList:!0,subtree:!0})}#k(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Q,J,"Joystick"),this.#L()}#U(){this.#N(),this.#K(),this.#P()}#N(){if(!this.#Q)return;this.#Q.setAttribute("fields","true"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["axis-labels","coordinates","precision"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#K(){if(!this.#Q)return;let J=this.value,Q=`${J.x}% ${J.y}%`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#P(){if(!this.#Q||!this.#Z)return;let J=O(this,"disabled");this.#Z.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#L()}#L(){if(!this.#Q)return;let J=O(this,"disabled"),Q=this.#$?.isConnected?this.#$.id:"",Z=this.getAttribute("aria-label")?.trim(),$=this.#Q.querySelector("fig-handle");if($)if($.toggleAttribute("disabled",J),Z)$.setAttribute("aria-label",Z),$.removeAttribute("aria-labelledby");else if(Q)$.setAttribute("aria-labelledby",Q),$.removeAttribute("aria-label");else $.setAttribute("aria-label","Joystick"),$.removeAttribute("aria-labelledby");for(let j of this.#Q.querySelectorAll("fig-input-number"))j.toggleAttribute("disabled",J)}#T(){this.#F(),this.#Q?.addEventListener("input",this.#B),this.#Q?.addEventListener("change",this.#M)}#F(){this.#Q?.removeEventListener("input",this.#B),this.#Q?.removeEventListener("change",this.#M)}#W(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#q(Q.detail?.value,this.value);this.#G(Z),this.#K(),K(this,J)}get value(){return this.#q(this.getAttribute("value"),this.#j)}set value(J){this.#G(J),this.#K()}get defaultValue(){return this.#q(this.getAttribute("default"),this.#j)}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,b(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.focus(J)}}L("propskit-joystick",RJ);class VJ extends S{static observedAttributes=["value","default","label","aria-label","precision","drag","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j={x:50,y:50};#Y=!1;#B=this.#H.bind(this,"input");#M=this.#H.bind(this,"change");connectedCallback(){if(!this.#Z)this.#j=this.#G(this.getAttribute("value"),this.#j),this.#O(this.#j),this.#k();this.#U(),this.#N(),this.#F(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#W(),this.#_?.disconnect(),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="value"&&!this.#Y)this.#O(this.#G(Z,this.value)),this.#P();else if(J==="label"||J==="aria-label")this.#U();else if(J==="precision"||J==="drag")this.#K();else if(J==="disabled")this.#L()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J,Q,Z){let $=String(J??"").trim().toLowerCase(),j=Q==="x"?{left:0,center:50,right:100}:{top:0,center:50,bottom:100};if($ in j)return j[$];let _=Number.parseFloat($.replace(/%/g,""));return Number.isFinite(_)?_:Z}#G(J,Q={x:50,y:50}){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{let j=$.replace(/,/g," ").split(/\s+/).filter(Boolean);Z={x:this.#q(j[0],"x",Q.x),y:this.#q(j[1]??j[0],"y",Q.y)}}}if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{x:this.#X(Z.x,Q.x),y:this.#X(Z.y,Q.y)}}#O(J){let Q=this.#G(J,this.#j),Z=JSON.stringify(Q);if(this.getAttribute("value")!==Z)this.#Y=!0,this.setAttribute("value",Z),this.#Y=!1;return Q}#k(){let J=this.querySelector(":scope > label"),Q=N("div",{className:"propskit-origin-surface",role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-origin-grid");$.setAttribute("fields","true"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#T()),this.#_.observe($,{childList:!0,subtree:!0})}#U(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Q,J,"Origin"),this.#T()}#N(){this.#K(),this.#P(),this.#L()}#K(){if(!this.#Q)return;this.#Q.setAttribute("fields","true"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["precision","drag"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#P(){if(!this.#Q)return;let J=this.value,Q=`${J.x}% ${J.y}%`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#L(){if(!this.#Q||!this.#Z)return;let J=O(this,"disabled");this.#Z.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#T()}#T(){if(!this.#Q)return;let J=O(this,"disabled"),Q=this.#$?.isConnected?this.#$.id:"",Z=this.getAttribute("aria-label")?.trim(),$=this.#Q.querySelector("fig-handle");if($)if($.toggleAttribute("disabled",J),Z)$.setAttribute("aria-label",Z),$.removeAttribute("aria-labelledby");else if(Q)$.setAttribute("aria-labelledby",Q),$.removeAttribute("aria-label");else $.setAttribute("aria-label","Origin"),$.removeAttribute("aria-labelledby");for(let j of this.#Q.querySelectorAll("fig-input-number"))j.toggleAttribute("disabled",J)}#F(){this.#W(),this.#Q?.addEventListener("input",this.#B),this.#Q?.addEventListener("change",this.#M)}#W(){this.#Q?.removeEventListener("input",this.#B),this.#Q?.removeEventListener("change",this.#M)}#H(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#G(Q.detail,this.value);this.#O(Z),this.#P(),K(this,J)}get value(){return this.#G(this.getAttribute("value"),this.#j)}set value(J){this.#O(J),this.#P()}get defaultValue(){return this.#G(this.getAttribute("default"),this.#j)}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,b(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.querySelector("fig-handle")?.focus(J)}}L("propskit-origin",VJ);class _J extends S{static observedAttributes=["value","default","label","aria-label","precision","edit","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j=null;#Y=!1;#B=this.#f.bind(this,"input");#M=this.#f.bind(this,"change");connectedCallback(){if(!this.#Z)this.#j=this.#k(this.getAttribute("value"),this.#q()),this.#U(this.#j),this.#N();this.#K(),this.#P(),this.#H(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#z(),this.#_?.disconnect(),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="value"&&!this.#Y)this.#U(this.#k(Z,this.value)),this.#T();else if(J==="label"||J==="aria-label")this.#K();else if(J==="precision"||J==="edit")this.#L();else if(J==="disabled")this.#F()}#X(){return this.localName==="propskit-spring"}#q(){return this.#X()?{stiffness:200,damping:15,mass:1}:{x1:0.42,y1:0,x2:0.58,y2:1}}#G(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J,Q){let Z=this.#G(J,Q);return Z>0?Z:Q}#k(J,Q=this.#q()){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{if(this.#X()){let j=$.match(/^spring\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);Z=j?{stiffness:Number(j[1]),damping:Number(j[2]),mass:Number(j[3])}:null}else{let _=$.replace(/^cubic-bezier\(\s*/i,"").replace(/\s*\)$/,"").split(",").map((X)=>Number(X.trim()));Z=_.length===4&&_.every(Number.isFinite)?{x1:_[0],y1:_[1],x2:_[2],y2:_[3]}:null}}}if(this.#X()){if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{stiffness:this.#O(Z.stiffness,Q.stiffness),damping:this.#O(Z.damping,Q.damping),mass:this.#O(Z.mass,Q.mass)}}if(Array.isArray(Z))Z={x1:Z[0],y1:Z[1],x2:Z[2],y2:Z[3]};if(!Z||typeof Z!=="object")return{...Q};return{x1:Math.max(0,Math.min(1,this.#G(Z.x1,Q.x1))),y1:this.#G(Z.y1,Q.y1),x2:Math.max(0,Math.min(1,this.#G(Z.x2,Q.x2))),y2:this.#G(Z.y2,Q.y2)}}#U(J){let Q=this.#j||this.#q(),Z=this.#k(J,Q),$=JSON.stringify(Z);if(this.getAttribute("value")!==$)this.#Y=!0,this.setAttribute("value",$),this.#Y=!1;return Z}#N(){let J=this.querySelector(":scope > label"),Q=N("div",{className:`${this.localName}-surface`,role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-easing-curve");$.setAttribute("mode",this.#X()?"spring":"bezier"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#W()),this.#_.observe($,{childList:!0,subtree:!0})}#K(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Q,J,this.#X()?"Spring":"Easing"),this.#W()}#P(){this.#L(),this.#T(),this.#F()}#L(){if(!this.#Q)return;this.#Q.setAttribute("mode",this.#X()?"spring":"bezier"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["precision","edit"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#T(){if(!this.#Q)return;let J=this.value,Q=this.#X()?`spring(${J.stiffness}, ${J.damping}, ${J.mass})`:`${J.x1}, ${J.y1}, ${J.x2}, ${J.y2}`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#F(){if(!this.#Q||!this.#Z)return;let J=O(this,"disabled");this.#Z.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#W()}#W(){if(!this.#Q)return;let J=O(this,"disabled");this.#Q.querySelector("fig-select")?.setAttribute("variant","ghost");for(let Q of this.#Q.querySelectorAll("fig-handle, fig-select, fig-dropdown, fig-input-text"))Q.toggleAttribute("disabled",J);for(let Q of this.#Q.querySelectorAll("input, select"))Q.disabled=J}#H(){this.#z(),this.#Q?.addEventListener("input",this.#B),this.#Q?.addEventListener("change",this.#M)}#z(){this.#Q?.removeEventListener("input",this.#B),this.#Q?.removeEventListener("change",this.#M)}#f(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#k(Q.detail?.value,this.value);this.#U(Z),this.#T(),K(this,J)}get value(){return this.#k(this.getAttribute("value"),this.#j||this.#q())}set value(J){this.#U(J),this.#T()}get defaultValue(){return this.#k(this.getAttribute("default"),this.#j||this.#q())}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,b(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.querySelector("fig-select, fig-dropdown, fig-handle, fig-input-text")?.focus(J)}}class fJ extends _J{}L("propskit-easing",fJ);class CJ extends _J{}L("propskit-spring",CJ);class AJ extends S{static observedAttributes=["label","collapsible","open","disabled","value"];#Z=null;#$=null;#J=null;#Q=!1;#_=!1;#j=!1;#Y=this.#P.bind(this,"input");#B=this.#P.bind(this,"change");#M=this.#L.bind(this);connectedCallback(){if(!this.#Q)this.#O(this.#G()),this.#Q=!0;if(!this.#Z)this.#k();this.#U(),this.#N(),this.#K(this.#G()),this.removeEventListener("input",this.#Y),this.addEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#O(this.#G());this.#K($)}return}if(J==="disabled"){this.#N();return}this.#U()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),color:typeof Q.color==="string"&&Q.color.trim()?Q.color.trim():"#D9D9D9"}}#G(){return this.#q(this.getAttribute("value"))}#O(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#k(){let J=this.#G(),Q=document.createElement("fig-group"),Z=document.createElement("propskit-color"),$=document.createElement("propskit-position");Q.setAttribute("compact",""),Z.setAttribute("label","Color"),Z.setAttribute("value",J.color),Z.setAttribute("data-propskit-color-point-control","color"),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),$.setAttribute("units","percent"),$.setAttribute("data-propskit-color-point-control","position"),this.#Z=Q,this.#$=Z,this.#J=$,this.#U(),this.#N(),Q.append(Z,$),this.replaceChildren(Q)}#U(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#N(){n(this,[this.#$,this.#J])}#K(J){let Q=this.#q(J);if(this.#$)this.#$.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#P(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-color-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-color-point-control");if(j==="color")$.color=Z.value||Z.getAttribute("value");else if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else return;this.#O($),K(this,J)}#L(J){if(J.target!==this.#Z||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get value(){return{...this.#G()}}set value(J){let Q=this.#O(J);this.#K(Q)}focus(J){this.#$?.focus(J)}}L("propskit-color-point",AJ);class EJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#Z=null;#$=null;#J=null;#Q=!1;#_=!1;#j=!1;#Y=this.#W.bind(this,"input");#B=this.#W.bind(this,"change");#M=this.#H.bind(this);connectedCallback(){if(!this.#Q)this.#k(this.#O()),this.#Q=!0;if(!this.#Z)this.#N();this.#K(),this.#P(),this.#L(),this.#T(this.#O()),this.removeEventListener("input",this.#Y),this.addEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#k(this.#O());this.#T($)}return}if(J==="units"){this.#P();return}if(J==="disabled"){this.#L();return}this.#K()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#X(J,0)}#G(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),radius:this.#q(Q.radius)}}#O(){return this.#G(this.getAttribute("value"))}#k(J){let Q=this.#G(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#U(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#N(){let J=this.#O(),Q=this.#U(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-control","radius"),this.#Z=Z,this.#$=$,this.#J=j,this.#K(),this.#L(),Z.append($,j),this.replaceChildren(Z)}#K(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#P(){if(this.hasAttribute("units"))this.#$?.setAttribute("units",this.units);else this.#$?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#L(){n(this,[this.#$,this.#J])}#T(J){let Q=this.#G(J);if(this.#$)this.#$.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#U(Q.radius);this.#J.value=Z.value}}#F(J,Q){let Z=this.#U(Q).value,$=this.#X(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#W(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-control");if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#F(Z,$.radius);else return;this.#k($),K(this,J)}#H(J){if(J.target!==this.#Z||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#O()}}set value(J){let Q=this.#k(J);this.#T(Q)}focus(J){this.#$?.focus(J)}}L("propskit-point-radius",EJ);class DJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#Z=null;#$=null;#J=null;#Q=null;#_=!1;#j=!1;#Y=!1;#B=this.#H.bind(this,"input");#M=this.#H.bind(this,"change");#X=this.#z.bind(this);connectedCallback(){if(!this.#_)this.#U(this.#k()),this.#_=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#T(),this.#F(this.#k()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#M),this.addEventListener("change",this.#M),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#M),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#U(this.#k());this.#F($)}return}if(J==="units"){this.#L();return}if(J==="disabled"){this.#T();return}this.#P()}#q(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#G(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#q(J,0)}#O(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#q(Q.x,50),y:this.#q(Q.y,50),radius:this.#G(Q.radius),angle:this.#q(Q.angle,0)}}#k(){return this.#O(this.getAttribute("value"))}#U(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#N(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#K(){let J=this.#k(),Q=this.#N(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number"),_=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-angle-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-angle-control","radius"),_.setAttribute("label","Angle"),_.setAttribute("value",String(J.angle)),_.setAttribute("units","°"),_.setAttribute("units-disallow",""),_.setAttribute("precision","1"),_.setAttribute("data-propskit-point-radius-angle-control","angle"),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=_,this.#P(),this.#T(),Z.append($,j,_),this.replaceChildren(Z)}#P(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#L(){if(this.hasAttribute("units"))this.#$?.setAttribute("units",this.units);else this.#$?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#T(){n(this,[this.#$,this.#J,this.#Q])}#F(J){let Q=this.#O(J);if(this.#$)this.#$.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#N(Q.radius);this.#J.value=Z.value}if(this.#Q)this.#Q.value=Q.angle}#W(J,Q){let Z=this.#N(Q).value,$=this.#q(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#H(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-angle-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-angle-control");if(j==="position")$.x=this.#q(Z.value?.x,$.x),$.y=this.#q(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#W(Z,$.radius);else if(j==="angle")$.angle=this.#q(Z.value,$.angle);else return;this.#U($),K(this,J)}#z(J){if(J.target!==this.#Z||this.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#k()}}set value(J){let Q=this.#U(J);this.#F(Q)}focus(J){this.#$?.focus(J)}}L("propskit-point-radius-angle",DJ);class IJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#Z=null;#$=null;#J=null;#Q=!1;#_=!1;#j=!1;#Y=this.#T.bind(this,"input");#B=this.#T.bind(this,"change");#M=this.#F.bind(this);connectedCallback(){if(!this.#Q)this.#O(this.#G()),this.#Q=!0;if(!this.#Z)this.#U();this.#N(),this.#K(),this.#P(),this.#L(this.#G()),this.removeEventListener("input",this.#Y),this.addEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#O(this.#G());this.#L($)}return}if(J==="units"){this.#K();return}if(J==="disabled"){this.#P();return}this.#N()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),x2:this.#X(Q.x2,75),y2:this.#X(Q.y2,75)}}#G(){return this.#q(this.getAttribute("value"))}#O(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#k(J,Q,Z,$){let j=document.createElement("propskit-position");if(j.setAttribute("label",J),j.setAttribute("x",String(Z)),j.setAttribute("y",String($)),this.hasAttribute("units"))j.setAttribute("units",this.units);return j.setAttribute("data-propskit-point-point-control",Q),j}#U(){let J=this.#G(),Q=document.createElement("fig-group"),Z=this.#k("Start","start",J.x,J.y),$=this.#k("End","end",J.x2,J.y2);Q.setAttribute("compact",""),this.#Z=Q,this.#$=Z,this.#J=$,this.#N(),this.#P(),Q.append(Z,$),this.replaceChildren(Q)}#N(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#K(){for(let J of[this.#$,this.#J]){if(!J)continue;if(this.hasAttribute("units"))J.setAttribute("units",this.units);else J.removeAttribute("units")}}#P(){n(this,[this.#$,this.#J])}#L(J){let Q=this.#q(J);if(this.#$)this.#$.value={x:Q.x,y:Q.y};if(this.#J)this.#J.value={x:Q.x2,y:Q.y2}}#T(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.value,_=Z.getAttribute("data-propskit-point-point-control");if(_==="start")$.x=this.#X(j?.x,$.x),$.y=this.#X(j?.y,$.y);else if(_==="end")$.x2=this.#X(j?.x,$.x2),$.y2=this.#X(j?.y,$.y2);else return;this.#O($),K(this,J)}#F(J){if(J.target!==this.#Z||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#G()}}set value(J){let Q=this.#O(J);this.#L(Q)}focus(J){this.#$?.focus(J)}}L("propskit-point-point",IJ);class t extends S{static observedAttributes=["name","open","show-reset","disabled"];static#Z=["propskit-color","propskit-fill","propskit-gradient","propskit-easing","propskit-joystick","propskit-number","propskit-origin","propskit-position","propskit-color-point","propskit-point-radius","propskit-point-radius-angle","propskit-point-point","propskit-select","propskit-slider","propskit-spring","propskit-switch","propskit-text","propskit-wheel","propskit-oscillator"].join(",");#$=null;#J=null;#Q=null;#_=null;#j=0;#Y=()=>this.#X();connectedCallback(){this.#z(),this.#N(),this.#B(),requestAnimationFrame(()=>{this.#L()})}disconnectedCallback(){if(this.#M(),this.#j)cancelAnimationFrame(this.#j),this.#j=0;this.#$?.removeEventListener("click",this.#G),this.#$?.removeEventListener("keydown",this.#O),this.#Q?.querySelector("fig-button")?.removeEventListener("click",this.#k)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#$?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#W(),this.#L();return}if(J==="disabled"){this.#N();return}this.#z()}get open(){let J=this.getAttribute("open");return J!==null&&J!=="false"}set open(J){let Q=this.open;if(J)this.setAttribute("open","true");else this.setAttribute("open","false");if(this.#$?.setAttribute("aria-expanded",String(!!J)),Q!==!!J)this.dispatchEvent(new CustomEvent("openchange",{detail:{open:!!J},bubbles:!0}))}get showReset(){let J=this.getAttribute("show-reset");if(J===null)return!0;return J!=="false"}set showReset(J){if(J)this.setAttribute("show-reset","true");else this.setAttribute("show-reset","false")}get dirty(){return this.hasAttribute("data-dirty")&&this.getAttribute("data-dirty")!=="false"}resetProperties(){this.#F()}#B(){if(this.removeEventListener("input",this.#Y,!0),this.removeEventListener("change",this.#Y,!0),this.addEventListener("input",this.#Y,!0),this.addEventListener("change",this.#Y,!0),!this.#_)this.#_=new MutationObserver(()=>{this.#N(),this.#X()});this.#_.disconnect(),this.#_.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#M(){this.removeEventListener("input",this.#Y,!0),this.removeEventListener("change",this.#Y,!0),this.#_?.disconnect()}#X(){if(this.#j)return;this.#j=requestAnimationFrame(()=>{this.#j=0,this.#L()})}#q(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#G=(J)=>{if(O(this,"disabled"))return;if(this.#q(J.target))return;J.stopPropagation(),this.open=!this.open};#O=(J)=>{if(O(this,"disabled"))return;if(this.#q(J.target))return;if(J.key!=="Enter"&&J.key!==" ")return;J.preventDefault(),J.stopPropagation(),this.open=!this.open};#k=(J)=>{if(J.preventDefault(),J.stopPropagation(),O(this,"disabled"))return;this.#F()};#U(){return[...this.querySelectorAll(t.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(t.#Z))}#N(){let J=O(this,"disabled");for(let Q of this.#U())if(J){if(!O(Q,"disabled"))Q.setAttribute("disabled",""),Q.setAttribute("data-propskit-group-disabled","")}else if(Q.hasAttribute("data-propskit-group-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-propskit-group-disabled");this.#$?.setAttribute("aria-disabled",String(J)),this.#$?.setAttribute("tabindex",J?"-1":"0"),this.#Q?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#K(J){return J.isDefault===!1}#P(){for(let J of this.#U())if(this.#K(J))return!0;return!1}#L(){if(this.#P())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#W()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#F(){for(let J of this.#U())this.#T(J);this.#L(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#W(){if(!this.showReset){this.#Q?.setAttribute("hidden","");return}this.#H(),this.#Q?.removeAttribute("hidden")}#H(){if(!this.#$||!this.showReset)return;let J=this.#$.querySelector(":scope > .propskit-group-reset-tooltip");if(!J){J=document.createElement("fig-tooltip"),J.className="propskit-group-reset-tooltip",J.setAttribute("text","Reset properties");let Q=document.createElement("fig-button");Q.className="propskit-group-reset",Q.setAttribute("variant","ghost"),Q.setAttribute("icon",""),Q.setAttribute("aria-label","Reset properties");let Z=document.createElement("fig-icon");Z.setAttribute("name","reset"),Q.appendChild(Z),J.appendChild(Q),this.#$.appendChild(J),Q.addEventListener("click",this.#k)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#k),Q?.addEventListener("click",this.#k)}this.#Q=J}#z(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#$=Z;else if(!this.#$||!this.#$.dataset.generated||this.#$.parentElement!==this)this.#$=document.createElement("fig-header"),this.#$.setAttribute("borderless",""),this.#$.dataset.generated="true",this.prepend(this.#$);let $=this.#$.querySelector(":scope > h3"),j=this.#$.querySelector(":scope > fig-button.propskit-group-disclosure");if(!$&&j){if($=j.querySelector(":scope > h3"),$)this.#$.insertBefore($,j);j.remove()}if(!$)$=document.createElement("h3"),this.#$.prepend($);let _=$.querySelector(":scope > button.propskit-group-disclosure");if(_){while(_.firstChild)$.insertBefore(_.firstChild,_);_.remove()}if(!$.id)$.id=GJ("propskit-group");if(this.#$.dataset.generated)$.textContent=Q;if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",$.id);let X=this.#$.querySelector(":scope > .propskit-group-chevron")||$.querySelector(":scope > .propskit-group-chevron");if(!X)X=document.createElement("fig-icon"),X.setAttribute("name","chevron"),X.setAttribute("size","small"),X.className="propskit-group-chevron";if(this.#$.insertBefore(X,$),this.#J=X,this.#W(),this.#$.setAttribute("role","button"),this.#N(),this.#$.setAttribute("aria-expanded",String(this.open)),this.#$.removeEventListener("click",this.#G),this.#$.addEventListener("click",this.#G),this.#$.removeEventListener("keydown",this.#O),this.#$.addEventListener("keydown",this.#O),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#$.setAttribute("aria-expanded","false")}}L("propskit-group",t);class s extends S{static#Z=4;static#$="propskit-slider-dragging";static#J=null;#Q=null;#_=null;#j=null;#Y=!1;#B=null;#M=new Set;#X=0;#q=0;#G=0;#O=null;#k=!0;#U=0;#N=1;#K=0;#P=null;#L=null;#T=0;#F=null;#W=null;#H=!1;#z=0;#f=null;#R=0;#D=null;#h=0;#I=null;#V=0;#p=0;#y=!1;#b=!1;#x=0;#C=null;#A=null;#d=this.#CJ.bind(this);#m=this.#RJ.bind(this);#E=this.#u.bind(this);#S=this.#HJ.bind(this);#jJ=this.#TJ.bind(this);#w=this.#MJ.bind(this);#v=this.#KJ.bind(this);#i=this.#fJ.bind(this);#t=this.#DJ.bind(this);#r=this.#WJ.bind(this);#g=new Set(["variant","color","text","full","elastic","size","name","class","data-wave-index","data-active","data-elastic-dragging","default","style"]);static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Q)this.#kJ();if(this.#e(),this.#QJ(),this.#gJ(),this.#a(),this.#BJ(),this.#GJ(),this.removeEventListener("pointerdown",this.#d,{capture:!0}),this.addEventListener("pointerdown",this.#d,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#S,{capture:!0}),this.addEventListener("pointerdown",this.#S,{capture:!0}),this.removeEventListener("contextmenu",this.#i),this.addEventListener("contextmenu",this.#i),this.removeEventListener("click",this.#r,!0),this.addEventListener("click",this.#r,!0),this.#L?.removeEventListener("change",this.#t),this.#L?.addEventListener("change",this.#t),!this.#B)this.#B=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#PJ();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#g.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#e(),this.#a();if(Z)this.#QJ(),this.#a()});this.#B.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#B?.disconnect(),this.#X)cancelAnimationFrame(this.#X),this.#X=0;if(this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#G)cancelAnimationFrame(this.#G),this.#G=0;this.#O?.disconnect(),this.#AJ(),this.#FJ(),clearTimeout(this.#x),this.#x=0,this.#YJ(),this.#zJ(),this.#l(),this.#cJ(),this.removeEventListener("pointerdown",this.#d,{capture:!0}),this.removeEventListener("pointerdown",this.#S,{capture:!0}),this.removeEventListener("contextmenu",this.#i),this.removeEventListener("click",this.#r,!0),this.#L?.removeEventListener("change",this.#t)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label"||J==="aria-label")this.#e(),this.#a()}#kJ(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#W=this.getAttribute("value")??this.getAttribute("default")??(J==="delta"?"0":this.getAttribute("min")??"0");let Q=Array.from(this.childNodes).filter((X)=>{return X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())}),Z=Q.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),$=N("div",{className:"propskit-slider-surface"}),j=Z||document.createElement("label"),_=document.createElement("fig-slider");_.setAttribute("text","true");for(let X of this.#OJ()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#Q=$,this.#_=j,this.#j=_,this.#Y=Boolean(Z),this.replaceChildren($),this.#n();for(let X of Q){if(X===Z)continue;this.#j.appendChild(X)}}#n(){let J=document.createElement("fig-menu");J.setAttribute("position","bottom left"),J.setAttribute("offset","0 0");let Q=document.createElement("fig-menu-item");Q.setAttribute("value","reset-default"),Q.textContent="Reset",J.appendChild(Q),J.addEventListener("change",this.#t),this.#L=J,this.appendChild(J)}#e(){C(this,this.#Q,this.#_,this.#Y),this.#GJ()}#QJ(){if(!this.#j)return;let J=this.#OJ(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#M)if(!Q.has($))this.#j.removeAttribute($);for(let $ of J){if($==="text"||$==="value")continue;let j=this.getAttribute($)??"";if(this.#j.getAttribute($)!==j)this.#j.setAttribute($,j)}this.#j.removeAttribute("variant"),this.#j.removeAttribute("color"),this.#j.removeAttribute("transform"),this.#j.removeAttribute("full"),this.#j.setAttribute("text","true");let Z=(this.getAttribute("type")||"range").toLowerCase();if(Z==="delta"){let $=Number(this.#j.min),j=Number(this.#j.max),_=Number.isFinite($)&&Number.isFinite(j)?$+(j-$)/2:0;this.#j.setAttribute("default",String(_))}else this.#j.removeAttribute("default");if(Z==="stepper")this.#j.setAttribute("step",this.getAttribute("step")??"10");else if(!this.hasAttribute("step"))this.#j.removeAttribute("step");if(Z==="opacity")this.#j.style.setProperty("--color",this.getAttribute("color")||"var(--figma-color-bg-secondary)");else this.#j.style.removeProperty("--color");this.#s(Z),this.#M=Q,this.#PJ(),this.#SJ(),this.#k=!0,this.#BJ(),this.#GJ()}#s(J){let Q=this.#j?.querySelector("fig-input-number");if(!(J==="hue"||J==="opacity"&&this.hasAttribute("color"))){Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color");return}let $=Number(this.#j?.min),j=Number(this.#j?.max),_=Number(this.#j?.value),X=Number.isFinite($)&&Number.isFinite(j)&&j>$&&Number.isFinite(_)?Math.max(0,Math.min(1,(_-$)/(j-$))):0,q=this.getAttribute("color"),B=J==="hue"?`hsl(${X*360}deg 100% 50%)`:`color-mix(in srgb, ${q} ${X*100}%, var(--figma-color-bg-secondary))`,Y=getComputedStyle(this).colorScheme.trim().toLowerCase()==="dark",G=wJ(this.#j,B,J==="hue"?0.35:Y?0.2:0.35);if(G){Q?.setAttribute("theme",G);let M=G==="light"&&Y||G==="dark"&&!Y;this.style.setProperty("--propskit-slider-filled-text-color",M?"var(--figma-color-text)":"var(--figma-color-text-oninverse)")}else Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color")}#NJ(){if(!this.#j)return;let J=Number(this.#j.min),Q=Number(this.#j.max),Z=Number(this.#j.value),$=Number.isFinite(J)&&Number.isFinite(Q)&&Q>J&&Number.isFinite(Z)?Math.max(0,Math.min(1,(Z-J)/(Q-J))):0;this.style.setProperty("--propskit-slider-complete",String($)),this.#s((this.getAttribute("type")||"range").toLowerCase()),this.#GJ()}#BJ(){if(!globalThis.ResizeObserver)return;if(!this.#O)this.#O=new ResizeObserver(()=>{this.#k=!0,this.#GJ()});this.#O.disconnect();for(let J of[this,this.#_,this.#j?.querySelector("fig-input-number"),this.#j?.querySelector("fig-input-number input"),this.#j?.querySelector('input[type="range"]')])if(J)this.#O.observe(J)}#GJ(){if(this.#G)cancelAnimationFrame(this.#G);this.#G=requestAnimationFrame(()=>{this.#G=0,this.#qJ()})}#qJ(){let J=this.#j?.querySelector('input[type="range"]');if(!J||!this.#j)return;let Q=J.getBoundingClientRect();if(!Q.width)return;let Z=Number(J.min||0),$=Number(J.max||100),j=Number(J.value),_=Number.isFinite(Z)&&Number.isFinite($)&&$>Z&&Number.isFinite(j)?Math.max(0,Math.min(1,(j-Z)/($-Z))):0,X=Q.left+_*Q.width;if(this.#k)this.#U=this.#XJ("--slider-thumb-width",this.#j)/2,this.#N=Math.max(1,this.#XJ("--propskit-slider-handle-fade-start-threshold")),this.#K=Math.min(this.#N,this.#XJ("--propskit-slider-handle-fade-end-threshold")),this.#k=!1;let q=this.#U,B=[],Y=this.#_?.parentElement===this.#Q?this.#LJ(this.#_):null,G=this.#j.querySelector("fig-input-number input"),M=G?this.#JJ(G):null;if(Y?.width&&Y.bottom>Q.top&&Y.top<Q.bottom)B.push(X-q-Y.right);if(M?.width&&M.bottom>Q.top&&M.top<Q.bottom)B.push(M.left-X-q);let k=this.#N,U=this.#K,P=B.length?Math.min(...B):k,T=Math.max(0.001,k-U),H=Math.max(0,Math.min(1,(P-U)/T));this.style.setProperty("--propskit-slider-handle-proximity",String(H))}#LJ(J){let Q=document.createRange();Q.selectNodeContents(J);let Z=[...Q.getClientRects()].filter((q)=>q.width>0&&q.height>0);if(Q.detach?.(),!Z.length)return null;let $=Math.min(...Z.map((q)=>q.left)),j=Math.max(...Z.map((q)=>q.right)),_=Math.min(...Z.map((q)=>q.top)),X=Math.max(...Z.map((q)=>q.bottom));return{left:$,right:j,top:_,bottom:X,width:j-$,height:X-_}}#JJ(J){let Q=J.value||J.placeholder||"";if(!Q)return null;let Z=J.getBoundingClientRect(),$=getComputedStyle(J),j=this.#_J(Q,$),_=Z.left+(Number.parseFloat($.borderLeftWidth)||0)+(Number.parseFloat($.paddingLeft)||0),X=Z.right-(Number.parseFloat($.borderRightWidth)||0)-(Number.parseFloat($.paddingRight)||0),q=Math.max(0,X-_),B=Math.min(q,j),Y=$.textAlign,G=_;if(Y==="right"||Y==="end")G=X-B;else if(Y==="center")G=_+(q-B)/2;return{left:G,right:G+B,top:Z.top,bottom:Z.bottom,width:B,height:Z.height}}#_J(J,Q){if(!s.#J)s.#J=document.createElement("canvas");let Z=s.#J.getContext("2d");if(!Z)return 0;if(Z.font=Q.font||`${Q.fontStyle} ${Q.fontWeight} ${Q.fontSize} ${Q.fontFamily}`,"fontKerning"in Z)Z.fontKerning=Q.fontKerning;if("fontStretch"in Z)Z.fontStretch=Q.fontStretch;if("fontVariantCaps"in Z)Z.fontVariantCaps=Q.fontVariantCaps;if("letterSpacing"in Z)Z.letterSpacing=Q.letterSpacing;return Z.measureText(J).width}#XJ(J,Q=this){let Z=document.createElement("div");Z.style.setProperty(J,getComputedStyle(Q).getPropertyValue(J)),Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild(Z);let $=Number.parseFloat(getComputedStyle(Z).width);return Z.remove(),Number.isFinite($)?Math.max(0,$):0}#PJ(){if(!this.#j)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#W??"";if(String(this.#j.value)!==J)this.#j.value=J;this.#NJ()}#OJ(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#g.has(Q))}#SJ(){if(this.#X)cancelAnimationFrame(this.#X);this.#X=requestAnimationFrame(()=>{this.#X=0,this.#pJ(),this.#ZJ()})}#a(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#ZJ()})}#ZJ(){let J=this.#j?.querySelector('input[type="range"]'),Q=this.#j?.querySelector("fig-input-number input");if(J!==this.#P)this.#UJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")?.trim();if(Z)J.setAttribute("aria-label",Z),J.removeAttribute("aria-labelledby");else if(this.#_?.parentElement===this.#Q&&this.#_.id)J.setAttribute("aria-labelledby",this.#_.id),J.removeAttribute("aria-label");else J.setAttribute("aria-label","Slider"),J.removeAttribute("aria-labelledby")}if(Q)Q.removeAttribute("tabindex"),Q.removeAttribute("aria-hidden")}#WJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#b&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#b=!1;return}this.#o()}#o(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!O(this,"disabled"))this.focus()})})}#UJ(J){if(this.#l(),this.#P=J,!this.#P)return;this.#P.addEventListener("dblclick",this.#v,{capture:!0})}#l(){if(!this.#P)return;this.#P.removeEventListener("dblclick",this.#v,{capture:!0}),this.#P=null}#KJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#xJ()}#HJ(J){if(J.button!==0||J.altKey||O(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#FJ(),this.#I=J.pointerId,this.#V=J.clientX,this.#p=J.clientY,this.#y=!1,window.addEventListener("pointermove",this.#jJ),window.addEventListener("pointerup",this.#w,{once:!0}),window.addEventListener("pointercancel",this.#w,{once:!0}),window.addEventListener("blur",this.#w,{once:!0})}#TJ(J){if(J.pointerId!==this.#I)return;if(J.buttons===0){this.#MJ(J);return}if(!this.#y){if(Math.hypot(J.clientX-this.#V,J.clientY-this.#p)<4)return;this.#y=!0,this.setAttribute("data-number-scrubbing",""),this.#$J(!0)}this.#EJ(this.#wJ(J),"input")}#MJ(J){if(J?.pointerId!==void 0&&this.#I!==null&&J.pointerId!==this.#I)return;let Q=this.#y;if(this.#FJ(),Q){this.#EJ(this.#j?.value,"change"),this.#b=!0,clearTimeout(this.#x),this.#x=window.setTimeout(()=>{this.#b=!1,this.#x=0},0),this.#o();return}this.#j?.querySelector("fig-input-number input")?.focus()}#FJ(){window.removeEventListener("pointermove",this.#jJ),window.removeEventListener("pointerup",this.#w),window.removeEventListener("pointercancel",this.#w),window.removeEventListener("blur",this.#w),this.#I=null,this.#y=!1,this.removeAttribute("data-number-scrubbing"),this.#$J(!1)}#CJ(J){if(J.button!==0||O(this,"disabled"))return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#j?.querySelector('input[type="range"]')??this.#P;if(!Q)return;this.#YJ(),this.#zJ(),this.#P=Q,this.#H=!0,this.#D=J.pointerId,this.#h=J.clientX,this.#z=this.getAttribute("elastic")==="false"?0:this.#IJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#f={left:Z.left,right:Z.right,width:Z.width},this.#R=$.width,window.addEventListener("pointermove",this.#m,{passive:!0}),window.addEventListener("pointerup",this.#E,{once:!0}),window.addEventListener("pointercancel",this.#E,{once:!0}),window.addEventListener("blur",this.#E,{once:!0})}#RJ(J){if(!this.#H)return;if(J.pointerId!==this.#D)return;if(J.buttons===0){this.#u(J);return}if(Math.abs(J.clientX-this.#h)>=s.#Z)this.#$J(!0);if(this.#z)this.#bJ(J.clientX)}#u(J){if(J?.pointerId!==void 0&&this.#D!==null&&J.pointerId!==this.#D)return;let Q=J?.type==="pointerup"||J?.type==="pointermove"&&J.buttons===0;if(this.#YJ(),this.#zJ(),Q)this.#o()}#YJ(){window.removeEventListener("pointermove",this.#m),window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E),this.#H=!1,this.#D=null,this.#h=0,this.#$J(!1)}#$J(J){this.toggleAttribute("data-propskit-slider-dragging",J),document.body.classList.toggle(s.#$,J)}#fJ(J){if(O(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#AJ(),this.#c(J.clientX,J.clientY)}#c(J,Q){let Z=!1,$=0,j=()=>{if(Z)return;Z=!0,window.clearTimeout($),window.removeEventListener("pointerup",j,!0),window.removeEventListener("pointercancel",j,!0),requestAnimationFrame(()=>{this.#L?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#DJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#xJ()}#AJ(){if(this.#T)clearTimeout(this.#T),this.#T=0;this.#F=null}#IJ(){let J=getComputedStyle(this).getPropertyValue("--propskit-slider-elastic-distance").trim();if(J.includes("var(")||!J.endsWith("px")){let Z=document.createElement("div");Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:"var(--propskit-slider-elastic-distance)"}),this.appendChild(Z),J=getComputedStyle(Z).width,Z.remove()}let Q=Number.parseFloat(J);return Number.isFinite(Q)?Math.max(0,Q):0}#bJ(J){let Q=this.#f;if(!Q||!this.#z){this.#zJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#VJ();return}let $=Math.max(-this.#z,Math.min(this.#z,Z*0.5)),j=Math.abs($),_=this.#R?(this.#R+j)/this.#R:1;this.dataset.elasticDragging="true",this.style.setProperty("--propskit-slider-elastic-size",`${j}px`),this.style.setProperty("--propskit-slider-elastic-scale",`${_}`),this.style.setProperty("--propskit-slider-elastic-origin",$<0?"right center":"left center")}#zJ(){this.#VJ(),this.#z=0,this.#f=null,this.#R=0,this.#D=null}#VJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#wJ(J){let Q=this.#P;if(!Q)return this.#j?.value??"";let Z=Q.getBoundingClientRect(),$=Z.width?Math.min(1,Math.max(0,(J.clientX-Z.left)/Z.width)):0,j=Number(Q.min||0),_=Number(Q.max||100),X=Q.step==="any"?0:Number(Q.step||1),q=j+(_-j)*$;if(!X)return String(q);let B=Math.round((q-j)/X)*X+j,Y=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(Y)))}#yJ(){return this.getAttribute("default")??this.#W??this.#P?.min??"0"}#xJ(){this.#AJ(),this.#EJ(this.#yJ(),"input"),this.#EJ(this.#yJ(),"change")}#EJ(J,Q){if(!this.#j||J===null||J===void 0)return;this.#j.value=J,this.setAttribute("value",String(this.#j.value)),K(this,Q)}#pJ(){if(!this.#j)return;let J=this.#j.querySelector("fig-input-number");if(!J)return;if(!(this.hasAttribute("steppers")&&this.getAttribute("steppers")!=="false")){J.removeAttribute("steppers");return}let Z=this.getAttribute("steppers");J.setAttribute("steppers",Z??"")}#gJ(){if(!this.#j)return;if(!this.#C)this.#C=this.#hJ.bind(this,"input");if(!this.#A)this.#A=this.#hJ.bind(this,"change");this.#j.addEventListener("input",this.#C),this.#j.addEventListener("change",this.#A)}#cJ(){if(!this.#j)return;if(this.#C)this.#j.removeEventListener("input",this.#C);if(this.#A)this.#j.removeEventListener("change",this.#A)}#hJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;if(J==="change")this.#zJ();if(this.#j?.value!==void 0){let Z=String(this.#j.value);if(this.getAttribute("value")!==Z)this.setAttribute("value",Z)}this.#NJ(),K(this,J)}focus(J){this.#ZJ();let Q=this.#j?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return d(this.getAttribute("value")??this.#j?.value)}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#j)this.#j.value="";return}let Q=String(J);if(this.setAttribute("value",Q),this.#j)this.#j.value=Q}get defaultValue(){return this.#yJ()}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){this.#xJ()}}L("propskit-slider",s);class V extends HTMLElement{static#Z=33;static#$=60;static#J=0.55;static#Q=1.5;static#_=80;static#j=4;static#Y="fig-input-wheel-dragging";#B=null;#M=null;#X=null;#q=null;#G=null;#O=null;#k=null;#U=0;#N=0;#K=0;#P=0;#L=0;#T=null;#F=!1;#W=null;#H=0;#z=0;#f=!1;#R=null;#D=0;#h=null;#I=0;#V=0;#p=this.#qJ.bind(this);#y=this.#LJ.bind(this);#b=this.#_J.bind(this);#x=this.#KJ.bind(this);#C=this.#HJ.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#B)this.#A();if(this.#e(),this.#kJ(),this.#BJ(),this.#T?.disconnect(),globalThis.ResizeObserver)this.#T=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#QJ(Q.width,Q.height)}),this.#T.observe(this);this.#s()}disconnectedCallback(){if(this.#T?.disconnect(),this.#K)cancelAnimationFrame(this.#K);this.#K=0,this.#MJ(),this.#GJ(),this.#XJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#B)return;if(J==="disabled")this.#e();if(J==="value"&&!this.#F)this.#kJ();if(J==="step")this.#n(),this.#s();if(J==="spin")this.#s();if(J==="min"||J==="max")this.#g(this.#S())}#A(){if(this.#B=this,this.#M=this,this.#X=this,this.setAttribute("role","spinbutton"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-label","Value");this.setAttribute("tabindex","0");let J=h("svg",{className:"fig-input-wheel-svg","aria-hidden":"true"}),Q=N("div",{className:"fig-input-wheel-handle"});this.#q=J,this.replaceChildren(J,Q);let Z=document.createElement("div");Z.setAttribute("aria-hidden","true"),Z.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0";let $=document.createElement("div");$.style.height="var(--fig-input-wheel-tick-height)";let j=document.createElement("div");j.style.height="var(--fig-input-wheel-tick-height-min)";let _=document.createElement("div");_.style.width="var(--fig-input-wheel-tick-width)";let X=document.createElement("div");X.style.width="var(--fig-input-wheel-tick-width-min)",Z.append($,j,_,X),this.append(Z),this.#k={maxEl:$,minEl:j,maxWidthEl:_,minWidthEl:X},this.#d()}#d(){if(!this.#q||this.#G)return;this.#G=h("path",{className:"fig-input-wheel-tick"}),this.#q.append(this.#G)}#m(){if(this.#O)return this.#O;return this.#O={maxH:this.#k?.maxEl.getBoundingClientRect().height||8,minH:this.#k?.minEl.getBoundingClientRect().height||4,maxW:this.#k?.maxWidthEl.getBoundingClientRect().width||2,minW:this.#k?.minWidthEl.getBoundingClientRect().width||1},this.#O}#E(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#S(){let J=Number(this.getAttribute("value")??0);return Number.isFinite(J)?J:0}#jJ(J){if(!this.hasAttribute(J))return null;let Q=this.getAttribute(J);if(Q===null||Q.trim()==="")return null;let Z=Number(Q);return Number.isFinite(Z)?Z:null}#w(){return this.#jJ("min")}#v(){return this.#jJ("max")}#i(J,Q){if(Q===null||Q===void 0||Q===""){this.removeAttribute(J);return}let Z=Number(Q);if(!Number.isFinite(Z)){this.removeAttribute(J);return}this.setAttribute(J,String(Z))}#t(J){let Q=J,Z=this.#w(),$=this.#v();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#r(J){let Q=this.#E();if(Q<=0)return J;let Z=this.#w()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#g(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#r(J):J;$=this.#t($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#n($),this.#s(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#kJ(){let J=this.#S(),Q=this.#t(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#g(Q);return}this.#n(J),this.#s()}#n(J=this.#S()){if(!this.#X)return;let Q=this.#w(),Z=this.#v();if(this.#X.setAttribute("aria-valuenow",String(J)),this.#X.setAttribute("aria-valuetext",String(J)),Q===null)this.#X.removeAttribute("aria-valuemin");else this.#X.setAttribute("aria-valuemin",String(Q));if(Z===null)this.#X.removeAttribute("aria-valuemax");else this.#X.setAttribute("aria-valuemax",String(Z))}#e(){let J=O(this,"disabled");if(!this.#X)return;if(J){if(this.#F)this.#XJ();this.#MJ(),this.setAttribute("aria-disabled","true"),this.#X.setAttribute("tabindex","-1"),this.#X.setAttribute("aria-disabled","true")}else this.removeAttribute("aria-disabled"),this.#X.setAttribute("tabindex","0"),this.#X.removeAttribute("aria-disabled")}#QJ(J,Q){if(!this.#q||J<1||Q<1)return;if(J===this.#U&&Q===this.#N)return;this.#U=J,this.#N=Q,this.#O=null,this.#q.setAttribute("viewBox",`0 0 ${J} ${Q}`),this.#q.setAttribute("width",String(J)),this.#q.setAttribute("height",String(Q)),this.#s()}#s(){if(this.#K)return;this.#K=requestAnimationFrame(()=>{if(!this.isConnected){this.#K=0;return}if(this.#U<1||this.#N<1){let J=this.#X?.getBoundingClientRect();if(J)this.#QJ(J.width,J.height)}this.#NJ(),this.#K=0})}#NJ(){if(!this.#G)return;let J=this.#U,Q=this.#N;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#w()??0:this.#R??this.#S(),$=360/V.#Z,j=this.#E(),_=this.#w()??0,X=(Z-_)/j*$,q=V.#J,B=J/2,Y=Q/2,{maxH:G,minH:M,maxW:k,minW:U}=this.#m(),P=V.#$,T=Math.max(J/2,1),H=T*0.84,D=[];for(let A=0;A<V.#Z;A+=1){let z=X+A*$;if(z=((z+180)%360+360)%360-180,z<-P||z>=P)continue;let I=z*Math.PI/180,E=B+H*Math.sin(I)/(1-q*Math.cos(I)),y=Math.min(1,Math.abs(E-B)/Math.max(T,1)),w=Math.cos(y*Math.PI*0.5),x=M+(G-M)*w,e=U+(k-U)*w,a=x/2,p=e/2,g=Y-a,r=Y+a,JJ=E-p,QJ=E+p;D.push(`M ${E} ${g} Q ${QJ} ${g} ${QJ} ${g+p} V ${r-p} Q ${QJ} ${r} ${E} ${r} Q ${JJ} ${r} ${JJ} ${r-p} V ${g+p} Q ${JJ} ${g} ${E} ${g} Z`)}this.#G.setAttribute("d",D.join(" "))}#BJ(){this.#B?.addEventListener("pointerdown",this.#p),this.#X?.addEventListener("wheel",this.#x,{passive:!1}),this.#X?.addEventListener("keydown",this.#C)}#GJ(){this.#B?.removeEventListener("pointerdown",this.#p),this.#X?.removeEventListener("wheel",this.#x),this.#X?.removeEventListener("keydown",this.#C),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b)}#qJ(J){if(O(this,"disabled"))return;if(J.button!==0)return;if(J.preventDefault(),!this.beginScrub(J))return;this.#B?.setPointerCapture?.(J.pointerId),window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#b),window.addEventListener("pointercancel",this.#b)}beginScrub(J={}){if(O(this,"disabled"))return!1;let Q=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Q))return!1;this.#MJ(),this.#F=!0,this.#W=J&&typeof J==="object"&&J.pointerId!==void 0?J.pointerId:null,this.#H=Q;let Z=J&&typeof J==="object"?Number(J.startValue):Number.NaN;return this.#z=Number.isFinite(Z)?this.#t(Z):this.#S(),this.#f=!1,this.#WJ(Q),this.#PJ(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.remove(V.#Y),this.focus(),!0}updateScrub(J,Q){if(!this.#F)return this.#S();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#S();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#JJ(Z,$),this.#S()}endScrub(J=!0){if(!this.#F)return this.#S();if(J&&this.#S()!==this.#z)this.#g(this.#S(),{snap:!0,emit:"change"});return this.#XJ(),this.#S()}#LJ(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.updateScrub(J)}#JJ(J,Q=1){if(!this.#f&&Math.abs(J-this.#H)>=V.#j)this.#f=!0,document.body.classList.add(V.#Y);let Z=this.#X?.clientWidth||1,$=V.#Z*(V.#$*2/360),j=this.#E()*$,_=(J-this.#H)*(j/Z)*Q,X=this.#R??this.#z,q=this.#t(this.#z+_);this.#o(J,Q,q!==X),this.#R=q,this.#g(q,{snap:!0,emit:"input"}),this.#SJ(J)}#_J(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.endScrub()}#XJ(){this.#F=!1,this.#W=null,this.#f=!1,this.#R=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(V.#Y),this.#UJ(),this.#a(),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),this.#s()}#PJ(){this.#a(),this.#D=this.#OJ("--fig-input-wheel-handle-drag-max")}#OJ(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#SJ(J){if(!this.#D){this.#ZJ();return}let Q=J-this.#H;if(!Q){this.#ZJ();return}let Z=this.#D*Math.tanh(Q/Math.max(1,this.#D*3));this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${Z}px`)}#a(){this.#ZJ(),this.#D=0}#ZJ(){this.style.removeProperty("--fig-input-wheel-handle-drag-offset")}#WJ(J){this.#UJ(),this.#h=J,this.#I=performance.now()}#o(J,Q,Z){let $=performance.now(),j=$-this.#I,_=this.#h===null?0:Math.abs(J-this.#h);this.#h=J,this.#I=$;let X=j>0?_/j*Math.max(1,Math.abs(Q)):0;if(!Z||X<V.#Q){this.#l();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#V),this.#V=window.setTimeout(()=>{this.#l()},V.#_)}#UJ(){this.#h=null,this.#I=0,this.#l()}#l(){clearTimeout(this.#V),this.#V=0,this.removeAttribute("data-fig-input-wheel-fast")}#KJ(J){if(O(this,"disabled"))return;J.preventDefault();let Q=J.deltaY===0?Math.sign(J.deltaX):Math.sign(J.deltaY);if(!Q)return;let Z=J.shiftKey?10:1;this.#g(this.#S()+this.#E()*Z*Q,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"})}#HJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number"))return;if(J.key==="Home"){let _=this.#w();if(_===null)return;J.preventDefault(),this.#g(_,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"});return}if(J.key==="End"){let _=this.#v();if(_===null)return;J.preventDefault(),this.#g(_,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"});return}if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(J.key))return;J.preventDefault();let Z=J.key==="ArrowRight"||J.key==="ArrowUp"?1:-1,$=J.shiftKey?10:1,j=this.#S();this.#g(j+this.#E()*$*Z,{snap:!0,emit:"input"}),this.#TJ(j,this.#S(),Z,$),this.#g(this.#S(),{emit:"change"})}#TJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#MJ();return}if(this.#P)cancelAnimationFrame(this.#P),this.#P=0;clearTimeout(this.#L),this.#L=0,this.removeAttribute("data-fig-input-wheel-keyboard-settling");let _=this.#R??J,X=Number.parseFloat(this.style.getPropertyValue("--fig-input-wheel-handle-drag-offset"))||0,q=$>1?120:90,B=performance.now(),Y=j;this.setAttribute("data-fig-input-wheel-keyboard-moving","");let G=(M)=>{let k=Math.min(1,(M-B)/q);if(this.#R=_+(Q-_)*k,Y){let U=Math.sin(k*Math.PI/2),P=X+(Z*4-X)*U;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${P}px`)}if(this.#NJ(),k<1){this.#P=requestAnimationFrame(G);return}this.#P=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.setAttribute("data-fig-input-wheel-keyboard-settling",""),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.#L=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#L=0},140),this.#s()};this.#P=requestAnimationFrame(G)}#MJ(){if(this.#P)cancelAnimationFrame(this.#P),this.#P=0;if(clearTimeout(this.#L),this.#L=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.isConnected)this.#s()}get value(){return this.getAttribute("value")??"0"}set value(J){if(J===null||J===void 0||J===""){this.#g(0);return}let Q=Number(J);this.#g(Number.isFinite(Q)?Q:0)}spinTo(J,{animateHandle:Q=!1}={}){let Z=this.#S();this.value=J;let $=this.#S();if(this.getAttribute("spin")==="false")return this.#MJ(),$;let j=Math.sign($-Z);return this.#TJ(Z,$,j,Math.abs($-Z)>this.#E()?10:1,Q),$}get min(){return this.#w()}set min(J){this.#i("min",J)}get max(){return this.#v()}set max(J){this.#i("max",J)}get step(){return this.#E()}focus(J){HTMLElement.prototype.focus.call(this,J)}}L("fig-input-wheel",V);class l extends S{static#Z=new Set(["label","size","disabled","variant","elastic","spin","text","default","class","style","id","oninput","onchange"]);static get observedAttributes(){return["label","aria-label","units","value","disabled","step","precision","min","max","elastic","spin","text"]}#$=null;#J=null;#Q=null;#_=null;#j=!1;#Y=null;#B=new Set;#M=null;#X=null;#q=0;#G=null;#O=0;#k=null;#U=null;#N=0;#K=0;#P=0;#L=!1;#T=!1;#F=0;#W=!1;#H=this.#s.bind(this,"input");#z=this.#s.bind(this,"change");#f=this.#NJ.bind(this,"input");#R=this.#NJ.bind(this,"change");#D=this.#BJ.bind(this);#h=this.#WJ.bind(this);#I=this.#o.bind(this);#V=this.#UJ.bind(this);#p=this.#GJ.bind(this);#y=this.#qJ.bind(this);#b=this.#LJ.bind(this);#x=this.#XJ.bind(this);#C=this.#PJ.bind(this);#A=this.#KJ.bind(this);connectedCallback(){if(!this.#$)this.#d();this.#m(),this.#E(),this.#jJ(),this.#g(),this.#kJ(),W(this),this.#Y?.disconnect(),this.#Y=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!l.#Z.has(Z)&&!l.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#g()}),this.#Y.observe(this,{attributes:!0})}disconnectedCallback(){this.#Y?.disconnect(),this.#JJ(),this.#a(),this.#n(),this.#l(),clearTimeout(this.#F),this.#F=0,this.#J?.endScrub(!1),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label")this.#m();if(J==="text")this.#E();if(J==="elastic"&&Z==="false")this.#a();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#jJ();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#g()}#d(){this.#M=this.getAttribute("value")??"0";let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=N("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number");Z.append($,j,_),this.#$=Z,this.#J=j,this.#Q=$,this.#_=_,this.#j=Boolean(Q),this.replaceChildren(Z);for(let X of J)if(X!==Q)_.appendChild(X)}#m(){let J=C(this,this.#$,this.#Q,this.#j);R(this,this.#J,J,"Wheel"),R(this,this.#_,J,"Number")}#E(){if(!this.#$||!this.#_)return;let J=this.getAttribute("text")!=="false",Q=this.#_.parentElement===this.#$;if(J&&!Q)this.#$.append(this.#_);else if(!J&&Q)this.#_.remove()}#S(J){if(!this.#J)return;if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#jJ(){if(!this.#J)return;this.#J.removeAttribute("units");for(let $ of["min","max","spin"])this.#S($);if(this.hasAttribute("step"))this.#S("step");else this.#J.setAttribute("step",String(this.#i()));this.#J.toggleAttribute("disabled",O(this,"disabled"));let J=d(this.getAttribute("value"));this.#J.value=J??0;let Q=String(this.#J.value);if(J!==null&&this.getAttribute("value")!==Q)this.setAttribute("value",Q);let Z=J===null?"":Q;if(this.#_?.getAttribute("value")!==Z)this.#_?.setAttribute("value",Z);this.#r()}#w(){return this.getAttributeNames().filter((J)=>!l.#Z.has(J)&&!l.observedAttributes.includes(J)&&!J.startsWith("data-"))}#v(){let J=(this.getAttribute("units")||"").trim(),Q=J.toLowerCase();if(Q==="ms"||Q==="millisecond"||Q==="milliseconds")return"ms";if(Q==="s"||Q==="second"||Q==="seconds")return"s";return J}#i(){let J=this.#v();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#t(){return this.#v()==="s"?2:0}#r(){if(!this.#J)return;let J=Number(this.#J.value),Q=this.#v();this.#J.setAttribute("aria-valuetext",Q?`${J} ${Q==="s"?"seconds":Q==="ms"?"milliseconds":Q}`:String(J))}#g(){if(!this.#_||!this.#J)return;let J=this.#w(),Q=new Set(J);for(let $ of this.#B)if(!Q.has($))this.#_.removeAttribute($);for(let $ of J)this.#_.setAttribute($,this.getAttribute($)??"");let Z=this.#v();if(Z)this.#_.setAttribute("units",Z);else this.#_.removeAttribute("units");if(this.#_.setAttribute("step",String(this.#J.step)),this.hasAttribute("precision"))this.#_.setAttribute("precision",this.getAttribute("precision")??"");else this.#_.setAttribute("precision",String(this.#t()));for(let $ of["min","max"]){let j=this.#J[$];if(j===null)this.#_.removeAttribute($);else this.#_.setAttribute($,String(j))}this.#_.toggleAttribute("disabled",O(this,"disabled")),this.#_.setAttribute("value",String(this.value??"")),this.#B=Q}#kJ(){this.#n(),this.#J?.addEventListener("input",this.#H),this.#J?.addEventListener("change",this.#z),this.#_?.addEventListener("input",this.#f),this.#_?.addEventListener("change",this.#R),this.#_?.addEventListener("keydown",this.#D,{capture:!0}),this.addEventListener("pointerdown",this.#p,{capture:!0}),this.addEventListener("pointerdown",this.#h,{capture:!0}),this.addEventListener("click",this.#A,!0)}#n(){this.#J?.removeEventListener("input",this.#H),this.#J?.removeEventListener("change",this.#z),this.#_?.removeEventListener("input",this.#f),this.#_?.removeEventListener("change",this.#R),this.#_?.removeEventListener("keydown",this.#D,{capture:!0}),this.removeEventListener("pointerdown",this.#p,{capture:!0}),this.removeEventListener("pointerdown",this.#h,{capture:!0}),this.removeEventListener("click",this.#A,!0)}#e(J,{spin:Q=!1,animateHandle:Z=!1}={}){let $=d(J);if($===null){if(this.removeAttribute("value"),this.#J)this.#J.value=0;return this.#_?.setAttribute("value",""),this.#r(),null}if(!this.#J)return this.setAttribute("value",String($)),$;if(Q)this.#J.spinTo($,{animateHandle:Z});else this.#J.value=$;let j=this.#J.value;if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#_?.getAttribute("value")!==j)this.#_?.setAttribute("value",j);return this.#r(),Number(j)}#QJ(J){K(this,J)}#s(J,Q){Q.stopImmediatePropagation(),this.#e(Q.detail),this.#QJ(J)}#NJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#_?.value;if(this.#e(Z,{spin:J==="input",animateHandle:J==="input"&&this.#W}),J==="input")this.#W=!1;this.#QJ(J)}#BJ(J){this.#W=!O(this,"disabled")&&(J.key==="ArrowUp"||J.key==="ArrowDown"),window.setTimeout(()=>{this.#W=!1},0)}#GJ(J){if(J.button!==0||O(this,"disabled")||!(J.target instanceof Element)||J.target.closest("fig-input-number")||J.target.closest(".propskit-wheel-surface")!==this.#$)return;if(J.preventDefault(),J.stopImmediatePropagation(),this.#JJ(),!this.#J?.beginScrub({clientX:J.clientX,pointerId:J.pointerId,startValue:Number(this.#J.value)}))return;this.#k=J.pointerId,this.#_J(J.pointerId),window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#b),window.addEventListener("pointercancel",this.#b),window.addEventListener("blur",this.#b)}#qJ(J){if(J.pointerId!==this.#k)return;if(J.buttons===0){this.#LJ(J);return}this.#J?.updateScrub(J)}#LJ(J){if(J?.pointerId!==void 0&&this.#k!==null&&J.pointerId!==this.#k)return;this.#J?.endScrub(),this.#JJ(),this.#a()}#JJ(){window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),window.removeEventListener("blur",this.#b),this.#k=null}#_J(J){if(this.#a(),this.getAttribute("elastic")==="false")return;this.#X=J,this.#q=this.#SJ("--propskit-wheel-elastic-distance");let Q=this.getBoundingClientRect();if(Q)this.#G={left:Q.left,right:Q.right};this.#O=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#x,{passive:!0}),window.addEventListener("pointerup",this.#C),window.addEventListener("pointercancel",this.#C),window.addEventListener("blur",this.#C)}#XJ(J){if(J.pointerId!==this.#X)return;if(J.buttons===0){this.#PJ(J);return}this.#OJ(J.clientX)}#PJ(J){if(J?.pointerId!==void 0&&this.#X!==null&&J.pointerId!==this.#X)return;this.#a()}#OJ(J){let Q=this.#G;if(!Q||!this.#q){this.#ZJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#ZJ();return}let $=Math.min(this.#q,Math.abs(Z)*0.5),j=this.#O?(this.#O+$)/this.#O:1;this.toggleAttribute("data-propskit-wheel-elastic-dragging",!0),this.style.setProperty("--propskit-wheel-elastic-scale",String(j)),this.style.setProperty("--propskit-wheel-elastic-origin",Z<0?"right center":"left center")}#SJ(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#a(){window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#C),window.removeEventListener("pointercancel",this.#C),window.removeEventListener("blur",this.#C),this.#X=null,this.#q=0,this.#G=null,this.#O=0,this.#ZJ()}#ZJ(){this.removeAttribute("data-propskit-wheel-elastic-dragging"),this.style.removeProperty("--propskit-wheel-elastic-scale"),this.style.removeProperty("--propskit-wheel-elastic-origin")}#WJ(J){if(J.button!==0||J.altKey||O(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#l(),this.#U=J.pointerId,this.#N=J.clientX,this.#K=J.clientY,this.#P=Number(this.#J?.value??0),window.addEventListener("pointermove",this.#I),window.addEventListener("pointerup",this.#V,{once:!0}),window.addEventListener("pointercancel",this.#V,{once:!0}),window.addEventListener("blur",this.#V,{once:!0})}#o(J){if(J.pointerId!==this.#U)return;if(J.buttons===0){this.#UJ(J);return}if(!this.#L){if(Math.hypot(J.clientX-this.#N,J.clientY-this.#K)<4)return;this.#L=!0,this.setAttribute("data-number-scrubbing",""),this.#_J(J.pointerId),this.#J?.beginScrub({clientX:this.#N,pointerId:J.pointerId,startValue:this.#P})}this.#J?.updateScrub(J),this.#OJ(J.clientX)}#UJ(J){if(J?.pointerId!==void 0&&this.#U!==null&&J.pointerId!==this.#U)return;let Q=this.#L;if(this.#a(),this.#l(),Q){this.#J?.endScrub(),this.#T=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#T=!1,this.#F=0},0),requestAnimationFrame(()=>this.#J?.focus());return}this.#_?.querySelector("input")?.focus()}#l(){window.removeEventListener("pointermove",this.#I),window.removeEventListener("pointerup",this.#V),window.removeEventListener("pointercancel",this.#V),window.removeEventListener("blur",this.#V),this.#U=null,this.#L=!1,this.removeAttribute("data-number-scrubbing")}#KJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#T&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#T=!1;return}if(!(J.target instanceof Element)||!J.target.closest("fig-input-wheel"))this.#J?.focus()}get value(){return d(this.getAttribute("value"))}set value(J){this.#e(J)}get min(){return this.#J?.min??null}set min(J){if(J===null||J===void 0||J==="")this.removeAttribute("min");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("min",String(Q));else this.removeAttribute("min")}}get max(){return this.#J?.max??null}set max(J){if(J===null||J===void 0||J==="")this.removeAttribute("max");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("max",String(Q));else this.removeAttribute("max")}}get defaultValue(){return this.getAttribute("default")??this.#M??"0"}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){this.#e(this.defaultValue),b(this)}focus(J){this.#J?.focus(J)}}L("propskit-wheel",l);class bJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping","precision"];#Z=50;#$=50;#J=75;#Q=75;#_=0;#j=!1;#Y=0;#B=null;#M=null;#X=null;#q=null;#G=null;#O=null;#k=null;#U=null;#N=null;#K=!1;#P=!1;#L=!1;#T=!1;#F=null;#W="";#H="";#z=null;#f=null;#R=null;#D="";#h="";#I=null;#V=null;#p=null;get#y(){return this.getAttribute("type")||"point"}get#b(){return this.#y==="point-radius"||this.#y==="point-radius-angle"}get#x(){return this.#y==="point-radius-angle"}get#C(){return this.#y==="point-point"}get#A(){return this.#y==="point-radius-angle"||this.#y==="point-point"}get#d(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#m(){let J=this.getAttribute("snapping");if(J===null)return"false";let Q=J.trim().toLowerCase();if(Q==="modifier")return"modifier";if(Q===""||Q==="true")return"true";return"false"}get#E(){let J=Number(this.getAttribute("precision")??2);if(!Number.isFinite(J))return 2;return Math.max(0,Math.min(8,Math.trunc(J)))}#S(J){let Q=10**this.#E,Z=Math.round(J*Q)/Q;return Object.is(Z,-0)?0:Z}#jJ(){let J=this.getAttribute("precision");for(let Q of[this.#B,this.#X,this.#M]){if(!Q)continue;if(J===null)Q.removeAttribute("precision");else Q.setAttribute("precision",String(this.#E))}}#w(J){let Q=this.#m;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#v(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${this.#S(this.#Z)}%, ${this.#S(this.#$)}%`}get#i(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${this.#S(this.#J)}%, ${this.#S(this.#Q)}%`}get#t(){return this.getAttribute("drag-surface")||"parent"}get#r(){let J=this.#t;if(J==="parent")return this.parentElement;return this.closest(J)}get#g(){let J=this.#t;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#kJ(J){if(this.#j)return this.#_/100*J;return this.#_}#n(){let J=this.#S(this.#_);if(this.#j)return`Radius ${J}%`;return`Radius ${J}`}connectedCallback(){this.#e(),this.#QJ()}disconnectedCallback(){this.#VJ(),this.#bJ(),this.#BJ(),this.#JJ(),document.body.classList.remove("fig-lab-move-active"),document.body.classList.remove("fig-lab-rotate-active")}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"&&!this.#K&&!this.#P&&!this.#L&&!this.#T)if(this.#e(),this.#B)this.#u();else this.#QJ();if(J==="type")this.#VJ(),this.#e(),this.#QJ();if(J==="color"&&this.#B)if(Z)this.#B.setAttribute("color",Z);else this.#B.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#QJ();if(J==="tooltips")this.#QJ();if(J==="snapping"&&this.#B){if(this.#B.setAttribute("drag-snapping",Z||"false"),this.#M)this.#M.setAttribute("drag-snapping",Z||"false")}if(J==="precision"){if(!this.isConnected)return;this.#jJ(),this.#Z=this.#S(this.#Z),this.#$=this.#S(this.#$),this.#J=this.#S(this.#J),this.#Q=this.#S(this.#Q),this.#_=this.#S(this.#_),this.#Y=this.#S(this.#Y),this.#u(),this.#c()}if(J==="name"){if(this.#O)this.#O.setAttribute("text",this.#v);if(this.#k)this.#k.setAttribute("text",this.#i)}}#e(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#Z=this.#S(Q.x);if(typeof Q.y==="number")this.#$=this.#S(Q.y);if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#j=!0,this.#_=this.#S(parseFloat(Z));else this.#j=!1,this.#_=this.#S(parseFloat(Z));if(!Number.isFinite(this.#_))this.#_=0}if(typeof Q.angle==="number")this.#Y=this.#S(Q.angle);if(typeof Q.x2==="number")this.#J=this.#S(Q.x2);if(typeof Q.y2==="number")this.#Q=this.#S(Q.y2);if(this.#y==="color"&&typeof Q.color==="string"&&Q.color.trim()&&this.getAttribute("color")!==Q.color.trim())this.setAttribute("color",Q.color.trim())}catch{}}get value(){let J={x:this.#S(this.#Z),y:this.#S(this.#$)};if(this.#y==="color"){let Q=this.getAttribute("color")||this.#B?.getAttribute("color");if(Q)J.color=Q}if(this.#b){let Q=this.#S(this.#_);J.radius=this.#j?`${Q}%`:Q}if(this.#x)J.angle=this.#S(this.#Y);if(this.#C)J.x2=this.#S(this.#J),J.y2=this.#S(this.#Q);return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#QJ(){this.#VJ(),this.replaceChildren(),this.#B=null,this.#M=null,this.#X=null,this.#q=null,this.#G=null,this.#O=null,this.#k=null,this.#U=null,this.#N=null;let J=O(this,"disabled"),Q=this.#y,Z=this.#d,$=this.#g,j=document.createElement("fig-handle");if(j.setAttribute("drag","true"),j.setAttribute("drag-surface",$),j.setAttribute("drag-axes","x,y"),j.setAttribute("drag-snapping",this.#m),j.setAttribute("value",`${this.#Z}% ${this.#$}%`),this.hasAttribute("precision"))j.setAttribute("precision",String(this.#E));if(J)j.setAttribute("disabled","");if(Q==="color"){j.setAttribute("type","color");let _=this.getAttribute("color");if(_)j.setAttribute("color",_)}else j.setAttribute("type","canvas");if(this.#C)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#B=j,this.#b)this.#a();if(this.#A)this.#ZJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#v),_.appendChild(j),this.appendChild(_),this.#O=_}else this.appendChild(j);if(this.#x)this.#o(J,Z,$);if(this.#C)this.#UJ(J,Z,$);this.#s(this.#B),this.#s(this.#X),this.#s(this.#M),this.#DJ(),this.#PJ(),requestAnimationFrame(()=>this.#u())}#s(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#LJ(Q,J);else this.#NJ(Q)},{capture:!0})}#NJ(J){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#F===null)this.#W=document.body.style.getPropertyValue("cursor"),this.#H=document.body.style.getPropertyPriority("cursor");if(this.#F=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#z)this.#z=(Q)=>{if(Q?.pointerId!==void 0&&this.#F!==null&&Q.pointerId!==this.#F)return;if(Q?.type==="blur")this.#BJ();else requestAnimationFrame(()=>this.#BJ())};window.addEventListener("pointerup",this.#z),window.addEventListener("pointercancel",this.#z),window.addEventListener("blur",this.#z)}#BJ(){if(this.#F===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#W)document.body.style.setProperty("cursor",this.#W,this.#H);else document.body.style.removeProperty("cursor");if(this.#F=null,this.#W="",this.#H="",this.#z)window.removeEventListener("pointerup",this.#z),window.removeEventListener("pointercancel",this.#z),window.removeEventListener("blur",this.#z)}#GJ(J){if(!J)return 0;if(J===this.#X)return this.#Y;if(!this.#C)return 0;let Q=this.#FJ();return J===this.#B?Q+180:Q}#qJ(){if(this.#f===null)return;let J=this.#KJ(this.#GJ(this.#R));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#LJ(J,Q){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#f===null)this.#D=document.body.style.getPropertyValue("cursor"),this.#h=document.body.style.getPropertyPriority("cursor");if(this.#f=J?.pointerId??-1,this.#R=Q,document.body.classList.add("fig-lab-rotate-active"),this.#qJ(),!this.#I)this.#I=(Z)=>{if(Z?.pointerId!==void 0&&this.#f!==null&&Z.pointerId!==this.#f)return;if(Z?.type==="blur")this.#JJ();else requestAnimationFrame(()=>this.#JJ())};window.addEventListener("pointerup",this.#I),window.addEventListener("pointercancel",this.#I),window.addEventListener("blur",this.#I)}#JJ(){if(this.#f===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#D)document.body.style.setProperty("cursor",this.#D,this.#h);else document.body.style.removeProperty("cursor");if(this.#f=null,this.#R=null,this.#D="",this.#h="",this.#I)window.removeEventListener("pointerup",this.#I),window.removeEventListener("pointercancel",this.#I),window.removeEventListener("blur",this.#I)}#_J(J,Q,Z,$){if(!J)return;let j=()=>!!$?.(),_=()=>{let B=Q();if(!B)return;B.removeAttribute("show"),B.hidePopup?.()},X=()=>{if(j()){_();return}let B=Q();if(!B)return;if(Z)B.setAttribute("text",Z());B.setAttribute("show","true"),B.showPopup?.()},q=()=>{_()};J.addEventListener("pointerenter",X),J.addEventListener("pointerleave",q)}#XJ(){return this.#K||this.#P||this.#L||this.#T}#PJ(){if(this.#B)this.#_J(this.#B,()=>this.#O,()=>this.#v,()=>this.#XJ()||!!this.#B?.querySelector("fig-color-tip"));if(this.#X)this.#_J(this.#X,()=>this.#N,()=>`Angle ${this.#S(this.#Y)}°`,()=>this.#XJ());if(this.#M)this.#_J(this.#M,()=>this.#k,()=>this.#i,()=>this.#XJ());if(this.#q){let J=this.#q.querySelector(".fig-canvas-control-radius-hit");this.#SJ(J||this.#q)}if(this.#y==="color"&&this.#B&&this.#O)new MutationObserver(()=>{if(this.#B?.querySelector("fig-color-tip"))this.#O?.removeAttribute("show"),this.#O?.hidePopup?.()}).observe(this.#B,{childList:!0,subtree:!0})}#OJ(J,Q){let Z=this.#U;if(!Z?.popup)return;let $=Q-8;Z.popup.anchor={getBoundingClientRect:()=>({left:J,top:$,right:J,bottom:$,width:0,height:0,x:J,y:$})},Z.popup.queueReposition?.()}#SJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#U;if(!Z)return;Z.setAttribute("text",this.#n()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#L)return;this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#L)return;let Q=this.#U;if(!Q)return;Q.removeAttribute("show")})}#a(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");Q.classList.add("fig-canvas-control-radius"),Q.setAttribute("overflow","visible");let Z=document.createElementNS("http://www.w3.org/2000/svg","circle");Z.classList.add("fig-canvas-control-radius-hit"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","circle");$.classList.add("fig-canvas-control-radius-halo"),Q.appendChild($);let j=document.createElementNS("http://www.w3.org/2000/svg","circle");if(Q.appendChild(j),this.#q=Q,this.#d){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#n()),_.appendChild(Q),this.appendChild(_),this.#U=_}else this.appendChild(Q);this.#IJ(Z)}#ZJ(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");if(Q.classList.add("fig-canvas-control-angle-svg"),Q.setAttribute("overflow","visible"),Q.style.position="absolute",Q.style.pointerEvents="none",this.#C){let j=document.createElementNS("http://www.w3.org/2000/svg","line");j.classList.add("fig-canvas-control-angle-line-hit"),j.setAttribute("stroke","transparent"),j.setAttribute("stroke-width","12"),j.setAttribute("stroke-linecap","round"),j.style.pointerEvents="stroke",Q.appendChild(j),this.#WJ(j)}let Z=document.createElementNS("http://www.w3.org/2000/svg","line");Z.classList.add("fig-canvas-control-angle-line-halo"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","line");$.classList.add("fig-canvas-control-angle-line"),Q.appendChild($),this.#G=Q,this.appendChild(Q)}#WJ(J){J.addEventListener("pointerdown",(Q)=>{if(O(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#r;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#$,q=this.#J,B=this.#Q;this.#K=!0,this.#P=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let Y=(M)=>{let k=Z.getBoundingClientRect(),U=k.width>0?(M.clientX-$)/k.width*100:0,P=k.height>0?(M.clientY-j)/k.height*100:0,T=-Math.min(_,q),H=100-Math.max(_,q),D=-Math.min(X,B),A=100-Math.max(X,B),z=Math.max(T,Math.min(H,U)),I=Math.max(D,Math.min(A,P));this.#Z=this.#S(_+z),this.#$=this.#S(X+I),this.#J=this.#S(q+z),this.#Q=this.#S(B+I),this.#u(),this.#YJ()},G=this.#zJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#K=!1,this.#P=!1,M)this.#c(),this.#$J()});window.addEventListener("pointermove",Y,{signal:G.signal}),window.addEventListener("pointerup",()=>G.finish(!0),{signal:G.signal}),window.addEventListener("pointercancel",()=>G.finish(!1),{signal:G.signal})})}#o(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("size","small"),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#E));if(J)$.setAttribute("disabled","");if(this.#X=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",`${this.#S(this.#Y)}°`),j.appendChild($),this.appendChild(j),this.#N=j}else this.appendChild($)}#UJ(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("drag-snapping",this.#m),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#Q}%`),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#E));if(J)$.setAttribute("disabled","");if(this.#M=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#i),j.appendChild($),this.appendChild(j),this.#k=j}else this.appendChild($)}#l(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.1212 16.9998L11.5607 17.4394C12.1465 18.0252 12.1464 18.975 11.5606 19.5607C10.9748 20.1465 10.0251 20.1465 9.4393 19.5606L6.4393 16.5604C5.85354 15.9746 5.85357 15.0249 6.43938 14.4391L9.43938 11.4393C10.0252 10.8535 10.9749 10.8536 11.5607 11.4394C12.1465 12.0252 12.1464 12.9749 11.5606 13.5607L11.1215 13.9998L20.8786 13.9999L20.4394 13.5607C19.8536 12.9749 19.8535 12.0252 20.4393 11.4394C21.0251 10.8536 21.9749 10.8536 22.5606 11.4394L25.5606 14.4393C25.842 14.7206 26 15.1021 26 15.4999C26 15.8978 25.842 16.2793 25.5607 16.5606L22.5607 19.5607C21.9749 20.1465 21.0251 20.1465 20.4393 19.5607C19.8536 18.9749 19.8535 18.0252 20.4393 17.4394L20.8788 16.9999L11.1212 16.9998Z' fill='white'/%3E%3C/g%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M10.8536 12.1465C11.0488 12.3417 11.0488 12.6583 10.8535 12.8536L8.70715 14.9998L23.2929 14.9999L21.1465 12.8536C20.9512 12.6583 20.9512 12.3417 21.1464 12.1465C21.3417 11.9512 21.6583 11.9512 21.8535 12.1465L24.8535 15.1464C24.9473 15.2402 25 15.3673 25 15.4999C25 15.6326 24.9473 15.7597 24.8536 15.8535L21.8536 18.8536C21.6583 19.0488 21.3417 19.0488 21.1465 18.8536C20.9512 18.6583 20.9512 18.3417 21.1464 18.1465L23.2929 15.9999L8.70705 15.9998L10.8536 18.1465C11.0488 18.3417 11.0488 18.6583 10.8535 18.8536C10.6583 19.0488 10.3417 19.0488 10.1464 18.8535L7.14643 15.8533C6.95118 15.658 6.95119 15.3415 7.14646 15.1462L10.1465 12.1464C10.3417 11.9512 10.6583 11.9512 10.8536 12.1465Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='3' y='9' width='26' height='15' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, nwse-resize`}#KJ(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J-45)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath d='M12.5607 22.4393L12.0216 21.9002C17.1558 21.2216 21.2216 17.1558 21.9002 12.0216L22.4393 12.5607C23.0251 13.1464 23.9749 13.1464 24.5607 12.5607C25.1464 11.9749 25.1464 11.0251 24.5607 10.4393L21.5607 7.43934C20.9749 6.85355 20.0251 6.85355 19.4393 7.43934L16.4393 10.4393C15.8536 11.0251 15.8536 11.9749 16.4393 12.5607C17.0251 13.1464 17.9749 13.1464 18.5607 12.5607L18.8056 12.3157C18.1013 15.5527 15.5527 18.1013 12.3157 18.8056L12.5607 18.5607C13.1464 17.9749 13.1464 17.0251 12.5607 16.4393C11.9749 15.8536 11.0251 15.8536 10.4393 16.4393L7.43934 19.4393C6.85356 20.0251 6.85356 20.9749 7.43934 21.5607L10.4393 24.5607C11.0251 25.1464 11.9749 25.1464 12.5607 24.5607C13.1464 23.9749 13.1464 23.0251 12.5607 22.4393Z' fill='white'/%3E%3C/g%3E%3Cpath d='M23.8536 11.8536C23.6583 12.0488 23.3417 12.0488 23.1464 11.8536L21 9.70711V10.5C21 16.299 16.299 21 10.5 21H9.70711L11.8536 23.1464C12.0488 23.3417 12.0488 23.6583 11.8536 23.8536C11.6583 24.0488 11.3417 24.0488 11.1464 23.8536L8.14645 20.8536C7.95119 20.6583 7.95119 20.3417 8.14645 20.1464L11.1464 17.1464C11.3417 16.9512 11.6583 16.9512 11.8536 17.1464C12.0488 17.3417 12.0488 17.6583 11.8536 17.8536L9.70711 20H10.5C15.7467 20 20 15.7467 20 10.5V9.70711L17.8536 11.8536C17.6583 12.0488 17.3417 12.0488 17.1464 11.8536C16.9512 11.6583 16.9512 11.3417 17.1464 11.1464L20.1464 8.14645C20.3417 7.95119 20.6583 7.95119 20.8536 8.14645L23.8536 11.1464C24.0488 11.3417 24.0488 11.6583 23.8536 11.8536Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='4' y='5' width='24' height='24' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, pointer`}#HJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#TJ(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#HJ(Z,this.#KJ(Q)),this.#R===J)this.#qJ()}#MJ(){if(!this.#X||!this.#x)return;this.#TJ(this.#X,this.#Y)}#FJ(){return Math.atan2(this.#Q-this.#$,this.#J-this.#Z)*180/Math.PI}#CJ(){if(!this.#C)return;let J=this.#FJ();this.#B?.style.removeProperty("cursor"),this.#M?.style.removeProperty("cursor"),this.#TJ(this.#B,J+180),this.#TJ(this.#M,J)}#RJ(J,Q,Z,$){J.style.setProperty("--fig-handle-position-translate","-50% -50%"),J.style.left=`${Q/100*$.width}px`,J.style.top=`${Z/100*$.height}px`}#u(){let J=this.#r;if(!J||!this.#B)return;let Q=J.getBoundingClientRect();if(this.#RJ(this.#B,this.#Z,this.#$,Q),this.#q){let Z=this.#Z/100*Q.width,$=this.#$/100*Q.height,j=this.#kJ(Q.width),_=this.#q,X=Math.max(j*2,1);_.style.position="absolute",_.style.width=`${X}px`,_.style.height=`${X}px`,_.style.left=`${Z-j}px`,_.style.top=`${$-j}px`,_.setAttribute("viewBox",`0 0 ${X} ${X}`);let q=_.querySelectorAll("circle");for(let B of q)B.setAttribute("cx",String(j)),B.setAttribute("cy",String(j)),B.setAttribute("r",String(Math.max(j-1,0)))}if(this.#G&&this.#A){let Z=this.#Z/100*Q.width,$=this.#$/100*Q.height,j,_;if(this.#C)j=this.#J/100*Q.width,_=this.#Q/100*Q.height;else{let B=this.#kJ(Q.width),Y=this.#Y*Math.PI/180;j=Z+B*Math.cos(Y),_=$+B*Math.sin(Y)}let X=this.#G;X.style.width=`${Q.width}px`,X.style.height=`${Q.height}px`,X.style.left="0",X.style.top="0",X.setAttribute("viewBox",`0 0 ${Q.width} ${Q.height}`);let q=X.querySelectorAll(".fig-canvas-control-angle-line, .fig-canvas-control-angle-line-halo, .fig-canvas-control-angle-line-hit");for(let B of q)B.setAttribute("x1",String(Z)),B.setAttribute("y1",String($)),B.setAttribute("x2",String(j)),B.setAttribute("y2",String(_))}if(this.#X&&this.#x){let Z=this.#Z/100*Q.width,$=this.#$/100*Q.height,j=this.#kJ(Q.width),_=this.#Y*Math.PI/180,X=Z+j*Math.cos(_),q=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,Y=Q.height>0?q/Q.height*100:0;this.#RJ(this.#X,B,Y,Q)}if(this.#M&&this.#C)this.#RJ(this.#M,this.#J,this.#Q,Q);this.#MJ(),this.#CJ()}#YJ(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#$J(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#fJ(J){return{...this.value,...xJ(J.color,J.alpha,J.opacity)}}#c(){this.setAttribute("value",JSON.stringify(this.value))}#DJ(){if(!this.#B)return;if(this.#B.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#YJ(this.#fJ(J.detail));return}this.#K=!0;let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#$/100;if(this.#Z=this.#S(Math.max(0,Math.min(100,Q*100))),this.#$=this.#S(Math.max(0,Math.min(100,Z*100))),this.#O)this.#O.removeAttribute("show"),this.#O.hidePopup?.();this.#u(),this.#YJ()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#$J(this.#fJ(J.detail));return}let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#$/100;if(this.#Z=this.#S(Math.max(0,Math.min(100,Q*100))),this.#$=this.#S(Math.max(0,Math.min(100,Z*100))),this.#O)this.#O.removeAttribute("show");this.#u(),this.#c(),this.#$J(),requestAnimationFrame(()=>{this.#K=!1})}),this.#X)this.#X.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#r;if(!Q)return;this.#T=!0,this.classList.add("fig-canvas-control-ring-active");let Z=Q.getBoundingClientRect(),$=this.#Z/100*Z.width,j=this.#$/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#X.offsetWidth/2,B=this.#X.offsetHeight/2,Y=_+q-$,G=X+B-j,M=Math.atan2(G,Y)*180/Math.PI;if(this.#w(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#Y=this.#S(M);let k=Math.sqrt(Y*Y+G*G);if(this.#w(J.detail?.shiftKey)){let U=this.#j?5:10;if(this.#j){let P=k/Z.width*100;P=Math.round(P/U)*U,k=P/100*Z.width}else k=Math.round(k/U)*U}if(this.#j)this.#_=this.#S(Math.max(0,k/Z.width*100));else this.#_=this.#S(Math.max(0,k));if(this.#N)this.#N.setAttribute("text",`Angle ${this.#S(this.#Y)}°`),this.#N.setAttribute("show","true"),this.#N.showPopup?.();this.#u(),this.#YJ()}),this.#X.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#N)this.#N.removeAttribute("show");this.#u(),this.#c(),this.#$J(),requestAnimationFrame(()=>{this.#T=!1})}),this.#X.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#r;if(!Z)return;if(this.#T=!0,this.classList.add("fig-canvas-control-ring-active"),this.#X.setAttribute("selected",""),this.#N)this.#N.setAttribute("show","true"),this.#N.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),q=this.#Z/100*X.width,B=this.#$/100*X.height,Y=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,Y)*180/Math.PI;if(this.#w(_.shiftKey))M=Math.round(M/15)*15;if(this.#Y=this.#S(M),this.#N)this.#N.setAttribute("text",`Angle ${this.#S(M)}°`);this.#u(),this.#YJ()},j=this.#zJ((_)=>{if(this.#T=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#X.removeAttribute("selected"),this.#N)this.#N.removeAttribute("show");if(_)this.#c(),this.#$J()});window.addEventListener("pointermove",$,{signal:j.signal}),window.addEventListener("pointerup",()=>j.finish(!0),{signal:j.signal}),window.addEventListener("pointercancel",()=>j.finish(!1),{signal:j.signal})});if(this.#M)this.#M.addEventListener("input",(J)=>{J.stopPropagation(),this.#P=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#Q/100;if(this.#J=this.#S(Math.max(0,Math.min(100,Q*100))),this.#Q=this.#S(Math.max(0,Math.min(100,Z*100))),this.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#u(),this.#YJ()}),this.#M.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#k)this.#k.removeAttribute("show");this.#u(),this.#c(),this.#$J(),requestAnimationFrame(()=>{this.#P=!1})}),this.#AJ(this.#B,!0),this.#AJ(this.#M,!1)}#AJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#r;if(!j)return;this.#K=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#Q:this.#$,B=Q?this.#Z:this.#J,Y=Q?this.#$:this.#Q,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,U=Y/100*_.height,P=Math.sqrt((k-G)**2+(U-M)**2),T=Q?this.#O:this.#k;if(T)T.removeAttribute("show"),T.hidePopup?.();let H=(A)=>{let z=j.getBoundingClientRect(),I=X/100*z.width,E=q/100*z.height,y=A.clientX-z.left-I,w=A.clientY-z.top-E,x=Math.atan2(w,y);if(this.#w(A.shiftKey))x=Math.round(x*180/Math.PI/15)*15*Math.PI/180;let e=I+P*Math.cos(x),a=E+P*Math.sin(x),p=Math.max(0,Math.min(100,e/z.width*100)),g=Math.max(0,Math.min(100,a/z.height*100));if(Q)this.#Z=this.#S(p),this.#$=this.#S(g);else this.#J=this.#S(p),this.#Q=this.#S(g);this.#u(),this.#YJ()},D=this.#zJ((A)=>{if(this.#K=!1,T)T.removeAttribute("show");if(A)this.#c(),this.#$J()});window.addEventListener("pointermove",H,{signal:D.signal}),window.addEventListener("pointerup",()=>D.finish(!0),{signal:D.signal}),window.addEventListener("pointercancel",()=>D.finish(!1),{signal:D.signal})})}#IJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#L)return;let $=this.#r;if(!$)return;let j=$.getBoundingClientRect(),_=this.#Z/100*j.width,X=this.#$/100*j.height,q=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#HJ(J,this.#l(q))});let Q=(Z)=>{if(O(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#L=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#r;if(!$)return;if(this.#U)this.#U.setAttribute("show","true"),this.#U.showPopup?.(),this.#OJ(Z.clientX,Z.clientY);if(this.#N)this.#N.removeAttribute("show"),this.#N.hidePopup?.();let j=this.#X?.style.pointerEvents,_=this.#X?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#X)this.#X.style.pointerEvents="none";if(_)_.style.pointerEvents="none";let q=document.body.style.cursor;J.style.pointerEvents="none";let B=$.getBoundingClientRect(),Y=this.#Z/100*B.width,G=this.#$/100*B.height,M=Math.atan2(Z.clientY-B.top-G,Z.clientX-B.left-Y)*180/Math.PI,k=Math.round(M);document.body.style.cursor=this.#l(k);let U=(T)=>{let H=$.getBoundingClientRect(),D=this.#Z/100*H.width,A=this.#$/100*H.height,z=T.clientX-H.left-D,I=T.clientY-H.top-A,E=Math.round(Math.atan2(I,z)*180/Math.PI);if(E!==k)k=E,document.body.style.cursor=this.#l(E);let y=Math.sqrt(z*z+I*I);if(this.#w(T.shiftKey)){let w=this.#j?5:10;if(this.#j){let x=y/H.width*100;x=Math.round(x/w)*w,y=x/100*H.width}else y=Math.round(y/w)*w}if(this.#j)this.#_=this.#S(Math.max(0,y/H.width*100));else this.#_=this.#S(Math.max(0,y));if(this.#U)this.#U.setAttribute("text",this.#n()),this.#OJ(T.clientX,T.clientY);this.#u(),this.#YJ()},P=this.#zJ((T)=>{if(this.#L=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#X)this.#X.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=q,this.#U)this.#U.removeAttribute("show");if(T)this.#c(),this.#$J()});window.addEventListener("pointermove",U,{signal:P.signal}),window.addEventListener("pointerup",()=>P.finish(!0),{signal:P.signal}),window.addEventListener("pointercancel",()=>P.finish(!1),{signal:P.signal})};J.addEventListener("pointerdown",Q),this._radiusDragCleanup=()=>J.removeEventListener("pointerdown",Q)}#bJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#zJ(J){this.#VJ();let Q=new AbortController,Z=!1,$=(j=!1)=>{if(Z)return;if(Z=!0,Q.abort(),this.#V===Q)this.#V=null,this.#p=null;J(j)};return this.#V=Q,this.#p=$,{signal:Q.signal,finish:$}}#VJ(){this.#p?.(!1),this.#V?.abort(),this.#V=null,this.#p=null}}L("fig-canvas-control",bJ);class F extends S{#Z=[F.#R()];#$=0;#J=2;#Q=240;#_=120;#j={min:-1,max:1};#Y=null;#B=null;#M=null;#X=null;#q=0;#G=null;#O=null;#k=null;#U=null;#N=[];#K=[];#P=[];#L=[];#T=new Set;#F=null;#W=null;#H=null;#z=null;#f=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#R(J="sine"){return{type:J,frequency:1,amplitude:1,phase:0,offset:0}}static get observedAttributes(){return["value","precision","aspect-ratio","edit","disabled"]}connectedCallback(){if(this.#f===null)this.#f=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify({waves:[F.#R()]});this.#J=this.#D("precision",2),this.#y(this.getAttribute("value")),this.#p(),this.#i(),this.#NJ(),W(this)}disconnectedCallback(){if(this.#FJ(),this.#PJ(),this.#F)this.#F.disconnect(),this.#F=null;f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#y(Z),this.isConnected)this.#i();return}if(J==="precision"){if(this.#J=this.#D("precision",2),this.isConnected)this.#u();return}if(J==="aspect-ratio"){if(this.#p(),this.#B)this.#_J();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#i()}}get value(){return JSON.stringify(this.data)}set value(J){this.setAttribute("value",typeof J==="object"&&J!==null?JSON.stringify(J):J)}get defaultValue(){return this.getAttribute("default")??this.#f??""}get isDefault(){let J=this.#b(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#C(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#c("input"),this.#c("change")}get data(){return{waves:this.#Z.map((J)=>this.#C(J))}}get preset(){let J=this.#A;return F.TYPES.find((Q)=>Q.value===J.type)?.name}#D(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#h(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#I(){return this.getAttribute("edit")!=="false"}#V(){return this.#h("disabled",!1)}#p(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#y(J){let Q=this.#b(J);if(!Q)return!1;if(this.#Z=Q,!this.#Z.length)this.#Z=[F.#R()];return this.#$=Math.min(this.#$,this.#Z.length-1),!0}#b(J){if(!J)return null;let Q=null;if(typeof J==="string")try{Q=JSON.parse(J)}catch{return null}else if(typeof J==="object")Q=J;if(!Q)return null;return(Array.isArray(Q)?Q:Array.isArray(Q.waves)?Q.waves:[Q]).map(($)=>this.#x($))}#x(J={}){return{type:this.#d(J.type),frequency:this.#m(J.frequency,1,0.1,16),amplitude:this.#m(J.amplitude,1,-4,4),phase:this.#m(J.phase,0,-360,360),offset:this.#m(J.offset,0,-4,4)}}#C(J){return{type:J.type,frequency:this.#E(J.frequency),amplitude:this.#E(J.amplitude),phase:this.#E(J.phase),offset:this.#E(J.offset)}}get#A(){if(!this.#Z[this.#$])this.#$=0;return this.#Z[this.#$]||F.#R()}#d(J){let Q=String(J||"").toLowerCase();return F.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#m(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#E(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#S(J){return F.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#jJ(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=F.#v(J,q),Y=5+q*j,G=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${Y.toFixed(1)},${G.toFixed(1)}`}return _}static#w(J,Q=24){return h("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},h("path",{d:F.#jJ(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=F.#jJ(J,Q);return`<svg width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}" fill="none"><path d="${Z}" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>`}static#v(J,Q,Z=0){let $=Q+Z/360,j=$-Math.floor($),_=$*Math.PI*2;switch(J){case"square":return Math.sin(_)>=0?1:-1;case"sawtooth":return j*2-1;case"triangle":return 1-Math.abs(j*4-2);default:return Math.sin(_)}}#i(){if(this.#FJ(),this.#PJ(),this.replaceChildren(...this.#r()),this.#e(),this.#BJ(),this.#_J(),this.#WJ(),!this.#V())this.#XJ();W(this)}#t(J,Q){return h("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},N("div",{className:"propskit-oscillator-handle-inner"},N("fig-tooltip",{text:Q},N("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#r(){let J=this.#I()&&!this.#V(),Q=[h("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#Q,height:this.#_}),h("line",{className:"propskit-oscillator-baseline"}),h("path",{className:"propskit-oscillator-path"}),h("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#t("amplitude","Amplitude"),this.#t("frequency","Frequency"));let Z=h("svg",{viewBox:`0 0 ${this.#Q} ${this.#_}`,className:"propskit-oscillator-svg"},Q),$=[N("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#I())$.push(N("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#g(j,_,!J))));return $}#g(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#$,_=F.#S(J.type),X=N("fig-tooltip",{text:"Remove form"},N("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},N("fig-icon",{name:"minus"}))),q=N("fig-header",{borderless:!0},[N("h3",{},_),X,this.#kJ(Z,Q)]),B=N("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#n(Q,"frequency","Frequency",0.1,16,0.1,""),this.#n(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#n(Q,"phase","Phase",-360,360,1,"°"),this.#n(Q,"offset","Offset",-4,4,0.1,"")]);return N("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#T.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#kJ(J,Q){let Z=N("fig-tooltip",{text:"Add form"},N("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},N("fig-icon",{name:"plus"}))),$=F.TYPES.map((j)=>N("fig-menu-item",{value:j.value},[F.#w(j.value,24),N("span",{},j.name)]));return N("fig-menu",{className:"propskit-oscillator-add-type",position:"bottom right","data-wave-index":Q,disabled:J},[Z,$])}#n(J,Q,Z,$,j,_,X){let q=this.#Z[J]||F.#R(),B=Q==="amplitude"||Q==="offset";return N("propskit-slider",{className:"propskit-oscillator-field",label:Z,name:Q,"data-wave-index":J,value:this.#E(q[Q]),min:$,max:j,step:_,precision:this.#J,elastic:"false",type:B?"delta":null,default:B?"0":null,units:X||null,disabled:this.#V()})}#e(){this.#B=this.querySelector(".propskit-oscillator-svg"),this.#M=this.querySelector(".propskit-oscillator-path"),this.#X=this.querySelector(".propskit-oscillator-playhead"),this.#G=this.querySelector(".propskit-oscillator-baseline"),this.#O=this.querySelector(".propskit-oscillator-bounds"),this.#k=this.querySelector('[data-handle="amplitude"]'),this.#U=this.querySelector('[data-handle="frequency"]'),this.#K=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#N=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#L=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#P=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#QJ(J){let Q=new Set;for(let Z of this.#T)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#T=Q}#s(J){let Q=new Set;for(let Z of this.#T)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#T=Q}#NJ(){if(this.#F||!window.ResizeObserver)return;this.#F=new ResizeObserver(()=>{if(this.#BJ())this.#_J()}),this.#F.observe(this)}#BJ(){if(!this.#B)return!1;let J=this.#B.getBoundingClientRect(),Q=Math.max(1,Math.round(J.width||240)),Z=Math.max(1,Math.round(J.height||120)),$=Q!==this.#Q||Z!==this.#_;return this.#Q=Q,this.#_=Z,this.#B.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#GJ(){let J=1,Q=256;for(let Z=0;Z<=Q;Z++)J=Math.max(J,Math.abs(this.#JJ(Z/Q)));return{min:-J,max:J}}#qJ(J){let{min:Q,max:Z}=this.#j;return this.#_-(J-Q)/(Z-Q)*this.#_}#LJ(J){let{min:Q,max:Z}=this.#j;return Q+(1-J/this.#_)*(Z-Q)}#JJ(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=F.#v(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#_J(){if(!this.#B||!this.#M)return;if(this.#BJ(),this.#j=this.#GJ(),this.#O)this.#O.setAttribute("width",this.#Q),this.#O.setAttribute("height",this.#_);let J=Math.max(...this.#Z.map((_)=>_.frequency)),Z=this.#Z.some((_)=>_.type==="square"||_.type==="sawtooth")?Math.max(192,Math.ceil(J*64)):Math.max(96,Math.ceil(J*64)),$="";for(let _=0;_<=Z;_++){let X=_/Z,q=X*this.#Q,B=this.#qJ(this.#JJ(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#M.setAttribute("d",$);let j=this.#qJ(0);this.#G?.setAttribute("x1","0"),this.#G?.setAttribute("y1",j),this.#G?.setAttribute("x2",this.#Q),this.#G?.setAttribute("y2",j),this.#SJ()}#XJ(){if(this.#q||!this.#X)return;let J=(Q)=>{if(!this.isConnected||!this.#X){this.#q=0;return}this.#OJ(Q%1000/1000),this.#q=requestAnimationFrame(J)};this.#q=requestAnimationFrame(J)}#PJ(){if(!this.#q)return;cancelAnimationFrame(this.#q),this.#q=0}#OJ(J){if(!this.#X)return;let Q=J*this.#Q,Z=this.#qJ(this.#JJ(J));this.#X.setAttribute("cx",Q.toFixed(1)),this.#X.setAttribute("cy",Z.toFixed(1))}#SJ(){let Q=this.#A,Z=this.#a(),$=Math.max(8,Math.min(this.#Q-8,this.#Q/Q.frequency)),j=this.#qJ(this.#JJ(Z/this.#Q)),_=this.#qJ(this.#JJ($/this.#Q));this.#ZJ(this.#k,Z,j,8),this.#ZJ(this.#U,$,_,8)}#a(){let J=this.#A,Q=J.phase/360,Z=Math.max(0.1,J.frequency),$=0.25;if(J.type==="triangle")$=0.5;if(J.type==="sawtooth")$=1;let j=($-Q)/Z;while(j<0)j+=1/Z;while(j>1)j-=1/Z;if(j<0||j>1||!Number.isFinite(j))j=0.25;return Math.max(8,Math.min(this.#Q-8,j*this.#Q))}#ZJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#WJ(){if(!this.#I()||this.#V())return;for(let Q of this.#K)Q.addEventListener("change",(Z)=>{if(this.#V())return;let $=this.#o(Q);this.#l($),this.#Z[$].type=this.#d(Z.detail??Z.target?.value),this.#u(),this.#c("input"),this.#c("change")});for(let Q of this.#N)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#W=Q;try{this.#KJ(this.#o(Q),Q.getAttribute("name"),Z.detail?.value??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#W=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#KJ(this.#o(Q),Q.getAttribute("name"),Z.detail?.value??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#L)Q.addEventListener("pointerdown",()=>{this.#l(this.#o(Q))}),Q.addEventListener("focusin",()=>{this.#l(this.#o(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#o(Q);if(Z.detail?.open)this.#T.add($);else this.#T.delete($)});for(let Q of this.querySelectorAll(".propskit-oscillator-add-type")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.addEventListener("change",($)=>{if($.target!==Q)return;if(this.#V())return;let _=this.#o(Q)+1,X=this.#d($.detail?.value??Q.value);this.#Z.splice(_,0,F.#R(X)),this.#s(_),this.#$=_,this.#i(),this.#c("input"),this.#c("change")})}for(let Q of this.querySelectorAll(".propskit-oscillator-add-type-button")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.closest("fig-tooltip")?.addEventListener("pointerdown",Z),Q.closest("fig-tooltip")?.addEventListener("click",Z)}for(let Q of this.querySelectorAll(".propskit-oscillator-remove-button"))Q.addEventListener("pointerdown",(Z)=>{Z.stopPropagation()}),Q.addEventListener("click",(Z)=>{if(Z.stopPropagation(),this.#V()||this.#Z.length<=1)return;let $=this.#o(Q);this.#Z.splice($,1),this.#QJ($),this.#$=Math.min(this.#$,this.#Z.length-1),this.#i(),this.#c("input"),this.#c("change")});for(let Q of[this.#k,this.#U])this.#UJ(Q);this.querySelector(".propskit-oscillator-svg-container")?.addEventListener("pointerdown",(Q)=>{if(this.#V())return;if(Q.target?.closest?.(".propskit-oscillator-handle, fig-handle"))return;this.#MJ(Q,"offset")})}#o(J){let Q=Number.parseInt(J?.getAttribute("data-wave-index")||"",10);return Number.isFinite(Q)?Math.min(this.#Z.length-1,Math.max(0,Q)):0}#UJ(J){let Q=J?.querySelector("fig-handle"),Z=J?.getAttribute("data-handle");if(!Q||!Z)return;Q.addEventListener("pointerdown",($)=>{if(this.#V())return;$.preventDefault(),$.stopImmediatePropagation(),this.#MJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#V())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#HJ($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#l(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#$)return;this.#$=Q,this.#fJ(),this.#SJ()}#KJ(J,Q,Z,$){if(this.#V())return;this.#l(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#$J();return}this.#Z[J]=this.#x({...this.#Z[J],[Q]:j}),this.#u({skipFieldSync:$=="input"}),this.#c($)}#HJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#A;switch(Q){case"amplitude":if(J.key==="ArrowUp")$.amplitude+=Z;else if(J.key==="ArrowDown")$.amplitude-=Z;else if(J.key==="Home")$.amplitude=-4;else if(J.key==="End")$.amplitude=4;else return!1;break;case"offset":if(J.key==="ArrowUp")$.offset+=Z;else if(J.key==="ArrowDown")$.offset-=Z;else if(J.key==="Home")$.offset=-4;else if(J.key==="End")$.offset=4;else return!1;break;case"frequency":if(J.key==="ArrowLeft")$.frequency-=Z;else if(J.key==="ArrowRight")$.frequency+=Z;else if(J.key==="Home")$.frequency=0.1;else if(J.key==="End")$.frequency=16;else return!1;break;default:return!1}return this.#Z[this.#$]=this.#x($),this.#u(),this.#c("input"),this.#c("change"),!0}#TJ(J){let Q=this.#B?.getScreenCTM();if(!Q)return{x:0,y:0};let Z=Q.inverse();return{x:Z.a*J.clientX+Z.c*J.clientY+Z.e,y:Z.b*J.clientX+Z.d*J.clientY+Z.f}}#MJ(J,Q){this.#FJ(),this.#Y=Q,this.#B?.classList.add("dragging");let Z=Q==="frequency"?"ew-resize":Q==="amplitude"?"ns-resize":"",$=document.body.style.cursor;if(Z)document.body.style.cursor=Z;let j=(q)=>{if(!this.#Y)return;let B=this.#TJ(q),Y=this.#A;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#Q,B.x));Y.frequency=this.#Q/G}else if(Q==="offset"){let G=this.#m(B.x/this.#Q,0,0,1),M=this.#RJ(Y,G);Y.offset=this.#LJ(B.y)-this.#CJ(this.#$,G)-M*Y.amplitude}else if(Q==="amplitude"){let G=this.#m(B.x/this.#Q,0,0,1),M=this.#RJ(Y,G),k=this.#LJ(B.y)-this.#CJ(this.#$,G)-Y.offset;Y.amplitude=Math.abs(M)<0.001?Y.amplitude:k/M}this.#Z[this.#$]=this.#x(Y),this.#u(),this.#c("input")},_=new AbortController,X=(q=!1)=>{if(this.#Y=null,this.#B?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#H===_)this.#H=null,this.#z=null;if(q)this.#c("change")};this.#H=_,this.#z=X,document.addEventListener("pointermove",j,{signal:_.signal}),document.addEventListener("pointerup",()=>X(!0),{signal:_.signal}),document.addEventListener("pointercancel",()=>X(!1),{signal:_.signal}),window.addEventListener("blur",()=>X(!1),{signal:_.signal})}#FJ(){this.#z?.(!1),this.#H?.abort(),this.#H=null,this.#z=null,this.#Y=null,this.#B?.classList.remove("dragging")}#CJ(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=F.#v($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#RJ(J,Q){return F.#v(J.type,Q*J.frequency,J.phase)}#u({skipFieldSync:J=!1}={}){if(this.#YJ(),!J)this.#$J();this.#fJ(),this.#_J()}#YJ(){for(let J of this.#K){let Q=this.#o(J);J.value=this.#Z[Q]?.type||"sine"}}#$J(){for(let J of this.#N){if(J===this.#W)continue;let Q=this.#o(J),Z=J.getAttribute("name"),$=this.#E(this.#Z[Q]?.[Z]??0),j=J.querySelector("fig-slider");if(j)j.value=$;else J.setAttribute("value",String($))}}#fJ(){for(let J of this.#P)if(this.#o(J)===this.#$)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#c(J){K(this,J)}}L("propskit-oscillator",F);class yJ extends HTMLElement{#Z;#$;#J=null;#Q;#_;#j;#Y;#B;#M;#X;#q=null;#G=null;constructor(){super();this.angle=0,this.#Z=1,this.#$=0,this.isDragging=!1,this.isShiftHeld=!1,this.handle=null,this.angleInput=null,this.plane=null,this.units="°",this.min=null,this.max=null,this.dial=!0,this.showRotations=!1,this.rotationSpan=null,this.#Q=this.#h.bind(this),this.#_=this.#d.bind(this),this.#j=this.#m.bind(this),this.#Y=this.#jJ.bind(this),this.#B=this.#w.bind(this),this.#M=this.#I.bind(this),this.#X=this.#S.bind(this)}connectedCallback(){requestAnimationFrame(()=>{if(!this.isConnected)return;this.precision=this.getAttribute("precision")||1,this.precision=parseInt(this.precision),this.text=this.getAttribute("text")==="true";let J=this.getAttribute("units")||"°";if(J==="deg")J="°";if(this.units=J,this.min=this.hasAttribute("min")?Number(this.getAttribute("min")):null,this.max=this.hasAttribute("max")?Number(this.getAttribute("max")):null,this.dial=this.#k("dial",!0),this.showRotations=this.#U(),this.#O(),this.#R(),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#E(),this.#D()}#O(){this.#E(),this.#D();let J=this.#W(),Q=this.#K(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#z(0),j=this.max??this.#z(360),_=[];if(this.dial)_.push(N("div",{className:"fig-input-angle-plane",role:"slider",tabindex:Q?"-1":"0","aria-label":Z,"aria-valuemin":$,"aria-valuemax":j,"aria-valuenow":this.angle,"aria-valuetext":`${this.angle.toFixed(this.precision)}${this.units}`,"aria-disabled":Q?"true":null},N("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(N("fig-input-number",{name:"angle",step:J,value:this.angle,min:this.min,max:this.max,units:this.units,"aria-label":Z,disabled:Q},this.showRotations?N("span",{slot:"append",className:"fig-input-angle-rotations"}):null));this.replaceChildren(..._)}#k(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#U(){if(this.hasAttribute("rotations"))return this.#k("rotations",!1);if(this.hasAttribute("show-rotations"))return this.#k("show-rotations",!1);return!1}#N(){let J=Math.abs(this.#H(this.angle));return Math.floor(J/360)}#K(){return O(this,"disabled")}#P(J){let Q=Number(J);if(!Number.isFinite(Q))return this.angle;if(this.min!==null&&Number.isFinite(this.min))Q=Math.max(this.min,Q);if(this.max!==null&&Number.isFinite(this.max))Q=Math.min(this.max,Q);return Q}#L(J,{reflect:Q=!0}={}){let Z=this.#P(J);if(this.angle=Z,this.#V(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#A(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#T(),this.#F()}#T(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#F(){if(!this.rotationSpan)return;let J=this.#N();if(J>1)this.rotationSpan.textContent=`×${J}`,this.rotationSpan.style.display="";else this.rotationSpan.textContent="",this.rotationSpan.style.display="none"}#W(){switch(this.units){case"rad":return 0.01;case"turn":return 0.001;default:return 0.1}}#H(J){switch(this.units){case"rad":return J*180/Math.PI;case"turn":return J*360;default:return J}}#z(J){switch(this.units){case"rad":return J*Math.PI/180;case"turn":return J/360;default:return J}}#f(J,Q,Z){let $;switch(Q){case"rad":$=J*180/Math.PI;break;case"turn":$=J*360;break;default:$=J}switch(Z){case"rad":return $*Math.PI/180;case"turn":return $/360;default:return $}}#R(){if(this.handle=this.querySelector(".fig-input-angle-handle"),this.plane=this.querySelector(".fig-input-angle-plane"),this.angleInput=this.querySelector("fig-input-number[name='angle']"),this.rotationSpan=this.querySelector(".fig-input-angle-rotations"),this.#F(),this.plane?.addEventListener("mousedown",this.#_),this.plane?.addEventListener("touchstart",this.#j),this.plane?.addEventListener("keydown",this.#X),window.addEventListener("keydown",this.#Y),window.addEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#M),this.angleInput.addEventListener("change",this.#M);this.addEventListener("change",this.#Q,!0)}#D(){if(this.plane?.removeEventListener("mousedown",this.#_),this.plane?.removeEventListener("touchstart",this.#j),this.plane?.removeEventListener("keydown",this.#X),window.removeEventListener("keydown",this.#Y),window.removeEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#M),this.angleInput.removeEventListener("change",this.#M);this.removeEventListener("change",this.#Q,!0)}#h(J){if(!J.target?.matches?.("input"))return;let Z=J.target.value.match(/^(-?\d*\.?\d+)\s*(turn|rad|deg|°)$/i);if(Z){let $=parseFloat(Z[1]),j=Z[2].toLowerCase();if(j==="deg")j="°";if(j!==this.units){let _=this.#f($,j,this.units);J.target.value=String(_)}}}#I(J){if(J.stopPropagation(),this.#K())return;if(this.#L(Number(J.target.value)),J.type==="change")this.#C();else this.#x()}#V(){let Q=this.#H(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#$=Math.sin(Q)}#p(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#y(J){let Q=this.plane.getBoundingClientRect(),Z=Q.left+Q.width/2,$=Q.top+Q.height/2,j=J.clientX-Z,_=J.clientY-$;return Math.atan2(_,j)*180/Math.PI}#b(J){let Z=(this.#y(J)%360+360)%360;if(Z=this.#p(Z),this.min!==null||this.max!==null)this.angle=this.#P(this.#z(Z));else if(this.#J===null){this.#J=Z;let _=(this.#H(this.angle)%360+360)%360,X=Z-_;if(X>180)X-=360;if(X<-180)X+=360;this.angle=this.#P(this.angle+this.#z(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#P(this.angle+this.#z(j)),this.#J=Z}if(this.#V(),this.setAttribute("value",String(this.angle)),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#F(),this.#T(),this.#x()}#x(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#C(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#A(){if(this.handle){let Q=this.#H(this.angle)*Math.PI/180,Z=this.plane.offsetWidth/2-this.handle.offsetWidth/2,$=Math.cos(Q)*Z,j=Math.sin(Q)*Z;this.handle.style.transform=`translate(${$}px, ${j}px)`}}#d(J){if(this.#K()||J.button!==0)return;this.#E(),this.isDragging=!0,this.#J=null,this.#b(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#b(j)},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#q===Z)this.#q=null,this.#G=null;if(j)this.#C()};this.#q=Z,this.#G=$,window.addEventListener("mousemove",Q,{signal:Z.signal}),window.addEventListener("mouseup",()=>$(!0),{signal:Z.signal}),window.addEventListener("blur",()=>$(!1),{signal:Z.signal})}#m(J){if(this.#K())return;J.preventDefault(),this.#E(),this.isDragging=!0,this.#J=null,this.#b(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#b(j.touches[0])},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#q===Z)this.#q=null,this.#G=null;if(j)this.#C()};this.#q=Z,this.#G=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#E(){this.#G?.(!1),this.#q?.abort(),this.#q=null,this.#G=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#S(J){if(this.#K())return;let Q=this.#W()*(J.shiftKey?10:1),Z=this.angle;if(J.key==="ArrowLeft"||J.key==="ArrowDown")Z-=Q;else if(J.key==="ArrowRight"||J.key==="ArrowUp")Z+=Q;else if(J.key==="Home")Z=this.min??this.#z(0);else if(J.key==="End")Z=this.max??this.#z(360);else return;J.preventDefault(),J.stopPropagation(),this.#L(Z),this.#x(),this.#C()}#jJ(J){if(J.key==="Shift")this.isShiftHeld=!0}#w(J){if(J.key==="Shift")this.isShiftHeld=!1}focus(){this.plane?.focus()}static get observedAttributes(){return["value","precision","text","min","max","units","dial","rotations","show-rotations","disabled","aria-label","name"]}get value(){return this.angle}get adjacent(){return this.#Z}get opposite(){return this.#$}set value(J){if(isNaN(J)){console.error("Invalid value: must be a number.");return}this.#L(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#L(Number(Z),{reflect:!1});break;case"precision":this.precision=parseInt(Z);break;case"text":if(Z!==Q){if(this.text=Z?.toLowerCase()==="true",this.isConnected)this.#O(),this.#R(),this.#A()}break;case"dial":if(this.dial=this.#k("dial",!0),this.isConnected)this.#O(),this.#R(),this.#A();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#O(),this.#R(),this.#A();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#L(this.angle),this.isConnected)this.#O(),this.#R(),this.#A();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#L(this.angle),this.isConnected)this.#O(),this.#R(),this.#A();break;case"disabled":if(this.#E(),this.isConnected)this.#O(),this.#R(),this.#A();break;case"aria-label":case"name":if(this.isConnected)this.#O(),this.#R(),this.#A();break;case"rotations":case"show-rotations":if(this.showRotations=this.#U(),this.isConnected)this.#O(),this.#R(),this.#A();break}}}L("fig-input-angle",yJ);class c extends HTMLElement{static observedAttributes=["axis","handle","disabled"];static#Z=6;static#$=['[draggable]:not([draggable="false"])','img:not([draggable="false"])','a[href]:not([draggable="false"])','input[type="range"]',"fig-handle","fig-slider","fig-input-number","fig-input-gradient","fig-easing-curve","fig-input-angle","fig-input-wheel","fig-joystick","fig-origin-grid","fig-canvas-control","propskit-color-point","propskit-number","propskit-point-point","propskit-point-radius","propskit-point-radius-angle","propskit-position","propskit-slider","propskit-oscillator"];#J=null;#Q=new Map;#_=null;#j=null;#Y=null;connectedCallback(){if(this.style.display="contents",!this.hasAttribute("role"))this.setAttribute("role","list");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Reorderable list");this.#T(),this.#G(),this.#J=new MutationObserver(()=>this.#G()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#C(),this.#A(),this.#p(),this.#Y?.remove(),this.#Y=null}attributeChangedCallback(){if(this.isConnected){if(this.#B)this.#A();this.#G()}}get#B(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#M(){return(this.getAttribute("axis")||"vertical").trim().toLowerCase()==="horizontal"?"horizontal":"vertical"}get#X(){return(this.getAttribute("handle")||"").trim()}#q(){return[...this.children].filter((J)=>J.nodeType===Node.ELEMENT_NODE&&!J.hasAttribute("data-reorder-live"))}#G(){let J=this.#q(),Q=new Set(J);for(let[Z,$]of this.#Q)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#L($),this.#Q.delete(Z);if(this.#U(J),this.#O(J),this.#B||J.length<2){this.#C();return}for(let Z of J){let $=this.#K(Z),j=this.#Q.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#Q.delete(Z);if(!$)continue;this.#P(Z,$)}this.#N(J),this.#k(J)}#O(J){for(let Q of J)if(Q.removeAttribute("data-reorder-item"),Q.hasAttribute("data-reorder-generated-role"))Q.removeAttribute("role"),Q.removeAttribute("data-reorder-generated-role")}#k(J){for(let Q of J)if(Q.setAttribute("data-reorder-item",""),!Q.hasAttribute("role"))Q.setAttribute("role","listitem"),Q.setAttribute("data-reorder-generated-role","")}#U(J){for(let Q of J)Q.querySelectorAll("[data-reorder-handle]").forEach((Z)=>{Z.removeAttribute("data-reorder-handle"),Z.removeAttribute("aria-roledescription")})}#N(J){if(!this.#X)return;for(let Q of J){let Z=Q.querySelector(this.#X);if(Z)Z.setAttribute("data-reorder-handle",""),Z.setAttribute("aria-roledescription","reorder handle")}}#K(J){if(this.#X)return J.querySelector(this.#X);return J}#P(J,Q){let Z=(B)=>{if(this.#B||this.#q().length<2)return;if(B.button!==0)return;if(!this.#X&&this.#W(B.target,J))return;this.#f(B,J,Q)},$=Q.getAttribute("tabindex"),j=Q.getAttribute("aria-label"),_=Q.getAttribute("role"),X=J.getAttribute("aria-label")||J.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";if(Q.setAttribute("tabindex","0"),Q.setAttribute("aria-label",`Move ${X}`),Q!==J&&!Q.hasAttribute("role"))Q.setAttribute("role","button");let q=(B)=>{if(this.#B)return;let Y=this.#M==="horizontal",G=Y?"ArrowLeft":"ArrowUp",M=Y?"ArrowRight":"ArrowDown";if(B.key!==G&&B.key!==M&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let k=this.#q(),U=k.indexOf(J),P=U;if(B.key===G)P=Math.max(0,U-1);else if(B.key===M)P=Math.min(k.length-1,U+1);else if(B.key==="Home")P=0;else if(B.key==="End")P=k.length-1;if(P===U){this.#F(`${X}, position ${U+1} of ${k.length}`);return}this.#b(J,P),this.#G(),this.#K(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:U,newIndex:P,item:J}})),this.#F(`${X}, position ${P+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#Q.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#L(J){let{target:Q,originalTabIndex:Z,originalAriaLabel:$,originalRole:j}=J;if(Z===null)Q.removeAttribute("tabindex");else Q.setAttribute("tabindex",Z);if($===null)Q.removeAttribute("aria-label");else Q.setAttribute("aria-label",$);if(j===null)Q.removeAttribute("role");else Q.setAttribute("role",j)}#T(){if(this.#Y?.isConnected)return;let J=document.createElement("span");J.setAttribute("data-reorder-live",""),J.setAttribute("role","status"),J.setAttribute("aria-live","polite"),J.setAttribute("aria-atomic","true"),Object.assign(J.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),this.#Y=J,document.body.appendChild(J)}#F(J){if(!this.#Y)return;this.#Y.textContent="",requestAnimationFrame(()=>{if(this.#Y)this.#Y.textContent=J})}#W(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of c.#$)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#H="fig-reorder-dragging";static#z(J){document.body.classList.toggle(c.#H,J)}#f(J,Q,Z){this.#A();let $={item:Q,target:Z,pointerId:J.pointerId,oldIndex:this.#q().indexOf(Q),targetIndex:this.#q().indexOf(Q),startX:J.clientX,startY:J.clientY,active:!1,onMove:null,onUp:null,onKeyDown:null};$.onMove=(j)=>{if(j.pointerId!==$.pointerId)return;let _=j.clientX-$.startX,X=j.clientY-$.startY;if(!$.active){if(_*_+X*X<c.#Z*c.#Z)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),c.#z(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#M==="horizontal"?j.clientX:j.clientY,B=this.#R(q);$.targetIndex=B,this.#V(B,Q)},$.onKeyDown=(j)=>{if(j.key!=="Escape"||!$.active)return;j.preventDefault(),this.#x($,!0)},$.onUp=(j)=>{if(j.pointerId!==$.pointerId)return;this.#x($,j.type==="pointercancel")},this.#_=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#R(J){let Q=this.#q(),Z=this.#M==="horizontal";for(let $=0;$<Q.length;$++){let j=Q[$].getBoundingClientRect(),_=Z?j.left+j.width/2:j.top+j.height/2;if(J<_)return $}return Q.length}#D(J,Q){let Z=this.#q(),$=Z.indexOf(J);if($===-1)return!1;let j=Math.max(0,Math.min(Q,Z.length));if(Q===$)return!1;if(j>=Z.length&&$===Z.length-1)return!1;return!0}#h(J){if(!J.length)return null;let Q=1/0,Z=-1/0,$=1/0,j=-1/0;for(let _ of J){let X=_.getBoundingClientRect();Q=Math.min(Q,X.left),Z=Math.max(Z,X.right),$=Math.min($,X.top),j=Math.max(j,X.bottom)}return{left:Q,top:$,width:Z-Q,height:j-$}}#I(){if(this.#j)return this.#j;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#M),document.body.appendChild(J),this.#j=J,J}#V(J,Q){let Z=this.#q();if(!this.#D(Q,J)){this.#p();return}let $=this.#h(Z);if(!$){this.#p();return}let j=this.#I();if(j.setAttribute("data-axis",this.#M),this.#M==="horizontal"){let X;if(J<=0)X=Z[0].getBoundingClientRect().left;else if(J>=Z.length)X=Z[Z.length-1].getBoundingClientRect().right;else X=Z[J].getBoundingClientRect().left;j.style.left=`${X-1}px`,j.style.top=`${$.top}px`,j.style.width="2px",j.style.height=`${$.height}px`;return}let _;if(J<=0)_=Z[0].getBoundingClientRect().top;else if(J>=Z.length)_=Z[Z.length-1].getBoundingClientRect().bottom;else _=Z[J].getBoundingClientRect().top;j.style.left=`${$.left}px`,j.style.top=`${_-1}px`,j.style.width=`${$.width}px`,j.style.height="2px"}#p(){this.#j?.remove(),this.#j=null}#y(J,Q){let Z=this.#q(),$=Math.max(0,Math.min(Q,Z.length));if($>=Z.length){if(Z[Z.length-1]!==J)this.appendChild(J);return}let j=Z[$];if(j!==J)this.insertBefore(J,j)}#b(J,Q){let $=this.#q().filter((j)=>j!==J)[Q]??null;if($)this.insertBefore(J,$);else this.appendChild(J)}#x(J,Q){let{item:Z,oldIndex:$,active:j,onMove:_,onUp:X,onKeyDown:q}=J;if(window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",X),window.removeEventListener("pointercancel",X),window.removeEventListener("keydown",q),j){if(!Q){this.#y(Z,J.targetIndex);let B=this.#q().indexOf(Z);if(B!==-1&&B!==$){this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:$,newIndex:B,item:Z}}));let Y=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#F(`${Y}, position ${B+1} of ${this.#q().length}`)}}}if(Z.classList.remove("dragging"),c.#z(!1),this.#p(),this.#_===J)this.#_=null}#C(){for(let[,J]of this.#Q)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#L(J);this.#Q.clear()}#A(){if(!this.#_)return;this.#x(this.#_,!0)}}L("fig-reorder",c);