@rogieking/figui3 8.9.29 → 8.9.30
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/dist/fig.js +3 -3
- package/fig-lab.js +19 -10
- package/fig.js +62 -22
- 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 Y(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var d="http://www.w3.org/2000/svg";function i(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 a(J,Q={}){for(let[Z,$]of Object.entries(Q)){if($===null||$===void 0||$===!1)continue;if(Z==="className")if(J.namespaceURI===d)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 a($,Q),i($,Z)}function A(J,Q,Z){let $=document.createElementNS(d,J);return a($,Q),i($,Z)}function c(J,Q){let Z=Y(J,"disabled");for(let $ of Q)$?.toggleAttribute("disabled",Z)}function KJ(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 u=new WeakMap;function z(J){let Q=u.get(J);if(!Q){let Z=document.createElement("fig-menu");Z.setAttribute("position","bottom left"),Z.setAttribute("offset","0 0");let $=document.createElement("fig-menu-item");$.setAttribute("value","reset-default"),$.textContent="Reset",Z.appendChild($);let j=0,_=()=>{if(j)clearTimeout(j),j=0;window.removeEventListener("pointerup",X,!0),window.removeEventListener("pointercancel",X,!0)},X=()=>{_();let O=Q?.point;if(O)Z.showAt?.(O.x,O.y)};Q={menu:Z,point:null,clearPendingOpen:_,handleContextMenu:(O)=>{if(Y(J,"disabled")||O.target?.closest?.("fig-menu"))return;O.preventDefault(),O.stopPropagation(),O.stopImmediatePropagation?.(),Q.point={x:O.clientX,y:O.clientY},_(),window.addEventListener("pointerup",X,{once:!0,capture:!0}),window.addEventListener("pointercancel",X,{once:!0,capture:!0}),j=window.setTimeout(X,180)},handleChange:(O)=>{if(O.stopPropagation(),O.detail?.value==="reset-default")J.resetToDefault?.()}},u.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 V(J){let Q=u.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function h(J,Q){for(let Z of["input","change"])J.dispatchEvent(new CustomEvent(Z,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}function w(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function v(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 w(J,Q)}}function SJ(J,Q){if(!J||!Q)return null;let Z=document.createElement("span");Z.style.cssText="position:absolute;visibility:hidden;pointer-events:none;color:"+Q,J.appendChild(Z);let $=getComputedStyle(Z).color;if(Z.remove(),!$.startsWith("rgb"))return null;let j=$.match(/[\d.]+/g)?.slice(0,3).map(Number);if(!j||j.length<3||j.some(Number.isNaN))return null;let[_,X,q]=j.map((O)=>{let G=O/255;return G<=0.04045?G/12.92:((G+0.055)/1.055)**2.4});return 0.2126*_+0.7152*X+0.0722*q<=0.179?"light":"dark"}var r=0;function TJ(J="fig-lab"){return r+=1,`${J}-${r}`}class t extends HTMLElement{}L("fig-ai-prompt",t);class n extends HTMLElement{}L("fig-ai-context",n);class e extends HTMLElement{}L("fig-chat-message",e);class JJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=null;#X=null;#Y=null;#q=this.#P.bind(this);#j=this.#L.bind(this);#B=this.#N.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#Q)this.#_();this.#X.removeEventListener("click",this.#q),this.#X.addEventListener("click",this.#q),this.#O(),this.#G()}disconnectedCallback(){this.#X?.removeEventListener("click",this.#q),this.#k()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;this.#G()}#_(){this.#Z=document.createElement("fig-tooltip"),this.#Z.className="fig-attachment-tooltip",this.#Q=document.createElement("fig-image"),this.#Q.setAttribute("aspect-ratio","1/1"),this.#Q.setAttribute("fit","cover"),this.#Q.setAttribute("full",""),this.#J=document.createElement("span"),this.#J.className="fig-attachment-fallback",this.#J.setAttribute("aria-hidden","true"),this.#$=document.createElement("fig-tooltip"),this.#$.className="fig-attachment-remove-tooltip",this.#$.setAttribute("text","Remove attachment"),this.#X=document.createElement("fig-button"),this.#X.className="fig-attachment-remove",this.#X.setAttribute("variant","overlay"),this.#X.setAttribute("size","small"),this.#X.setAttribute("icon","");let J=document.createElement("fig-icon");J.setAttribute("name","close"),J.setAttribute("size","small"),this.#X.append(J),this.#$.append(this.#X),this.#Q.append(this.#J),this.#Z.append(this.#Q),this.replaceChildren(this.#Z,this.#$),this.#X.addEventListener("click",this.#q),this.#O()}#O(){let J=this.#Q?.mediaEl;if(!J||J===this.#Y)return;this.#k(),this.#Y=J,this.#Y.addEventListener("load",this.#j),this.#Y.addEventListener("error",this.#B)}#k(){if(!this.#Y)return;this.#Y.removeEventListener("load",this.#j),this.#Y.removeEventListener("error",this.#B),this.#Y=null}#G(){let J=this.getAttribute("src")||"",Q=this.getAttribute("name")||"Attachment",Z=!this.hasAttribute("removable")||Y(this,"removable"),$=Y(this,"disabled");if(this.#Z.setAttribute("text",Q),this.#Q.setAttribute("alt",Q),J)this.#Q.setAttribute("src",J);else this.#Q.removeAttribute("src");if(this.#O(),this.#J.textContent=this.#M(Q),this.#X.hidden=!Z,this.#X.toggleAttribute("disabled",$),this.#X.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")}#N(){this.setAttribute("data-fallback","")}#P(J){if(J.stopPropagation(),Y(this,"disabled")||this.hasAttribute("removable")&&!Y(this,"removable"))return;this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.getAttribute("value"),name:this.getAttribute("name")||"",src:this.getAttribute("src")||"",attachment:this}}))}}L("fig-attachment",JJ);class QJ 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",QJ);class ZJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=null;#j=null;#B=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.#B),this.addEventListener("click",this.#B),z(this),!this.#X)this.#X=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.#X.observe(this,{attributes:!0})}disconnectedCallback(){this.#X?.disconnect(),this.#N(),this.removeEventListener("click",this.#B),V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#k()}#O(){this.#_=Y(this,"checked");let Q=Array.from(this.childNodes).filter((q)=>q.nodeType!==Node.TEXT_NODE||Boolean(q.textContent?.trim())).find((q)=>q.nodeType===Node.ELEMENT_NODE&&q.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-segmented-control"),_=document.createElement("fig-segment"),X=document.createElement("fig-segment");j.setAttribute("sizing","equal"),_.setAttribute("value","off"),_.textContent="Off",X.setAttribute("value","on"),X.textContent="On",j.append(_,X),Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#$=Boolean(Q),this.replaceChildren(Z)}#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.#$)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")}#G(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","checked","value","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#M(){if(!this.#J)return;let J=this.#G(),Q=new Set(J);for(let Z of this.#Y)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#J.setAttribute("value",Y(this,"checked")?"on":"off"),this.#Y=Q}#L(){if(!this.#J)return;this.#q??=this.#P.bind(this,"input"),this.#j??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#j)}#N(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#j)this.#J.removeEventListener("change",this.#j)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value==="on";this.toggleAttribute("checked",Z);let $={checked:Z,value:this.getAttribute("value")??""};this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-segmented-control, fig-menu"))return;let Q=this.#J?.value==="on"?"off":"on";this.#J?.querySelector(`fig-segment[value="${Q}"]`)?.click()}get checked(){return this.#J?this.#J.value==="on":Y(this,"checked")}set checked(J){let Q=Boolean(J);if(this.toggleAttribute("checked",Q),this.#J)this.#J.value=Q?"on":"off"}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){this.setAttribute("value",J??"")}get defaultValue(){return this.hasAttribute("default")?Y(this,"default"):this.#_}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,h(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",ZJ);function I(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 FJ(J){let{color:Q,alpha:Z}=I(J);return JSON.stringify({type:"solid",color:Q,alpha:Z})}function m(J){return`url("${String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}")`}function zJ(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 WJ(J){return{type:"video",video:{url:J,scaleMode:"fill",scale:50}}}function E(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:$}=I(Q);return{type:"solid",color:Z,alpha:$}}if(zJ(Q))return WJ(Q);return{type:"solid",color:"#D9D9D9",alpha:1}}function p(J){if(J==null)return"";return typeof J==="string"?J:JSON.stringify(J)}function HJ(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 l(J,Q){switch(J?.type){case"solid":return J.color||"";case"gradient":return J.css||HJ(J.gradient)||"";case"image":return J.image?.url?m(J.image.url):"";case"video":return J.video?.poster?m(J.video.poster):"";case"webcam":return J.webcam?.snapshot?m(J.webcam.snapshot):"";default:return J?.swatchBackground||J?.background||J?.css||Q?.getAttribute("swatch-background")||""}}function RJ(J){if(!J||typeof J!=="object")return null;if(J.type==="image")return J.image;if(J.type==="video")return J.video;if(J.type==="webcam")return J.webcam;return null}function VJ(J){let Q=RJ(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 fJ(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 $J extends HTMLElement{#Z=null;#Q=null;#J=null;#$=null;#X=!1;#Y=null;#q=new Set;#j=null;#B=null;#_=this.#W.bind(this);#O=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#k();if(this.#G(),this.#P(),this.#U(),this.#O===null)this.#O=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#_),this.addEventListener("click",this.#_),z(this),!this.#Y)this.#Y=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.#G();if(Z)this.#P()});this.#Y.observe(this,{attributes:!0})}disconnectedCallback(){this.#Y?.disconnect(),this.#K(),this.removeEventListener("click",this.#_),V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#G()}#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.#$=_,this.#X=Boolean(Q),this.replaceChildren(Z)}#G(){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.#X)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 I(this.getAttribute("value"))}#L(){let{color:J,alpha:Q}=this.#M();return JSON.stringify({type:"solid",color:J,alpha:Q})}#N(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","mode"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#P(){if(!this.#J)return;let J=this.#N(),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.#$)this.#$.setAttribute("background",$),this.#$.setAttribute("alpha",String(j));this.#q=Q}#U(){if(!this.#J)return;this.#j??=this.#z.bind(this,"input"),this.#B??=this.#z.bind(this,"change"),this.#J.addEventListener("input",this.#j),this.#J.addEventListener("change",this.#B)}#K(){if(!this.#J)return;if(this.#j)this.#J.removeEventListener("input",this.#j);if(this.#B)this.#J.removeEventListener("change",this.#B)}#T(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return I(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 I(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 I(Z).color;return this.#M().color}#S(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)}}#z(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#T(Q),$=this.#S(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.#$)this.#$.setAttribute("background",$.color),this.#$.setAttribute("alpha",String($.alpha));this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#W(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??this.#J?.value??this.#J?.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=String(J);this.setAttribute("value",Q),this.#F(Q)}#F(J){if(!this.#J)return;let Q=FJ(J);if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");if(this.#J.setAttribute("value",Q),this.#$){let Z=I(J);this.#$.setAttribute("background",Z.color),this.#$.setAttribute("alpha",String(Z.alpha))}}#R(){return this.getAttribute("default")??this.#O??""}get defaultValue(){return String(this.#R())}get isDefault(){return w(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",$J);class jJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=null;#X=!1;#Y=null;#q=new Set;#j=null;#B=null;#_=this.#H.bind(this);#O=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#k();if(this.#G(),this.#S(),this.#z(),this.#O===null)this.#O=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#_),this.addEventListener("click",this.#_),z(this),!this.#Y)this.#Y=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.#G();if(Z)this.#S()});this.#Y.observe(this,{attributes:!0})}disconnectedCallback(){this.#Y?.disconnect(),this.#W(),this.removeEventListener("click",this.#_),V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#G()}#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.#$=_,this.#X=Boolean(Q),this.replaceChildren(Z)}#G(){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.#X)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 E(this.getAttribute("value"))}#L(){return p(this.#M())}#N(){let J=this.#M()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#P(){let J=this.#J?.value;if(J&&typeof J==="object")return J;if(typeof J==="string"&&J)return E(J);return null}#U(J){let Q=this.#P();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.#$)return;let Q=this.#U(J),Z=l(Q,this.#N());if(!Z)Z=l(this.#P(),this.#N());if(!Z){let j=this.#$.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#$.setAttribute("background",Z),this.#$.setAttribute("alpha",String(fJ(Q)));let $=VJ(Q||J);if($)this.#$.style.setProperty("--swatch-bg-size",$.size),this.#$.style.setProperty("--swatch-bg-position",$.position)}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#S(){if(!this.#J)return;let J=this.#T(),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}#z(){if(!this.#J)return;this.#j??=this.#R.bind(this,"input"),this.#B??=this.#R.bind(this,"change"),this.#J.addEventListener("input",this.#j),this.#J.addEventListener("change",this.#B)}#W(){if(!this.#J)return;if(this.#j)this.#J.removeEventListener("input",this.#j);if(this.#B)this.#J.removeEventListener("change",this.#B)}#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 E(Q);let Z=this.#J?.value;if(Z&&typeof Z==="object")return Z;if(typeof Z==="string"&&Z)return E(Z);return this.#M()}#R(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#U(this.#F(Q)),$=p(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(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??p(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=p(typeof J==="string"?E(J):J);this.setAttribute("value",Q),this.#D(Q)}#D(J){if(!this.#J)return;let Q=p(E(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#K(E(Q))}#w(){return this.getAttribute("default")??this.#O??""}get defaultValue(){return String(this.#w())}get isDefault(){return v(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#D(J);let Q=E(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",jJ);class _J extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=null;#j=null;#B=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.#B),this.addEventListener("click",this.#B),z(this),!this.#X)this.#X=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.#X.observe(this,{attributes:!0})}disconnectedCallback(){this.#X?.disconnect(),this.#N(),this.removeEventListener("click",this.#B),V(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.#$=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.#$)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")}#G(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#M(){if(!this.#J)return;let J=this.#G(),Q=new Set(J);for(let Z of this.#Y)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.#Y=Q}#L(){if(!this.#J)return;this.#q??=this.#U.bind(this,"input"),this.#j??=this.#U.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#j)}#N(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#j)this.#J.removeEventListener("change",this.#j)}#P(J){let Q=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:this.#J?.value;if(!Q||typeof Q!=="object")return this.value;return JSON.stringify(Q)}#U(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#P(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(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-input-gradient, fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.querySelector?.("fig-fill-picker")?.open?.()}get value(){return this.getAttribute("value")??JSON.stringify(this.#J?.value??{})}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=typeof J==="object"?JSON.stringify(J):String(J);if(this.setAttribute("value",Q),this.#J&&this.#J.getAttribute("value")!==Q)this.#J.setAttribute("value",Q)}get defaultValue(){return this.getAttribute("default")??this.#_??""}get isDefault(){return v(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J;let Q=this.#J?.value;h(this,Q)}focus(J){this.#J?.focus(J)}}L("propskit-gradient",_J);class x extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=!1;#Y=null;#q=new Set;#j=null;#B=null;#_=null;#O=this.#f.bind(this);#k=this.#w.bind(this);#G=!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#N(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#P(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.#T(),this.#W(),this.#F(),this.removeEventListener("click",this.#O),this.addEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),this.addEventListener("pointerdown",this.#k,!0),z(this),!this.#Y)this.#Y=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="direction"||j==="aria-label")Q=!0;else Z=!0}if(Q)this.#T();if(Z)this.#W()});this.#Y.observe(this,{attributes:!0})}disconnectedCallback(){this.#Y?.disconnect(),this.#R(),this.removeEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#T();return}if(J==="options"||J==="value")this.#W()}#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.#$=x.#L();let j=document.createElement(this.#$?"fig-select":"fig-dropdown");if(j.setAttribute("full",""),this.#$&&Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#X=Boolean(J),this.replaceChildren(Z)}#T(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#X)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","")}#S(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default"]);if(!this.#$)J.add("options");return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#z(){if(!this.#J||this.#$)return;let J=x.#N(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=x.#P(Z),$.textContent=x.#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)}}#W(){if(!this.#J)return;if(!this.#$)this.#z();let J=this.#S().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.#j??=this.#H.bind(this,"input"),this.#B??=this.#H.bind(this,"change"),this.#J.addEventListener("input",this.#j),this.#J.addEventListener("change",this.#B),this.#$)this.#_??=this.#H.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#_)}#R(){if(!this.#J)return;if(this.#j)this.#J.removeEventListener("input",this.#j);if(this.#B)this.#J.removeEventListener("change",this.#B);if(this.#_)this.#J.removeEventListener("optionhover",this.#_)}#H(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#D(){if(!this.#J||!this.#$)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#w(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select, fig-dropdown")){this.#G=!1;return}if(!this.#$)return;this.#G=this.#D()}#f(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select, fig-dropdown")){this.#G=!1;return}if(!this.#J||Y(this.#J,"disabled")){this.#G=!1;return}if(this.#J.focus(),!this.#$)return;if(this.#G||this.#D()){this.#G=!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 w(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;h(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-select",x);class XJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=null;#j=null;#B=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.#B),this.addEventListener("click",this.#B),z(this),!this.#X)this.#X=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.#X.observe(this,{attributes:!0})}disconnectedCallback(){this.#X?.disconnect(),this.#N(),this.removeEventListener("click",this.#B),V(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.#$=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.#$)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")}#G(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","multiline","resizable","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#M(){if(!this.#J)return;let J=this.#G(),Q=new Set(J);for(let Z of this.#Y)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#Y=Q}#L(){if(!this.#J)return;this.#q??=this.#P.bind(this,"input"),this.#j??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#j)}#N(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#j)this.#J.removeEventListener("change",this.#j)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-text, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#_??""}get isDefault(){return w(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,h(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-text",XJ);class BJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=null;#j=null;#B=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.#B),this.addEventListener("click",this.#B),z(this),!this.#X)this.#X=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.#X.observe(this,{attributes:!0})}disconnectedCallback(){this.#X?.disconnect(),this.#N(),this.removeEventListener("click",this.#B),V(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.#$=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.#$)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")}#G(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#M(){if(!this.#J)return;let J=this.#G(),Q=new Set(J);for(let Z of this.#Y)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#Y=Q}#L(){if(!this.#J)return;this.#q??=this.#P.bind(this,"input"),this.#j??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#j)}#N(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#j)this.#J.removeEventListener("change",this.#j)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;if(this.#J?.value!==void 0)this.setAttribute("value",String(this.#J.value));this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#_??"0"}get isDefault(){return w(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,h(this,this.#J?.value??J)}focus(J){this.#J?.focus(J)}}L("propskit-number",BJ);class qJ extends HTMLElement{static observedAttributes=["x","y","default","label","units","disabled","size"];#Z=null;#Q=null;#J=null;#$=null;#X=!1;#Y=!1;#q=this.#z.bind(this,"input");#j=this.#z.bind(this,"change");#B=this.#W.bind(this);connectedCallback(){if(!this.#X)this.#$=this.#O(),this.#G(this.#$),this.#X=!0;if(!this.#Z)this.#L();this.#N(),this.#P(),this.#T(),this.removeEventListener("click",this.#B),this.addEventListener("click",this.#B),z(this)}disconnectedCallback(){this.#S(),this.removeEventListener("click",this.#B),V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if((J==="x"||J==="y")&&!this.#Y)this.#P();else if(J==="label")this.#N();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.#$?.x??50),y:this.#_(Q.y,this.#$?.y??50)}}catch{return null}}#G(J){let Q=this.#O(),Z={x:this.#_(J?.x,Q.x),y:this.#_(J?.y,Q.y)};return this.#Y=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#Y=!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($),Y(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),z(this)}#N(){let J=this.#Z?.querySelector(":scope > label");if(!J)return;let Q=this.getAttribute("label");J.textContent=Q?.trim()||"Position"}#P(){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=Y(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#J?.toggleAttribute("disabled",J)}#T(){this.#S(),this.#Q?.addEventListener("input",this.#q),this.#Q?.addEventListener("change",this.#j),this.#J?.addEventListener("input",this.#q),this.#J?.addEventListener("change",this.#j)}#S(){this.#Q?.removeEventListener("input",this.#q),this.#Q?.removeEventListener("change",this.#j),this.#J?.removeEventListener("input",this.#q),this.#J?.removeEventListener("change",this.#j)}#z(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#_(Q.currentTarget.value,$[Z]);let j=this.#G($);this.dispatchEvent(new CustomEvent(J,{detail:{...j,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#W(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#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.#G(J);this.#P(Q)}get defaultValue(){return this.#k(this.getAttribute("default"))||{...this.#$||{x:50,y:50}}}get isDefault(){return v(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,h(this,{...J,units:this.units})}focus(J){this.#Q?.focus(J)}}L("propskit-position",qJ);class OJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","disabled","value"];#Z=null;#Q=null;#J=null;#$=!1;#X=!1;#Y=!1;#q=this.#K.bind(this,"input");#j=this.#K.bind(this,"change");#B=this.#T.bind(this);connectedCallback(){if(!this.#$)this.#G(this.#k()),this.#$=!0;if(!this.#Z)this.#M();this.#L(),this.#N(),this.#P(),this.#U(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.addEventListener("change",this.#j),this.removeEventListener("openchange",this.#B),this.addEventListener("openchange",this.#B)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.removeEventListener("openchange",this.#B)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#X){let $=this.#G(this.#k());this.#U($)}return}if(J==="size"){this.#N();return}if(J==="disabled"){this.#P();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"))}#G(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#X=!0,this.setAttribute("value",Z),this.#X=!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.#N(),this.#P(),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")}#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)}}#P(){c(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(),Y(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-color-point-control");if(j==="color")$.color=Z.value||Z.getAttribute("value");else if(j==="position")$.x=this.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else return;let _=this.#G($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,units:"percent"},bubbles:!0,cancelable:!0,composed:!0}))}#T(J){if(J.target!==this.#Z||this.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get value(){return{...this.#k()}}set value(J){let Q=this.#G(J);this.#U(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-color-point",OJ);class YJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#$=!1;#X=!1;#Y=!1;#q=this.#W.bind(this,"input");#j=this.#W.bind(this,"change");#B=this.#F.bind(this);connectedCallback(){if(!this.#$)this.#M(this.#G()),this.#$=!0;if(!this.#Z)this.#N();this.#P(),this.#U(),this.#K(),this.#T(),this.#S(this.#G()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.addEventListener("change",this.#j),this.removeEventListener("openchange",this.#B),this.addEventListener("openchange",this.#B)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.removeEventListener("openchange",this.#B)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#X){let $=this.#M(this.#G());this.#S($)}return}if(J==="size"){this.#U();return}if(J==="units"){this.#K();return}if(J==="disabled"){this.#T();return}this.#P()}#_(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)}}#G(){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.#X=!0,this.setAttribute("value",Z),this.#X=!1,Q}#L(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#N(){let J=this.#G(),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.#P(),this.#U(),this.#T(),Z.append($,j),this.replaceChildren(Z)}#P(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#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")}#T(){c(this,[this.#Q,this.#J])}#S(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}}#z(J,Q){let Z=this.#L(Q).value,$=this.#_(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#W(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(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.#z(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.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#G()}}set value(J){let Q=this.#M(J);this.#S(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius",YJ);class GJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#$=null;#X=!1;#Y=!1;#q=!1;#j=this.#F.bind(this,"input");#B=this.#F.bind(this,"change");#_=this.#R.bind(this);connectedCallback(){if(!this.#X)this.#L(this.#M()),this.#X=!0;if(!this.#Z)this.#P();this.#U(),this.#K(),this.#T(),this.#S(),this.#z(this.#M()),this.removeEventListener("input",this.#j),this.addEventListener("input",this.#j),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#_),this.addEventListener("openchange",this.#_)}disconnectedCallback(){this.removeEventListener("input",this.#j),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#_)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if(J==="value"){if(!this.#Y){let $=this.#L(this.#M());this.#z($)}return}if(J==="size"){this.#K();return}if(J==="units"){this.#T();return}if(J==="disabled"){this.#S();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)}#G(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#O(Q.x,50),y:this.#O(Q.y,50),radius:this.#k(Q.radius),angle:this.#O(Q.angle,0)}}#M(){return this.#G(this.getAttribute("value"))}#L(J){let Q=this.#G(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#Y=!0,this.setAttribute("value",Z),this.#Y=!1,Q}#N(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#P(){let J=this.#M(),Q=this.#N(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number"),_=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-angle-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-angle-control","radius"),_.setAttribute("label","Angle"),_.setAttribute("value",String(J.angle)),_.setAttribute("units","°"),_.setAttribute("units-disallow",""),_.setAttribute("precision","1"),_.setAttribute("data-propskit-point-radius-angle-control","angle"),this.#Z=Z,this.#Q=$,this.#J=j,this.#$=_,this.#U(),this.#K(),this.#S(),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.#$]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#T(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#S(){c(this,[this.#Q,this.#J,this.#$])}#z(J){let Q=this.#G(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#N(Q.radius);this.#J.value=Z.value}if(this.#$)this.#$.value=Q.angle}#W(J,Q){let Z=this.#N(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(),Y(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.#W(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.#N(_.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.#z(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius-angle",GJ);class MJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#$=!1;#X=!1;#Y=!1;#q=this.#S.bind(this,"input");#j=this.#S.bind(this,"change");#B=this.#z.bind(this);connectedCallback(){if(!this.#$)this.#G(this.#k()),this.#$=!0;if(!this.#Z)this.#L();this.#N(),this.#P(),this.#U(),this.#K(),this.#T(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.addEventListener("change",this.#j),this.removeEventListener("openchange",this.#B),this.addEventListener("openchange",this.#B)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.removeEventListener("openchange",this.#B)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#X){let $=this.#G(this.#k());this.#T($)}return}if(J==="size"){this.#P();return}if(J==="units"){this.#U();return}if(J==="disabled"){this.#K();return}this.#N()}#_(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"))}#G(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#X=!0,this.setAttribute("value",Z),this.#X=!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.#N(),this.#P(),this.#K(),Q.append(Z,$),this.replaceChildren(Q)}#N(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#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)}}#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(){c(this,[this.#Q,this.#J])}#T(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}}#S(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let $=this.value,j=Z.value,_=Z.getAttribute("data-propskit-point-point-control");if(_==="start")$.x=this.#_(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.#G($);this.dispatchEvent(new CustomEvent(J,{detail:{...X,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#z(J){if(J.target!==this.#Z||this.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#k()}}set value(J){let Q=this.#G(J);this.#T(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-point",MJ);class g extends HTMLElement{static observedAttributes=["name","open","show-reset","disabled"];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-oscillator"].join(",");#Q=null;#J=null;#$=null;#X=null;#Y=0;#q=()=>this.#_();connectedCallback(){this.#F(),this.#N(),this.#j(),requestAnimationFrame(()=>{this.#K()})}disconnectedCallback(){if(this.#B(),this.#Y)cancelAnimationFrame(this.#Y),this.#Y=0;this.#Q?.removeEventListener("click",this.#k),this.#Q?.removeEventListener("keydown",this.#G),this.#$?.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.#K();return}if(J==="disabled"){this.#N();return}this.#F()}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.#S()}#j(){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.#X)this.#X=new MutationObserver(()=>{this.#N(),this.#_()});this.#X.disconnect(),this.#X.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#B(){this.removeEventListener("input",this.#q,!0),this.removeEventListener("change",this.#q,!0),this.#X?.disconnect()}#_(){if(this.#Y)return;this.#Y=requestAnimationFrame(()=>{this.#Y=0,this.#K()})}#O(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#k=(J)=>{if(Y(this,"disabled"))return;if(this.#O(J.target))return;J.stopPropagation(),this.open=!this.open};#G=(J)=>{if(Y(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(),Y(this,"disabled"))return;this.#S()};#L(){return[...this.querySelectorAll(g.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(g.#Z))}#N(){let J=Y(this,"disabled");for(let Q of this.#L())if(J){if(!Y(Q,"disabled"))Q.setAttribute("disabled",""),Q.setAttribute("data-propskit-group-disabled","")}else if(Q.hasAttribute("data-propskit-group-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-propskit-group-disabled");this.#Q?.setAttribute("aria-disabled",String(J)),this.#Q?.setAttribute("tabindex",J?"-1":"0"),this.#$?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#P(J){return J.isDefault===!1}#U(){for(let J of this.#L())if(this.#P(J))return!0;return!1}#K(){if(this.#U())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#z()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#S(){for(let J of this.#L())this.#T(J);this.#K(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#z(){if(!this.showReset){this.#$?.setAttribute("hidden","");return}this.#W(),this.#$?.removeAttribute("hidden")}#W(){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}#F(){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=TJ("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.#N(),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.#G),this.#Q.addEventListener("keydown",this.#G),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#Q.setAttribute("aria-expanded","false")}}L("propskit-group",g);class kJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=0;#j=0;#B=null;#_=null;#O=0;#k=null;#G=null;#M=!1;#L=0;#N=null;#P=0;#U=null;#K=null;#T=0;#S=0;#z=!1;#W=!1;#F=0;#R=null;#H=null;#D=this.#BJ.bind(this);#w=this.#JJ.bind(this);#f=this.#l.bind(this);#C=this.#KJ.bind(this);#h=this.#kJ.bind(this);#A=this.#XJ.bind(this);#p=this.#WJ.bind(this);#I=this.#SJ.bind(this);#E=this.#TJ.bind(this);#V=this.#e.bind(this);#d=new Set(["variant","color","text","full","elastic","size","name","class","data-wave-index","data-active","data-elastic-dragging","style"]);static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#m();if(this.#o(),this.#i(),this.#x(),this.#jJ(),this.removeEventListener("pointerdown",this.#D,{capture:!0}),this.addEventListener("pointerdown",this.#D,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.addEventListener("pointerdown",this.#C,{capture:!0}),this.removeEventListener("contextmenu",this.#I),this.addEventListener("contextmenu",this.#I),this.removeEventListener("click",this.#V,!0),this.addEventListener("click",this.#V,!0),this.#_?.removeEventListener("change",this.#E),this.#_?.addEventListener("change",this.#E),!this.#X)this.#X=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#g();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#d.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#o();if(Z)this.#i(),this.#jJ()});this.#X.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#X?.disconnect(),this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#j)cancelAnimationFrame(this.#j),this.#j=0;this.#PJ(),this.#v(),clearTimeout(this.#F),this.#F=0,this.#NJ(),this.#y(),this.#_J(),this.#s(),this.removeEventListener("pointerdown",this.#D,{capture:!0}),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.removeEventListener("contextmenu",this.#I),this.removeEventListener("click",this.#V,!0),this.#_?.removeEventListener("change",this.#E)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#o()}#m(){this.#G=this.getAttribute("value")??this.getAttribute("min")??"0";let J=Array.from(this.childNodes).filter((_)=>{return _.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-slider");j.setAttribute("text","true");for(let _ of this.#a()){let X=this.getAttribute(_);j.setAttribute(_,X??"")}Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#$=Boolean(Q),this.replaceChildren(Z),this.#b();for(let _ of J){if(_===Q)continue;this.#J.appendChild(_)}}#b(){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.#E),this.#_=J,this.appendChild(J)}#o(){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.#$)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")}#i(){if(!this.#J)return;let J=this.#a(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#Y)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"||Z==="stepper")this.#J.setAttribute("default",this.getAttribute("default")??"50");else if(!this.hasAttribute("default"))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.#ZJ(Z),this.#Y=Q,this.#g(),this.#$J()}#ZJ(J){let Q=this.#J?.querySelector("fig-input-number");if(!Q)return;if(J!=="opacity"||!this.hasAttribute("color")){Q.removeAttribute("theme");return}let Z=SJ(this.#J,this.getAttribute("color"));if(Z)Q.setAttribute("theme",Z);else Q.removeAttribute("theme")}#g(){if(!this.#J||!this.hasAttribute("value"))return;let J=this.getAttribute("value")??"";if(String(this.#J.value)!==J)this.#J.value=J}#a(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#d.has(Q))}#$J(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#GJ(),this.#n()})}#jJ(){if(this.#j)cancelAnimationFrame(this.#j);this.#j=requestAnimationFrame(()=>{this.#j=0,this.#n()})}#n(){let J=this.#J?.querySelector('input[type="range"]'),Q=this.#J?.querySelector("fig-input-number input");if(J!==this.#B)this.#zJ(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")}#e(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#W&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#W=!1;return}this.#r()}#r(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!Y(this,"disabled"))this.focus()})})}#zJ(J){if(this.#_J(),this.#B=J,!this.#B)return;this.#B.addEventListener("dblclick",this.#p,{capture:!0})}#_J(){if(!this.#B)return;this.#B.removeEventListener("dblclick",this.#p,{capture:!0}),this.#B=null}#WJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#OJ()}#KJ(J){if(J.button!==0||J.altKey||Y(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#v(),this.#K=J.pointerId,this.#T=J.clientX,this.#S=J.clientY,this.#z=!1,window.addEventListener("pointermove",this.#h),window.addEventListener("pointerup",this.#A,{once:!0}),window.addEventListener("pointercancel",this.#A,{once:!0}),window.addEventListener("blur",this.#A,{once:!0})}#kJ(J){if(J.pointerId!==this.#K)return;if(J.buttons===0){this.#XJ(J);return}if(!this.#z){if(Math.hypot(J.clientX-this.#T,J.clientY-this.#S)<4)return;this.#z=!0,this.setAttribute("data-number-scrubbing","")}this.#YJ(this.#t(J),"input")}#XJ(J){if(J?.pointerId!==void 0&&this.#K!==null&&J.pointerId!==this.#K)return;let Q=this.#z;if(this.#v(),Q){this.#YJ(this.#J?.value,"change"),this.#W=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#W=!1,this.#F=0},0),this.#r();return}this.#J?.querySelector("fig-input-number input")?.focus()}#v(){window.removeEventListener("pointermove",this.#h),window.removeEventListener("pointerup",this.#A),window.removeEventListener("pointercancel",this.#A),window.removeEventListener("blur",this.#A),this.#K=null,this.#z=!1,this.removeAttribute("data-number-scrubbing")}#BJ(J){if(J.button!==0||Y(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.#B;if(!Q)return;this.#NJ(),this.#y(),this.#B=Q,this.#M=!0,this.#U=J.pointerId,this.#L=this.#FJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#N={left:Z.left,right:Z.right,width:Z.width},this.#P=$.width,window.addEventListener("pointermove",this.#w,{passive:!0}),window.addEventListener("pointerup",this.#f,{once:!0}),window.addEventListener("pointercancel",this.#f,{once:!0}),window.addEventListener("blur",this.#f,{once:!0})}#JJ(J){if(!this.#M)return;if(J.pointerId!==this.#U)return;if(J.buttons===0){this.#l(J);return}this.#LJ(J.clientX)}#l(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.#NJ(),this.#y(),Q)this.#r()}#NJ(){window.removeEventListener("pointermove",this.#w),window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f),this.#M=!1,this.#U=null}#SJ(J){if(Y(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#PJ(),this.#HJ(J.clientX,J.clientY)}#HJ(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)}#TJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#OJ()}#PJ(){if(this.#O)clearTimeout(this.#O),this.#O=0;this.#k=null}#FJ(){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}#LJ(J){let Q=this.#N;if(!Q||!this.#L){this.#y();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#UJ();return}let $=Math.max(-this.#L,Math.min(this.#L,Z*0.5)),j=Math.abs($),_=this.#P?(this.#P+j)/this.#P: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")}#y(){this.#UJ(),this.#L=0,this.#N=null,this.#P=0,this.#U=null}#UJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#t(J){let Q=this.#B;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,O=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(O)))}#qJ(){return this.getAttribute("default")??this.#J?.getAttribute("default")??this.#G??this.#B?.min??"0"}#OJ(){this.#PJ(),this.#YJ(this.#qJ(),"input"),this.#YJ(this.#qJ(),"change")}#YJ(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}))}#GJ(){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??"")}#x(){if(!this.#J)return;if(!this.#R)this.#R=this.#u.bind(this,"input");if(!this.#H)this.#H=this.#u.bind(this,"change");this.#J.addEventListener("input",this.#R),this.#J.addEventListener("change",this.#H)}#s(){if(!this.#J)return;if(this.#R)this.#J.removeEventListener("input",this.#R);if(this.#H)this.#J.removeEventListener("change",this.#H)}#u(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;if(J==="change")this.#y();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.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#n();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.#qJ()}get isDefault(){return w(this.value,this.defaultValue)}resetToDefault(){this.#OJ()}}L("propskit-slider",kJ);class NJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping"];#Z=50;#Q=50;#J=75;#$=75;#X=0;#Y=!1;#q=0;#j=null;#B=null;#_=null;#O=null;#k=null;#G=null;#M=null;#L=null;#N=null;#P=!1;#U=!1;#K=!1;#T=!1;#S=null;#z="";#W="";#F=null;#R=null;#H=null;#D="";#w="";#f=null;#C=null;#h=null;get#A(){return this.getAttribute("type")||"point"}get#p(){return this.#A==="point-radius"||this.#A==="point-radius-angle"}get#I(){return this.#A==="point-radius-angle"}get#E(){return this.#A==="point-point"}get#V(){return this.#A==="point-radius-angle"||this.#A==="point-point"}get#d(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#m(){let J=this.getAttribute("snapping");if(J===null)return"false";let Q=J.trim().toLowerCase();if(Q==="modifier")return"modifier";if(Q===""||Q==="true")return"true";return"false"}#b(J){let Q=this.#m;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#o(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${Math.round(this.#Z)}%, ${Math.round(this.#Q)}%`}get#i(){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.#$)}%`}get#ZJ(){return this.getAttribute("drag-surface")||"parent"}get#g(){let J=this.#ZJ;if(J==="parent")return this.parentElement;return this.closest(J)}get#a(){let J=this.#ZJ;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#$J(J){if(this.#Y)return this.#X/100*J;return this.#X}#jJ(){if(this.#Y)return`Radius ${Math.round(this.#X)}%`;return`Radius ${Math.round(this.#X)}`}connectedCallback(){this.#n(),this.#e()}disconnectedCallback(){this.#VJ(),this.#AJ(),this.#_J(),this.#XJ(),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.#P&&!this.#U&&!this.#K&&!this.#T)if(this.#n(),this.#j)this.#x();else this.#e();if(J==="type")this.#VJ(),this.#n(),this.#e();if(J==="color"&&this.#j)if(Z)this.#j.setAttribute("color",Z);else this.#j.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#e();if(J==="tooltips")this.#e();if(J==="snapping"&&this.#j){if(this.#j.setAttribute("drag-snapping",Z||"false"),this.#B)this.#B.setAttribute("drag-snapping",Z||"false")}if(J==="name"){if(this.#G)this.#G.setAttribute("text",this.#o);if(this.#M)this.#M.setAttribute("text",this.#i)}}#n(){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.#Y=!0,this.#X=parseFloat(Z);else this.#Y=!1,this.#X=parseFloat(Z);if(!Number.isFinite(this.#X))this.#X=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.#$=Q.y2;if(this.#A==="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.#A==="color"){let Q=this.getAttribute("color")||this.#j?.getAttribute("color");if(Q)J.color=Q}if(this.#p)J.radius=this.#Y?`${this.#X}%`:this.#X;if(this.#I)J.angle=this.#q;if(this.#E)J.x2=this.#J,J.y2=this.#$;return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#e(){this.#VJ(),this.replaceChildren(),this.#j=null,this.#B=null,this.#_=null,this.#O=null,this.#k=null,this.#G=null,this.#M=null,this.#L=null,this.#N=null;let J=Y(this,"disabled"),Q=this.#A,Z=this.#d,$=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.#m),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.#E)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#j=j,this.#p)this.#SJ();if(this.#V)this.#HJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#o),_.appendChild(j),this.appendChild(_),this.#G=_}else this.appendChild(j);if(this.#I)this.#PJ(J,Z,$);if(this.#E)this.#FJ(J,Z,$);this.#r(this.#j),this.#r(this.#_),this.#r(this.#B),this.#fJ(),this.#JJ(),requestAnimationFrame(()=>this.#x())}#r(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#kJ(Q,J);else this.#zJ(Q)},{capture:!0})}#zJ(J){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#S===null)this.#z=document.body.style.getPropertyValue("cursor"),this.#W=document.body.style.getPropertyPriority("cursor");if(this.#S=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.#S!==null&&Q.pointerId!==this.#S)return;if(Q?.type==="blur")this.#_J();else requestAnimationFrame(()=>this.#_J())};window.addEventListener("pointerup",this.#F),window.addEventListener("pointercancel",this.#F),window.addEventListener("blur",this.#F)}#_J(){if(this.#S===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#z)document.body.style.setProperty("cursor",this.#z,this.#W);else document.body.style.removeProperty("cursor");if(this.#S=null,this.#z="",this.#W="",this.#F)window.removeEventListener("pointerup",this.#F),window.removeEventListener("pointercancel",this.#F),window.removeEventListener("blur",this.#F)}#WJ(J){if(!J)return 0;if(J===this.#_)return this.#q;if(!this.#E)return 0;let Q=this.#OJ();return J===this.#j?Q+180:Q}#KJ(){if(this.#R===null)return;let J=this.#y(this.#WJ(this.#H));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#kJ(J,Q){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#R===null)this.#D=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.#f)this.#f=(Z)=>{if(Z?.pointerId!==void 0&&this.#R!==null&&Z.pointerId!==this.#R)return;if(Z?.type==="blur")this.#XJ();else requestAnimationFrame(()=>this.#XJ())};window.addEventListener("pointerup",this.#f),window.addEventListener("pointercancel",this.#f),window.addEventListener("blur",this.#f)}#XJ(){if(this.#R===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#D)document.body.style.setProperty("cursor",this.#D,this.#w);else document.body.style.removeProperty("cursor");if(this.#R=null,this.#H=null,this.#D="",this.#w="",this.#f)window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f)}#v(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)}#BJ(){return this.#P||this.#U||this.#K||this.#T}#JJ(){if(this.#j)this.#v(this.#j,()=>this.#G,()=>this.#o,()=>this.#BJ()||!!this.#j?.querySelector("fig-color-tip"));if(this.#_)this.#v(this.#_,()=>this.#N,()=>`Angle ${Math.round(this.#q)}°`,()=>this.#BJ());if(this.#B)this.#v(this.#B,()=>this.#M,()=>this.#i,()=>this.#BJ());if(this.#O){let J=this.#O.querySelector(".fig-canvas-control-radius-hit");this.#NJ(J||this.#O)}if(this.#A==="color"&&this.#j&&this.#G)new MutationObserver(()=>{if(this.#j?.querySelector("fig-color-tip"))this.#G?.removeAttribute("show"),this.#G?.hidePopup?.()}).observe(this.#j,{childList:!0,subtree:!0})}#l(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?.()}#NJ(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.#l(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#K)return;this.#l(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#K)return;let Q=this.#L;if(!Q)return;Q.removeAttribute("show")})}#SJ(){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.#d){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.#c(Z)}#HJ(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");if(Q.classList.add("fig-canvas-control-angle-svg"),Q.setAttribute("overflow","visible"),Q.style.position="absolute",Q.style.pointerEvents="none",this.#E){let j=document.createElementNS("http://www.w3.org/2000/svg","line");j.classList.add("fig-canvas-control-angle-line-hit"),j.setAttribute("stroke","transparent"),j.setAttribute("stroke-width","12"),j.setAttribute("stroke-linecap","round"),j.style.pointerEvents="stroke",Q.appendChild(j),this.#TJ(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)}#TJ(J){J.addEventListener("pointerdown",(Q)=>{if(Y(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.#$;this.#P=!0,this.#U=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let O=(M)=>{let k=Z.getBoundingClientRect(),K=k.width>0?(M.clientX-$)/k.width*100:0,N=k.height>0?(M.clientY-j)/k.height*100:0,S=-Math.min(_,q),F=100-Math.max(_,q),W=-Math.min(X,B),H=100-Math.max(X,B),T=Math.max(S,Math.min(F,K)),R=Math.max(W,Math.min(H,N));this.#Z=_+T,this.#Q=X+R,this.#J=q+T,this.#$=B+R,this.#x(),this.#s()},G=this.#CJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#P=!1,this.#U=!1,M)this.#QJ(),this.#u()});window.addEventListener("pointermove",O,{signal:G.signal}),window.addEventListener("pointerup",()=>G.finish(!0),{signal:G.signal}),window.addEventListener("pointercancel",()=>G.finish(!1),{signal:G.signal})})}#PJ(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.#N=j}else this.appendChild($)}#FJ(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("drag-snapping",this.#m),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#$}%`),J)$.setAttribute("disabled","");if(this.#B=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#i),j.appendChild($),this.appendChild(j),this.#M=j}else this.appendChild($)}#LJ(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`}#y(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`}#UJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#t(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#UJ(Z,this.#y(Q)),this.#H===J)this.#KJ()}#qJ(){if(!this.#_||!this.#I)return;this.#t(this.#_,this.#q)}#OJ(){return Math.atan2(this.#$-this.#Q,this.#J-this.#Z)*180/Math.PI}#YJ(){if(!this.#E)return;let J=this.#OJ();this.#j?.style.removeProperty("cursor"),this.#B?.style.removeProperty("cursor"),this.#t(this.#j,J+180),this.#t(this.#B,J)}#GJ(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`}#x(){let J=this.#g;if(!J||!this.#j)return;let Q=J.getBoundingClientRect();if(this.#GJ(this.#j,this.#Z,this.#Q,Q),this.#O){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#$J(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.#V){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#E)j=this.#J/100*Q.width,_=this.#$/100*Q.height;else{let B=this.#$J(Q.width),O=this.#q*Math.PI/180;j=Z+B*Math.cos(O),_=$+B*Math.sin(O)}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.#I){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#$J(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,O=Q.height>0?q/Q.height*100:0;this.#GJ(this.#_,B,O,Q)}if(this.#B&&this.#E)this.#GJ(this.#B,this.#J,this.#$,Q);this.#qJ(),this.#YJ()}#s(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#u(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#MJ(J){return{...this.value,...KJ(J.color,J.alpha,J.opacity)}}#QJ(){this.setAttribute("value",JSON.stringify(this.value))}#fJ(){if(!this.#j)return;if(this.#j.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#j.getAttribute("color")||J.detail.color),this.#s(this.#MJ(J.detail));return}this.#P=!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.#G)this.#G.removeAttribute("show"),this.#G.hidePopup?.();this.#x(),this.#s()}),this.#j.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#j.getAttribute("color")||J.detail.color),this.#u(this.#MJ(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.#G)this.#G.removeAttribute("show");this.#x(),this.#QJ(),this.#u(),requestAnimationFrame(()=>{this.#P=!1})}),this.#_)this.#_.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#g;if(!Q)return;this.#T=!0,this.classList.add("fig-canvas-control-ring-active");let Z=Q.getBoundingClientRect(),$=this.#Z/100*Z.width,j=this.#Q/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#_.offsetWidth/2,B=this.#_.offsetHeight/2,O=_+q-$,G=X+B-j,M=Math.atan2(G,O)*180/Math.PI;if(this.#b(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#q=M;let k=Math.sqrt(O*O+G*G);if(this.#b(J.detail?.shiftKey)){let K=this.#Y?5:10;if(this.#Y){let N=k/Z.width*100;N=Math.round(N/K)*K,k=N/100*Z.width}else k=Math.round(k/K)*K}if(this.#Y)this.#X=Math.max(0,k/Z.width*100);else this.#X=Math.max(0,k);if(this.#N)this.#N.setAttribute("text",`Angle ${Math.round(this.#q)}°`),this.#N.setAttribute("show","true"),this.#N.showPopup?.();this.#x(),this.#s()}),this.#_.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#N)this.#N.removeAttribute("show");this.#x(),this.#QJ(),this.#u(),requestAnimationFrame(()=>{this.#T=!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.#T=!0,this.classList.add("fig-canvas-control-ring-active"),this.#_.setAttribute("selected",""),this.#N)this.#N.setAttribute("show","true"),this.#N.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),q=this.#Z/100*X.width,B=this.#Q/100*X.height,O=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,O)*180/Math.PI;if(this.#b(_.shiftKey))M=Math.round(M/15)*15;if(this.#q=M,this.#N)this.#N.setAttribute("text",`Angle ${Math.round(M)}°`);this.#x(),this.#s()},j=this.#CJ((_)=>{if(this.#T=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#_.removeAttribute("selected"),this.#N)this.#N.removeAttribute("show");if(_)this.#QJ(),this.#u()});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.#B)this.#B.addEventListener("input",(J)=>{J.stopPropagation(),this.#U=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#$/100;if(this.#J=Math.round(Math.max(0,Math.min(100,Q*100))),this.#$=Math.round(Math.max(0,Math.min(100,Z*100))),this.#M)this.#M.removeAttribute("show"),this.#M.hidePopup?.();this.#x(),this.#s()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#M)this.#M.removeAttribute("show");this.#x(),this.#QJ(),this.#u(),requestAnimationFrame(()=>{this.#U=!1})}),this.#RJ(this.#j,!0),this.#RJ(this.#B,!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.#P=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#$:this.#Q,B=Q?this.#Z:this.#J,O=Q?this.#Q:this.#$,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,K=O/100*_.height,N=Math.sqrt((k-G)**2+(K-M)**2),S=Q?this.#G:this.#M;if(S)S.removeAttribute("show"),S.hidePopup?.();let F=(H)=>{let T=j.getBoundingClientRect(),R=X/100*T.width,b=q/100*T.height,f=H.clientX-T.left-R,y=H.clientY-T.top-b,C=Math.atan2(y,f);if(this.#b(H.shiftKey))C=Math.round(C*180/Math.PI/15)*15*Math.PI/180;let LJ=R+N*Math.cos(C),UJ=b+N*Math.sin(C),s=Math.max(0,Math.min(100,LJ/T.width*100)),o=Math.max(0,Math.min(100,UJ/T.height*100));if(Q)this.#Z=s,this.#Q=o;else this.#J=s,this.#$=o;this.#x(),this.#s()},W=this.#CJ((H)=>{if(this.#P=!1,S)S.removeAttribute("show");if(H)this.#QJ(),this.#u()});window.addEventListener("pointermove",F,{signal:W.signal}),window.addEventListener("pointerup",()=>W.finish(!0),{signal:W.signal}),window.addEventListener("pointercancel",()=>W.finish(!1),{signal:W.signal})})}#c(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.#UJ(J,this.#LJ(q))});let Q=(Z)=>{if(Y(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.#l(Z.clientX,Z.clientY);if(this.#N)this.#N.removeAttribute("show"),this.#N.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(),O=this.#Z/100*B.width,G=this.#Q/100*B.height,M=Math.atan2(Z.clientY-B.top-G,Z.clientX-B.left-O)*180/Math.PI,k=Math.round(M);document.body.style.cursor=this.#LJ(k);let K=(S)=>{let F=$.getBoundingClientRect(),W=this.#Z/100*F.width,H=this.#Q/100*F.height,T=S.clientX-F.left-W,R=S.clientY-F.top-H,b=Math.round(Math.atan2(R,T)*180/Math.PI);if(b!==k)k=b,document.body.style.cursor=this.#LJ(b);let f=Math.sqrt(T*T+R*R);if(this.#b(S.shiftKey)){let y=this.#Y?5:10;if(this.#Y){let C=f/F.width*100;C=Math.round(C/y)*y,f=C/100*F.width}else f=Math.round(f/y)*y}if(this.#Y)this.#X=Math.max(0,f/F.width*100);else this.#X=Math.max(0,f);if(this.#L)this.#L.setAttribute("text",this.#jJ()),this.#l(S.clientX,S.clientY);this.#x(),this.#s()},N=this.#CJ((S)=>{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(S)this.#QJ(),this.#u()});window.addEventListener("pointermove",K,{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.#C===Q)this.#C=null,this.#h=null;J(j)};return this.#C=Q,this.#h=$,{signal:Q.signal,finish:$}}#VJ(){this.#h?.(!1),this.#C?.abort(),this.#C=null,this.#h=null}}L("fig-canvas-control",NJ);class U extends HTMLElement{#Z=[U.#H()];#Q=0;#J=2;#$=240;#X=120;#Y={min:-1,max:1};#q=null;#j=null;#B=null;#_=null;#O=0;#k=null;#G=null;#M=null;#L=null;#N=[];#P=[];#U=[];#K=[];#T=new Set;#S=null;#z=null;#W=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:[U.#H()]});this.#J=this.#D("precision",2),this.#A(this.getAttribute("value")),this.#h(),this.#a(),this.#KJ(),z(this)}disconnectedCallback(){if(this.#x(),this.#SJ(),this.#S)this.#S.disconnect(),this.#S=null;V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#A(Z),this.isConnected)this.#a();return}if(J==="precision"){if(this.#J=this.#D("precision",2),this.isConnected)this.#MJ();return}if(J==="aspect-ratio"){if(this.#h(),this.#j)this.#l();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.#p(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#E(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#c("input"),this.#c("change")}get data(){return{waves:this.#Z.map((J)=>this.#E(J))}}get preset(){let J=this.#V;return U.TYPES.find((Q)=>Q.value===J.type)?.name}#D(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#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}#f(){return this.getAttribute("edit")!=="false"}#C(){return this.#w("disabled",!1)}#h(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#A(J){let Q=this.#p(J);if(!Q)return!1;if(this.#Z=Q,!this.#Z.length)this.#Z=[U.#H()];return this.#Q=Math.min(this.#Q,this.#Z.length-1),!0}#p(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.#I($))}#I(J={}){return{type:this.#d(J.type),frequency:this.#m(J.frequency,1,0.1,16),amplitude:this.#m(J.amplitude,1,-4,4),phase:this.#m(J.phase,0,-360,360),offset:this.#m(J.offset,0,-4,4)}}#E(J){return{type:J.type,frequency:this.#b(J.frequency),amplitude:this.#b(J.amplitude),phase:this.#b(J.phase),offset:this.#b(J.offset)}}get#V(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||U.#H()}#d(J){let Q=String(J||"").toLowerCase();return U.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#m(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#b(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#o(J){return U.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#i(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=U.#g(J,q),O=5+q*j,G=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${O.toFixed(1)},${G.toFixed(1)}`}return _}static#ZJ(J,Q=24){return A("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},A("path",{d:U.#i(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=U.#i(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.#x(),this.#SJ(),this.replaceChildren(...this.#jJ()),this.#zJ(),this.#kJ(),this.#l(),this.#LJ(),!this.#C())this.#NJ();z(this)}#$J(J,Q){return A("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","aria-label":`Oscillator ${J} handle`}))))}#jJ(){let J=this.#f()&&!this.#C(),Q=[A("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#$,height:this.#X}),A("line",{className:"propskit-oscillator-baseline"}),A("path",{className:"propskit-oscillator-path"}),A("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#$J("amplitude","Amplitude"),this.#$J("frequency","Frequency"));let Z=A("svg",{viewBox:`0 0 ${this.#$} ${this.#X}`,className:"propskit-oscillator-svg"},Q),$=[P("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#f())$.push(P("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#n(j,_,!J))));return $}#n(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#Q,_=U.#o(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.#e(Z,Q)]),B=P("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#r(Q,"frequency","Frequency",0.1,16,0.1,""),this.#r(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#r(Q,"phase","Phase",-360,360,1,"°"),this.#r(Q,"offset","Offset",-4,4,0.1,"")]);return P("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#T.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#e(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"}))),$=U.TYPES.map((j)=>P("fig-menu-item",{value:j.value},[U.#ZJ(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,$])}#r(J,Q,Z,$,j,_,X){let q=this.#Z[J]||U.#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.#b(q[Q]),min:$,max:j,step:_,precision:this.#J,elastic:"false",type:B?"delta":null,default:B?"0":null,units:X||null,disabled:this.#C()})}#zJ(){this.#j=this.querySelector(".propskit-oscillator-svg"),this.#B=this.querySelector(".propskit-oscillator-path"),this.#_=this.querySelector(".propskit-oscillator-playhead"),this.#k=this.querySelector(".propskit-oscillator-baseline"),this.#G=this.querySelector(".propskit-oscillator-bounds"),this.#M=this.querySelector('[data-handle="amplitude"]'),this.#L=this.querySelector('[data-handle="frequency"]'),this.#P=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#N=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"))}#_J(J){let Q=new Set;for(let Z of this.#T)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#T=Q}#WJ(J){let Q=new Set;for(let Z of this.#T)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#T=Q}#KJ(){if(this.#S||!window.ResizeObserver)return;this.#S=new ResizeObserver(()=>{if(this.#kJ())this.#l()}),this.#S.observe(this)}#kJ(){if(!this.#j)return!1;let J=this.#j.getBoundingClientRect(),Q=Math.max(1,Math.round(J.width||240)),Z=Math.max(1,Math.round(J.height||120)),$=Q!==this.#$||Z!==this.#X;return this.#$=Q,this.#X=Z,this.#j.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#XJ(){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}}#v(J){let{min:Q,max:Z}=this.#Y;return this.#X-(J-Q)/(Z-Q)*this.#X}#BJ(J){let{min:Q,max:Z}=this.#Y;return Q+(1-J/this.#X)*(Z-Q)}#JJ(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=U.#g(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#l(){if(!this.#j||!this.#B)return;if(this.#kJ(),this.#Y=this.#XJ(),this.#G)this.#G.setAttribute("width",this.#$),this.#G.setAttribute("height",this.#X);let J=Math.max(...this.#Z.map((_)=>_.frequency)),Z=this.#Z.some((_)=>_.type==="square"||_.type==="sawtooth")?Math.max(192,Math.ceil(J*64)):Math.max(96,Math.ceil(J*64)),$="";for(let _=0;_<=Z;_++){let X=_/Z,q=X*this.#$,B=this.#v(this.#JJ(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#B.setAttribute("d",$);let j=this.#v(0);this.#k?.setAttribute("x1","0"),this.#k?.setAttribute("y1",j),this.#k?.setAttribute("x2",this.#$),this.#k?.setAttribute("y2",j),this.#TJ()}#NJ(){if(this.#O||!this.#_)return;let J=(Q)=>{if(!this.isConnected||!this.#_){this.#O=0;return}this.#HJ(Q%1000/1000),this.#O=requestAnimationFrame(J)};this.#O=requestAnimationFrame(J)}#SJ(){if(!this.#O)return;cancelAnimationFrame(this.#O),this.#O=0}#HJ(J){if(!this.#_)return;let Q=J*this.#$,Z=this.#v(this.#JJ(J));this.#_.setAttribute("cx",Q.toFixed(1)),this.#_.setAttribute("cy",Z.toFixed(1))}#TJ(){let Q=this.#V,Z=this.#PJ(),$=Math.max(8,Math.min(this.#$-8,this.#$/Q.frequency)),j=this.#v(this.#JJ(Z/this.#$)),_=this.#v(this.#JJ($/this.#$));this.#FJ(this.#M,Z,j,8),this.#FJ(this.#L,$,_,8)}#PJ(){let J=this.#V,Q=J.phase/360,Z=Math.max(0.1,J.frequency),$=0.25;if(J.type==="triangle")$=0.5;if(J.type==="sawtooth")$=1;let j=($-Q)/Z;while(j<0)j+=1/Z;while(j>1)j-=1/Z;if(j<0||j>1||!Number.isFinite(j))j=0.25;return Math.max(8,Math.min(this.#$-8,j*this.#$))}#FJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#LJ(){if(!this.#f()||this.#C())return;for(let Q of this.#P)Q.addEventListener("change",(Z)=>{if(this.#C())return;let $=this.#y(Q);this.#t($),this.#Z[$].type=this.#d(Z.detail??Z.target?.value),this.#MJ(),this.#c("input"),this.#c("change")});for(let Q of this.#N)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#z=Q;try{this.#qJ(this.#y(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#z=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#qJ(this.#y(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#K)Q.addEventListener("pointerdown",()=>{this.#t(this.#y(Q))}),Q.addEventListener("focusin",()=>{this.#t(this.#y(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#y(Q);if(Z.detail?.open)this.#T.add($);else this.#T.delete($)});for(let Q of this.querySelectorAll(".propskit-oscillator-add-type")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.addEventListener("change",($)=>{if($.target!==Q)return;if(this.#C())return;let _=this.#y(Q)+1,X=this.#d($.detail?.value??Q.value);this.#Z.splice(_,0,U.#H(X)),this.#WJ(_),this.#Q=_,this.#a(),this.#c("input"),this.#c("change")})}for(let Q of this.querySelectorAll(".propskit-oscillator-add-type-button")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.closest("fig-tooltip")?.addEventListener("pointerdown",Z),Q.closest("fig-tooltip")?.addEventListener("click",Z)}for(let Q of this.querySelectorAll(".propskit-oscillator-remove-button"))Q.addEventListener("pointerdown",(Z)=>{Z.stopPropagation()}),Q.addEventListener("click",(Z)=>{if(Z.stopPropagation(),this.#C()||this.#Z.length<=1)return;let $=this.#y(Q);this.#Z.splice($,1),this.#_J($),this.#Q=Math.min(this.#Q,this.#Z.length-1),this.#a(),this.#c("input"),this.#c("change")});for(let Q of[this.#M,this.#L])this.#UJ(Q);this.querySelector(".propskit-oscillator-svg-container")?.addEventListener("pointerdown",(Q)=>{if(this.#C())return;if(Q.target?.closest?.(".propskit-oscillator-handle, fig-handle"))return;this.#GJ(Q,"offset")})}#y(J){let Q=Number.parseInt(J?.getAttribute("data-wave-index")||"",10);return Number.isFinite(Q)?Math.min(this.#Z.length-1,Math.max(0,Q)):0}#UJ(J){let Q=J?.querySelector("fig-handle"),Z=J?.getAttribute("data-handle");if(!Q||!Z)return;Q.addEventListener("pointerdown",($)=>{if(this.#C())return;$.preventDefault(),$.stopImmediatePropagation(),this.#GJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#C())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#OJ($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#t(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#Q)return;this.#Q=Q,this.#RJ(),this.#TJ()}#qJ(J,Q,Z,$){if(this.#C())return;this.#t(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#fJ();return}this.#Z[J]=this.#I({...this.#Z[J],[Q]:j}),this.#MJ({skipFieldSync:$=="input"}),this.#c($)}#OJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#V;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.#I($),this.#MJ(),this.#c("input"),this.#c("change"),!0}#YJ(J){let Q=this.#j?.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}}#GJ(J,Q){this.#x(),this.#q=Q,this.#j?.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.#YJ(q),O=this.#V;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#$,B.x));O.frequency=this.#$/G}else if(Q==="offset"){let G=this.#m(B.x/this.#$,0,0,1),M=this.#u(O,G);O.offset=this.#BJ(B.y)-this.#s(this.#Q,G)-M*O.amplitude}else if(Q==="amplitude"){let G=this.#m(B.x/this.#$,0,0,1),M=this.#u(O,G),k=this.#BJ(B.y)-this.#s(this.#Q,G)-O.offset;O.amplitude=Math.abs(M)<0.001?O.amplitude:k/M}this.#Z[this.#Q]=this.#I(O),this.#MJ(),this.#c("input")},_=new AbortController,X=(q=!1)=>{if(this.#q=null,this.#j?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#W===_)this.#W=null,this.#F=null;if(q)this.#c("change")};this.#W=_,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})}#x(){this.#F?.(!1),this.#W?.abort(),this.#W=null,this.#F=null,this.#q=null,this.#j?.classList.remove("dragging")}#s(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=U.#g($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#u(J,Q){return U.#g(J.type,Q*J.frequency,J.phase)}#MJ({skipFieldSync:J=!1}={}){if(this.#QJ(),!J)this.#fJ();this.#RJ(),this.#l()}#QJ(){for(let J of this.#P){let Q=this.#y(J);J.value=this.#Z[Q]?.type||"sine"}}#fJ(){for(let J of this.#N){if(J===this.#z)continue;let Q=this.#y(J),Z=J.getAttribute("name"),$=this.#b(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.#y(J)===this.#Q)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#c(J){this.dispatchEvent(new CustomEvent(J,{bubbles:!0,detail:{value:this.value,data:this.data,preset:U.#o(this.#V.type)}}))}}L("propskit-oscillator",U);class PJ extends HTMLElement{#Z;#Q;#J=null;#$;#X;#Y;#q;#j;#B;#_;#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.#$=this.#w.bind(this),this.#X=this.#d.bind(this),this.#Y=this.#m.bind(this),this.#q=this.#i.bind(this),this.#j=this.#ZJ.bind(this),this.#B=this.#f.bind(this),this.#_=this.#o.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.#G(),this.#H(),this.#V(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#b(),this.#D()}#G(){this.#b(),this.#D();let J=this.#z(),Q=this.#P(),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}#N(){let J=Math.abs(this.#W(this.angle));return Math.floor(J/360)}#P(){return Y(this,"disabled")}#U(J){let Q=Number(J);if(!Number.isFinite(Q))return this.angle;if(this.min!==null&&Number.isFinite(this.min))Q=Math.max(this.min,Q);if(this.max!==null&&Number.isFinite(this.max))Q=Math.min(this.max,Q);return Q}#K(J,{reflect:Q=!0}={}){let Z=this.#U(J);if(this.angle=Z,this.#C(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#V(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#T(),this.#S()}#T(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#S(){if(!this.rotationSpan)return;let J=this.#N();if(J>1)this.rotationSpan.textContent=`×${J}`,this.rotationSpan.style.display="";else this.rotationSpan.textContent="",this.rotationSpan.style.display="none"}#z(){switch(this.units){case"rad":return 0.01;case"turn":return 0.001;default:return 0.1}}#W(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.#S(),this.plane?.addEventListener("mousedown",this.#X),this.plane?.addEventListener("touchstart",this.#Y),this.plane?.addEventListener("keydown",this.#_),window.addEventListener("keydown",this.#q),window.addEventListener("keyup",this.#j),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#B),this.angleInput.addEventListener("change",this.#B);this.addEventListener("change",this.#$,!0)}#D(){if(this.plane?.removeEventListener("mousedown",this.#X),this.plane?.removeEventListener("touchstart",this.#Y),this.plane?.removeEventListener("keydown",this.#_),window.removeEventListener("keydown",this.#q),window.removeEventListener("keyup",this.#j),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#B),this.angleInput.removeEventListener("change",this.#B);this.removeEventListener("change",this.#$,!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(_)}}}#f(J){if(J.stopPropagation(),this.#P())return;if(this.#K(Number(J.target.value)),J.type==="change")this.#E();else this.#I()}#C(){let Q=this.#W(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#Q=Math.sin(Q)}#h(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#A(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}#p(J){let Z=(this.#A(J)%360+360)%360;if(Z=this.#h(Z),this.min!==null||this.max!==null)this.angle=this.#U(this.#F(Z));else if(this.#J===null){this.#J=Z;let _=(this.#W(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.#C(),this.setAttribute("value",String(this.angle)),this.#V(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#S(),this.#T(),this.#I()}#I(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#E(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#V(){if(this.handle){let Q=this.#W(this.angle)*Math.PI/180,Z=this.plane.offsetWidth/2-this.handle.offsetWidth/2,$=Math.cos(Q)*Z,j=Math.sin(Q)*Z;this.handle.style.transform=`translate(${$}px, ${j}px)`}}#d(J){if(this.#P()||J.button!==0)return;this.#b(),this.isDragging=!0,this.#J=null,this.#p(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#p(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.#E()};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})}#m(J){if(this.#P())return;J.preventDefault(),this.#b(),this.isDragging=!0,this.#J=null,this.#p(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#p(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.#E()};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})}#b(){this.#k?.(!1),this.#O?.abort(),this.#O=null,this.#k=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#o(J){if(this.#P())return;let Q=this.#z()*(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.#I(),this.#E()}#i(J){if(J.key==="Shift")this.isShiftHeld=!0}#ZJ(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.#G(),this.#H(),this.#V()}break;case"dial":if(this.dial=this.#M("dial",!0),this.isConnected)this.#G(),this.#H(),this.#V();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#G(),this.#H(),this.#V();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#G(),this.#H(),this.#V();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#G(),this.#H(),this.#V();break;case"disabled":if(this.#b(),this.isConnected)this.#G(),this.#H(),this.#V();break;case"aria-label":case"name":if(this.isConnected)this.#G(),this.#H(),this.#V();break;case"rotations":case"show-rotations":if(this.showRotations=this.#L(),this.isConnected)this.#G(),this.#H(),this.#V();break}}}L("fig-input-angle",PJ);class D 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-joystick","fig-canvas-control","propskit-color-point","propskit-number","propskit-point-point","propskit-point-radius","propskit-point-radius-angle","propskit-position","propskit-slider","propskit-oscillator"];#J=null;#$=new Map;#X=null;#Y=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.#T(),this.#k(),this.#J=new MutationObserver(()=>this.#k()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#E(),this.#V(),this.#h(),this.#q?.remove(),this.#q=null}attributeChangedCallback(){if(this.isConnected){if(this.#j)this.#V();this.#k()}}get#j(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#B(){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.#$)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#K($),this.#$.delete(Z);if(this.#L(J),this.#G(J),this.#j||J.length<2){this.#E();return}for(let Z of J){let $=this.#P(Z),j=this.#$.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#$.delete(Z);if(!$)continue;this.#U(Z,$)}this.#N(J),this.#M(J)}#G(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")})}#N(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")}}#P(J){if(this.#_)return J.querySelector(this.#_);return J}#U(J,Q){let Z=(B)=>{if(this.#j||this.#O().length<2)return;if(B.button!==0)return;if(!this.#_&&this.#z(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.#j)return;let O=this.#B==="horizontal",G=O?"ArrowLeft":"ArrowUp",M=O?"ArrowRight":"ArrowDown";if(B.key!==G&&B.key!==M&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let k=this.#O(),K=k.indexOf(J),N=K;if(B.key===G)N=Math.max(0,K-1);else if(B.key===M)N=Math.min(k.length-1,K+1);else if(B.key==="Home")N=0;else if(B.key==="End")N=k.length-1;if(N===K){this.#S(`${X}, position ${K+1} of ${k.length}`);return}this.#p(J,N),this.#k(),this.#P(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:K,newIndex:N,item:J}})),this.#S(`${X}, position ${N+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#$.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#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)}#T(){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)}#S(J){if(!this.#q)return;this.#q.textContent="",requestAnimationFrame(()=>{if(this.#q)this.#q.textContent=J})}#z(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of D.#Q)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#W="fig-reorder-dragging";static#F(J){document.body.classList.toggle(D.#W,J)}#R(J,Q,Z){this.#V();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<D.#Z*D.#Z)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),D.#F(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#B==="horizontal"?j.clientX:j.clientY,B=this.#H(q);$.targetIndex=B,this.#C(B,Q)},$.onKeyDown=(j)=>{if(j.key!=="Escape"||!$.active)return;j.preventDefault(),this.#I($,!0)},$.onUp=(j)=>{if(j.pointerId!==$.pointerId)return;this.#I($,j.type==="pointercancel")},this.#X=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#H(J){let Q=this.#O(),Z=this.#B==="horizontal";for(let $=0;$<Q.length;$++){let j=Q[$].getBoundingClientRect(),_=Z?j.left+j.width/2:j.top+j.height/2;if(J<_)return $}return Q.length}#D(J,Q){let Z=this.#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-$}}#f(){if(this.#Y)return this.#Y;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#B),document.body.appendChild(J),this.#Y=J,J}#C(J,Q){let Z=this.#O();if(!this.#D(Q,J)){this.#h();return}let $=this.#w(Z);if(!$){this.#h();return}let j=this.#f();if(j.setAttribute("data-axis",this.#B),this.#B==="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"}#h(){this.#Y?.remove(),this.#Y=null}#A(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)}#p(J,Q){let $=this.#O().filter((j)=>j!==J)[Q]??null;if($)this.insertBefore(J,$);else this.appendChild(J)}#I(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.#A(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 O=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#S(`${O}, position ${B+1} of ${this.#O().length}`)}}}if(Z.classList.remove("dragging"),D.#F(!1),this.#h(),this.#X===J)this.#X=null}#E(){for(let[,J]of this.#$)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#K(J);this.#$.clear()}#V(){if(!this.#X)return;this.#I(this.#X,!0)}}L("fig-reorder",D);
|
|
3
|
+
`:",";return Q.split(Z).map(($)=>$.trim()).filter(Boolean)}static#P(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.#T(),this.#W(),this.#F(),this.removeEventListener("click",this.#O),this.addEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),this.addEventListener("pointerdown",this.#k,!0),z(this),!this.#Y)this.#Y=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="direction"||j==="aria-label")Q=!0;else Z=!0}if(Q)this.#T();if(Z)this.#W()});this.#Y.observe(this,{attributes:!0})}disconnectedCallback(){this.#Y?.disconnect(),this.#R(),this.removeEventListener("click",this.#O),this.removeEventListener("pointerdown",this.#k,!0),V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#T();return}if(J==="options"||J==="value")this.#W()}#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.#$=x.#L();let j=document.createElement(this.#$?"fig-select":"fig-dropdown");if(j.setAttribute("full",""),this.#$&&Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#X=Boolean(J),this.replaceChildren(Z)}#T(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#X)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","")}#S(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default"]);if(!this.#$)J.add("options");return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#z(){if(!this.#J||this.#$)return;let J=x.#N(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=x.#P(Z),$.textContent=x.#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)}}#W(){if(!this.#J)return;if(!this.#$)this.#z();let J=this.#S().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.#j??=this.#H.bind(this,"input"),this.#B??=this.#H.bind(this,"change"),this.#J.addEventListener("input",this.#j),this.#J.addEventListener("change",this.#B),this.#$)this.#_??=this.#H.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#_)}#R(){if(!this.#J)return;if(this.#j)this.#J.removeEventListener("input",this.#j);if(this.#B)this.#J.removeEventListener("change",this.#B);if(this.#_)this.#J.removeEventListener("optionhover",this.#_)}#H(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#D(){if(!this.#J||!this.#$)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#w(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select, fig-dropdown")){this.#G=!1;return}if(!this.#$)return;this.#G=this.#D()}#f(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select, fig-dropdown")){this.#G=!1;return}if(!this.#J||Y(this.#J,"disabled")){this.#G=!1;return}if(this.#J.focus(),!this.#$)return;if(this.#G||this.#D()){this.#G=!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 w(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;h(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-select",x);class XJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=null;#j=null;#B=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.#B),this.addEventListener("click",this.#B),z(this),!this.#X)this.#X=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.#X.observe(this,{attributes:!0})}disconnectedCallback(){this.#X?.disconnect(),this.#N(),this.removeEventListener("click",this.#B),V(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.#$=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.#$)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")}#G(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","multiline","resizable","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#M(){if(!this.#J)return;let J=this.#G(),Q=new Set(J);for(let Z of this.#Y)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#Y=Q}#L(){if(!this.#J)return;this.#q??=this.#P.bind(this,"input"),this.#j??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#j)}#N(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#j)this.#J.removeEventListener("change",this.#j)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-text, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#_??""}get isDefault(){return w(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,h(this,J)}focus(J){this.#J?.focus(J)}}L("propskit-text",XJ);class BJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=null;#j=null;#B=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.#B),this.addEventListener("click",this.#B),z(this),!this.#X)this.#X=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.#X.observe(this,{attributes:!0})}disconnectedCallback(){this.#X?.disconnect(),this.#N(),this.removeEventListener("click",this.#B),V(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.#$=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.#$)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")}#G(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#M(){if(!this.#J)return;let J=this.#G(),Q=new Set(J);for(let Z of this.#Y)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#Y=Q}#L(){if(!this.#J)return;this.#q??=this.#P.bind(this,"input"),this.#j??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#j)}#N(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#j)this.#J.removeEventListener("change",this.#j)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;if(this.#J?.value!==void 0)this.setAttribute("value",String(this.#J.value));this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#_??"0"}get isDefault(){return w(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,h(this,this.#J?.value??J)}focus(J){this.#J?.focus(J)}}L("propskit-number",BJ);class qJ extends HTMLElement{static observedAttributes=["x","y","default","label","units","disabled","size"];#Z=null;#Q=null;#J=null;#$=null;#X=!1;#Y=!1;#q=this.#z.bind(this,"input");#j=this.#z.bind(this,"change");#B=this.#W.bind(this);connectedCallback(){if(!this.#X)this.#$=this.#O(),this.#G(this.#$),this.#X=!0;if(!this.#Z)this.#L();this.#N(),this.#P(),this.#T(),this.removeEventListener("click",this.#B),this.addEventListener("click",this.#B),z(this)}disconnectedCallback(){this.#S(),this.removeEventListener("click",this.#B),V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if((J==="x"||J==="y")&&!this.#Y)this.#P();else if(J==="label")this.#N();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.#$?.x??50),y:this.#_(Q.y,this.#$?.y??50)}}catch{return null}}#G(J){let Q=this.#O(),Z={x:this.#_(J?.x,Q.x),y:this.#_(J?.y,Q.y)};return this.#Y=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#Y=!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($),Y(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),z(this)}#N(){let J=this.#Z?.querySelector(":scope > label");if(!J)return;let Q=this.getAttribute("label");J.textContent=Q?.trim()||"Position"}#P(){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=Y(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#J?.toggleAttribute("disabled",J)}#T(){this.#S(),this.#Q?.addEventListener("input",this.#q),this.#Q?.addEventListener("change",this.#j),this.#J?.addEventListener("input",this.#q),this.#J?.addEventListener("change",this.#j)}#S(){this.#Q?.removeEventListener("input",this.#q),this.#Q?.removeEventListener("change",this.#j),this.#J?.removeEventListener("input",this.#q),this.#J?.removeEventListener("change",this.#j)}#z(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#_(Q.currentTarget.value,$[Z]);let j=this.#G($);this.dispatchEvent(new CustomEvent(J,{detail:{...j,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#W(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#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.#G(J);this.#P(Q)}get defaultValue(){return this.#k(this.getAttribute("default"))||{...this.#$||{x:50,y:50}}}get isDefault(){return v(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,h(this,{...J,units:this.units})}focus(J){this.#Q?.focus(J)}}L("propskit-position",qJ);class OJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","disabled","value"];#Z=null;#Q=null;#J=null;#$=!1;#X=!1;#Y=!1;#q=this.#K.bind(this,"input");#j=this.#K.bind(this,"change");#B=this.#T.bind(this);connectedCallback(){if(!this.#$)this.#G(this.#k()),this.#$=!0;if(!this.#Z)this.#M();this.#L(),this.#N(),this.#P(),this.#U(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.addEventListener("change",this.#j),this.removeEventListener("openchange",this.#B),this.addEventListener("openchange",this.#B)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.removeEventListener("openchange",this.#B)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#X){let $=this.#G(this.#k());this.#U($)}return}if(J==="size"){this.#N();return}if(J==="disabled"){this.#P();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"))}#G(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#X=!0,this.setAttribute("value",Z),this.#X=!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.#N(),this.#P(),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")}#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)}}#P(){c(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(),Y(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-color-point-control");if(j==="color")$.color=Z.value||Z.getAttribute("value");else if(j==="position")$.x=this.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else return;let _=this.#G($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,units:"percent"},bubbles:!0,cancelable:!0,composed:!0}))}#T(J){if(J.target!==this.#Z||this.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get value(){return{...this.#k()}}set value(J){let Q=this.#G(J);this.#U(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-color-point",OJ);class YJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#$=!1;#X=!1;#Y=!1;#q=this.#W.bind(this,"input");#j=this.#W.bind(this,"change");#B=this.#F.bind(this);connectedCallback(){if(!this.#$)this.#M(this.#G()),this.#$=!0;if(!this.#Z)this.#N();this.#P(),this.#U(),this.#K(),this.#T(),this.#S(this.#G()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.addEventListener("change",this.#j),this.removeEventListener("openchange",this.#B),this.addEventListener("openchange",this.#B)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.removeEventListener("openchange",this.#B)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#X){let $=this.#M(this.#G());this.#S($)}return}if(J==="size"){this.#U();return}if(J==="units"){this.#K();return}if(J==="disabled"){this.#T();return}this.#P()}#_(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)}}#G(){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.#X=!0,this.setAttribute("value",Z),this.#X=!1,Q}#L(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#N(){let J=this.#G(),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.#P(),this.#U(),this.#T(),Z.append($,j),this.replaceChildren(Z)}#P(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#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")}#T(){c(this,[this.#Q,this.#J])}#S(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}}#z(J,Q){let Z=this.#L(Q).value,$=this.#_(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#W(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(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.#z(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.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#G()}}set value(J){let Q=this.#M(J);this.#S(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius",YJ);class GJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#$=null;#X=!1;#Y=!1;#q=!1;#j=this.#F.bind(this,"input");#B=this.#F.bind(this,"change");#_=this.#R.bind(this);connectedCallback(){if(!this.#X)this.#L(this.#M()),this.#X=!0;if(!this.#Z)this.#P();this.#U(),this.#K(),this.#T(),this.#S(),this.#z(this.#M()),this.removeEventListener("input",this.#j),this.addEventListener("input",this.#j),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#_),this.addEventListener("openchange",this.#_)}disconnectedCallback(){this.removeEventListener("input",this.#j),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#_)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if(J==="value"){if(!this.#Y){let $=this.#L(this.#M());this.#z($)}return}if(J==="size"){this.#K();return}if(J==="units"){this.#T();return}if(J==="disabled"){this.#S();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)}#G(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#O(Q.x,50),y:this.#O(Q.y,50),radius:this.#k(Q.radius),angle:this.#O(Q.angle,0)}}#M(){return this.#G(this.getAttribute("value"))}#L(J){let Q=this.#G(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#Y=!0,this.setAttribute("value",Z),this.#Y=!1,Q}#N(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#P(){let J=this.#M(),Q=this.#N(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number"),_=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-angle-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-angle-control","radius"),_.setAttribute("label","Angle"),_.setAttribute("value",String(J.angle)),_.setAttribute("units","°"),_.setAttribute("units-disallow",""),_.setAttribute("precision","1"),_.setAttribute("data-propskit-point-radius-angle-control","angle"),this.#Z=Z,this.#Q=$,this.#J=j,this.#$=_,this.#U(),this.#K(),this.#S(),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.#$]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#T(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#S(){c(this,[this.#Q,this.#J,this.#$])}#z(J){let Q=this.#G(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#N(Q.radius);this.#J.value=Z.value}if(this.#$)this.#$.value=Q.angle}#W(J,Q){let Z=this.#N(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(),Y(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.#W(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.#N(_.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.#z(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-radius-angle",GJ);class MJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#$=!1;#X=!1;#Y=!1;#q=this.#S.bind(this,"input");#j=this.#S.bind(this,"change");#B=this.#z.bind(this);connectedCallback(){if(!this.#$)this.#G(this.#k()),this.#$=!0;if(!this.#Z)this.#L();this.#N(),this.#P(),this.#U(),this.#K(),this.#T(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.addEventListener("change",this.#j),this.removeEventListener("openchange",this.#B),this.addEventListener("openchange",this.#B)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#j),this.removeEventListener("openchange",this.#B)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"){if(!this.#X){let $=this.#G(this.#k());this.#T($)}return}if(J==="size"){this.#P();return}if(J==="units"){this.#U();return}if(J==="disabled"){this.#K();return}this.#N()}#_(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"))}#G(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#X=!0,this.setAttribute("value",Z),this.#X=!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.#N(),this.#P(),this.#K(),Q.append(Z,$),this.replaceChildren(Q)}#N(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#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)}}#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(){c(this,[this.#Q,this.#J])}#T(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}}#S(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let $=this.value,j=Z.value,_=Z.getAttribute("data-propskit-point-point-control");if(_==="start")$.x=this.#_(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.#G($);this.dispatchEvent(new CustomEvent(J,{detail:{...X,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#z(J){if(J.target!==this.#Z||this.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#k()}}set value(J){let Q=this.#G(J);this.#T(Q)}focus(J){this.#Q?.focus(J)}}L("propskit-point-point",MJ);class g extends HTMLElement{static observedAttributes=["name","open","show-reset","disabled"];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-oscillator"].join(",");#Q=null;#J=null;#$=null;#X=null;#Y=0;#q=()=>this.#_();connectedCallback(){this.#F(),this.#N(),this.#j(),requestAnimationFrame(()=>{this.#K()})}disconnectedCallback(){if(this.#B(),this.#Y)cancelAnimationFrame(this.#Y),this.#Y=0;this.#Q?.removeEventListener("click",this.#k),this.#Q?.removeEventListener("keydown",this.#G),this.#$?.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.#K();return}if(J==="disabled"){this.#N();return}this.#F()}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.#S()}#j(){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.#X)this.#X=new MutationObserver(()=>{this.#N(),this.#_()});this.#X.disconnect(),this.#X.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#B(){this.removeEventListener("input",this.#q,!0),this.removeEventListener("change",this.#q,!0),this.#X?.disconnect()}#_(){if(this.#Y)return;this.#Y=requestAnimationFrame(()=>{this.#Y=0,this.#K()})}#O(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#k=(J)=>{if(Y(this,"disabled"))return;if(this.#O(J.target))return;J.stopPropagation(),this.open=!this.open};#G=(J)=>{if(Y(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(),Y(this,"disabled"))return;this.#S()};#L(){return[...this.querySelectorAll(g.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(g.#Z))}#N(){let J=Y(this,"disabled");for(let Q of this.#L())if(J){if(!Y(Q,"disabled"))Q.setAttribute("disabled",""),Q.setAttribute("data-propskit-group-disabled","")}else if(Q.hasAttribute("data-propskit-group-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-propskit-group-disabled");this.#Q?.setAttribute("aria-disabled",String(J)),this.#Q?.setAttribute("tabindex",J?"-1":"0"),this.#$?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#P(J){return J.isDefault===!1}#U(){for(let J of this.#L())if(this.#P(J))return!0;return!1}#K(){if(this.#U())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#z()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#S(){for(let J of this.#L())this.#T(J);this.#K(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#z(){if(!this.showReset){this.#$?.setAttribute("hidden","");return}this.#W(),this.#$?.removeAttribute("hidden")}#W(){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}#F(){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=TJ("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.#N(),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.#G),this.#Q.addEventListener("keydown",this.#G),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#Q.setAttribute("aria-expanded","false")}}L("propskit-group",g);class kJ extends HTMLElement{#Z=null;#Q=null;#J=null;#$=!1;#X=null;#Y=new Set;#q=0;#j=0;#B=null;#_=null;#O=0;#k=null;#G=null;#M=!1;#L=0;#N=null;#P=0;#U=null;#K=null;#T=0;#S=0;#z=!1;#W=!1;#F=0;#R=null;#H=null;#D=this.#BJ.bind(this);#w=this.#JJ.bind(this);#f=this.#l.bind(this);#C=this.#KJ.bind(this);#h=this.#kJ.bind(this);#A=this.#XJ.bind(this);#p=this.#WJ.bind(this);#I=this.#SJ.bind(this);#E=this.#TJ.bind(this);#V=this.#e.bind(this);#d=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.#m();if(this.#o(),this.#i(),this.#x(),this.#jJ(),this.removeEventListener("pointerdown",this.#D,{capture:!0}),this.addEventListener("pointerdown",this.#D,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.addEventListener("pointerdown",this.#C,{capture:!0}),this.removeEventListener("contextmenu",this.#I),this.addEventListener("contextmenu",this.#I),this.removeEventListener("click",this.#V,!0),this.addEventListener("click",this.#V,!0),this.#_?.removeEventListener("change",this.#E),this.#_?.addEventListener("change",this.#E),!this.#X)this.#X=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#g();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#d.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#o();if(Z)this.#i(),this.#jJ()});this.#X.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#X?.disconnect(),this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#j)cancelAnimationFrame(this.#j),this.#j=0;this.#PJ(),this.#v(),clearTimeout(this.#F),this.#F=0,this.#NJ(),this.#y(),this.#_J(),this.#s(),this.removeEventListener("pointerdown",this.#D,{capture:!0}),this.removeEventListener("pointerdown",this.#C,{capture:!0}),this.removeEventListener("contextmenu",this.#I),this.removeEventListener("click",this.#V,!0),this.#_?.removeEventListener("change",this.#E)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#o()}#m(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#G=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.#a()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#Z=$,this.#Q=j,this.#J=_,this.#$=Boolean(Z),this.replaceChildren($),this.#b();for(let X of Q){if(X===Z)continue;this.#J.appendChild(X)}}#b(){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.#E),this.#_=J,this.appendChild(J)}#o(){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.#$)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")}#i(){if(!this.#J)return;let J=this.#a(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#Y)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.#ZJ(Z),this.#Y=Q,this.#g(),this.#$J()}#ZJ(J){let Q=this.#J?.querySelector("fig-input-number");if(!Q)return;if(J!=="opacity"||!this.hasAttribute("color")){Q.removeAttribute("theme");return}let Z=SJ(this.#J,this.getAttribute("color"));if(Z)Q.setAttribute("theme",Z);else Q.removeAttribute("theme")}#g(){if(!this.#J)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#G??"";if(String(this.#J.value)!==J)this.#J.value=J}#a(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#d.has(Q))}#$J(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#GJ(),this.#n()})}#jJ(){if(this.#j)cancelAnimationFrame(this.#j);this.#j=requestAnimationFrame(()=>{this.#j=0,this.#n()})}#n(){let J=this.#J?.querySelector('input[type="range"]'),Q=this.#J?.querySelector("fig-input-number input");if(J!==this.#B)this.#zJ(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")}#e(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#W&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#W=!1;return}this.#r()}#r(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!Y(this,"disabled"))this.focus()})})}#zJ(J){if(this.#_J(),this.#B=J,!this.#B)return;this.#B.addEventListener("dblclick",this.#p,{capture:!0})}#_J(){if(!this.#B)return;this.#B.removeEventListener("dblclick",this.#p,{capture:!0}),this.#B=null}#WJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#OJ()}#KJ(J){if(J.button!==0||J.altKey||Y(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#v(),this.#K=J.pointerId,this.#T=J.clientX,this.#S=J.clientY,this.#z=!1,window.addEventListener("pointermove",this.#h),window.addEventListener("pointerup",this.#A,{once:!0}),window.addEventListener("pointercancel",this.#A,{once:!0}),window.addEventListener("blur",this.#A,{once:!0})}#kJ(J){if(J.pointerId!==this.#K)return;if(J.buttons===0){this.#XJ(J);return}if(!this.#z){if(Math.hypot(J.clientX-this.#T,J.clientY-this.#S)<4)return;this.#z=!0,this.setAttribute("data-number-scrubbing","")}this.#YJ(this.#t(J),"input")}#XJ(J){if(J?.pointerId!==void 0&&this.#K!==null&&J.pointerId!==this.#K)return;let Q=this.#z;if(this.#v(),Q){this.#YJ(this.#J?.value,"change"),this.#W=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#W=!1,this.#F=0},0),this.#r();return}this.#J?.querySelector("fig-input-number input")?.focus()}#v(){window.removeEventListener("pointermove",this.#h),window.removeEventListener("pointerup",this.#A),window.removeEventListener("pointercancel",this.#A),window.removeEventListener("blur",this.#A),this.#K=null,this.#z=!1,this.removeAttribute("data-number-scrubbing")}#BJ(J){if(J.button!==0||Y(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.#B;if(!Q)return;this.#NJ(),this.#y(),this.#B=Q,this.#M=!0,this.#U=J.pointerId,this.#L=this.#FJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#N={left:Z.left,right:Z.right,width:Z.width},this.#P=$.width,window.addEventListener("pointermove",this.#w,{passive:!0}),window.addEventListener("pointerup",this.#f,{once:!0}),window.addEventListener("pointercancel",this.#f,{once:!0}),window.addEventListener("blur",this.#f,{once:!0})}#JJ(J){if(!this.#M)return;if(J.pointerId!==this.#U)return;if(J.buttons===0){this.#l(J);return}this.#LJ(J.clientX)}#l(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.#NJ(),this.#y(),Q)this.#r()}#NJ(){window.removeEventListener("pointermove",this.#w),window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f),this.#M=!1,this.#U=null}#SJ(J){if(Y(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#PJ(),this.#HJ(J.clientX,J.clientY)}#HJ(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)}#TJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#OJ()}#PJ(){if(this.#O)clearTimeout(this.#O),this.#O=0;this.#k=null}#FJ(){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}#LJ(J){let Q=this.#N;if(!Q||!this.#L){this.#y();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#UJ();return}let $=Math.max(-this.#L,Math.min(this.#L,Z*0.5)),j=Math.abs($),_=this.#P?(this.#P+j)/this.#P: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")}#y(){this.#UJ(),this.#L=0,this.#N=null,this.#P=0,this.#U=null}#UJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#t(J){let Q=this.#B;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,O=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(O)))}#qJ(){return this.getAttribute("default")??this.#G??this.#B?.min??"0"}#OJ(){this.#PJ(),this.#YJ(this.#qJ(),"input"),this.#YJ(this.#qJ(),"change")}#YJ(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}))}#GJ(){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??"")}#x(){if(!this.#J)return;if(!this.#R)this.#R=this.#u.bind(this,"input");if(!this.#H)this.#H=this.#u.bind(this,"change");this.#J.addEventListener("input",this.#R),this.#J.addEventListener("change",this.#H)}#s(){if(!this.#J)return;if(this.#R)this.#J.removeEventListener("input",this.#R);if(this.#H)this.#J.removeEventListener("change",this.#H)}#u(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;if(J==="change")this.#y();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.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#n();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.#qJ()}get isDefault(){return w(this.value,this.defaultValue)}resetToDefault(){this.#OJ()}}L("propskit-slider",kJ);class NJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping"];#Z=50;#Q=50;#J=75;#$=75;#X=0;#Y=!1;#q=0;#j=null;#B=null;#_=null;#O=null;#k=null;#G=null;#M=null;#L=null;#N=null;#P=!1;#U=!1;#K=!1;#T=!1;#S=null;#z="";#W="";#F=null;#R=null;#H=null;#D="";#w="";#f=null;#C=null;#h=null;get#A(){return this.getAttribute("type")||"point"}get#p(){return this.#A==="point-radius"||this.#A==="point-radius-angle"}get#I(){return this.#A==="point-radius-angle"}get#E(){return this.#A==="point-point"}get#V(){return this.#A==="point-radius-angle"||this.#A==="point-point"}get#d(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#m(){let J=this.getAttribute("snapping");if(J===null)return"false";let Q=J.trim().toLowerCase();if(Q==="modifier")return"modifier";if(Q===""||Q==="true")return"true";return"false"}#b(J){let Q=this.#m;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#o(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${Math.round(this.#Z)}%, ${Math.round(this.#Q)}%`}get#i(){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.#$)}%`}get#ZJ(){return this.getAttribute("drag-surface")||"parent"}get#g(){let J=this.#ZJ;if(J==="parent")return this.parentElement;return this.closest(J)}get#a(){let J=this.#ZJ;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#$J(J){if(this.#Y)return this.#X/100*J;return this.#X}#jJ(){if(this.#Y)return`Radius ${Math.round(this.#X)}%`;return`Radius ${Math.round(this.#X)}`}connectedCallback(){this.#n(),this.#e()}disconnectedCallback(){this.#VJ(),this.#AJ(),this.#_J(),this.#XJ(),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.#P&&!this.#U&&!this.#K&&!this.#T)if(this.#n(),this.#j)this.#x();else this.#e();if(J==="type")this.#VJ(),this.#n(),this.#e();if(J==="color"&&this.#j)if(Z)this.#j.setAttribute("color",Z);else this.#j.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#e();if(J==="tooltips")this.#e();if(J==="snapping"&&this.#j){if(this.#j.setAttribute("drag-snapping",Z||"false"),this.#B)this.#B.setAttribute("drag-snapping",Z||"false")}if(J==="name"){if(this.#G)this.#G.setAttribute("text",this.#o);if(this.#M)this.#M.setAttribute("text",this.#i)}}#n(){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.#Y=!0,this.#X=parseFloat(Z);else this.#Y=!1,this.#X=parseFloat(Z);if(!Number.isFinite(this.#X))this.#X=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.#$=Q.y2;if(this.#A==="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.#A==="color"){let Q=this.getAttribute("color")||this.#j?.getAttribute("color");if(Q)J.color=Q}if(this.#p)J.radius=this.#Y?`${this.#X}%`:this.#X;if(this.#I)J.angle=this.#q;if(this.#E)J.x2=this.#J,J.y2=this.#$;return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#e(){this.#VJ(),this.replaceChildren(),this.#j=null,this.#B=null,this.#_=null,this.#O=null,this.#k=null,this.#G=null,this.#M=null,this.#L=null,this.#N=null;let J=Y(this,"disabled"),Q=this.#A,Z=this.#d,$=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.#m),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.#E)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#j=j,this.#p)this.#SJ();if(this.#V)this.#HJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#o),_.appendChild(j),this.appendChild(_),this.#G=_}else this.appendChild(j);if(this.#I)this.#PJ(J,Z,$);if(this.#E)this.#FJ(J,Z,$);this.#r(this.#j),this.#r(this.#_),this.#r(this.#B),this.#fJ(),this.#JJ(),requestAnimationFrame(()=>this.#x())}#r(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#kJ(Q,J);else this.#zJ(Q)},{capture:!0})}#zJ(J){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#S===null)this.#z=document.body.style.getPropertyValue("cursor"),this.#W=document.body.style.getPropertyPriority("cursor");if(this.#S=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.#S!==null&&Q.pointerId!==this.#S)return;if(Q?.type==="blur")this.#_J();else requestAnimationFrame(()=>this.#_J())};window.addEventListener("pointerup",this.#F),window.addEventListener("pointercancel",this.#F),window.addEventListener("blur",this.#F)}#_J(){if(this.#S===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#z)document.body.style.setProperty("cursor",this.#z,this.#W);else document.body.style.removeProperty("cursor");if(this.#S=null,this.#z="",this.#W="",this.#F)window.removeEventListener("pointerup",this.#F),window.removeEventListener("pointercancel",this.#F),window.removeEventListener("blur",this.#F)}#WJ(J){if(!J)return 0;if(J===this.#_)return this.#q;if(!this.#E)return 0;let Q=this.#OJ();return J===this.#j?Q+180:Q}#KJ(){if(this.#R===null)return;let J=this.#y(this.#WJ(this.#H));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#kJ(J,Q){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#R===null)this.#D=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.#f)this.#f=(Z)=>{if(Z?.pointerId!==void 0&&this.#R!==null&&Z.pointerId!==this.#R)return;if(Z?.type==="blur")this.#XJ();else requestAnimationFrame(()=>this.#XJ())};window.addEventListener("pointerup",this.#f),window.addEventListener("pointercancel",this.#f),window.addEventListener("blur",this.#f)}#XJ(){if(this.#R===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#D)document.body.style.setProperty("cursor",this.#D,this.#w);else document.body.style.removeProperty("cursor");if(this.#R=null,this.#H=null,this.#D="",this.#w="",this.#f)window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f)}#v(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)}#BJ(){return this.#P||this.#U||this.#K||this.#T}#JJ(){if(this.#j)this.#v(this.#j,()=>this.#G,()=>this.#o,()=>this.#BJ()||!!this.#j?.querySelector("fig-color-tip"));if(this.#_)this.#v(this.#_,()=>this.#N,()=>`Angle ${Math.round(this.#q)}°`,()=>this.#BJ());if(this.#B)this.#v(this.#B,()=>this.#M,()=>this.#i,()=>this.#BJ());if(this.#O){let J=this.#O.querySelector(".fig-canvas-control-radius-hit");this.#NJ(J||this.#O)}if(this.#A==="color"&&this.#j&&this.#G)new MutationObserver(()=>{if(this.#j?.querySelector("fig-color-tip"))this.#G?.removeAttribute("show"),this.#G?.hidePopup?.()}).observe(this.#j,{childList:!0,subtree:!0})}#l(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?.()}#NJ(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.#l(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#K)return;this.#l(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#K)return;let Q=this.#L;if(!Q)return;Q.removeAttribute("show")})}#SJ(){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.#d){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.#c(Z)}#HJ(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");if(Q.classList.add("fig-canvas-control-angle-svg"),Q.setAttribute("overflow","visible"),Q.style.position="absolute",Q.style.pointerEvents="none",this.#E){let j=document.createElementNS("http://www.w3.org/2000/svg","line");j.classList.add("fig-canvas-control-angle-line-hit"),j.setAttribute("stroke","transparent"),j.setAttribute("stroke-width","12"),j.setAttribute("stroke-linecap","round"),j.style.pointerEvents="stroke",Q.appendChild(j),this.#TJ(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)}#TJ(J){J.addEventListener("pointerdown",(Q)=>{if(Y(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.#$;this.#P=!0,this.#U=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let O=(M)=>{let k=Z.getBoundingClientRect(),K=k.width>0?(M.clientX-$)/k.width*100:0,N=k.height>0?(M.clientY-j)/k.height*100:0,S=-Math.min(_,q),F=100-Math.max(_,q),W=-Math.min(X,B),H=100-Math.max(X,B),T=Math.max(S,Math.min(F,K)),R=Math.max(W,Math.min(H,N));this.#Z=_+T,this.#Q=X+R,this.#J=q+T,this.#$=B+R,this.#x(),this.#s()},G=this.#CJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#P=!1,this.#U=!1,M)this.#QJ(),this.#u()});window.addEventListener("pointermove",O,{signal:G.signal}),window.addEventListener("pointerup",()=>G.finish(!0),{signal:G.signal}),window.addEventListener("pointercancel",()=>G.finish(!1),{signal:G.signal})})}#PJ(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.#N=j}else this.appendChild($)}#FJ(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("drag-snapping",this.#m),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#$}%`),J)$.setAttribute("disabled","");if(this.#B=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#i),j.appendChild($),this.appendChild(j),this.#M=j}else this.appendChild($)}#LJ(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`}#y(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`}#UJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#t(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#UJ(Z,this.#y(Q)),this.#H===J)this.#KJ()}#qJ(){if(!this.#_||!this.#I)return;this.#t(this.#_,this.#q)}#OJ(){return Math.atan2(this.#$-this.#Q,this.#J-this.#Z)*180/Math.PI}#YJ(){if(!this.#E)return;let J=this.#OJ();this.#j?.style.removeProperty("cursor"),this.#B?.style.removeProperty("cursor"),this.#t(this.#j,J+180),this.#t(this.#B,J)}#GJ(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`}#x(){let J=this.#g;if(!J||!this.#j)return;let Q=J.getBoundingClientRect();if(this.#GJ(this.#j,this.#Z,this.#Q,Q),this.#O){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#$J(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.#V){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#E)j=this.#J/100*Q.width,_=this.#$/100*Q.height;else{let B=this.#$J(Q.width),O=this.#q*Math.PI/180;j=Z+B*Math.cos(O),_=$+B*Math.sin(O)}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.#I){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#$J(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,O=Q.height>0?q/Q.height*100:0;this.#GJ(this.#_,B,O,Q)}if(this.#B&&this.#E)this.#GJ(this.#B,this.#J,this.#$,Q);this.#qJ(),this.#YJ()}#s(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#u(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#MJ(J){return{...this.value,...KJ(J.color,J.alpha,J.opacity)}}#QJ(){this.setAttribute("value",JSON.stringify(this.value))}#fJ(){if(!this.#j)return;if(this.#j.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#j.getAttribute("color")||J.detail.color),this.#s(this.#MJ(J.detail));return}this.#P=!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.#G)this.#G.removeAttribute("show"),this.#G.hidePopup?.();this.#x(),this.#s()}),this.#j.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#j.getAttribute("color")||J.detail.color),this.#u(this.#MJ(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.#G)this.#G.removeAttribute("show");this.#x(),this.#QJ(),this.#u(),requestAnimationFrame(()=>{this.#P=!1})}),this.#_)this.#_.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#g;if(!Q)return;this.#T=!0,this.classList.add("fig-canvas-control-ring-active");let Z=Q.getBoundingClientRect(),$=this.#Z/100*Z.width,j=this.#Q/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#_.offsetWidth/2,B=this.#_.offsetHeight/2,O=_+q-$,G=X+B-j,M=Math.atan2(G,O)*180/Math.PI;if(this.#b(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#q=M;let k=Math.sqrt(O*O+G*G);if(this.#b(J.detail?.shiftKey)){let K=this.#Y?5:10;if(this.#Y){let N=k/Z.width*100;N=Math.round(N/K)*K,k=N/100*Z.width}else k=Math.round(k/K)*K}if(this.#Y)this.#X=Math.max(0,k/Z.width*100);else this.#X=Math.max(0,k);if(this.#N)this.#N.setAttribute("text",`Angle ${Math.round(this.#q)}°`),this.#N.setAttribute("show","true"),this.#N.showPopup?.();this.#x(),this.#s()}),this.#_.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#N)this.#N.removeAttribute("show");this.#x(),this.#QJ(),this.#u(),requestAnimationFrame(()=>{this.#T=!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.#T=!0,this.classList.add("fig-canvas-control-ring-active"),this.#_.setAttribute("selected",""),this.#N)this.#N.setAttribute("show","true"),this.#N.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),q=this.#Z/100*X.width,B=this.#Q/100*X.height,O=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,O)*180/Math.PI;if(this.#b(_.shiftKey))M=Math.round(M/15)*15;if(this.#q=M,this.#N)this.#N.setAttribute("text",`Angle ${Math.round(M)}°`);this.#x(),this.#s()},j=this.#CJ((_)=>{if(this.#T=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#_.removeAttribute("selected"),this.#N)this.#N.removeAttribute("show");if(_)this.#QJ(),this.#u()});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.#B)this.#B.addEventListener("input",(J)=>{J.stopPropagation(),this.#U=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#$/100;if(this.#J=Math.round(Math.max(0,Math.min(100,Q*100))),this.#$=Math.round(Math.max(0,Math.min(100,Z*100))),this.#M)this.#M.removeAttribute("show"),this.#M.hidePopup?.();this.#x(),this.#s()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#M)this.#M.removeAttribute("show");this.#x(),this.#QJ(),this.#u(),requestAnimationFrame(()=>{this.#U=!1})}),this.#RJ(this.#j,!0),this.#RJ(this.#B,!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.#P=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#$:this.#Q,B=Q?this.#Z:this.#J,O=Q?this.#Q:this.#$,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,K=O/100*_.height,N=Math.sqrt((k-G)**2+(K-M)**2),S=Q?this.#G:this.#M;if(S)S.removeAttribute("show"),S.hidePopup?.();let F=(H)=>{let T=j.getBoundingClientRect(),R=X/100*T.width,b=q/100*T.height,f=H.clientX-T.left-R,y=H.clientY-T.top-b,C=Math.atan2(y,f);if(this.#b(H.shiftKey))C=Math.round(C*180/Math.PI/15)*15*Math.PI/180;let LJ=R+N*Math.cos(C),UJ=b+N*Math.sin(C),s=Math.max(0,Math.min(100,LJ/T.width*100)),o=Math.max(0,Math.min(100,UJ/T.height*100));if(Q)this.#Z=s,this.#Q=o;else this.#J=s,this.#$=o;this.#x(),this.#s()},W=this.#CJ((H)=>{if(this.#P=!1,S)S.removeAttribute("show");if(H)this.#QJ(),this.#u()});window.addEventListener("pointermove",F,{signal:W.signal}),window.addEventListener("pointerup",()=>W.finish(!0),{signal:W.signal}),window.addEventListener("pointercancel",()=>W.finish(!1),{signal:W.signal})})}#c(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.#UJ(J,this.#LJ(q))});let Q=(Z)=>{if(Y(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.#l(Z.clientX,Z.clientY);if(this.#N)this.#N.removeAttribute("show"),this.#N.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(),O=this.#Z/100*B.width,G=this.#Q/100*B.height,M=Math.atan2(Z.clientY-B.top-G,Z.clientX-B.left-O)*180/Math.PI,k=Math.round(M);document.body.style.cursor=this.#LJ(k);let K=(S)=>{let F=$.getBoundingClientRect(),W=this.#Z/100*F.width,H=this.#Q/100*F.height,T=S.clientX-F.left-W,R=S.clientY-F.top-H,b=Math.round(Math.atan2(R,T)*180/Math.PI);if(b!==k)k=b,document.body.style.cursor=this.#LJ(b);let f=Math.sqrt(T*T+R*R);if(this.#b(S.shiftKey)){let y=this.#Y?5:10;if(this.#Y){let C=f/F.width*100;C=Math.round(C/y)*y,f=C/100*F.width}else f=Math.round(f/y)*y}if(this.#Y)this.#X=Math.max(0,f/F.width*100);else this.#X=Math.max(0,f);if(this.#L)this.#L.setAttribute("text",this.#jJ()),this.#l(S.clientX,S.clientY);this.#x(),this.#s()},N=this.#CJ((S)=>{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(S)this.#QJ(),this.#u()});window.addEventListener("pointermove",K,{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.#C===Q)this.#C=null,this.#h=null;J(j)};return this.#C=Q,this.#h=$,{signal:Q.signal,finish:$}}#VJ(){this.#h?.(!1),this.#C?.abort(),this.#C=null,this.#h=null}}L("fig-canvas-control",NJ);class U extends HTMLElement{#Z=[U.#H()];#Q=0;#J=2;#$=240;#X=120;#Y={min:-1,max:1};#q=null;#j=null;#B=null;#_=null;#O=0;#k=null;#G=null;#M=null;#L=null;#N=[];#P=[];#U=[];#K=[];#T=new Set;#S=null;#z=null;#W=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:[U.#H()]});this.#J=this.#D("precision",2),this.#A(this.getAttribute("value")),this.#h(),this.#a(),this.#KJ(),z(this)}disconnectedCallback(){if(this.#x(),this.#SJ(),this.#S)this.#S.disconnect(),this.#S=null;V(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#A(Z),this.isConnected)this.#a();return}if(J==="precision"){if(this.#J=this.#D("precision",2),this.isConnected)this.#MJ();return}if(J==="aspect-ratio"){if(this.#h(),this.#j)this.#l();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.#p(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#E(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#c("input"),this.#c("change")}get data(){return{waves:this.#Z.map((J)=>this.#E(J))}}get preset(){let J=this.#V;return U.TYPES.find((Q)=>Q.value===J.type)?.name}#D(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#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}#f(){return this.getAttribute("edit")!=="false"}#C(){return this.#w("disabled",!1)}#h(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#A(J){let Q=this.#p(J);if(!Q)return!1;if(this.#Z=Q,!this.#Z.length)this.#Z=[U.#H()];return this.#Q=Math.min(this.#Q,this.#Z.length-1),!0}#p(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.#I($))}#I(J={}){return{type:this.#d(J.type),frequency:this.#m(J.frequency,1,0.1,16),amplitude:this.#m(J.amplitude,1,-4,4),phase:this.#m(J.phase,0,-360,360),offset:this.#m(J.offset,0,-4,4)}}#E(J){return{type:J.type,frequency:this.#b(J.frequency),amplitude:this.#b(J.amplitude),phase:this.#b(J.phase),offset:this.#b(J.offset)}}get#V(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||U.#H()}#d(J){let Q=String(J||"").toLowerCase();return U.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#m(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#b(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#o(J){return U.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#i(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=U.#g(J,q),O=5+q*j,G=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${O.toFixed(1)},${G.toFixed(1)}`}return _}static#ZJ(J,Q=24){return A("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},A("path",{d:U.#i(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=U.#i(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.#x(),this.#SJ(),this.replaceChildren(...this.#jJ()),this.#zJ(),this.#kJ(),this.#l(),this.#LJ(),!this.#C())this.#NJ();z(this)}#$J(J,Q){return A("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.#f()&&!this.#C(),Q=[A("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#$,height:this.#X}),A("line",{className:"propskit-oscillator-baseline"}),A("path",{className:"propskit-oscillator-path"}),A("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#$J("amplitude","Amplitude"),this.#$J("frequency","Frequency"));let Z=A("svg",{viewBox:`0 0 ${this.#$} ${this.#X}`,className:"propskit-oscillator-svg"},Q),$=[P("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#f())$.push(P("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#n(j,_,!J))));return $}#n(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#Q,_=U.#o(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.#e(Z,Q)]),B=P("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#r(Q,"frequency","Frequency",0.1,16,0.1,""),this.#r(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#r(Q,"phase","Phase",-360,360,1,"°"),this.#r(Q,"offset","Offset",-4,4,0.1,"")]);return P("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#T.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#e(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"}))),$=U.TYPES.map((j)=>P("fig-menu-item",{value:j.value},[U.#ZJ(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,$])}#r(J,Q,Z,$,j,_,X){let q=this.#Z[J]||U.#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.#b(q[Q]),min:$,max:j,step:_,precision:this.#J,elastic:"false",type:B?"delta":null,default:B?"0":null,units:X||null,disabled:this.#C()})}#zJ(){this.#j=this.querySelector(".propskit-oscillator-svg"),this.#B=this.querySelector(".propskit-oscillator-path"),this.#_=this.querySelector(".propskit-oscillator-playhead"),this.#k=this.querySelector(".propskit-oscillator-baseline"),this.#G=this.querySelector(".propskit-oscillator-bounds"),this.#M=this.querySelector('[data-handle="amplitude"]'),this.#L=this.querySelector('[data-handle="frequency"]'),this.#P=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#N=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"))}#_J(J){let Q=new Set;for(let Z of this.#T)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#T=Q}#WJ(J){let Q=new Set;for(let Z of this.#T)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#T=Q}#KJ(){if(this.#S||!window.ResizeObserver)return;this.#S=new ResizeObserver(()=>{if(this.#kJ())this.#l()}),this.#S.observe(this)}#kJ(){if(!this.#j)return!1;let J=this.#j.getBoundingClientRect(),Q=Math.max(1,Math.round(J.width||240)),Z=Math.max(1,Math.round(J.height||120)),$=Q!==this.#$||Z!==this.#X;return this.#$=Q,this.#X=Z,this.#j.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#XJ(){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}}#v(J){let{min:Q,max:Z}=this.#Y;return this.#X-(J-Q)/(Z-Q)*this.#X}#BJ(J){let{min:Q,max:Z}=this.#Y;return Q+(1-J/this.#X)*(Z-Q)}#JJ(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=U.#g(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#l(){if(!this.#j||!this.#B)return;if(this.#kJ(),this.#Y=this.#XJ(),this.#G)this.#G.setAttribute("width",this.#$),this.#G.setAttribute("height",this.#X);let J=Math.max(...this.#Z.map((_)=>_.frequency)),Z=this.#Z.some((_)=>_.type==="square"||_.type==="sawtooth")?Math.max(192,Math.ceil(J*64)):Math.max(96,Math.ceil(J*64)),$="";for(let _=0;_<=Z;_++){let X=_/Z,q=X*this.#$,B=this.#v(this.#JJ(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#B.setAttribute("d",$);let j=this.#v(0);this.#k?.setAttribute("x1","0"),this.#k?.setAttribute("y1",j),this.#k?.setAttribute("x2",this.#$),this.#k?.setAttribute("y2",j),this.#TJ()}#NJ(){if(this.#O||!this.#_)return;let J=(Q)=>{if(!this.isConnected||!this.#_){this.#O=0;return}this.#HJ(Q%1000/1000),this.#O=requestAnimationFrame(J)};this.#O=requestAnimationFrame(J)}#SJ(){if(!this.#O)return;cancelAnimationFrame(this.#O),this.#O=0}#HJ(J){if(!this.#_)return;let Q=J*this.#$,Z=this.#v(this.#JJ(J));this.#_.setAttribute("cx",Q.toFixed(1)),this.#_.setAttribute("cy",Z.toFixed(1))}#TJ(){let Q=this.#V,Z=this.#PJ(),$=Math.max(8,Math.min(this.#$-8,this.#$/Q.frequency)),j=this.#v(this.#JJ(Z/this.#$)),_=this.#v(this.#JJ($/this.#$));this.#FJ(this.#M,Z,j,8),this.#FJ(this.#L,$,_,8)}#PJ(){let J=this.#V,Q=J.phase/360,Z=Math.max(0.1,J.frequency),$=0.25;if(J.type==="triangle")$=0.5;if(J.type==="sawtooth")$=1;let j=($-Q)/Z;while(j<0)j+=1/Z;while(j>1)j-=1/Z;if(j<0||j>1||!Number.isFinite(j))j=0.25;return Math.max(8,Math.min(this.#$-8,j*this.#$))}#FJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#LJ(){if(!this.#f()||this.#C())return;for(let Q of this.#P)Q.addEventListener("change",(Z)=>{if(this.#C())return;let $=this.#y(Q);this.#t($),this.#Z[$].type=this.#d(Z.detail??Z.target?.value),this.#MJ(),this.#c("input"),this.#c("change")});for(let Q of this.#N)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#z=Q;try{this.#qJ(this.#y(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#z=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#qJ(this.#y(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#K)Q.addEventListener("pointerdown",()=>{this.#t(this.#y(Q))}),Q.addEventListener("focusin",()=>{this.#t(this.#y(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#y(Q);if(Z.detail?.open)this.#T.add($);else this.#T.delete($)});for(let Q of this.querySelectorAll(".propskit-oscillator-add-type")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.addEventListener("change",($)=>{if($.target!==Q)return;if(this.#C())return;let _=this.#y(Q)+1,X=this.#d($.detail?.value??Q.value);this.#Z.splice(_,0,U.#H(X)),this.#WJ(_),this.#Q=_,this.#a(),this.#c("input"),this.#c("change")})}for(let Q of this.querySelectorAll(".propskit-oscillator-add-type-button")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.closest("fig-tooltip")?.addEventListener("pointerdown",Z),Q.closest("fig-tooltip")?.addEventListener("click",Z)}for(let Q of this.querySelectorAll(".propskit-oscillator-remove-button"))Q.addEventListener("pointerdown",(Z)=>{Z.stopPropagation()}),Q.addEventListener("click",(Z)=>{if(Z.stopPropagation(),this.#C()||this.#Z.length<=1)return;let $=this.#y(Q);this.#Z.splice($,1),this.#_J($),this.#Q=Math.min(this.#Q,this.#Z.length-1),this.#a(),this.#c("input"),this.#c("change")});for(let Q of[this.#M,this.#L])this.#UJ(Q);this.querySelector(".propskit-oscillator-svg-container")?.addEventListener("pointerdown",(Q)=>{if(this.#C())return;if(Q.target?.closest?.(".propskit-oscillator-handle, fig-handle"))return;this.#GJ(Q,"offset")})}#y(J){let Q=Number.parseInt(J?.getAttribute("data-wave-index")||"",10);return Number.isFinite(Q)?Math.min(this.#Z.length-1,Math.max(0,Q)):0}#UJ(J){let Q=J?.querySelector("fig-handle"),Z=J?.getAttribute("data-handle");if(!Q||!Z)return;Q.addEventListener("pointerdown",($)=>{if(this.#C())return;$.preventDefault(),$.stopImmediatePropagation(),this.#GJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#C())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#OJ($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#t(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#Q)return;this.#Q=Q,this.#RJ(),this.#TJ()}#qJ(J,Q,Z,$){if(this.#C())return;this.#t(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#fJ();return}this.#Z[J]=this.#I({...this.#Z[J],[Q]:j}),this.#MJ({skipFieldSync:$=="input"}),this.#c($)}#OJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#V;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.#I($),this.#MJ(),this.#c("input"),this.#c("change"),!0}#YJ(J){let Q=this.#j?.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}}#GJ(J,Q){this.#x(),this.#q=Q,this.#j?.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.#YJ(q),O=this.#V;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#$,B.x));O.frequency=this.#$/G}else if(Q==="offset"){let G=this.#m(B.x/this.#$,0,0,1),M=this.#u(O,G);O.offset=this.#BJ(B.y)-this.#s(this.#Q,G)-M*O.amplitude}else if(Q==="amplitude"){let G=this.#m(B.x/this.#$,0,0,1),M=this.#u(O,G),k=this.#BJ(B.y)-this.#s(this.#Q,G)-O.offset;O.amplitude=Math.abs(M)<0.001?O.amplitude:k/M}this.#Z[this.#Q]=this.#I(O),this.#MJ(),this.#c("input")},_=new AbortController,X=(q=!1)=>{if(this.#q=null,this.#j?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#W===_)this.#W=null,this.#F=null;if(q)this.#c("change")};this.#W=_,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})}#x(){this.#F?.(!1),this.#W?.abort(),this.#W=null,this.#F=null,this.#q=null,this.#j?.classList.remove("dragging")}#s(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=U.#g($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#u(J,Q){return U.#g(J.type,Q*J.frequency,J.phase)}#MJ({skipFieldSync:J=!1}={}){if(this.#QJ(),!J)this.#fJ();this.#RJ(),this.#l()}#QJ(){for(let J of this.#P){let Q=this.#y(J);J.value=this.#Z[Q]?.type||"sine"}}#fJ(){for(let J of this.#N){if(J===this.#z)continue;let Q=this.#y(J),Z=J.getAttribute("name"),$=this.#b(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.#y(J)===this.#Q)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#c(J){this.dispatchEvent(new CustomEvent(J,{bubbles:!0,detail:{value:this.value,data:this.data,preset:U.#o(this.#V.type)}}))}}L("propskit-oscillator",U);class PJ extends HTMLElement{#Z;#Q;#J=null;#$;#X;#Y;#q;#j;#B;#_;#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.#$=this.#w.bind(this),this.#X=this.#d.bind(this),this.#Y=this.#m.bind(this),this.#q=this.#i.bind(this),this.#j=this.#ZJ.bind(this),this.#B=this.#f.bind(this),this.#_=this.#o.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.#G(),this.#H(),this.#V(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#b(),this.#D()}#G(){this.#b(),this.#D();let J=this.#z(),Q=this.#P(),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}#N(){let J=Math.abs(this.#W(this.angle));return Math.floor(J/360)}#P(){return Y(this,"disabled")}#U(J){let Q=Number(J);if(!Number.isFinite(Q))return this.angle;if(this.min!==null&&Number.isFinite(this.min))Q=Math.max(this.min,Q);if(this.max!==null&&Number.isFinite(this.max))Q=Math.min(this.max,Q);return Q}#K(J,{reflect:Q=!0}={}){let Z=this.#U(J);if(this.angle=Z,this.#C(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#V(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#T(),this.#S()}#T(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#S(){if(!this.rotationSpan)return;let J=this.#N();if(J>1)this.rotationSpan.textContent=`×${J}`,this.rotationSpan.style.display="";else this.rotationSpan.textContent="",this.rotationSpan.style.display="none"}#z(){switch(this.units){case"rad":return 0.01;case"turn":return 0.001;default:return 0.1}}#W(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.#S(),this.plane?.addEventListener("mousedown",this.#X),this.plane?.addEventListener("touchstart",this.#Y),this.plane?.addEventListener("keydown",this.#_),window.addEventListener("keydown",this.#q),window.addEventListener("keyup",this.#j),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#B),this.angleInput.addEventListener("change",this.#B);this.addEventListener("change",this.#$,!0)}#D(){if(this.plane?.removeEventListener("mousedown",this.#X),this.plane?.removeEventListener("touchstart",this.#Y),this.plane?.removeEventListener("keydown",this.#_),window.removeEventListener("keydown",this.#q),window.removeEventListener("keyup",this.#j),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#B),this.angleInput.removeEventListener("change",this.#B);this.removeEventListener("change",this.#$,!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(_)}}}#f(J){if(J.stopPropagation(),this.#P())return;if(this.#K(Number(J.target.value)),J.type==="change")this.#E();else this.#I()}#C(){let Q=this.#W(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#Q=Math.sin(Q)}#h(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#A(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}#p(J){let Z=(this.#A(J)%360+360)%360;if(Z=this.#h(Z),this.min!==null||this.max!==null)this.angle=this.#U(this.#F(Z));else if(this.#J===null){this.#J=Z;let _=(this.#W(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.#C(),this.setAttribute("value",String(this.angle)),this.#V(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#S(),this.#T(),this.#I()}#I(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#E(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#V(){if(this.handle){let Q=this.#W(this.angle)*Math.PI/180,Z=this.plane.offsetWidth/2-this.handle.offsetWidth/2,$=Math.cos(Q)*Z,j=Math.sin(Q)*Z;this.handle.style.transform=`translate(${$}px, ${j}px)`}}#d(J){if(this.#P()||J.button!==0)return;this.#b(),this.isDragging=!0,this.#J=null,this.#p(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#p(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.#E()};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})}#m(J){if(this.#P())return;J.preventDefault(),this.#b(),this.isDragging=!0,this.#J=null,this.#p(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#p(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.#E()};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})}#b(){this.#k?.(!1),this.#O?.abort(),this.#O=null,this.#k=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#o(J){if(this.#P())return;let Q=this.#z()*(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.#I(),this.#E()}#i(J){if(J.key==="Shift")this.isShiftHeld=!0}#ZJ(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.#G(),this.#H(),this.#V()}break;case"dial":if(this.dial=this.#M("dial",!0),this.isConnected)this.#G(),this.#H(),this.#V();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#G(),this.#H(),this.#V();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#G(),this.#H(),this.#V();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#G(),this.#H(),this.#V();break;case"disabled":if(this.#b(),this.isConnected)this.#G(),this.#H(),this.#V();break;case"aria-label":case"name":if(this.isConnected)this.#G(),this.#H(),this.#V();break;case"rotations":case"show-rotations":if(this.showRotations=this.#L(),this.isConnected)this.#G(),this.#H(),this.#V();break}}}L("fig-input-angle",PJ);class D 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-joystick","fig-canvas-control","propskit-color-point","propskit-number","propskit-point-point","propskit-point-radius","propskit-point-radius-angle","propskit-position","propskit-slider","propskit-oscillator"];#J=null;#$=new Map;#X=null;#Y=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.#T(),this.#k(),this.#J=new MutationObserver(()=>this.#k()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#E(),this.#V(),this.#h(),this.#q?.remove(),this.#q=null}attributeChangedCallback(){if(this.isConnected){if(this.#j)this.#V();this.#k()}}get#j(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#B(){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.#$)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#K($),this.#$.delete(Z);if(this.#L(J),this.#G(J),this.#j||J.length<2){this.#E();return}for(let Z of J){let $=this.#P(Z),j=this.#$.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#$.delete(Z);if(!$)continue;this.#U(Z,$)}this.#N(J),this.#M(J)}#G(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")})}#N(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")}}#P(J){if(this.#_)return J.querySelector(this.#_);return J}#U(J,Q){let Z=(B)=>{if(this.#j||this.#O().length<2)return;if(B.button!==0)return;if(!this.#_&&this.#z(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.#j)return;let O=this.#B==="horizontal",G=O?"ArrowLeft":"ArrowUp",M=O?"ArrowRight":"ArrowDown";if(B.key!==G&&B.key!==M&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let k=this.#O(),K=k.indexOf(J),N=K;if(B.key===G)N=Math.max(0,K-1);else if(B.key===M)N=Math.min(k.length-1,K+1);else if(B.key==="Home")N=0;else if(B.key==="End")N=k.length-1;if(N===K){this.#S(`${X}, position ${K+1} of ${k.length}`);return}this.#p(J,N),this.#k(),this.#P(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:K,newIndex:N,item:J}})),this.#S(`${X}, position ${N+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#$.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#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)}#T(){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)}#S(J){if(!this.#q)return;this.#q.textContent="",requestAnimationFrame(()=>{if(this.#q)this.#q.textContent=J})}#z(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of D.#Q)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#W="fig-reorder-dragging";static#F(J){document.body.classList.toggle(D.#W,J)}#R(J,Q,Z){this.#V();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<D.#Z*D.#Z)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),D.#F(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#B==="horizontal"?j.clientX:j.clientY,B=this.#H(q);$.targetIndex=B,this.#C(B,Q)},$.onKeyDown=(j)=>{if(j.key!=="Escape"||!$.active)return;j.preventDefault(),this.#I($,!0)},$.onUp=(j)=>{if(j.pointerId!==$.pointerId)return;this.#I($,j.type==="pointercancel")},this.#X=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#H(J){let Q=this.#O(),Z=this.#B==="horizontal";for(let $=0;$<Q.length;$++){let j=Q[$].getBoundingClientRect(),_=Z?j.left+j.width/2:j.top+j.height/2;if(J<_)return $}return Q.length}#D(J,Q){let Z=this.#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-$}}#f(){if(this.#Y)return this.#Y;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#B),document.body.appendChild(J),this.#Y=J,J}#C(J,Q){let Z=this.#O();if(!this.#D(Q,J)){this.#h();return}let $=this.#w(Z);if(!$){this.#h();return}let j=this.#f();if(j.setAttribute("data-axis",this.#B),this.#B==="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"}#h(){this.#Y?.remove(),this.#Y=null}#A(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)}#p(J,Q){let $=this.#O().filter((j)=>j!==J)[Q]??null;if($)this.insertBefore(J,$);else this.appendChild(J)}#I(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.#A(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 O=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#S(`${O}, position ${B+1} of ${this.#O().length}`)}}}if(Z.classList.remove("dragging"),D.#F(!1),this.#h(),this.#X===J)this.#X=null}#E(){for(let[,J]of this.#$)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#K(J);this.#$.clear()}#V(){if(!this.#X)return;this.#I(this.#X,!0)}}L("fig-reorder",D);
|