@rogieking/figui3 6.23.1 → 6.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fig-lab.js CHANGED
@@ -1,4 +1,4 @@
1
- function z(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function M(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var x=0;function i(J="fig-lab"){return x+=1,`${J}-${x}`}class g extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#O.bind(this);static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#Y(),this.#k(),this.#N(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#U(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#Y()}#G(){let Q=Array.from(this.childNodes).filter((Y)=>Y.nodeType!==Node.TEXT_NODE||Boolean(Y.textContent?.trim())).find((Y)=>Y.nodeType===Node.ELEMENT_NODE&&Y.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.#B=Boolean(Q),this.replaceChildren(Z)}#Y(){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.#B)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")}#M(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","checked","value"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#M(),Q=new Set(J);for(let Z of this.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#J.setAttribute("value",M(this,"checked")?"on":"off"),this.#P=Q}#N(){if(!this.#J)return;this.#X??=this.#q.bind(this,"input"),this.#$??=this.#q.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#U(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#q(J,Q){Q.stopImmediatePropagation();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}))}#O(J){if(J.target instanceof Element&&J.target.closest("fig-segmented-control"))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":M(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??"")}focus(J){(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}z("propskit-switch",g);class m extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#S.bind(this);#G=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#Y();if(this.#M(),this.#N(),this.#U(),this.#G===null)this.#G=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#N()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#q(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#Y(){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-color");for(let _ of J)if(_!==Q)j.appendChild(_);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#B=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#B)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Color")}#k(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#N(){if(!this.#J)return;let J=this.#k(),Q=new Set(J);for(let Z of this.#P)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,$)}this.#J.setAttribute("text","true"),this.#P=Q}#U(){if(!this.#J)return;this.#X??=this.#L.bind(this,"input"),this.#$??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#q(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#O(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return Q;if(Q&&typeof Q==="object"){if(typeof Q.value==="string"&&Q.value)return Q.value;if(typeof Q.hex==="string"&&Q.hex)return Q.hex;if(typeof Q.color==="string"&&Q.color)return Q.color}if(typeof this.#J?.value==="string"&&this.#J.value)return this.#J.value;return this.#J?.getAttribute("value")??""}#L(J,Q){Q.stopImmediatePropagation();let Z=this.#O(Q);if(this.setAttribute("value",Z),this.#J&&this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#S(J){if(J.target instanceof Element&&J.target.closest("fig-input-color"))return;this.focus()}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);if(this.setAttribute("value",Q),this.#J&&this.#J.getAttribute("value")!==Q)this.#J.setAttribute("value",Q)}#z(J){if(!this.#J)return;if(this.#J.getAttribute("value")===J)this.#J.removeAttribute("value");this.#J.setAttribute("value",J)}#K(){return this.getAttribute("default")??this.#G??""}resetToDefault(){let J=String(this.#K());this.setAttribute("value",J),this.#z(J),this.dispatchEvent(new CustomEvent("input",{detail:J,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:J,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#J?.querySelector("input:not([tabindex='-1'])")?.focus(J)}}z("propskit-color",m);class u extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#K.bind(this);#G=this.#z.bind(this);#Y=!1;static get observedAttributes(){return["label","direction","aria-label","options","value"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#k(),this.#U(),this.#q(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),this.removeEventListener("pointerdown",this.#G,!0),this.addEventListener("pointerdown",this.#G,!0),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="direction"||j==="aria-label")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#U()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#O(),this.removeEventListener("click",this.#j),this.removeEventListener("pointerdown",this.#G,!0)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#k();return}if(J==="options"||J==="value")this.#U()}#M(){let J=this.querySelector(":scope > label"),Q=document.createElement("fig-field"),Z=J||document.createElement("label"),$=document.createElement("fig-select");$.setAttribute("full",""),Q.append(Z,$),this.#Z=Q,this.#Q=Z,this.#J=$,this.#B=Boolean(J),this.replaceChildren(Q)}#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.#B)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","")}#N(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#U(){if(!this.#J)return;let J=this.#N().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.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#P=Q}#q(){if(!this.#J)return;this.#X??=this.#L.bind(this,"input"),this.#$??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#O(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#L(J,Q){if(Q.target!==this.#J)return;Q.stopImmediatePropagation();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}))}#S(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#z(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-select")){this.#Y=!1;return}this.#Y=this.#S()}#K(J){if(J.target instanceof Element&&J.target.closest("fig-select")){this.#Y=!1;return}if(!this.#J||M(this.#J,"disabled")){this.#Y=!1;return}if(this.#J.focus(),this.#Y||this.#S()){this.#Y=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0)this.removeAttribute("value");else this.setAttribute("value",String(J))}focus(J){this.#J?.focus(J)}}z("propskit-select",u);class c extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#O.bind(this);static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#Y(),this.#k(),this.#N(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#U(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#G(){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.#B=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#B)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")}#M(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","multiline","resizable"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#M(),Q=new Set(J);for(let Z of this.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#P=Q}#N(){if(!this.#J)return;this.#X??=this.#q.bind(this,"input"),this.#$??=this.#q.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#U(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#q(J,Q){Q.stopImmediatePropagation();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}))}#O(J){if(J.target instanceof Element&&J.target.closest("fig-input-text"))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}}focus(J){this.#J?.focus(J)}}z("propskit-text",c);class v extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#O.bind(this);static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#Y(),this.#k(),this.#N(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#U(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#Y()}#G(){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.#B=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#Y(){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.#B)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")}#M(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#M(),Q=new Set(J);for(let Z of this.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#P=Q}#N(){if(!this.#J)return;this.#X??=this.#q.bind(this,"input"),this.#$??=this.#q.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#U(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#q(J,Q){Q.stopImmediatePropagation();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}))}#O(J){if(J.target instanceof Element&&J.target.closest("fig-input-number"))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}}focus(J){this.#J?.focus(J)}}z("propskit-number",v);class b extends HTMLElement{static observedAttributes=["name","open","show-reset"];static#Z=["propskit-color","propskit-number","propskit-select","propskit-slider","propskit-switch","propskit-text"].join(",");#Q=null;#J=null;#B=null;#_=null;#P=new WeakMap;#X=null;#$=0;#j=()=>this.#M();connectedCallback(){this.#R(),this.#G(),requestAnimationFrame(()=>{this.#L(),this.#K()})}disconnectedCallback(){if(this.#Y(),this.#$)cancelAnimationFrame(this.#$),this.#$=0;this.#J?.removeEventListener("click",this.#N),this.#_?.querySelector("fig-button")?.removeEventListener("click",this.#U)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#J?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#T(),this.#K();return}this.#R()}get open(){let J=this.getAttribute("open");return J!==null&&J!=="false"}set open(J){let Q=this.open;if(J)this.setAttribute("open","true");else this.setAttribute("open","false");if(this.#J?.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.#C()}#G(){if(this.removeEventListener("input",this.#j,!0),this.removeEventListener("change",this.#j,!0),this.addEventListener("input",this.#j,!0),this.addEventListener("change",this.#j,!0),!this.#X)this.#X=new MutationObserver(()=>{this.#L(),this.#M()});this.#X.disconnect(),this.#X.observe(this,{childList:!0,subtree:!0})}#Y(){this.removeEventListener("input",this.#j,!0),this.removeEventListener("change",this.#j,!0),this.#X?.disconnect()}#M(){if(this.#$)return;this.#$=requestAnimationFrame(()=>{this.#$=0,this.#L(),this.#K()})}#k(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#N=(J)=>{if(this.#k(J.target))return;J.stopPropagation(),this.open=!this.open};#U=(J)=>{J.preventDefault(),J.stopPropagation(),this.#C()};#q(){return[...this.querySelectorAll(b.#Z)].filter((J)=>J.closest("propskit-group")===this)}#O(J){if(J.localName==="propskit-switch")return{kind:"checked",value:Boolean(J.checked)};if("value"in J)return{kind:"value",value:J.value};return{kind:"value",value:J.getAttribute("value")??""}}#L(){for(let J of this.#q()){if(this.#P.has(J))continue;if(J.hasAttribute("default")){if(J.localName==="propskit-switch"){this.#P.set(J,{kind:"checked",value:M(J,"default")});continue}this.#P.set(J,{kind:"value",value:J.getAttribute("default")??""});continue}this.#P.set(J,this.#O(J))}}#S(J){let Q=this.#P.get(J);if(!Q)return!1;let Z=this.#O(J);if(Q.kind==="checked")return Boolean(Z.value)!==Boolean(Q.value);return String(Z.value??"")!==String(Q.value??"")}#z(){for(let J of this.#q())if(this.#S(J))return!0;return!1}#K(){if(this.#z())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#T()}#H(J){let Q=this.#P.get(J);if(!Q)return;if(Q.kind==="checked"){J.checked=Q.value;let $={checked:Boolean(Q.value),value:J.getAttribute("value")??""};J.dispatchEvent(new CustomEvent("input",{detail:$,bubbles:!0,cancelable:!0,composed:!0})),J.dispatchEvent(new CustomEvent("change",{detail:$,bubbles:!0,cancelable:!0,composed:!0}));return}if(typeof J.resetToDefault==="function"){let $=J.getAttribute("default");if(J.setAttribute("default",String(Q.value??"")),J.resetToDefault(),$===null)J.removeAttribute("default");else J.setAttribute("default",$);return}J.value=Q.value;let Z=J.getAttribute?.("value")??("value"in J?J.value:Q.value);J.dispatchEvent(new CustomEvent("input",{detail:Z,bubbles:!0,cancelable:!0,composed:!0})),J.dispatchEvent(new CustomEvent("change",{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#C(){this.#L();for(let J of this.#q())this.#H(J);this.#K(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#T(){if(!this.showReset){this.#_?.setAttribute("hidden","");return}this.#F(),this.#_?.removeAttribute("hidden")}#F(){if(!this.#Q||!this.showReset)return;let J=this.#Q.querySelector(":scope > .propskit-group-reset-tooltip");if(!J){J=document.createElement("fig-tooltip"),J.className="propskit-group-reset-tooltip",J.setAttribute("text","Reset properties");let Q=document.createElement("fig-button");Q.className="propskit-group-reset",Q.setAttribute("variant","ghost"),Q.setAttribute("icon",""),Q.setAttribute("aria-label","Reset properties");let Z=document.createElement("fig-icon");Z.setAttribute("name","reset"),Q.appendChild(Z),J.appendChild(Q),this.#Q.appendChild(J),Q.addEventListener("click",this.#U)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#U),Q?.addEventListener("click",this.#U)}this.#_=J}#R(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#Q=Z;else if(!this.#Q||!this.#Q.dataset.generated||this.#Q.parentElement!==this)this.#Q=document.createElement("fig-header"),this.#Q.setAttribute("borderless",""),this.#Q.dataset.generated="true",this.prepend(this.#Q);let $=this.#Q.querySelector(":scope > .propskit-group-disclosure");if(!$){$=document.createElement("fig-button"),$.className="propskit-group-disclosure",$.setAttribute("variant","ghost");let _=this.#Q.querySelector(":scope > h3");if(_)$.appendChild(_);this.#Q.prepend($)}this.#J=$;let j=$.querySelector("h3");if(!j)j=document.createElement("h3"),$.appendChild(j);if(!j.id)j.id=i("propskit-group");if(this.#Q.dataset.generated){let _=j.querySelector(".propskit-group-chevron");if(j.textContent=Q,_)j.prepend(_)}if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",j.id);if(!j.querySelector(".propskit-group-chevron")){let _=document.createElement("fig-icon");_.setAttribute("name","chevron"),_.setAttribute("size","small"),_.className="propskit-group-chevron",j.prepend(_)}if(this.#B=j.querySelector(".propskit-group-chevron"),this.#T(),this.#Q.removeAttribute("role"),this.#Q.removeAttribute("tabindex"),this.#Q.removeAttribute("aria-expanded"),this.#J.setAttribute("aria-labelledby",j.id),this.#J.setAttribute("aria-expanded",String(this.open)),this.#J.removeEventListener("click",this.#N),this.#J.addEventListener("click",this.#N),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#J.setAttribute("aria-expanded","false")}}z("propskit-group",b);class s extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=0;#$=0;#j=null;#G=null;#Y=0;#M=null;#k=!1;#N=0;#U=null;#q=0;#O=null;#L=null;#S=null;#z=this.#x.bind(this);#K=this.#QJ.bind(this);#H=this.#p.bind(this);#C=this.#o.bind(this);#T=this.#jJ.bind(this);#F=this.#_J.bind(this);#R=this.#I.bind(this);#g=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.#D();if(this.#w(),this.#y(),this.#PJ(),this.#E(),this.removeEventListener("pointerdown",this.#z,{capture:!0}),this.addEventListener("pointerdown",this.#z,{capture:!0,passive:!0}),this.removeEventListener("contextmenu",this.#T),this.addEventListener("contextmenu",this.#T),this.removeEventListener("click",this.#R,!0),this.addEventListener("click",this.#R,!0),this.#G?.removeEventListener("change",this.#F),this.#G?.addEventListener("change",this.#F),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName&&this.#g.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#w();if(Z)this.#y(),this.#E()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#_?.disconnect(),this.#X)cancelAnimationFrame(this.#X),this.#X=0;if(this.#$)cancelAnimationFrame(this.#$),this.#$=0;this.#r(),this.#e(),this.#u(),this.#m(),this.#ZJ(),this.removeEventListener("pointerdown",this.#z,{capture:!0}),this.removeEventListener("contextmenu",this.#T),this.removeEventListener("click",this.#R,!0),this.#G?.removeEventListener("change",this.#F)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#w()}#D(){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.#f()){let X=this.getAttribute(_);j.setAttribute(_,X??"")}Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#B=Boolean(Q),this.replaceChildren(Z),this.#W();for(let _ of J){if(_===Q)continue;this.#J.appendChild(_)}}#W(){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 to default",J.appendChild(Q),J.addEventListener("change",this.#F),this.#G=J,this.appendChild(J)}#w(){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.#B)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#y(){if(!this.#J)return;let J=this.#f(),Q=new Set(J.filter(($)=>$!=="text"));for(let $ of this.#P)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J){if($==="text")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","light-dark(#444444, #e6e6e6)");else this.#J.style.removeProperty("--color");this.#P=Q,this.#i()}#f(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#g.has(Q))}#i(){if(this.#X)cancelAnimationFrame(this.#X);this.#X=requestAnimationFrame(()=>{this.#X=0,this.#YJ(),this.#V()})}#E(){if(this.#$)cancelAnimationFrame(this.#$);this.#$=requestAnimationFrame(()=>{this.#$=0,this.#V()})}#V(){let J=this.#J?.querySelector('input[type="range"]'),Q=this.#J?.querySelector("fig-input-number input");if(J!==this.#j)this.#A(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.setAttribute("tabindex","-1"),Q.setAttribute("aria-hidden","true")}#I(J){if(M(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.#h()}#h(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!M(this,"disabled"))this.focus()})})}#A(J){if(this.#m(),this.#j=J,!this.#j)return;this.#j.addEventListener("dblclick",this.#C,{capture:!0})}#m(){if(!this.#j)return;this.#j.removeEventListener("dblclick",this.#C,{capture:!0}),this.#j=null}#o(J){J.preventDefault(),J.stopImmediatePropagation(),this.#c()}#x(J){if(J.button!==0||M(this,"disabled"))return;if(!J.target?.closest?.("fig-input-number, fig-menu"))this.#h();if(this.getAttribute("elastic")==="false")return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#J?.querySelector('input[type="range"]')??this.#j;if(!Q)return;this.#e(),this.#u(),this.#j=Q,this.#k=!0,this.#O=J.pointerId,this.#N=this.#XJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#U={left:Z.left,right:Z.right,width:Z.width},this.#q=$.width,window.addEventListener("pointermove",this.#K,{passive:!0}),window.addEventListener("pointerup",this.#H,{once:!0}),window.addEventListener("pointercancel",this.#H,{once:!0}),window.addEventListener("blur",this.#H,{once:!0})}#QJ(J){if(!this.#k)return;if(J.pointerId!==this.#O)return;if(J.buttons===0){this.#p(J);return}this.#UJ(J.clientX)}#p(J){if(J?.pointerId!==void 0&&this.#O!==null&&J.pointerId!==this.#O)return;this.#e(),this.#u()}#e(){window.removeEventListener("pointermove",this.#K),window.removeEventListener("pointerup",this.#H),window.removeEventListener("pointercancel",this.#H),window.removeEventListener("blur",this.#H),this.#k=!1,this.#O=null}#jJ(J){if(M(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#r(),this.#a(J.clientX,J.clientY)}#a(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.#G?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#_J(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#c()}#r(){if(this.#Y)clearTimeout(this.#Y),this.#Y=0;this.#M=null}#XJ(){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}#UJ(J){let Q=this.#U;if(!Q||!this.#N){this.#u();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#kJ();return}let $=Math.max(-this.#N,Math.min(this.#N,Z*0.5)),j=Math.abs($),_=this.#q?(this.#q+j)/this.#q: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")}#u(){this.#kJ(),this.#N=0,this.#U=null,this.#q=0,this.#O=null}#kJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#JJ(J){let Q=this.#j;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),Y=j+(_-j)*$;if(!X)return String(Y);let B=Math.round((Y-j)/X)*X+j,G=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(G)))}#BJ(){return this.getAttribute("default")??this.#J?.getAttribute("default")??this.getAttribute("value")??this.#J?.getAttribute("value")??this.#j?.min??"0"}#c(){this.#r(),this.#l(this.#BJ(),"input"),this.#l(this.#BJ(),"change")}#l(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}))}#YJ(){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??"")}#PJ(){if(!this.#J)return;if(!this.#L)this.#L=this.#GJ.bind(this,"input");if(!this.#S)this.#S=this.#GJ.bind(this,"change");this.#J.addEventListener("input",this.#L),this.#J.addEventListener("change",this.#S)}#ZJ(){if(!this.#J)return;if(this.#L)this.#J.removeEventListener("input",this.#L);if(this.#S)this.#J.removeEventListener("change",this.#S)}#GJ(J,Q){if(Q.stopImmediatePropagation(),J==="change")this.#u();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}))}focus(J){this.#V();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}resetToDefault(){this.#c()}}z("propskit-slider",s);class o extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping"];#Z=50;#Q=50;#J=75;#B=75;#_=0;#P=!1;#X=0;#$=null;#j=null;#G=null;#Y=null;#M=null;#k=null;#N=null;#U=null;#q=null;#O=!1;#L=!1;#S=!1;#z=!1;#K=null;#H="";#C="";#T=null;#F=null;#R=null;#g="";#D="";#W=null;#w=null;#y=null;get#f(){return this.getAttribute("type")||"point"}get#i(){return this.#f==="point-radius"||this.#f==="point-radius-angle"}get#E(){return this.#f==="point-radius-angle"}get#V(){return this.#f==="point-point"}get#I(){return this.#f==="point-radius-angle"||this.#f==="point-point"}get#h(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#A(){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"}#m(J){let Q=this.#A;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#x(){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.#B)}%`}get#QJ(){return this.getAttribute("drag-surface")||"parent"}get#p(){let J=this.#QJ;if(J==="parent")return this.parentElement;return this.closest(J)}get#e(){let J=this.#QJ;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#jJ(J){if(this.#P)return this.#_/100*J;return this.#_}#a(){if(this.#P)return`Radius ${Math.round(this.#_)}%`;return`Radius ${Math.round(this.#_)}`}connectedCallback(){this.#_J(),this.#r()}disconnectedCallback(){this.#KJ(),this.#CJ(),this.#u(),this.#c(),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.#O&&!this.#L&&!this.#S&&!this.#z)if(this.#_J(),this.#$)this.#b();else this.#r();if(J==="type")this.#KJ(),this.#_J(),this.#r();if(J==="color"&&this.#$)if(Z)this.#$.setAttribute("color",Z);else this.#$.removeAttribute("color");if(J==="disabled")this.#KJ(),this.#r();if(J==="tooltips")this.#r();if(J==="snapping"&&this.#$){if(this.#$.setAttribute("drag-snapping",Z||"false"),this.#j)this.#j.setAttribute("drag-snapping",Z||"false")}if(J==="name"){if(this.#k)this.#k.setAttribute("text",this.#o);if(this.#N)this.#N.setAttribute("text",this.#x)}}#_J(){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.#P=!0,this.#_=parseFloat(Z);else this.#P=!1,this.#_=parseFloat(Z);if(!Number.isFinite(this.#_))this.#_=0}if(typeof Q.angle==="number")this.#X=Q.angle;if(typeof Q.x2==="number")this.#J=Q.x2;if(typeof Q.y2==="number")this.#B=Q.y2}catch{}}get value(){let J={x:this.#Z,y:this.#Q};if(this.#f==="color"){let Q=this.getAttribute("color")||this.#$?.getAttribute("color");if(Q)J.color=Q}if(this.#i)J.radius=this.#P?`${this.#_}%`:this.#_;if(this.#E)J.angle=this.#X;if(this.#V)J.x2=this.#J,J.y2=this.#B;return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#r(){this.#KJ(),this.innerHTML="",this.#$=null,this.#j=null,this.#G=null,this.#Y=null,this.#M=null,this.#k=null,this.#N=null,this.#U=null,this.#q=null;let J=M(this,"disabled"),Q=this.#f,Z=this.#h,$=this.#e,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.#A),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.#V)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#$=j,this.#i)this.#WJ();if(this.#I)this.#LJ();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.#k=_}else this.appendChild(j);if(this.#E)this.#v(J,Z,$);if(this.#V)this.#VJ(J,Z,$);this.#XJ(this.#$),this.#XJ(this.#G),this.#XJ(this.#j),this.#s(),this.#PJ(),requestAnimationFrame(()=>this.#b())}#XJ(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#BJ(Q,J);else this.#UJ(Q)},{capture:!0})}#UJ(J){if(M(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#K===null)this.#H=document.body.style.getPropertyValue("cursor"),this.#C=document.body.style.getPropertyPriority("cursor");if(this.#K=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#T)this.#T=(Q)=>{if(Q?.pointerId!==void 0&&this.#K!==null&&Q.pointerId!==this.#K)return;if(Q?.type==="blur")this.#u();else requestAnimationFrame(()=>this.#u())};window.addEventListener("pointerup",this.#T),window.addEventListener("pointercancel",this.#T),window.addEventListener("blur",this.#T)}#u(){if(this.#K===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#H)document.body.style.setProperty("cursor",this.#H,this.#C);else document.body.style.removeProperty("cursor");if(this.#K=null,this.#H="",this.#C="",this.#T)window.removeEventListener("pointerup",this.#T),window.removeEventListener("pointercancel",this.#T),window.removeEventListener("blur",this.#T)}#kJ(J){if(!J)return 0;if(J===this.#G)return this.#X;if(!this.#V)return 0;let Q=this.#qJ();return J===this.#$?Q+180:Q}#JJ(){if(this.#F===null)return;let J=this.#MJ(this.#kJ(this.#R));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#BJ(J,Q){if(M(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#F===null)this.#g=document.body.style.getPropertyValue("cursor"),this.#D=document.body.style.getPropertyPriority("cursor");if(this.#F=J?.pointerId??-1,this.#R=Q,document.body.classList.add("fig-lab-rotate-active"),this.#JJ(),!this.#W)this.#W=(Z)=>{if(Z?.pointerId!==void 0&&this.#F!==null&&Z.pointerId!==this.#F)return;if(Z?.type==="blur")this.#c();else requestAnimationFrame(()=>this.#c())};window.addEventListener("pointerup",this.#W),window.addEventListener("pointercancel",this.#W),window.addEventListener("blur",this.#W)}#c(){if(this.#F===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#g)document.body.style.setProperty("cursor",this.#g,this.#D);else document.body.style.removeProperty("cursor");if(this.#F=null,this.#R=null,this.#g="",this.#D="",this.#W)window.removeEventListener("pointerup",this.#W),window.removeEventListener("pointercancel",this.#W),window.removeEventListener("blur",this.#W)}#l(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?.()},Y=()=>{_()};J.addEventListener("pointerenter",X),J.addEventListener("pointerleave",Y)}#YJ(){return this.#O||this.#L||this.#S||this.#z}#PJ(){if(this.#$)this.#l(this.#$,()=>this.#k,()=>this.#o,()=>this.#YJ()||!!this.#$?.querySelector("fig-color-tip"));if(this.#G)this.#l(this.#G,()=>this.#q,()=>`Angle ${Math.round(this.#X)}°`,()=>this.#YJ());if(this.#j)this.#l(this.#j,()=>this.#N,()=>this.#x,()=>this.#YJ());if(this.#Y){let J=this.#Y.querySelector(".fig-canvas-control-radius-hit");this.#GJ(J||this.#Y)}if(this.#f==="color"&&this.#$&&this.#k)new MutationObserver(()=>{if(this.#$?.querySelector("fig-color-tip"))this.#k?.removeAttribute("show"),this.#k?.hidePopup?.()}).observe(this.#$,{childList:!0,subtree:!0})}#ZJ(J,Q){let Z=this.#U;if(!Z?.popup)return;let $=Q-8;Z.popup.anchor={getBoundingClientRect:()=>({left:J,top:$,right:J,bottom:$,width:0,height:0,x:J,y:$})},Z.popup.queueReposition?.()}#GJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#U;if(!Z)return;Z.setAttribute("text",this.#a()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#ZJ(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#S)return;this.#ZJ(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#S)return;let Q=this.#U;if(!Q)return;Q.removeAttribute("show")})}#WJ(){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.#Y=Q,this.#h){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#a()),_.appendChild(Q),this.appendChild(_),this.#U=_}else this.appendChild(Q);this.#fJ(Z)}#LJ(){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.#V){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.#RJ(j)}let Z=document.createElementNS("http://www.w3.org/2000/svg","line");Z.classList.add("fig-canvas-control-angle-line-halo"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","line");$.classList.add("fig-canvas-control-angle-line"),Q.appendChild($),this.#M=Q,this.appendChild(Q)}#RJ(J){J.addEventListener("pointerdown",(Q)=>{if(M(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#p;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#Q,Y=this.#J,B=this.#B;this.#O=!0,this.#L=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let G=(P)=>{let q=Z.getBoundingClientRect(),O=q.width>0?(P.clientX-$)/q.width*100:0,N=q.height>0?(P.clientY-j)/q.height*100:0,K=-Math.min(_,Y),S=100-Math.max(_,Y),T=-Math.min(X,B),F=100-Math.max(X,B),L=Math.max(K,Math.min(S,O)),W=Math.max(T,Math.min(F,N));this.#Z=_+L,this.#Q=X+W,this.#J=Y+L,this.#B=B+W,this.#b(),this.#n()},k=this.#FJ((P)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#O=!1,this.#L=!1,P)this.#t(),this.#d()});window.addEventListener("pointermove",G,{signal:k.signal}),window.addEventListener("pointerup",()=>k.finish(!0),{signal:k.signal}),window.addEventListener("pointercancel",()=>k.finish(!1),{signal:k.signal})})}#v(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.#G=$,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.#X)}°`),j.appendChild($),this.appendChild(j),this.#q=j}else this.appendChild($)}#VJ(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.#A),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#B}%`),J)$.setAttribute("disabled","");if(this.#j=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#x),j.appendChild($),this.appendChild(j),this.#N=j}else this.appendChild($)}#$J(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`}#MJ(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`}#SJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#OJ(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#SJ(Z,this.#MJ(Q)),this.#R===J)this.#JJ()}#zJ(){if(!this.#G||!this.#E)return;this.#OJ(this.#G,this.#X)}#qJ(){return Math.atan2(this.#B-this.#Q,this.#J-this.#Z)*180/Math.PI}#TJ(){if(!this.#V)return;let J=this.#qJ();this.#$?.style.removeProperty("cursor"),this.#j?.style.removeProperty("cursor"),this.#OJ(this.#$,J+180),this.#OJ(this.#j,J)}#NJ(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`}#b(){let J=this.#p;if(!J||!this.#$)return;let Q=J.getBoundingClientRect();if(this.#NJ(this.#$,this.#Z,this.#Q,Q),this.#Y){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#jJ(Q.width),_=this.#Y,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 Y=_.querySelectorAll("circle");for(let B of Y)B.setAttribute("cx",String(j)),B.setAttribute("cy",String(j)),B.setAttribute("r",String(Math.max(j-1,0)))}if(this.#M&&this.#I){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#V)j=this.#J/100*Q.width,_=this.#B/100*Q.height;else{let B=this.#jJ(Q.width),G=this.#X*Math.PI/180;j=Z+B*Math.cos(G),_=$+B*Math.sin(G)}let X=this.#M;X.style.width=`${Q.width}px`,X.style.height=`${Q.height}px`,X.style.left="0",X.style.top="0",X.setAttribute("viewBox",`0 0 ${Q.width} ${Q.height}`);let Y=X.querySelectorAll(".fig-canvas-control-angle-line, .fig-canvas-control-angle-line-halo, .fig-canvas-control-angle-line-hit");for(let B of Y)B.setAttribute("x1",String(Z)),B.setAttribute("y1",String($)),B.setAttribute("x2",String(j)),B.setAttribute("y2",String(_))}if(this.#G&&this.#E){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#jJ(Q.width),_=this.#X*Math.PI/180,X=Z+j*Math.cos(_),Y=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,G=Q.height>0?Y/Q.height*100:0;this.#NJ(this.#G,B,G,Q)}if(this.#j&&this.#V)this.#NJ(this.#j,this.#J,this.#B,Q);this.#zJ(),this.#TJ()}#n(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:this.value}))}#d(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:this.value}))}#t(){this.setAttribute("value",JSON.stringify(this.value))}#s(){if(!this.#$)return;if(this.#$.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",J.detail.color),this.#n();return}this.#O=!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.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#b(),this.#n()}),this.#$.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",J.detail.color),this.#d();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.#k)this.#k.removeAttribute("show");this.#b(),this.#t(),this.#d(),requestAnimationFrame(()=>{this.#O=!1})}),this.#G)this.#G.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#p;if(!Q)return;this.#z=!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,Y=this.#G.offsetWidth/2,B=this.#G.offsetHeight/2,G=_+Y-$,k=X+B-j,P=Math.atan2(k,G)*180/Math.PI;if(this.#m(J.detail?.shiftKey))P=Math.round(P/15)*15;this.#X=P;let q=Math.sqrt(G*G+k*k);if(this.#m(J.detail?.shiftKey)){let O=this.#P?5:10;if(this.#P){let N=q/Z.width*100;N=Math.round(N/O)*O,q=N/100*Z.width}else q=Math.round(q/O)*O}if(this.#P)this.#_=Math.max(0,q/Z.width*100);else this.#_=Math.max(0,q);if(this.#q)this.#q.setAttribute("text",`Angle ${Math.round(this.#X)}°`),this.#q.setAttribute("show","true"),this.#q.showPopup?.();this.#b(),this.#n()}),this.#G.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#q)this.#q.removeAttribute("show");this.#b(),this.#t(),this.#d(),requestAnimationFrame(()=>{this.#z=!1})}),this.#G.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#p;if(!Z)return;if(this.#z=!0,this.classList.add("fig-canvas-control-ring-active"),this.#G.setAttribute("selected",""),this.#q)this.#q.setAttribute("show","true"),this.#q.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),Y=this.#Z/100*X.width,B=this.#Q/100*X.height,G=_.clientX-X.left-Y,k=_.clientY-X.top-B,P=Math.atan2(k,G)*180/Math.PI;if(this.#m(_.shiftKey))P=Math.round(P/15)*15;if(this.#X=P,this.#q)this.#q.setAttribute("text",`Angle ${Math.round(P)}°`);this.#b(),this.#n()},j=this.#FJ((_)=>{if(this.#z=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#G.removeAttribute("selected"),this.#q)this.#q.removeAttribute("show");if(_)this.#t(),this.#d()});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.#j)this.#j.addEventListener("input",(J)=>{J.stopPropagation(),this.#L=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#B/100;if(this.#J=Math.round(Math.max(0,Math.min(100,Q*100))),this.#B=Math.round(Math.max(0,Math.min(100,Z*100))),this.#N)this.#N.removeAttribute("show"),this.#N.hidePopup?.();this.#b(),this.#n()}),this.#j.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#N)this.#N.removeAttribute("show");this.#b(),this.#t(),this.#d(),requestAnimationFrame(()=>{this.#L=!1})}),this.#HJ(this.#$,!0),this.#HJ(this.#j,!1)}#HJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#p;if(!j)return;this.#O=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,Y=Q?this.#B:this.#Q,B=Q?this.#Z:this.#J,G=Q?this.#Q:this.#B,k=X/100*_.width,P=Y/100*_.height,q=B/100*_.width,O=G/100*_.height,N=Math.sqrt((q-k)**2+(O-P)**2),K=Q?this.#k:this.#N;if(K)K.removeAttribute("show"),K.hidePopup?.();let S=(F)=>{let L=j.getBoundingClientRect(),W=X/100*L.width,f=Y/100*L.height,R=F.clientX-L.left-W,C=F.clientY-L.top-f,V=Math.atan2(C,R);if(this.#m(F.shiftKey))V=Math.round(V*180/Math.PI/15)*15*Math.PI/180;let l=W+N*Math.cos(V),d=f+N*Math.sin(V),y=Math.max(0,Math.min(100,l/L.width*100)),h=Math.max(0,Math.min(100,d/L.height*100));if(Q)this.#Z=y,this.#Q=h;else this.#J=y,this.#B=h;this.#b(),this.#n()},T=this.#FJ((F)=>{if(this.#O=!1,K)K.removeAttribute("show");if(F)this.#t(),this.#d()});window.addEventListener("pointermove",S,{signal:T.signal}),window.addEventListener("pointerup",()=>T.finish(!0),{signal:T.signal}),window.addEventListener("pointercancel",()=>T.finish(!1),{signal:T.signal})})}#fJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#S)return;let $=this.#p;if(!$)return;let j=$.getBoundingClientRect(),_=this.#Z/100*j.width,X=this.#Q/100*j.height,Y=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#SJ(J,this.#$J(Y))});let Q=(Z)=>{if(M(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#S=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#p;if(!$)return;if(this.#U)this.#U.setAttribute("show","true"),this.#U.showPopup?.(),this.#ZJ(Z.clientX,Z.clientY);if(this.#q)this.#q.removeAttribute("show"),this.#q.hidePopup?.();let j=this.#G?.style.pointerEvents,_=this.#G?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#G)this.#G.style.pointerEvents="none";if(_)_.style.pointerEvents="none";let Y=document.body.style.cursor;J.style.pointerEvents="none";let B=$.getBoundingClientRect(),G=this.#Z/100*B.width,k=this.#Q/100*B.height,P=Math.atan2(Z.clientY-B.top-k,Z.clientX-B.left-G)*180/Math.PI,q=Math.round(P);document.body.style.cursor=this.#$J(q);let O=(K)=>{let S=$.getBoundingClientRect(),T=this.#Z/100*S.width,F=this.#Q/100*S.height,L=K.clientX-S.left-T,W=K.clientY-S.top-F,f=Math.round(Math.atan2(W,L)*180/Math.PI);if(f!==q)q=f,document.body.style.cursor=this.#$J(f);let R=Math.sqrt(L*L+W*W);if(this.#m(K.shiftKey)){let C=this.#P?5:10;if(this.#P){let V=R/S.width*100;V=Math.round(V/C)*C,R=V/100*S.width}else R=Math.round(R/C)*C}if(this.#P)this.#_=Math.max(0,R/S.width*100);else this.#_=Math.max(0,R);if(this.#U)this.#U.setAttribute("text",this.#a()),this.#ZJ(K.clientX,K.clientY);this.#b(),this.#n()},N=this.#FJ((K)=>{if(this.#S=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#G)this.#G.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=Y,this.#U)this.#U.removeAttribute("show");if(K)this.#t(),this.#d()});window.addEventListener("pointermove",O,{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)}#CJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#FJ(J){this.#KJ();let Q=new AbortController,Z=!1,$=(j=!1)=>{if(Z)return;if(Z=!0,Q.abort(),this.#w===Q)this.#w=null,this.#y=null;J(j)};return this.#w=Q,this.#y=$,{signal:Q.signal,finish:$}}#KJ(){this.#y?.(!1),this.#w?.abort(),this.#w=null,this.#y=null}}z("fig-canvas-control",o);class U extends HTMLElement{#Z=[U.#F()];#Q=0;#J=2;#B=240;#_=120;#P={min:-1,max:1};#X=null;#$=null;#j=null;#G=null;#Y=0;#M=null;#k=null;#N=null;#U=null;#q=[];#O=[];#L=[];#S=[];#z=new Set;#K=null;#H=null;#C=null;#T=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#F(J="sine"){return{type:J,frequency:1,amplitude:1,phase:0,offset:0}}static get observedAttributes(){return["value","precision","aspect-ratio","edit","disabled"]}connectedCallback(){this.#J=this.#R("precision",2),this.#y(this.getAttribute("value")),this.#w(),this.#x(),this.#UJ()}disconnectedCallback(){if(this.#qJ(),this.#PJ(),this.#K)this.#K.disconnect(),this.#K=null}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#y(Z),this.isConnected)this.#x();return}if(J==="precision"){if(this.#J=this.#R("precision",2),this.isConnected)this.#b();return}if(J==="aspect-ratio"){if(this.#w(),this.#$)this.#l();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#x()}}get value(){return JSON.stringify(this.data)}set value(J){this.setAttribute("value",typeof J==="object"&&J!==null?JSON.stringify(J):J)}get data(){return{waves:this.#Z.map((J)=>this.#i(J))}}get preset(){let J=this.#E;return U.TYPES.find((Q)=>Q.value===J.type)?.name}#R(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#g(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}#D(){return this.getAttribute("edit")!=="false"}#W(){return this.#g("disabled",!1)}#w(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#y(J){if(!J)return!1;let Q=null;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}else if(typeof J==="object")Q=J;if(!Q)return!1;let Z=Array.isArray(Q)?Q:Array.isArray(Q.waves)?Q.waves:[Q];if(this.#Z=Z.map(($)=>this.#f($)),!this.#Z.length)this.#Z=[U.#F()];return this.#Q=Math.min(this.#Q,this.#Z.length-1),!0}#f(J={}){return{type:this.#V(J.type),frequency:this.#I(J.frequency,1,0.1,16),amplitude:this.#I(J.amplitude,1,-4,4),phase:this.#I(J.phase,0,-360,360),offset:this.#I(J.offset,0,-4,4)}}#i(J){return{type:J.type,frequency:this.#h(J.frequency),amplitude:this.#h(J.amplitude),phase:this.#h(J.phase),offset:this.#h(J.offset)}}get#E(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||U.#F()}#V(J){let Q=String(J||"").toLowerCase();return U.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#I(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#h(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#A(J){return String(J).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}static#m(J){return U.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static waveIcon(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let Y=X/32,B=U.#o(J,Y),G=5+Y*j,k=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${G.toFixed(1)},${k.toFixed(1)}`}return`<svg width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}" fill="none"><path d="${_}" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>`}static#o(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(_)}}#x(){this.#qJ(),this.#PJ(),this.innerHTML=this.#QJ(),this.#_J(),this.#u(),this.#l(),this.#RJ(),this.#YJ()}#QJ(){let J=this.#D()&&!this.#W(),Q=J?"":" disabled";return`<div class="propskit-oscillator-svg-container">
1
+ function z(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function M(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var x=0;function i(J="fig-lab"){return x+=1,`${J}-${x}`}class g extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#O.bind(this);static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#Y(),this.#k(),this.#N(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#U(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#Y()}#G(){let Q=Array.from(this.childNodes).filter((Y)=>Y.nodeType!==Node.TEXT_NODE||Boolean(Y.textContent?.trim())).find((Y)=>Y.nodeType===Node.ELEMENT_NODE&&Y.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.#B=Boolean(Q),this.replaceChildren(Z)}#Y(){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.#B)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")}#M(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","checked","value"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#M(),Q=new Set(J);for(let Z of this.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#J.setAttribute("value",M(this,"checked")?"on":"off"),this.#P=Q}#N(){if(!this.#J)return;this.#X??=this.#q.bind(this,"input"),this.#$??=this.#q.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#U(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#q(J,Q){Q.stopImmediatePropagation();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}))}#O(J){if(J.target instanceof Element&&J.target.closest("fig-segmented-control"))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":M(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??"")}focus(J){(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}z("propskit-switch",g);class m extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#S.bind(this);#G=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#Y();if(this.#M(),this.#N(),this.#U(),this.#G===null)this.#G=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#N()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#q(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#Y(){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-color");for(let _ of J)if(_!==Q)j.appendChild(_);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#B=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#B)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Color")}#k(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#N(){if(!this.#J)return;let J=this.#k(),Q=new Set(J);for(let Z of this.#P)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,$)}this.#J.setAttribute("text","true"),this.#P=Q}#U(){if(!this.#J)return;this.#X??=this.#L.bind(this,"input"),this.#$??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#q(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#O(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return Q;if(Q&&typeof Q==="object"){if(typeof Q.value==="string"&&Q.value)return Q.value;if(typeof Q.hex==="string"&&Q.hex)return Q.hex;if(typeof Q.color==="string"&&Q.color)return Q.color}if(typeof this.#J?.value==="string"&&this.#J.value)return this.#J.value;return this.#J?.getAttribute("value")??""}#L(J,Q){Q.stopImmediatePropagation();let Z=this.#O(Q);if(this.setAttribute("value",Z),this.#J&&this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#S(J){if(J.target instanceof Element&&J.target.closest("fig-input-color"))return;this.focus()}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);if(this.setAttribute("value",Q),this.#J&&this.#J.getAttribute("value")!==Q)this.#J.setAttribute("value",Q)}#z(J){if(!this.#J)return;if(this.#J.getAttribute("value")===J)this.#J.removeAttribute("value");this.#J.setAttribute("value",J)}#K(){return this.getAttribute("default")??this.#G??""}resetToDefault(){let J=String(this.#K());this.setAttribute("value",J),this.#z(J),this.dispatchEvent(new CustomEvent("input",{detail:J,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:J,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#J?.querySelector("input:not([tabindex='-1'])")?.focus(J)}}z("propskit-color",m);class u extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#K.bind(this);#G=this.#z.bind(this);#Y=!1;static get observedAttributes(){return["label","direction","aria-label","options","value"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#k(),this.#U(),this.#q(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),this.removeEventListener("pointerdown",this.#G,!0),this.addEventListener("pointerdown",this.#G,!0),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="direction"||j==="aria-label")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#U()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#O(),this.removeEventListener("click",this.#j),this.removeEventListener("pointerdown",this.#G,!0)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#k();return}if(J==="options"||J==="value")this.#U()}#M(){let J=this.querySelector(":scope > label"),Q=document.createElement("fig-field"),Z=J||document.createElement("label"),$=document.createElement("fig-select");$.setAttribute("full",""),Q.append(Z,$),this.#Z=Q,this.#Q=Z,this.#J=$,this.#B=Boolean(J),this.replaceChildren(Q)}#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.#B)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","")}#N(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#U(){if(!this.#J)return;let J=this.#N().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.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#P=Q}#q(){if(!this.#J)return;this.#X??=this.#L.bind(this,"input"),this.#$??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#O(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#L(J,Q){if(Q.target!==this.#J)return;Q.stopImmediatePropagation();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}))}#S(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#z(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-select")){this.#Y=!1;return}this.#Y=this.#S()}#K(J){if(J.target instanceof Element&&J.target.closest("fig-select")){this.#Y=!1;return}if(!this.#J||M(this.#J,"disabled")){this.#Y=!1;return}if(this.#J.focus(),this.#Y||this.#S()){this.#Y=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0)this.removeAttribute("value");else this.setAttribute("value",String(J))}focus(J){this.#J?.focus(J)}}z("propskit-select",u);class c extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#O.bind(this);static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#Y(),this.#k(),this.#N(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#U(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#G(){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.#B=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#B)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")}#M(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","multiline","resizable"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#M(),Q=new Set(J);for(let Z of this.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#P=Q}#N(){if(!this.#J)return;this.#X??=this.#q.bind(this,"input"),this.#$??=this.#q.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#U(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#q(J,Q){Q.stopImmediatePropagation();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}))}#O(J){if(J.target instanceof Element&&J.target.closest("fig-input-text"))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}}focus(J){this.#J?.focus(J)}}z("propskit-text",c);class v extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=null;#$=null;#j=this.#O.bind(this);static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#Y(),this.#k(),this.#N(),this.removeEventListener("click",this.#j),this.addEventListener("click",this.#j),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#U(),this.removeEventListener("click",this.#j)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#Y()}#G(){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.#B=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#Y(){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.#B)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")}#M(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#M(),Q=new Set(J);for(let Z of this.#P)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#P=Q}#N(){if(!this.#J)return;this.#X??=this.#q.bind(this,"input"),this.#$??=this.#q.bind(this,"change"),this.#J.addEventListener("input",this.#X),this.#J.addEventListener("change",this.#$)}#U(){if(!this.#J)return;if(this.#X)this.#J.removeEventListener("input",this.#X);if(this.#$)this.#J.removeEventListener("change",this.#$)}#q(J,Q){Q.stopImmediatePropagation();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}))}#O(J){if(J.target instanceof Element&&J.target.closest("fig-input-number"))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}}focus(J){this.#J?.focus(J)}}z("propskit-number",v);class b extends HTMLElement{static observedAttributes=["name","open","show-reset"];static#Z=["propskit-color","propskit-number","propskit-select","propskit-slider","propskit-switch","propskit-text"].join(",");#Q=null;#J=null;#B=null;#_=null;#P=new WeakMap;#X=null;#$=0;#j=()=>this.#M();connectedCallback(){this.#R(),this.#G(),requestAnimationFrame(()=>{this.#L(),this.#K()})}disconnectedCallback(){if(this.#Y(),this.#$)cancelAnimationFrame(this.#$),this.#$=0;this.#J?.removeEventListener("click",this.#N),this.#_?.querySelector("fig-button")?.removeEventListener("click",this.#U)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#J?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#T(),this.#K();return}this.#R()}get open(){let J=this.getAttribute("open");return J!==null&&J!=="false"}set open(J){let Q=this.open;if(J)this.setAttribute("open","true");else this.setAttribute("open","false");if(this.#J?.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.#C()}#G(){if(this.removeEventListener("input",this.#j,!0),this.removeEventListener("change",this.#j,!0),this.addEventListener("input",this.#j,!0),this.addEventListener("change",this.#j,!0),!this.#X)this.#X=new MutationObserver(()=>{this.#L(),this.#M()});this.#X.disconnect(),this.#X.observe(this,{childList:!0,subtree:!0})}#Y(){this.removeEventListener("input",this.#j,!0),this.removeEventListener("change",this.#j,!0),this.#X?.disconnect()}#M(){if(this.#$)return;this.#$=requestAnimationFrame(()=>{this.#$=0,this.#L(),this.#K()})}#k(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#N=(J)=>{if(this.#k(J.target))return;J.stopPropagation(),this.open=!this.open};#U=(J)=>{J.preventDefault(),J.stopPropagation(),this.#C()};#q(){return[...this.querySelectorAll(b.#Z)].filter((J)=>J.closest("propskit-group")===this)}#O(J){if(J.localName==="propskit-switch")return{kind:"checked",value:Boolean(J.checked)};if("value"in J)return{kind:"value",value:J.value};return{kind:"value",value:J.getAttribute("value")??""}}#L(){for(let J of this.#q()){if(this.#P.has(J))continue;if(J.hasAttribute("default")){if(J.localName==="propskit-switch"){this.#P.set(J,{kind:"checked",value:M(J,"default")});continue}this.#P.set(J,{kind:"value",value:J.getAttribute("default")??""});continue}this.#P.set(J,this.#O(J))}}#S(J){let Q=this.#P.get(J);if(!Q)return!1;let Z=this.#O(J);if(Q.kind==="checked")return Boolean(Z.value)!==Boolean(Q.value);return String(Z.value??"")!==String(Q.value??"")}#z(){for(let J of this.#q())if(this.#S(J))return!0;return!1}#K(){if(this.#z())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#T()}#H(J){let Q=this.#P.get(J);if(!Q)return;if(Q.kind==="checked"){J.checked=Q.value;let $={checked:Boolean(Q.value),value:J.getAttribute("value")??""};J.dispatchEvent(new CustomEvent("input",{detail:$,bubbles:!0,cancelable:!0,composed:!0})),J.dispatchEvent(new CustomEvent("change",{detail:$,bubbles:!0,cancelable:!0,composed:!0}));return}if(typeof J.resetToDefault==="function"){let $=J.getAttribute("default");if(J.setAttribute("default",String(Q.value??"")),J.resetToDefault(),$===null)J.removeAttribute("default");else J.setAttribute("default",$);return}J.value=Q.value;let Z=J.getAttribute?.("value")??("value"in J?J.value:Q.value);J.dispatchEvent(new CustomEvent("input",{detail:Z,bubbles:!0,cancelable:!0,composed:!0})),J.dispatchEvent(new CustomEvent("change",{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#C(){this.#L();for(let J of this.#q())this.#H(J);this.#K(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#T(){if(!this.showReset){this.#_?.setAttribute("hidden","");return}this.#F(),this.#_?.removeAttribute("hidden")}#F(){if(!this.#Q||!this.showReset)return;let J=this.#Q.querySelector(":scope > .propskit-group-reset-tooltip");if(!J){J=document.createElement("fig-tooltip"),J.className="propskit-group-reset-tooltip",J.setAttribute("text","Reset properties");let Q=document.createElement("fig-button");Q.className="propskit-group-reset",Q.setAttribute("variant","ghost"),Q.setAttribute("icon",""),Q.setAttribute("aria-label","Reset properties");let Z=document.createElement("fig-icon");Z.setAttribute("name","reset"),Q.appendChild(Z),J.appendChild(Q),this.#Q.appendChild(J),Q.addEventListener("click",this.#U)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#U),Q?.addEventListener("click",this.#U)}this.#_=J}#R(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#Q=Z;else if(!this.#Q||!this.#Q.dataset.generated||this.#Q.parentElement!==this)this.#Q=document.createElement("fig-header"),this.#Q.setAttribute("borderless",""),this.#Q.dataset.generated="true",this.prepend(this.#Q);let $=this.#Q.querySelector(":scope > .propskit-group-disclosure");if(!$){$=document.createElement("fig-button"),$.className="propskit-group-disclosure",$.setAttribute("variant","ghost");let _=this.#Q.querySelector(":scope > h3");if(_)$.appendChild(_);this.#Q.prepend($)}this.#J=$;let j=$.querySelector("h3");if(!j)j=document.createElement("h3"),$.appendChild(j);if(!j.id)j.id=i("propskit-group");if(this.#Q.dataset.generated){let _=j.querySelector(".propskit-group-chevron");if(j.textContent=Q,_)j.prepend(_)}if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",j.id);if(!j.querySelector(".propskit-group-chevron")){let _=document.createElement("fig-icon");_.setAttribute("name","chevron"),_.setAttribute("size","small"),_.className="propskit-group-chevron",j.prepend(_)}if(this.#B=j.querySelector(".propskit-group-chevron"),this.#T(),this.#Q.removeAttribute("role"),this.#Q.removeAttribute("tabindex"),this.#Q.removeAttribute("aria-expanded"),this.#J.setAttribute("aria-labelledby",j.id),this.#J.setAttribute("aria-expanded",String(this.open)),this.#J.removeEventListener("click",this.#N),this.#J.addEventListener("click",this.#N),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#J.setAttribute("aria-expanded","false")}}z("propskit-group",b);class s extends HTMLElement{#Z=null;#Q=null;#J=null;#B=!1;#_=null;#P=new Set;#X=0;#$=0;#j=null;#G=null;#Y=0;#M=null;#k=!1;#N=0;#U=null;#q=0;#O=null;#L=null;#S=null;#z=this.#x.bind(this);#K=this.#QJ.bind(this);#H=this.#p.bind(this);#C=this.#o.bind(this);#T=this.#jJ.bind(this);#F=this.#_J.bind(this);#R=this.#I.bind(this);#g=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.#D();if(this.#w(),this.#y(),this.#PJ(),this.#E(),this.removeEventListener("pointerdown",this.#z,{capture:!0}),this.addEventListener("pointerdown",this.#z,{capture:!0,passive:!0}),this.removeEventListener("contextmenu",this.#T),this.addEventListener("contextmenu",this.#T),this.removeEventListener("click",this.#R,!0),this.addEventListener("click",this.#R,!0),this.#G?.removeEventListener("change",this.#F),this.#G?.addEventListener("change",this.#F),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName&&this.#g.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#w();if(Z)this.#y(),this.#E()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#_?.disconnect(),this.#X)cancelAnimationFrame(this.#X),this.#X=0;if(this.#$)cancelAnimationFrame(this.#$),this.#$=0;this.#r(),this.#e(),this.#u(),this.#m(),this.#ZJ(),this.removeEventListener("pointerdown",this.#z,{capture:!0}),this.removeEventListener("contextmenu",this.#T),this.removeEventListener("click",this.#R,!0),this.#G?.removeEventListener("change",this.#F)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#w()}#D(){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.#f()){let X=this.getAttribute(_);j.setAttribute(_,X??"")}Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#B=Boolean(Q),this.replaceChildren(Z),this.#W();for(let _ of J){if(_===Q)continue;this.#J.appendChild(_)}}#W(){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 to default",J.appendChild(Q),J.addEventListener("change",this.#F),this.#G=J,this.appendChild(J)}#w(){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.#B)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#y(){if(!this.#J)return;let J=this.#f(),Q=new Set(J.filter(($)=>$!=="text"));for(let $ of this.#P)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J){if($==="text")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","light-dark(#444444, #e6e6e6)");else this.#J.style.removeProperty("--color");this.#P=Q,this.#i()}#f(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#g.has(Q))}#i(){if(this.#X)cancelAnimationFrame(this.#X);this.#X=requestAnimationFrame(()=>{this.#X=0,this.#YJ(),this.#V()})}#E(){if(this.#$)cancelAnimationFrame(this.#$);this.#$=requestAnimationFrame(()=>{this.#$=0,this.#V()})}#V(){let J=this.#J?.querySelector('input[type="range"]'),Q=this.#J?.querySelector("fig-input-number input");if(J!==this.#j)this.#A(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.setAttribute("tabindex","-1"),Q.setAttribute("aria-hidden","true")}#I(J){if(M(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.#h()}#h(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!M(this,"disabled"))this.focus()})})}#A(J){if(this.#m(),this.#j=J,!this.#j)return;this.#j.addEventListener("dblclick",this.#C,{capture:!0})}#m(){if(!this.#j)return;this.#j.removeEventListener("dblclick",this.#C,{capture:!0}),this.#j=null}#o(J){J.preventDefault(),J.stopImmediatePropagation(),this.#c()}#x(J){if(J.button!==0||M(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.#j;if(!Q)return;this.#e(),this.#u(),this.#j=Q,this.#k=!0,this.#O=J.pointerId,this.#N=this.#XJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#U={left:Z.left,right:Z.right,width:Z.width},this.#q=$.width,window.addEventListener("pointermove",this.#K,{passive:!0}),window.addEventListener("pointerup",this.#H,{once:!0}),window.addEventListener("pointercancel",this.#H,{once:!0}),window.addEventListener("blur",this.#H,{once:!0})}#QJ(J){if(!this.#k)return;if(J.pointerId!==this.#O)return;if(J.buttons===0){this.#p(J);return}this.#UJ(J.clientX)}#p(J){if(J?.pointerId!==void 0&&this.#O!==null&&J.pointerId!==this.#O)return;let Q=J?.type==="pointerup"||J?.type==="pointermove"&&J.buttons===0;if(this.#e(),this.#u(),Q)this.#h()}#e(){window.removeEventListener("pointermove",this.#K),window.removeEventListener("pointerup",this.#H),window.removeEventListener("pointercancel",this.#H),window.removeEventListener("blur",this.#H),this.#k=!1,this.#O=null}#jJ(J){if(M(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#r(),this.#a(J.clientX,J.clientY)}#a(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.#G?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#_J(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#c()}#r(){if(this.#Y)clearTimeout(this.#Y),this.#Y=0;this.#M=null}#XJ(){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}#UJ(J){let Q=this.#U;if(!Q||!this.#N){this.#u();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#kJ();return}let $=Math.max(-this.#N,Math.min(this.#N,Z*0.5)),j=Math.abs($),_=this.#q?(this.#q+j)/this.#q: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")}#u(){this.#kJ(),this.#N=0,this.#U=null,this.#q=0,this.#O=null}#kJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#JJ(J){let Q=this.#j;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),Y=j+(_-j)*$;if(!X)return String(Y);let B=Math.round((Y-j)/X)*X+j,G=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(G)))}#BJ(){return this.getAttribute("default")??this.#J?.getAttribute("default")??this.getAttribute("value")??this.#J?.getAttribute("value")??this.#j?.min??"0"}#c(){this.#r(),this.#l(this.#BJ(),"input"),this.#l(this.#BJ(),"change")}#l(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}))}#YJ(){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??"")}#PJ(){if(!this.#J)return;if(!this.#L)this.#L=this.#GJ.bind(this,"input");if(!this.#S)this.#S=this.#GJ.bind(this,"change");this.#J.addEventListener("input",this.#L),this.#J.addEventListener("change",this.#S)}#ZJ(){if(!this.#J)return;if(this.#L)this.#J.removeEventListener("input",this.#L);if(this.#S)this.#J.removeEventListener("change",this.#S)}#GJ(J,Q){if(Q.stopImmediatePropagation(),J==="change")this.#u();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}))}focus(J){this.#V();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}resetToDefault(){this.#c()}}z("propskit-slider",s);class o extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping"];#Z=50;#Q=50;#J=75;#B=75;#_=0;#P=!1;#X=0;#$=null;#j=null;#G=null;#Y=null;#M=null;#k=null;#N=null;#U=null;#q=null;#O=!1;#L=!1;#S=!1;#z=!1;#K=null;#H="";#C="";#T=null;#F=null;#R=null;#g="";#D="";#W=null;#w=null;#y=null;get#f(){return this.getAttribute("type")||"point"}get#i(){return this.#f==="point-radius"||this.#f==="point-radius-angle"}get#E(){return this.#f==="point-radius-angle"}get#V(){return this.#f==="point-point"}get#I(){return this.#f==="point-radius-angle"||this.#f==="point-point"}get#h(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#A(){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"}#m(J){let Q=this.#A;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#x(){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.#B)}%`}get#QJ(){return this.getAttribute("drag-surface")||"parent"}get#p(){let J=this.#QJ;if(J==="parent")return this.parentElement;return this.closest(J)}get#e(){let J=this.#QJ;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#jJ(J){if(this.#P)return this.#_/100*J;return this.#_}#a(){if(this.#P)return`Radius ${Math.round(this.#_)}%`;return`Radius ${Math.round(this.#_)}`}connectedCallback(){this.#_J(),this.#r()}disconnectedCallback(){this.#KJ(),this.#CJ(),this.#u(),this.#c(),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.#O&&!this.#L&&!this.#S&&!this.#z)if(this.#_J(),this.#$)this.#b();else this.#r();if(J==="type")this.#KJ(),this.#_J(),this.#r();if(J==="color"&&this.#$)if(Z)this.#$.setAttribute("color",Z);else this.#$.removeAttribute("color");if(J==="disabled")this.#KJ(),this.#r();if(J==="tooltips")this.#r();if(J==="snapping"&&this.#$){if(this.#$.setAttribute("drag-snapping",Z||"false"),this.#j)this.#j.setAttribute("drag-snapping",Z||"false")}if(J==="name"){if(this.#k)this.#k.setAttribute("text",this.#o);if(this.#N)this.#N.setAttribute("text",this.#x)}}#_J(){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.#P=!0,this.#_=parseFloat(Z);else this.#P=!1,this.#_=parseFloat(Z);if(!Number.isFinite(this.#_))this.#_=0}if(typeof Q.angle==="number")this.#X=Q.angle;if(typeof Q.x2==="number")this.#J=Q.x2;if(typeof Q.y2==="number")this.#B=Q.y2}catch{}}get value(){let J={x:this.#Z,y:this.#Q};if(this.#f==="color"){let Q=this.getAttribute("color")||this.#$?.getAttribute("color");if(Q)J.color=Q}if(this.#i)J.radius=this.#P?`${this.#_}%`:this.#_;if(this.#E)J.angle=this.#X;if(this.#V)J.x2=this.#J,J.y2=this.#B;return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#r(){this.#KJ(),this.innerHTML="",this.#$=null,this.#j=null,this.#G=null,this.#Y=null,this.#M=null,this.#k=null,this.#N=null,this.#U=null,this.#q=null;let J=M(this,"disabled"),Q=this.#f,Z=this.#h,$=this.#e,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.#A),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.#V)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#$=j,this.#i)this.#WJ();if(this.#I)this.#LJ();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.#k=_}else this.appendChild(j);if(this.#E)this.#v(J,Z,$);if(this.#V)this.#VJ(J,Z,$);this.#XJ(this.#$),this.#XJ(this.#G),this.#XJ(this.#j),this.#s(),this.#PJ(),requestAnimationFrame(()=>this.#b())}#XJ(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#BJ(Q,J);else this.#UJ(Q)},{capture:!0})}#UJ(J){if(M(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#K===null)this.#H=document.body.style.getPropertyValue("cursor"),this.#C=document.body.style.getPropertyPriority("cursor");if(this.#K=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#T)this.#T=(Q)=>{if(Q?.pointerId!==void 0&&this.#K!==null&&Q.pointerId!==this.#K)return;if(Q?.type==="blur")this.#u();else requestAnimationFrame(()=>this.#u())};window.addEventListener("pointerup",this.#T),window.addEventListener("pointercancel",this.#T),window.addEventListener("blur",this.#T)}#u(){if(this.#K===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#H)document.body.style.setProperty("cursor",this.#H,this.#C);else document.body.style.removeProperty("cursor");if(this.#K=null,this.#H="",this.#C="",this.#T)window.removeEventListener("pointerup",this.#T),window.removeEventListener("pointercancel",this.#T),window.removeEventListener("blur",this.#T)}#kJ(J){if(!J)return 0;if(J===this.#G)return this.#X;if(!this.#V)return 0;let Q=this.#qJ();return J===this.#$?Q+180:Q}#JJ(){if(this.#F===null)return;let J=this.#MJ(this.#kJ(this.#R));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#BJ(J,Q){if(M(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#F===null)this.#g=document.body.style.getPropertyValue("cursor"),this.#D=document.body.style.getPropertyPriority("cursor");if(this.#F=J?.pointerId??-1,this.#R=Q,document.body.classList.add("fig-lab-rotate-active"),this.#JJ(),!this.#W)this.#W=(Z)=>{if(Z?.pointerId!==void 0&&this.#F!==null&&Z.pointerId!==this.#F)return;if(Z?.type==="blur")this.#c();else requestAnimationFrame(()=>this.#c())};window.addEventListener("pointerup",this.#W),window.addEventListener("pointercancel",this.#W),window.addEventListener("blur",this.#W)}#c(){if(this.#F===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#g)document.body.style.setProperty("cursor",this.#g,this.#D);else document.body.style.removeProperty("cursor");if(this.#F=null,this.#R=null,this.#g="",this.#D="",this.#W)window.removeEventListener("pointerup",this.#W),window.removeEventListener("pointercancel",this.#W),window.removeEventListener("blur",this.#W)}#l(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?.()},Y=()=>{_()};J.addEventListener("pointerenter",X),J.addEventListener("pointerleave",Y)}#YJ(){return this.#O||this.#L||this.#S||this.#z}#PJ(){if(this.#$)this.#l(this.#$,()=>this.#k,()=>this.#o,()=>this.#YJ()||!!this.#$?.querySelector("fig-color-tip"));if(this.#G)this.#l(this.#G,()=>this.#q,()=>`Angle ${Math.round(this.#X)}°`,()=>this.#YJ());if(this.#j)this.#l(this.#j,()=>this.#N,()=>this.#x,()=>this.#YJ());if(this.#Y){let J=this.#Y.querySelector(".fig-canvas-control-radius-hit");this.#GJ(J||this.#Y)}if(this.#f==="color"&&this.#$&&this.#k)new MutationObserver(()=>{if(this.#$?.querySelector("fig-color-tip"))this.#k?.removeAttribute("show"),this.#k?.hidePopup?.()}).observe(this.#$,{childList:!0,subtree:!0})}#ZJ(J,Q){let Z=this.#U;if(!Z?.popup)return;let $=Q-8;Z.popup.anchor={getBoundingClientRect:()=>({left:J,top:$,right:J,bottom:$,width:0,height:0,x:J,y:$})},Z.popup.queueReposition?.()}#GJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#U;if(!Z)return;Z.setAttribute("text",this.#a()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#ZJ(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#S)return;this.#ZJ(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#S)return;let Q=this.#U;if(!Q)return;Q.removeAttribute("show")})}#WJ(){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.#Y=Q,this.#h){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#a()),_.appendChild(Q),this.appendChild(_),this.#U=_}else this.appendChild(Q);this.#fJ(Z)}#LJ(){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.#V){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.#RJ(j)}let Z=document.createElementNS("http://www.w3.org/2000/svg","line");Z.classList.add("fig-canvas-control-angle-line-halo"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","line");$.classList.add("fig-canvas-control-angle-line"),Q.appendChild($),this.#M=Q,this.appendChild(Q)}#RJ(J){J.addEventListener("pointerdown",(Q)=>{if(M(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#p;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#Q,Y=this.#J,B=this.#B;this.#O=!0,this.#L=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let G=(P)=>{let q=Z.getBoundingClientRect(),O=q.width>0?(P.clientX-$)/q.width*100:0,N=q.height>0?(P.clientY-j)/q.height*100:0,K=-Math.min(_,Y),S=100-Math.max(_,Y),T=-Math.min(X,B),F=100-Math.max(X,B),L=Math.max(K,Math.min(S,O)),W=Math.max(T,Math.min(F,N));this.#Z=_+L,this.#Q=X+W,this.#J=Y+L,this.#B=B+W,this.#b(),this.#n()},k=this.#FJ((P)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#O=!1,this.#L=!1,P)this.#t(),this.#d()});window.addEventListener("pointermove",G,{signal:k.signal}),window.addEventListener("pointerup",()=>k.finish(!0),{signal:k.signal}),window.addEventListener("pointercancel",()=>k.finish(!1),{signal:k.signal})})}#v(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.#G=$,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.#X)}°`),j.appendChild($),this.appendChild(j),this.#q=j}else this.appendChild($)}#VJ(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.#A),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#B}%`),J)$.setAttribute("disabled","");if(this.#j=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#x),j.appendChild($),this.appendChild(j),this.#N=j}else this.appendChild($)}#$J(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`}#MJ(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`}#SJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#OJ(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#SJ(Z,this.#MJ(Q)),this.#R===J)this.#JJ()}#zJ(){if(!this.#G||!this.#E)return;this.#OJ(this.#G,this.#X)}#qJ(){return Math.atan2(this.#B-this.#Q,this.#J-this.#Z)*180/Math.PI}#TJ(){if(!this.#V)return;let J=this.#qJ();this.#$?.style.removeProperty("cursor"),this.#j?.style.removeProperty("cursor"),this.#OJ(this.#$,J+180),this.#OJ(this.#j,J)}#NJ(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`}#b(){let J=this.#p;if(!J||!this.#$)return;let Q=J.getBoundingClientRect();if(this.#NJ(this.#$,this.#Z,this.#Q,Q),this.#Y){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#jJ(Q.width),_=this.#Y,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 Y=_.querySelectorAll("circle");for(let B of Y)B.setAttribute("cx",String(j)),B.setAttribute("cy",String(j)),B.setAttribute("r",String(Math.max(j-1,0)))}if(this.#M&&this.#I){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#V)j=this.#J/100*Q.width,_=this.#B/100*Q.height;else{let B=this.#jJ(Q.width),G=this.#X*Math.PI/180;j=Z+B*Math.cos(G),_=$+B*Math.sin(G)}let X=this.#M;X.style.width=`${Q.width}px`,X.style.height=`${Q.height}px`,X.style.left="0",X.style.top="0",X.setAttribute("viewBox",`0 0 ${Q.width} ${Q.height}`);let Y=X.querySelectorAll(".fig-canvas-control-angle-line, .fig-canvas-control-angle-line-halo, .fig-canvas-control-angle-line-hit");for(let B of Y)B.setAttribute("x1",String(Z)),B.setAttribute("y1",String($)),B.setAttribute("x2",String(j)),B.setAttribute("y2",String(_))}if(this.#G&&this.#E){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#jJ(Q.width),_=this.#X*Math.PI/180,X=Z+j*Math.cos(_),Y=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,G=Q.height>0?Y/Q.height*100:0;this.#NJ(this.#G,B,G,Q)}if(this.#j&&this.#V)this.#NJ(this.#j,this.#J,this.#B,Q);this.#zJ(),this.#TJ()}#n(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:this.value}))}#d(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:this.value}))}#t(){this.setAttribute("value",JSON.stringify(this.value))}#s(){if(!this.#$)return;if(this.#$.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",J.detail.color),this.#n();return}this.#O=!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.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#b(),this.#n()}),this.#$.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",J.detail.color),this.#d();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.#k)this.#k.removeAttribute("show");this.#b(),this.#t(),this.#d(),requestAnimationFrame(()=>{this.#O=!1})}),this.#G)this.#G.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#p;if(!Q)return;this.#z=!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,Y=this.#G.offsetWidth/2,B=this.#G.offsetHeight/2,G=_+Y-$,k=X+B-j,P=Math.atan2(k,G)*180/Math.PI;if(this.#m(J.detail?.shiftKey))P=Math.round(P/15)*15;this.#X=P;let q=Math.sqrt(G*G+k*k);if(this.#m(J.detail?.shiftKey)){let O=this.#P?5:10;if(this.#P){let N=q/Z.width*100;N=Math.round(N/O)*O,q=N/100*Z.width}else q=Math.round(q/O)*O}if(this.#P)this.#_=Math.max(0,q/Z.width*100);else this.#_=Math.max(0,q);if(this.#q)this.#q.setAttribute("text",`Angle ${Math.round(this.#X)}°`),this.#q.setAttribute("show","true"),this.#q.showPopup?.();this.#b(),this.#n()}),this.#G.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#q)this.#q.removeAttribute("show");this.#b(),this.#t(),this.#d(),requestAnimationFrame(()=>{this.#z=!1})}),this.#G.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#p;if(!Z)return;if(this.#z=!0,this.classList.add("fig-canvas-control-ring-active"),this.#G.setAttribute("selected",""),this.#q)this.#q.setAttribute("show","true"),this.#q.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),Y=this.#Z/100*X.width,B=this.#Q/100*X.height,G=_.clientX-X.left-Y,k=_.clientY-X.top-B,P=Math.atan2(k,G)*180/Math.PI;if(this.#m(_.shiftKey))P=Math.round(P/15)*15;if(this.#X=P,this.#q)this.#q.setAttribute("text",`Angle ${Math.round(P)}°`);this.#b(),this.#n()},j=this.#FJ((_)=>{if(this.#z=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#G.removeAttribute("selected"),this.#q)this.#q.removeAttribute("show");if(_)this.#t(),this.#d()});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.#j)this.#j.addEventListener("input",(J)=>{J.stopPropagation(),this.#L=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#B/100;if(this.#J=Math.round(Math.max(0,Math.min(100,Q*100))),this.#B=Math.round(Math.max(0,Math.min(100,Z*100))),this.#N)this.#N.removeAttribute("show"),this.#N.hidePopup?.();this.#b(),this.#n()}),this.#j.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#N)this.#N.removeAttribute("show");this.#b(),this.#t(),this.#d(),requestAnimationFrame(()=>{this.#L=!1})}),this.#HJ(this.#$,!0),this.#HJ(this.#j,!1)}#HJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#p;if(!j)return;this.#O=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,Y=Q?this.#B:this.#Q,B=Q?this.#Z:this.#J,G=Q?this.#Q:this.#B,k=X/100*_.width,P=Y/100*_.height,q=B/100*_.width,O=G/100*_.height,N=Math.sqrt((q-k)**2+(O-P)**2),K=Q?this.#k:this.#N;if(K)K.removeAttribute("show"),K.hidePopup?.();let S=(F)=>{let L=j.getBoundingClientRect(),W=X/100*L.width,f=Y/100*L.height,R=F.clientX-L.left-W,C=F.clientY-L.top-f,V=Math.atan2(C,R);if(this.#m(F.shiftKey))V=Math.round(V*180/Math.PI/15)*15*Math.PI/180;let l=W+N*Math.cos(V),d=f+N*Math.sin(V),y=Math.max(0,Math.min(100,l/L.width*100)),h=Math.max(0,Math.min(100,d/L.height*100));if(Q)this.#Z=y,this.#Q=h;else this.#J=y,this.#B=h;this.#b(),this.#n()},T=this.#FJ((F)=>{if(this.#O=!1,K)K.removeAttribute("show");if(F)this.#t(),this.#d()});window.addEventListener("pointermove",S,{signal:T.signal}),window.addEventListener("pointerup",()=>T.finish(!0),{signal:T.signal}),window.addEventListener("pointercancel",()=>T.finish(!1),{signal:T.signal})})}#fJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#S)return;let $=this.#p;if(!$)return;let j=$.getBoundingClientRect(),_=this.#Z/100*j.width,X=this.#Q/100*j.height,Y=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#SJ(J,this.#$J(Y))});let Q=(Z)=>{if(M(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#S=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#p;if(!$)return;if(this.#U)this.#U.setAttribute("show","true"),this.#U.showPopup?.(),this.#ZJ(Z.clientX,Z.clientY);if(this.#q)this.#q.removeAttribute("show"),this.#q.hidePopup?.();let j=this.#G?.style.pointerEvents,_=this.#G?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#G)this.#G.style.pointerEvents="none";if(_)_.style.pointerEvents="none";let Y=document.body.style.cursor;J.style.pointerEvents="none";let B=$.getBoundingClientRect(),G=this.#Z/100*B.width,k=this.#Q/100*B.height,P=Math.atan2(Z.clientY-B.top-k,Z.clientX-B.left-G)*180/Math.PI,q=Math.round(P);document.body.style.cursor=this.#$J(q);let O=(K)=>{let S=$.getBoundingClientRect(),T=this.#Z/100*S.width,F=this.#Q/100*S.height,L=K.clientX-S.left-T,W=K.clientY-S.top-F,f=Math.round(Math.atan2(W,L)*180/Math.PI);if(f!==q)q=f,document.body.style.cursor=this.#$J(f);let R=Math.sqrt(L*L+W*W);if(this.#m(K.shiftKey)){let C=this.#P?5:10;if(this.#P){let V=R/S.width*100;V=Math.round(V/C)*C,R=V/100*S.width}else R=Math.round(R/C)*C}if(this.#P)this.#_=Math.max(0,R/S.width*100);else this.#_=Math.max(0,R);if(this.#U)this.#U.setAttribute("text",this.#a()),this.#ZJ(K.clientX,K.clientY);this.#b(),this.#n()},N=this.#FJ((K)=>{if(this.#S=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#G)this.#G.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=Y,this.#U)this.#U.removeAttribute("show");if(K)this.#t(),this.#d()});window.addEventListener("pointermove",O,{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)}#CJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#FJ(J){this.#KJ();let Q=new AbortController,Z=!1,$=(j=!1)=>{if(Z)return;if(Z=!0,Q.abort(),this.#w===Q)this.#w=null,this.#y=null;J(j)};return this.#w=Q,this.#y=$,{signal:Q.signal,finish:$}}#KJ(){this.#y?.(!1),this.#w?.abort(),this.#w=null,this.#y=null}}z("fig-canvas-control",o);class U extends HTMLElement{#Z=[U.#F()];#Q=0;#J=2;#B=240;#_=120;#P={min:-1,max:1};#X=null;#$=null;#j=null;#G=null;#Y=0;#M=null;#k=null;#N=null;#U=null;#q=[];#O=[];#L=[];#S=[];#z=new Set;#K=null;#H=null;#C=null;#T=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#F(J="sine"){return{type:J,frequency:1,amplitude:1,phase:0,offset:0}}static get observedAttributes(){return["value","precision","aspect-ratio","edit","disabled"]}connectedCallback(){this.#J=this.#R("precision",2),this.#y(this.getAttribute("value")),this.#w(),this.#x(),this.#UJ()}disconnectedCallback(){if(this.#qJ(),this.#PJ(),this.#K)this.#K.disconnect(),this.#K=null}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#y(Z),this.isConnected)this.#x();return}if(J==="precision"){if(this.#J=this.#R("precision",2),this.isConnected)this.#b();return}if(J==="aspect-ratio"){if(this.#w(),this.#$)this.#l();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#x()}}get value(){return JSON.stringify(this.data)}set value(J){this.setAttribute("value",typeof J==="object"&&J!==null?JSON.stringify(J):J)}get data(){return{waves:this.#Z.map((J)=>this.#i(J))}}get preset(){let J=this.#E;return U.TYPES.find((Q)=>Q.value===J.type)?.name}#R(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#g(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}#D(){return this.getAttribute("edit")!=="false"}#W(){return this.#g("disabled",!1)}#w(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#y(J){if(!J)return!1;let Q=null;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}else if(typeof J==="object")Q=J;if(!Q)return!1;let Z=Array.isArray(Q)?Q:Array.isArray(Q.waves)?Q.waves:[Q];if(this.#Z=Z.map(($)=>this.#f($)),!this.#Z.length)this.#Z=[U.#F()];return this.#Q=Math.min(this.#Q,this.#Z.length-1),!0}#f(J={}){return{type:this.#V(J.type),frequency:this.#I(J.frequency,1,0.1,16),amplitude:this.#I(J.amplitude,1,-4,4),phase:this.#I(J.phase,0,-360,360),offset:this.#I(J.offset,0,-4,4)}}#i(J){return{type:J.type,frequency:this.#h(J.frequency),amplitude:this.#h(J.amplitude),phase:this.#h(J.phase),offset:this.#h(J.offset)}}get#E(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||U.#F()}#V(J){let Q=String(J||"").toLowerCase();return U.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#I(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#h(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#A(J){return String(J).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}static#m(J){return U.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static waveIcon(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let Y=X/32,B=U.#o(J,Y),G=5+Y*j,k=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${G.toFixed(1)},${k.toFixed(1)}`}return`<svg width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}" fill="none"><path d="${_}" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>`}static#o(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(_)}}#x(){this.#qJ(),this.#PJ(),this.innerHTML=this.#QJ(),this.#_J(),this.#u(),this.#l(),this.#RJ(),this.#YJ()}#QJ(){let J=this.#D()&&!this.#W(),Q=J?"":" disabled";return`<div class="propskit-oscillator-svg-container">
2
2
  <svg viewBox="0 0 ${this.#B} ${this.#_}" class="propskit-oscillator-svg">
3
3
  <rect class="propskit-oscillator-bounds" x="0" y="0" width="${this.#B}" height="${this.#_}"></rect>
4
4
  <line class="propskit-oscillator-baseline"></line>
package/fig-lab.js CHANGED
@@ -1977,9 +1977,6 @@ class PropskitSlider extends HTMLElement {
1977
1977
 
1978
1978
  #handleElasticPointerDown(event) {
1979
1979
  if (event.button !== 0 || figLabBooleanAttribute(this, "disabled")) return;
1980
- if (!event.target?.closest?.("fig-input-number, fig-menu")) {
1981
- this.#queueRangeFocus();
1982
- }
1983
1980
  if (this.getAttribute("elastic") === "false") return;
1984
1981
  if (event.target?.closest?.("fig-input-number")) return;
1985
1982
  const rangeInput =
@@ -2031,8 +2028,12 @@ class PropskitSlider extends HTMLElement {
2031
2028
  ) {
2032
2029
  return;
2033
2030
  }
2031
+ const shouldFocus =
2032
+ event?.type === "pointerup" ||
2033
+ (event?.type === "pointermove" && event.buttons === 0);
2034
2034
  this.#stopElasticTracking();
2035
2035
  this.#resetElasticPull();
2036
+ if (shouldFocus) this.#queueRangeFocus();
2036
2037
  }
2037
2038
 
2038
2039
  #stopElasticTracking() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "6.23.1",
3
+ "version": "6.23.3",
4
4
  "description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
5
5
  "author": "Rogie King",
6
6
  "license": "MIT",