@rogieking/figui3 8.9.37 → 8.9.38
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 +1 -1
- package/fig-lab.js +1 -1
- package/package.json +1 -1
package/dist/fig-lab.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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 ZJ(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 $J(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 P(J,Q,Z){let $=document.createElement(J);return $J($,Q),ZJ($,Z)}function E(J,Q,Z){let $=document.createElementNS(QJ,J);return $J($,Q),ZJ($,Z)}function r(J,Q){let Z=O(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 t=new WeakMap;function f(J){let Q=t.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?.()}},t.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=t.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function p(J,Q){for(let Z of["input","change"])J.dispatchEvent(new CustomEvent(Z,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}function g(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function n(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 g(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,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 e=0;function jJ(J="fig-lab"){return e+=1,`${J}-${e}`}class _J extends HTMLElement{}L("fig-ai-prompt",_J);class XJ extends HTMLElement{}L("fig-ai-context",XJ);class BJ extends HTMLElement{}L("fig-chat-message",BJ);class qJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=null;#$=null;#G=null;#q=this.#N.bind(this);#B=this.#L.bind(this);#X=this.#P.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#Q)this.#_();this.#$.removeEventListener("click",this.#q),this.#$.addEventListener("click",this.#q),this.#O(),this.#Y()}disconnectedCallback(){this.#$?.removeEventListener("click",this.#q),this.#k()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;this.#Y()}#_(){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.#j=document.createElement("fig-tooltip"),this.#j.className="fig-attachment-remove-tooltip",this.#j.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.#j.append(this.#$),this.#Q.append(this.#J),this.#Z.append(this.#Q),this.replaceChildren(this.#Z,this.#j),this.#$.addEventListener("click",this.#q),this.#O()}#O(){let J=this.#Q?.mediaEl;if(!J||J===this.#G)return;this.#k(),this.#G=J,this.#G.addEventListener("load",this.#B),this.#G.addEventListener("error",this.#X)}#k(){if(!this.#G)return;this.#G.removeEventListener("load",this.#B),this.#G.removeEventListener("error",this.#X),this.#G=null}#Y(){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.#Q.setAttribute("alt",Q),J)this.#Q.setAttribute("src",J);else this.#Q.removeAttribute("src");if(this.#O(),this.#J.textContent=this.#M(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")}#M(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)}#L(){if(this.getAttribute("src"))this.removeAttribute("data-fallback")}#P(){this.setAttribute("data-fallback","")}#N(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",qJ);class OJ 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","")}}L("fig-attachments",OJ);class YJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=null;#B=null;#X=this.#U.bind(this);#_=!1;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#O();if(this.#k(),this.#M(),this.#L(),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")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#M()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#P(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#k()}#O(){this.#_=O(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.#j=Boolean(Q),this.replaceChildren(Z)}#k(){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.#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")}#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-"))}#M(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#G)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#J.setAttribute("value",O(this,"checked")?"on":"off"),this.#G=Q}#L(){if(!this.#J)return;this.#q??=this.#N.bind(this,"input"),this.#B??=this.#N.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#B)this.#J.removeEventListener("change",this.#B)}#N(J,Q){if(Q.stopImmediatePropagation(),O(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(O(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":O(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")?O(this,"default"):this.#_}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,p(this,{checked:J,value:this.getAttribute("value")??""})}focus(J){(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}L("propskit-switch",YJ);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 a(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 v(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 JJ(J,Q){switch(J?.type){case"solid":return J.color||"";case"gradient":return J.css||AJ(J.gradient)||"";case"image":return J.image?.url?a(J.image.url):"";case"video":return J.video?.poster?a(J.video.poster):"";case"webcam":return J.webcam?.snapshot?a(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 GJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=null;#$=!1;#G=null;#q=new Set;#B=null;#X=null;#_=this.#z.bind(this);#O=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#k();if(this.#Y(),this.#N(),this.#U(),this.#O===null)this.#O=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#_),this.addEventListener("click",this.#_),f(this),!this.#G)this.#G=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.#N()});this.#G.observe(this,{attributes:!0})}disconnectedCallback(){this.#G?.disconnect(),this.#K(),this.removeEventListener("click",this.#_),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#k(){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.#j=_,this.#$=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.#$)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")}#M(){return w(this.getAttribute("value"))}#L(){let{color:J,alpha:Q}=this.#M();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-"))}#N(){if(!this.#J)return;let J=this.#P(),Q=new Set(J);for(let _ of this.#q)if(!Q.has(_))this.#J.removeAttribute(_);for(let _ of J)this.#J.setAttribute(_,this.getAttribute(_)??"");this.#J.setAttribute("mode","solid");let Z=this.#L();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);let{color:$,alpha:j}=this.#M();if(this.#j)this.#j.setAttribute("background",$),this.#j.setAttribute("alpha",String(j));this.#q=Q}#U(){if(!this.#J)return;this.#B??=this.#W.bind(this,"input"),this.#X??=this.#W.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#X)}#K(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#X)this.#J.removeEventListener("change",this.#X)}#S(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.#M().color}#T(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.#M().alpha;return{color:Q,alpha:$,opacity:Math.round($*100)}}#W(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#S(Q),$=this.#T(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.#L();if(this.#J&&this.#J.getAttribute("value")!==X)this.#J.setAttribute("value",X);if(this.#j)this.#j.setAttribute("background",$.color),this.#j.setAttribute("alpha",String($.alpha));this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#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-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.#F(Q)}#F(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.#j){let Z=w(J);this.#j.setAttribute("background",Z.color),this.#j.setAttribute("alpha",String(Z.alpha))}}#R(){return this.getAttribute("default")??this.#O??""}get defaultValue(){return String(this.#R())}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#F(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)}}L("propskit-color",GJ);class MJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=null;#$=!1;#G=null;#q=new Set;#B=null;#X=null;#_=this.#H.bind(this);#O=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#k();if(this.#Y(),this.#T(),this.#W(),this.#O===null)this.#O=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#_),this.addEventListener("click",this.#_),f(this),!this.#G)this.#G=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.#T()});this.#G.observe(this,{attributes:!0})}disconnectedCallback(){this.#G?.disconnect(),this.#z(),this.removeEventListener("click",this.#_),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#k(){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.#j=_,this.#$=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.#$)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")}#M(){return x(this.getAttribute("value"))}#L(){return v(this.#M())}#P(){let J=this.#M()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#N(){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.#N();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}}}#K(J=this.#M()){if(!this.#j)return;let Q=this.#U(J),Z=JJ(Q,this.#P());if(!Z)Z=JJ(this.#N(),this.#P());if(!Z){let j=this.#j.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#j.setAttribute("background",Z),this.#j.setAttribute("alpha",String(IJ(Q)));let $=DJ(Q||J);if($)this.#j.style.setProperty("--swatch-bg-size",$.size),this.#j.style.setProperty("--swatch-bg-position",$.position)}#S(){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-"))}#T(){if(!this.#J)return;let J=this.#S(),Q=new Set(J);for(let $ of this.#q)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=this.#L();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);this.#K(),this.#q=Q}#W(){if(!this.#J)return;this.#B??=this.#R.bind(this,"input"),this.#X??=this.#R.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#X)}#z(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#X)this.#J.removeEventListener("change",this.#X)}#F(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.#M()}#R(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#U(this.#F(Q)),$=v(Z);if(this.setAttribute("value",$),this.#J&&this.#J.getAttribute("value")!==$)this.#J.setAttribute("value",$);this.#K(Z),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#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")??v(this.#J?.value)??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value"),this.#K({type:"solid",color:"",alpha:1});return}let Q=v(typeof J==="string"?x(J):J);this.setAttribute("value",Q),this.#C(Q)}#C(J){if(!this.#J)return;let Q=v(x(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#K(x(Q))}#w(){return this.getAttribute("default")??this.#O??""}get defaultValue(){return String(this.#w())}get isDefault(){return n(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#C(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)}}L("propskit-fill",MJ);class kJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=null;#B=null;#X=this.#K.bind(this);#_=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#O();if(this.#k(),this.#M(),this.#L(),this.#_===null)this.#_=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify(this.#J?.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.#k();if(Z)this.#M()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#P(),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.#k()}#O(){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.#j=Boolean(Q),this.replaceChildren(Z)}#k(){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()||"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-"))}#M(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#G)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.#G=Q}#L(){if(!this.#J)return;this.#q??=this.#U.bind(this,"input"),this.#B??=this.#U.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#B)this.#J.removeEventListener("change",this.#B)}#N(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(),O(this,"disabled"))return;let Z=this.#N(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}))}#K(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.#_??""}get isDefault(){return n(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J;let Q=this.#J?.value;p(this,Q)}focus(J){this.#J?.focus(J)}}L("propskit-gradient",kJ);class m extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=!1;#G=null;#q=new Set;#B=null;#X=null;#_=null;#O=this.#E.bind(this);#k=this.#w.bind(this);#Y=!1;#M=null;static get observedAttributes(){return["label","direction","aria-label","options","value"]}static#L(){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
2
|
`)?`
|
|
3
|
-
`:",";return Q.split(Z).map(($)=>$.trim()).filter(Boolean)}static#N(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.#K();if(this.#S(),this.#z(),this.#F(),this.removeEventListener("click",this.#O),this.addEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),this.addEventListener("pointerdown",this.#k,!0),f(this),!this.#G)this.#G=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.#S();if(Z)this.#z()});this.#G.observe(this,{attributes:!0})}disconnectedCallback(){this.#G?.disconnect(),this.#R(),this.removeEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#S();return}if(J==="options"||J==="value")this.#z()}#K(){this.#M=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.#j=m.#L();let j=document.createElement(this.#j?"fig-select":"fig-dropdown");if(j.setAttribute("full",""),this.#j&&Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#$=Boolean(J),this.replaceChildren(Z)}#S(){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("label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);if(!this.#j)J.add("options");return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#W(){if(!this.#J||this.#j)return;let J=m.#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=m.#N(Z),$.textContent=m.#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)}}#z(){if(!this.#J)return;if(!this.#j)this.#W();let J=this.#T().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.#q)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#q=Q}#F(){if(!this.#J)return;if(this.#B??=this.#H.bind(this,"input"),this.#X??=this.#H.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#X),this.#j)this.#_??=this.#H.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#_)}#R(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#X)this.#J.removeEventListener("change",this.#X);if(this.#_)this.#J.removeEventListener("optionhover",this.#_)}#H(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 $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#C(){if(!this.#J||!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"))}#w(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.#j)return;this.#Y=this.#C()}#E(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, fig-dropdown")){this.#Y=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#Y=!1;return}if(this.#J.focus(),!this.#j)return;if(this.#Y||this.#C()){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.#M??""}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;p(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-select",m);class NJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=null;#B=null;#X=this.#U.bind(this);#_=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#O();if(this.#k(),this.#M(),this.#L(),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.#k();if(Z)this.#M()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#P(),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.#k()}#O(){this.#_=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.#j=Boolean(Q),this.replaceChildren(Z)}#k(){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()||"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-"))}#M(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#G)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#G=Q}#L(){if(!this.#J)return;this.#q??=this.#N.bind(this,"input"),this.#B??=this.#N.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#B)this.#J.removeEventListener("change",this.#B)}#N(J,Q){if(Q.stopImmediatePropagation(),O(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(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.#_??""}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,p(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-text",NJ);class PJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=null;#B=null;#X=this.#U.bind(this);#_=null;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#O();if(this.#k(),this.#M(),this.#L(),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")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#M()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#P(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#k()}#O(){this.#_=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.#j=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#k(){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.#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")}#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-"))}#M(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#G)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#G=Q}#L(){if(!this.#J)return;this.#q??=this.#N.bind(this,"input"),this.#B??=this.#N.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#B)this.#J.removeEventListener("change",this.#B)}#N(J,Q){if(Q.stopImmediatePropagation(),O(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(O(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.#_??"0"}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,p(this,this.#J?.value??J)}focus(J){this.#J?.focus(J)}}L("propskit-number",PJ);class LJ extends HTMLElement{static observedAttributes=["x","y","default","label","units","disabled","size"];#Z=null;#Q=null;#J=null;#j=null;#$=!1;#G=!1;#q=this.#W.bind(this,"input");#B=this.#W.bind(this,"change");#X=this.#z.bind(this);connectedCallback(){if(!this.#$)this.#j=this.#O(),this.#Y(this.#j),this.#$=!0;if(!this.#Z)this.#L();this.#P(),this.#N(),this.#S(),this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),f(this)}disconnectedCallback(){this.#T(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if((J==="x"||J==="y")&&!this.#G)this.#N();else if(J==="label")this.#P();else if(J==="units")this.#U();else if(J==="disabled")this.#K()}#_(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.#_(J,50),y:Q===null||!Q.trim()?50:this.#_(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.#_(Q.x,this.#j?.x??50),y:this.#_(Q.y,this.#j?.y??50)}}catch{return null}}#Y(J){let Q=this.#O(),Z={x:this.#_(J?.x,Q.x),y:this.#_(J?.y,Q.y)};return this.#G=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#G=!1,Z}#M(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}#L(){let J=this.#O(),Q=document.createElement("fig-field");Q.className="propskit-position-row",Q.setAttribute("direction","horizontal");let Z=document.createElement("label"),$=this.#M("x",J.x),j=this.#M("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"}#N(){let J=this.#O();this.#Q?.setAttribute("value",String(J.x)),this.#J?.setAttribute("value",String(J.y)),this.#U(),this.#K()}#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")}}#K(){let J=O(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#J?.toggleAttribute("disabled",J)}#S(){this.#T(),this.#Q?.addEventListener("input",this.#q),this.#Q?.addEventListener("change",this.#B),this.#J?.addEventListener("input",this.#q),this.#J?.addEventListener("change",this.#B)}#T(){this.#Q?.removeEventListener("input",this.#q),this.#Q?.removeEventListener("change",this.#B),this.#J?.removeEventListener("input",this.#q),this.#J?.removeEventListener("change",this.#B)}#W(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.#_(Q.currentTarget.value,$[Z]);let j=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...j,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#z(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.#_(J,50)))}get y(){return this.#O().y}set y(J){this.setAttribute("y",String(this.#_(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.#Y(J);this.#N(Q)}get defaultValue(){return this.#k(this.getAttribute("default"))||{...this.#j||{x:50,y:50}}}get isDefault(){return n(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,p(this,{...J,units:this.units})}focus(J){this.#Q?.focus(J)}}L("propskit-position",LJ);class UJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","disabled","value"];#Z=null;#Q=null;#J=null;#j=!1;#$=!1;#G=!1;#q=this.#K.bind(this,"input");#B=this.#K.bind(this,"change");#X=this.#S.bind(this);connectedCallback(){if(!this.#j)this.#Y(this.#k()),this.#j=!0;if(!this.#Z)this.#M();this.#L(),this.#P(),this.#N(),this.#U(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#Y(this.#k());this.#U($)}return}if(J==="size"){this.#P();return}if(J==="disabled"){this.#N();return}this.#L()}#_(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#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.x,50),y:this.#_(Q.y,50),color:typeof Q.color==="string"&&Q.color.trim()?Q.color.trim():"#D9D9D9"}}#k(){return this.#O(this.getAttribute("value"))}#Y(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#M(){let J=this.#k(),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.#L(),this.#P(),this.#N(),Q.append(Z,$),this.replaceChildren(Q)}#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")}#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)}}#N(){r(this,[this.#Q,this.#J])}#U(J){let Q=this.#O(J);if(this.#Q)this.#Q.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#K(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.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else return;let _=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,units:"percent"},bubbles:!0,cancelable:!0,composed:!0}))}#S(J){if(J.target!==this.#Z||this.#G)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#G=!0,this.setAttribute("open",String(Q)),this.#G=!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.#k()}}set value(J){let Q=this.#Y(J);this.#U(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-color-point",UJ);class KJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#j=!1;#$=!1;#G=!1;#q=this.#z.bind(this,"input");#B=this.#z.bind(this,"change");#X=this.#F.bind(this);connectedCallback(){if(!this.#j)this.#M(this.#Y()),this.#j=!0;if(!this.#Z)this.#P();this.#N(),this.#U(),this.#K(),this.#S(),this.#T(this.#Y()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#M(this.#Y());this.#T($)}return}if(J==="size"){this.#U();return}if(J==="units"){this.#K();return}if(J==="disabled"){this.#S();return}this.#N()}#_(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#_(J,0)}#k(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.x,50),y:this.#_(Q.y,50),radius:this.#O(Q.radius)}}#Y(){return this.#k(this.getAttribute("value"))}#M(J){let Q=this.#k(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#L(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.#L(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.#N(),this.#U(),this.#S(),Z.append($,j),this.replaceChildren(Z)}#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")}#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)}}#K(){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")}#S(){r(this,[this.#Q,this.#J])}#T(J){let Q=this.#k(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#L(Q.radius);this.#J.value=Z.value}}#W(J,Q){let Z=this.#L(Q).value,$=this.#_(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-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.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#W(Z,$.radius);else return;let _=this.#M($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#L(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#F(J){if(J.target!==this.#Z||this.#G)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#G=!0,this.setAttribute("open",String(Q)),this.#G=!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.#M(J);this.#T(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius",KJ);class SJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#j=null;#$=!1;#G=!1;#q=!1;#B=this.#F.bind(this,"input");#X=this.#F.bind(this,"change");#_=this.#R.bind(this);connectedCallback(){if(!this.#$)this.#L(this.#M()),this.#$=!0;if(!this.#Z)this.#N();this.#U(),this.#K(),this.#S(),this.#T(),this.#W(this.#M()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#X),this.addEventListener("change",this.#X),this.removeEventListener("openchange",this.#_),this.addEventListener("openchange",this.#_)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#X),this.removeEventListener("openchange",this.#_)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#G){let $=this.#L(this.#M());this.#W($)}return}if(J==="size"){this.#K();return}if(J==="units"){this.#S();return}if(J==="disabled"){this.#T();return}this.#U()}#O(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#k(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#O(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.#O(Q.x,50),y:this.#O(Q.y,50),radius:this.#k(Q.radius),angle:this.#O(Q.angle,0)}}#M(){return this.#Y(this.getAttribute("value"))}#L(J){let Q=this.#Y(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#G=!0,this.setAttribute("value",Z),this.#G=!1,Q}#P(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#N(){let J=this.#M(),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.#j=_,this.#U(),this.#K(),this.#T(),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")}#K(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J,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(){r(this,[this.#Q,this.#J,this.#j])}#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.#j)this.#j.value=Q.angle}#z(J,Q){let Z=this.#P(Q).value,$=this.#O(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#F(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.#O(Z.value?.x,$.x),$.y=this.#O(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#z(Z,$.radius);else if(j==="angle")$.angle=this.#O(Z.value,$.angle);else return;let _=this.#L($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#P(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#R(J){if(J.target!==this.#Z||this.#q)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#q=!0,this.setAttribute("open",String(Q)),this.#q=!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.#L(J);this.#W(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius-angle",SJ);class TJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#j=!1;#$=!1;#G=!1;#q=this.#T.bind(this,"input");#B=this.#T.bind(this,"change");#X=this.#W.bind(this);connectedCallback(){if(!this.#j)this.#Y(this.#k()),this.#j=!0;if(!this.#Z)this.#L();this.#P(),this.#N(),this.#U(),this.#K(),this.#S(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#Y(this.#k());this.#S($)}return}if(J==="size"){this.#N();return}if(J==="units"){this.#U();return}if(J==="disabled"){this.#K();return}this.#P()}#_(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#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.x,50),y:this.#_(Q.y,50),x2:this.#_(Q.x2,75),y2:this.#_(Q.y2,75)}}#k(){return this.#O(this.getAttribute("value"))}#Y(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#M(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}#L(){let J=this.#k(),Q=document.createElement("fig-group"),Z=this.#M("Start","start",J.x,J.y),$=this.#M("End","end",J.x2,J.y2);Q.setAttribute("compact",""),this.#Z=Q,this.#Q=Z,this.#J=$,this.#P(),this.#N(),this.#K(),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")}#N(){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")}}#K(){r(this,[this.#Q,this.#J])}#S(J){let Q=this.#O(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}}#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.#_(j?.x,$.x),$.y=this.#_(j?.y,$.y);else if(_==="end")$.x2=this.#_(j?.x,$.x2),$.y2=this.#_(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.#G)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#G=!0,this.setAttribute("open",String(Q)),this.#G=!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.#Y(J);this.#S(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-point",TJ);class o 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;#j=null;#$=null;#G=0;#q=()=>this.#_();connectedCallback(){this.#R(),this.#P(),this.#N(),this.#B(),requestAnimationFrame(()=>{this.#S()})}disconnectedCallback(){if(this.#X(),this.#G)cancelAnimationFrame(this.#G),this.#G=0;this.#Q?.removeEventListener("click",this.#k),this.#Q?.removeEventListener("keydown",this.#Y),this.#j?.querySelector("fig-button")?.removeEventListener("click",this.#M)}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.#z(),this.#S();return}if(J==="disabled"){this.#P();return}if(J==="size"){this.#N();return}this.#R()}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.#q,!0),this.removeEventListener("change",this.#q,!0),this.addEventListener("input",this.#q,!0),this.addEventListener("change",this.#q,!0),!this.#$)this.#$=new MutationObserver(()=>{this.#P(),this.#N(),this.#_()});this.#$.disconnect(),this.#$.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#X(){this.removeEventListener("input",this.#q,!0),this.removeEventListener("change",this.#q,!0),this.#$?.disconnect()}#_(){if(this.#G)return;this.#G=requestAnimationFrame(()=>{this.#G=0,this.#S()})}#O(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#k=(J)=>{if(O(this,"disabled"))return;if(this.#O(J.target))return;J.stopPropagation(),this.open=!this.open};#Y=(J)=>{if(O(this,"disabled"))return;if(this.#O(J.target))return;if(J.key!=="Enter"&&J.key!==" ")return;J.preventDefault(),J.stopPropagation(),this.open=!this.open};#M=(J)=>{if(J.preventDefault(),J.stopPropagation(),O(this,"disabled"))return;this.#W()};#L(){return[...this.querySelectorAll(o.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(o.#Z))}#P(){let J=O(this,"disabled");for(let Q of this.#L())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.#Q?.setAttribute("aria-disabled",String(J)),this.#Q?.setAttribute("tabindex",J?"-1":"0"),this.#j?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#N(){let J=this.getAttribute("size")==="small";for(let Q of this.#L()){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}#K(){for(let J of this.#L())if(this.#U(J))return!0;return!1}#S(){if(this.#K())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#z()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#W(){for(let J of this.#L())this.#T(J);this.#S(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#z(){if(!this.showReset){this.#j?.setAttribute("hidden","");return}this.#F(),this.#j?.removeAttribute("hidden")}#F(){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.#M)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#M),Q?.addEventListener("click",this.#M)}this.#j=J}#R(){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=jJ("propskit-group");if(this.#Q.dataset.generated){let X=$.querySelector(".propskit-group-chevron");if($.textContent=Q,X)$.prepend(X)}if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",$.id);if(!$.querySelector(".propskit-group-chevron")){let X=document.createElement("fig-icon");X.setAttribute("name","chevron"),X.setAttribute("size","small"),X.className="propskit-group-chevron",$.prepend(X)}if(this.#J=$.querySelector(".propskit-group-chevron"),this.#z(),this.#Q.setAttribute("role","button"),this.#P(),this.#Q.setAttribute("aria-expanded",String(this.open)),this.#Q.removeEventListener("click",this.#k),this.#Q.addEventListener("click",this.#k),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")}}L("propskit-group",o);class FJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=0;#B=0;#X=null;#_=null;#O=0;#k=null;#Y=null;#M=!1;#L=0;#P=null;#N=0;#U=null;#K=null;#S=0;#T=0;#W=!1;#z=!1;#F=0;#R=null;#H=null;#C=this.#JJ.bind(this);#w=this.#i.bind(this);#E=this.#OJ.bind(this);#f=this.#NJ.bind(this);#y=this.#e.bind(this);#D=this.#o.bind(this);#c=this.#kJ.bind(this);#x=this.#zJ.bind(this);#I=this.#WJ.bind(this);#A=this.#n.bind(this);#m=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.#Z)this.#V();if(this.#p(),this.#s(),this.#XJ(),this.#t(),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.addEventListener("pointerdown",this.#C,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#f,{capture:!0}),this.addEventListener("pointerdown",this.#f,{capture:!0}),this.removeEventListener("contextmenu",this.#x),this.addEventListener("contextmenu",this.#x),this.removeEventListener("click",this.#A,!0),this.addEventListener("click",this.#A,!0),this.#_?.removeEventListener("change",this.#I),this.#_?.addEventListener("change",this.#I),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#a();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#m.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#p();if(Z)this.#s(),this.#t()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#$?.disconnect(),this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#B)cancelAnimationFrame(this.#B),this.#B=0;this.#KJ(),this.#ZJ(),clearTimeout(this.#F),this.#F=0,this.#YJ(),this.#GJ(),this.#MJ(),this.#BJ(),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.removeEventListener("pointerdown",this.#f,{capture:!0}),this.removeEventListener("contextmenu",this.#x),this.removeEventListener("click",this.#A,!0),this.#_?.removeEventListener("change",this.#I)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#p()}#V(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#Y=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.#b()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#Z=$,this.#Q=j,this.#J=_,this.#j=Boolean(Z),this.replaceChildren($),this.#h();for(let X of Q){if(X===Z)continue;this.#J.appendChild(X)}}#h(){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.#_=J,this.appendChild(J)}#p(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()===""){if(this.#Q.parentElement===this.#Z)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")}#s(){if(!this.#J)return;let J=this.#b(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#G)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.#d(Z),this.#G=Q,this.#a(),this.#jJ()}#d(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=RJ(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")}#g(){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.#d((this.getAttribute("type")||"range").toLowerCase())}#a(){if(!this.#J)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#Y??"";if(String(this.#J.value)!==J)this.#J.value=J;this.#g()}#b(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#m.has(Q))}#jJ(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#r(),this.#l()})}#t(){if(this.#B)cancelAnimationFrame(this.#B);this.#B=requestAnimationFrame(()=>{this.#B=0,this.#l()})}#l(){let J=this.#J?.querySelector('input[type="range"]'),Q=this.#J?.querySelector("fig-input-number input");if(J!==this.#X)this.#qJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")||this.#Q?.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")}#n(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#z&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#z=!1;return}this.#u()}#u(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!O(this,"disabled"))this.focus()})})}#qJ(J){if(this.#MJ(),this.#X=J,!this.#X)return;this.#X.addEventListener("dblclick",this.#c,{capture:!0})}#MJ(){if(!this.#X)return;this.#X.removeEventListener("dblclick",this.#c,{capture:!0}),this.#X=null}#kJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#HJ()}#NJ(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.#ZJ(),this.#K=J.pointerId,this.#S=J.clientX,this.#T=J.clientY,this.#W=!1,window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#D,{once:!0}),window.addEventListener("pointercancel",this.#D,{once:!0}),window.addEventListener("blur",this.#D,{once:!0})}#e(J){if(J.pointerId!==this.#K)return;if(J.buttons===0){this.#o(J);return}if(!this.#W){if(Math.hypot(J.clientX-this.#S,J.clientY-this.#T)<4)return;this.#W=!0,this.setAttribute("data-number-scrubbing","")}this.#PJ(this.#TJ(J),"input")}#o(J){if(J?.pointerId!==void 0&&this.#K!==null&&J.pointerId!==this.#K)return;let Q=this.#W;if(this.#ZJ(),Q){this.#PJ(this.#J?.value,"change"),this.#z=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#z=!1,this.#F=0},0),this.#u();return}this.#J?.querySelector("fig-input-number input")?.focus()}#ZJ(){window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#D),window.removeEventListener("pointercancel",this.#D),window.removeEventListener("blur",this.#D),this.#K=null,this.#W=!1,this.removeAttribute("data-number-scrubbing")}#JJ(J){if(J.button!==0||O(this,"disabled"))return;if(this.getAttribute("elastic")==="false")return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#J?.querySelector('input[type="range"]')??this.#X;if(!Q)return;this.#YJ(),this.#GJ(),this.#X=Q,this.#M=!0,this.#U=J.pointerId,this.#L=this.#SJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#P={left:Z.left,right:Z.right,width:Z.width},this.#N=$.width,window.addEventListener("pointermove",this.#w,{passive:!0}),window.addEventListener("pointerup",this.#E,{once:!0}),window.addEventListener("pointercancel",this.#E,{once:!0}),window.addEventListener("blur",this.#E,{once:!0})}#i(J){if(!this.#M)return;if(J.pointerId!==this.#U)return;if(J.buttons===0){this.#OJ(J);return}this.#v(J.clientX)}#OJ(J){if(J?.pointerId!==void 0&&this.#U!==null&&J.pointerId!==this.#U)return;let Q=J?.type==="pointerup"||J?.type==="pointermove"&&J.buttons===0;if(this.#YJ(),this.#GJ(),Q)this.#u()}#YJ(){window.removeEventListener("pointermove",this.#w),window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E),this.#M=!1,this.#U=null}#zJ(J){if(O(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#KJ(),this.#UJ(J.clientX,J.clientY)}#UJ(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.#_?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#WJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#HJ()}#KJ(){if(this.#O)clearTimeout(this.#O),this.#O=0;this.#k=null}#SJ(){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}#v(J){let Q=this.#P;if(!Q||!this.#L){this.#GJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#_J();return}let $=Math.max(-this.#L,Math.min(this.#L,Z*0.5)),j=Math.abs($),_=this.#N?(this.#N+j)/this.#N: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")}#GJ(){this.#_J(),this.#L=0,this.#P=null,this.#N=0,this.#U=null}#_J(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#TJ(J){let Q=this.#X;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)))}#$J(){return this.getAttribute("default")??this.#Y??this.#X?.min??"0"}#HJ(){this.#KJ(),this.#PJ(this.#$J(),"input"),this.#PJ(this.#$J(),"change")}#PJ(J,Q){if(!this.#J||J===null||J===void 0)return;this.#J.value=J,this.setAttribute("value",String(this.#J.value)),this.dispatchEvent(new CustomEvent(Q,{detail:this.#J.value,bubbles:!0,cancelable:!0,composed:!0}))}#r(){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??"")}#XJ(){if(!this.#J)return;if(!this.#R)this.#R=this.#LJ.bind(this,"input");if(!this.#H)this.#H=this.#LJ.bind(this,"change");this.#J.addEventListener("input",this.#R),this.#J.addEventListener("change",this.#H)}#BJ(){if(!this.#J)return;if(this.#R)this.#J.removeEventListener("input",this.#R);if(this.#H)this.#J.removeEventListener("change",this.#H)}#LJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;if(J==="change")this.#GJ();let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;if(this.#J?.value!==void 0){let $=String(this.#J.value);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}this.#g(),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#l();let Q=this.#J?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return 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.#$J()}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){this.#HJ()}}L("propskit-slider",FJ);class V extends HTMLElement{static#Z=33;static#Q=60;static#J=0.55;static#j=1.5;static#$=80;static#G="fig-input-wheel-dragging";#q=null;#B=null;#X=null;#_=null;#O=null;#k=null;#Y=null;#M=0;#L=0;#P=0;#N=0;#U=0;#K=null;#S=!1;#T=null;#W=0;#z=0;#F=null;#R=0;#H=null;#C=0;#w=0;#E=this.#NJ.bind(this);#f=this.#e.bind(this);#y=this.#ZJ.bind(this);#D=this.#GJ.bind(this);#c=this.#_J.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#q)this.#x();if(this.#l(),this.#jJ(),this.#MJ(),this.#K?.disconnect(),globalThis.ResizeObserver)this.#K=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#n(Q.width,Q.height)}),this.#K.observe(this);this.#u()}disconnectedCallback(){if(this.#K?.disconnect(),this.#P)cancelAnimationFrame(this.#P);this.#P=0,this.#$J(),this.#kJ(),this.#JJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#q)return;if(J==="disabled")this.#l();if(J==="value"&&!this.#S)this.#jJ();if(J==="step")this.#t(),this.#u();if(J==="spin")this.#u();if(J==="min"||J==="max")this.#b(this.#V())}#x(){if(this.#q=this,this.#B=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=P("div",{className:"fig-input-wheel-handle"});this.#_=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.#Y={maxEl:$,minEl:j,maxWidthEl:_,minWidthEl:X},this.#I()}#I(){if(!this.#_||this.#O)return;this.#O=E("path",{className:"fig-input-wheel-tick"}),this.#_.append(this.#O)}#A(){if(this.#k)return this.#k;return this.#k={maxH:this.#Y?.maxEl.getBoundingClientRect().height||8,minH:this.#Y?.minEl.getBoundingClientRect().height||4,maxW:this.#Y?.maxWidthEl.getBoundingClientRect().width||2,minW:this.#Y?.minWidthEl.getBoundingClientRect().width||1},this.#k}#m(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#V(){let J=Number(this.getAttribute("value")??0);return Number.isFinite(J)?J:0}#h(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}#p(){return this.#h("min")}#s(){return this.#h("max")}#d(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))}#g(J){let Q=J,Z=this.#p(),$=this.#s();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#a(J){let Q=this.#m();if(Q<=0)return J;let Z=this.#p()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#b(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#a(J):J;$=this.#g($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#t($),this.#u(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#jJ(){let J=this.#V(),Q=this.#g(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#b(Q);return}this.#t(J),this.#u()}#t(J=this.#V()){if(!this.#X)return;let Q=this.#p(),Z=this.#s();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))}#l(){let J=O(this,"disabled");if(!this.#X)return;if(J){if(this.#S)this.#JJ();this.#$J(),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")}#n(J,Q){if(!this.#_||J<1||Q<1)return;if(J===this.#M&&Q===this.#L)return;this.#M=J,this.#L=Q,this.#k=null,this.#_.setAttribute("viewBox",`0 0 ${J} ${Q}`),this.#_.setAttribute("width",String(J)),this.#_.setAttribute("height",String(Q)),this.#u()}#u(){if(this.#P)return;this.#P=requestAnimationFrame(()=>{if(!this.isConnected){this.#P=0;return}if(this.#M<1||this.#L<1){let J=this.#X?.getBoundingClientRect();if(J)this.#n(J.width,J.height)}this.#qJ(),this.#P=0})}#qJ(){if(!this.#O)return;let J=this.#M,Q=this.#L;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#p()??0:this.#F??this.#V(),$=360/V.#Z,j=this.#m(),_=this.#p()??0,X=(Z-_)/j*$,q=V.#J,B=J/2,Y=Q/2,{maxH:G,minH:M,maxW:k,minW:U}=this.#A(),N=V.#Q,T=Math.max(J/2,1),F=T*0.84,H=[];for(let z=0;z<V.#Z;z+=1){let S=X+z*$;if(S=((S+180)%360+360)%360-180,S<-N||S>=N)continue;let R=S*Math.PI/180,W=B+F*Math.sin(R)/(1-q*Math.cos(R)),C=Math.min(1,Math.abs(W-B)/Math.max(T,1)),I=Math.cos(C*Math.PI*0.5),A=M+(G-M)*I,l=U+(k-U)*I,s=A/2,b=l/2,y=Y-s,c=Y+s,d=W-b,i=W+b;H.push(`M ${W} ${y} Q ${i} ${y} ${i} ${y+b} V ${c-b} Q ${i} ${c} ${W} ${c} Q ${d} ${c} ${d} ${c-b} V ${y+b} Q ${d} ${y} ${W} ${y} Z`)}this.#O.setAttribute("d",H.join(" "))}#MJ(){this.#q?.addEventListener("pointerdown",this.#E),this.#X?.addEventListener("wheel",this.#D,{passive:!1}),this.#X?.addEventListener("keydown",this.#c)}#kJ(){this.#q?.removeEventListener("pointerdown",this.#E),this.#X?.removeEventListener("wheel",this.#D),this.#X?.removeEventListener("keydown",this.#c),window.removeEventListener("pointermove",this.#f),window.removeEventListener("pointerup",this.#y),window.removeEventListener("pointercancel",this.#y)}#NJ(J){if(O(this,"disabled"))return;if(J.button!==0)return;if(J.preventDefault(),!this.beginScrub(J))return;this.#q?.setPointerCapture?.(J.pointerId),window.addEventListener("pointermove",this.#f),window.addEventListener("pointerup",this.#y),window.addEventListener("pointercancel",this.#y)}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.#$J(),this.#S=!0,this.#T=J&&typeof J==="object"&&J.pointerId!==void 0?J.pointerId:null,this.#W=Q;let Z=J&&typeof J==="object"?Number(J.startValue):Number.NaN;return this.#z=Number.isFinite(Z)?this.#g(Z):this.#V(),this.#WJ(Q),this.#i(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.add(V.#G),this.focus(),!0}updateScrub(J,Q){if(!this.#S)return this.#V();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#V();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#o(Z,$),this.#V()}endScrub(J=!0){if(!this.#S)return this.#V();if(J&&this.#V()!==this.#z)this.#b(this.#V(),{snap:!0,emit:"change"});return this.#JJ(),this.#V()}#e(J){if(!this.#S)return;if(this.#T!==null&&J.pointerId!==this.#T)return;this.updateScrub(J)}#o(J,Q=1){let Z=this.#X?.clientWidth||1,$=V.#Z*(V.#Q*2/360),j=this.#m()*$,_=(J-this.#W)*(j/Z)*Q,X=this.#F??this.#z,q=this.#g(this.#z+_);this.#KJ(J,Q,q!==X),this.#F=q,this.#b(q,{snap:!0,emit:"input"}),this.#YJ(J)}#ZJ(J){if(!this.#S)return;if(this.#T!==null&&J.pointerId!==this.#T)return;this.endScrub()}#JJ(){this.#S=!1,this.#T=null,this.#F=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(V.#G),this.#SJ(),this.#zJ(),window.removeEventListener("pointermove",this.#f),window.removeEventListener("pointerup",this.#y),window.removeEventListener("pointercancel",this.#y),this.#u()}#i(){this.#zJ(),this.#R=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}#YJ(J){if(!this.#R){this.#UJ();return}let Q=J-this.#W;if(!Q){this.#UJ();return}let Z=this.#R*Math.tanh(Q/Math.max(1,this.#R*3));this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${Z}px`)}#zJ(){this.#UJ(),this.#R=0}#UJ(){this.style.removeProperty("--fig-input-wheel-handle-drag-offset")}#WJ(J){this.#SJ(),this.#H=J,this.#C=performance.now()}#KJ(J,Q,Z){let $=performance.now(),j=$-this.#C,_=this.#H===null?0:Math.abs(J-this.#H);this.#H=J,this.#C=$;let X=j>0?_/j*Math.max(1,Math.abs(Q)):0;if(!Z||X<V.#j){this.#v();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#w),this.#w=window.setTimeout(()=>{this.#v()},V.#$)}#SJ(){this.#H=null,this.#C=0,this.#v()}#v(){clearTimeout(this.#w),this.#w=0,this.removeAttribute("data-fig-input-wheel-fast")}#GJ(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.#b(this.#V()+this.#m()*Z*Q,{snap:!0,emit:"input"}),this.#b(this.#V(),{emit:"change"})}#_J(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number"))return;if(J.key==="Home"){let _=this.#p();if(_===null)return;J.preventDefault(),this.#b(_,{snap:!0,emit:"input"}),this.#b(this.#V(),{emit:"change"});return}if(J.key==="End"){let _=this.#s();if(_===null)return;J.preventDefault(),this.#b(_,{snap:!0,emit:"input"}),this.#b(this.#V(),{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.#V();this.#b(j+this.#m()*$*Z,{snap:!0,emit:"input"}),this.#TJ(j,this.#V(),Z,$),this.#b(this.#V(),{emit:"change"})}#TJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#$J();return}if(this.#N)cancelAnimationFrame(this.#N),this.#N=0;clearTimeout(this.#U),this.#U=0,this.removeAttribute("data-fig-input-wheel-keyboard-settling");let _=this.#F??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.#F=_+(Q-_)*k,Y){let U=Math.sin(k*Math.PI/2),N=X+(Z*4-X)*U;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${N}px`)}if(this.#qJ(),k<1){this.#N=requestAnimationFrame(G);return}this.#N=0,this.#F=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.#U=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#U=0},140),this.#u()};this.#N=requestAnimationFrame(G)}#$J(){if(this.#N)cancelAnimationFrame(this.#N),this.#N=0;if(clearTimeout(this.#U),this.#U=0,this.#F=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.#u()}get value(){return this.getAttribute("value")??"0"}set value(J){if(J===null||J===void 0||J===""){this.#b(0);return}let Q=Number(J);this.#b(Number.isFinite(Q)?Q:0)}spinTo(J){let Q=this.#V();this.value=J;let Z=this.#V();if(this.getAttribute("spin")==="false")return this.#$J(),Z;let $=Math.sign(Z-Q);return this.#TJ(Q,Z,$,Math.abs(Z-Q)>this.#m()?10:1,!1),Z}get min(){return this.#p()}set min(J){this.#d("min",J)}get max(){return this.#s()}set max(J){this.#d("max",J)}get step(){return this.#m()}focus(J){HTMLElement.prototype.focus.call(this,J)}}L("fig-input-wheel",V);class u 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;#j=null;#$=null;#G=!1;#q=null;#B=new Set;#X=null;#_=null;#O=0;#k=null;#Y=0;#M=null;#L=0;#P=0;#N=0;#U=!1;#K=!1;#S=0;#T=this.#t.bind(this,"input");#W=this.#t.bind(this,"change");#z=this.#l.bind(this,"input");#F=this.#l.bind(this,"change");#R=this.#ZJ.bind(this);#H=this.#JJ.bind(this);#C=this.#i.bind(this);#w=this.#n.bind(this);#E=this.#qJ.bind(this);#f=this.#MJ.bind(this);#y=this.#YJ.bind(this);connectedCallback(){if(!this.#Q)this.#D();this.#c(),this.#x(),this.#A(),this.#d(),this.#g(),f(this),this.#q?.disconnect(),this.#q=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!u.#Z.has(Z)&&!u.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#d()}),this.#q.observe(this,{attributes:!0})}disconnectedCallback(){this.#q?.disconnect(),this.#e(),this.#a(),this.#OJ(),clearTimeout(this.#S),this.#S=0,this.#J?.endScrub(!1),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label")this.#c();if(J==="text")this.#x();if(J==="elastic"&&Z==="false")this.#e();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#A();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#d()}#D(){this.#X=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=P("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number"),X=jJ("propskit-wheel-label");$.id=X,j.setAttribute("aria-labelledby",X),_.setAttribute("aria-labelledby",X),Z.append($,j,_),this.#Q=Z,this.#J=j,this.#j=$,this.#$=_,this.#G=Boolean(Q),this.replaceChildren(Z);for(let q of J)if(q!==Q)_.appendChild(q)}#c(){if(!this.#j)return;if(!this.#G)this.#j.textContent=this.hasAttribute("label")?this.getAttribute("label")??"":"Value";this.toggleAttribute("data-label-empty",!(this.#j.textContent??"").trim())}#x(){if(!this.#Q||!this.#$)return;let J=this.getAttribute("text")!=="false",Q=this.#$.parentElement===this.#Q;if(J&&!Q)this.#Q.append(this.#$);else if(!J&&Q)this.#$.remove()}#I(J){if(!this.#J)return;if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#A(){if(!this.#J)return;this.#J.removeAttribute("units");for(let Q of["min","max","spin"])this.#I(Q);if(this.hasAttribute("step"))this.#I("step");else this.#J.setAttribute("step",String(this.#h()));this.#J.toggleAttribute("disabled",O(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.#$?.getAttribute("value")!==J)this.#$?.setAttribute("value",J);this.#s()}#m(){return this.getAttributeNames().filter((J)=>!u.#Z.has(J)&&!u.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}#h(){let J=this.#V();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#p(){return this.#V()==="s"?2:0}#s(){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))}#d(){if(!this.#$||!this.#J)return;let J=this.#m(),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.#p()));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",this.#J.value),this.#B=Q}#g(){this.#a(),this.#J?.addEventListener("input",this.#T),this.#J?.addEventListener("change",this.#W),this.#$?.addEventListener("input",this.#z),this.#$?.addEventListener("change",this.#F),this.addEventListener("pointerdown",this.#w,{capture:!0}),this.addEventListener("pointerdown",this.#R,{capture:!0}),this.addEventListener("click",this.#y,!0)}#a(){this.#J?.removeEventListener("input",this.#T),this.#J?.removeEventListener("change",this.#W),this.#$?.removeEventListener("input",this.#z),this.#$?.removeEventListener("change",this.#F),this.removeEventListener("pointerdown",this.#w,{capture:!0}),this.removeEventListener("pointerdown",this.#R,{capture:!0}),this.removeEventListener("click",this.#y,!0)}#b(J,{spin:Q=!1}={}){let Z=Number(J);if(!this.#J){let _=Number.isFinite(Z)?Z:0;return this.setAttribute("value",String(_)),_}let $=Number.isFinite(Z)?Z:0;if(Q)this.#J.spinTo($);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.#s(),Number(j)}#jJ(J,Q){this.dispatchEvent(new CustomEvent(J,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}#t(J,Q){Q.stopImmediatePropagation();let Z=this.#b(Q.detail);this.#jJ(J,Z)}#l(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#$?.value,$=this.#b(Z,{spin:J==="input"});this.#jJ(J,$)}#n(J){if(J.button!==0||O(this,"disabled")||this.getAttribute("elastic")==="false"||!(J.target instanceof Element)||J.target.closest("fig-input-number")||!J.target.closest("fig-input-wheel"))return;this.#u(J.pointerId)}#u(J){if(this.#e(),this.getAttribute("elastic")==="false")return;this.#_=J,this.#O=this.#NJ("--propskit-wheel-elastic-distance");let Q=this.#J?.getBoundingClientRect();if(Q)this.#k={left:Q.left,right:Q.right};this.#Y=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#E,{passive:!0}),window.addEventListener("pointerup",this.#f),window.addEventListener("pointercancel",this.#f),window.addEventListener("blur",this.#f)}#qJ(J){if(J.pointerId!==this.#_)return;if(J.buttons===0){this.#MJ(J);return}this.#kJ(J.clientX)}#MJ(J){if(J?.pointerId!==void 0&&this.#_!==null&&J.pointerId!==this.#_)return;this.#e()}#kJ(J){let Q=this.#k;if(!Q||!this.#O){this.#o();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#o();return}let $=Math.min(this.#O,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")}#NJ(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}#e(){window.removeEventListener("pointermove",this.#E),window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f),this.#_=null,this.#O=0,this.#k=null,this.#Y=0,this.#o()}#o(){this.removeAttribute("data-propskit-wheel-elastic-dragging"),this.style.removeProperty("--propskit-wheel-elastic-scale"),this.style.removeProperty("--propskit-wheel-elastic-origin")}#ZJ(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.#OJ(),this.#M=J.pointerId,this.#L=J.clientX,this.#P=J.clientY,this.#N=Number(this.#J?.value??0),window.addEventListener("pointermove",this.#H),window.addEventListener("pointerup",this.#C,{once:!0}),window.addEventListener("pointercancel",this.#C,{once:!0}),window.addEventListener("blur",this.#C,{once:!0})}#JJ(J){if(J.pointerId!==this.#M)return;if(J.buttons===0){this.#i(J);return}if(!this.#U){if(Math.hypot(J.clientX-this.#L,J.clientY-this.#P)<4)return;this.#U=!0,this.setAttribute("data-number-scrubbing",""),this.#u(J.pointerId),this.#J?.beginScrub({clientX:this.#L,pointerId:J.pointerId,startValue:this.#N})}this.#J?.updateScrub(J),this.#kJ(J.clientX)}#i(J){if(J?.pointerId!==void 0&&this.#M!==null&&J.pointerId!==this.#M)return;let Q=this.#U;if(this.#e(),this.#OJ(),Q){this.#J?.endScrub(),this.#K=!0,clearTimeout(this.#S),this.#S=window.setTimeout(()=>{this.#K=!1,this.#S=0},0),requestAnimationFrame(()=>this.#J?.focus());return}this.#$?.querySelector("input")?.focus()}#OJ(){window.removeEventListener("pointermove",this.#H),window.removeEventListener("pointerup",this.#C),window.removeEventListener("pointercancel",this.#C),window.removeEventListener("blur",this.#C),this.#M=null,this.#U=!1,this.removeAttribute("data-number-scrubbing")}#YJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#K&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#K=!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.#b(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.#X??"0"}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=Number(this.defaultValue),Q=this.#b(Number.isFinite(J)?J:0);p(this,Q)}focus(J){this.#J?.focus(J)}}L("propskit-wheel",u);class zJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping"];#Z=50;#Q=50;#J=75;#j=75;#$=0;#G=!1;#q=0;#B=null;#X=null;#_=null;#O=null;#k=null;#Y=null;#M=null;#L=null;#P=null;#N=!1;#U=!1;#K=!1;#S=!1;#T=null;#W="";#z="";#F=null;#R=null;#H=null;#C="";#w="";#E=null;#f=null;#y=null;get#D(){return this.getAttribute("type")||"point"}get#c(){return this.#D==="point-radius"||this.#D==="point-radius-angle"}get#x(){return this.#D==="point-radius-angle"}get#I(){return this.#D==="point-point"}get#A(){return this.#D==="point-radius-angle"||this.#D==="point-point"}get#m(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#V(){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"}#h(J){let Q=this.#V;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#p(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${Math.round(this.#Z)}%, ${Math.round(this.#Q)}%`}get#s(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${Math.round(this.#J)}%, ${Math.round(this.#j)}%`}get#d(){return this.getAttribute("drag-surface")||"parent"}get#g(){let J=this.#d;if(J==="parent")return this.parentElement;return this.closest(J)}get#a(){let J=this.#d;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#b(J){if(this.#G)return this.#$/100*J;return this.#$}#jJ(){if(this.#G)return`Radius ${Math.round(this.#$)}%`;return`Radius ${Math.round(this.#$)}`}connectedCallback(){this.#t(),this.#l()}disconnectedCallback(){this.#VJ(),this.#AJ(),this.#qJ(),this.#e(),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.#N&&!this.#U&&!this.#K&&!this.#S)if(this.#t(),this.#B)this.#r();else this.#l();if(J==="type")this.#VJ(),this.#t(),this.#l();if(J==="color"&&this.#B)if(Z)this.#B.setAttribute("color",Z);else this.#B.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#l();if(J==="tooltips")this.#l();if(J==="snapping"&&this.#B){if(this.#B.setAttribute("drag-snapping",Z||"false"),this.#X)this.#X.setAttribute("drag-snapping",Z||"false")}if(J==="name"){if(this.#Y)this.#Y.setAttribute("text",this.#p);if(this.#M)this.#M.setAttribute("text",this.#s)}}#t(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#Z=Q.x;if(typeof Q.y==="number")this.#Q=Q.y;if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#G=!0,this.#$=parseFloat(Z);else this.#G=!1,this.#$=parseFloat(Z);if(!Number.isFinite(this.#$))this.#$=0}if(typeof Q.angle==="number")this.#q=Q.angle;if(typeof Q.x2==="number")this.#J=Q.x2;if(typeof Q.y2==="number")this.#j=Q.y2;if(this.#D==="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.#Z,y:this.#Q};if(this.#D==="color"){let Q=this.getAttribute("color")||this.#B?.getAttribute("color");if(Q)J.color=Q}if(this.#c)J.radius=this.#G?`${this.#$}%`:this.#$;if(this.#x)J.angle=this.#q;if(this.#I)J.x2=this.#J,J.y2=this.#j;return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#l(){this.#VJ(),this.replaceChildren(),this.#B=null,this.#X=null,this.#_=null,this.#O=null,this.#k=null,this.#Y=null,this.#M=null,this.#L=null,this.#P=null;let J=O(this,"disabled"),Q=this.#D,Z=this.#m,$=this.#a,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.#V),j.setAttribute("value",`${this.#Z}% ${this.#Q}%`),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.#I)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#B=j,this.#c)this.#YJ();if(this.#A)this.#zJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#p),_.appendChild(j),this.appendChild(_),this.#Y=_}else this.appendChild(j);if(this.#x)this.#WJ(J,Z,$);if(this.#I)this.#KJ(J,Z,$);this.#n(this.#B),this.#n(this.#_),this.#n(this.#X),this.#fJ(),this.#JJ(),requestAnimationFrame(()=>this.#r())}#n(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#NJ(Q,J);else this.#u(Q)},{capture:!0})}#u(J){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#T===null)this.#W=document.body.style.getPropertyValue("cursor"),this.#z=document.body.style.getPropertyPriority("cursor");if(this.#T=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#F)this.#F=(Q)=>{if(Q?.pointerId!==void 0&&this.#T!==null&&Q.pointerId!==this.#T)return;if(Q?.type==="blur")this.#qJ();else requestAnimationFrame(()=>this.#qJ())};window.addEventListener("pointerup",this.#F),window.addEventListener("pointercancel",this.#F),window.addEventListener("blur",this.#F)}#qJ(){if(this.#T===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#W)document.body.style.setProperty("cursor",this.#W,this.#z);else document.body.style.removeProperty("cursor");if(this.#T=null,this.#W="",this.#z="",this.#F)window.removeEventListener("pointerup",this.#F),window.removeEventListener("pointercancel",this.#F),window.removeEventListener("blur",this.#F)}#MJ(J){if(!J)return 0;if(J===this.#_)return this.#q;if(!this.#I)return 0;let Q=this.#$J();return J===this.#B?Q+180:Q}#kJ(){if(this.#R===null)return;let J=this.#v(this.#MJ(this.#H));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#NJ(J,Q){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#R===null)this.#C=document.body.style.getPropertyValue("cursor"),this.#w=document.body.style.getPropertyPriority("cursor");if(this.#R=J?.pointerId??-1,this.#H=Q,document.body.classList.add("fig-lab-rotate-active"),this.#kJ(),!this.#E)this.#E=(Z)=>{if(Z?.pointerId!==void 0&&this.#R!==null&&Z.pointerId!==this.#R)return;if(Z?.type==="blur")this.#e();else requestAnimationFrame(()=>this.#e())};window.addEventListener("pointerup",this.#E),window.addEventListener("pointercancel",this.#E),window.addEventListener("blur",this.#E)}#e(){if(this.#R===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#C)document.body.style.setProperty("cursor",this.#C,this.#w);else document.body.style.removeProperty("cursor");if(this.#R=null,this.#H=null,this.#C="",this.#w="",this.#E)window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E)}#o(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)}#ZJ(){return this.#N||this.#U||this.#K||this.#S}#JJ(){if(this.#B)this.#o(this.#B,()=>this.#Y,()=>this.#p,()=>this.#ZJ()||!!this.#B?.querySelector("fig-color-tip"));if(this.#_)this.#o(this.#_,()=>this.#P,()=>`Angle ${Math.round(this.#q)}°`,()=>this.#ZJ());if(this.#X)this.#o(this.#X,()=>this.#M,()=>this.#s,()=>this.#ZJ());if(this.#O){let J=this.#O.querySelector(".fig-canvas-control-radius-hit");this.#OJ(J||this.#O)}if(this.#D==="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})}#i(J,Q){let Z=this.#L;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?.()}#OJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#L;if(!Z)return;Z.setAttribute("text",this.#jJ()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#i(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#K)return;this.#i(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#K)return;let Q=this.#L;if(!Q)return;Q.removeAttribute("show")})}#YJ(){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.#O=Q,this.#m){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#jJ()),_.appendChild(Q),this.appendChild(_),this.#L=_}else this.appendChild(Q);this.#QJ(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.#I){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.#UJ(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.#k=Q,this.appendChild(Q)}#UJ(J){J.addEventListener("pointerdown",(Q)=>{if(O(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#g;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#Q,q=this.#J,B=this.#j;this.#N=!0,this.#U=!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,N=k.height>0?(M.clientY-j)/k.height*100:0,T=-Math.min(_,q),F=100-Math.max(_,q),H=-Math.min(X,B),z=100-Math.max(X,B),S=Math.max(T,Math.min(F,U)),R=Math.max(H,Math.min(z,N));this.#Z=_+S,this.#Q=X+R,this.#J=q+S,this.#j=B+R,this.#r(),this.#XJ()},G=this.#CJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#N=!1,this.#U=!1,M)this.#FJ(),this.#BJ()});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})})}#WJ(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"),J)$.setAttribute("disabled","");if(this.#_=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",`${Math.round(this.#q)}°`),j.appendChild($),this.appendChild(j),this.#P=j}else this.appendChild($)}#KJ(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.#V),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#j}%`),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),j.appendChild($),this.appendChild(j),this.#M=j}else this.appendChild($)}#SJ(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`}#v(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`}#GJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#_J(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#GJ(Z,this.#v(Q)),this.#H===J)this.#kJ()}#TJ(){if(!this.#_||!this.#x)return;this.#_J(this.#_,this.#q)}#$J(){return Math.atan2(this.#j-this.#Q,this.#J-this.#Z)*180/Math.PI}#HJ(){if(!this.#I)return;let J=this.#$J();this.#B?.style.removeProperty("cursor"),this.#X?.style.removeProperty("cursor"),this.#_J(this.#B,J+180),this.#_J(this.#X,J)}#PJ(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`}#r(){let J=this.#g;if(!J||!this.#B)return;let Q=J.getBoundingClientRect();if(this.#PJ(this.#B,this.#Z,this.#Q,Q),this.#O){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#b(Q.width),_=this.#O,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.#k&&this.#A){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#I)j=this.#J/100*Q.width,_=this.#j/100*Q.height;else{let B=this.#b(Q.width),Y=this.#q*Math.PI/180;j=Z+B*Math.cos(Y),_=$+B*Math.sin(Y)}let X=this.#k;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.#_&&this.#x){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#b(Q.width),_=this.#q*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.#PJ(this.#_,B,Y,Q)}if(this.#X&&this.#I)this.#PJ(this.#X,this.#J,this.#j,Q);this.#TJ(),this.#HJ()}#XJ(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#BJ(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#LJ(J){return{...this.value,...HJ(J.color,J.alpha,J.opacity)}}#FJ(){this.setAttribute("value",JSON.stringify(this.value))}#fJ(){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.#XJ(this.#LJ(J.detail));return}this.#N=!0;let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=Math.round(Math.max(0,Math.min(100,Q*100))),this.#Q=Math.round(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show"),this.#Y.hidePopup?.();this.#r(),this.#XJ()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#BJ(this.#LJ(J.detail));return}let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=Math.round(Math.max(0,Math.min(100,Q*100))),this.#Q=Math.round(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show");this.#r(),this.#FJ(),this.#BJ(),requestAnimationFrame(()=>{this.#N=!1})}),this.#_)this.#_.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#g;if(!Q)return;this.#S=!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.#_.offsetWidth/2,B=this.#_.offsetHeight/2,Y=_+q-$,G=X+B-j,M=Math.atan2(G,Y)*180/Math.PI;if(this.#h(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#q=M;let k=Math.sqrt(Y*Y+G*G);if(this.#h(J.detail?.shiftKey)){let U=this.#G?5:10;if(this.#G){let N=k/Z.width*100;N=Math.round(N/U)*U,k=N/100*Z.width}else k=Math.round(k/U)*U}if(this.#G)this.#$=Math.max(0,k/Z.width*100);else this.#$=Math.max(0,k);if(this.#P)this.#P.setAttribute("text",`Angle ${Math.round(this.#q)}°`),this.#P.setAttribute("show","true"),this.#P.showPopup?.();this.#r(),this.#XJ()}),this.#_.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#P)this.#P.removeAttribute("show");this.#r(),this.#FJ(),this.#BJ(),requestAnimationFrame(()=>{this.#S=!1})}),this.#_.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#g;if(!Z)return;if(this.#S=!0,this.classList.add("fig-canvas-control-ring-active"),this.#_.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,Y=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,Y)*180/Math.PI;if(this.#h(_.shiftKey))M=Math.round(M/15)*15;if(this.#q=M,this.#P)this.#P.setAttribute("text",`Angle ${Math.round(M)}°`);this.#r(),this.#XJ()},j=this.#CJ((_)=>{if(this.#S=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#_.removeAttribute("selected"),this.#P)this.#P.removeAttribute("show");if(_)this.#FJ(),this.#BJ()});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.#X)this.#X.addEventListener("input",(J)=>{J.stopPropagation(),this.#U=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#j/100;if(this.#J=Math.round(Math.max(0,Math.min(100,Q*100))),this.#j=Math.round(Math.max(0,Math.min(100,Z*100))),this.#M)this.#M.removeAttribute("show"),this.#M.hidePopup?.();this.#r(),this.#XJ()}),this.#X.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#M)this.#M.removeAttribute("show");this.#r(),this.#FJ(),this.#BJ(),requestAnimationFrame(()=>{this.#U=!1})}),this.#RJ(this.#B,!0),this.#RJ(this.#X,!1)}#RJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#g;if(!j)return;this.#N=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#j:this.#Q,B=Q?this.#Z:this.#J,Y=Q?this.#Q:this.#j,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,U=Y/100*_.height,N=Math.sqrt((k-G)**2+(U-M)**2),T=Q?this.#Y:this.#M;if(T)T.removeAttribute("show"),T.hidePopup?.();let F=(z)=>{let S=j.getBoundingClientRect(),R=X/100*S.width,W=q/100*S.height,C=z.clientX-S.left-R,I=z.clientY-S.top-W,A=Math.atan2(I,C);if(this.#h(z.shiftKey))A=Math.round(A*180/Math.PI/15)*15*Math.PI/180;let l=R+N*Math.cos(A),s=W+N*Math.sin(A),b=Math.max(0,Math.min(100,l/S.width*100)),y=Math.max(0,Math.min(100,s/S.height*100));if(Q)this.#Z=b,this.#Q=y;else this.#J=b,this.#j=y;this.#r(),this.#XJ()},H=this.#CJ((z)=>{if(this.#N=!1,T)T.removeAttribute("show");if(z)this.#FJ(),this.#BJ()});window.addEventListener("pointermove",F,{signal:H.signal}),window.addEventListener("pointerup",()=>H.finish(!0),{signal:H.signal}),window.addEventListener("pointercancel",()=>H.finish(!1),{signal:H.signal})})}#QJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#K)return;let $=this.#g;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.#GJ(J,this.#SJ(q))});let Q=(Z)=>{if(O(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#K=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#g;if(!$)return;if(this.#L)this.#L.setAttribute("show","true"),this.#L.showPopup?.(),this.#i(Z.clientX,Z.clientY);if(this.#P)this.#P.removeAttribute("show"),this.#P.hidePopup?.();let j=this.#_?.style.pointerEvents,_=this.#_?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#_)this.#_.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.#Q/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.#SJ(k);let U=(T)=>{let F=$.getBoundingClientRect(),H=this.#Z/100*F.width,z=this.#Q/100*F.height,S=T.clientX-F.left-H,R=T.clientY-F.top-z,W=Math.round(Math.atan2(R,S)*180/Math.PI);if(W!==k)k=W,document.body.style.cursor=this.#SJ(W);let C=Math.sqrt(S*S+R*R);if(this.#h(T.shiftKey)){let I=this.#G?5:10;if(this.#G){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.#G)this.#$=Math.max(0,C/F.width*100);else this.#$=Math.max(0,C);if(this.#L)this.#L.setAttribute("text",this.#jJ()),this.#i(T.clientX,T.clientY);this.#r(),this.#XJ()},N=this.#CJ((T)=>{if(this.#K=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#_)this.#_.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=q,this.#L)this.#L.removeAttribute("show");if(T)this.#FJ(),this.#BJ()});window.addEventListener("pointermove",U,{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)}#AJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#CJ(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.#y=null;J(j)};return this.#f=Q,this.#y=$,{signal:Q.signal,finish:$}}#VJ(){this.#y?.(!1),this.#f?.abort(),this.#f=null,this.#y=null}}L("fig-canvas-control",zJ);class K extends HTMLElement{#Z=[K.#H()];#Q=0;#J=2;#j=240;#$=120;#G={min:-1,max:1};#q=null;#B=null;#X=null;#_=null;#O=0;#k=null;#Y=null;#M=null;#L=null;#P=[];#N=[];#U=[];#K=[];#S=new Set;#T=null;#W=null;#z=null;#F=null;#R=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#H(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.#R===null)this.#R=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify({waves:[K.#H()]});this.#J=this.#C("precision",2),this.#D(this.getAttribute("value")),this.#y(),this.#a(),this.#kJ(),f(this)}disconnectedCallback(){if(this.#r(),this.#YJ(),this.#T)this.#T.disconnect(),this.#T=null;D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#D(Z),this.isConnected)this.#a();return}if(J==="precision"){if(this.#J=this.#C("precision",2),this.isConnected)this.#LJ();return}if(J==="aspect-ratio"){if(this.#y(),this.#B)this.#i();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#a()}}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.#R??""}get isDefault(){let J=this.#c(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#I(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#QJ("input"),this.#QJ("change")}get data(){return{waves:this.#Z.map((J)=>this.#I(J))}}get preset(){let J=this.#A;return K.TYPES.find((Q)=>Q.value===J.type)?.name}#C(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#w(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}#E(){return this.getAttribute("edit")!=="false"}#f(){return this.#w("disabled",!1)}#y(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#D(J){let Q=this.#c(J);if(!Q)return!1;if(this.#Z=Q,!this.#Z.length)this.#Z=[K.#H()];return this.#Q=Math.min(this.#Q,this.#Z.length-1),!0}#c(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.#m(J.type),frequency:this.#V(J.frequency,1,0.1,16),amplitude:this.#V(J.amplitude,1,-4,4),phase:this.#V(J.phase,0,-360,360),offset:this.#V(J.offset,0,-4,4)}}#I(J){return{type:J.type,frequency:this.#h(J.frequency),amplitude:this.#h(J.amplitude),phase:this.#h(J.phase),offset:this.#h(J.offset)}}get#A(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||K.#H()}#m(J){let Q=String(J||"").toLowerCase();return K.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#V(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#h(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#p(J){return K.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#s(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=K.#g(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#d(J,Q=24){return E("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},E("path",{d:K.#s(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=K.#s(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#g(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(_)}}#a(){if(this.#r(),this.#YJ(),this.replaceChildren(...this.#jJ()),this.#u(),this.#NJ(),this.#i(),this.#SJ(),!this.#f())this.#OJ();f(this)}#b(J,Q){return E("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},P("div",{className:"propskit-oscillator-handle-inner"},P("fig-tooltip",{text:Q},P("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#jJ(){let J=this.#E()&&!this.#f(),Q=[E("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#j,height:this.#$}),E("line",{className:"propskit-oscillator-baseline"}),E("path",{className:"propskit-oscillator-path"}),E("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#b("amplitude","Amplitude"),this.#b("frequency","Frequency"));let Z=E("svg",{viewBox:`0 0 ${this.#j} ${this.#$}`,className:"propskit-oscillator-svg"},Q),$=[P("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#E())$.push(P("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#t(j,_,!J))));return $}#t(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#Q,_=K.#p(J.type),X=P("fig-tooltip",{text:"Remove form"},P("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},P("fig-icon",{name:"minus"}))),q=P("fig-header",{borderless:!0},[P("h3",{},_),X,this.#l(Z,Q)]),B=P("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 P("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#S.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#l(J,Q){let Z=P("fig-tooltip",{text:"Add form"},P("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},P("fig-icon",{name:"plus"}))),$=K.TYPES.map((j)=>P("fig-menu-item",{value:j.value},[K.#d(j.value,24),P("span",{},j.name)]));return P("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]||K.#H(),B=Q==="amplitude"||Q==="offset";return P("propskit-slider",{className:"propskit-oscillator-field",label:Z,direction:"horizontal",name:Q,"data-wave-index":J,value:this.#h(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()})}#u(){this.#B=this.querySelector(".propskit-oscillator-svg"),this.#X=this.querySelector(".propskit-oscillator-path"),this.#_=this.querySelector(".propskit-oscillator-playhead"),this.#k=this.querySelector(".propskit-oscillator-baseline"),this.#Y=this.querySelector(".propskit-oscillator-bounds"),this.#M=this.querySelector('[data-handle="amplitude"]'),this.#L=this.querySelector('[data-handle="frequency"]'),this.#N=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#P=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#K=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#U=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#qJ(J){let Q=new Set;for(let Z of this.#S)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#S=Q}#MJ(J){let Q=new Set;for(let Z of this.#S)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#S=Q}#kJ(){if(this.#T||!window.ResizeObserver)return;this.#T=new ResizeObserver(()=>{if(this.#NJ())this.#i()}),this.#T.observe(this)}#NJ(){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.#j||Z!==this.#$;return this.#j=Q,this.#$=Z,this.#B.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#e(){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}}#o(J){let{min:Q,max:Z}=this.#G;return this.#$-(J-Q)/(Z-Q)*this.#$}#ZJ(J){let{min:Q,max:Z}=this.#G;return Q+(1-J/this.#$)*(Z-Q)}#JJ(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=K.#g(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#i(){if(!this.#B||!this.#X)return;if(this.#NJ(),this.#G=this.#e(),this.#Y)this.#Y.setAttribute("width",this.#j),this.#Y.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.#j,B=this.#o(this.#JJ(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#X.setAttribute("d",$);let j=this.#o(0);this.#k?.setAttribute("x1","0"),this.#k?.setAttribute("y1",j),this.#k?.setAttribute("x2",this.#j),this.#k?.setAttribute("y2",j),this.#UJ()}#OJ(){if(this.#O||!this.#_)return;let J=(Q)=>{if(!this.isConnected||!this.#_){this.#O=0;return}this.#zJ(Q%1000/1000),this.#O=requestAnimationFrame(J)};this.#O=requestAnimationFrame(J)}#YJ(){if(!this.#O)return;cancelAnimationFrame(this.#O),this.#O=0}#zJ(J){if(!this.#_)return;let Q=J*this.#j,Z=this.#o(this.#JJ(J));this.#_.setAttribute("cx",Q.toFixed(1)),this.#_.setAttribute("cy",Z.toFixed(1))}#UJ(){let Q=this.#A,Z=this.#WJ(),$=Math.max(8,Math.min(this.#j-8,this.#j/Q.frequency)),j=this.#o(this.#JJ(Z/this.#j)),_=this.#o(this.#JJ($/this.#j));this.#KJ(this.#M,Z,j,8),this.#KJ(this.#L,$,_,8)}#WJ(){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.#j-8,j*this.#j))}#KJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#SJ(){if(!this.#E()||this.#f())return;for(let Q of this.#N)Q.addEventListener("change",(Z)=>{if(this.#f())return;let $=this.#v(Q);this.#_J($),this.#Z[$].type=this.#m(Z.detail??Z.target?.value),this.#LJ(),this.#QJ("input"),this.#QJ("change")});for(let Q of this.#P)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#W=Q;try{this.#TJ(this.#v(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#W=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#TJ(this.#v(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#K)Q.addEventListener("pointerdown",()=>{this.#_J(this.#v(Q))}),Q.addEventListener("focusin",()=>{this.#_J(this.#v(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#v(Q);if(Z.detail?.open)this.#S.add($);else this.#S.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.#v(Q)+1,X=this.#m($.detail?.value??Q.value);this.#Z.splice(_,0,K.#H(X)),this.#MJ(_),this.#Q=_,this.#a(),this.#QJ("input"),this.#QJ("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.#v(Q);this.#Z.splice($,1),this.#qJ($),this.#Q=Math.min(this.#Q,this.#Z.length-1),this.#a(),this.#QJ("input"),this.#QJ("change")});for(let Q of[this.#M,this.#L])this.#GJ(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.#PJ(Q,"offset")})}#v(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}#GJ(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.#PJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#f())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#$J($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#_J(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#Q)return;this.#Q=Q,this.#RJ(),this.#UJ()}#TJ(J,Q,Z,$){if(this.#f())return;this.#_J(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#fJ();return}this.#Z[J]=this.#x({...this.#Z[J],[Q]:j}),this.#LJ({skipFieldSync:$=="input"}),this.#QJ($)}#$J(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.#Q]=this.#x($),this.#LJ(),this.#QJ("input"),this.#QJ("change"),!0}#HJ(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}}#PJ(J,Q){this.#r(),this.#q=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.#q)return;let B=this.#HJ(q),Y=this.#A;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#j,B.x));Y.frequency=this.#j/G}else if(Q==="offset"){let G=this.#V(B.x/this.#j,0,0,1),M=this.#BJ(Y,G);Y.offset=this.#ZJ(B.y)-this.#XJ(this.#Q,G)-M*Y.amplitude}else if(Q==="amplitude"){let G=this.#V(B.x/this.#j,0,0,1),M=this.#BJ(Y,G),k=this.#ZJ(B.y)-this.#XJ(this.#Q,G)-Y.offset;Y.amplitude=Math.abs(M)<0.001?Y.amplitude:k/M}this.#Z[this.#Q]=this.#x(Y),this.#LJ(),this.#QJ("input")},_=new AbortController,X=(q=!1)=>{if(this.#q=null,this.#B?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#z===_)this.#z=null,this.#F=null;if(q)this.#QJ("change")};this.#z=_,this.#F=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})}#r(){this.#F?.(!1),this.#z?.abort(),this.#z=null,this.#F=null,this.#q=null,this.#B?.classList.remove("dragging")}#XJ(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=K.#g($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#BJ(J,Q){return K.#g(J.type,Q*J.frequency,J.phase)}#LJ({skipFieldSync:J=!1}={}){if(this.#FJ(),!J)this.#fJ();this.#RJ(),this.#i()}#FJ(){for(let J of this.#N){let Q=this.#v(J);J.value=this.#Z[Q]?.type||"sine"}}#fJ(){for(let J of this.#P){if(J===this.#W)continue;let Q=this.#v(J),Z=J.getAttribute("name"),$=this.#h(this.#Z[Q]?.[Z]??0),j=J.querySelector("fig-slider");if(j)j.value=$;else J.setAttribute("value",String($))}}#RJ(){for(let J of this.#U)if(this.#v(J)===this.#Q)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#QJ(J){this.dispatchEvent(new CustomEvent(J,{bubbles:!0,detail:{value:this.value,data:this.data,preset:K.#p(this.#A.type)}}))}}L("propskit-oscillator",K);class WJ extends HTMLElement{#Z;#Q;#J=null;#j;#$;#G;#q;#B;#X;#_;#O=null;#k=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.#j=this.#w.bind(this),this.#$=this.#m.bind(this),this.#G=this.#V.bind(this),this.#q=this.#s.bind(this),this.#B=this.#d.bind(this),this.#X=this.#E.bind(this),this.#_=this.#p.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.#M("dial",!0),this.showRotations=this.#L(),this.#Y(),this.#H(),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#h(),this.#C()}#Y(){this.#h(),this.#C();let J=this.#W(),Q=this.#N(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#F(0),j=this.max??this.#F(360),_=[];if(this.dial)_.push(P("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},P("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(P("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?P("span",{slot:"append",className:"fig-input-angle-rotations"}):null));this.replaceChildren(..._)}#M(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}#L(){if(this.hasAttribute("rotations"))return this.#M("rotations",!1);if(this.hasAttribute("show-rotations"))return this.#M("show-rotations",!1);return!1}#P(){let J=Math.abs(this.#z(this.angle));return Math.floor(J/360)}#N(){return O(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}#K(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.#A(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#S(),this.#T()}#S(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#T(){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}}#z(J){switch(this.units){case"rad":return J*180/Math.PI;case"turn":return J*360;default:return J}}#F(J){switch(this.units){case"rad":return J*Math.PI/180;case"turn":return J/360;default:return J}}#R(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 $}}#H(){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.#T(),this.plane?.addEventListener("mousedown",this.#$),this.plane?.addEventListener("touchstart",this.#G),this.plane?.addEventListener("keydown",this.#_),window.addEventListener("keydown",this.#q),window.addEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#X),this.angleInput.addEventListener("change",this.#X);this.addEventListener("change",this.#j,!0)}#C(){if(this.plane?.removeEventListener("mousedown",this.#$),this.plane?.removeEventListener("touchstart",this.#G),this.plane?.removeEventListener("keydown",this.#_),window.removeEventListener("keydown",this.#q),window.removeEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#X),this.angleInput.removeEventListener("change",this.#X);this.removeEventListener("change",this.#j,!0)}#w(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.#R($,j,this.units);J.target.value=String(_)}}}#E(J){if(J.stopPropagation(),this.#N())return;if(this.#K(Number(J.target.value)),J.type==="change")this.#I();else this.#x()}#f(){let Q=this.#z(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#Q=Math.sin(Q)}#y(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#D(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}#c(J){let Z=(this.#D(J)%360+360)%360;if(Z=this.#y(Z),this.min!==null||this.max!==null)this.angle=this.#U(this.#F(Z));else if(this.#J===null){this.#J=Z;let _=(this.#z(this.angle)%360+360)%360,X=Z-_;if(X>180)X-=360;if(X<-180)X+=360;this.angle=this.#U(this.angle+this.#F(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#U(this.angle+this.#F(j)),this.#J=Z}if(this.#f(),this.setAttribute("value",String(this.angle)),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#T(),this.#S(),this.#x()}#x(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#I(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#A(){if(this.handle){let Q=this.#z(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)`}}#m(J){if(this.#N()||J.button!==0)return;this.#h(),this.isDragging=!0,this.#J=null,this.#c(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#c(j)},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#O===Z)this.#O=null,this.#k=null;if(j)this.#I()};this.#O=Z,this.#k=$,window.addEventListener("mousemove",Q,{signal:Z.signal}),window.addEventListener("mouseup",()=>$(!0),{signal:Z.signal}),window.addEventListener("blur",()=>$(!1),{signal:Z.signal})}#V(J){if(this.#N())return;J.preventDefault(),this.#h(),this.isDragging=!0,this.#J=null,this.#c(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#c(j.touches[0])},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#O===Z)this.#O=null,this.#k=null;if(j)this.#I()};this.#O=Z,this.#k=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#h(){this.#k?.(!1),this.#O?.abort(),this.#O=null,this.#k=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#p(J){if(this.#N())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.#F(0);else if(J.key==="End")Z=this.max??this.#F(360);else return;J.preventDefault(),J.stopPropagation(),this.#K(Z),this.#x(),this.#I()}#s(J){if(J.key==="Shift")this.isShiftHeld=!0}#d(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.#K(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#K(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.#H(),this.#A()}break;case"dial":if(this.dial=this.#M("dial",!0),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#Y(),this.#H(),this.#A();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"disabled":if(this.#h(),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"aria-label":case"name":if(this.isConnected)this.#Y(),this.#H(),this.#A();break;case"rotations":case"show-rotations":if(this.showRotations=this.#L(),this.isConnected)this.#Y(),this.#H(),this.#A();break}}}L("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;#j=new Map;#$=null;#G=null;#q=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.#S(),this.#k(),this.#J=new MutationObserver(()=>this.#k()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#I(),this.#A(),this.#y(),this.#q?.remove(),this.#q=null}attributeChangedCallback(){if(this.isConnected){if(this.#B)this.#A();this.#k()}}get#B(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#X(){return(this.getAttribute("axis")||"vertical").trim().toLowerCase()==="horizontal"?"horizontal":"vertical"}get#_(){return(this.getAttribute("handle")||"").trim()}#O(){return[...this.children].filter((J)=>J.nodeType===Node.ELEMENT_NODE&&!J.hasAttribute("data-reorder-live"))}#k(){let J=this.#O(),Q=new Set(J);for(let[Z,$]of this.#j)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#K($),this.#j.delete(Z);if(this.#L(J),this.#Y(J),this.#B||J.length<2){this.#I();return}for(let Z of J){let $=this.#N(Z),j=this.#j.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#j.delete(Z);if(!$)continue;this.#U(Z,$)}this.#P(J),this.#M(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")}#M(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","")}#L(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.#_)return;for(let Q of J){let Z=Q.querySelector(this.#_);if(Z)Z.setAttribute("data-reorder-handle",""),Z.setAttribute("aria-roledescription","reorder handle")}}#N(J){if(this.#_)return J.querySelector(this.#_);return J}#U(J,Q){let Z=(B)=>{if(this.#B||this.#O().length<2)return;if(B.button!==0)return;if(!this.#_&&this.#W(B.target,J))return;this.#R(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.#X==="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.#O(),U=k.indexOf(J),N=U;if(B.key===G)N=Math.max(0,U-1);else if(B.key===M)N=Math.min(k.length-1,U+1);else if(B.key==="Home")N=0;else if(B.key==="End")N=k.length-1;if(N===U){this.#T(`${X}, position ${U+1} of ${k.length}`);return}this.#c(J,N),this.#k(),this.#N(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:U,newIndex:N,item:J}})),this.#T(`${X}, position ${N+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#j.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#K(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)}#S(){if(this.#q?.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.#q=J,document.body.appendChild(J)}#T(J){if(!this.#q)return;this.#q.textContent="",requestAnimationFrame(()=>{if(this.#q)this.#q.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#z="fig-reorder-dragging";static#F(J){document.body.classList.toggle(h.#z,J)}#R(J,Q,Z){this.#A();let $={item:Q,target:Z,pointerId:J.pointerId,oldIndex:this.#O().indexOf(Q),targetIndex:this.#O().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.#F(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#X==="horizontal"?j.clientX:j.clientY,B=this.#H(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.#$=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#H(J){let Q=this.#O(),Z=this.#X==="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}#C(J,Q){let Z=this.#O(),$=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}#w(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-$}}#E(){if(this.#G)return this.#G;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#X),document.body.appendChild(J),this.#G=J,J}#f(J,Q){let Z=this.#O();if(!this.#C(Q,J)){this.#y();return}let $=this.#w(Z);if(!$){this.#y();return}let j=this.#E();if(j.setAttribute("data-axis",this.#X),this.#X==="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"}#y(){this.#G?.remove(),this.#G=null}#D(J,Q){let Z=this.#O(),$=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)}#c(J,Q){let $=this.#O().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.#D(Z,J.targetIndex);let B=this.#O().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.#T(`${Y}, position ${B+1} of ${this.#O().length}`)}}}if(Z.classList.remove("dragging"),h.#F(!1),this.#y(),this.#$===J)this.#$=null}#I(){for(let[,J]of this.#j)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#K(J);this.#j.clear()}#A(){if(!this.#$)return;this.#x(this.#$,!0)}}L("fig-reorder",h);
|
|
3
|
+
`:",";return Q.split(Z).map(($)=>$.trim()).filter(Boolean)}static#N(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.#K();if(this.#S(),this.#z(),this.#F(),this.removeEventListener("click",this.#O),this.addEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),this.addEventListener("pointerdown",this.#k,!0),f(this),!this.#G)this.#G=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.#S();if(Z)this.#z()});this.#G.observe(this,{attributes:!0})}disconnectedCallback(){this.#G?.disconnect(),this.#R(),this.removeEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#S();return}if(J==="options"||J==="value")this.#z()}#K(){this.#M=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.#j=m.#L();let j=document.createElement(this.#j?"fig-select":"fig-dropdown");if(j.setAttribute("full",""),this.#j&&Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#$=Boolean(J),this.replaceChildren(Z)}#S(){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("label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);if(!this.#j)J.add("options");return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#W(){if(!this.#J||this.#j)return;let J=m.#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=m.#N(Z),$.textContent=m.#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)}}#z(){if(!this.#J)return;if(!this.#j)this.#W();let J=this.#T().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.#q)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#q=Q}#F(){if(!this.#J)return;if(this.#B??=this.#H.bind(this,"input"),this.#X??=this.#H.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#X),this.#j)this.#_??=this.#H.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#_)}#R(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#X)this.#J.removeEventListener("change",this.#X);if(this.#_)this.#J.removeEventListener("optionhover",this.#_)}#H(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 $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#C(){if(!this.#J||!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"))}#w(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.#j)return;this.#Y=this.#C()}#E(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, fig-dropdown")){this.#Y=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#Y=!1;return}if(this.#J.focus(),!this.#j)return;if(this.#Y||this.#C()){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.#M??""}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;p(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-select",m);class NJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=null;#B=null;#X=this.#U.bind(this);#_=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#O();if(this.#k(),this.#M(),this.#L(),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.#k();if(Z)this.#M()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#P(),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.#k()}#O(){this.#_=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.#j=Boolean(Q),this.replaceChildren(Z)}#k(){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()||"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-"))}#M(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#G)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#G=Q}#L(){if(!this.#J)return;this.#q??=this.#N.bind(this,"input"),this.#B??=this.#N.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#B)this.#J.removeEventListener("change",this.#B)}#N(J,Q){if(Q.stopImmediatePropagation(),O(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(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.#_??""}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,p(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-text",NJ);class PJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=null;#B=null;#X=this.#U.bind(this);#_=null;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#O();if(this.#k(),this.#M(),this.#L(),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")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#M()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#P(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#k()}#O(){this.#_=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.#j=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#k(){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.#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")}#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-"))}#M(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#G)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#G=Q}#L(){if(!this.#J)return;this.#q??=this.#N.bind(this,"input"),this.#B??=this.#N.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#B)this.#J.removeEventListener("change",this.#B)}#N(J,Q){if(Q.stopImmediatePropagation(),O(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(O(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.#_??"0"}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,p(this,this.#J?.value??J)}focus(J){this.#J?.focus(J)}}L("propskit-number",PJ);class LJ extends HTMLElement{static observedAttributes=["x","y","default","label","units","disabled","size"];#Z=null;#Q=null;#J=null;#j=null;#$=!1;#G=!1;#q=this.#W.bind(this,"input");#B=this.#W.bind(this,"change");#X=this.#z.bind(this);connectedCallback(){if(!this.#$)this.#j=this.#O(),this.#Y(this.#j),this.#$=!0;if(!this.#Z)this.#L();this.#P(),this.#N(),this.#S(),this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),f(this)}disconnectedCallback(){this.#T(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if((J==="x"||J==="y")&&!this.#G)this.#N();else if(J==="label")this.#P();else if(J==="units")this.#U();else if(J==="disabled")this.#K()}#_(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.#_(J,50),y:Q===null||!Q.trim()?50:this.#_(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.#_(Q.x,this.#j?.x??50),y:this.#_(Q.y,this.#j?.y??50)}}catch{return null}}#Y(J){let Q=this.#O(),Z={x:this.#_(J?.x,Q.x),y:this.#_(J?.y,Q.y)};return this.#G=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#G=!1,Z}#M(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}#L(){let J=this.#O(),Q=document.createElement("fig-field");Q.className="propskit-position-row",Q.setAttribute("direction","horizontal");let Z=document.createElement("label"),$=this.#M("x",J.x),j=this.#M("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"}#N(){let J=this.#O();this.#Q?.setAttribute("value",String(J.x)),this.#J?.setAttribute("value",String(J.y)),this.#U(),this.#K()}#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")}}#K(){let J=O(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#J?.toggleAttribute("disabled",J)}#S(){this.#T(),this.#Q?.addEventListener("input",this.#q),this.#Q?.addEventListener("change",this.#B),this.#J?.addEventListener("input",this.#q),this.#J?.addEventListener("change",this.#B)}#T(){this.#Q?.removeEventListener("input",this.#q),this.#Q?.removeEventListener("change",this.#B),this.#J?.removeEventListener("input",this.#q),this.#J?.removeEventListener("change",this.#B)}#W(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.#_(Q.currentTarget.value,$[Z]);let j=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...j,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#z(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.#_(J,50)))}get y(){return this.#O().y}set y(J){this.setAttribute("y",String(this.#_(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.#Y(J);this.#N(Q)}get defaultValue(){return this.#k(this.getAttribute("default"))||{...this.#j||{x:50,y:50}}}get isDefault(){return n(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,p(this,{...J,units:this.units})}focus(J){this.#Q?.focus(J)}}L("propskit-position",LJ);class UJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","disabled","value"];#Z=null;#Q=null;#J=null;#j=!1;#$=!1;#G=!1;#q=this.#K.bind(this,"input");#B=this.#K.bind(this,"change");#X=this.#S.bind(this);connectedCallback(){if(!this.#j)this.#Y(this.#k()),this.#j=!0;if(!this.#Z)this.#M();this.#L(),this.#P(),this.#N(),this.#U(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#Y(this.#k());this.#U($)}return}if(J==="size"){this.#P();return}if(J==="disabled"){this.#N();return}this.#L()}#_(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#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.x,50),y:this.#_(Q.y,50),color:typeof Q.color==="string"&&Q.color.trim()?Q.color.trim():"#D9D9D9"}}#k(){return this.#O(this.getAttribute("value"))}#Y(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#M(){let J=this.#k(),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.#L(),this.#P(),this.#N(),Q.append(Z,$),this.replaceChildren(Q)}#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")}#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)}}#N(){r(this,[this.#Q,this.#J])}#U(J){let Q=this.#O(J);if(this.#Q)this.#Q.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#K(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.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else return;let _=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,units:"percent"},bubbles:!0,cancelable:!0,composed:!0}))}#S(J){if(J.target!==this.#Z||this.#G)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#G=!0,this.setAttribute("open",String(Q)),this.#G=!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.#k()}}set value(J){let Q=this.#Y(J);this.#U(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-color-point",UJ);class KJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#j=!1;#$=!1;#G=!1;#q=this.#z.bind(this,"input");#B=this.#z.bind(this,"change");#X=this.#F.bind(this);connectedCallback(){if(!this.#j)this.#M(this.#Y()),this.#j=!0;if(!this.#Z)this.#P();this.#N(),this.#U(),this.#K(),this.#S(),this.#T(this.#Y()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#M(this.#Y());this.#T($)}return}if(J==="size"){this.#U();return}if(J==="units"){this.#K();return}if(J==="disabled"){this.#S();return}this.#N()}#_(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#_(J,0)}#k(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.x,50),y:this.#_(Q.y,50),radius:this.#O(Q.radius)}}#Y(){return this.#k(this.getAttribute("value"))}#M(J){let Q=this.#k(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#L(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.#L(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.#N(),this.#U(),this.#S(),Z.append($,j),this.replaceChildren(Z)}#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")}#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)}}#K(){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")}#S(){r(this,[this.#Q,this.#J])}#T(J){let Q=this.#k(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#L(Q.radius);this.#J.value=Z.value}}#W(J,Q){let Z=this.#L(Q).value,$=this.#_(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-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.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#W(Z,$.radius);else return;let _=this.#M($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#L(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#F(J){if(J.target!==this.#Z||this.#G)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#G=!0,this.setAttribute("open",String(Q)),this.#G=!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.#M(J);this.#T(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius",KJ);class SJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#j=null;#$=!1;#G=!1;#q=!1;#B=this.#F.bind(this,"input");#X=this.#F.bind(this,"change");#_=this.#R.bind(this);connectedCallback(){if(!this.#$)this.#L(this.#M()),this.#$=!0;if(!this.#Z)this.#N();this.#U(),this.#K(),this.#S(),this.#T(),this.#W(this.#M()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#X),this.addEventListener("change",this.#X),this.removeEventListener("openchange",this.#_),this.addEventListener("openchange",this.#_)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#X),this.removeEventListener("openchange",this.#_)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#G){let $=this.#L(this.#M());this.#W($)}return}if(J==="size"){this.#K();return}if(J==="units"){this.#S();return}if(J==="disabled"){this.#T();return}this.#U()}#O(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#k(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#O(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.#O(Q.x,50),y:this.#O(Q.y,50),radius:this.#k(Q.radius),angle:this.#O(Q.angle,0)}}#M(){return this.#Y(this.getAttribute("value"))}#L(J){let Q=this.#Y(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#G=!0,this.setAttribute("value",Z),this.#G=!1,Q}#P(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#N(){let J=this.#M(),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.#j=_,this.#U(),this.#K(),this.#T(),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")}#K(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J,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(){r(this,[this.#Q,this.#J,this.#j])}#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.#j)this.#j.value=Q.angle}#z(J,Q){let Z=this.#P(Q).value,$=this.#O(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#F(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.#O(Z.value?.x,$.x),$.y=this.#O(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#z(Z,$.radius);else if(j==="angle")$.angle=this.#O(Z.value,$.angle);else return;let _=this.#L($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#P(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#R(J){if(J.target!==this.#Z||this.#q)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#q=!0,this.setAttribute("open",String(Q)),this.#q=!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.#L(J);this.#W(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius-angle",SJ);class TJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#j=!1;#$=!1;#G=!1;#q=this.#T.bind(this,"input");#B=this.#T.bind(this,"change");#X=this.#W.bind(this);connectedCallback(){if(!this.#j)this.#Y(this.#k()),this.#j=!0;if(!this.#Z)this.#L();this.#P(),this.#N(),this.#U(),this.#K(),this.#S(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#Y(this.#k());this.#S($)}return}if(J==="size"){this.#N();return}if(J==="units"){this.#U();return}if(J==="disabled"){this.#K();return}this.#P()}#_(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#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.x,50),y:this.#_(Q.y,50),x2:this.#_(Q.x2,75),y2:this.#_(Q.y2,75)}}#k(){return this.#O(this.getAttribute("value"))}#Y(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#M(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}#L(){let J=this.#k(),Q=document.createElement("fig-group"),Z=this.#M("Start","start",J.x,J.y),$=this.#M("End","end",J.x2,J.y2);Q.setAttribute("compact",""),this.#Z=Q,this.#Q=Z,this.#J=$,this.#P(),this.#N(),this.#K(),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")}#N(){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")}}#K(){r(this,[this.#Q,this.#J])}#S(J){let Q=this.#O(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}}#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.#_(j?.x,$.x),$.y=this.#_(j?.y,$.y);else if(_==="end")$.x2=this.#_(j?.x,$.x2),$.y2=this.#_(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.#G)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#G=!0,this.setAttribute("open",String(Q)),this.#G=!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.#Y(J);this.#S(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-point",TJ);class o 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;#j=null;#$=null;#G=0;#q=()=>this.#_();connectedCallback(){this.#R(),this.#P(),this.#N(),this.#B(),requestAnimationFrame(()=>{this.#S()})}disconnectedCallback(){if(this.#X(),this.#G)cancelAnimationFrame(this.#G),this.#G=0;this.#Q?.removeEventListener("click",this.#k),this.#Q?.removeEventListener("keydown",this.#Y),this.#j?.querySelector("fig-button")?.removeEventListener("click",this.#M)}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.#z(),this.#S();return}if(J==="disabled"){this.#P();return}if(J==="size"){this.#N();return}this.#R()}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.#q,!0),this.removeEventListener("change",this.#q,!0),this.addEventListener("input",this.#q,!0),this.addEventListener("change",this.#q,!0),!this.#$)this.#$=new MutationObserver(()=>{this.#P(),this.#N(),this.#_()});this.#$.disconnect(),this.#$.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#X(){this.removeEventListener("input",this.#q,!0),this.removeEventListener("change",this.#q,!0),this.#$?.disconnect()}#_(){if(this.#G)return;this.#G=requestAnimationFrame(()=>{this.#G=0,this.#S()})}#O(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#k=(J)=>{if(O(this,"disabled"))return;if(this.#O(J.target))return;J.stopPropagation(),this.open=!this.open};#Y=(J)=>{if(O(this,"disabled"))return;if(this.#O(J.target))return;if(J.key!=="Enter"&&J.key!==" ")return;J.preventDefault(),J.stopPropagation(),this.open=!this.open};#M=(J)=>{if(J.preventDefault(),J.stopPropagation(),O(this,"disabled"))return;this.#W()};#L(){return[...this.querySelectorAll(o.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(o.#Z))}#P(){let J=O(this,"disabled");for(let Q of this.#L())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.#Q?.setAttribute("aria-disabled",String(J)),this.#Q?.setAttribute("tabindex",J?"-1":"0"),this.#j?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#N(){let J=this.getAttribute("size")==="small";for(let Q of this.#L()){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}#K(){for(let J of this.#L())if(this.#U(J))return!0;return!1}#S(){if(this.#K())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#z()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#W(){for(let J of this.#L())this.#T(J);this.#S(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#z(){if(!this.showReset){this.#j?.setAttribute("hidden","");return}this.#F(),this.#j?.removeAttribute("hidden")}#F(){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.#M)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#M),Q?.addEventListener("click",this.#M)}this.#j=J}#R(){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=jJ("propskit-group");if(this.#Q.dataset.generated){let X=$.querySelector(".propskit-group-chevron");if($.textContent=Q,X)$.prepend(X)}if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",$.id);if(!$.querySelector(".propskit-group-chevron")){let X=document.createElement("fig-icon");X.setAttribute("name","chevron"),X.setAttribute("size","small"),X.className="propskit-group-chevron",$.prepend(X)}if(this.#J=$.querySelector(".propskit-group-chevron"),this.#z(),this.#Q.setAttribute("role","button"),this.#P(),this.#Q.setAttribute("aria-expanded",String(this.open)),this.#Q.removeEventListener("click",this.#k),this.#Q.addEventListener("click",this.#k),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")}}L("propskit-group",o);class FJ extends HTMLElement{#Z=null;#Q=null;#J=null;#j=!1;#$=null;#G=new Set;#q=0;#B=0;#X=null;#_=null;#O=0;#k=null;#Y=null;#M=!1;#L=0;#P=null;#N=0;#U=null;#K=null;#S=0;#T=0;#W=!1;#z=!1;#F=0;#R=null;#H=null;#C=this.#JJ.bind(this);#w=this.#i.bind(this);#E=this.#OJ.bind(this);#f=this.#NJ.bind(this);#y=this.#e.bind(this);#D=this.#o.bind(this);#c=this.#kJ.bind(this);#x=this.#zJ.bind(this);#I=this.#WJ.bind(this);#A=this.#n.bind(this);#m=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.#Z)this.#V();if(this.#p(),this.#s(),this.#XJ(),this.#t(),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.addEventListener("pointerdown",this.#C,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#f,{capture:!0}),this.addEventListener("pointerdown",this.#f,{capture:!0}),this.removeEventListener("contextmenu",this.#x),this.addEventListener("contextmenu",this.#x),this.removeEventListener("click",this.#A,!0),this.addEventListener("click",this.#A,!0),this.#_?.removeEventListener("change",this.#I),this.#_?.addEventListener("change",this.#I),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#a();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#m.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#p();if(Z)this.#s(),this.#t()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#$?.disconnect(),this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#B)cancelAnimationFrame(this.#B),this.#B=0;this.#KJ(),this.#ZJ(),clearTimeout(this.#F),this.#F=0,this.#YJ(),this.#GJ(),this.#MJ(),this.#BJ(),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.removeEventListener("pointerdown",this.#f,{capture:!0}),this.removeEventListener("contextmenu",this.#x),this.removeEventListener("click",this.#A,!0),this.#_?.removeEventListener("change",this.#I)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#p()}#V(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#Y=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.#b()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#Z=$,this.#Q=j,this.#J=_,this.#j=Boolean(Z),this.replaceChildren($),this.#h();for(let X of Q){if(X===Z)continue;this.#J.appendChild(X)}}#h(){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.#_=J,this.appendChild(J)}#p(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()===""){if(this.#Q.parentElement===this.#Z)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")}#s(){if(!this.#J)return;let J=this.#b(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#G)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.#d(Z),this.#G=Q,this.#a(),this.#jJ()}#d(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=RJ(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")}#g(){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.#d((this.getAttribute("type")||"range").toLowerCase())}#a(){if(!this.#J)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#Y??"";if(String(this.#J.value)!==J)this.#J.value=J;this.#g()}#b(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#m.has(Q))}#jJ(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#r(),this.#l()})}#t(){if(this.#B)cancelAnimationFrame(this.#B);this.#B=requestAnimationFrame(()=>{this.#B=0,this.#l()})}#l(){let J=this.#J?.querySelector('input[type="range"]'),Q=this.#J?.querySelector("fig-input-number input");if(J!==this.#X)this.#qJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")||this.#Q?.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")}#n(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#z&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#z=!1;return}this.#u()}#u(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!O(this,"disabled"))this.focus()})})}#qJ(J){if(this.#MJ(),this.#X=J,!this.#X)return;this.#X.addEventListener("dblclick",this.#c,{capture:!0})}#MJ(){if(!this.#X)return;this.#X.removeEventListener("dblclick",this.#c,{capture:!0}),this.#X=null}#kJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#HJ()}#NJ(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.#ZJ(),this.#K=J.pointerId,this.#S=J.clientX,this.#T=J.clientY,this.#W=!1,window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#D,{once:!0}),window.addEventListener("pointercancel",this.#D,{once:!0}),window.addEventListener("blur",this.#D,{once:!0})}#e(J){if(J.pointerId!==this.#K)return;if(J.buttons===0){this.#o(J);return}if(!this.#W){if(Math.hypot(J.clientX-this.#S,J.clientY-this.#T)<4)return;this.#W=!0,this.setAttribute("data-number-scrubbing","")}this.#PJ(this.#TJ(J),"input")}#o(J){if(J?.pointerId!==void 0&&this.#K!==null&&J.pointerId!==this.#K)return;let Q=this.#W;if(this.#ZJ(),Q){this.#PJ(this.#J?.value,"change"),this.#z=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#z=!1,this.#F=0},0),this.#u();return}this.#J?.querySelector("fig-input-number input")?.focus()}#ZJ(){window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#D),window.removeEventListener("pointercancel",this.#D),window.removeEventListener("blur",this.#D),this.#K=null,this.#W=!1,this.removeAttribute("data-number-scrubbing")}#JJ(J){if(J.button!==0||O(this,"disabled"))return;if(this.getAttribute("elastic")==="false")return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#J?.querySelector('input[type="range"]')??this.#X;if(!Q)return;this.#YJ(),this.#GJ(),this.#X=Q,this.#M=!0,this.#U=J.pointerId,this.#L=this.#SJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#P={left:Z.left,right:Z.right,width:Z.width},this.#N=$.width,window.addEventListener("pointermove",this.#w,{passive:!0}),window.addEventListener("pointerup",this.#E,{once:!0}),window.addEventListener("pointercancel",this.#E,{once:!0}),window.addEventListener("blur",this.#E,{once:!0})}#i(J){if(!this.#M)return;if(J.pointerId!==this.#U)return;if(J.buttons===0){this.#OJ(J);return}this.#v(J.clientX)}#OJ(J){if(J?.pointerId!==void 0&&this.#U!==null&&J.pointerId!==this.#U)return;let Q=J?.type==="pointerup"||J?.type==="pointermove"&&J.buttons===0;if(this.#YJ(),this.#GJ(),Q)this.#u()}#YJ(){window.removeEventListener("pointermove",this.#w),window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E),this.#M=!1,this.#U=null}#zJ(J){if(O(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#KJ(),this.#UJ(J.clientX,J.clientY)}#UJ(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.#_?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#WJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#HJ()}#KJ(){if(this.#O)clearTimeout(this.#O),this.#O=0;this.#k=null}#SJ(){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}#v(J){let Q=this.#P;if(!Q||!this.#L){this.#GJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#_J();return}let $=Math.max(-this.#L,Math.min(this.#L,Z*0.5)),j=Math.abs($),_=this.#N?(this.#N+j)/this.#N: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")}#GJ(){this.#_J(),this.#L=0,this.#P=null,this.#N=0,this.#U=null}#_J(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#TJ(J){let Q=this.#X;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)))}#$J(){return this.getAttribute("default")??this.#Y??this.#X?.min??"0"}#HJ(){this.#KJ(),this.#PJ(this.#$J(),"input"),this.#PJ(this.#$J(),"change")}#PJ(J,Q){if(!this.#J||J===null||J===void 0)return;this.#J.value=J,this.setAttribute("value",String(this.#J.value)),this.dispatchEvent(new CustomEvent(Q,{detail:this.#J.value,bubbles:!0,cancelable:!0,composed:!0}))}#r(){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??"")}#XJ(){if(!this.#J)return;if(!this.#R)this.#R=this.#LJ.bind(this,"input");if(!this.#H)this.#H=this.#LJ.bind(this,"change");this.#J.addEventListener("input",this.#R),this.#J.addEventListener("change",this.#H)}#BJ(){if(!this.#J)return;if(this.#R)this.#J.removeEventListener("input",this.#R);if(this.#H)this.#J.removeEventListener("change",this.#H)}#LJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;if(J==="change")this.#GJ();let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;if(this.#J?.value!==void 0){let $=String(this.#J.value);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}this.#g(),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#l();let Q=this.#J?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return 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.#$J()}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){this.#HJ()}}L("propskit-slider",FJ);class V extends HTMLElement{static#Z=33;static#Q=60;static#J=0.55;static#j=1.5;static#$=80;static#G="fig-input-wheel-dragging";#q=null;#B=null;#X=null;#_=null;#O=null;#k=null;#Y=null;#M=0;#L=0;#P=0;#N=0;#U=0;#K=null;#S=!1;#T=null;#W=0;#z=0;#F=null;#R=0;#H=null;#C=0;#w=0;#E=this.#NJ.bind(this);#f=this.#e.bind(this);#y=this.#ZJ.bind(this);#D=this.#GJ.bind(this);#c=this.#_J.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#q)this.#x();if(this.#l(),this.#jJ(),this.#MJ(),this.#K?.disconnect(),globalThis.ResizeObserver)this.#K=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#n(Q.width,Q.height)}),this.#K.observe(this);this.#u()}disconnectedCallback(){if(this.#K?.disconnect(),this.#P)cancelAnimationFrame(this.#P);this.#P=0,this.#$J(),this.#kJ(),this.#JJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#q)return;if(J==="disabled")this.#l();if(J==="value"&&!this.#S)this.#jJ();if(J==="step")this.#t(),this.#u();if(J==="spin")this.#u();if(J==="min"||J==="max")this.#b(this.#V())}#x(){if(this.#q=this,this.#B=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=P("div",{className:"fig-input-wheel-handle"});this.#_=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.#Y={maxEl:$,minEl:j,maxWidthEl:_,minWidthEl:X},this.#I()}#I(){if(!this.#_||this.#O)return;this.#O=E("path",{className:"fig-input-wheel-tick"}),this.#_.append(this.#O)}#A(){if(this.#k)return this.#k;return this.#k={maxH:this.#Y?.maxEl.getBoundingClientRect().height||8,minH:this.#Y?.minEl.getBoundingClientRect().height||4,maxW:this.#Y?.maxWidthEl.getBoundingClientRect().width||2,minW:this.#Y?.minWidthEl.getBoundingClientRect().width||1},this.#k}#m(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#V(){let J=Number(this.getAttribute("value")??0);return Number.isFinite(J)?J:0}#h(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}#p(){return this.#h("min")}#s(){return this.#h("max")}#d(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))}#g(J){let Q=J,Z=this.#p(),$=this.#s();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#a(J){let Q=this.#m();if(Q<=0)return J;let Z=this.#p()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#b(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#a(J):J;$=this.#g($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#t($),this.#u(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#jJ(){let J=this.#V(),Q=this.#g(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#b(Q);return}this.#t(J),this.#u()}#t(J=this.#V()){if(!this.#X)return;let Q=this.#p(),Z=this.#s();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))}#l(){let J=O(this,"disabled");if(!this.#X)return;if(J){if(this.#S)this.#JJ();this.#$J(),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")}#n(J,Q){if(!this.#_||J<1||Q<1)return;if(J===this.#M&&Q===this.#L)return;this.#M=J,this.#L=Q,this.#k=null,this.#_.setAttribute("viewBox",`0 0 ${J} ${Q}`),this.#_.setAttribute("width",String(J)),this.#_.setAttribute("height",String(Q)),this.#u()}#u(){if(this.#P)return;this.#P=requestAnimationFrame(()=>{if(!this.isConnected){this.#P=0;return}if(this.#M<1||this.#L<1){let J=this.#X?.getBoundingClientRect();if(J)this.#n(J.width,J.height)}this.#qJ(),this.#P=0})}#qJ(){if(!this.#O)return;let J=this.#M,Q=this.#L;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#p()??0:this.#F??this.#V(),$=360/V.#Z,j=this.#m(),_=this.#p()??0,X=(Z-_)/j*$,q=V.#J,B=J/2,Y=Q/2,{maxH:G,minH:M,maxW:k,minW:U}=this.#A(),N=V.#Q,T=Math.max(J/2,1),F=T*0.84,H=[];for(let z=0;z<V.#Z;z+=1){let S=X+z*$;if(S=((S+180)%360+360)%360-180,S<-N||S>=N)continue;let R=S*Math.PI/180,W=B+F*Math.sin(R)/(1-q*Math.cos(R)),C=Math.min(1,Math.abs(W-B)/Math.max(T,1)),I=Math.cos(C*Math.PI*0.5),A=M+(G-M)*I,l=U+(k-U)*I,s=A/2,b=l/2,y=Y-s,c=Y+s,d=W-b,i=W+b;H.push(`M ${W} ${y} Q ${i} ${y} ${i} ${y+b} V ${c-b} Q ${i} ${c} ${W} ${c} Q ${d} ${c} ${d} ${c-b} V ${y+b} Q ${d} ${y} ${W} ${y} Z`)}this.#O.setAttribute("d",H.join(" "))}#MJ(){this.#q?.addEventListener("pointerdown",this.#E),this.#X?.addEventListener("wheel",this.#D,{passive:!1}),this.#X?.addEventListener("keydown",this.#c)}#kJ(){this.#q?.removeEventListener("pointerdown",this.#E),this.#X?.removeEventListener("wheel",this.#D),this.#X?.removeEventListener("keydown",this.#c),window.removeEventListener("pointermove",this.#f),window.removeEventListener("pointerup",this.#y),window.removeEventListener("pointercancel",this.#y)}#NJ(J){if(O(this,"disabled"))return;if(J.button!==0)return;if(J.preventDefault(),!this.beginScrub(J))return;this.#q?.setPointerCapture?.(J.pointerId),window.addEventListener("pointermove",this.#f),window.addEventListener("pointerup",this.#y),window.addEventListener("pointercancel",this.#y)}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.#$J(),this.#S=!0,this.#T=J&&typeof J==="object"&&J.pointerId!==void 0?J.pointerId:null,this.#W=Q;let Z=J&&typeof J==="object"?Number(J.startValue):Number.NaN;return this.#z=Number.isFinite(Z)?this.#g(Z):this.#V(),this.#WJ(Q),this.#i(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.add(V.#G),this.focus(),!0}updateScrub(J,Q){if(!this.#S)return this.#V();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#V();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#o(Z,$),this.#V()}endScrub(J=!0){if(!this.#S)return this.#V();if(J&&this.#V()!==this.#z)this.#b(this.#V(),{snap:!0,emit:"change"});return this.#JJ(),this.#V()}#e(J){if(!this.#S)return;if(this.#T!==null&&J.pointerId!==this.#T)return;this.updateScrub(J)}#o(J,Q=1){let Z=this.#X?.clientWidth||1,$=V.#Z*(V.#Q*2/360),j=this.#m()*$,_=(J-this.#W)*(j/Z)*Q,X=this.#F??this.#z,q=this.#g(this.#z+_);this.#KJ(J,Q,q!==X),this.#F=q,this.#b(q,{snap:!0,emit:"input"}),this.#YJ(J)}#ZJ(J){if(!this.#S)return;if(this.#T!==null&&J.pointerId!==this.#T)return;this.endScrub()}#JJ(){this.#S=!1,this.#T=null,this.#F=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(V.#G),this.#SJ(),this.#zJ(),window.removeEventListener("pointermove",this.#f),window.removeEventListener("pointerup",this.#y),window.removeEventListener("pointercancel",this.#y),this.#u()}#i(){this.#zJ(),this.#R=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}#YJ(J){if(!this.#R){this.#UJ();return}let Q=J-this.#W;if(!Q){this.#UJ();return}let Z=this.#R*Math.tanh(Q/Math.max(1,this.#R*3));this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${Z}px`)}#zJ(){this.#UJ(),this.#R=0}#UJ(){this.style.removeProperty("--fig-input-wheel-handle-drag-offset")}#WJ(J){this.#SJ(),this.#H=J,this.#C=performance.now()}#KJ(J,Q,Z){let $=performance.now(),j=$-this.#C,_=this.#H===null?0:Math.abs(J-this.#H);this.#H=J,this.#C=$;let X=j>0?_/j*Math.max(1,Math.abs(Q)):0;if(!Z||X<V.#j){this.#v();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#w),this.#w=window.setTimeout(()=>{this.#v()},V.#$)}#SJ(){this.#H=null,this.#C=0,this.#v()}#v(){clearTimeout(this.#w),this.#w=0,this.removeAttribute("data-fig-input-wheel-fast")}#GJ(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.#b(this.#V()+this.#m()*Z*Q,{snap:!0,emit:"input"}),this.#b(this.#V(),{emit:"change"})}#_J(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number"))return;if(J.key==="Home"){let _=this.#p();if(_===null)return;J.preventDefault(),this.#b(_,{snap:!0,emit:"input"}),this.#b(this.#V(),{emit:"change"});return}if(J.key==="End"){let _=this.#s();if(_===null)return;J.preventDefault(),this.#b(_,{snap:!0,emit:"input"}),this.#b(this.#V(),{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.#V();this.#b(j+this.#m()*$*Z,{snap:!0,emit:"input"}),this.#TJ(j,this.#V(),Z,$),this.#b(this.#V(),{emit:"change"})}#TJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#$J();return}if(this.#N)cancelAnimationFrame(this.#N),this.#N=0;clearTimeout(this.#U),this.#U=0,this.removeAttribute("data-fig-input-wheel-keyboard-settling");let _=this.#F??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.#F=_+(Q-_)*k,Y){let U=Math.sin(k*Math.PI/2),N=X+(Z*4-X)*U;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${N}px`)}if(this.#qJ(),k<1){this.#N=requestAnimationFrame(G);return}this.#N=0,this.#F=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.#U=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#U=0},140),this.#u()};this.#N=requestAnimationFrame(G)}#$J(){if(this.#N)cancelAnimationFrame(this.#N),this.#N=0;if(clearTimeout(this.#U),this.#U=0,this.#F=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.#u()}get value(){return this.getAttribute("value")??"0"}set value(J){if(J===null||J===void 0||J===""){this.#b(0);return}let Q=Number(J);this.#b(Number.isFinite(Q)?Q:0)}spinTo(J){let Q=this.#V();this.value=J;let Z=this.#V();if(this.getAttribute("spin")==="false")return this.#$J(),Z;let $=Math.sign(Z-Q);return this.#TJ(Q,Z,$,Math.abs(Z-Q)>this.#m()?10:1,!1),Z}get min(){return this.#p()}set min(J){this.#d("min",J)}get max(){return this.#s()}set max(J){this.#d("max",J)}get step(){return this.#m()}focus(J){HTMLElement.prototype.focus.call(this,J)}}L("fig-input-wheel",V);class u 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;#j=null;#$=null;#G=!1;#q=null;#B=new Set;#X=null;#_=null;#O=0;#k=null;#Y=0;#M=null;#L=0;#P=0;#N=0;#U=!1;#K=!1;#S=0;#T=this.#t.bind(this,"input");#W=this.#t.bind(this,"change");#z=this.#l.bind(this,"input");#F=this.#l.bind(this,"change");#R=this.#ZJ.bind(this);#H=this.#JJ.bind(this);#C=this.#i.bind(this);#w=this.#n.bind(this);#E=this.#qJ.bind(this);#f=this.#MJ.bind(this);#y=this.#YJ.bind(this);connectedCallback(){if(!this.#Q)this.#D();this.#c(),this.#x(),this.#A(),this.#d(),this.#g(),f(this),this.#q?.disconnect(),this.#q=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!u.#Z.has(Z)&&!u.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#d()}),this.#q.observe(this,{attributes:!0})}disconnectedCallback(){this.#q?.disconnect(),this.#e(),this.#a(),this.#OJ(),clearTimeout(this.#S),this.#S=0,this.#J?.endScrub(!1),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label")this.#c();if(J==="text")this.#x();if(J==="elastic"&&Z==="false")this.#e();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#A();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#d()}#D(){this.#X=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=P("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number"),X=jJ("propskit-wheel-label");$.id=X,j.setAttribute("aria-labelledby",X),_.setAttribute("aria-labelledby",X),Z.append($,j,_),this.#Q=Z,this.#J=j,this.#j=$,this.#$=_,this.#G=Boolean(Q),this.replaceChildren(Z);for(let q of J)if(q!==Q)_.appendChild(q)}#c(){if(!this.#j)return;if(!this.#G)this.#j.textContent=this.hasAttribute("label")?this.getAttribute("label")??"":"Value";this.toggleAttribute("data-label-empty",!(this.#j.textContent??"").trim())}#x(){if(!this.#Q||!this.#$)return;let J=this.getAttribute("text")!=="false",Q=this.#$.parentElement===this.#Q;if(J&&!Q)this.#Q.append(this.#$);else if(!J&&Q)this.#$.remove()}#I(J){if(!this.#J)return;if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#A(){if(!this.#J)return;this.#J.removeAttribute("units");for(let Q of["min","max","spin"])this.#I(Q);if(this.hasAttribute("step"))this.#I("step");else this.#J.setAttribute("step",String(this.#h()));this.#J.toggleAttribute("disabled",O(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.#$?.getAttribute("value")!==J)this.#$?.setAttribute("value",J);this.#s()}#m(){return this.getAttributeNames().filter((J)=>!u.#Z.has(J)&&!u.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}#h(){let J=this.#V();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#p(){return this.#V()==="s"?2:0}#s(){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))}#d(){if(!this.#$||!this.#J)return;let J=this.#m(),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.#p()));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",this.#J.value),this.#B=Q}#g(){this.#a(),this.#J?.addEventListener("input",this.#T),this.#J?.addEventListener("change",this.#W),this.#$?.addEventListener("input",this.#z),this.#$?.addEventListener("change",this.#F),this.addEventListener("pointerdown",this.#w,{capture:!0}),this.addEventListener("pointerdown",this.#R,{capture:!0}),this.addEventListener("click",this.#y,!0)}#a(){this.#J?.removeEventListener("input",this.#T),this.#J?.removeEventListener("change",this.#W),this.#$?.removeEventListener("input",this.#z),this.#$?.removeEventListener("change",this.#F),this.removeEventListener("pointerdown",this.#w,{capture:!0}),this.removeEventListener("pointerdown",this.#R,{capture:!0}),this.removeEventListener("click",this.#y,!0)}#b(J,{spin:Q=!1}={}){let Z=Number(J);if(!this.#J){let _=Number.isFinite(Z)?Z:0;return this.setAttribute("value",String(_)),_}let $=Number.isFinite(Z)?Z:0;if(Q)this.#J.spinTo($);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.#s(),Number(j)}#jJ(J,Q){this.dispatchEvent(new CustomEvent(J,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}#t(J,Q){Q.stopImmediatePropagation();let Z=this.#b(Q.detail);this.#jJ(J,Z)}#l(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#$?.value,$=this.#b(Z,{spin:J==="input"});this.#jJ(J,$)}#n(J){if(J.button!==0||O(this,"disabled")||this.getAttribute("elastic")==="false"||!(J.target instanceof Element)||J.target.closest("fig-input-number")||!J.target.closest("fig-input-wheel"))return;this.#u(J.pointerId)}#u(J){if(this.#e(),this.getAttribute("elastic")==="false")return;this.#_=J,this.#O=this.#NJ("--propskit-wheel-elastic-distance");let Q=this.getBoundingClientRect();if(Q)this.#k={left:Q.left,right:Q.right};this.#Y=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#E,{passive:!0}),window.addEventListener("pointerup",this.#f),window.addEventListener("pointercancel",this.#f),window.addEventListener("blur",this.#f)}#qJ(J){if(J.pointerId!==this.#_)return;if(J.buttons===0){this.#MJ(J);return}this.#kJ(J.clientX)}#MJ(J){if(J?.pointerId!==void 0&&this.#_!==null&&J.pointerId!==this.#_)return;this.#e()}#kJ(J){let Q=this.#k;if(!Q||!this.#O){this.#o();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#o();return}let $=Math.min(this.#O,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")}#NJ(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}#e(){window.removeEventListener("pointermove",this.#E),window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f),this.#_=null,this.#O=0,this.#k=null,this.#Y=0,this.#o()}#o(){this.removeAttribute("data-propskit-wheel-elastic-dragging"),this.style.removeProperty("--propskit-wheel-elastic-scale"),this.style.removeProperty("--propskit-wheel-elastic-origin")}#ZJ(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.#OJ(),this.#M=J.pointerId,this.#L=J.clientX,this.#P=J.clientY,this.#N=Number(this.#J?.value??0),window.addEventListener("pointermove",this.#H),window.addEventListener("pointerup",this.#C,{once:!0}),window.addEventListener("pointercancel",this.#C,{once:!0}),window.addEventListener("blur",this.#C,{once:!0})}#JJ(J){if(J.pointerId!==this.#M)return;if(J.buttons===0){this.#i(J);return}if(!this.#U){if(Math.hypot(J.clientX-this.#L,J.clientY-this.#P)<4)return;this.#U=!0,this.setAttribute("data-number-scrubbing",""),this.#u(J.pointerId),this.#J?.beginScrub({clientX:this.#L,pointerId:J.pointerId,startValue:this.#N})}this.#J?.updateScrub(J),this.#kJ(J.clientX)}#i(J){if(J?.pointerId!==void 0&&this.#M!==null&&J.pointerId!==this.#M)return;let Q=this.#U;if(this.#e(),this.#OJ(),Q){this.#J?.endScrub(),this.#K=!0,clearTimeout(this.#S),this.#S=window.setTimeout(()=>{this.#K=!1,this.#S=0},0),requestAnimationFrame(()=>this.#J?.focus());return}this.#$?.querySelector("input")?.focus()}#OJ(){window.removeEventListener("pointermove",this.#H),window.removeEventListener("pointerup",this.#C),window.removeEventListener("pointercancel",this.#C),window.removeEventListener("blur",this.#C),this.#M=null,this.#U=!1,this.removeAttribute("data-number-scrubbing")}#YJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#K&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#K=!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.#b(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.#X??"0"}get isDefault(){return g(this.value,this.defaultValue)}resetToDefault(){let J=Number(this.defaultValue),Q=this.#b(Number.isFinite(J)?J:0);p(this,Q)}focus(J){this.#J?.focus(J)}}L("propskit-wheel",u);class zJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping"];#Z=50;#Q=50;#J=75;#j=75;#$=0;#G=!1;#q=0;#B=null;#X=null;#_=null;#O=null;#k=null;#Y=null;#M=null;#L=null;#P=null;#N=!1;#U=!1;#K=!1;#S=!1;#T=null;#W="";#z="";#F=null;#R=null;#H=null;#C="";#w="";#E=null;#f=null;#y=null;get#D(){return this.getAttribute("type")||"point"}get#c(){return this.#D==="point-radius"||this.#D==="point-radius-angle"}get#x(){return this.#D==="point-radius-angle"}get#I(){return this.#D==="point-point"}get#A(){return this.#D==="point-radius-angle"||this.#D==="point-point"}get#m(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#V(){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"}#h(J){let Q=this.#V;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#p(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${Math.round(this.#Z)}%, ${Math.round(this.#Q)}%`}get#s(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${Math.round(this.#J)}%, ${Math.round(this.#j)}%`}get#d(){return this.getAttribute("drag-surface")||"parent"}get#g(){let J=this.#d;if(J==="parent")return this.parentElement;return this.closest(J)}get#a(){let J=this.#d;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#b(J){if(this.#G)return this.#$/100*J;return this.#$}#jJ(){if(this.#G)return`Radius ${Math.round(this.#$)}%`;return`Radius ${Math.round(this.#$)}`}connectedCallback(){this.#t(),this.#l()}disconnectedCallback(){this.#VJ(),this.#AJ(),this.#qJ(),this.#e(),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.#N&&!this.#U&&!this.#K&&!this.#S)if(this.#t(),this.#B)this.#r();else this.#l();if(J==="type")this.#VJ(),this.#t(),this.#l();if(J==="color"&&this.#B)if(Z)this.#B.setAttribute("color",Z);else this.#B.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#l();if(J==="tooltips")this.#l();if(J==="snapping"&&this.#B){if(this.#B.setAttribute("drag-snapping",Z||"false"),this.#X)this.#X.setAttribute("drag-snapping",Z||"false")}if(J==="name"){if(this.#Y)this.#Y.setAttribute("text",this.#p);if(this.#M)this.#M.setAttribute("text",this.#s)}}#t(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#Z=Q.x;if(typeof Q.y==="number")this.#Q=Q.y;if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#G=!0,this.#$=parseFloat(Z);else this.#G=!1,this.#$=parseFloat(Z);if(!Number.isFinite(this.#$))this.#$=0}if(typeof Q.angle==="number")this.#q=Q.angle;if(typeof Q.x2==="number")this.#J=Q.x2;if(typeof Q.y2==="number")this.#j=Q.y2;if(this.#D==="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.#Z,y:this.#Q};if(this.#D==="color"){let Q=this.getAttribute("color")||this.#B?.getAttribute("color");if(Q)J.color=Q}if(this.#c)J.radius=this.#G?`${this.#$}%`:this.#$;if(this.#x)J.angle=this.#q;if(this.#I)J.x2=this.#J,J.y2=this.#j;return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#l(){this.#VJ(),this.replaceChildren(),this.#B=null,this.#X=null,this.#_=null,this.#O=null,this.#k=null,this.#Y=null,this.#M=null,this.#L=null,this.#P=null;let J=O(this,"disabled"),Q=this.#D,Z=this.#m,$=this.#a,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.#V),j.setAttribute("value",`${this.#Z}% ${this.#Q}%`),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.#I)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#B=j,this.#c)this.#YJ();if(this.#A)this.#zJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#p),_.appendChild(j),this.appendChild(_),this.#Y=_}else this.appendChild(j);if(this.#x)this.#WJ(J,Z,$);if(this.#I)this.#KJ(J,Z,$);this.#n(this.#B),this.#n(this.#_),this.#n(this.#X),this.#fJ(),this.#JJ(),requestAnimationFrame(()=>this.#r())}#n(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#NJ(Q,J);else this.#u(Q)},{capture:!0})}#u(J){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#T===null)this.#W=document.body.style.getPropertyValue("cursor"),this.#z=document.body.style.getPropertyPriority("cursor");if(this.#T=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#F)this.#F=(Q)=>{if(Q?.pointerId!==void 0&&this.#T!==null&&Q.pointerId!==this.#T)return;if(Q?.type==="blur")this.#qJ();else requestAnimationFrame(()=>this.#qJ())};window.addEventListener("pointerup",this.#F),window.addEventListener("pointercancel",this.#F),window.addEventListener("blur",this.#F)}#qJ(){if(this.#T===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#W)document.body.style.setProperty("cursor",this.#W,this.#z);else document.body.style.removeProperty("cursor");if(this.#T=null,this.#W="",this.#z="",this.#F)window.removeEventListener("pointerup",this.#F),window.removeEventListener("pointercancel",this.#F),window.removeEventListener("blur",this.#F)}#MJ(J){if(!J)return 0;if(J===this.#_)return this.#q;if(!this.#I)return 0;let Q=this.#$J();return J===this.#B?Q+180:Q}#kJ(){if(this.#R===null)return;let J=this.#v(this.#MJ(this.#H));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#NJ(J,Q){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#R===null)this.#C=document.body.style.getPropertyValue("cursor"),this.#w=document.body.style.getPropertyPriority("cursor");if(this.#R=J?.pointerId??-1,this.#H=Q,document.body.classList.add("fig-lab-rotate-active"),this.#kJ(),!this.#E)this.#E=(Z)=>{if(Z?.pointerId!==void 0&&this.#R!==null&&Z.pointerId!==this.#R)return;if(Z?.type==="blur")this.#e();else requestAnimationFrame(()=>this.#e())};window.addEventListener("pointerup",this.#E),window.addEventListener("pointercancel",this.#E),window.addEventListener("blur",this.#E)}#e(){if(this.#R===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#C)document.body.style.setProperty("cursor",this.#C,this.#w);else document.body.style.removeProperty("cursor");if(this.#R=null,this.#H=null,this.#C="",this.#w="",this.#E)window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E)}#o(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)}#ZJ(){return this.#N||this.#U||this.#K||this.#S}#JJ(){if(this.#B)this.#o(this.#B,()=>this.#Y,()=>this.#p,()=>this.#ZJ()||!!this.#B?.querySelector("fig-color-tip"));if(this.#_)this.#o(this.#_,()=>this.#P,()=>`Angle ${Math.round(this.#q)}°`,()=>this.#ZJ());if(this.#X)this.#o(this.#X,()=>this.#M,()=>this.#s,()=>this.#ZJ());if(this.#O){let J=this.#O.querySelector(".fig-canvas-control-radius-hit");this.#OJ(J||this.#O)}if(this.#D==="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})}#i(J,Q){let Z=this.#L;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?.()}#OJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#L;if(!Z)return;Z.setAttribute("text",this.#jJ()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#i(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#K)return;this.#i(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#K)return;let Q=this.#L;if(!Q)return;Q.removeAttribute("show")})}#YJ(){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.#O=Q,this.#m){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#jJ()),_.appendChild(Q),this.appendChild(_),this.#L=_}else this.appendChild(Q);this.#QJ(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.#I){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.#UJ(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.#k=Q,this.appendChild(Q)}#UJ(J){J.addEventListener("pointerdown",(Q)=>{if(O(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#g;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#Q,q=this.#J,B=this.#j;this.#N=!0,this.#U=!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,N=k.height>0?(M.clientY-j)/k.height*100:0,T=-Math.min(_,q),F=100-Math.max(_,q),H=-Math.min(X,B),z=100-Math.max(X,B),S=Math.max(T,Math.min(F,U)),R=Math.max(H,Math.min(z,N));this.#Z=_+S,this.#Q=X+R,this.#J=q+S,this.#j=B+R,this.#r(),this.#XJ()},G=this.#CJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#N=!1,this.#U=!1,M)this.#FJ(),this.#BJ()});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})})}#WJ(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"),J)$.setAttribute("disabled","");if(this.#_=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",`${Math.round(this.#q)}°`),j.appendChild($),this.appendChild(j),this.#P=j}else this.appendChild($)}#KJ(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.#V),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#j}%`),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),j.appendChild($),this.appendChild(j),this.#M=j}else this.appendChild($)}#SJ(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`}#v(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`}#GJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#_J(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#GJ(Z,this.#v(Q)),this.#H===J)this.#kJ()}#TJ(){if(!this.#_||!this.#x)return;this.#_J(this.#_,this.#q)}#$J(){return Math.atan2(this.#j-this.#Q,this.#J-this.#Z)*180/Math.PI}#HJ(){if(!this.#I)return;let J=this.#$J();this.#B?.style.removeProperty("cursor"),this.#X?.style.removeProperty("cursor"),this.#_J(this.#B,J+180),this.#_J(this.#X,J)}#PJ(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`}#r(){let J=this.#g;if(!J||!this.#B)return;let Q=J.getBoundingClientRect();if(this.#PJ(this.#B,this.#Z,this.#Q,Q),this.#O){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#b(Q.width),_=this.#O,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.#k&&this.#A){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#I)j=this.#J/100*Q.width,_=this.#j/100*Q.height;else{let B=this.#b(Q.width),Y=this.#q*Math.PI/180;j=Z+B*Math.cos(Y),_=$+B*Math.sin(Y)}let X=this.#k;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.#_&&this.#x){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#b(Q.width),_=this.#q*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.#PJ(this.#_,B,Y,Q)}if(this.#X&&this.#I)this.#PJ(this.#X,this.#J,this.#j,Q);this.#TJ(),this.#HJ()}#XJ(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#BJ(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#LJ(J){return{...this.value,...HJ(J.color,J.alpha,J.opacity)}}#FJ(){this.setAttribute("value",JSON.stringify(this.value))}#fJ(){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.#XJ(this.#LJ(J.detail));return}this.#N=!0;let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=Math.round(Math.max(0,Math.min(100,Q*100))),this.#Q=Math.round(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show"),this.#Y.hidePopup?.();this.#r(),this.#XJ()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#BJ(this.#LJ(J.detail));return}let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=Math.round(Math.max(0,Math.min(100,Q*100))),this.#Q=Math.round(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show");this.#r(),this.#FJ(),this.#BJ(),requestAnimationFrame(()=>{this.#N=!1})}),this.#_)this.#_.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#g;if(!Q)return;this.#S=!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.#_.offsetWidth/2,B=this.#_.offsetHeight/2,Y=_+q-$,G=X+B-j,M=Math.atan2(G,Y)*180/Math.PI;if(this.#h(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#q=M;let k=Math.sqrt(Y*Y+G*G);if(this.#h(J.detail?.shiftKey)){let U=this.#G?5:10;if(this.#G){let N=k/Z.width*100;N=Math.round(N/U)*U,k=N/100*Z.width}else k=Math.round(k/U)*U}if(this.#G)this.#$=Math.max(0,k/Z.width*100);else this.#$=Math.max(0,k);if(this.#P)this.#P.setAttribute("text",`Angle ${Math.round(this.#q)}°`),this.#P.setAttribute("show","true"),this.#P.showPopup?.();this.#r(),this.#XJ()}),this.#_.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#P)this.#P.removeAttribute("show");this.#r(),this.#FJ(),this.#BJ(),requestAnimationFrame(()=>{this.#S=!1})}),this.#_.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#g;if(!Z)return;if(this.#S=!0,this.classList.add("fig-canvas-control-ring-active"),this.#_.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,Y=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,Y)*180/Math.PI;if(this.#h(_.shiftKey))M=Math.round(M/15)*15;if(this.#q=M,this.#P)this.#P.setAttribute("text",`Angle ${Math.round(M)}°`);this.#r(),this.#XJ()},j=this.#CJ((_)=>{if(this.#S=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#_.removeAttribute("selected"),this.#P)this.#P.removeAttribute("show");if(_)this.#FJ(),this.#BJ()});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.#X)this.#X.addEventListener("input",(J)=>{J.stopPropagation(),this.#U=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#j/100;if(this.#J=Math.round(Math.max(0,Math.min(100,Q*100))),this.#j=Math.round(Math.max(0,Math.min(100,Z*100))),this.#M)this.#M.removeAttribute("show"),this.#M.hidePopup?.();this.#r(),this.#XJ()}),this.#X.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#M)this.#M.removeAttribute("show");this.#r(),this.#FJ(),this.#BJ(),requestAnimationFrame(()=>{this.#U=!1})}),this.#RJ(this.#B,!0),this.#RJ(this.#X,!1)}#RJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#g;if(!j)return;this.#N=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#j:this.#Q,B=Q?this.#Z:this.#J,Y=Q?this.#Q:this.#j,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,U=Y/100*_.height,N=Math.sqrt((k-G)**2+(U-M)**2),T=Q?this.#Y:this.#M;if(T)T.removeAttribute("show"),T.hidePopup?.();let F=(z)=>{let S=j.getBoundingClientRect(),R=X/100*S.width,W=q/100*S.height,C=z.clientX-S.left-R,I=z.clientY-S.top-W,A=Math.atan2(I,C);if(this.#h(z.shiftKey))A=Math.round(A*180/Math.PI/15)*15*Math.PI/180;let l=R+N*Math.cos(A),s=W+N*Math.sin(A),b=Math.max(0,Math.min(100,l/S.width*100)),y=Math.max(0,Math.min(100,s/S.height*100));if(Q)this.#Z=b,this.#Q=y;else this.#J=b,this.#j=y;this.#r(),this.#XJ()},H=this.#CJ((z)=>{if(this.#N=!1,T)T.removeAttribute("show");if(z)this.#FJ(),this.#BJ()});window.addEventListener("pointermove",F,{signal:H.signal}),window.addEventListener("pointerup",()=>H.finish(!0),{signal:H.signal}),window.addEventListener("pointercancel",()=>H.finish(!1),{signal:H.signal})})}#QJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#K)return;let $=this.#g;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.#GJ(J,this.#SJ(q))});let Q=(Z)=>{if(O(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#K=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#g;if(!$)return;if(this.#L)this.#L.setAttribute("show","true"),this.#L.showPopup?.(),this.#i(Z.clientX,Z.clientY);if(this.#P)this.#P.removeAttribute("show"),this.#P.hidePopup?.();let j=this.#_?.style.pointerEvents,_=this.#_?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#_)this.#_.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.#Q/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.#SJ(k);let U=(T)=>{let F=$.getBoundingClientRect(),H=this.#Z/100*F.width,z=this.#Q/100*F.height,S=T.clientX-F.left-H,R=T.clientY-F.top-z,W=Math.round(Math.atan2(R,S)*180/Math.PI);if(W!==k)k=W,document.body.style.cursor=this.#SJ(W);let C=Math.sqrt(S*S+R*R);if(this.#h(T.shiftKey)){let I=this.#G?5:10;if(this.#G){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.#G)this.#$=Math.max(0,C/F.width*100);else this.#$=Math.max(0,C);if(this.#L)this.#L.setAttribute("text",this.#jJ()),this.#i(T.clientX,T.clientY);this.#r(),this.#XJ()},N=this.#CJ((T)=>{if(this.#K=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#_)this.#_.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=q,this.#L)this.#L.removeAttribute("show");if(T)this.#FJ(),this.#BJ()});window.addEventListener("pointermove",U,{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)}#AJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#CJ(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.#y=null;J(j)};return this.#f=Q,this.#y=$,{signal:Q.signal,finish:$}}#VJ(){this.#y?.(!1),this.#f?.abort(),this.#f=null,this.#y=null}}L("fig-canvas-control",zJ);class K extends HTMLElement{#Z=[K.#H()];#Q=0;#J=2;#j=240;#$=120;#G={min:-1,max:1};#q=null;#B=null;#X=null;#_=null;#O=0;#k=null;#Y=null;#M=null;#L=null;#P=[];#N=[];#U=[];#K=[];#S=new Set;#T=null;#W=null;#z=null;#F=null;#R=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#H(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.#R===null)this.#R=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify({waves:[K.#H()]});this.#J=this.#C("precision",2),this.#D(this.getAttribute("value")),this.#y(),this.#a(),this.#kJ(),f(this)}disconnectedCallback(){if(this.#r(),this.#YJ(),this.#T)this.#T.disconnect(),this.#T=null;D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#D(Z),this.isConnected)this.#a();return}if(J==="precision"){if(this.#J=this.#C("precision",2),this.isConnected)this.#LJ();return}if(J==="aspect-ratio"){if(this.#y(),this.#B)this.#i();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#a()}}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.#R??""}get isDefault(){let J=this.#c(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#I(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#QJ("input"),this.#QJ("change")}get data(){return{waves:this.#Z.map((J)=>this.#I(J))}}get preset(){let J=this.#A;return K.TYPES.find((Q)=>Q.value===J.type)?.name}#C(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#w(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}#E(){return this.getAttribute("edit")!=="false"}#f(){return this.#w("disabled",!1)}#y(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#D(J){let Q=this.#c(J);if(!Q)return!1;if(this.#Z=Q,!this.#Z.length)this.#Z=[K.#H()];return this.#Q=Math.min(this.#Q,this.#Z.length-1),!0}#c(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.#m(J.type),frequency:this.#V(J.frequency,1,0.1,16),amplitude:this.#V(J.amplitude,1,-4,4),phase:this.#V(J.phase,0,-360,360),offset:this.#V(J.offset,0,-4,4)}}#I(J){return{type:J.type,frequency:this.#h(J.frequency),amplitude:this.#h(J.amplitude),phase:this.#h(J.phase),offset:this.#h(J.offset)}}get#A(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||K.#H()}#m(J){let Q=String(J||"").toLowerCase();return K.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#V(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#h(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#p(J){return K.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#s(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=K.#g(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#d(J,Q=24){return E("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},E("path",{d:K.#s(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=K.#s(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#g(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(_)}}#a(){if(this.#r(),this.#YJ(),this.replaceChildren(...this.#jJ()),this.#u(),this.#NJ(),this.#i(),this.#SJ(),!this.#f())this.#OJ();f(this)}#b(J,Q){return E("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},P("div",{className:"propskit-oscillator-handle-inner"},P("fig-tooltip",{text:Q},P("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#jJ(){let J=this.#E()&&!this.#f(),Q=[E("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#j,height:this.#$}),E("line",{className:"propskit-oscillator-baseline"}),E("path",{className:"propskit-oscillator-path"}),E("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#b("amplitude","Amplitude"),this.#b("frequency","Frequency"));let Z=E("svg",{viewBox:`0 0 ${this.#j} ${this.#$}`,className:"propskit-oscillator-svg"},Q),$=[P("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#E())$.push(P("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#t(j,_,!J))));return $}#t(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#Q,_=K.#p(J.type),X=P("fig-tooltip",{text:"Remove form"},P("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},P("fig-icon",{name:"minus"}))),q=P("fig-header",{borderless:!0},[P("h3",{},_),X,this.#l(Z,Q)]),B=P("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 P("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#S.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#l(J,Q){let Z=P("fig-tooltip",{text:"Add form"},P("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},P("fig-icon",{name:"plus"}))),$=K.TYPES.map((j)=>P("fig-menu-item",{value:j.value},[K.#d(j.value,24),P("span",{},j.name)]));return P("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]||K.#H(),B=Q==="amplitude"||Q==="offset";return P("propskit-slider",{className:"propskit-oscillator-field",label:Z,direction:"horizontal",name:Q,"data-wave-index":J,value:this.#h(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()})}#u(){this.#B=this.querySelector(".propskit-oscillator-svg"),this.#X=this.querySelector(".propskit-oscillator-path"),this.#_=this.querySelector(".propskit-oscillator-playhead"),this.#k=this.querySelector(".propskit-oscillator-baseline"),this.#Y=this.querySelector(".propskit-oscillator-bounds"),this.#M=this.querySelector('[data-handle="amplitude"]'),this.#L=this.querySelector('[data-handle="frequency"]'),this.#N=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#P=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#K=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#U=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#qJ(J){let Q=new Set;for(let Z of this.#S)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#S=Q}#MJ(J){let Q=new Set;for(let Z of this.#S)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#S=Q}#kJ(){if(this.#T||!window.ResizeObserver)return;this.#T=new ResizeObserver(()=>{if(this.#NJ())this.#i()}),this.#T.observe(this)}#NJ(){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.#j||Z!==this.#$;return this.#j=Q,this.#$=Z,this.#B.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#e(){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}}#o(J){let{min:Q,max:Z}=this.#G;return this.#$-(J-Q)/(Z-Q)*this.#$}#ZJ(J){let{min:Q,max:Z}=this.#G;return Q+(1-J/this.#$)*(Z-Q)}#JJ(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=K.#g(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#i(){if(!this.#B||!this.#X)return;if(this.#NJ(),this.#G=this.#e(),this.#Y)this.#Y.setAttribute("width",this.#j),this.#Y.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.#j,B=this.#o(this.#JJ(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#X.setAttribute("d",$);let j=this.#o(0);this.#k?.setAttribute("x1","0"),this.#k?.setAttribute("y1",j),this.#k?.setAttribute("x2",this.#j),this.#k?.setAttribute("y2",j),this.#UJ()}#OJ(){if(this.#O||!this.#_)return;let J=(Q)=>{if(!this.isConnected||!this.#_){this.#O=0;return}this.#zJ(Q%1000/1000),this.#O=requestAnimationFrame(J)};this.#O=requestAnimationFrame(J)}#YJ(){if(!this.#O)return;cancelAnimationFrame(this.#O),this.#O=0}#zJ(J){if(!this.#_)return;let Q=J*this.#j,Z=this.#o(this.#JJ(J));this.#_.setAttribute("cx",Q.toFixed(1)),this.#_.setAttribute("cy",Z.toFixed(1))}#UJ(){let Q=this.#A,Z=this.#WJ(),$=Math.max(8,Math.min(this.#j-8,this.#j/Q.frequency)),j=this.#o(this.#JJ(Z/this.#j)),_=this.#o(this.#JJ($/this.#j));this.#KJ(this.#M,Z,j,8),this.#KJ(this.#L,$,_,8)}#WJ(){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.#j-8,j*this.#j))}#KJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#SJ(){if(!this.#E()||this.#f())return;for(let Q of this.#N)Q.addEventListener("change",(Z)=>{if(this.#f())return;let $=this.#v(Q);this.#_J($),this.#Z[$].type=this.#m(Z.detail??Z.target?.value),this.#LJ(),this.#QJ("input"),this.#QJ("change")});for(let Q of this.#P)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#W=Q;try{this.#TJ(this.#v(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#W=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#TJ(this.#v(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#K)Q.addEventListener("pointerdown",()=>{this.#_J(this.#v(Q))}),Q.addEventListener("focusin",()=>{this.#_J(this.#v(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#v(Q);if(Z.detail?.open)this.#S.add($);else this.#S.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.#v(Q)+1,X=this.#m($.detail?.value??Q.value);this.#Z.splice(_,0,K.#H(X)),this.#MJ(_),this.#Q=_,this.#a(),this.#QJ("input"),this.#QJ("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.#v(Q);this.#Z.splice($,1),this.#qJ($),this.#Q=Math.min(this.#Q,this.#Z.length-1),this.#a(),this.#QJ("input"),this.#QJ("change")});for(let Q of[this.#M,this.#L])this.#GJ(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.#PJ(Q,"offset")})}#v(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}#GJ(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.#PJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#f())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#$J($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#_J(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#Q)return;this.#Q=Q,this.#RJ(),this.#UJ()}#TJ(J,Q,Z,$){if(this.#f())return;this.#_J(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#fJ();return}this.#Z[J]=this.#x({...this.#Z[J],[Q]:j}),this.#LJ({skipFieldSync:$=="input"}),this.#QJ($)}#$J(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.#Q]=this.#x($),this.#LJ(),this.#QJ("input"),this.#QJ("change"),!0}#HJ(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}}#PJ(J,Q){this.#r(),this.#q=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.#q)return;let B=this.#HJ(q),Y=this.#A;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#j,B.x));Y.frequency=this.#j/G}else if(Q==="offset"){let G=this.#V(B.x/this.#j,0,0,1),M=this.#BJ(Y,G);Y.offset=this.#ZJ(B.y)-this.#XJ(this.#Q,G)-M*Y.amplitude}else if(Q==="amplitude"){let G=this.#V(B.x/this.#j,0,0,1),M=this.#BJ(Y,G),k=this.#ZJ(B.y)-this.#XJ(this.#Q,G)-Y.offset;Y.amplitude=Math.abs(M)<0.001?Y.amplitude:k/M}this.#Z[this.#Q]=this.#x(Y),this.#LJ(),this.#QJ("input")},_=new AbortController,X=(q=!1)=>{if(this.#q=null,this.#B?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#z===_)this.#z=null,this.#F=null;if(q)this.#QJ("change")};this.#z=_,this.#F=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})}#r(){this.#F?.(!1),this.#z?.abort(),this.#z=null,this.#F=null,this.#q=null,this.#B?.classList.remove("dragging")}#XJ(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=K.#g($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#BJ(J,Q){return K.#g(J.type,Q*J.frequency,J.phase)}#LJ({skipFieldSync:J=!1}={}){if(this.#FJ(),!J)this.#fJ();this.#RJ(),this.#i()}#FJ(){for(let J of this.#N){let Q=this.#v(J);J.value=this.#Z[Q]?.type||"sine"}}#fJ(){for(let J of this.#P){if(J===this.#W)continue;let Q=this.#v(J),Z=J.getAttribute("name"),$=this.#h(this.#Z[Q]?.[Z]??0),j=J.querySelector("fig-slider");if(j)j.value=$;else J.setAttribute("value",String($))}}#RJ(){for(let J of this.#U)if(this.#v(J)===this.#Q)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#QJ(J){this.dispatchEvent(new CustomEvent(J,{bubbles:!0,detail:{value:this.value,data:this.data,preset:K.#p(this.#A.type)}}))}}L("propskit-oscillator",K);class WJ extends HTMLElement{#Z;#Q;#J=null;#j;#$;#G;#q;#B;#X;#_;#O=null;#k=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.#j=this.#w.bind(this),this.#$=this.#m.bind(this),this.#G=this.#V.bind(this),this.#q=this.#s.bind(this),this.#B=this.#d.bind(this),this.#X=this.#E.bind(this),this.#_=this.#p.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.#M("dial",!0),this.showRotations=this.#L(),this.#Y(),this.#H(),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#h(),this.#C()}#Y(){this.#h(),this.#C();let J=this.#W(),Q=this.#N(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#F(0),j=this.max??this.#F(360),_=[];if(this.dial)_.push(P("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},P("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(P("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?P("span",{slot:"append",className:"fig-input-angle-rotations"}):null));this.replaceChildren(..._)}#M(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}#L(){if(this.hasAttribute("rotations"))return this.#M("rotations",!1);if(this.hasAttribute("show-rotations"))return this.#M("show-rotations",!1);return!1}#P(){let J=Math.abs(this.#z(this.angle));return Math.floor(J/360)}#N(){return O(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}#K(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.#A(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#S(),this.#T()}#S(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#T(){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}}#z(J){switch(this.units){case"rad":return J*180/Math.PI;case"turn":return J*360;default:return J}}#F(J){switch(this.units){case"rad":return J*Math.PI/180;case"turn":return J/360;default:return J}}#R(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 $}}#H(){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.#T(),this.plane?.addEventListener("mousedown",this.#$),this.plane?.addEventListener("touchstart",this.#G),this.plane?.addEventListener("keydown",this.#_),window.addEventListener("keydown",this.#q),window.addEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#X),this.angleInput.addEventListener("change",this.#X);this.addEventListener("change",this.#j,!0)}#C(){if(this.plane?.removeEventListener("mousedown",this.#$),this.plane?.removeEventListener("touchstart",this.#G),this.plane?.removeEventListener("keydown",this.#_),window.removeEventListener("keydown",this.#q),window.removeEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#X),this.angleInput.removeEventListener("change",this.#X);this.removeEventListener("change",this.#j,!0)}#w(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.#R($,j,this.units);J.target.value=String(_)}}}#E(J){if(J.stopPropagation(),this.#N())return;if(this.#K(Number(J.target.value)),J.type==="change")this.#I();else this.#x()}#f(){let Q=this.#z(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#Q=Math.sin(Q)}#y(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#D(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}#c(J){let Z=(this.#D(J)%360+360)%360;if(Z=this.#y(Z),this.min!==null||this.max!==null)this.angle=this.#U(this.#F(Z));else if(this.#J===null){this.#J=Z;let _=(this.#z(this.angle)%360+360)%360,X=Z-_;if(X>180)X-=360;if(X<-180)X+=360;this.angle=this.#U(this.angle+this.#F(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#U(this.angle+this.#F(j)),this.#J=Z}if(this.#f(),this.setAttribute("value",String(this.angle)),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#T(),this.#S(),this.#x()}#x(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#I(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#A(){if(this.handle){let Q=this.#z(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)`}}#m(J){if(this.#N()||J.button!==0)return;this.#h(),this.isDragging=!0,this.#J=null,this.#c(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#c(j)},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#O===Z)this.#O=null,this.#k=null;if(j)this.#I()};this.#O=Z,this.#k=$,window.addEventListener("mousemove",Q,{signal:Z.signal}),window.addEventListener("mouseup",()=>$(!0),{signal:Z.signal}),window.addEventListener("blur",()=>$(!1),{signal:Z.signal})}#V(J){if(this.#N())return;J.preventDefault(),this.#h(),this.isDragging=!0,this.#J=null,this.#c(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#c(j.touches[0])},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#O===Z)this.#O=null,this.#k=null;if(j)this.#I()};this.#O=Z,this.#k=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#h(){this.#k?.(!1),this.#O?.abort(),this.#O=null,this.#k=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#p(J){if(this.#N())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.#F(0);else if(J.key==="End")Z=this.max??this.#F(360);else return;J.preventDefault(),J.stopPropagation(),this.#K(Z),this.#x(),this.#I()}#s(J){if(J.key==="Shift")this.isShiftHeld=!0}#d(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.#K(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#K(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.#H(),this.#A()}break;case"dial":if(this.dial=this.#M("dial",!0),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#Y(),this.#H(),this.#A();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"disabled":if(this.#h(),this.isConnected)this.#Y(),this.#H(),this.#A();break;case"aria-label":case"name":if(this.isConnected)this.#Y(),this.#H(),this.#A();break;case"rotations":case"show-rotations":if(this.showRotations=this.#L(),this.isConnected)this.#Y(),this.#H(),this.#A();break}}}L("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;#j=new Map;#$=null;#G=null;#q=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.#S(),this.#k(),this.#J=new MutationObserver(()=>this.#k()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#I(),this.#A(),this.#y(),this.#q?.remove(),this.#q=null}attributeChangedCallback(){if(this.isConnected){if(this.#B)this.#A();this.#k()}}get#B(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#X(){return(this.getAttribute("axis")||"vertical").trim().toLowerCase()==="horizontal"?"horizontal":"vertical"}get#_(){return(this.getAttribute("handle")||"").trim()}#O(){return[...this.children].filter((J)=>J.nodeType===Node.ELEMENT_NODE&&!J.hasAttribute("data-reorder-live"))}#k(){let J=this.#O(),Q=new Set(J);for(let[Z,$]of this.#j)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#K($),this.#j.delete(Z);if(this.#L(J),this.#Y(J),this.#B||J.length<2){this.#I();return}for(let Z of J){let $=this.#N(Z),j=this.#j.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#j.delete(Z);if(!$)continue;this.#U(Z,$)}this.#P(J),this.#M(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")}#M(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","")}#L(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.#_)return;for(let Q of J){let Z=Q.querySelector(this.#_);if(Z)Z.setAttribute("data-reorder-handle",""),Z.setAttribute("aria-roledescription","reorder handle")}}#N(J){if(this.#_)return J.querySelector(this.#_);return J}#U(J,Q){let Z=(B)=>{if(this.#B||this.#O().length<2)return;if(B.button!==0)return;if(!this.#_&&this.#W(B.target,J))return;this.#R(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.#X==="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.#O(),U=k.indexOf(J),N=U;if(B.key===G)N=Math.max(0,U-1);else if(B.key===M)N=Math.min(k.length-1,U+1);else if(B.key==="Home")N=0;else if(B.key==="End")N=k.length-1;if(N===U){this.#T(`${X}, position ${U+1} of ${k.length}`);return}this.#c(J,N),this.#k(),this.#N(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:U,newIndex:N,item:J}})),this.#T(`${X}, position ${N+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#j.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#K(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)}#S(){if(this.#q?.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.#q=J,document.body.appendChild(J)}#T(J){if(!this.#q)return;this.#q.textContent="",requestAnimationFrame(()=>{if(this.#q)this.#q.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#z="fig-reorder-dragging";static#F(J){document.body.classList.toggle(h.#z,J)}#R(J,Q,Z){this.#A();let $={item:Q,target:Z,pointerId:J.pointerId,oldIndex:this.#O().indexOf(Q),targetIndex:this.#O().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.#F(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#X==="horizontal"?j.clientX:j.clientY,B=this.#H(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.#$=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#H(J){let Q=this.#O(),Z=this.#X==="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}#C(J,Q){let Z=this.#O(),$=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}#w(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-$}}#E(){if(this.#G)return this.#G;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#X),document.body.appendChild(J),this.#G=J,J}#f(J,Q){let Z=this.#O();if(!this.#C(Q,J)){this.#y();return}let $=this.#w(Z);if(!$){this.#y();return}let j=this.#E();if(j.setAttribute("data-axis",this.#X),this.#X==="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"}#y(){this.#G?.remove(),this.#G=null}#D(J,Q){let Z=this.#O(),$=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)}#c(J,Q){let $=this.#O().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.#D(Z,J.targetIndex);let B=this.#O().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.#T(`${Y}, position ${B+1} of ${this.#O().length}`)}}}if(Z.classList.remove("dragging"),h.#F(!1),this.#y(),this.#$===J)this.#$=null}#I(){for(let[,J]of this.#j)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#K(J);this.#j.clear()}#A(){if(!this.#$)return;this.#x(this.#$,!0)}}L("fig-reorder",h);
|
package/fig-lab.js
CHANGED
|
@@ -6753,7 +6753,7 @@ class PropskitWheel extends HTMLElement {
|
|
|
6753
6753
|
this.#elasticMaxPx = this.#readCssLength(
|
|
6754
6754
|
"--propskit-wheel-elastic-distance",
|
|
6755
6755
|
);
|
|
6756
|
-
const rangeRect = this
|
|
6756
|
+
const rangeRect = this.getBoundingClientRect();
|
|
6757
6757
|
if (rangeRect) {
|
|
6758
6758
|
this.#elasticRangeRect = {
|
|
6759
6759
|
left: rangeRect.left,
|
package/package.json
CHANGED