builder-settings-types 0.0.405 → 0.0.407
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ef="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Un=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=ef[r[t]&63];return e};function tf(t){let e=0,r=t.parentElement;for(;r;)r.classList.contains("setting-group")&&r!==t&&e++,r=r.parentElement;return e}function Dn(t,e){const r=Math.min(Math.max(e,0),5);t.setAttribute("data-nesting-level",r.toString()),r>0?t.style.setProperty("--visual-indent",`${r*2}px`):(t.style.removeProperty("--visual-indent"),t.style.marginLeft="")}function Ni(t,e=0){t.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(a=>{const n=a,i=e+1;Dn(n,i),Ni(n,i)})}const rf={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class af{constructor(e={}){this.observedElements=new Set,this.config={...rf,...e},this.config.enableAutoDetection&&this.setupAutoDetection()}setupAutoDetection(){this.observer=new MutationObserver(e=>{let r=!1;e.forEach(a=>{a.type==="childList"&&a.addedNodes.forEach(n=>{n instanceof HTMLElement&&(n.classList.contains("setting-group")?[n]:Array.from(n.querySelectorAll(".setting-group"))).length>0&&(r=!0)})}),r&&this.updateAllNesting()}),this.observer.observe(document.body,{childList:!0,subtree:!0})}trackElement(e){this.observedElements.add(e),this.updateElementNesting(e)}untrackElement(e){this.observedElements.delete(e)}updateElementNesting(e){const r=tf(e);this.applyNestingWithConfig(e,r)}updateAllNesting(){this.observedElements.forEach(e=>{e.isConnected?this.updateElementNesting(e):this.observedElements.delete(e)})}applyNestingWithConfig(e,r){const a=Math.min(Math.max(r,0),this.config.maxLevel);if(e.setAttribute("data-nesting-level",a.toString()),a>0){const n=a*this.config.visualIndentMultiplier;e.style.setProperty("--visual-indent",`${n}px`)}else e.style.removeProperty("--visual-indent"),e.style.marginLeft=""}recalculateNesting(e=document.body){e.querySelectorAll(".setting-group").forEach(a=>{const n=a;this.updateElementNesting(n),this.trackElement(n)})}getNestingStats(){const e={};return this.observedElements.forEach(r=>{const a=parseInt(r.getAttribute("data-nesting-level")||"0",10);e[a]=(e[a]||0)+1}),e}destroy(){this.observer&&(this.observer.disconnect(),this.observer=void 0),this.observedElements.clear()}}const Ys=new af;function Hn(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array)return t.map(e=>Hn(e));if(typeof t=="object"){const e={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=Hn(t[r]));return e}return t}function nf(t){switch(t){case"number":return 0;case"text":return"";case"select":return null;case"color":return"#000000";case"date":return new Date().toISOString().split("T")[0];case"button":return"";default:return""}}const lt=class lt{constructor(e={}){this.props=e,this.dataPropsPath="",this.id=e.id||Un(),this.value=this.props.default,this.desktop=this.props.default,this.title=e.title||"",this.includeGetJson=e.includeGetJson!==void 0?e.includeGetJson:!0}static SetUploadUrl(e){globalThis.DefaultUploadUrl=e,lt.DefaultUploadUrl=e}static SetDefaultLanguage(e){globalThis.DefaultLanguage=e,lt.DefaultLanguage=e}static CurrentLanguage(e){return e!==void 0&&(lt.currentLanguage=e,lt.currentLanguageExplicitlySet=!0,lt.languageChangeCallbacks.forEach(r=>r(e))),lt.currentLanguage||lt.DefaultLanguage}static HasExplicitCurrentLanguage(){return lt.currentLanguageExplicitlySet}static onLanguageChange(e){return lt.languageChangeCallbacks.add(e),()=>{lt.languageChangeCallbacks.delete(e)}}static SetGlobalVariables(e){lt.GlobalVariables={...lt.GlobalVariables,...e}}destroy(){throw new Error("Method not implemented.")}setOnChange(e){return this.onChange=e,this}setOnBlur(e){return this.onBlur=e,this}setDataPropsPath(e){this.dataPropsPath=e}getDataPropsPath(){return this.dataPropsPath}setComponentPath(e){}setValue(e){console.log("📤 [setValue]",this.title||this.id,":",this.value,"→",e),this.value=e,this.inputEl&&(this.inputEl.value=String(e)),this.onChange&&this.onChange(e),this.props.detectChange&&this.props.detectChange(e)}clone(){const e=this.constructor,r=Hn(this.props),a=new e(r);return a.value=Hn(this.value),a}createInput(e){e={...this.props.inputProps,...e};const r=document.createElement("div");if(r.className=e.wrapperClassName||"",e.title||e.icon){const o=document.createElement("div");if(o.className="icon-container",e.icon){const l=this.createIcon(e.icon,e.iconClassName);o.appendChild(l)}if(e.title){const l=this.createLabel(e.title,e.labelClassName);o.appendChild(l)}r.appendChild(o)}const a=document.createElement("div");a.className=e.wrapperClassName||"";const n=document.createElement("input");this.inputEl=n,n.value=String(e.value||nf(e.inputType)),n.type=e.inputType,n.placeholder=e.placeholder||"",n.className=e.inputClassName||"",this.dataPropsPath&&n.setAttribute("data-test-id",this.dataPropsPath);const i=o=>{const l=o.target;let c=l.value;switch(e.inputType){case"number":c=Number(l.value);break;case"color":c=l.value;break;case"date":c=l.value;break;case"select":c=l.value;break;case"text":c=l.value;break;case"button":c=l.value;break;default:c=l.value}this.value=c,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},s=o=>{o.target,this.onBlur&&this.onBlur(this.value)};return n.addEventListener("input",i),n.addEventListener("change",i),n.addEventListener("blur",s),e.inputCustomizer&&e.inputCustomizer(n),a.appendChild(n),r.appendChild(a),r}createLabel(e,r){const a=document.createElement("span");return a.textContent=e,a.className="input-label "+(r||""),a}createIcon(e,r){const a=document.createElement("span");return a.className="input-icon "+(r||""),a.innerHTML=e,a}};lt.currentLanguageExplicitlySet=!1,lt.languageChangeCallbacks=new Set,lt.GlobalVariables={primary:"#1B1958",secondary:"#0D0938",tertiary:"#2A1560",accent:"#189541","text-dark":"#00141E","text-light":"#FFFFFF"},lt.GlobalVariableGroups=[{title:"Global Colors",keys:["primary","secondary","tertiary","accent"]},{title:"Text Color",keys:["text-dark","text-light"]}];let Le=lt;function dr(t){return t instanceof Le}function $e(t){return t instanceof ir}function Mi(t){return dr(t)||$e(t)}const Qi=(t,e,r)=>{let a=!1,n=0,i=0,s=0,o=0;const l=h=>{if(h.target.closest("button"))return;a=!0,n=h.clientX,i=h.clientY;const u=e.getBoundingClientRect();s=u.left,o=u.top,document.addEventListener("mousemove",c),document.addEventListener("mouseup",f),document.body.style.userSelect="none"},c=h=>{if(!a)return;const u=h.clientX-n,p=h.clientY-i,m=window.innerWidth,d=window.innerHeight,g=e.offsetWidth,x=e.offsetHeight;let w=s+u,v=o+p;w=Math.max(8,Math.min(m-g-8,w)),v=Math.max(8,Math.min(d-x-8,v)),e.style.left=`${w}px`,e.style.top=`${v}px`,r==null||r(w,v)},f=()=>{a=!1,document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",f),document.body.style.userSelect=""};t.addEventListener("mousedown",l)},ta=t=>{if(!t)return null;let e=t.trim();return!e.startsWith("#")||(e=e.slice(1),e.length===3&&(e=e.split("").map(r=>r+r).join("")),!/^[0-9a-fA-F]{6}$/.test(e))?null:`#${e.toUpperCase()}`},Rn=(t,e,r)=>`#${[t,e,r].map(a=>Math.max(0,Math.min(255,a)).toString(16).padStart(2,"0")).join("")}`,Pt=t=>{const e=t.replace("#",""),r=e.length===3?e.split("").map(a=>a+a).join(""):e;return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}},ya=t=>{const{r:e,g:r,b:a}=Pt(t),n=e/255,i=r/255,s=a/255,o=Math.max(n,i,s),l=Math.min(n,i,s),c=o-l;let f=0;c!==0&&(o===n?f=(i-s)/c%6:o===i?f=(s-n)/c+2:f=(n-i)/c+4),f<0&&(f+=6);const h=o===0?0:c/o,u=o;return{h:f*60,s:h,v:u}},ka=(t,e,r)=>{const a=(t%360+360)%360,n=r*e,i=n*(1-Math.abs(a/60%2-1)),s=r-n;let o=0,l=0,c=0;return a<60?(o=n,l=i,c=0):a<120?(o=i,l=n,c=0):a<180?(o=0,l=n,c=i):a<240?(o=0,l=i,c=n):a<300?(o=i,l=0,c=n):(o=n,l=0,c=i),Rn(Math.round((o+s)*255),Math.round((l+s)*255),Math.round((c+s)*255))},m0=(t,e,r)=>{const a=r*(1-e/2),n=a===0||a===1?0:(r-a)/Math.min(a,1-a);return{hue:t,sat:n,lightness:a}},Oi=(t,e,r)=>{const a=(1-Math.abs(2*r-1))*e,n=a*(1-Math.abs(t/60%2-1)),i=r-a/2;let s=0,o=0,l=0;return t<60?(s=a,o=n,l=0):t<120?(s=n,o=a,l=0):t<180?(s=0,o=a,l=n):t<240?(s=0,o=n,l=a):t<300?(s=n,o=0,l=a):(s=a,o=0,l=n),{r:Math.round((s+i)*255),g:Math.round((o+i)*255),b:Math.round((l+i)*255)}},Pi=(t,e)=>{const r=Math.max(0,Math.min(100,e))/100;if(t.startsWith("#")){const{r:n,g:i,b:s}=Pt(t);return`rgba(${n}, ${i}, ${s}, ${r})`}if(t.startsWith("rgba("))return t.replace(/,\s*[\d.]+\)$/,`, ${r})`);if(t.startsWith("rgb("))return t.replace("rgb(","rgba(").replace(")",`, ${r})`);if(t.startsWith("hsl(")){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const{r:i,g:s,b:o}=Oi(parseInt(n[1]),parseInt(n[2])/100,parseInt(n[3])/100);return`rgba(${i}, ${s}, ${o}, ${r})`}}if(t.startsWith("hsla(")){const n=t.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);if(n){const{r:i,g:s,b:o}=Oi(parseInt(n[1]),parseInt(n[2])/100,parseInt(n[3])/100);return`rgba(${i}, ${s}, ${o}, ${r})`}}const a=ta(t);if(a){const{r:n,g:i,b:s}=Pt(a);return`rgba(${n}, ${i}, ${s}, ${r})`}return t},sf=t=>["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy","maroon","olive","aqua","silver","teal","fuchsia","transparent"].includes(t.toLowerCase()),g0=t=>[/^#[0-9a-fA-F]{3,8}$/,/^rgba?\s*\([^)]+\)$/,/^hsla?\s*\([^)]+\)$/,/^[a-zA-Z]+$/].some(r=>r.test(t.trim())),of=t=>{if(typeof document>"u")return g0(t)||!!ta(t);const e=document.createElement("div");return e.style.color=t,e.style.color!==""},x0=t=>{const e=t.trim();if(/^#[0-9A-Fa-f]{8}$/.test(e)){const i=e.slice(1),s=parseInt(i.slice(0,2),16),o=parseInt(i.slice(2,4),16),l=parseInt(i.slice(4,6),16),c=parseInt(i.slice(6,8),16);return{color:Rn(s,o,l),position:0,opacity:Math.round(c/255*100)}}const r=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(r){const i=parseInt(r[1]),s=parseInt(r[2]),o=parseInt(r[3]),l=r[4]?parseFloat(r[4]):1;return{color:Rn(i,s,o),position:0,opacity:Math.round(l*100)}}const a=e.match(/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/);if(a){const{r:i,g:s,b:o}=Oi(parseFloat(a[1]),parseFloat(a[2])/100,parseFloat(a[3])/100),l=a[4]?parseFloat(a[4]):1;return{color:Rn(i,s,o),position:0,opacity:Math.round(l*100)}}return{color:ta(e)||e,position:0,opacity:100}},Js=t=>{const e=[];let r="",a=0;for(let n=0;n<t.length;n++){const i=t[n];if(i==="(")a++;else if(i===")")a--;else if(i===","&&a===0){e.push(r.trim()),r="";continue}r+=i}return r.trim()&&e.push(r.trim()),e},qs=(t,e)=>{const r=new RegExp(`${e}\\s*\\(`,"i"),a=t.match(r);if(!a)return null;const n=a.index+a[0].length;let i=1,s=n;for(let o=n;o<t.length&&i>0;o++)t[o]==="("?i++:t[o]===")"&&i--,s=o;return i===0?t.substring(n,s):null},lf=t=>{const e=t.split(" ")[0].toLowerCase();return["circle","ellipse","closest-side","closest-corner","farthest-side","farthest-corner","at","contain","cover"].includes(e)?!1:/^#[0-9a-f]{3,8}$/i.test(e)||/^rgb/i.test(t)||/^hsl/i.test(t)||sf(e)},Zs=t=>{const e=[];return t.forEach((r,a)=>{const n=r.trim();if(!n)return;let i="",s=0;const o=n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);o&&g0(o[1].trim())?(i=o[1].trim(),s=parseFloat(o[2])):(i=n,s=t.length===1?0:a/(t.length-1)*100);const l=x0(i);l.position=Math.max(0,Math.min(100,Math.round(s))),e.push(l)}),e},Cr=t=>{const e=t.stops&&t.stops.length?t.stops:[{color:"#000000",position:0,opacity:100}];return{type:t.type&&["linear","radial","solid"].includes(t.type)?t.type:"linear",angle:typeof t.angle=="number"?t.angle:90,stops:e.map((r,a)=>({color:r.color||"#000000",position:typeof r.position=="number"?r.position:e.length===1?0:Math.round(a/(e.length-1)*100),opacity:r.opacity===void 0||Number.isNaN(r.opacity)?100:r.opacity}))}},Nt=t=>{const e=t.replace(/;$/,"").trim();if(of(e)){const n=x0(e);return Cr({type:"solid",angle:0,stops:[n]})}const r=qs(e,"linear-gradient");if(r){const n=Js(r);let i=90,s=n;const o=n[0];if(o.includes("deg")){const c=o.match(/(-?\d+(?:\.\d+)?)deg/);c&&(i=parseFloat(c[1]),s=n.slice(1))}else o.includes("to ")&&(i={"to right":90,"to left":270,"to bottom":180,"to top":0,"to bottom right":135,"to bottom left":225,"to top right":45,"to top left":315}[o]??90,s=n.slice(1));const l=Zs(s);return l.length?Cr({type:"linear",angle:i,stops:l}):null}const a=qs(e,"radial-gradient");if(a){const n=Js(a),i=n[0]&&!lf(n[0])?n.slice(1):n,s=Zs(i);return s.length?Cr({type:"radial",angle:0,stops:s}):null}return null},qt=t=>{if(t.type==="solid"){const r=t.stops[0],a=r.color;if(a.startsWith("var(--"))return a;const n=r.opacity??100,i=a.replace("#",""),s=Math.round(n/100*255).toString(16).toUpperCase().padStart(2,"0");return`#${i}${s}`}const e=t.stops.map(r=>`${Pi(r.color,r.opacity??100)} ${r.position}%`).join(", ");return t.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${t.angle}deg, ${e})`},cf=t=>Math.round(t/100*255).toString(16).toUpperCase().padStart(2,"0"),Bn=t=>{if(t.type==="solid"){const e=t.stops[0];if(e){const r=e.color;if(r.startsWith("var(--"))return r.replace("var(--","").replace(")","").split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ");r.toUpperCase();const a=e.opacity??100;if(a===100)return r;{const n=cf(a);return`${r}${n}`}}return"#000000"}return t.type==="linear"?`Linear ${t.angle}°`:"Radial Gradient"},Za=class Za{static defaults(){return{solid:[],gradient:[]}}static normalizeList(e){const r=new Set,a=[];return e.forEach(n=>{let i=ta(n);i||Nt(n)&&(i=n),i&&(r.has(i)||(r.add(i),a.push(i)))}),a.slice(0,this.MAX_COLORS)}static ensureLoaded(){var e;if(!this.colors&&(this.colors=this.defaults(),!(typeof window>"u")))try{const r=(e=window.sessionStorage)==null?void 0:e.getItem(this.STORAGE_KEY);if(!r)return;const a=JSON.parse(r);if(Array.isArray(a))this.colors.solid=this.normalizeList(a);else if(a&&typeof a=="object"){const n=a;n.solid&&(this.colors.solid=this.normalizeList(n.solid)),n.gradient&&(this.colors.gradient=this.normalizeList(n.gradient))}}catch{this.colors=this.defaults()}}static persist(){var e;if(!(typeof window>"u"))try{(e=window.sessionStorage)==null||e.setItem(this.STORAGE_KEY,JSON.stringify(this.colors||this.defaults()))}catch{}}static list(e){return this.ensureLoaded(),this.colors||(this.colors=this.defaults()),this.colors[e]}static getColors(e){if(e==="all"){const r=this.list("solid"),a=this.list("gradient"),n=[],i=Math.max(r.length,a.length);for(let s=0;s<i;s++)s<r.length&&n.push(r[s]),s<a.length&&n.push(a[s]);return this.normalizeList(n)}return[...this.list(e)]}static addColor(e,r){if(!e)return;let a=ta(e),n="solid";if(a)n="solid";else{const l=Nt(e);l&&(a=e,n=l.type==="solid"?"solid":"gradient")}if(!a)return;const i=r==="all"?n:r,s=this.list(i),o=s.indexOf(a);o!==-1&&s.splice(o,1),s.unshift(a),s.length>this.MAX_COLORS&&(s.length=this.MAX_COLORS),this.persist()}};Za.STORAGE_KEY="settingsLib_recentColors",Za.MAX_COLORS=18,Za.colors=null;let ra=Za;const es=(t,e)=>{const r=document.createElement("div");r.className="color-picker-recent-section";const a=document.createElement("div");a.className="color-picker-recent-title",a.textContent="Recently Used";const n=document.createElement("div");n.className="color-picker-tooltip",n.style.display="none",r.appendChild(n);const i=()=>{n.style.display="none"},s=(f,h)=>{const u=f.getBoundingClientRect();n.textContent=h,n.style.left=`${u.left+u.width/2}px`,n.style.top=`${u.bottom+8}px`,n.style.display="block"},o=document.createElement("div");o.className="color-picker-recent-grid";const l=document.createElement("div");l.className="color-picker-recent-placeholder",l.textContent="No recent colors yet",r.appendChild(a),r.appendChild(o),r.appendChild(l);const c=()=>{i(),o.innerHTML="";const f=ra.getColors(e);if(f.length===0){o.style.display="none",l.style.display="block";return}o.style.display="grid",l.style.display="none",f.forEach(h=>{const u=document.createElement("button");u.type="button",u.className="color-picker-recent-swatch";const p=ff(h);if(u.title=p,u.setAttribute("aria-label",`Use color: ${p}`),h.includes("gradient(")){u.style.backgroundImage=h,u.style.backgroundColor="transparent";const d=Nt(h);d&&d.stops&&d.stops.length>0&&(u.style.borderColor=d.stops[0].color)}else u.style.backgroundColor=h,u.style.borderColor=h;u.addEventListener("mouseenter",()=>s(u,p)),u.addEventListener("mouseleave",()=>{i(),u.style.boxShadow=""}),u.addEventListener("mousedown",()=>{u.style.boxShadow="0px 0px 0px 2px var(--grey40)"}),u.addEventListener("mouseup",()=>{setTimeout(()=>{u.style.boxShadow=""},150)}),u.addEventListener("click",()=>{i(),t(h)}),o.appendChild(u)})};return c(),{container:r,refresh:c}},ff=t=>{const e=Nt(t);if(e)return Bn(e);const r=ta(t);if(r){const a=Pt(r);return`${r} (RGB: ${a.r}, ${a.g}, ${a.b})`}return t},v0=`<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ef="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Un=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=ef[r[t]&63];return e};function tf(t){let e=0,r=t.parentElement;for(;r;)r.classList.contains("setting-group")&&r!==t&&e++,r=r.parentElement;return e}function Dn(t,e){const r=Math.min(Math.max(e,0),5);t.setAttribute("data-nesting-level",r.toString()),r>0?t.style.setProperty("--visual-indent",`${r*2}px`):(t.style.removeProperty("--visual-indent"),t.style.marginLeft="")}function Ni(t,e=0){t.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach(a=>{const n=a,i=e+1;Dn(n,i),Ni(n,i)})}const rf={maxLevel:5,spacingMultiplier:1,visualIndentMultiplier:2,enableAutoDetection:!0};class af{constructor(e={}){this.observedElements=new Set,this.config={...rf,...e},this.config.enableAutoDetection&&this.setupAutoDetection()}setupAutoDetection(){this.observer=new MutationObserver(e=>{let r=!1;e.forEach(a=>{a.type==="childList"&&a.addedNodes.forEach(n=>{n instanceof HTMLElement&&(n.classList.contains("setting-group")?[n]:Array.from(n.querySelectorAll(".setting-group"))).length>0&&(r=!0)})}),r&&this.updateAllNesting()}),this.observer.observe(document.body,{childList:!0,subtree:!0})}trackElement(e){this.observedElements.add(e),this.updateElementNesting(e)}untrackElement(e){this.observedElements.delete(e)}updateElementNesting(e){const r=tf(e);this.applyNestingWithConfig(e,r)}updateAllNesting(){this.observedElements.forEach(e=>{e.isConnected?this.updateElementNesting(e):this.observedElements.delete(e)})}applyNestingWithConfig(e,r){const a=Math.min(Math.max(r,0),this.config.maxLevel);if(e.setAttribute("data-nesting-level",a.toString()),a>0){const n=a*this.config.visualIndentMultiplier;e.style.setProperty("--visual-indent",`${n}px`)}else e.style.removeProperty("--visual-indent"),e.style.marginLeft=""}recalculateNesting(e=document.body){e.querySelectorAll(".setting-group").forEach(a=>{const n=a;this.updateElementNesting(n),this.trackElement(n)})}getNestingStats(){const e={};return this.observedElements.forEach(r=>{const a=parseInt(r.getAttribute("data-nesting-level")||"0",10);e[a]=(e[a]||0)+1}),e}destroy(){this.observer&&(this.observer.disconnect(),this.observer=void 0),this.observedElements.clear()}}const Ys=new af;function Hn(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array)return t.map(e=>Hn(e));if(typeof t=="object"){const e={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=Hn(t[r]));return e}return t}function nf(t){switch(t){case"number":return 0;case"text":return"";case"select":return null;case"color":return"#000000";case"date":return new Date().toISOString().split("T")[0];case"button":return"";default:return""}}const lt=class lt{constructor(e={}){this.props=e,this.dataPropsPath="",this.id=e.id||Un(),this.value=this.props.default,this.desktop=this.props.default,this.title=e.title||"",this.includeGetJson=e.includeGetJson!==void 0?e.includeGetJson:!0}static SetUploadUrl(e){globalThis.DefaultUploadUrl=e,lt.DefaultUploadUrl=e}static SetDefaultLanguage(e){globalThis.DefaultLanguage=e,lt.DefaultLanguage=e}static CurrentLanguage(e){return e!==void 0&&(lt.currentLanguage=e,lt.currentLanguageExplicitlySet=!0,lt.languageChangeCallbacks.forEach(r=>r(e))),lt.currentLanguage||lt.DefaultLanguage}static HasExplicitCurrentLanguage(){return lt.currentLanguageExplicitlySet}static onLanguageChange(e){return lt.languageChangeCallbacks.add(e),()=>{lt.languageChangeCallbacks.delete(e)}}static SetGlobalVariables(e){lt.GlobalVariables={...lt.GlobalVariables,...e}}destroy(){throw new Error("Method not implemented.")}setOnChange(e){return this.onChange=e,this}setOnBlur(e){return this.onBlur=e,this}setDataPropsPath(e){this.dataPropsPath=e}getDataPropsPath(){return this.dataPropsPath}setComponentPath(e){}setValue(e){this.value=e,this.inputEl&&(this.inputEl.value=String(e)),this.onChange&&this.onChange(e),this.props.detectChange&&this.props.detectChange(e)}clone(){const e=this.constructor,r=Hn(this.props),a=new e(r);return a.value=Hn(this.value),a}createInput(e){e={...this.props.inputProps,...e};const r=document.createElement("div");if(r.className=e.wrapperClassName||"",e.title||e.icon){const o=document.createElement("div");if(o.className="icon-container",e.icon){const l=this.createIcon(e.icon,e.iconClassName);o.appendChild(l)}if(e.title){const l=this.createLabel(e.title,e.labelClassName);o.appendChild(l)}r.appendChild(o)}const a=document.createElement("div");a.className=e.wrapperClassName||"";const n=document.createElement("input");this.inputEl=n,n.value=String(e.value||nf(e.inputType)),n.type=e.inputType,n.placeholder=e.placeholder||"",n.className=e.inputClassName||"",this.dataPropsPath&&n.setAttribute("data-test-id",this.dataPropsPath);const i=o=>{const l=o.target;let c=l.value;switch(e.inputType){case"number":c=Number(l.value);break;case"color":c=l.value;break;case"date":c=l.value;break;case"select":c=l.value;break;case"text":c=l.value;break;case"button":c=l.value;break;default:c=l.value}this.value=c,this.onChange&&this.onChange(this.value),this.props.detectChange&&this.props.detectChange(this.value)},s=o=>{o.target,this.onBlur&&this.onBlur(this.value)};return n.addEventListener("input",i),n.addEventListener("change",i),n.addEventListener("blur",s),e.inputCustomizer&&e.inputCustomizer(n),a.appendChild(n),r.appendChild(a),r}createLabel(e,r){const a=document.createElement("span");return a.textContent=e,a.className="input-label "+(r||""),a}createIcon(e,r){const a=document.createElement("span");return a.className="input-icon "+(r||""),a.innerHTML=e,a}};lt.currentLanguageExplicitlySet=!1,lt.languageChangeCallbacks=new Set,lt.GlobalVariables={primary:"#1B1958",secondary:"#0D0938",tertiary:"#2A1560",accent:"#189541","text-dark":"#00141E","text-light":"#FFFFFF"},lt.GlobalVariableGroups=[{title:"Global Colors",keys:["primary","secondary","tertiary","accent"]},{title:"Text Color",keys:["text-dark","text-light"]}];let Le=lt;function dr(t){return t instanceof Le}function $e(t){return t instanceof ir}function Mi(t){return dr(t)||$e(t)}const Qi=(t,e,r)=>{let a=!1,n=0,i=0,s=0,o=0;const l=h=>{if(h.target.closest("button"))return;a=!0,n=h.clientX,i=h.clientY;const u=e.getBoundingClientRect();s=u.left,o=u.top,document.addEventListener("mousemove",c),document.addEventListener("mouseup",f),document.body.style.userSelect="none"},c=h=>{if(!a)return;const u=h.clientX-n,p=h.clientY-i,m=window.innerWidth,d=window.innerHeight,g=e.offsetWidth,x=e.offsetHeight;let w=s+u,v=o+p;w=Math.max(8,Math.min(m-g-8,w)),v=Math.max(8,Math.min(d-x-8,v)),e.style.left=`${w}px`,e.style.top=`${v}px`,r==null||r(w,v)},f=()=>{a=!1,document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",f),document.body.style.userSelect=""};t.addEventListener("mousedown",l)},ta=t=>{if(!t)return null;let e=t.trim();return!e.startsWith("#")||(e=e.slice(1),e.length===3&&(e=e.split("").map(r=>r+r).join("")),!/^[0-9a-fA-F]{6}$/.test(e))?null:`#${e.toUpperCase()}`},Rn=(t,e,r)=>`#${[t,e,r].map(a=>Math.max(0,Math.min(255,a)).toString(16).padStart(2,"0")).join("")}`,Pt=t=>{const e=t.replace("#",""),r=e.length===3?e.split("").map(a=>a+a).join(""):e;return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}},ya=t=>{const{r:e,g:r,b:a}=Pt(t),n=e/255,i=r/255,s=a/255,o=Math.max(n,i,s),l=Math.min(n,i,s),c=o-l;let f=0;c!==0&&(o===n?f=(i-s)/c%6:o===i?f=(s-n)/c+2:f=(n-i)/c+4),f<0&&(f+=6);const h=o===0?0:c/o,u=o;return{h:f*60,s:h,v:u}},ka=(t,e,r)=>{const a=(t%360+360)%360,n=r*e,i=n*(1-Math.abs(a/60%2-1)),s=r-n;let o=0,l=0,c=0;return a<60?(o=n,l=i,c=0):a<120?(o=i,l=n,c=0):a<180?(o=0,l=n,c=i):a<240?(o=0,l=i,c=n):a<300?(o=i,l=0,c=n):(o=n,l=0,c=i),Rn(Math.round((o+s)*255),Math.round((l+s)*255),Math.round((c+s)*255))},m0=(t,e,r)=>{const a=r*(1-e/2),n=a===0||a===1?0:(r-a)/Math.min(a,1-a);return{hue:t,sat:n,lightness:a}},Oi=(t,e,r)=>{const a=(1-Math.abs(2*r-1))*e,n=a*(1-Math.abs(t/60%2-1)),i=r-a/2;let s=0,o=0,l=0;return t<60?(s=a,o=n,l=0):t<120?(s=n,o=a,l=0):t<180?(s=0,o=a,l=n):t<240?(s=0,o=n,l=a):t<300?(s=n,o=0,l=a):(s=a,o=0,l=n),{r:Math.round((s+i)*255),g:Math.round((o+i)*255),b:Math.round((l+i)*255)}},Pi=(t,e)=>{const r=Math.max(0,Math.min(100,e))/100;if(t.startsWith("#")){const{r:n,g:i,b:s}=Pt(t);return`rgba(${n}, ${i}, ${s}, ${r})`}if(t.startsWith("rgba("))return t.replace(/,\s*[\d.]+\)$/,`, ${r})`);if(t.startsWith("rgb("))return t.replace("rgb(","rgba(").replace(")",`, ${r})`);if(t.startsWith("hsl(")){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const{r:i,g:s,b:o}=Oi(parseInt(n[1]),parseInt(n[2])/100,parseInt(n[3])/100);return`rgba(${i}, ${s}, ${o}, ${r})`}}if(t.startsWith("hsla(")){const n=t.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);if(n){const{r:i,g:s,b:o}=Oi(parseInt(n[1]),parseInt(n[2])/100,parseInt(n[3])/100);return`rgba(${i}, ${s}, ${o}, ${r})`}}const a=ta(t);if(a){const{r:n,g:i,b:s}=Pt(a);return`rgba(${n}, ${i}, ${s}, ${r})`}return t},sf=t=>["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy","maroon","olive","aqua","silver","teal","fuchsia","transparent"].includes(t.toLowerCase()),g0=t=>[/^#[0-9a-fA-F]{3,8}$/,/^rgba?\s*\([^)]+\)$/,/^hsla?\s*\([^)]+\)$/,/^[a-zA-Z]+$/].some(r=>r.test(t.trim())),of=t=>{if(typeof document>"u")return g0(t)||!!ta(t);const e=document.createElement("div");return e.style.color=t,e.style.color!==""},x0=t=>{const e=t.trim();if(/^#[0-9A-Fa-f]{8}$/.test(e)){const i=e.slice(1),s=parseInt(i.slice(0,2),16),o=parseInt(i.slice(2,4),16),l=parseInt(i.slice(4,6),16),c=parseInt(i.slice(6,8),16);return{color:Rn(s,o,l),position:0,opacity:Math.round(c/255*100)}}const r=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);if(r){const i=parseInt(r[1]),s=parseInt(r[2]),o=parseInt(r[3]),l=r[4]?parseFloat(r[4]):1;return{color:Rn(i,s,o),position:0,opacity:Math.round(l*100)}}const a=e.match(/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/);if(a){const{r:i,g:s,b:o}=Oi(parseFloat(a[1]),parseFloat(a[2])/100,parseFloat(a[3])/100),l=a[4]?parseFloat(a[4]):1;return{color:Rn(i,s,o),position:0,opacity:Math.round(l*100)}}return{color:ta(e)||e,position:0,opacity:100}},Js=t=>{const e=[];let r="",a=0;for(let n=0;n<t.length;n++){const i=t[n];if(i==="(")a++;else if(i===")")a--;else if(i===","&&a===0){e.push(r.trim()),r="";continue}r+=i}return r.trim()&&e.push(r.trim()),e},qs=(t,e)=>{const r=new RegExp(`${e}\\s*\\(`,"i"),a=t.match(r);if(!a)return null;const n=a.index+a[0].length;let i=1,s=n;for(let o=n;o<t.length&&i>0;o++)t[o]==="("?i++:t[o]===")"&&i--,s=o;return i===0?t.substring(n,s):null},lf=t=>{const e=t.split(" ")[0].toLowerCase();return["circle","ellipse","closest-side","closest-corner","farthest-side","farthest-corner","at","contain","cover"].includes(e)?!1:/^#[0-9a-f]{3,8}$/i.test(e)||/^rgb/i.test(t)||/^hsl/i.test(t)||sf(e)},Zs=t=>{const e=[];return t.forEach((r,a)=>{const n=r.trim();if(!n)return;let i="",s=0;const o=n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);o&&g0(o[1].trim())?(i=o[1].trim(),s=parseFloat(o[2])):(i=n,s=t.length===1?0:a/(t.length-1)*100);const l=x0(i);l.position=Math.max(0,Math.min(100,Math.round(s))),e.push(l)}),e},Cr=t=>{const e=t.stops&&t.stops.length?t.stops:[{color:"#000000",position:0,opacity:100}];return{type:t.type&&["linear","radial","solid"].includes(t.type)?t.type:"linear",angle:typeof t.angle=="number"?t.angle:90,stops:e.map((r,a)=>({color:r.color||"#000000",position:typeof r.position=="number"?r.position:e.length===1?0:Math.round(a/(e.length-1)*100),opacity:r.opacity===void 0||Number.isNaN(r.opacity)?100:r.opacity}))}},Nt=t=>{const e=t.replace(/;$/,"").trim();if(of(e)){const n=x0(e);return Cr({type:"solid",angle:0,stops:[n]})}const r=qs(e,"linear-gradient");if(r){const n=Js(r);let i=90,s=n;const o=n[0];if(o.includes("deg")){const c=o.match(/(-?\d+(?:\.\d+)?)deg/);c&&(i=parseFloat(c[1]),s=n.slice(1))}else o.includes("to ")&&(i={"to right":90,"to left":270,"to bottom":180,"to top":0,"to bottom right":135,"to bottom left":225,"to top right":45,"to top left":315}[o]??90,s=n.slice(1));const l=Zs(s);return l.length?Cr({type:"linear",angle:i,stops:l}):null}const a=qs(e,"radial-gradient");if(a){const n=Js(a),i=n[0]&&!lf(n[0])?n.slice(1):n,s=Zs(i);return s.length?Cr({type:"radial",angle:0,stops:s}):null}return null},qt=t=>{if(t.type==="solid"){const r=t.stops[0],a=r.color;if(a.startsWith("var(--"))return a;const n=r.opacity??100,i=a.replace("#",""),s=Math.round(n/100*255).toString(16).toUpperCase().padStart(2,"0");return`#${i}${s}`}const e=t.stops.map(r=>`${Pi(r.color,r.opacity??100)} ${r.position}%`).join(", ");return t.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${t.angle}deg, ${e})`},cf=t=>Math.round(t/100*255).toString(16).toUpperCase().padStart(2,"0"),Bn=t=>{if(t.type==="solid"){const e=t.stops[0];if(e){const r=e.color;if(r.startsWith("var(--"))return r.replace("var(--","").replace(")","").split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ");r.toUpperCase();const a=e.opacity??100;if(a===100)return r;{const n=cf(a);return`${r}${n}`}}return"#000000"}return t.type==="linear"?`Linear ${t.angle}°`:"Radial Gradient"},Za=class Za{static defaults(){return{solid:[],gradient:[]}}static normalizeList(e){const r=new Set,a=[];return e.forEach(n=>{let i=ta(n);i||Nt(n)&&(i=n),i&&(r.has(i)||(r.add(i),a.push(i)))}),a.slice(0,this.MAX_COLORS)}static ensureLoaded(){var e;if(!this.colors&&(this.colors=this.defaults(),!(typeof window>"u")))try{const r=(e=window.sessionStorage)==null?void 0:e.getItem(this.STORAGE_KEY);if(!r)return;const a=JSON.parse(r);if(Array.isArray(a))this.colors.solid=this.normalizeList(a);else if(a&&typeof a=="object"){const n=a;n.solid&&(this.colors.solid=this.normalizeList(n.solid)),n.gradient&&(this.colors.gradient=this.normalizeList(n.gradient))}}catch{this.colors=this.defaults()}}static persist(){var e;if(!(typeof window>"u"))try{(e=window.sessionStorage)==null||e.setItem(this.STORAGE_KEY,JSON.stringify(this.colors||this.defaults()))}catch{}}static list(e){return this.ensureLoaded(),this.colors||(this.colors=this.defaults()),this.colors[e]}static getColors(e){if(e==="all"){const r=this.list("solid"),a=this.list("gradient"),n=[],i=Math.max(r.length,a.length);for(let s=0;s<i;s++)s<r.length&&n.push(r[s]),s<a.length&&n.push(a[s]);return this.normalizeList(n)}return[...this.list(e)]}static addColor(e,r){if(!e)return;let a=ta(e),n="solid";if(a)n="solid";else{const l=Nt(e);l&&(a=e,n=l.type==="solid"?"solid":"gradient")}if(!a)return;const i=r==="all"?n:r,s=this.list(i),o=s.indexOf(a);o!==-1&&s.splice(o,1),s.unshift(a),s.length>this.MAX_COLORS&&(s.length=this.MAX_COLORS),this.persist()}};Za.STORAGE_KEY="settingsLib_recentColors",Za.MAX_COLORS=18,Za.colors=null;let ra=Za;const es=(t,e)=>{const r=document.createElement("div");r.className="color-picker-recent-section";const a=document.createElement("div");a.className="color-picker-recent-title",a.textContent="Recently Used";const n=document.createElement("div");n.className="color-picker-tooltip",n.style.display="none",r.appendChild(n);const i=()=>{n.style.display="none"},s=(f,h)=>{const u=f.getBoundingClientRect();n.textContent=h,n.style.left=`${u.left+u.width/2}px`,n.style.top=`${u.bottom+8}px`,n.style.display="block"},o=document.createElement("div");o.className="color-picker-recent-grid";const l=document.createElement("div");l.className="color-picker-recent-placeholder",l.textContent="No recent colors yet",r.appendChild(a),r.appendChild(o),r.appendChild(l);const c=()=>{i(),o.innerHTML="";const f=ra.getColors(e);if(f.length===0){o.style.display="none",l.style.display="block";return}o.style.display="grid",l.style.display="none",f.forEach(h=>{const u=document.createElement("button");u.type="button",u.className="color-picker-recent-swatch";const p=ff(h);if(u.title=p,u.setAttribute("aria-label",`Use color: ${p}`),h.includes("gradient(")){u.style.backgroundImage=h,u.style.backgroundColor="transparent";const d=Nt(h);d&&d.stops&&d.stops.length>0&&(u.style.borderColor=d.stops[0].color)}else u.style.backgroundColor=h,u.style.borderColor=h;u.addEventListener("mouseenter",()=>s(u,p)),u.addEventListener("mouseleave",()=>{i(),u.style.boxShadow=""}),u.addEventListener("mousedown",()=>{u.style.boxShadow="0px 0px 0px 2px var(--grey40)"}),u.addEventListener("mouseup",()=>{setTimeout(()=>{u.style.boxShadow=""},150)}),u.addEventListener("click",()=>{i(),t(h)}),o.appendChild(u)})};return c(),{container:r,refresh:c}},ff=t=>{const e=Nt(t);if(e)return Bn(e);const r=ta(t);if(r){const a=Pt(r);return`${r} (RGB: ${a.r}, ${a.g}, ${a.b})`}return t},v0=`<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
3
3
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
4
4
|
fill="#919EAB"/>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
`;class gf{constructor(e,r="gradient"){this.isOpen=!1,this.currentColor="#FF0000",this.currentOpacity=100,this.outsideClick=a=>{if(!this.isOpen)return;const n=a.target;if(this.element.contains(n))return;if(this.backdrop.contains(n)){a.preventDefault(),a.stopPropagation(),this.close(!0);return}const i=document.querySelectorAll(".gstop-color-input, .gstop-color-preview, .gradient-mini-preview");if(Array.from(i).some(l=>l.contains(n)))return;const o=document.querySelector(".gradient-popover");o&&o.contains(n)||(a.preventDefault(),a.stopPropagation(),this.close(!0))},this.keyDown=a=>{if(this.isOpen){if(a.key==="Escape")a.preventDefault(),this.close(!0);else if(a.key==="Enter"){const n=a.target;if(n&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"))return;a.preventDefault(),this.close(!0)}}},this.onChange=e,this.recentScope=r,this.element=this.build(),this.backdrop=this.createBackdrop()}parsePercentage(e){const r=parseFloat(e);return isNaN(r)?0:r/100}build(){const e=document.createElement("div");e.className="custom-color-picker",e.style.display="none";const r=document.createElement("div");r.className="color-picker-header",r.style.cursor="move";const a=document.createElement("span");a.textContent="Color";const n=document.createElement("button");n.className="color-picker-close",n.innerHTML=v0,n.addEventListener("click",()=>this.close(!0)),r.appendChild(a),r.appendChild(n),Qi(r,e);const i=document.createElement("div");i.className="color-picker-area",this.colorArea=i;const s=document.createElement("div");s.className="color-picker-marker",this.colorMarker=s,i.appendChild(s);const o=document.createElement("div");o.className="color-picker-sliders-container";const l=document.createElement("button");l.className="color-picker-eyedropper",l.type="button",l.innerHTML=E0;const c=document.createElement("div");c.className="color-picker-sliders-group";const f=document.createElement("div");f.className="color-picker-hue",this.hueSlider=f;const h=document.createElement("div");h.className="color-picker-hue-marker",this.hueMarker=h,f.appendChild(h);const u=document.createElement("div");u.className="color-picker-opacity",this.opacitySlider=u;const p=document.createElement("div");p.className="color-picker-opacity-marker",this.opacityMarker=p,u.appendChild(p),c.appendChild(f),c.appendChild(u),o.appendChild(l),o.appendChild(c);const m=es(y=>{var P;this.setColor(y),(P=this.onChange)==null||P.call(this,y,this.currentOpacity)},this.recentScope);this.recentSectionRefresh=m.refresh;const d=document.createElement("div");d.className="color-picker-format-section";const g=document.createElement("select");g.className="color-picker-format-select",this.select=g;const x=document.createElement("option");x.value="hex",x.textContent="HEX";const w=document.createElement("option");w.value="rgb",w.textContent="RGB";const v=document.createElement("option");v.value="hsl",v.textContent="HSL",g.appendChild(x),g.appendChild(w),g.appendChild(v);const F=document.createElement("input");F.type="text",F.className="color-picker-color-input",F.value=this.currentColor,this.input=F;const N=document.createElement("div");N.className="color-picker-input-container";const A=document.createElement("button");return A.className="color-picker-copy-inside",A.textContent="Copy",N.appendChild(F),N.appendChild(A),d.appendChild(g),d.appendChild(N),e.appendChild(r),e.appendChild(i),e.appendChild(o),e.appendChild(m.container),e.appendChild(d),e.addEventListener("click",y=>y.stopPropagation()),this.bind(i,f,u,F,g,A,l),e}createBackdrop(){const e=document.createElement("div");return e.className="color-picker-backdrop",e.style.display="none",e.style.pointerEvents="none",e}bind(e,r,a,n,i,s,o){const l=h=>{var w;const u=e.getBoundingClientRect(),p=Math.max(0,Math.min(1,(h.clientX-u.left)/u.width)),m=Math.max(0,Math.min(1,(h.clientY-u.top)/u.height));this.colorMarker.style.left=`${p*100}%`,this.colorMarker.style.top=`${m*100}%`;const g=this.parsePercentage(this.hueMarker.style.left||"0%")*360,x=ka(g,p,1-m);this.currentColor=x,this.syncInput(),this.updateOpacityBg(),(w=this.onChange)==null||w.call(this,x,this.currentOpacity)},c=h=>{var w;const u=r.getBoundingClientRect();let p=Math.max(0,Math.min(1,(h.clientX-u.left)/u.width));this.hueMarker.style.left=`${p*100}%`;const m=p*360,d=this.parsePercentage(this.colorMarker.style.left||"0%"),g=this.parsePercentage(this.colorMarker.style.top||"0%"),x=ka(m,d,1-g);this.currentColor=x,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${m}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),(w=this.onChange)==null||w.call(this,x,this.currentOpacity)},f=h=>{var m;const u=a.getBoundingClientRect(),p=Math.max(0,Math.min(1,(h.clientX-u.left)/u.width));this.opacityMarker.style.left=`${p*100}%`,this.currentOpacity=Math.round(p*100),(m=this.onChange)==null||m.call(this,this.currentColor,this.currentOpacity)};e.addEventListener("mousedown",h=>{h.preventDefault(),l(h);const u=m=>l(m),p=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",p)}),r.addEventListener("mousedown",h=>{h.preventDefault(),c(h);const u=m=>c(m),p=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",p)}),a.addEventListener("mousedown",h=>{h.preventDefault(),f(h);const u=m=>f(m),p=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",p)}),i.addEventListener("change",()=>this.syncInput()),n.addEventListener("input",()=>this.applyFromInput()),n.addEventListener("blur",()=>this.syncInput()),n.addEventListener("keydown",h=>{h.key==="Enter"&&(h.preventDefault(),this.syncInput(),n.blur())}),s.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(n.value)}catch{n.select(),document.execCommand("copy")}}),o.addEventListener("click",async()=>{var h;if(!("EyeDropper"in window)){alert("EyeDropper API is not supported in this browser.");return}try{const u=new window.EyeDropper,{sRGBHex:p}=await u.open();this.setColor(p),(h=this.onChange)==null||h.call(this,p,this.currentOpacity)}catch{}}),document.addEventListener("keydown",this.keyDown,!0),setTimeout(()=>document.addEventListener("click",this.outsideClick,!0),0)}setColor(e){var s;this.currentColor=e;const{h:r,s:a,v:n}=ya(e),i=r>=360?r%360:r;this.hueMarker.style.left=`${i/360*100}%`,this.colorMarker.style.left=`${a*100}%`,this.colorMarker.style.top=`${(1-n)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${i}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),(s=this.onChange)==null||s.call(this,e,this.currentOpacity)}syncInput(){const e=this.select.value,{h:r,s:a,v:n}=ya(this.currentColor);if(e==="hex")this.input.value=this.currentColor;else if(e==="rgb"){const{r:i,g:s,b:o}=Pt(this.currentColor);this.input.value=`rgb(${i}, ${s}, ${o})`}else{const{hue:i,sat:s,lightness:o}=m0(r,a,n);this.input.value=`hsl(${Math.round(i)}, ${Math.round(s*100)}%, ${Math.round(o*100)}%)`}}applyFromInput(){const e=this.input.value.trim();let r="";if(/^#[0-9A-Fa-f]{6}$/.test(e))r=e;else{const a=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(a){const n=parseInt(a[1]),i=parseInt(a[2]),s=parseInt(a[3]);n<=255&&i<=255&&s<=255&&(r=`#${[n,i,s].map(o=>o.toString(16).padStart(2,"0")).join("")}`)}else{const n=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const i=parseInt(n[1]),s=parseInt(n[2])/100,o=parseInt(n[3])/100,l=o+s*Math.min(o,1-o),c=l===0?0:2*(1-o/l);r=ka(i,c,l)}}}r&&this.setColor(r)}updateOpacityBg(){const{r:e,g:r,b:a}=Pt(this.currentColor);this.opacitySlider.style.setProperty("--base-color",`rgb(${e}, ${r}, ${a})`),this.opacitySlider.style.setProperty("--base-color-transparent",`rgba(${e}, ${r}, ${a}, 0)`)}open(e,r,a){var v;this.currentColor=e,this.currentOpacity=a??100,this.syncInput();const{h:n,s:i,v:s}=ya(e);this.hueMarker.style.left=`${n/360*100}%`,this.colorMarker.style.left=`${i*100}%`,this.colorMarker.style.top=`${(1-s)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`,this.updateOpacityBg(),this.opacityMarker.style.left=`${this.currentOpacity}%`,(v=this.recentSectionRefresh)==null||v.call(this),this.isOpen=!0,this.backdrop.style.display="block",this.backdrop.parentElement||document.body.appendChild(this.backdrop),this.element.style.display="block",this.element.style.position="fixed",this.element.style.zIndex="10002",this.element.style.left="-9999px",this.element.style.top="0px",this.element.parentElement||document.body.appendChild(this.element);const o=this.element.offsetWidth,l=this.element.offsetHeight,c=r.getBoundingClientRect(),f=window.innerWidth,h=window.innerHeight,u=16;let p=c.right+8,m=c.top;const d=f-c.right,g=c.left;d>=o+u?p=c.right+8:g>=o+u?p=c.left-o-8:p=Math.max(u,(f-o)/2);const x=h-c.bottom,w=c.top;x>=l+u?m=c.bottom+8:w>=l+u?m=c.top-l-8:x>w?(m=c.bottom+8,m+l>h-u&&(m=h-l-u)):(m=c.top-l-8,m<u&&(m=u)),this.element.style.left=`${p}px`,this.element.style.top=`${m}px`}close(e){var r;this.isOpen&&(this.isOpen=!1,this.backdrop.style.display="none",this.element.style.display="none",document.removeEventListener("click",this.outsideClick,!0),document.removeEventListener("keydown",this.keyDown,!0),e&&this.onChange&&this.recentScope==="solid"&&(ra.addColor(this.currentColor,this.recentScope),(r=this.recentSectionRefresh)==null||r.call(this)))}setOnChange(e){this.onChange=e}getIsOpen(){return this.isOpen}getElement(){return this.element}}class xf{constructor(e){this.isDragging=!1,this.currentColor="#FFFFFF",this.currentColor=this.sanitizeColor(e.initialColor),this.currentOpacity=this.clampOpacity(e.initialOpacity),this.onColorChange=e.onColorChange,this.recentScope=e.scope??"solid",this.element=this.build(),this.initFromColor(this.currentColor,this.currentOpacity)}parsePercentage(e){const r=parseFloat(e);return isNaN(r)?0:r/100}sanitizeColor(e){const r=this.currentColor||"#FFFFFF";return ta(e)??r}clampOpacity(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.round(e))):100}build(){const e=document.createElement("div");e.className="embedded-color-picker";const r=document.createElement("div");r.className="color-picker-area embedded",this.colorArea=r;const a=document.createElement("div");a.className="color-picker-marker",this.colorMarker=a,r.appendChild(a);const n=document.createElement("div");n.className="color-picker-sliders-container embedded";const i=document.createElement("button");i.className="color-picker-eyedropper",i.type="button",i.innerHTML=E0;const s=document.createElement("div");s.className="color-picker-sliders-group";const o=document.createElement("div");o.className="color-picker-hue embedded",this.hueSlider=o;const l=document.createElement("div");l.className="color-picker-hue-marker",this.hueMarker=l,o.appendChild(l);const c=document.createElement("div");c.className="color-picker-opacity embedded",this.opacitySlider=c;const f=document.createElement("div");f.className="color-picker-opacity-marker",this.opacityMarker=f,c.appendChild(f),s.appendChild(o),s.appendChild(c),n.appendChild(i),n.appendChild(s);const h=es(F=>{const N=Nt(F);N&&N.type!=="solid"?this.onColorChange(F,this.currentOpacity):(this.setColor(F),this.onColorChange(this.currentColor,this.currentOpacity))},"all");this.recentSectionRefresh=h.refresh;const u=document.createElement("div");u.className="color-picker-format-section embedded";const p=document.createElement("select");p.className="color-picker-format-select",this.select=p;const m=document.createElement("option");m.value="hex",m.textContent="HEX";const d=document.createElement("option");d.value="rgb",d.textContent="RGB";const g=document.createElement("option");g.value="hsl",g.textContent="HSL",p.appendChild(m),p.appendChild(d),p.appendChild(g);const x=document.createElement("input");x.type="text",x.className="color-picker-color-input",this.input=x;const w=document.createElement("div");w.className="color-picker-input-container";const v=document.createElement("button");return v.className="color-picker-copy-inside",v.textContent="Copy",w.appendChild(x),w.appendChild(v),u.appendChild(p),u.appendChild(w),e.appendChild(r),e.appendChild(n),e.appendChild(u),e.appendChild(h.container),this.bind(r,o,c,x,p,v,i),e}bind(e,r,a,n,i,s,o){const l=(u,p)=>{const m=p||e.getBoundingClientRect(),d=Math.max(0,Math.min(1,(u.clientX-m.left)/m.width)),g=Math.max(0,Math.min(1,(u.clientY-m.top)/m.height));this.colorMarker.style.left=`${d*100}%`,this.colorMarker.style.top=`${g*100}%`;const w=this.parsePercentage(this.hueMarker.style.left||"0%")*360,v=ka(w,d,1-g);this.currentColor=v,this.syncInput(),this.updateOpacityBg(),this.queueChange()},c=(u,p)=>{const m=p||r.getBoundingClientRect(),d=Math.max(0,Math.min(1,(u.clientX-m.left)/m.width));this.hueMarker.style.left=`${d*100}%`;const g=d*360,x=this.parsePercentage(this.colorMarker.style.left||"0%"),w=this.parsePercentage(this.colorMarker.style.top||"0%"),v=ka(g,x,1-w);this.currentColor=v,this.colorArea.style.background=`linear-gradient(to top, #000, transparent),
|
|
24
24
|
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg(),this.queueChange()},f=(u,p)=>{const m=p||a.getBoundingClientRect(),d=Math.max(0,Math.min(1,(u.clientX-m.left)/m.width));this.opacityMarker.style.left=`${d*100}%`,this.currentOpacity=this.clampOpacity(d*100),this.queueChange()},h=(u,p,m)=>{u.preventDefault(),this.isDragging=!0,this.cachedRect=m.getBoundingClientRect(),p(u,this.cachedRect);let d=null,g;const x=()=>{this.dragRafId===void 0&&(this.dragRafId=window.requestAnimationFrame(()=>{this.dragRafId=void 0,d&&this.cachedRect&&p(d,this.cachedRect)}))},w=()=>{this.isDragging&&(this.isDragging=!1,this.dragRafId!==void 0&&(cancelAnimationFrame(this.dragRafId),this.dragRafId=void 0),this.cachedRect=void 0,d=null,this.flushChange(),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",w),window.removeEventListener("blur",w),this.applyPendingExternal())};g=v=>{if(!v.buttons){w();return}d=v,x()},document.addEventListener("mousemove",g),document.addEventListener("mouseup",w),window.addEventListener("blur",w)};e.addEventListener("mousedown",u=>{h(u,l,e)}),r.addEventListener("mousedown",u=>{h(u,c,r)}),a.addEventListener("mousedown",u=>{h(u,f,a)}),i.addEventListener("change",()=>{this.syncInput()}),n.addEventListener("input",()=>{this.applyFromInput()}),n.addEventListener("blur",()=>{this.syncInput()}),n.addEventListener("keydown",u=>{u.key==="Enter"&&(u.preventDefault(),this.syncInput(),n.blur())}),s.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(n.value)}catch{n.select(),document.execCommand("copy")}}),o.addEventListener("click",async()=>{if(!("EyeDropper"in window)){alert("EyeDropper API is not supported in this browser.");return}try{const u=new window.EyeDropper,{sRGBHex:p}=await u.open();this.setColor(p),this.onColorChange(this.currentColor,this.currentOpacity)}catch{}})}setColor(e){const r=this.sanitizeColor(e);this.currentColor=r;const{h:a,s:n,v:i}=ya(r),s=a>=360?a%360:a;this.hueMarker.style.left=`${s/360*100}%`,this.colorMarker.style.left=`${n*100}%`,this.colorMarker.style.top=`${(1-i)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent),
|
|
25
25
|
linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`,this.syncInput(),this.updateOpacityBg()}syncInput(){const e=this.select.value,{h:r,s:a,v:n}=ya(this.currentColor);if(e==="hex")this.input.value=this.currentColor;else if(e==="rgb"){const{r:i,g:s,b:o}=Pt(this.currentColor);this.input.value=`rgb(${i}, ${s}, ${o})`}else{const{hue:i,sat:s,lightness:o}=m0(r,a,n);this.input.value=`hsl(${Math.round(i)}, ${Math.round(s*100)}%, ${Math.round(o*100)}%)`}}applyFromInput(){const e=this.input.value.trim();let r="";if(/^#[0-9A-Fa-f]{6}$/.test(e))r=e;else{const a=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(a){const n=parseInt(a[1],10),i=parseInt(a[2],10),s=parseInt(a[3],10);n<=255&&i<=255&&s<=255&&(r="#"+[n,i,s].map(o=>o.toString(16).padStart(2,"0")).join(""))}else{const n=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const i=parseInt(n[1],10),s=parseInt(n[2],10)/100,o=parseInt(n[3],10)/100,l=o+s*Math.min(o,1-o),c=l===0?0:2*(1-o/l);r=ka(i,c,l)}}}r&&(this.setColor(r),this.onColorChange(this.currentColor,this.currentOpacity))}updateOpacityBg(){const{r:e,g:r,b:a}=Pt(this.currentColor);this.opacitySlider.style.setProperty("--base-color",`rgb(${e}, ${r}, ${a})`),this.opacitySlider.style.setProperty("--base-color-transparent",`rgba(${e}, ${r}, ${a}, 0)`)}queueChange(){this.changeRafId===void 0&&(this.changeRafId=window.requestAnimationFrame(()=>{this.changeRafId=void 0,this.onColorChange(this.currentColor,this.currentOpacity)}))}flushChange(){this.changeRafId!==void 0&&(cancelAnimationFrame(this.changeRafId),this.changeRafId=void 0),this.onColorChange(this.currentColor,this.currentOpacity)}applyPendingExternal(){if(!this.pendingExternalUpdate)return;const{color:e,opacity:r}=this.pendingExternalUpdate;this.pendingExternalUpdate=void 0,this.initFromColor(e,r)}initFromColor(e,r){var l;const a=this.sanitizeColor(e);this.currentColor=a,this.currentOpacity=this.clampOpacity(r);const{h:n,s:i,v:s}=ya(a),o=n>=360?n%360:n;this.hueMarker.style.left=`${o/360*100}%`,this.colorMarker.style.left=`${i*100}%`,this.colorMarker.style.top=`${(1-s)*100}%`,this.colorArea.style.background=`linear-gradient(to top, #000, transparent),
|
|
26
|
-
linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`,this.opacityMarker.style.left=`${this.currentOpacity}%`,this.updateOpacityBg(),this.syncInput(),(l=this.recentSectionRefresh)==null||l.call(this)}commitRecentColor(){var e;this.recentScope==="solid"&&(ra.addColor(this.currentColor,this.recentScope),(e=this.recentSectionRefresh)==null||e.call(this))}getElement(){return this.element}updateColor(e,r){if(this.isDragging){this.pendingExternalUpdate={color:e,opacity:r};return}this.initFromColor(e,r)}}const Qt=class Qt extends Le{constructor(e={}){const r=typeof e.default=="string"?void 0:e.default;super({...e,title:e.title||"Color",default:r}),this.inputType={type:"text",angle:"number",stops:"text"},this.element=null,this.previewEl=null,this.inputEl=void 0,this.popoverEl=null,this.backdropEl=null,this.isPopoverOpen=!1,this.isEditing=!1,this.popoverPosition=null,this.previewUpdateTimeout=null,this.changeDebounceTimeout=null,this.solidPicker=null,this.pendingSolidColor=null,this.sharedStopColorPicker=null,this.colorPickerStopIndex=null,this.variant="default",this.globalLayoutMode="list",this.globalSearchQuery="",this.currentMode="custom",this.linkedGlobalVariable=null,this.unlinkButton=null,this.onBackgroundClick=a=>{var u;if(!this.popoverEl||!this.isPopoverOpen)return;const n=a.target,i=this.popoverEl.contains(n),s=(u=this.element)==null?void 0:u.contains(n),o=document.querySelectorAll(".custom-color-picker"),l=Array.from(o).some(p=>p.contains(n)),c=n.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"),f=n.classList.contains("color-picker-backdrop"),h=n.classList.contains("gradient-popover-backdrop");!i&&!s&&!l&&!c&&!f&&!h&&this.closePopover()},this.handlePopoverKeydown=a=>{var n,i;if(this.isPopoverOpen){if(a.key==="Escape"){if(a.preventDefault(),(n=this.sharedStopColorPicker)!=null&&n.getIsOpen()){this.sharedStopColorPicker.close(!1),this.colorPickerStopIndex=null;return}this.closePopover();return}if(a.key==="Enter"){const s=a.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"))return;if(a.preventDefault(),(i=this.sharedStopColorPicker)!=null&&i.getIsOpen()){this.sharedStopColorPicker.close(!0),this.colorPickerStopIndex=null;return}this.closePopover()}}},this.detectChange=e.detectChange,this.variant=e.variant??"default",this.originalDefault=e.default,this.value=this.defaultValue(),this.setLinkedGlobalVariableFrom(this.originalDefault??this.value)}resolveGlobalVarColor(e){if(e.startsWith("var(--")){const r=e.replace("var(--","").replace(")","");return(Le.GlobalVariables||{})[r]||e}return e}getSharedStopColorPicker(){return this.sharedStopColorPicker||(this.sharedStopColorPicker=new gf(void 0,"solid")),this.sharedStopColorPicker}setLinkedGlobalVariableFrom(e){var a,n;if(!e){this.linkedGlobalVariable=null;return}const r=typeof e=="string"?e:((n=(a=e.stops)==null?void 0:a[0])==null?void 0:n.color)??null;this.linkedGlobalVariable=r&&r.startsWith("var(--")?r:null}isBoundToGlobal(){return!!this.linkedGlobalVariable}clearGlobalBindingForCustomChange(){var e,r;this.isBoundToGlobal()&&((r=(e=this.value)==null?void 0:e.stops)!=null&&r.length&&(this.value.stops=this.value.stops.map(a=>({...a,color:this.resolveGlobalVarColor(a.color)}))),this.linkedGlobalVariable=null,this.updateUnlinkButtonVisibility())}breakGlobalBinding(){var e;!this.isBoundToGlobal()||!this.value||((e=this.value.stops)!=null&&e.length&&(this.value.stops=this.value.stops.map(r=>({...r,color:this.resolveGlobalVarColor(r.color)}))),this.linkedGlobalVariable=null,this.updateUI(),this.triggerChange(),this.isPopoverOpen&&this.refreshPopoverContent())}defaultValue(){const e=this.originalDefault;if(typeof e=="string"){if(e.startsWith("var(--"))return Cr({type:"solid",angle:0,stops:[{color:e,position:0,opacity:100}]});const a=Nt(e);if(a)return Cr(a)}return Cr(e&&typeof e=="object"?e:{type:"linear",angle:90,stops:[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]})}setValue(e){let r=null;typeof e=="string"?e.startsWith("var(--")?r=Cr({type:"solid",angle:0,stops:[{color:e,position:0,opacity:100}]}):r=Nt(e):e&&typeof e=="object"&&(r=Cr(e)),r||(r=this.defaultValue()),this.value=r,this.setLinkedGlobalVariableFrom(e??r),this.updateUI(),this.isPopoverOpen&&this.refreshPopoverContent(),this.triggerChange(),this.pendingSolidColor=null,this.updateUnlinkButtonVisibility()}updateUI(){if(this.previewEl&&this.value)if(this.value.type==="solid"){const e=this.value.stops[0],r=e.opacity??100,a=this.resolveGlobalVarColor(e.color);this.previewEl.style.background=Pi(a,r)}else{const e=this.resolveGradientGlobalVars(this.value);this.previewEl.style.background=qt(e)}if(this.inputEl&&this.value&&!this.isEditing)if(this.isBoundToGlobal()&&this.linkedGlobalVariable){const r=this.linkedGlobalVariable.replace("var(--","").replace(")","").split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ");this.inputEl.value=`Linked: ${r}`}else this.inputEl.value=Bn(this.value);this.updateUnlinkButtonVisibility()}resolveGradientGlobalVars(e){return{...e,stops:e.stops.map(r=>({...r,color:this.resolveGlobalVarColor(r.color)}))}}updateUnlinkButtonVisibility(){if(!this.unlinkButton)return;const e=this.isBoundToGlobal();e?this.unlinkButton.classList.add("visible"):this.unlinkButton.classList.remove("visible"),this.previewEl&&(e?this.previewEl.classList.add("bound"):this.previewEl.classList.remove("bound"))}cssForTextValue(){return this.value?{background:qt(this.value),"-webkit-background-clip":"text","background-clip":"text",color:"transparent","-webkit-text-fill-color":"transparent"}:{}}draw(){const e=document.createElement("div");if(e.className="gradient-setting-wrapper",this.props.title){const a=document.createElement("div");a.className="icon-container";const n=document.createElement("span");n.className="input-label",n.textContent=this.props.title,a.appendChild(n),e.appendChild(a)}const r=document.createElement("div");return r.className="gradient-input-wrapper",this.previewEl=document.createElement("div"),this.previewEl.className="gradient-mini-preview",this.previewEl.style.background=this.value?qt(this.value):"linear-gradient(90deg, #a84b4b 0%, #786666 100%)",this.previewEl.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.openPopover()}),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className="gradient-text-input",this.inputEl.placeholder="Enter gradient CSS or paste color...",this.inputEl.value=this.value?Bn(this.value):"",this.inputEl.readOnly=!1,this.inputEl.addEventListener("focus",()=>{if(this.isEditing=!0,this.value)if(this.value.type==="solid"){const a=this.value.stops[0];if(a){const i=this.resolveGlobalVarColor(a.color).toUpperCase(),s=a.opacity??100;if(s===100)this.inputEl.value=i;else{const l=Math.round(s/100*255).toString(16).toUpperCase().padStart(2,"0");this.inputEl.value=`${i}${l}`}}}else this.inputEl.value=qt(this.value)}),this.inputEl.addEventListener("blur",()=>{this.isEditing=!1,this.value&&(this.inputEl.value=Bn(this.value))}),this.inputEl.addEventListener("paste",a=>this.handlePaste(a)),this.inputEl.addEventListener("input",a=>this.handleTextInput(a)),this.inputEl.addEventListener("keydown",a=>{a.key==="Enter"&&(this.handleTextInput(a),this.inputEl.blur()),a.key==="Escape"&&(this.value&&(this.inputEl.value=qt(this.value)),this.inputEl.blur())}),r.appendChild(this.previewEl),this.unlinkButton=document.createElement("button"),this.unlinkButton.type="button",this.unlinkButton.className="gradient-unlink-button",this.unlinkButton.innerHTML=mf,this.unlinkButton.title="Break global color binding",this.unlinkButton.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.breakGlobalBinding()}),r.appendChild(this.unlinkButton),r.appendChild(this.inputEl),e.appendChild(r),this.createPopover(),this.element=e,this.updateUnlinkButtonVisibility(),e}createPopover(){if(this.popoverEl)return;this.backdropEl=document.createElement("div"),this.backdropEl.className="gradient-popover-backdrop",this.backdropEl.style.display="none",this.backdropEl.style.pointerEvents="none",this.popoverEl=document.createElement("div"),this.popoverEl.className="gradient-popover",this.popoverEl.style.display="none",this.popoverEl.addEventListener("click",l=>{l.stopPropagation()});const e=document.createElement("div");e.className="gradient-popover-header",e.style.cursor="move";let r=null;if(this.variant!=="global"){r=document.createElement("div"),r.className="color-setting-tabs header-tabs";const l=document.createElement("button");l.className="color-tab active",l.textContent="Custom";const c=document.createElement("button");c.className="color-tab",c.textContent="Global",r.appendChild(l),r.appendChild(c),e.appendChild(r)}else{const l=document.createElement("div");e.appendChild(l)}const a=document.createElement("button");a.type="button",a.className="gradient-popover-close",a.innerHTML=v0,a.addEventListener("click",()=>this.closePopover()),e.appendChild(a),Qi(e,this.popoverEl,(l,c)=>{this.popoverPosition={left:l,top:c}});const n=document.createElement("div");n.className="gradient-editor";const i=document.createElement("div");i.className="type-tabs-wrapper";const s=this.createTypeTabs();i.appendChild(s),n.appendChild(i);const o=document.createElement("div");if(o.className="gradient-editor-content",this.updatePopoverContent(o),n.appendChild(o),this.variant!=="global"&&r){const l=r.children[0],c=r.children[1],f=h=>{this.currentMode=h,h==="custom"?(l.classList.add("active"),c.classList.remove("active"),i.style.display="block"):(c.classList.add("active"),l.classList.remove("active"),i.style.display="none"),this.updatePopoverContent(o)};l.addEventListener("click",()=>f("custom")),c.addEventListener("click",()=>f("global")),this.isBoundToGlobal()?(this.currentMode="global",f("global")):(this.currentMode="custom",f("custom"))}this.popoverEl.appendChild(e),this.popoverEl.appendChild(n),document.body.appendChild(this.backdropEl),document.body.appendChild(this.popoverEl)}createTypeTabs(){var n,i;const e=document.createElement("div");e.className="gradient-type-tabs";const r=document.createElement("button");r.type="button",r.className=`gradient-type-tab ${((n=this.value)==null?void 0:n.type)==="solid"?"active":""}`,r.innerHTML=df,r.addEventListener("click",()=>this.switchType("solid"));const a=document.createElement("button");return a.type="button",a.className=`gradient-type-tab ${((i=this.value)==null?void 0:i.type)!=="solid"?"active":""}`,a.innerHTML=pf,a.addEventListener("click",()=>{var o,l;const s=((o=this.value)==null?void 0:o.type)==="solid"?"linear":((l=this.value)==null?void 0:l.type)||"linear";this.switchType(s)}),e.appendChild(r),e.appendChild(a),e}switchType(e,r=!1){var l,c;if(!this.value)return;const a=this.value.type,n=this.isBoundToGlobal(),i=this.linkedGlobalVariable;this.value.type=e;let s=!1;if(n&&i&&a==="solid"!=(e==="solid")){const f=this.resolveGlobalVarColor(i),h=this.value.stops&&this.value.stops[0]?this.value.stops[0].opacity??100:100,u=Nt(f);u&&u.type!=="solid"&&u.stops.length>=2?(this.value.stops=u.stops,this.value.angle=u.angle,this.value.type=u.type,this.linkedGlobalVariable=null,s=!0):((l=this.value.stops)!=null&&l.length&&(this.value.stops=this.value.stops.map(p=>({...p,color:p.color.startsWith("var(--")?this.resolveGlobalVarColor(p.color):p.color}))),!this.value.stops||this.value.stops.length===0?this.value.stops=[{color:f,position:0,opacity:h}]:this.value.stops[0]={...this.value.stops[0],color:f,opacity:h},this.linkedGlobalVariable=null,s=!0)}if(e!=="solid"&&(this.pendingSolidColor=null),e!=="solid"&&(!this.value.stops||this.value.stops.length===0)&&(this.value.stops=[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]),e!=="solid"&&this.value.stops.length===1){const h=this.value.stops[0].color;if(h.startsWith("var(--")){const u=this.resolveGlobalVarColor(h),p=Nt(u);p&&p.type!=="solid"&&p.stops.length>=2?(this.value.stops=p.stops,this.value.angle=p.angle,this.value.type=p.type):(this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90)}else if(h.startsWith("linear-gradient")||h.startsWith("radial-gradient")){const u=Nt(h);u&&u.type!=="solid"&&u.stops.length>=2?(this.value.stops=u.stops,this.value.angle=u.angle,this.value.type=u.type):(this.value.stops=[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}],this.value.angle=90)}else this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90}else if(e!=="solid"&&this.value.stops.length>=2)this.value.angle||(this.value.angle=90);else if(e==="solid"&&n&&i){const f=this.value.stops&&this.value.stops[0]?this.value.stops[0].opacity??100:100;this.value.stops=[{color:i,position:0,opacity:f}],this.value.angle=0}if(this.popoverEl){const f=this.popoverEl.querySelectorAll(".gradient-type-tab");f.forEach(p=>p.classList.remove("active"));const h=f[0],u=f[1];e==="solid"?h==null||h.classList.add("active"):u==null||u.classList.add("active")}const o=(c=this.popoverEl)==null?void 0:c.querySelector(".gradient-editor-content");o&&this.updatePopoverContent(o),this.updateUI(),(r||s||a!==e)&&this.triggerChange()}updatePopoverContent(e){if(e.innerHTML="",!!this.value){if(this.variant!=="global"&&this.currentMode==="global"){this.renderGlobalColors(e);return}this.value.type==="solid"?this.renderSolid(e):this.renderGradient(e)}}renderGlobalColors(e){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const r=this.value.stops[0],a=h=>{h.innerHTML="";let u={};try{u=Le.GlobalVariables||{}}catch(g){console.warn("Could not access Setting.GlobalVariables",g)}if(!u||Object.keys(u).length===0){const g=document.createElement("div");g.textContent="No global colors defined",g.style.fontSize="12px",g.style.color="#666",g.style.padding="8px",h.appendChild(g);return}const p=Le.GlobalVariableGroups||[{title:"Global Colors",keys:["primary","secondary","tertiary","accent"]},{title:"Text Color",keys:["text-dark","text-light"]}],m=this.globalSearchQuery.toLowerCase();let d;this.globalLayoutMode==="list"?(d=document.createElement("div"),d.className="global-colors-list"):(d=document.createElement("div"),d.className="global-colors-grid"),h.appendChild(d),p.forEach(g=>{const x=Object.entries(u).filter(([w])=>!g.keys.includes(w)&&g.title!=="Global Colors"?!1:g.keys.includes(w)&&w.toLowerCase().includes(m));x.length!==0&&x.forEach(([w,v])=>{if(this.globalLayoutMode==="list"){const F=document.createElement("div");F.className="global-color-row";const N=document.createElement("div");N.className="global-color-circle";const A=this.resolveGlobalVarColor(v);N.style.background=A,(this.linkedGlobalVariable===`var(--${w})`||r.color===`var(--${w})`)&&N.classList.add("selected");const P=document.createElement("span");P.className="global-color-label",P.textContent=w.split("-").map(I=>I.charAt(0).toUpperCase()+I.slice(1)).join(" "),F.appendChild(N),F.appendChild(P),F.addEventListener("click",I=>{I.preventDefault();const z=`var(--${w})`;this.setValue(z),this.pendingSolidColor=z,a(h)}),d.appendChild(F)}else{const F=document.createElement("div");F.className="global-color-circle";const N=this.resolveGlobalVarColor(v);F.style.background=N,F.title=w.split("-").map(y=>y.charAt(0).toUpperCase()+y.slice(1)).join(" "),(this.linkedGlobalVariable===`var(--${w})`||r.color===`var(--${w})`)&&F.classList.add("selected"),F.addEventListener("click",y=>{y.preventDefault();const P=`var(--${w})`;this.setValue(P),this.pendingSolidColor=P,a(h)}),d.appendChild(F)}})})},n=document.createElement("div");n.className="global-controls-row";const i=document.createElement("div");i.className="global-search-container";const s=document.createElement("span");s.className="global-search-icon",s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';const o=document.createElement("input");o.type="text",o.className="global-search-input",o.placeholder="Search",o.value=this.globalSearchQuery;const l=document.createElement("div");o.addEventListener("input",h=>{this.globalSearchQuery=h.target.value,a(l)}),i.appendChild(s),i.appendChild(o);const c=document.createElement("button");c.className="global-layout-toggle",c.type="button";const f=()=>{c.innerHTML=this.globalLayoutMode==="list"?'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>'};f(),c.addEventListener("click",()=>{this.globalLayoutMode=this.globalLayoutMode==="list"?"grid":"list",f(),a(l)}),n.appendChild(i),n.appendChild(c),e.appendChild(n),e.appendChild(l),a(l)}renderSolid(e){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const r=this.value.stops[0],a=new xf({initialColor:r.color.startsWith("var(--")?this.resolveGlobalVarColor(r.color):r.color,initialOpacity:r.opacity??100,onColorChange:(n,i)=>{if(this.clearGlobalBindingForCustomChange(),this.value){const s=Nt(n);if(s&&s.type!=="solid"){this.value=s,this.switchType(s.type,!0);return}this.value.stops[0].color=n,this.value.stops[0].opacity=i,this.updateUI(),this.triggerChange(),this.pendingSolidColor=n}}});this.solidPicker=a,e.appendChild(a.getElement())}renderGradient(e){this.solidPicker=null;let r=null;{const f=document.createElement("div");f.className="gradient-subtype-inline";const h=document.createElement("select");h.className="gradient-subtype-select";const u=document.createElement("option");u.value="linear",u.textContent="Linear";const p=document.createElement("option");p.value="radial",p.textContent="Radial",h.appendChild(u),h.appendChild(p),h.value=this.value.type==="radial"?"radial":"linear",r=document.createElement("input"),r.type="text",r.inputMode="numeric",r.className="gradient-degree-input",r.value=`${this.value.angle??90}°`,r.style.width="75px",r.style.textAlign="center",(!this.value.angle||this.value.stops.length<2)&&(this.value.angle=90,r.value="90°");const m=document.createElement("button");m.type="button",m.className="gradient-flip-btn",m.innerHTML=hf,h.addEventListener("change",()=>{this.clearGlobalBindingForCustomChange(),this.switchType(h.value==="radial"?"radial":"linear",!0),r&&this.updateDegreeVisibility(r)}),r.addEventListener("focus",d=>{const g=d.target;g.value=g.value.replace(/[^0-9-]/g,""),setTimeout(()=>g.select(),0)}),r.addEventListener("input",d=>{this.clearGlobalBindingForCustomChange();const g=parseInt(d.target.value);!Number.isNaN(g)&&this.value&&(this.value.angle=Math.max(0,Math.min(360,g)),this.debouncedPreviewUpdate())}),r.addEventListener("blur",d=>{var w;this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const g=d.target;let x=parseInt(g.value);Number.isNaN(x)&&(x=((w=this.value)==null?void 0:w.angle)??0),x=Math.max(0,Math.min(360,x)),this.value&&(this.value.angle=x),g.value=`${x}°`,this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),m.addEventListener("click",()=>{this.clearGlobalBindingForCustomChange(),!(!this.value||!this.value.stops)&&(this.value.stops.forEach(d=>{d.position=100-d.position}),this.value.stops.sort((d,g)=>d.position-g.position),this.updateGradientPreview(a),this.createHandles(n,a),this.updateStopsList(l),this.updateUI(),this.triggerChange())}),f.appendChild(h),f.appendChild(r),f.appendChild(m),e.appendChild(f),this.updateDegreeVisibility(r)}const a=document.createElement("div");a.className="gradient-preview",this.updateGradientPreview(a);const n=document.createElement("div");n.className="gradient-handles",a.appendChild(n),e.appendChild(a),this.createHandles(n,a),a.addEventListener("click",f=>{var d;const h=f.target;if(h.classList.contains("gstop-handle")||h.classList.contains("gstop-chip"))return;const u=a.getBoundingClientRect(),m=(f.clientX-u.left)/u.width*100;this.clearGlobalBindingForCustomChange(),this.addStopAtPosition(m),this.updateStopsList(),this.updateGradientPreview(a),this.createHandles(n,a),this.updateUI(),((d=document.activeElement)==null?void 0:d.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange()});const i=document.createElement("div");i.className="gradient-stops-header";const s=document.createElement("span");s.textContent="Stops";const o=document.createElement("button");o.type="button",o.className="gradient-add-stop",o.textContent="+",i.appendChild(s),i.appendChild(o);const l=document.createElement("div");l.className="gradient-stops",e.appendChild(i),e.appendChild(l),this.updateStopsList(l);const c=es(f=>{const h=Nt(f);h&&(this.clearGlobalBindingForCustomChange(),this.value=h,this.switchType(h.type,!0),this.updateUI(),this.triggerChange())},"all");this.recentGradientRefresh=c.refresh,e.appendChild(c.container),o.addEventListener("click",()=>{var f;this.clearGlobalBindingForCustomChange(),this.addStop(),this.updateStopsList(l),this.updateGradientPreview(a),this.createHandles(n,a),this.updateUI(),((f=document.activeElement)==null?void 0:f.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange()})}updateDegreeVisibility(e){var r;e&&(((r=this.value)==null?void 0:r.type)==="radial"?(e.disabled=!0,e.style.opacity="0.5"):(e.disabled=!1,e.style.opacity="1"))}updateGradientPreview(e){var a;const r=e||((a=this.popoverEl)==null?void 0:a.querySelector(".gradient-preview"));if(r&&this.value)if(this.value.type==="solid")r.style.background=qt(this.value);else{const n=this.value.stops.map(i=>`${Pi(i.color,i.opacity??100)} ${i.position}%`).join(", ");r.style.background=`linear-gradient(90deg, ${n})`}}debouncedPreviewUpdate(e){this.previewUpdateTimeout&&clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=window.setTimeout(()=>{this.updateGradientPreview(e),this.previewUpdateTimeout=null},16)}createHandles(e,r){e.innerHTML="",!(!this.value||this.value.type==="solid"||!this.value.stops)&&this.value.stops.forEach((a,n)=>{const i=document.createElement("div");i.className="gstop-handle",i.style.left=`${Math.max(0,Math.min(100,a.position))}%`,i.style.top="0%";const s=document.createElement("div");s.className="gstop-chip";const o=this.resolveGlobalVarColor(a.color);s.style.backgroundColor=o,i.appendChild(s);let l=!1,c=!1,f=0,h=0;const u=d=>{l=!0,c=!1,f=d.clientX,h=this.value.stops[n].position,i.classList.add("selected"),document.addEventListener("mousemove",p),document.addEventListener("mouseup",m),d.preventDefault(),d.stopPropagation()},p=d=>{if(!l||!this.value)return;const g=d.clientX-f;if(Math.abs(g)>3&&(c=!0),c){this.clearGlobalBindingForCustomChange();const x=r.getBoundingClientRect();let w=h+g/x.width*100;w=Math.max(0,Math.min(100,w)),this.value.stops[n].position=Math.round(w),i.style.left=`${w}%`,this.updateGradientPreview()}},m=d=>{var g;if(l)if(l=!1,i.classList.remove("selected"),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m),c)this.value&&(this.value.stops.sort((x,w)=>x.position-w.position),this.createHandles(e,r),this.updateStopsList()),this.updateUI(),this.triggerChange();else{d.stopPropagation();const x=(g=this.value)==null?void 0:g.stops[n];x&&setTimeout(()=>{const w=this.getSharedStopColorPicker();w.getIsOpen()&&w.close(!1),this.colorPickerStopIndex=n,w.setOnChange((F,N)=>{this.clearGlobalBindingForCustomChange(),this.value&&this.value.stops[n]&&(this.value.stops[n].color=F,N!==void 0&&(this.value.stops[n].opacity=N),s.style.backgroundColor=F,this.updateGradientPreview(),this.updateStopsList(),this.updateUI(),this.triggerChange())});const v=this.resolveGlobalVarColor(x.color);w.open(v,s,x.opacity??100)},0)}};i.addEventListener("mousedown",u),e.appendChild(i)})}updateStopsList(e){var a;const r=e||((a=this.popoverEl)==null?void 0:a.querySelector(".gradient-stops"));!r||!this.value||this.value.type==="solid"||!this.value.stops||(r.innerHTML="",this.value.stops.forEach((n,i)=>{var F,N;const s=document.createElement("div");s.className="gstop-row";const o=document.createElement("div");o.className="gstop-position-group";const l=document.createElement("input");l.type="text",l.className="gstop-position-input",l.value=`${n.position}%`,l.style.width="60px",o.appendChild(l);const c=document.createElement("div");c.className="gstop-color-container";const f=this.resolveGlobalVarColor(n.color),h=document.createElement("div");h.className="gstop-color-preview",h.style.backgroundColor=f;const u=document.createElement("input");u.type="text",u.className="gstop-color-input",u.value=f.replace("#","").toUpperCase();const p=document.createElement("button");p.type="button",p.className="gstop-color-copy",p.textContent="Copy",c.appendChild(h),c.appendChild(u),c.appendChild(p);const m=document.createElement("button");m.type="button",m.className="gstop-del",m.innerHTML=uf,m.disabled=(((N=(F=this.value)==null?void 0:F.stops)==null?void 0:N.length)||0)<=2,s.appendChild(o),s.appendChild(c),s.appendChild(m),r.appendChild(s);const d=document.createElement("span");d.className="gstop-opacity-label",d.textContent="Opacity";const g=document.createElement("div");g.className="gstop-opacity-group";const x=document.createElement("input");x.type="range",x.className="gstop-opacity-slider",x.min="0",x.max="100",x.value=String(n.opacity??100);const w=Pt(f);x.style.setProperty("--slider-color",`rgb(${w.r}, ${w.g}, ${w.b})`),x.style.setProperty("--slider-color-transparent",`rgba(${w.r}, ${w.g}, ${w.b}, 0)`);const v=document.createElement("span");v.className="gstop-opacity-value",v.textContent=`${n.opacity??100}%`,g.appendChild(x),g.appendChild(v),u.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation();const y=this.getSharedStopColorPicker();y.getIsOpen()&&y.close(!1),this.colorPickerStopIndex=i,y.setOnChange((I,z)=>{this.clearGlobalBindingForCustomChange(),u.value=I.replace("#","").toUpperCase(),h.style.backgroundColor=I,this.value.stops[i].color=I,z!==void 0&&(this.value.stops[i].opacity=z,x.value=String(z),v.textContent=`${z}%`);const V=Pt(I);x.style.setProperty("--slider-color",`rgb(${V.r}, ${V.g}, ${V.b})`),x.style.setProperty("--slider-color-transparent",`rgba(${V.r}, ${V.g}, ${V.b}, 0)`),this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateUI(),this.triggerChange()});const P=this.resolveGlobalVarColor(n.color);y.open(P,u,n.opacity??100)}),u.addEventListener("input",()=>{this.clearGlobalBindingForCustomChange();const A=u.value.trim(),y=A.startsWith("#")?A:`#${A}`;if(/^#[0-9A-Fa-f]{6}$/.test(y)){this.value.stops[i].color=y,h.style.backgroundColor=y;const P=Pt(y);x.style.setProperty("--slider-color",`rgb(${P.r}, ${P.g}, ${P.b})`),x.style.setProperty("--slider-color-transparent",`rgba(${P.r}, ${P.g}, ${P.b}, 0)`),this.debouncedPreviewUpdate()}}),u.addEventListener("blur",()=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),p.addEventListener("click",async A=>{A.stopPropagation();try{await navigator.clipboard.writeText(`#${u.value}`)}catch{}}),l.addEventListener("focus",A=>{const y=A.target;y.value=y.value.replace("%",""),y.select()}),l.addEventListener("input",A=>{this.clearGlobalBindingForCustomChange();const y=A.target,P=parseInt(y.value.replace(/[^\d]/g,""),10);if(!Number.isNaN(P)){const I=Math.max(0,Math.min(100,P));this.value.stops[i].position=I,y.value=`${I}%`,this.debouncedPreviewUpdate()}}),l.addEventListener("blur",A=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const y=A.target,P=parseInt(y.value.replace(/[^\d]/g,""),10);if(Number.isNaN(P))y.value=`${this.value.stops[i].position}%`;else{const I=Math.max(0,Math.min(100,P));this.value.stops[i].position=I,y.value=`${I}%`}this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateUI(),this.triggerChange()}),m.addEventListener("click",()=>{var A,y;(this.value.stops.length||0)<=2||((A=this.sharedStopColorPicker)!=null&&A.getIsOpen()&&this.colorPickerStopIndex===i?(this.sharedStopColorPicker.close(!1),this.colorPickerStopIndex=null):this.colorPickerStopIndex!==null&&this.colorPickerStopIndex>i&&this.colorPickerStopIndex--,this.clearGlobalBindingForCustomChange(),this.value.stops.splice(i,1),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateGradientPreview(),this.updateUI(),((y=document.activeElement)==null?void 0:y.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange())}),x.addEventListener("input",()=>{this.clearGlobalBindingForCustomChange();const A=parseInt(x.value,10);this.value.stops[i].opacity=Math.max(0,Math.min(100,A)),v.textContent=`${this.value.stops[i].opacity}%`,this.debouncedPreviewUpdate()}),x.addEventListener("change",()=>{this.clearGlobalBindingForCustomChange(),this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()})}))}addStop(){if(!this.value||this.value.type==="solid"||!this.value.stops)return;const e=this.value.stops.map(n=>n.position).sort((n,i)=>n-i);let r=50,a=0;for(let n=0;n<e.length-1;n++){const i=e[n+1]-e[n];i>a&&(a=i,r=e[n]+i/2)}this.addStopAtPosition(r)}addStopAtPosition(e){if(!this.value||this.value.type==="solid"||!this.value.stops)return;const r=Math.max(0,Math.min(100,e)),a=[...this.value.stops].sort((c,f)=>c.position-f.position);let n=a[0],i=a[a.length-1];for(let c=0;c<a.length-1;c++)if(a[c].position<=r&&a[c+1].position>=r){n=a[c],i=a[c+1];break}let s,o;if(n===i||n.position===i.position)s=n.color,o=n.opacity??100;else{const c=(r-n.position)/(i.position-n.position),f=Pt(n.color),h=Pt(i.color),u=Math.round(f.r+(h.r-f.r)*c),p=Math.round(f.g+(h.g-f.g)*c),m=Math.round(f.b+(h.b-f.b)*c);s=`#${u.toString(16).padStart(2,"0")}${p.toString(16).padStart(2,"0")}${m.toString(16).padStart(2,"0")}`.toUpperCase(),o=Math.round((n.opacity??100)+((i.opacity??100)-(n.opacity??100))*c)}const l={position:Math.round(r),color:s,opacity:o};this.value.stops.push(l),this.value.stops.sort((c,f)=>c.position-f.position)}openPopover(){if(this.popoverEl&&(Qt.openInstance&&Qt.openInstance!==this&&Qt.openInstance.closePopover(),!this.isPopoverOpen)){if(this.isPopoverOpen=!0,Qt.openInstance=this,this.backdropEl&&(this.backdropEl.style.display="block",this.backdropEl.parentElement||document.body.appendChild(this.backdropEl)),this.popoverEl.style.display="flex",this.refreshPopoverContent(),this.element){const e=this.element.getBoundingClientRect(),r=306,a=window.innerWidth,n=window.innerHeight,i=16;this.popoverEl.style.position="fixed",this.popoverEl.style.zIndex="10000",this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const s=this.popoverEl.offsetHeight;let o=e.right+8,l=e.top;const c=a-e.right,f=e.left,h=r+i;c<h&&f>c+100&&(o=e.left-r-8);const u=n-e.bottom,p=e.top;p>=s+i?l=e.top-s-8:u>=s+i?l=e.bottom+8:p>u?(l=e.top-s-8,l<i&&(l=i)):(l=e.bottom+8,l+s>n-i&&(l=n-s-i)),this.popoverEl.style.left=`${o}px`,this.popoverEl.style.top=`${l}px`,this.popoverPosition={left:o,top:l}}setTimeout(()=>document.addEventListener("click",this.onBackgroundClick,!0),200),document.addEventListener("keydown",this.handlePopoverKeydown,!0)}}repositionPopover(){var e;if(!(!this.popoverEl||!this.isPopoverOpen||!this.element)&&((e=document.activeElement)==null?void 0:e.tagName)!=="INPUT"){if(this.popoverPosition){this.popoverEl.style.left=`${this.popoverPosition.left}px`,this.popoverEl.style.top=`${this.popoverPosition.top}px`;return}requestAnimationFrame(()=>{if(!this.popoverEl||!this.element)return;const r=this.element.getBoundingClientRect(),a=306,n=window.innerWidth,i=window.innerHeight,s=16;this.popoverEl.style.left,this.popoverEl.style.top,this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const o=this.popoverEl.offsetHeight;let l=r.right+8,c=r.top;const f=n-r.right,h=r.left,u=a+s;f<u&&h>f+100&&(l=r.left-a-8);const p=i-r.bottom,m=r.top;m>=o+s?c=r.top-o-8:p>=o+s?c=r.bottom+8:m>p?(c=r.top-o-8,c<s&&(c=s)):(c=r.bottom+8,c+o>i-s&&(c=i-o-s)),this.popoverEl.style.left=`${l}px`,this.popoverEl.style.top=`${c}px`})}}refreshPopoverContent(){var i,s;if(!this.popoverEl)return;const e=this.popoverEl.querySelectorAll(".gradient-type-tab");e.forEach(o=>o.classList.remove("active"));const r=e[0],a=e[1];((i=this.value)==null?void 0:i.type)==="solid"?r.classList.add("active"):(a.classList.add("active"),(s=this.recentGradientRefresh)==null||s.call(this)),this.popoverEl.offsetHeight;const n=this.popoverEl.querySelector(".gradient-editor-content");n&&this.updatePopoverContent(n)}closePopover(){var e,r;if(!(!this.popoverEl||!this.isPopoverOpen)){if(this.isPopoverOpen=!1,this.popoverPosition=null,(e=this.sharedStopColorPicker)!=null&&e.getIsOpen()&&(this.sharedStopColorPicker.close(!0),this.colorPickerStopIndex=null),this.backdropEl&&(this.backdropEl.style.display="none"),this.popoverEl.style.display="none",document.removeEventListener("click",this.onBackgroundClick,!0),document.removeEventListener("keydown",this.handlePopoverKeydown,!0),this.commitPendingSolidColor(),this.value&&this.value.type!=="solid"){const a=qt(this.value);ra.addColor(a,"gradient"),(r=this.recentGradientRefresh)==null||r.call(this)}this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),Qt.openInstance===this&&(Qt.openInstance=null)}}commitPendingSolidColor(){this.pendingSolidColor&&(this.solidPicker?this.solidPicker.commitRecentColor():ra.addColor(this.pendingSolidColor,"solid"),this.pendingSolidColor=null)}handlePaste(e){var a;e.preventDefault();const r=((a=e.clipboardData)==null?void 0:a.getData("text"))||"";this.parseAndSet(r)}handleTextInput(e){const r=e.target;this.parseAndSet(r.value)}parseAndSet(e){let r=e.trim();r&&!r.startsWith("#")&&!r.startsWith("var(")&&!r.startsWith("rgb")&&!r.startsWith("hsl")&&!r.includes("gradient")&&/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(r)&&(r="#"+r,this.inputEl&&(this.inputEl.value=r));const a=Nt(r);a&&this.setValue(a)}getChangePayload(){var e;if(this.value)return this.isBoundToGlobal()?((e=this.value.stops)==null?void 0:e.some(a=>a.opacity!==void 0&&a.opacity!==100))?this.resolveGradientGlobalVars(this.value):this.linkedGlobalVariable||void 0:this.value}triggerChange(){const e=this.getChangePayload();e!==void 0&&(this.changeDebounceTimeout&&clearTimeout(this.changeDebounceTimeout),this.changeDebounceTimeout=setTimeout(()=>{var r,a;(r=this.onChange)==null||r.call(this,e),(a=this.detectChange)==null||a.call(this,e),this.changeDebounceTimeout=null},Qt.CHANGE_DEBOUNCE_DELAY))}getElement(){return this.element}getValue(){const e=this.getChangePayload();return e?typeof e=="string"?e:qt(e):""}getCSSValue(){const e=this.getChangePayload();return e?typeof e=="string"?e:qt(e):""}getCSSForText(){return this.value?this.cssForTextValue():{}}getRawValue(){return this.value}};Qt.openInstance=null,Qt.CHANGE_DEBOUNCE_DELAY=150;let aa=Qt;function zr(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const a=t[r];e(r,a)}}function Di(t){if(t==null)return t;if(Array.isArray(t))return t.map(e=>Di(e));if(typeof t=="object"){const e={};for(const[r,a]of Object.entries(t))r!=="$id"&&(e[r]=Di(a));return e}return t}const ni=class ni{constructor(e){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastChangeTime=0,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.dataPropsPath="",this.hide=!1,this.isSettingValue=!1,this.suppressOnChange=!1,console.log("🔨 [SettingsGroup Created]",e.title||"Unnamed Group"),this.suppressOnChange=!0,this.id=e.id||Un(),this.title=e.title,this.settings=e.settings,this.isCollapsed=e.collapsed??!1,this.isMain=e.main??!1,this.custom=e.custom??!1,this.nestingLevel=0,this.includeGetJson=e.includeGetJson??!0,this.addItemCfg=e.addItem,this.deleteItemCfg=e.deleteItem,this.dataProps=e.dataProps,this.dataPropsPath=e.dataProps||"",this.hide=e.hide??!1,Object.assign(this,e.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel(),this.propagateDataPropsPath(),this.propagateComponentPaths(),this.suppressOnChange=!1}propagateNestingLevel(){const e=this.nestingLevel+1;zr(this.settings,(r,a)=>{$e(a)&&(a.nestingLevel=e,a.propagateNestingLevel())})}getNestingLevel(){return this.nestingLevel}setNestingLevel(e){this.nestingLevel=e,this.propagateNestingLevel(),this.elementRef&&this.updateNestingStyles()}setTitle(e){if(this.title=e,this.elementRef){const r=this.elementRef.querySelector(".setting-group-title h3");r&&(r.textContent=e)}}getDataPropsPath(){return this.dataPropsPath}setDataPropsPath(e){this.dataPropsPath=e,this.propagateDataPropsPath()}propagateDataPropsPath(){zr(this.settings,(e,r)=>{const a=String(e),n=this.dataPropsPath?`${this.dataPropsPath}_${a}`:a;($e(r)||dr(r)&&typeof r.setDataPropsPath=="function")&&r.setDataPropsPath(n)})}propagateComponentPaths(e=""){zr(this.settings,(r,a)=>{var i;const n=String(r);if($e(a)){const s=e?`${e} > ${a.title}`:a.title;a.propagateComponentPaths(s)}else if(dr(a)&&typeof a.setComponentPath=="function"){const s=((i=a.props)==null?void 0:i.title)||n,o=e?`${e} > ${s}`:s;a.setComponentPath(o)}})}updateNestingStyles(){this.elementRef&&(Dn(this.elementRef,this.nestingLevel),Ni(this.elementRef,this.nestingLevel))}forceChildUIRefresh(){Object.entries(this.settings).forEach(([e,r])=>{try{if($e(r)){const a=r.getValues();r.setValue(a)}else if(typeof r.setValue=="function"){const a=r.value;a!==void 0&&r.setValue(a)}}catch(a){console.warn(`Error refreshing UI for setting ${e}:`,a)}})}removeSetting(e){var n;const r=this.settings[e];if(!r)return;if(delete this.settings[e],this.elementRef){const i=this.elementRef.querySelector(".setting-group-content");if(i){const s=Array.from(i.querySelectorAll(".setting-group, .setting, [data-setting-id]"));for(const o of s){const l=o.id,c=o.getAttribute("data-setting-id");if(l&&"id"in r&&typeof r.id=="string"&&l.includes(r.id)){o.remove();break}if(c&&"id"in r&&typeof r.id=="string"&&c===r.id){o.remove();break}}}}typeof r.cleanup=="function"&&r.cleanup(),this.updateNestingStyles();const a=this.getValues();this.initialValues=a,this.suppressOnChange||(n=this.onChange)==null||n.call(this,a)}updateVisibility(){this.elementRef}updateSettings(e,r){var l;const a=(r==null?void 0:r.preserveValues)??!0,n=new Set(Object.keys(this.settings)),i=Object.keys(e),s={};a&&i.forEach(c=>{const f=this.settings[c];f&&($e(f)?s[c]=f.getValues():dr(f)?s[c]=f.value:typeof f.getValues=="function"?s[c]=f.getValues():f.value!==void 0&&(s[c]=f.value))}),n.forEach(c=>{i.includes(c)||this.removeSetting(c)}),i.forEach(c=>{var u;const f=e[c],h=this.settings[c];if(h!==f&&(h&&this.removeSetting(c),this.addSetting(c,f),a&&c in s)){const p=s[c];try{$e(f)?f.setValue(p):dr(f)?(u=f.setValue)==null||u.call(f,p):f.setValue&&f.setValue(p)}catch(m){console.warn(`Could not preserve value for setting ${c}:`,m)}}}),this.settings=e,this.propagateNestingLevel(),this.propagateDataPropsPath();const o=this.getValues();this.initialValues=o,this.suppressOnChange||(l=this.onChange)==null||l.call(this,o)}clone(){const e={};zr(this.settings,(n,i)=>{const s=String(n);typeof i.clone=="function"?e[s]=i.clone():(console.warn(`Setting with key '${s}' does not have a clone method. Copying reference.`),e[s]=i)});const r={title:this.title,settings:e,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,includeGetJson:this.includeGetJson,addItem:this.addItemCfg,deleteItem:this.deleteItemCfg,dataProps:this.dataProps,hide:this.hide},a=w0(r);return a.suppressOnChange=!0,a.initialValues=this.getValues(),a.suppressOnChange=!1,a}resetDefault(){const e=this.originalDefaultValues;this.setValue(e),this.onChange&&!this.suppressOnChange&&this.onChange(this.getValues())}setMobileValues(e){!e||typeof e!="object"||(Object.entries(e).forEach(([r,a])=>{const n=this.settings[r];n&&($e(n)||dr(n))&&typeof n.setMobileValue=="function"&&n.setMobileValue(a)}),this.setValue(e),this.onChange&&!this.suppressOnChange&&this.onChange(this.getValues()))}getMobileValues(e){if(e===void 0){const r={};for(const a in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,a)){const n=this.settings[a];if($e(n))r[a]=n.getMobileValues();else{const i=n;r[a]=i.mobileValue!==void 0?i.mobileValue:i.value}}return r}else{const r=this.settings[e];if(!r)return;if($e(r))return r.getMobileValues();const a=r;return a.mobileValue!==void 0?a.mobileValue:a.value}}setOnChange(e){this.onChange=e;const r=()=>{this.isHandlingChange||this.suppressOnChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const a=this.getValues(),n=this.calculateChanges(this.initialValues,a);Object.keys(n).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=a,this.suppressOnChange||e(a),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),zr(this.settings,(a,n)=>{var i;if($e(n))n.setOnChange(()=>{if(this.suppressOnChange)return;const s=this.getValues();this.initialValues=s,e(s)}),this.changeHandlers.add(()=>e(this.getValues()));else if(dr(n)){const s=()=>r();this.changeHandlers.add(s),n.setOnChange(s)}else{const s=()=>r();this.changeHandlers.add(s),(i=n.setOnChange)==null||i.call(n,s)}}),this}cleanup(){this.changeTimeout&&(clearTimeout(this.changeTimeout),this.changeTimeout=null),this.blurTimeout&&(clearTimeout(this.blurTimeout),this.blurTimeout=null),this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.changeHandlers.clear(),zr(this.settings,(e,r)=>{const a=r;try{typeof a.cleanup=="function"?a.cleanup():typeof a.destroy=="function"&&a.destroy()}catch{}})}setValue(e){if(!(!e||typeof e!="object")&&!this.isSettingValue){this.isSettingValue=!0;try{Object.entries(e).forEach(([a,n])=>{let i=this.settings[a];if(!i&&this.addItemCfg&&a.startsWith(this.addItemCfg.keyPrefix)){const s=a.slice(this.addItemCfg.keyPrefix.length),o=Number(s);if(Number.isFinite(o)){const l=this.addItemCfg.createItem(o);Mi(l)&&(this.addSetting(a,l),i=l)}}i&&($e(i)||dr(i))&&typeof i.setValue=="function"&&i.setValue(n)});const r=this.getValues();this.initialValues=r,this.onChange&&!this.suppressOnChange&&this.onChange(r)}finally{this.isSettingValue=!1}}}wireChild(e){var a;const r=()=>{var i;if(this.suppressOnChange)return;const n=this.getValues();this.initialValues=n,(i=this.onChange)==null||i.call(this,n),this.updateVisibility()};$e(e)?e.setOnChange(()=>r()):dr(e)?e.setOnChange(()=>r()):(a=e.setOnChange)==null||a.call(e,()=>r())}addSetting(e,r){var n,i;if(this.settings[e]=r,this.wireChild(r),this.elementRef){const s=this.elementRef.querySelector(".setting-group-content");if(s){const o=s.querySelector(".setting-group-empty");o&&o.remove(),$e(r)&&typeof r.setNestingLevel=="function"&&r.setNestingLevel(this.nestingLevel+1);const l=r.draw(),c=this.deleteItemCfg??this.addItemCfg;if(c){const u=c.keyPrefix??((n=this.addItemCfg)==null?void 0:n.keyPrefix);u&&e.startsWith(u)&&this.addDeleteButtonToElement(l,e)}const f=s.querySelector(".sg-add-button-bottom");f?s.insertBefore(l,f):s.appendChild(l),Ys.trackElement(l),Dn(l,this.nestingLevel+1),Ni(l,this.nestingLevel+1);const h=l.style.display;l.style.display="none",l.offsetHeight,l.style.display=h,this.updateNestingStyles()}}const a=this.getValues();this.initialValues=a,this.suppressOnChange||(i=this.onChange)==null||i.call(this,a)}addDeleteButtonToElement(e,r,a){let n=null;try{n=e.querySelector(":scope > .setting-group-title")}catch{n=null}if(!n){const c=Array.from(e.querySelectorAll(".setting-group-title"));for(const f of c)if(f.closest(".setting-group")===e){n=f;break}n||(n=c[0]??null)}if(!n)return;const i=n.querySelector(".actions-section");if(!i)return;const s=document.createElement("button");s.type="button",s.className="sg-delete-button",a?a.deleteItemCfg:this.deleteItemCfg??this.addItemCfg,s.title="Delete",s.style.cssText=`
|
|
26
|
+
linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`,this.opacityMarker.style.left=`${this.currentOpacity}%`,this.updateOpacityBg(),this.syncInput(),(l=this.recentSectionRefresh)==null||l.call(this)}commitRecentColor(){var e;this.recentScope==="solid"&&(ra.addColor(this.currentColor,this.recentScope),(e=this.recentSectionRefresh)==null||e.call(this))}getElement(){return this.element}updateColor(e,r){if(this.isDragging){this.pendingExternalUpdate={color:e,opacity:r};return}this.initFromColor(e,r)}}const Qt=class Qt extends Le{constructor(e={}){const r=typeof e.default=="string"?void 0:e.default;super({...e,title:e.title||"Color",default:r}),this.inputType={type:"text",angle:"number",stops:"text"},this.element=null,this.previewEl=null,this.inputEl=void 0,this.popoverEl=null,this.backdropEl=null,this.isPopoverOpen=!1,this.isEditing=!1,this.popoverPosition=null,this.previewUpdateTimeout=null,this.changeDebounceTimeout=null,this.solidPicker=null,this.pendingSolidColor=null,this.sharedStopColorPicker=null,this.colorPickerStopIndex=null,this.variant="default",this.globalLayoutMode="list",this.globalSearchQuery="",this.currentMode="custom",this.linkedGlobalVariable=null,this.unlinkButton=null,this.onBackgroundClick=a=>{var u;if(!this.popoverEl||!this.isPopoverOpen)return;const n=a.target,i=this.popoverEl.contains(n),s=(u=this.element)==null?void 0:u.contains(n),o=document.querySelectorAll(".custom-color-picker"),l=Array.from(o).some(p=>p.contains(n)),c=n.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"),f=n.classList.contains("color-picker-backdrop"),h=n.classList.contains("gradient-popover-backdrop");!i&&!s&&!l&&!c&&!f&&!h&&this.closePopover()},this.handlePopoverKeydown=a=>{var n,i;if(this.isPopoverOpen){if(a.key==="Escape"){if(a.preventDefault(),(n=this.sharedStopColorPicker)!=null&&n.getIsOpen()){this.sharedStopColorPicker.close(!1),this.colorPickerStopIndex=null;return}this.closePopover();return}if(a.key==="Enter"){const s=a.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"))return;if(a.preventDefault(),(i=this.sharedStopColorPicker)!=null&&i.getIsOpen()){this.sharedStopColorPicker.close(!0),this.colorPickerStopIndex=null;return}this.closePopover()}}},this.detectChange=e.detectChange,this.variant=e.variant??"default",this.originalDefault=e.default,this.value=this.defaultValue(),this.setLinkedGlobalVariableFrom(this.originalDefault??this.value)}resolveGlobalVarColor(e){if(e.startsWith("var(--")){const r=e.replace("var(--","").replace(")","");return(Le.GlobalVariables||{})[r]||e}return e}getSharedStopColorPicker(){return this.sharedStopColorPicker||(this.sharedStopColorPicker=new gf(void 0,"solid")),this.sharedStopColorPicker}setLinkedGlobalVariableFrom(e){var a,n;if(!e){this.linkedGlobalVariable=null;return}const r=typeof e=="string"?e:((n=(a=e.stops)==null?void 0:a[0])==null?void 0:n.color)??null;this.linkedGlobalVariable=r&&r.startsWith("var(--")?r:null}isBoundToGlobal(){return!!this.linkedGlobalVariable}clearGlobalBindingForCustomChange(){var e,r;this.isBoundToGlobal()&&((r=(e=this.value)==null?void 0:e.stops)!=null&&r.length&&(this.value.stops=this.value.stops.map(a=>({...a,color:this.resolveGlobalVarColor(a.color)}))),this.linkedGlobalVariable=null,this.updateUnlinkButtonVisibility())}breakGlobalBinding(){var e;!this.isBoundToGlobal()||!this.value||((e=this.value.stops)!=null&&e.length&&(this.value.stops=this.value.stops.map(r=>({...r,color:this.resolveGlobalVarColor(r.color)}))),this.linkedGlobalVariable=null,this.updateUI(),this.triggerChange(),this.isPopoverOpen&&this.refreshPopoverContent())}defaultValue(){const e=this.originalDefault;if(typeof e=="string"){if(e.startsWith("var(--"))return Cr({type:"solid",angle:0,stops:[{color:e,position:0,opacity:100}]});const a=Nt(e);if(a)return Cr(a)}return Cr(e&&typeof e=="object"?e:{type:"linear",angle:90,stops:[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]})}setValue(e){let r=null;typeof e=="string"?e.startsWith("var(--")?r=Cr({type:"solid",angle:0,stops:[{color:e,position:0,opacity:100}]}):r=Nt(e):e&&typeof e=="object"&&(r=Cr(e)),r||(r=this.defaultValue()),this.value=r,this.setLinkedGlobalVariableFrom(e??r),this.updateUI(),this.isPopoverOpen&&this.refreshPopoverContent(),this.triggerChange(),this.pendingSolidColor=null,this.updateUnlinkButtonVisibility()}updateUI(){if(this.previewEl&&this.value)if(this.value.type==="solid"){const e=this.value.stops[0],r=e.opacity??100,a=this.resolveGlobalVarColor(e.color);this.previewEl.style.background=Pi(a,r)}else{const e=this.resolveGradientGlobalVars(this.value);this.previewEl.style.background=qt(e)}if(this.inputEl&&this.value&&!this.isEditing)if(this.isBoundToGlobal()&&this.linkedGlobalVariable){const r=this.linkedGlobalVariable.replace("var(--","").replace(")","").split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ");this.inputEl.value=`Linked: ${r}`}else this.inputEl.value=Bn(this.value);this.updateUnlinkButtonVisibility()}resolveGradientGlobalVars(e){return{...e,stops:e.stops.map(r=>({...r,color:this.resolveGlobalVarColor(r.color)}))}}updateUnlinkButtonVisibility(){if(!this.unlinkButton)return;const e=this.isBoundToGlobal();e?this.unlinkButton.classList.add("visible"):this.unlinkButton.classList.remove("visible"),this.previewEl&&(e?this.previewEl.classList.add("bound"):this.previewEl.classList.remove("bound"))}cssForTextValue(){return this.value?{background:qt(this.value),"-webkit-background-clip":"text","background-clip":"text",color:"transparent","-webkit-text-fill-color":"transparent"}:{}}draw(){const e=document.createElement("div");if(e.className="gradient-setting-wrapper",this.props.title){const a=document.createElement("div");a.className="icon-container";const n=document.createElement("span");n.className="input-label",n.textContent=this.props.title,a.appendChild(n),e.appendChild(a)}const r=document.createElement("div");return r.className="gradient-input-wrapper",this.previewEl=document.createElement("div"),this.previewEl.className="gradient-mini-preview",this.previewEl.style.background=this.value?qt(this.value):"linear-gradient(90deg, #a84b4b 0%, #786666 100%)",this.previewEl.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.openPopover()}),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className="gradient-text-input",this.inputEl.placeholder="Enter gradient CSS or paste color...",this.inputEl.value=this.value?Bn(this.value):"",this.inputEl.readOnly=!1,this.inputEl.addEventListener("focus",()=>{if(this.isEditing=!0,this.value)if(this.value.type==="solid"){const a=this.value.stops[0];if(a){const i=this.resolveGlobalVarColor(a.color).toUpperCase(),s=a.opacity??100;if(s===100)this.inputEl.value=i;else{const l=Math.round(s/100*255).toString(16).toUpperCase().padStart(2,"0");this.inputEl.value=`${i}${l}`}}}else this.inputEl.value=qt(this.value)}),this.inputEl.addEventListener("blur",()=>{this.isEditing=!1,this.value&&(this.inputEl.value=Bn(this.value))}),this.inputEl.addEventListener("paste",a=>this.handlePaste(a)),this.inputEl.addEventListener("input",a=>this.handleTextInput(a)),this.inputEl.addEventListener("keydown",a=>{a.key==="Enter"&&(this.handleTextInput(a),this.inputEl.blur()),a.key==="Escape"&&(this.value&&(this.inputEl.value=qt(this.value)),this.inputEl.blur())}),r.appendChild(this.previewEl),this.unlinkButton=document.createElement("button"),this.unlinkButton.type="button",this.unlinkButton.className="gradient-unlink-button",this.unlinkButton.innerHTML=mf,this.unlinkButton.title="Break global color binding",this.unlinkButton.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.breakGlobalBinding()}),r.appendChild(this.unlinkButton),r.appendChild(this.inputEl),e.appendChild(r),this.createPopover(),this.element=e,this.updateUnlinkButtonVisibility(),e}createPopover(){if(this.popoverEl)return;this.backdropEl=document.createElement("div"),this.backdropEl.className="gradient-popover-backdrop",this.backdropEl.style.display="none",this.backdropEl.style.pointerEvents="none",this.popoverEl=document.createElement("div"),this.popoverEl.className="gradient-popover",this.popoverEl.style.display="none",this.popoverEl.addEventListener("click",l=>{l.stopPropagation()});const e=document.createElement("div");e.className="gradient-popover-header",e.style.cursor="move";let r=null;if(this.variant!=="global"){r=document.createElement("div"),r.className="color-setting-tabs header-tabs";const l=document.createElement("button");l.className="color-tab active",l.textContent="Custom";const c=document.createElement("button");c.className="color-tab",c.textContent="Global",r.appendChild(l),r.appendChild(c),e.appendChild(r)}else{const l=document.createElement("div");e.appendChild(l)}const a=document.createElement("button");a.type="button",a.className="gradient-popover-close",a.innerHTML=v0,a.addEventListener("click",()=>this.closePopover()),e.appendChild(a),Qi(e,this.popoverEl,(l,c)=>{this.popoverPosition={left:l,top:c}});const n=document.createElement("div");n.className="gradient-editor";const i=document.createElement("div");i.className="type-tabs-wrapper";const s=this.createTypeTabs();i.appendChild(s),n.appendChild(i);const o=document.createElement("div");if(o.className="gradient-editor-content",this.updatePopoverContent(o),n.appendChild(o),this.variant!=="global"&&r){const l=r.children[0],c=r.children[1],f=h=>{this.currentMode=h,h==="custom"?(l.classList.add("active"),c.classList.remove("active"),i.style.display="block"):(c.classList.add("active"),l.classList.remove("active"),i.style.display="none"),this.updatePopoverContent(o)};l.addEventListener("click",()=>f("custom")),c.addEventListener("click",()=>f("global")),this.isBoundToGlobal()?(this.currentMode="global",f("global")):(this.currentMode="custom",f("custom"))}this.popoverEl.appendChild(e),this.popoverEl.appendChild(n),document.body.appendChild(this.backdropEl),document.body.appendChild(this.popoverEl)}createTypeTabs(){var n,i;const e=document.createElement("div");e.className="gradient-type-tabs";const r=document.createElement("button");r.type="button",r.className=`gradient-type-tab ${((n=this.value)==null?void 0:n.type)==="solid"?"active":""}`,r.innerHTML=df,r.addEventListener("click",()=>this.switchType("solid"));const a=document.createElement("button");return a.type="button",a.className=`gradient-type-tab ${((i=this.value)==null?void 0:i.type)!=="solid"?"active":""}`,a.innerHTML=pf,a.addEventListener("click",()=>{var o,l;const s=((o=this.value)==null?void 0:o.type)==="solid"?"linear":((l=this.value)==null?void 0:l.type)||"linear";this.switchType(s)}),e.appendChild(r),e.appendChild(a),e}switchType(e,r=!1){var l,c;if(!this.value)return;const a=this.value.type,n=this.isBoundToGlobal(),i=this.linkedGlobalVariable;this.value.type=e;let s=!1;if(n&&i&&a==="solid"!=(e==="solid")){const f=this.resolveGlobalVarColor(i),h=this.value.stops&&this.value.stops[0]?this.value.stops[0].opacity??100:100,u=Nt(f);u&&u.type!=="solid"&&u.stops.length>=2?(this.value.stops=u.stops,this.value.angle=u.angle,this.value.type=u.type,this.linkedGlobalVariable=null,s=!0):((l=this.value.stops)!=null&&l.length&&(this.value.stops=this.value.stops.map(p=>({...p,color:p.color.startsWith("var(--")?this.resolveGlobalVarColor(p.color):p.color}))),!this.value.stops||this.value.stops.length===0?this.value.stops=[{color:f,position:0,opacity:h}]:this.value.stops[0]={...this.value.stops[0],color:f,opacity:h},this.linkedGlobalVariable=null,s=!0)}if(e!=="solid"&&(this.pendingSolidColor=null),e!=="solid"&&(!this.value.stops||this.value.stops.length===0)&&(this.value.stops=[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}]),e!=="solid"&&this.value.stops.length===1){const h=this.value.stops[0].color;if(h.startsWith("var(--")){const u=this.resolveGlobalVarColor(h),p=Nt(u);p&&p.type!=="solid"&&p.stops.length>=2?(this.value.stops=p.stops,this.value.angle=p.angle,this.value.type=p.type):(this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90)}else if(h.startsWith("linear-gradient")||h.startsWith("radial-gradient")){const u=Nt(h);u&&u.type!=="solid"&&u.stops.length>=2?(this.value.stops=u.stops,this.value.angle=u.angle,this.value.type=u.type):(this.value.stops=[{color:"#a84b4b",position:0,opacity:100},{color:"#786666",position:100,opacity:100}],this.value.angle=90)}else this.value.stops.push({color:"#786666",position:100,opacity:100}),this.value.angle=90}else if(e!=="solid"&&this.value.stops.length>=2)this.value.angle||(this.value.angle=90);else if(e==="solid"&&n&&i){const f=this.value.stops&&this.value.stops[0]?this.value.stops[0].opacity??100:100;this.value.stops=[{color:i,position:0,opacity:f}],this.value.angle=0}if(this.popoverEl){const f=this.popoverEl.querySelectorAll(".gradient-type-tab");f.forEach(p=>p.classList.remove("active"));const h=f[0],u=f[1];e==="solid"?h==null||h.classList.add("active"):u==null||u.classList.add("active")}const o=(c=this.popoverEl)==null?void 0:c.querySelector(".gradient-editor-content");o&&this.updatePopoverContent(o),this.updateUI(),(r||s||a!==e)&&this.triggerChange()}updatePopoverContent(e){if(e.innerHTML="",!!this.value){if(this.variant!=="global"&&this.currentMode==="global"){this.renderGlobalColors(e);return}this.value.type==="solid"?this.renderSolid(e):this.renderGradient(e)}}renderGlobalColors(e){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const r=this.value.stops[0],a=h=>{h.innerHTML="";let u={};try{u=Le.GlobalVariables||{}}catch(g){console.warn("Could not access Setting.GlobalVariables",g)}if(!u||Object.keys(u).length===0){const g=document.createElement("div");g.textContent="No global colors defined",g.style.fontSize="12px",g.style.color="#666",g.style.padding="8px",h.appendChild(g);return}const p=Le.GlobalVariableGroups||[{title:"Global Colors",keys:["primary","secondary","tertiary","accent"]},{title:"Text Color",keys:["text-dark","text-light"]}],m=this.globalSearchQuery.toLowerCase();let d;this.globalLayoutMode==="list"?(d=document.createElement("div"),d.className="global-colors-list"):(d=document.createElement("div"),d.className="global-colors-grid"),h.appendChild(d),p.forEach(g=>{const x=Object.entries(u).filter(([w])=>!g.keys.includes(w)&&g.title!=="Global Colors"?!1:g.keys.includes(w)&&w.toLowerCase().includes(m));x.length!==0&&x.forEach(([w,v])=>{if(this.globalLayoutMode==="list"){const F=document.createElement("div");F.className="global-color-row";const N=document.createElement("div");N.className="global-color-circle";const A=this.resolveGlobalVarColor(v);N.style.background=A,(this.linkedGlobalVariable===`var(--${w})`||r.color===`var(--${w})`)&&N.classList.add("selected");const P=document.createElement("span");P.className="global-color-label",P.textContent=w.split("-").map(I=>I.charAt(0).toUpperCase()+I.slice(1)).join(" "),F.appendChild(N),F.appendChild(P),F.addEventListener("click",I=>{I.preventDefault();const z=`var(--${w})`;this.setValue(z),this.pendingSolidColor=z,a(h)}),d.appendChild(F)}else{const F=document.createElement("div");F.className="global-color-circle";const N=this.resolveGlobalVarColor(v);F.style.background=N,F.title=w.split("-").map(y=>y.charAt(0).toUpperCase()+y.slice(1)).join(" "),(this.linkedGlobalVariable===`var(--${w})`||r.color===`var(--${w})`)&&F.classList.add("selected"),F.addEventListener("click",y=>{y.preventDefault();const P=`var(--${w})`;this.setValue(P),this.pendingSolidColor=P,a(h)}),d.appendChild(F)}})})},n=document.createElement("div");n.className="global-controls-row";const i=document.createElement("div");i.className="global-search-container";const s=document.createElement("span");s.className="global-search-icon",s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';const o=document.createElement("input");o.type="text",o.className="global-search-input",o.placeholder="Search",o.value=this.globalSearchQuery;const l=document.createElement("div");o.addEventListener("input",h=>{this.globalSearchQuery=h.target.value,a(l)}),i.appendChild(s),i.appendChild(o);const c=document.createElement("button");c.className="global-layout-toggle",c.type="button";const f=()=>{c.innerHTML=this.globalLayoutMode==="list"?'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>'};f(),c.addEventListener("click",()=>{this.globalLayoutMode=this.globalLayoutMode==="list"?"grid":"list",f(),a(l)}),n.appendChild(i),n.appendChild(c),e.appendChild(n),e.appendChild(l),a(l)}renderSolid(e){(!this.value||!this.value.stops||!this.value.stops.length)&&(this.value||(this.value=this.defaultValue()),this.value.stops=[{color:"#000000",position:0,opacity:100}]);const r=this.value.stops[0],a=new xf({initialColor:r.color.startsWith("var(--")?this.resolveGlobalVarColor(r.color):r.color,initialOpacity:r.opacity??100,onColorChange:(n,i)=>{if(this.clearGlobalBindingForCustomChange(),this.value){const s=Nt(n);if(s&&s.type!=="solid"){this.value=s,this.switchType(s.type,!0);return}this.value.stops[0].color=n,this.value.stops[0].opacity=i,this.updateUI(),this.triggerChange(),this.pendingSolidColor=n}}});this.solidPicker=a,e.appendChild(a.getElement())}renderGradient(e){this.solidPicker=null;let r=null;{const f=document.createElement("div");f.className="gradient-subtype-inline";const h=document.createElement("select");h.className="gradient-subtype-select";const u=document.createElement("option");u.value="linear",u.textContent="Linear";const p=document.createElement("option");p.value="radial",p.textContent="Radial",h.appendChild(u),h.appendChild(p),h.value=this.value.type==="radial"?"radial":"linear",r=document.createElement("input"),r.type="text",r.inputMode="numeric",r.className="gradient-degree-input",r.value=`${this.value.angle??90}°`,r.style.width="75px",r.style.textAlign="center",(!this.value.angle||this.value.stops.length<2)&&(this.value.angle=90,r.value="90°");const m=document.createElement("button");m.type="button",m.className="gradient-flip-btn",m.innerHTML=hf,h.addEventListener("change",()=>{this.clearGlobalBindingForCustomChange(),this.switchType(h.value==="radial"?"radial":"linear",!0),r&&this.updateDegreeVisibility(r)}),r.addEventListener("focus",d=>{const g=d.target;g.value=g.value.replace(/[^0-9-]/g,""),setTimeout(()=>g.select(),0)}),r.addEventListener("input",d=>{this.clearGlobalBindingForCustomChange();const g=parseInt(d.target.value);!Number.isNaN(g)&&this.value&&(this.value.angle=Math.max(0,Math.min(360,g)),this.debouncedPreviewUpdate())}),r.addEventListener("blur",d=>{var w;this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const g=d.target;let x=parseInt(g.value);Number.isNaN(x)&&(x=((w=this.value)==null?void 0:w.angle)??0),x=Math.max(0,Math.min(360,x)),this.value&&(this.value.angle=x),g.value=`${x}°`,this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),m.addEventListener("click",()=>{this.clearGlobalBindingForCustomChange(),!(!this.value||!this.value.stops)&&(this.value.stops.forEach(d=>{d.position=100-d.position}),this.value.stops.sort((d,g)=>d.position-g.position),this.updateGradientPreview(a),this.createHandles(n,a),this.updateStopsList(l),this.updateUI(),this.triggerChange())}),f.appendChild(h),f.appendChild(r),f.appendChild(m),e.appendChild(f),this.updateDegreeVisibility(r)}const a=document.createElement("div");a.className="gradient-preview",this.updateGradientPreview(a);const n=document.createElement("div");n.className="gradient-handles",a.appendChild(n),e.appendChild(a),this.createHandles(n,a),a.addEventListener("click",f=>{var d;const h=f.target;if(h.classList.contains("gstop-handle")||h.classList.contains("gstop-chip"))return;const u=a.getBoundingClientRect(),m=(f.clientX-u.left)/u.width*100;this.clearGlobalBindingForCustomChange(),this.addStopAtPosition(m),this.updateStopsList(),this.updateGradientPreview(a),this.createHandles(n,a),this.updateUI(),((d=document.activeElement)==null?void 0:d.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange()});const i=document.createElement("div");i.className="gradient-stops-header";const s=document.createElement("span");s.textContent="Stops";const o=document.createElement("button");o.type="button",o.className="gradient-add-stop",o.textContent="+",i.appendChild(s),i.appendChild(o);const l=document.createElement("div");l.className="gradient-stops",e.appendChild(i),e.appendChild(l),this.updateStopsList(l);const c=es(f=>{const h=Nt(f);h&&(this.clearGlobalBindingForCustomChange(),this.value=h,this.switchType(h.type,!0),this.updateUI(),this.triggerChange())},"all");this.recentGradientRefresh=c.refresh,e.appendChild(c.container),o.addEventListener("click",()=>{var f;this.clearGlobalBindingForCustomChange(),this.addStop(),this.updateStopsList(l),this.updateGradientPreview(a),this.createHandles(n,a),this.updateUI(),((f=document.activeElement)==null?void 0:f.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange()})}updateDegreeVisibility(e){var r;e&&(((r=this.value)==null?void 0:r.type)==="radial"?(e.disabled=!0,e.style.opacity="0.5"):(e.disabled=!1,e.style.opacity="1"))}updateGradientPreview(e){var a;const r=e||((a=this.popoverEl)==null?void 0:a.querySelector(".gradient-preview"));if(r&&this.value)if(this.value.type==="solid")r.style.background=qt(this.value);else{const n=this.value.stops.map(i=>`${Pi(i.color,i.opacity??100)} ${i.position}%`).join(", ");r.style.background=`linear-gradient(90deg, ${n})`}}debouncedPreviewUpdate(e){this.previewUpdateTimeout&&clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=window.setTimeout(()=>{this.updateGradientPreview(e),this.previewUpdateTimeout=null},16)}createHandles(e,r){e.innerHTML="",!(!this.value||this.value.type==="solid"||!this.value.stops)&&this.value.stops.forEach((a,n)=>{const i=document.createElement("div");i.className="gstop-handle",i.style.left=`${Math.max(0,Math.min(100,a.position))}%`,i.style.top="0%";const s=document.createElement("div");s.className="gstop-chip";const o=this.resolveGlobalVarColor(a.color);s.style.backgroundColor=o,i.appendChild(s);let l=!1,c=!1,f=0,h=0;const u=d=>{l=!0,c=!1,f=d.clientX,h=this.value.stops[n].position,i.classList.add("selected"),document.addEventListener("mousemove",p),document.addEventListener("mouseup",m),d.preventDefault(),d.stopPropagation()},p=d=>{if(!l||!this.value)return;const g=d.clientX-f;if(Math.abs(g)>3&&(c=!0),c){this.clearGlobalBindingForCustomChange();const x=r.getBoundingClientRect();let w=h+g/x.width*100;w=Math.max(0,Math.min(100,w)),this.value.stops[n].position=Math.round(w),i.style.left=`${w}%`,this.updateGradientPreview()}},m=d=>{var g;if(l)if(l=!1,i.classList.remove("selected"),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m),c)this.value&&(this.value.stops.sort((x,w)=>x.position-w.position),this.createHandles(e,r),this.updateStopsList()),this.updateUI(),this.triggerChange();else{d.stopPropagation();const x=(g=this.value)==null?void 0:g.stops[n];x&&setTimeout(()=>{const w=this.getSharedStopColorPicker();w.getIsOpen()&&w.close(!1),this.colorPickerStopIndex=n,w.setOnChange((F,N)=>{this.clearGlobalBindingForCustomChange(),this.value&&this.value.stops[n]&&(this.value.stops[n].color=F,N!==void 0&&(this.value.stops[n].opacity=N),s.style.backgroundColor=F,this.updateGradientPreview(),this.updateStopsList(),this.updateUI(),this.triggerChange())});const v=this.resolveGlobalVarColor(x.color);w.open(v,s,x.opacity??100)},0)}};i.addEventListener("mousedown",u),e.appendChild(i)})}updateStopsList(e){var a;const r=e||((a=this.popoverEl)==null?void 0:a.querySelector(".gradient-stops"));!r||!this.value||this.value.type==="solid"||!this.value.stops||(r.innerHTML="",this.value.stops.forEach((n,i)=>{var F,N;const s=document.createElement("div");s.className="gstop-row";const o=document.createElement("div");o.className="gstop-position-group";const l=document.createElement("input");l.type="text",l.className="gstop-position-input",l.value=`${n.position}%`,l.style.width="60px",o.appendChild(l);const c=document.createElement("div");c.className="gstop-color-container";const f=this.resolveGlobalVarColor(n.color),h=document.createElement("div");h.className="gstop-color-preview",h.style.backgroundColor=f;const u=document.createElement("input");u.type="text",u.className="gstop-color-input",u.value=f.replace("#","").toUpperCase();const p=document.createElement("button");p.type="button",p.className="gstop-color-copy",p.textContent="Copy",c.appendChild(h),c.appendChild(u),c.appendChild(p);const m=document.createElement("button");m.type="button",m.className="gstop-del",m.innerHTML=uf,m.disabled=(((N=(F=this.value)==null?void 0:F.stops)==null?void 0:N.length)||0)<=2,s.appendChild(o),s.appendChild(c),s.appendChild(m),r.appendChild(s);const d=document.createElement("span");d.className="gstop-opacity-label",d.textContent="Opacity";const g=document.createElement("div");g.className="gstop-opacity-group";const x=document.createElement("input");x.type="range",x.className="gstop-opacity-slider",x.min="0",x.max="100",x.value=String(n.opacity??100);const w=Pt(f);x.style.setProperty("--slider-color",`rgb(${w.r}, ${w.g}, ${w.b})`),x.style.setProperty("--slider-color-transparent",`rgba(${w.r}, ${w.g}, ${w.b}, 0)`);const v=document.createElement("span");v.className="gstop-opacity-value",v.textContent=`${n.opacity??100}%`,g.appendChild(x),g.appendChild(v),u.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation();const y=this.getSharedStopColorPicker();y.getIsOpen()&&y.close(!1),this.colorPickerStopIndex=i,y.setOnChange((I,z)=>{this.clearGlobalBindingForCustomChange(),u.value=I.replace("#","").toUpperCase(),h.style.backgroundColor=I,this.value.stops[i].color=I,z!==void 0&&(this.value.stops[i].opacity=z,x.value=String(z),v.textContent=`${z}%`);const V=Pt(I);x.style.setProperty("--slider-color",`rgb(${V.r}, ${V.g}, ${V.b})`),x.style.setProperty("--slider-color-transparent",`rgba(${V.r}, ${V.g}, ${V.b}, 0)`),this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateUI(),this.triggerChange()});const P=this.resolveGlobalVarColor(n.color);y.open(P,u,n.opacity??100)}),u.addEventListener("input",()=>{this.clearGlobalBindingForCustomChange();const A=u.value.trim(),y=A.startsWith("#")?A:`#${A}`;if(/^#[0-9A-Fa-f]{6}$/.test(y)){this.value.stops[i].color=y,h.style.backgroundColor=y;const P=Pt(y);x.style.setProperty("--slider-color",`rgb(${P.r}, ${P.g}, ${P.b})`),x.style.setProperty("--slider-color-transparent",`rgba(${P.r}, ${P.g}, ${P.b}, 0)`),this.debouncedPreviewUpdate()}}),u.addEventListener("blur",()=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()}),p.addEventListener("click",async A=>{A.stopPropagation();try{await navigator.clipboard.writeText(`#${u.value}`)}catch{}}),l.addEventListener("focus",A=>{const y=A.target;y.value=y.value.replace("%",""),y.select()}),l.addEventListener("input",A=>{this.clearGlobalBindingForCustomChange();const y=A.target,P=parseInt(y.value.replace(/[^\d]/g,""),10);if(!Number.isNaN(P)){const I=Math.max(0,Math.min(100,P));this.value.stops[i].position=I,y.value=`${I}%`,this.debouncedPreviewUpdate()}}),l.addEventListener("blur",A=>{this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null);const y=A.target,P=parseInt(y.value.replace(/[^\d]/g,""),10);if(Number.isNaN(P))y.value=`${this.value.stops[i].position}%`;else{const I=Math.max(0,Math.min(100,P));this.value.stops[i].position=I,y.value=`${I}%`}this.updateGradientPreview(),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateUI(),this.triggerChange()}),m.addEventListener("click",()=>{var A,y;(this.value.stops.length||0)<=2||((A=this.sharedStopColorPicker)!=null&&A.getIsOpen()&&this.colorPickerStopIndex===i?(this.sharedStopColorPicker.close(!1),this.colorPickerStopIndex=null):this.colorPickerStopIndex!==null&&this.colorPickerStopIndex>i&&this.colorPickerStopIndex--,this.clearGlobalBindingForCustomChange(),this.value.stops.splice(i,1),this.createHandles(this.popoverEl.querySelector(".gradient-handles"),this.popoverEl.querySelector(".gradient-preview")),this.updateStopsList(),this.updateGradientPreview(),this.updateUI(),((y=document.activeElement)==null?void 0:y.tagName)!=="INPUT"&&this.repositionPopover(),this.triggerChange())}),x.addEventListener("input",()=>{this.clearGlobalBindingForCustomChange();const A=parseInt(x.value,10);this.value.stops[i].opacity=Math.max(0,Math.min(100,A)),v.textContent=`${this.value.stops[i].opacity}%`,this.debouncedPreviewUpdate()}),x.addEventListener("change",()=>{this.clearGlobalBindingForCustomChange(),this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),this.updateGradientPreview(),this.updateUI(),this.triggerChange()})}))}addStop(){if(!this.value||this.value.type==="solid"||!this.value.stops)return;const e=this.value.stops.map(n=>n.position).sort((n,i)=>n-i);let r=50,a=0;for(let n=0;n<e.length-1;n++){const i=e[n+1]-e[n];i>a&&(a=i,r=e[n]+i/2)}this.addStopAtPosition(r)}addStopAtPosition(e){if(!this.value||this.value.type==="solid"||!this.value.stops)return;const r=Math.max(0,Math.min(100,e)),a=[...this.value.stops].sort((c,f)=>c.position-f.position);let n=a[0],i=a[a.length-1];for(let c=0;c<a.length-1;c++)if(a[c].position<=r&&a[c+1].position>=r){n=a[c],i=a[c+1];break}let s,o;if(n===i||n.position===i.position)s=n.color,o=n.opacity??100;else{const c=(r-n.position)/(i.position-n.position),f=Pt(n.color),h=Pt(i.color),u=Math.round(f.r+(h.r-f.r)*c),p=Math.round(f.g+(h.g-f.g)*c),m=Math.round(f.b+(h.b-f.b)*c);s=`#${u.toString(16).padStart(2,"0")}${p.toString(16).padStart(2,"0")}${m.toString(16).padStart(2,"0")}`.toUpperCase(),o=Math.round((n.opacity??100)+((i.opacity??100)-(n.opacity??100))*c)}const l={position:Math.round(r),color:s,opacity:o};this.value.stops.push(l),this.value.stops.sort((c,f)=>c.position-f.position)}openPopover(){if(this.popoverEl&&(Qt.openInstance&&Qt.openInstance!==this&&Qt.openInstance.closePopover(),!this.isPopoverOpen)){if(this.isPopoverOpen=!0,Qt.openInstance=this,this.backdropEl&&(this.backdropEl.style.display="block",this.backdropEl.parentElement||document.body.appendChild(this.backdropEl)),this.popoverEl.style.display="flex",this.refreshPopoverContent(),this.element){const e=this.element.getBoundingClientRect(),r=306,a=window.innerWidth,n=window.innerHeight,i=16;this.popoverEl.style.position="fixed",this.popoverEl.style.zIndex="10000",this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const s=this.popoverEl.offsetHeight;let o=e.right+8,l=e.top;const c=a-e.right,f=e.left,h=r+i;c<h&&f>c+100&&(o=e.left-r-8);const u=n-e.bottom,p=e.top;p>=s+i?l=e.top-s-8:u>=s+i?l=e.bottom+8:p>u?(l=e.top-s-8,l<i&&(l=i)):(l=e.bottom+8,l+s>n-i&&(l=n-s-i)),this.popoverEl.style.left=`${o}px`,this.popoverEl.style.top=`${l}px`,this.popoverPosition={left:o,top:l}}setTimeout(()=>document.addEventListener("click",this.onBackgroundClick,!0),200),document.addEventListener("keydown",this.handlePopoverKeydown,!0)}}repositionPopover(){var e;if(!(!this.popoverEl||!this.isPopoverOpen||!this.element)&&((e=document.activeElement)==null?void 0:e.tagName)!=="INPUT"){if(this.popoverPosition){this.popoverEl.style.left=`${this.popoverPosition.left}px`,this.popoverEl.style.top=`${this.popoverPosition.top}px`;return}requestAnimationFrame(()=>{if(!this.popoverEl||!this.element)return;const r=this.element.getBoundingClientRect(),a=306,n=window.innerWidth,i=window.innerHeight,s=16;this.popoverEl.style.left,this.popoverEl.style.top,this.popoverEl.style.left="-9999px",this.popoverEl.style.top="0px";const o=this.popoverEl.offsetHeight;let l=r.right+8,c=r.top;const f=n-r.right,h=r.left,u=a+s;f<u&&h>f+100&&(l=r.left-a-8);const p=i-r.bottom,m=r.top;m>=o+s?c=r.top-o-8:p>=o+s?c=r.bottom+8:m>p?(c=r.top-o-8,c<s&&(c=s)):(c=r.bottom+8,c+o>i-s&&(c=i-o-s)),this.popoverEl.style.left=`${l}px`,this.popoverEl.style.top=`${c}px`})}}refreshPopoverContent(){var i,s;if(!this.popoverEl)return;const e=this.popoverEl.querySelectorAll(".gradient-type-tab");e.forEach(o=>o.classList.remove("active"));const r=e[0],a=e[1];((i=this.value)==null?void 0:i.type)==="solid"?r.classList.add("active"):(a.classList.add("active"),(s=this.recentGradientRefresh)==null||s.call(this)),this.popoverEl.offsetHeight;const n=this.popoverEl.querySelector(".gradient-editor-content");n&&this.updatePopoverContent(n)}closePopover(){var e,r;if(!(!this.popoverEl||!this.isPopoverOpen)){if(this.isPopoverOpen=!1,this.popoverPosition=null,(e=this.sharedStopColorPicker)!=null&&e.getIsOpen()&&(this.sharedStopColorPicker.close(!0),this.colorPickerStopIndex=null),this.backdropEl&&(this.backdropEl.style.display="none"),this.popoverEl.style.display="none",document.removeEventListener("click",this.onBackgroundClick,!0),document.removeEventListener("keydown",this.handlePopoverKeydown,!0),this.commitPendingSolidColor(),this.value&&this.value.type!=="solid"){const a=qt(this.value);ra.addColor(a,"gradient"),(r=this.recentGradientRefresh)==null||r.call(this)}this.previewUpdateTimeout&&(clearTimeout(this.previewUpdateTimeout),this.previewUpdateTimeout=null),Qt.openInstance===this&&(Qt.openInstance=null)}}commitPendingSolidColor(){this.pendingSolidColor&&(this.solidPicker?this.solidPicker.commitRecentColor():ra.addColor(this.pendingSolidColor,"solid"),this.pendingSolidColor=null)}handlePaste(e){var a;e.preventDefault();const r=((a=e.clipboardData)==null?void 0:a.getData("text"))||"";this.parseAndSet(r)}handleTextInput(e){const r=e.target;this.parseAndSet(r.value)}parseAndSet(e){let r=e.trim();r&&!r.startsWith("#")&&!r.startsWith("var(")&&!r.startsWith("rgb")&&!r.startsWith("hsl")&&!r.includes("gradient")&&/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(r)&&(r="#"+r,this.inputEl&&(this.inputEl.value=r));const a=Nt(r);a&&this.setValue(a)}getChangePayload(){var e;if(this.value)return this.isBoundToGlobal()?((e=this.value.stops)==null?void 0:e.some(a=>a.opacity!==void 0&&a.opacity!==100))?this.resolveGradientGlobalVars(this.value):this.linkedGlobalVariable||void 0:this.value}triggerChange(){const e=this.getChangePayload();e!==void 0&&(this.changeDebounceTimeout&&clearTimeout(this.changeDebounceTimeout),this.changeDebounceTimeout=setTimeout(()=>{var r,a;(r=this.onChange)==null||r.call(this,e),(a=this.detectChange)==null||a.call(this,e),this.changeDebounceTimeout=null},Qt.CHANGE_DEBOUNCE_DELAY))}getElement(){return this.element}getValue(){const e=this.getChangePayload();return e?typeof e=="string"?e:qt(e):""}getCSSValue(){const e=this.getChangePayload();return e?typeof e=="string"?e:qt(e):""}getCSSForText(){return this.value?this.cssForTextValue():{}}getRawValue(){return this.value}};Qt.openInstance=null,Qt.CHANGE_DEBOUNCE_DELAY=150;let aa=Qt;function zr(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const a=t[r];e(r,a)}}function Di(t){if(t==null)return t;if(Array.isArray(t))return t.map(e=>Di(e));if(typeof t=="object"){const e={};for(const[r,a]of Object.entries(t))r!=="$id"&&(e[r]=Di(a));return e}return t}const ni=class ni{constructor(e){this.elementRef=null,this.isHidden=!1,this.custom=!1,this.initialValues={},this.changeTimeout=null,this.isHandlingChange=!1,this.changeHandlers=new Set,this.blurTimeout=null,this.lastChangeTime=0,this.handleBlur=()=>{},this.pendingBlurHandler=null,this.originalDefaultValues={},this.nestingLevel=0,this.dataPropsPath="",this.hide=!1,this.isSettingValue=!1,this.suppressOnChange=!1,this.suppressOnChange=!0,this.id=e.id||Un(),this.title=e.title,this.settings=e.settings,this.isCollapsed=e.collapsed??!1,this.isMain=e.main??!1,this.custom=e.custom??!1,this.nestingLevel=0,this.includeGetJson=e.includeGetJson??!0,this.addItemCfg=e.addItem,this.deleteItemCfg=e.deleteItem,this.dataProps=e.dataProps,this.dataPropsPath=e.dataProps||"",this.hide=e.hide??!1,Object.assign(this,e.settings),this.initialValues=this.getValues(),this.originalDefaultValues=this.getDefaultValues(),this.propagateNestingLevel(),this.propagateDataPropsPath(),this.propagateComponentPaths(),this.suppressOnChange=!1}propagateNestingLevel(){const e=this.nestingLevel+1;zr(this.settings,(r,a)=>{$e(a)&&(a.nestingLevel=e,a.propagateNestingLevel())})}getNestingLevel(){return this.nestingLevel}setNestingLevel(e){this.nestingLevel=e,this.propagateNestingLevel(),this.elementRef&&this.updateNestingStyles()}setTitle(e){if(this.title=e,this.elementRef){const r=this.elementRef.querySelector(".setting-group-title h3");r&&(r.textContent=e)}}getDataPropsPath(){return this.dataPropsPath}setDataPropsPath(e){this.dataPropsPath=e,this.propagateDataPropsPath()}propagateDataPropsPath(){zr(this.settings,(e,r)=>{const a=String(e),n=this.dataPropsPath?`${this.dataPropsPath}_${a}`:a;($e(r)||dr(r)&&typeof r.setDataPropsPath=="function")&&r.setDataPropsPath(n)})}propagateComponentPaths(e=""){zr(this.settings,(r,a)=>{var i;const n=String(r);if($e(a)){const s=e?`${e} > ${a.title}`:a.title;a.propagateComponentPaths(s)}else if(dr(a)&&typeof a.setComponentPath=="function"){const s=((i=a.props)==null?void 0:i.title)||n,o=e?`${e} > ${s}`:s;a.setComponentPath(o)}})}updateNestingStyles(){this.elementRef&&(Dn(this.elementRef,this.nestingLevel),Ni(this.elementRef,this.nestingLevel))}forceChildUIRefresh(){Object.entries(this.settings).forEach(([e,r])=>{try{if($e(r)){const a=r.getValues();r.setValue(a)}else if(typeof r.setValue=="function"){const a=r.value;a!==void 0&&r.setValue(a)}}catch(a){console.warn(`Error refreshing UI for setting ${e}:`,a)}})}removeSetting(e){var n;const r=this.settings[e];if(!r)return;if(delete this.settings[e],this.elementRef){const i=this.elementRef.querySelector(".setting-group-content");if(i){const s=Array.from(i.querySelectorAll(".setting-group, .setting, [data-setting-id]"));for(const o of s){const l=o.id,c=o.getAttribute("data-setting-id");if(l&&"id"in r&&typeof r.id=="string"&&l.includes(r.id)){o.remove();break}if(c&&"id"in r&&typeof r.id=="string"&&c===r.id){o.remove();break}}}}typeof r.cleanup=="function"&&r.cleanup(),this.updateNestingStyles();const a=this.getValues();this.initialValues=a,this.suppressOnChange||(n=this.onChange)==null||n.call(this,a)}updateVisibility(){this.elementRef}updateSettings(e,r){var l;const a=(r==null?void 0:r.preserveValues)??!0,n=new Set(Object.keys(this.settings)),i=Object.keys(e),s={};a&&i.forEach(c=>{const f=this.settings[c];f&&($e(f)?s[c]=f.getValues():dr(f)?s[c]=f.value:typeof f.getValues=="function"?s[c]=f.getValues():f.value!==void 0&&(s[c]=f.value))}),n.forEach(c=>{i.includes(c)||this.removeSetting(c)}),i.forEach(c=>{var u;const f=e[c],h=this.settings[c];if(h!==f&&(h&&this.removeSetting(c),this.addSetting(c,f),a&&c in s)){const p=s[c];try{$e(f)?f.setValue(p):dr(f)?(u=f.setValue)==null||u.call(f,p):f.setValue&&f.setValue(p)}catch(m){console.warn(`Could not preserve value for setting ${c}:`,m)}}}),this.settings=e,this.propagateNestingLevel(),this.propagateDataPropsPath();const o=this.getValues();this.initialValues=o,this.suppressOnChange||(l=this.onChange)==null||l.call(this,o)}clone(){const e={};zr(this.settings,(n,i)=>{const s=String(n);typeof i.clone=="function"?e[s]=i.clone():(console.warn(`Setting with key '${s}' does not have a clone method. Copying reference.`),e[s]=i)});const r={title:this.title,settings:e,collapsed:this.isCollapsed,main:this.isMain,custom:this.custom,includeGetJson:this.includeGetJson,addItem:this.addItemCfg,deleteItem:this.deleteItemCfg,dataProps:this.dataProps,hide:this.hide},a=w0(r);return a.suppressOnChange=!0,a.initialValues=this.getValues(),a.suppressOnChange=!1,a}resetDefault(){const e=this.originalDefaultValues;this.setValue(e),this.onChange&&!this.suppressOnChange&&this.onChange(this.getValues())}setMobileValues(e){!e||typeof e!="object"||(Object.entries(e).forEach(([r,a])=>{const n=this.settings[r];n&&($e(n)||dr(n))&&typeof n.setMobileValue=="function"&&n.setMobileValue(a)}),this.setValue(e),this.onChange&&!this.suppressOnChange&&this.onChange(this.getValues()))}getMobileValues(e){if(e===void 0){const r={};for(const a in this.settings)if(Object.prototype.hasOwnProperty.call(this.settings,a)){const n=this.settings[a];if($e(n))r[a]=n.getMobileValues();else{const i=n;r[a]=i.mobileValue!==void 0?i.mobileValue:i.value}}return r}else{const r=this.settings[e];if(!r)return;if($e(r))return r.getMobileValues();const a=r;return a.mobileValue!==void 0?a.mobileValue:a.value}}setOnChange(e){this.onChange=e;const r=()=>{this.isHandlingChange||this.suppressOnChange||(this.isHandlingChange=!0,this.changeTimeout&&clearTimeout(this.changeTimeout),this.changeTimeout=setTimeout(()=>{const a=this.getValues(),n=this.calculateChanges(this.initialValues,a);Object.keys(n).length>0&&(this.lastChangeTime=Date.now(),this.initialValues=a,this.suppressOnChange||e(a),this.updateVisibility()),this.isHandlingChange=!1},50))};return this.changeHandlers.clear(),zr(this.settings,(a,n)=>{var i;if($e(n))n.setOnChange(()=>{if(this.suppressOnChange)return;const s=this.getValues();this.initialValues=s,e(s)}),this.changeHandlers.add(()=>e(this.getValues()));else if(dr(n)){const s=()=>r();this.changeHandlers.add(s),n.setOnChange(s)}else{const s=()=>r();this.changeHandlers.add(s),(i=n.setOnChange)==null||i.call(n,s)}}),this}cleanup(){this.changeTimeout&&(clearTimeout(this.changeTimeout),this.changeTimeout=null),this.blurTimeout&&(clearTimeout(this.blurTimeout),this.blurTimeout=null),this.elementRef&&this.elementRef.removeEventListener("focusout",this.handleBlur),this.changeHandlers.clear(),zr(this.settings,(e,r)=>{const a=r;try{typeof a.cleanup=="function"?a.cleanup():typeof a.destroy=="function"&&a.destroy()}catch{}})}setValue(e){if(!(!e||typeof e!="object")&&!this.isSettingValue){this.isSettingValue=!0;try{Object.entries(e).forEach(([a,n])=>{let i=this.settings[a];if(!i&&this.addItemCfg&&a.startsWith(this.addItemCfg.keyPrefix)){const s=a.slice(this.addItemCfg.keyPrefix.length),o=Number(s);if(Number.isFinite(o)){const l=this.addItemCfg.createItem(o);Mi(l)&&(this.addSetting(a,l),i=l)}}i&&($e(i)||dr(i))&&typeof i.setValue=="function"&&i.setValue(n)});const r=this.getValues();this.initialValues=r,this.onChange&&!this.suppressOnChange&&this.onChange(r)}finally{this.isSettingValue=!1}}}wireChild(e){var a;const r=()=>{var i;if(this.suppressOnChange)return;const n=this.getValues();this.initialValues=n,(i=this.onChange)==null||i.call(this,n),this.updateVisibility()};$e(e)?e.setOnChange(()=>r()):dr(e)?e.setOnChange(()=>r()):(a=e.setOnChange)==null||a.call(e,()=>r())}addSetting(e,r){var n,i;if(this.settings[e]=r,this.wireChild(r),this.elementRef){const s=this.elementRef.querySelector(".setting-group-content");if(s){const o=s.querySelector(".setting-group-empty");o&&o.remove(),$e(r)&&typeof r.setNestingLevel=="function"&&r.setNestingLevel(this.nestingLevel+1);const l=r.draw(),c=this.deleteItemCfg??this.addItemCfg;if(c){const u=c.keyPrefix??((n=this.addItemCfg)==null?void 0:n.keyPrefix);u&&e.startsWith(u)&&this.addDeleteButtonToElement(l,e)}const f=s.querySelector(".sg-add-button-bottom");f?s.insertBefore(l,f):s.appendChild(l),Ys.trackElement(l),Dn(l,this.nestingLevel+1),Ni(l,this.nestingLevel+1);const h=l.style.display;l.style.display="none",l.offsetHeight,l.style.display=h,this.updateNestingStyles()}}const a=this.getValues();this.initialValues=a,this.suppressOnChange||(i=this.onChange)==null||i.call(this,a)}addDeleteButtonToElement(e,r,a){let n=null;try{n=e.querySelector(":scope > .setting-group-title")}catch{n=null}if(!n){const c=Array.from(e.querySelectorAll(".setting-group-title"));for(const f of c)if(f.closest(".setting-group")===e){n=f;break}n||(n=c[0]??null)}if(!n)return;const i=n.querySelector(".actions-section");if(!i)return;const s=document.createElement("button");s.type="button",s.className="sg-delete-button",a?a.deleteItemCfg:this.deleteItemCfg??this.addItemCfg,s.title="Delete",s.style.cssText=`
|
|
27
27
|
background: none;
|
|
28
28
|
border: none;
|
|
29
29
|
cursor: pointer;
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
xmlns="http://www.w3.org/2000/svg">
|
|
105
105
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
106
106
|
strokeWidth="1.5" strokeLinecap="round"/>
|
|
107
|
-
</svg>`;f.innerHTML=`${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel??"Add"}</span>`,f.addEventListener("click",u=>{u.stopPropagation(),u.preventDefault();const p=this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),m=this.addItemCfg.createItem(p);if(Mi(m)){const d=`${this.addItemCfg.keyPrefix}${p}`;this.addSetting(d,m)}}),o.appendChild(f)}return r.appendChild(a),r.appendChild(i),e.appendChild(r),e.appendChild(o),this.elementRef=e,Ys.trackElement(e),setTimeout(()=>{this.updateNestingStyles()},0),this.pendingBlurHandler&&(this.pendingBlurHandler=null),e}collapse(){if(!this.elementRef||this.isCollapsed)return;const e=this.elementRef.querySelector(".setting-group-content"),r=this.elementRef.querySelector(".setting-group-arrow"),a=this.elementRef.querySelector(".setting-group-title");e&&r&&a&&(this.isCollapsed=!0,e.classList.add("collapsed"),r.classList.add("rotated"),a.setAttribute("aria-expanded","false"))}expand(){if(!this.elementRef||!this.isCollapsed)return;const e=this.elementRef.querySelector(".setting-group-content"),r=this.elementRef.querySelector(".setting-group-arrow"),a=this.elementRef.querySelector(".setting-group-title");e&&r&&a&&(this.isCollapsed=!1,e.classList.remove("collapsed"),r.classList.remove("rotated"),a.setAttribute("aria-expanded","true"))}getJson(){return JSON.stringify(this.getValuesForJson(),null,2)}setJson(e){try{const r=JSON.parse(e);let a=r;const n=Object.keys(this.settings),i=Object.keys(r);if(!n.some(o=>i.includes(o))&&i.length===1){const o=i[0];a=r[o]}this.setValue(a)}catch(r){throw console.error("Invalid JSON provided to setJson:",r),new Error("Invalid JSON format")}}};ni.hiddenElements=new Set;let ir=ni;function vf(t){return new ts(t)}class ts extends ir{constructor(e){super(e);const r=Object.keys(this.settings)[0];this.activeTabId=r||""}getActiveTabId(){return this.activeTabId}switchToTab(e){if(!this.settings[e]||this.activeTabId===e)return;this.activeTabId=e,this.updateTabUI();const r=this.getValues();this.initialValues=r}getValues(e){return e!==void 0?super.getValues(e):{...super.getValues(),activeTabId:this.activeTabId}}updateTabUI(){if(!this.tabsContainer||!this.contentContainers)return;this.tabsContainer.querySelectorAll(".tab-button").forEach(r=>{r.getAttribute("data-tab-id")===this.activeTabId?r.classList.add("active"):r.classList.remove("active")}),Object.entries(this.contentContainers).forEach(([r,a])=>{r===this.activeTabId?a.classList.add("active"):a.classList.remove("active")})}draw(){const e=super.draw();e.classList.add("tabs-settings-container");const r=e.querySelector(".setting-group-content");if(!r)return e;r.innerHTML="";const a=document.createElement("div");a.className="tabs-title";const n=document.createElement("h3");n.textContent=this.title,a.appendChild(n);const i=document.createElement("div");i.className="tabs-header",this.tabsContainer=i;const s=document.createElement("div");if(s.className="tab-content",this.contentContainers={},Object.keys(this.settings).forEach((o,l)=>{const c=document.createElement("button");c.className="tab-button",c.type="button",c.setAttribute("data-tab-id",o),c.textContent=o,c.addEventListener("click",()=>this.switchToTab(o)),i.appendChild(c);const f=document.createElement("div");f.className="tab-panel",this.contentContainers[o]=f;const h=this.settings[o];h&&($e(h)&&typeof h.setNestingLevel=="function"&&h.setNestingLevel(this.getNestingLevel()+1),f.appendChild(h.draw())),s.appendChild(f),l===0&&!this.activeTabId&&(this.activeTabId=o)}),r.appendChild(a),r.appendChild(i),r.appendChild(s),!this.activeTabId){const o=Object.keys(this.settings)[0];this.activeTabId=o||""}return this.updateTabUI(),e}}function w0(t){return new ir(t)}function Ef(t){return t}class C0 extends Le{constructor(e={}){super(e),this.inputType="text",e.onChange&&this.setOnChange(e.onChange)}draw(){const e=r=>{this.props.maxLength!==void 0&&(r.maxLength=this.props.maxLength),this.props.className&&r.classList.add(this.props.className)};return this.createInput({value:this.value,inputType:this.inputType,title:this.props.title,placeholder:this.props.placeholder,icon:this.props.icon,inputClassName:"string-setting-input "+(this.props.inputClassName||""),wrapperClassName:"string-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:e})}}const wf="<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' strokeLinecap='round' strokeLinejoin='round'/></svg>";class Zt extends C0{constructor(e){super({...e,icon:e.icon||wf,title:e.title||"Color",default:e.default?Zt.normalizeColorValue(e.default):"#000000"}),this.inputType="color",this.element=null,this.colorInputEl=null,this.textInputEl=null,this.detectChange=e.detectChange}static normalizeColorValue(e){return e.startsWith("var(--")?e:e.startsWith("#")?Zt.normalizeHexValue(e):e.includes(",")?Zt.rgbToHexStatic(e):Zt.normalizeHexValue(e)}static normalizeHexValue(e){return e=e.replace("#",""),e.length===3&&(e=e.split("").map(r=>r+r).join("")),e.length!==6?(console.warn(`Invalid hex value "${e}", using default "#000000"`),"#000000"):/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:(console.warn(`Invalid hex value "${e}", using default "#000000"`),"#000000")}static rgbToHexStatic(e){const r=e.split(",").map(f=>parseInt(f.trim()));if(r.length!==3||r.some(isNaN))return console.warn(`Invalid RGB value "${e}", using default "#000000"`),"#000000";const[a,n,i]=r,s=Math.max(0,Math.min(255,a)),o=Math.max(0,Math.min(255,n)),l=Math.max(0,Math.min(255,i)),c=f=>{const h=f.toString(16);return h.length===1?"0"+h:h};return`#${c(s)}${c(o)}${c(l)}`}setValue(e){if(e===void 0){this.value="#000000",this.colorInputEl&&(this.colorInputEl.value="#000000"),this.textInputEl&&(this.textInputEl.value="#000000"),this.onChange&&this.onChange("#000000"),this.props.detectChange&&this.props.detectChange("#000000");return}if(typeof e=="string"){const r=Zt.normalizeColorValue(e);this.value=r,this.colorInputEl&&(this.colorInputEl.value=r),this.textInputEl&&(this.textInputEl.value=r),this.onChange&&this.onChange(r),this.props.detectChange&&this.props.detectChange(r)}else this.value="#000000",this.colorInputEl&&(this.colorInputEl.value="#000000"),this.textInputEl&&(this.textInputEl.value="#000000"),this.onChange&&this.onChange("#000000"),this.props.detectChange&&this.props.detectChange("#000000")}hexToRgb(e){e=e.replace("#","");const r=parseInt(e.substring(0,2),16),a=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return`${r}, ${a}, ${n}`}draw(){const e=document.createElement("div");if(e.className="color-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const d=document.createElement("div");if(d.className="icon-container",this.props.icon){const g=document.createElement("span");g.className="input-icon",g.innerHTML=this.props.icon,d.appendChild(g)}if(this.props.title){const g=document.createElement("span");g.className="input-label",g.textContent=this.props.title,d.appendChild(g)}e.appendChild(d)}const r=document.createElement("div");r.className="color-input-wrapper";const a=document.createElement("div");a.className="color-setting-tabs",a.style.display="flex",a.style.marginBottom="8px",a.style.gap="4px";const n=document.createElement("button");n.className="color-tab active",n.textContent="Solid";const i=document.createElement("button");i.className="color-tab",i.textContent="Global",a.appendChild(n),a.appendChild(i);const s=document.createElement("div");s.className="color-content-solid";const o=document.createElement("div");o.className="color-content-global",o.style.display="none",o.style.display="grid",o.style.gridTemplateColumns="repeat(auto-fill, minmax(30px, 1fr))",o.style.gap="8px";const l=()=>{try{if(console.log("ColorSetting: renderGlobalOptions called"),o.innerHTML="",!Le){console.error("ColorSetting: Setting class is undefined");const g=document.createElement("div");g.textContent="Error: System error (Setting undefined)",o.appendChild(g);return}const d=Le.GlobalVariables||{};if(console.log("ColorSetting: GlobalVariables:",d),!d||Object.keys(d).length===0){const g=document.createElement("div");g.textContent="No global colors defined",g.style.gridColumn="1 / -1",g.style.fontSize="12px",g.style.color="#666",o.appendChild(g);return}Object.entries(d).forEach(([g,x])=>{const w=document.createElement("button");w.className="global-color-btn",w.title=g,w.style.width="30px",w.style.height="30px",w.style.borderRadius="50%",w.style.border="1px solid #ddd",w.style.backgroundColor=x,w.style.cursor="pointer",this.value===`var(--${g})`&&(w.style.border="2px solid #2196f3"),w.addEventListener("click",v=>{var N,A;v.preventDefault();const F=`var(--${g})`;this.value=F,(N=this.onChange)==null||N.call(this,F),(A=this.detectChange)==null||A.call(this,F),Array.from(o.children).forEach(y=>{y.style.border="1px solid #ddd"}),w.style.border="2px solid #2196f3",h.style.backgroundColor=x}),o.appendChild(w)})}catch(d){console.error("ColorSetting: Error in renderGlobalOptions",d),o.innerHTML="Error loading global options"}};l(),n.addEventListener("click",d=>{d.preventDefault(),n.classList.add("active"),i.classList.remove("active"),s.style.display="flex",o.style.display="none",this.value&&this.value.startsWith("var(--")}),i.addEventListener("click",d=>{d.preventDefault(),i.classList.add("active"),n.classList.remove("active"),s.style.display="none",o.style.display="grid",l()}),this.value&&this.value.startsWith("var(--")?i.click():n.click();const c=d=>{const g=d.value.trim();if(!g)return r.classList.remove("error"),!0;const w=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(g);return w?r.classList.remove("error"):r.classList.add("error"),w},f=document.createElement("input");f.type="color",f.className="color-picker",f.value=this.value&&!this.value.startsWith("var(--")?this.value:"#000000",f.setAttribute("aria-label","Choose color"),f.setAttribute("title","Click to open color picker"),this.getDataPropsPath()&&f.setAttribute("data-test-id",this.getDataPropsPath()),this.colorInputEl=f;const h=document.createElement("div");h.className="color-preview";let u=this.value||"#000000";if(u.startsWith("var(--")){const d=u.replace("var(--","").replace(")","");u=(Le.GlobalVariables||{})[d]||"#000000"}h.style.backgroundColor=u;const p=document.createElement("input");p.type="text",p.className="color-text-input",p.value=this.value||"",p.placeholder="#000000",p.setAttribute("pattern","#[0-9A-Fa-f]{6}"),p.setAttribute("title","Enter a hex color value (e.g., #ff0000)"),p.setAttribute("aria-label","Hex color value"),p.setAttribute("maxlength","7"),this.getDataPropsPath()&&p.setAttribute("data-test-id",`${this.getDataPropsPath()}_text`),this.textInputEl=p;const m=d=>{var x,w;let g=d.trim();if(g&&!g.startsWith("#")&&!g.startsWith("var(")&&/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(g)&&(g="#"+g,this.textInputEl&&(this.textInputEl.value=g)),this.textInputEl&&c(this.textInputEl)){const v=Zt.normalizeColorValue(g);this.value=v,(x=this.onChange)==null||x.call(this,v),(w=this.detectChange)==null||w.call(this,v),this.colorInputEl&&(this.colorInputEl.value=v),h.style.backgroundColor=v}};return this.textInputEl.addEventListener("input",d=>{const g=d.target.value;m(g)}),this.textInputEl.addEventListener("paste",d=>{var x;d.preventDefault();const g=((x=d.clipboardData)==null?void 0:x.getData("text"))||"";this.textInputEl&&(this.textInputEl.value=g.trim(),m(g))}),this.textInputEl.addEventListener("keydown",d=>{var g,x,w;d.key==="Enter"&&(d.preventDefault(),m(((g=this.textInputEl)==null?void 0:g.value)||""),(x=this.textInputEl)==null||x.blur()),d.key==="Escape"&&(this.textInputEl&&this.value&&(this.textInputEl.value=this.value),(w=this.textInputEl)==null||w.blur(),r.classList.remove("error"))}),this.colorInputEl.addEventListener("input",d=>{var w,v;const g=d.target.value,x=Zt.normalizeColorValue(g);this.value=x,(w=this.onChange)==null||w.call(this,x),(v=this.detectChange)==null||v.call(this,x),this.textInputEl&&(this.textInputEl.value=x),h.style.backgroundColor=x,r.classList.remove("error")}),this.colorInputEl.addEventListener("change",d=>{var w,v;const g=d.target.value,x=Zt.normalizeColorValue(g);this.value=x,(w=this.onChange)==null||w.call(this,x),(v=this.detectChange)==null||v.call(this,x),this.textInputEl&&(this.textInputEl.value=x),h.style.backgroundColor=x}),s.appendChild(f),s.appendChild(h),s.appendChild(p),r.appendChild(a),r.appendChild(s),r.appendChild(o),e.appendChild(r),this.element=e,e}getElement(){return this.element}getNormalizedValue(){return this.value?Zt.normalizeColorValue(this.value):"#000000"}isValidHex(){return this.value?/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(this.value):!1}toRgb(){return this.isValidHex()?this.hexToRgb(this.value):"0, 0, 0"}}const Cf=`
|
|
107
|
+
</svg>`;f.innerHTML=`${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel??"Add"}</span>`,f.addEventListener("click",u=>{u.stopPropagation(),u.preventDefault();const p=this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),m=this.addItemCfg.createItem(p);if(Mi(m)){const d=`${this.addItemCfg.keyPrefix}${p}`;this.addSetting(d,m)}}),o.appendChild(f)}return r.appendChild(a),r.appendChild(i),e.appendChild(r),e.appendChild(o),this.elementRef=e,Ys.trackElement(e),setTimeout(()=>{this.updateNestingStyles()},0),this.pendingBlurHandler&&(this.pendingBlurHandler=null),e}collapse(){if(!this.elementRef||this.isCollapsed)return;const e=this.elementRef.querySelector(".setting-group-content"),r=this.elementRef.querySelector(".setting-group-arrow"),a=this.elementRef.querySelector(".setting-group-title");e&&r&&a&&(this.isCollapsed=!0,e.classList.add("collapsed"),r.classList.add("rotated"),a.setAttribute("aria-expanded","false"))}expand(){if(!this.elementRef||!this.isCollapsed)return;const e=this.elementRef.querySelector(".setting-group-content"),r=this.elementRef.querySelector(".setting-group-arrow"),a=this.elementRef.querySelector(".setting-group-title");e&&r&&a&&(this.isCollapsed=!1,e.classList.remove("collapsed"),r.classList.remove("rotated"),a.setAttribute("aria-expanded","true"))}getJson(){return JSON.stringify(this.getValuesForJson(),null,2)}setJson(e){try{const r=JSON.parse(e);let a=r;const n=Object.keys(this.settings),i=Object.keys(r);if(!n.some(o=>i.includes(o))&&i.length===1){const o=i[0];a=r[o]}this.setValue(a)}catch(r){throw console.error("Invalid JSON provided to setJson:",r),new Error("Invalid JSON format")}}};ni.hiddenElements=new Set;let ir=ni;function vf(t){return new ts(t)}class ts extends ir{constructor(e){super(e);const r=Object.keys(this.settings)[0];this.activeTabId=r||""}getActiveTabId(){return this.activeTabId}switchToTab(e){if(!this.settings[e]||this.activeTabId===e)return;this.activeTabId=e,this.updateTabUI();const r=this.getValues();this.initialValues=r}getValues(e){return e!==void 0?super.getValues(e):{...super.getValues(),activeTabId:this.activeTabId}}updateTabUI(){if(!this.tabsContainer||!this.contentContainers)return;this.tabsContainer.querySelectorAll(".tab-button").forEach(r=>{r.getAttribute("data-tab-id")===this.activeTabId?r.classList.add("active"):r.classList.remove("active")}),Object.entries(this.contentContainers).forEach(([r,a])=>{r===this.activeTabId?a.classList.add("active"):a.classList.remove("active")})}draw(){const e=super.draw();e.classList.add("tabs-settings-container");const r=e.querySelector(".setting-group-content");if(!r)return e;r.innerHTML="";const a=document.createElement("div");a.className="tabs-title";const n=document.createElement("h3");n.textContent=this.title,a.appendChild(n);const i=document.createElement("div");i.className="tabs-header",this.tabsContainer=i;const s=document.createElement("div");if(s.className="tab-content",this.contentContainers={},Object.keys(this.settings).forEach((o,l)=>{const c=document.createElement("button");c.className="tab-button",c.type="button",c.setAttribute("data-tab-id",o),c.textContent=o,c.addEventListener("click",()=>this.switchToTab(o)),i.appendChild(c);const f=document.createElement("div");f.className="tab-panel",this.contentContainers[o]=f;const h=this.settings[o];h&&($e(h)&&typeof h.setNestingLevel=="function"&&h.setNestingLevel(this.getNestingLevel()+1),f.appendChild(h.draw())),s.appendChild(f),l===0&&!this.activeTabId&&(this.activeTabId=o)}),r.appendChild(a),r.appendChild(i),r.appendChild(s),!this.activeTabId){const o=Object.keys(this.settings)[0];this.activeTabId=o||""}return this.updateTabUI(),e}}function w0(t){return new ir(t)}function Ef(t){return t}class C0 extends Le{constructor(e={}){super(e),this.inputType="text",e.onChange&&this.setOnChange(e.onChange)}draw(){const e=r=>{this.props.maxLength!==void 0&&(r.maxLength=this.props.maxLength),this.props.className&&r.classList.add(this.props.className)};return this.createInput({value:this.value,inputType:this.inputType,title:this.props.title,placeholder:this.props.placeholder,icon:this.props.icon,inputClassName:"string-setting-input "+(this.props.inputClassName||""),wrapperClassName:"string-setting-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:e})}}const wf="<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' strokeLinecap='round' strokeLinejoin='round'/></svg>";class Zt extends C0{constructor(e){super({...e,icon:e.icon||wf,title:e.title||"Color",default:e.default?Zt.normalizeColorValue(e.default):"#000000"}),this.inputType="color",this.element=null,this.colorInputEl=null,this.textInputEl=null,this.detectChange=e.detectChange}static normalizeColorValue(e){return e.startsWith("var(--")?e:e.startsWith("#")?Zt.normalizeHexValue(e):e.includes(",")?Zt.rgbToHexStatic(e):Zt.normalizeHexValue(e)}static normalizeHexValue(e){return e=e.replace("#",""),e.length===3&&(e=e.split("").map(r=>r+r).join("")),e.length!==6?(console.warn(`Invalid hex value "${e}", using default "#000000"`),"#000000"):/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:(console.warn(`Invalid hex value "${e}", using default "#000000"`),"#000000")}static rgbToHexStatic(e){const r=e.split(",").map(f=>parseInt(f.trim()));if(r.length!==3||r.some(isNaN))return console.warn(`Invalid RGB value "${e}", using default "#000000"`),"#000000";const[a,n,i]=r,s=Math.max(0,Math.min(255,a)),o=Math.max(0,Math.min(255,n)),l=Math.max(0,Math.min(255,i)),c=f=>{const h=f.toString(16);return h.length===1?"0"+h:h};return`#${c(s)}${c(o)}${c(l)}`}setValue(e){if(e===void 0){this.value="#000000",this.colorInputEl&&(this.colorInputEl.value="#000000"),this.textInputEl&&(this.textInputEl.value="#000000"),this.onChange&&this.onChange("#000000"),this.props.detectChange&&this.props.detectChange("#000000");return}if(typeof e=="string"){const r=Zt.normalizeColorValue(e);this.value=r,this.colorInputEl&&(this.colorInputEl.value=r),this.textInputEl&&(this.textInputEl.value=r),this.onChange&&this.onChange(r),this.props.detectChange&&this.props.detectChange(r)}else this.value="#000000",this.colorInputEl&&(this.colorInputEl.value="#000000"),this.textInputEl&&(this.textInputEl.value="#000000"),this.onChange&&this.onChange("#000000"),this.props.detectChange&&this.props.detectChange("#000000")}hexToRgb(e){e=e.replace("#","");const r=parseInt(e.substring(0,2),16),a=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return`${r}, ${a}, ${n}`}draw(){const e=document.createElement("div");if(e.className="color-setting-wrapper "+(this.props.wrapperClassName||""),this.props.title||this.props.icon){const d=document.createElement("div");if(d.className="icon-container",this.props.icon){const g=document.createElement("span");g.className="input-icon",g.innerHTML=this.props.icon,d.appendChild(g)}if(this.props.title){const g=document.createElement("span");g.className="input-label",g.textContent=this.props.title,d.appendChild(g)}e.appendChild(d)}const r=document.createElement("div");r.className="color-input-wrapper";const a=document.createElement("div");a.className="color-setting-tabs",a.style.display="flex",a.style.marginBottom="8px",a.style.gap="4px";const n=document.createElement("button");n.className="color-tab active",n.textContent="Solid";const i=document.createElement("button");i.className="color-tab",i.textContent="Global",a.appendChild(n),a.appendChild(i);const s=document.createElement("div");s.className="color-content-solid";const o=document.createElement("div");o.className="color-content-global",o.style.display="none",o.style.display="grid",o.style.gridTemplateColumns="repeat(auto-fill, minmax(30px, 1fr))",o.style.gap="8px";const l=()=>{try{if(o.innerHTML="",!Le){console.error("ColorSetting: Setting class is undefined");const g=document.createElement("div");g.textContent="Error: System error (Setting undefined)",o.appendChild(g);return}const d=Le.GlobalVariables||{};if(!d||Object.keys(d).length===0){const g=document.createElement("div");g.textContent="No global colors defined",g.style.gridColumn="1 / -1",g.style.fontSize="12px",g.style.color="#666",o.appendChild(g);return}Object.entries(d).forEach(([g,x])=>{const w=document.createElement("button");w.className="global-color-btn",w.title=g,w.style.width="30px",w.style.height="30px",w.style.borderRadius="50%",w.style.border="1px solid #ddd",w.style.backgroundColor=x,w.style.cursor="pointer",this.value===`var(--${g})`&&(w.style.border="2px solid #2196f3"),w.addEventListener("click",v=>{var N,A;v.preventDefault();const F=`var(--${g})`;this.value=F,(N=this.onChange)==null||N.call(this,F),(A=this.detectChange)==null||A.call(this,F),Array.from(o.children).forEach(y=>{y.style.border="1px solid #ddd"}),w.style.border="2px solid #2196f3",h.style.backgroundColor=x}),o.appendChild(w)})}catch(d){console.error("ColorSetting: Error in renderGlobalOptions",d),o.innerHTML="Error loading global options"}};l(),n.addEventListener("click",d=>{d.preventDefault(),n.classList.add("active"),i.classList.remove("active"),s.style.display="flex",o.style.display="none",this.value&&this.value.startsWith("var(--")}),i.addEventListener("click",d=>{d.preventDefault(),i.classList.add("active"),n.classList.remove("active"),s.style.display="none",o.style.display="grid",l()}),this.value&&this.value.startsWith("var(--")?i.click():n.click();const c=d=>{const g=d.value.trim();if(!g)return r.classList.remove("error"),!0;const w=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(g);return w?r.classList.remove("error"):r.classList.add("error"),w},f=document.createElement("input");f.type="color",f.className="color-picker",f.value=this.value&&!this.value.startsWith("var(--")?this.value:"#000000",f.setAttribute("aria-label","Choose color"),f.setAttribute("title","Click to open color picker"),this.getDataPropsPath()&&f.setAttribute("data-test-id",this.getDataPropsPath()),this.colorInputEl=f;const h=document.createElement("div");h.className="color-preview";let u=this.value||"#000000";if(u.startsWith("var(--")){const d=u.replace("var(--","").replace(")","");u=(Le.GlobalVariables||{})[d]||"#000000"}h.style.backgroundColor=u;const p=document.createElement("input");p.type="text",p.className="color-text-input",p.value=this.value||"",p.placeholder="#000000",p.setAttribute("pattern","#[0-9A-Fa-f]{6}"),p.setAttribute("title","Enter a hex color value (e.g., #ff0000)"),p.setAttribute("aria-label","Hex color value"),p.setAttribute("maxlength","7"),this.getDataPropsPath()&&p.setAttribute("data-test-id",`${this.getDataPropsPath()}_text`),this.textInputEl=p;const m=d=>{var x,w;let g=d.trim();if(g&&!g.startsWith("#")&&!g.startsWith("var(")&&/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(g)&&(g="#"+g,this.textInputEl&&(this.textInputEl.value=g)),this.textInputEl&&c(this.textInputEl)){const v=Zt.normalizeColorValue(g);this.value=v,(x=this.onChange)==null||x.call(this,v),(w=this.detectChange)==null||w.call(this,v),this.colorInputEl&&(this.colorInputEl.value=v),h.style.backgroundColor=v}};return this.textInputEl.addEventListener("input",d=>{const g=d.target.value;m(g)}),this.textInputEl.addEventListener("paste",d=>{var x;d.preventDefault();const g=((x=d.clipboardData)==null?void 0:x.getData("text"))||"";this.textInputEl&&(this.textInputEl.value=g.trim(),m(g))}),this.textInputEl.addEventListener("keydown",d=>{var g,x,w;d.key==="Enter"&&(d.preventDefault(),m(((g=this.textInputEl)==null?void 0:g.value)||""),(x=this.textInputEl)==null||x.blur()),d.key==="Escape"&&(this.textInputEl&&this.value&&(this.textInputEl.value=this.value),(w=this.textInputEl)==null||w.blur(),r.classList.remove("error"))}),this.colorInputEl.addEventListener("input",d=>{var w,v;const g=d.target.value,x=Zt.normalizeColorValue(g);this.value=x,(w=this.onChange)==null||w.call(this,x),(v=this.detectChange)==null||v.call(this,x),this.textInputEl&&(this.textInputEl.value=x),h.style.backgroundColor=x,r.classList.remove("error")}),this.colorInputEl.addEventListener("change",d=>{var w,v;const g=d.target.value,x=Zt.normalizeColorValue(g);this.value=x,(w=this.onChange)==null||w.call(this,x),(v=this.detectChange)==null||v.call(this,x),this.textInputEl&&(this.textInputEl.value=x),h.style.backgroundColor=x}),s.appendChild(f),s.appendChild(h),s.appendChild(p),r.appendChild(a),r.appendChild(s),r.appendChild(o),e.appendChild(r),this.element=e,e}getElement(){return this.element}getNormalizedValue(){return this.value?Zt.normalizeColorValue(this.value):"#000000"}isValidHex(){return this.value?/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(this.value):!1}toRgb(){return this.isValidHex()?this.hexToRgb(this.value):"0, 0, 0"}}const Cf=`
|
|
108
108
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
109
109
|
<path d="M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z" stroke="#667085" strokeLinecap="round" strokeLinejoin="round"/>
|
|
110
110
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" strokeWidth="0.5" strokeLinecap="round" strokeLinejoin="round" opacity="0.5"/>
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
<path d="M13.5 15C14.1989 15 14.5484 15 14.824 14.8858C15.1916 14.7336 15.4836 14.4416 15.6358 14.074C15.75 13.7984 15.75 13.4489 15.75 12.75C15.75 12.0511 15.75 11.7016 15.6358 11.426C15.4836 11.0584 15.1916 10.7664 14.824 10.6142C14.5484 10.5 14.1989 10.5 13.5 10.5H4.5C3.80109 10.5 3.45163 10.5 3.17598 10.6142C2.80843 10.7664 2.51642 11.0584 2.36418 11.426C2.25 11.7016 2.25 12.0511 2.25 12.75C2.25 13.4489 2.25 13.7984 2.36418 14.074C2.51642 14.4416 2.80843 14.7336 3.17597 14.8858C3.45163 15 3.80109 15 4.5 15L13.5 15Z"
|
|
139
139
|
stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
|
|
140
140
|
</svg>
|
|
141
|
-
`}].forEach(i=>{const s=document.createElement("button");s.className="align-option-button",s.innerHTML=i.icon,this.getDataPropsPath()&&s.setAttribute("data-test-id",`${this.getDataPropsPath()}_${i.name}`),this.value===i.name&&s.classList.add("selected"),s.addEventListener("click",()=>{var o;a.querySelectorAll(".align-option-button").forEach(l=>l.classList.remove("selected")),s.classList.add("selected"),this.value=i.name,(o=this.onChange)==null||o.call(this,this.value)}),a.appendChild(s)}),e.appendChild(a),e}}class Tf extends Le{constructor(e){super(e),this.inputType="button",this.bgWithAlpha="rgba(145, 158, 171, 0.08)"}draw(){const e=document.createElement("button");e.className="button-setting "+(this.props.className||""),e.textContent=this.props.label,e.style.borderColor=this.props.borderColor||"rgba(145, 158, 171, 0.32)",this.getDataPropsPath()&&e.setAttribute("data-test-id",this.getDataPropsPath());const r=this.props.backgroundColor||"rgba(0,0,0,0)",a=this.props.textColor||"black";e.style.backgroundColor=r,e.style.color=a;let n=r;const i=r.match(/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i);if(i){let o=+i[1],l=+i[2],c=+i[3],f=+i[4];f>=1?(o=Math.round(o*.9),l=Math.round(l*.9),c=Math.round(c*.9)):f=Math.min(1,f+.12),n=`rgba(${o},${l},${c},${f})`}e.addEventListener("mouseenter",()=>{
|
|
141
|
+
`}].forEach(i=>{const s=document.createElement("button");s.className="align-option-button",s.innerHTML=i.icon,this.getDataPropsPath()&&s.setAttribute("data-test-id",`${this.getDataPropsPath()}_${i.name}`),this.value===i.name&&s.classList.add("selected"),s.addEventListener("click",()=>{var o;a.querySelectorAll(".align-option-button").forEach(l=>l.classList.remove("selected")),s.classList.add("selected"),this.value=i.name,(o=this.onChange)==null||o.call(this,this.value)}),a.appendChild(s)}),e.appendChild(a),e}}class Tf extends Le{constructor(e){super(e),this.inputType="button",this.bgWithAlpha="rgba(145, 158, 171, 0.08)"}draw(){const e=document.createElement("button");e.className="button-setting "+(this.props.className||""),e.textContent=this.props.label,e.style.borderColor=this.props.borderColor||"rgba(145, 158, 171, 0.32)",this.getDataPropsPath()&&e.setAttribute("data-test-id",this.getDataPropsPath());const r=this.props.backgroundColor||"rgba(0,0,0,0)",a=this.props.textColor||"black";e.style.backgroundColor=r,e.style.color=a;let n=r;const i=r.match(/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i);if(i){let o=+i[1],l=+i[2],c=+i[3],f=+i[4];f>=1?(o=Math.round(o*.9),l=Math.round(l*.9),c=Math.round(c*.9)):f=Math.min(1,f+.12),n=`rgba(${o},${l},${c},${f})`}e.addEventListener("mouseenter",()=>{e.style.setProperty("background-color",n,"important")}),e.addEventListener("mouseleave",()=>{e.style.setProperty("background-color",r,"important")}),e.addEventListener("click",()=>{var o,l;return(l=(o=this.props).onClick)==null?void 0:l.call(o)});const s=document.createElement("div");return s.className="button-setting-wrapper "+(this.props.wrapperClassName||""),s.appendChild(e),s}}class Sf extends Le{constructor(e={}){super(e),this.inputType={width:"number",height:"number"},this.aspectRatio=1,this.isUpdating=!1;const r=e.width||0,a=e.height||0;this.value||(this.value={width:r,height:a}),this.minWidth=e.minWidth??0,this.maxWidth=e.maxWidth,this.minHeight=e.minHeight??0,this.maxHeight=e.maxHeight,this.locked=e.locked??!1,this.value.height>0&&(this.aspectRatio=this.value.width/this.value.height),this.widthSetting=new sr({title:"Width",default:this.value.width,suffix:"px",minValue:this.minWidth,maxValue:this.maxWidth,icon:bf}),this.heightSetting=new sr({title:"Height",default:this.value.height,suffix:"px",minValue:this.minHeight,maxValue:this.maxHeight,icon:Ff}),this.widthSetting.setOnChange(this.handleWidthChange.bind(this)),this.heightSetting.setOnChange(this.handleHeightChange.bind(this))}handleWidthChange(e){if(!this.isUpdating&&!(isNaN(e)||e<0)){e=Math.max(this.minWidth,e),this.maxWidth&&e>this.maxWidth&&(e=this.maxWidth),this.isUpdating=!0;try{let r=e,a=this.value.height;this.locked&&this.aspectRatio>0&&(a=Math.round(r/this.aspectRatio),this.maxHeight&&a>this.maxHeight&&(a=this.maxHeight,r=Math.round(a*this.aspectRatio),this.maxWidth&&r>this.maxWidth&&(r=this.maxWidth,a>0&&(this.aspectRatio=r/a)))),this.value={width:r,height:a},this.widthSetting.setValue(r),this.locked&&this.heightSetting.setValue(a),this.onChange&&this.onChange(this.value)}finally{this.isUpdating=!1}}}handleHeightChange(e){if(!this.isUpdating&&!(isNaN(e)||e<0)){e=Math.max(this.minHeight,e),this.maxHeight&&e>this.maxHeight&&(e=this.maxHeight),this.isUpdating=!0;try{let r=e,a=this.value.width;this.locked&&this.aspectRatio>0&&(a=Math.round(r*this.aspectRatio),this.maxWidth&&a>this.maxWidth&&(a=this.maxWidth,r=Math.round(a/this.aspectRatio),this.maxHeight&&r>this.maxHeight&&(r=this.maxHeight,r>0&&(this.aspectRatio=a/r)))),this.value={width:a,height:r},this.locked&&this.widthSetting.setValue(a),this.heightSetting.setValue(r),this.onChange&&this.onChange(this.value)}finally{this.isUpdating=!1}}}toggleLock(e){if(this.locked=!this.locked,this.locked&&this.value){const{width:a,height:n}=this.value;n>0&&(this.aspectRatio=a/n)}e.innerHTML=this.getLockSVG(this.locked),e.setAttribute("aria-pressed",String(this.locked)),e.title=this.locked?"Unlock aspect ratio":"Lock aspect ratio";const r=e.closest(".dimension-setting-container");r&&(this.locked?r.classList.add("aspect-locked"):r.classList.remove("aspect-locked")),e.style.transform="scale(0.9)",setTimeout(()=>{e.style.transform="scale(1)"},100)}getLockSVG(e){return e?`
|
|
142
142
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
143
143
|
<path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25C6.00786 1.25 6.84859 1.96573 7.04162 2.91667M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
|
|
144
144
|
</svg>`:`
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
<path d="M9.39651 1.01051C11.3739 1.1085 13.2506 1.93712 14.6572 3.34372C16.1573 4.84391 16.9999 6.87849 17 9C17 11.1217 16.1575 13.157 14.6572 14.6572C13.157 16.1575 11.1217 17 9 17C6.87849 16.9999 4.84391 16.1573 3.34372 14.6572C1.84345 13.157 1 11.1217 1 9C1.00007 6.8784 1.84352 4.84393 3.34372 3.34372C4.84393 1.84352 6.8784 1.00007 9 1L9.39651 1.01051ZM6.37728 9.63633C6.4447 11.3419 6.77841 12.8501 7.26681 13.9492C7.54127 14.5668 7.85143 15.0276 8.16398 15.3251C8.47319 15.6194 8.75489 15.7282 9 15.7283C9.24512 15.7283 9.52678 15.6193 9.83602 15.3251C10.1486 15.0276 10.4587 14.5668 10.7332 13.9492C11.2216 12.8501 11.5563 11.3419 11.6237 9.63633L6.37728 9.63633ZM2.30324 9.63633C2.45049 11.1873 3.13189 12.6472 4.2428 13.7582C4.89509 14.4104 5.66859 14.9125 6.50914 15.2477C6.36305 15.0042 6.22802 14.7421 6.10498 14.4652C5.53369 13.1795 5.17153 11.4895 5.10367 9.63633H2.30324ZM12.8963 9.63633C12.8285 11.4894 12.4672 13.1795 11.896 14.4652C11.7729 14.7422 11.637 15.0041 11.4909 15.2477C12.3317 14.9125 13.1057 14.4106 13.7582 13.7582C14.8691 12.6472 15.5505 11.1873 15.6977 9.63633H12.8963ZM11.4918 2.7523C11.6379 2.99583 11.7729 3.25794 11.896 3.53481C12.4673 4.8206 12.8285 6.51129 12.8963 8.36462H15.6977C15.5506 6.81361 14.869 5.3538 13.7582 4.2428C13.1059 3.59052 12.3324 3.0875 11.4918 2.7523ZM9 2.27266C8.75489 2.27274 8.47319 2.38159 8.16398 2.67586C7.85146 2.97338 7.54123 3.43415 7.26681 4.05171C6.77841 5.1509 6.44466 6.65897 6.37728 8.36462H11.6237C11.5563 6.65889 11.2216 5.15091 10.7332 4.05171C10.4587 3.434 10.1486 2.97336 9.83602 2.67586C9.5267 2.38149 9.24517 2.27266 9 2.27266ZM6.50818 2.7523C5.6678 3.0875 4.89497 3.59064 4.2428 4.2428C3.13179 5.35382 2.4504 6.81352 2.30324 8.36462H5.10367C5.17149 6.51128 5.53363 4.8206 6.10498 3.53481C6.22796 3.25809 6.36217 2.99572 6.50818 2.7523Z" fill="#637381"/>
|
|
315
315
|
</svg>`,Sh=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
316
316
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9942 13.4085L17.6485 19.0631C17.837 19.2452 18.0894 19.346 18.3515 19.3437C18.6136 19.3414 18.8643 19.2363 19.0496 19.051C19.2349 18.8656 19.34 18.6149 19.3423 18.3528C19.3446 18.0908 19.2438 17.8383 19.0618 17.6497L13.4075 11.9951L19.0618 6.34039C19.2438 6.15186 19.3446 5.89936 19.3423 5.63728C19.34 5.37519 19.2349 5.12448 19.0496 4.93915C18.8643 4.75381 18.6136 4.64869 18.3515 4.64641C18.0894 4.64413 17.837 4.74489 17.6485 4.92697L11.9942 10.5816L6.33992 4.92697C6.15056 4.74939 5.89954 4.65245 5.63999 4.65666C5.38043 4.66088 5.13269 4.76592 4.9492 4.94955C4.76571 5.13319 4.66085 5.38102 4.65682 5.6406C4.65279 5.90018 4.7499 6.15114 4.9276 6.34039L10.5809 11.9951L4.9266 17.6497C4.83114 17.7419 4.75499 17.8522 4.70261 17.9742C4.65022 18.0961 4.62265 18.2273 4.6215 18.36C4.62034 18.4928 4.64563 18.6244 4.69589 18.7472C4.74615 18.8701 4.82036 18.9817 4.91421 19.0755C5.00806 19.1694 5.11966 19.2436 5.24249 19.2939C5.36533 19.3441 5.49695 19.3694 5.62966 19.3683C5.76238 19.3671 5.89353 19.3395 6.01548 19.2872C6.13742 19.2348 6.24772 19.1586 6.33992 19.0631L11.9942 13.4085Z" fill="#637381"/>
|
|
317
|
-
</svg>`,Bi="Enter text in {language}...",bh="Enter text in ",xe=(t,e,r)=>({label:e,placeholder:`${bh}${t}`}),b0={en:xe("en","English"),ka:xe("ka","ქართული"),de:xe("de","Deutsch"),fr:xe("fr","Français"),es:xe("es","Español"),it:xe("it","Italiano"),pt:xe("pt","Português"),nl:xe("nl","Nederlands"),sv:xe("sv","Svenska"),no:xe("no","Norsk"),da:xe("da","Dansk"),fi:xe("fi","Suomi"),pl:xe("pl","Polski"),cs:xe("cs","Čeština"),sk:xe("sk","Slovenčina"),hu:xe("hu","Magyar"),ro:xe("ro","Română"),bg:xe("bg","Български"),uk:xe("uk","Українська"),ru:xe("ru","Русский"),sr:xe("sr","Српски"),hr:xe("hr","Hrvatski"),sl:xe("sl","Slovenščina"),el:xe("el","Ελληνικά"),tr:xe("tr","Türkçe"),ar:xe("ar","العربية"),he:xe("he","עברית"),fa:xe("fa","فارسی"),ur:xe("ur","اردو"),hi:xe("hi","हिन्दी"),bn:xe("bn","বাংলা"),ta:xe("ta","தமிழ்"),te:xe("te","తెలుగు"),mr:xe("mr","मराठी"),gu:xe("gu","ગુજરાતી"),pa:xe("pa","ਪੰਜਾਬੀ"),th:xe("th","ไทย"),vi:xe("vi","TiếngViệt"),id:xe("id","BahasaIndonesia"),ms:xe("ms","BahasaMelayu"),fil:xe("fil","Filipino"),zh:xe("zh","中文"),ja:xe("ja","日本語"),ko:xe("ko","한국어"),sw:xe("sw","Kiswahili"),am:xe("am","አማርኛ"),yo:xe("yo","Yorùbá"),zu:xe("zu","IsiZulu")};function F0(t){var r,a;const e=b0[((r=t==null?void 0:t.toLowerCase)==null?void 0:r.call(t))||""];return e!=null&&e.label?e.label:((a=t==null?void 0:t.toUpperCase)==null?void 0:a.call(t))||String(t)}function Vn(t,e=Bi){var n;const r=b0[((n=t==null?void 0:t.toLowerCase)==null?void 0:n.call(t))||""];if(r!=null&&r.placeholder)return r.placeholder;const a=F0(t);return e.includes("{language}")?e.replace("{language}",a):e}function Fh(t){const e=document.createElement("div");e.classList.add("simple-multi-language-title");const r=document.createElement("span");r.textContent=t.title??"";const a=document.createElement("button");return a.classList.add("multi-language-eye-icon"),a.innerHTML=Th,a.addEventListener("click",n=>{n.preventDefault(),t.onEyeIconClick()}),e.appendChild(r),e.appendChild(a),e}let xi;function no(t,e){xi||(xi=document.createElement("canvas"));const r=xi.getContext("2d");if(!r)return t.length*10;const a=`${e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`.trim();return r.font=a,r.measureText(t).width}function Kr(t,e){const r=window.getComputedStyle(t),a=parseFloat(r.paddingLeft)||0,n=parseFloat(r.paddingRight)||0,i=parseFloat(r.borderLeftWidth)||0,s=parseFloat(r.borderRightWidth)||0,o=Math.max(0,t.clientWidth-a-n-i-s);if(o<=0){t.placeholder=e;return}if(no(e,r)<=o){t.placeholder=e;return}const c="...";let f=0,h=e.length,u=0;for(;f<=h;){const m=Math.floor((f+h)/2),d=e.slice(0,m).trimEnd()+c;no(d,r)<=o?(u=m,f=m+1):h=m-1}const p=e.slice(0,u).trimEnd()+c;t.placeholder=p}function rs(t,e=3){t.style.height="auto";const r=window.getComputedStyle(t),a=parseFloat(r.lineHeight)||20,n=parseFloat(r.paddingTop)+parseFloat(r.paddingBottom),i=parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth),s=a*e+n+i,o=Math.min(t.scrollHeight||55,s);t.style.height=`${o}px`,t.scrollHeight>s?t.style.overflowY="auto":t.style.overflowY="hidden"}function Lh(t,e=3){requestAnimationFrame(()=>{t.offsetHeight,rs(t,e);const r=t.getAttribute("data-full-placeholder");r&&Kr(t,r)})}function L0(t){const e=document.createElement("div");e.classList.add("simple-multi-language-row");const r=document.createElement("label");if(r.classList.add("simple-language-label"),r.textContent=F0(t.languageCode),r.setAttribute("for",`textarea-${t.languageCode}`),e.appendChild(r),t.multiImg&&t.uploadSetting){const a=t.uploadSetting.draw();a.classList.add("simple-language-upload"),e.appendChild(a)}else{const a=document.createElement("textarea");a.id=`textarea-${t.languageCode}`,a.classList.add("simple-language-textarea"),t.isPopupMode&&a.classList.add("popup-mode"),a.value=t.value||"",a.rows=1,a.style.overflowY="hidden",a.setAttribute("data-full-placeholder",t.placeholder),Kr(a,t.placeholder),t.dataTestId&&a.setAttribute("data-test-id",t.dataTestId);const n=t.maxRows??3;a.addEventListener("input",i=>{const s=i.target;t.onInput(t.languageCode,s.value),rs(s,n);const o=a.getAttribute("data-full-placeholder")||"";o&&Kr(a,o)}),e.appendChild(a),Lh(a,n)}return e}function Ah(t){const e=document.createElement("div");e.classList.add("multi-language-popup-overlay");const r=document.createElement("div");r.classList.add("multi-language-popup");const a=document.createElement("div");a.classList.add("multi-language-popup-header");const n=document.createElement("h3");n.classList.add("multi-language-popup-title"),n.textContent="All Languages";const i=document.createElement("button");i.classList.add("multi-language-close-button"),i.innerHTML=Sh,i.addEventListener("click",()=>t.onClose()),a.appendChild(n),a.appendChild(i),r.appendChild(a);const s=document.createElement("div");s.classList.add("multi-language-popup-content"),t.languages.forEach(c=>{var d;const f=((d=t.values)==null?void 0:d[c])||"",h=Vn(c,t.placeholder),u=t.uploadSettings.get(c),p=t.dataTestPath?`${t.dataTestPath}_${c}`:void 0,m=L0({languageCode:c,value:f,placeholder:h,isDefaultLanguage:!1,isPopupMode:!0,multiImg:t.multiImg,onInput:t.onInput,uploadSetting:u,dataTestId:p});s.appendChild(m)}),r.appendChild(s);const o=document.createElement("div");o.classList.add("multi-language-popup-footer");const l=document.createElement("button");return l.classList.add("multi-language-done-button"),l.textContent="Done",l.addEventListener("click",()=>t.onClose()),o.appendChild(l),r.appendChild(o),e.appendChild(r),e.addEventListener("mousedown",c=>{c.target===e&&t.onClose()}),e}/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */var zn={};zn.version="0.18.5";var A0=1252,Ih=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],as={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969},ns=function(t){Ih.indexOf(t)!=-1&&(A0=as[0]=t)};function Nh(){ns(1252)}var tr=function(t){ns(t)};function is(){tr(1200),Nh()}function io(t){for(var e=[],r=0,a=t.length;r<a;++r)e[r]=t.charCodeAt(r);return e}function Mh(t){for(var e=[],r=0;r<t.length>>1;++r)e[r]=String.fromCharCode(t.charCodeAt(2*r)+(t.charCodeAt(2*r+1)<<8));return e.join("")}function I0(t){for(var e=[],r=0;r<t.length>>1;++r)e[r]=String.fromCharCode(t.charCodeAt(2*r+1)+(t.charCodeAt(2*r)<<8));return e.join("")}var Ha=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1);return e==255&&r==254?Mh(t.slice(2)):e==254&&r==255?I0(t.slice(2)):e==65279?t.slice(1):t},kn=function(e){return String.fromCharCode(e)},so=function(e){return String.fromCharCode(e)},Vi,Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function en(t){for(var e="",r=0,a=0,n=0,i=0,s=0,o=0,l=0,c=0;c<t.length;)r=t.charCodeAt(c++),i=r>>2,a=t.charCodeAt(c++),s=(r&3)<<4|a>>4,n=t.charCodeAt(c++),o=(a&15)<<2|n>>6,l=n&63,isNaN(a)?o=l=64:isNaN(n)&&(l=64),e+=Mr.charAt(i)+Mr.charAt(s)+Mr.charAt(o)+Mr.charAt(l);return e}function Bt(t){var e="",r=0,a=0,n=0,i=0,s=0,o=0,l=0;t=t.replace(/[^\w\+\/\=]/g,"");for(var c=0;c<t.length;)i=Mr.indexOf(t.charAt(c++)),s=Mr.indexOf(t.charAt(c++)),r=i<<2|s>>4,e+=String.fromCharCode(r),o=Mr.indexOf(t.charAt(c++)),a=(s&15)<<4|o>>2,o!==64&&(e+=String.fromCharCode(a)),l=Mr.indexOf(t.charAt(c++)),n=(o&3)<<6|l,l!==64&&(e+=String.fromCharCode(n));return e}var _e=function(){return typeof Buffer<"u"&&typeof process<"u"&&typeof process.versions<"u"&&!!process.versions.node}(),br=function(){if(typeof Buffer<"u"){var t=!Buffer.from;if(!t)try{Buffer.from("foo","utf8")}catch{t=!0}return t?function(e,r){return r?new Buffer(e,r):new Buffer(e)}:Buffer.from.bind(Buffer)}return function(){}}();function Pr(t){return _e?Buffer.alloc?Buffer.alloc(t):new Buffer(t):typeof Uint8Array<"u"?new Uint8Array(t):new Array(t)}function oo(t){return _e?Buffer.allocUnsafe?Buffer.allocUnsafe(t):new Buffer(t):typeof Uint8Array<"u"?new Uint8Array(t):new Array(t)}var Dt=function(e){return _e?br(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)&255})};function ii(t){if(typeof ArrayBuffer>"u")return Dt(t);for(var e=new ArrayBuffer(t.length),r=new Uint8Array(e),a=0;a!=t.length;++a)r[a]=t.charCodeAt(a)&255;return e}function Vr(t){if(Array.isArray(t))return t.map(function(a){return String.fromCharCode(a)}).join("");for(var e=[],r=0;r<t.length;++r)e[r]=String.fromCharCode(t[r]);return e.join("")}function Oh(t){if(typeof Uint8Array>"u")throw new Error("Unsupported");return new Uint8Array(t)}function ss(t){if(typeof ArrayBuffer>"u")throw new Error("Unsupported");if(t instanceof ArrayBuffer)return ss(new Uint8Array(t));for(var e=new Array(t.length),r=0;r<t.length;++r)e[r]=t[r];return e}var ft=_e?function(t){return Buffer.concat(t.map(function(e){return Buffer.isBuffer(e)?e:br(e)}))}:function(t){if(typeof Uint8Array<"u"){var e=0,r=0;for(e=0;e<t.length;++e)r+=t[e].length;var a=new Uint8Array(r),n=0;for(e=0,r=0;e<t.length;r+=n,++e)if(n=t[e].length,t[e]instanceof Uint8Array)a.set(t[e],r);else{if(typeof t[e]=="string")throw"wtf";a.set(new Uint8Array(t[e]),r)}return a}return[].concat.apply([],t.map(function(i){return Array.isArray(i)?i:[].slice.call(i)}))};function Ph(t){for(var e=[],r=0,a=t.length+250,n=Pr(t.length+255),i=0;i<t.length;++i){var s=t.charCodeAt(i);if(s<128)n[r++]=s;else if(s<2048)n[r++]=192|s>>6&31,n[r++]=128|s&63;else if(s>=55296&&s<57344){s=(s&1023)+64;var o=t.charCodeAt(++i)&1023;n[r++]=240|s>>8&7,n[r++]=128|s>>2&63,n[r++]=128|o>>6&15|(s&3)<<4,n[r++]=128|o&63}else n[r++]=224|s>>12&15,n[r++]=128|s>>6&63,n[r++]=128|s&63;r>a&&(e.push(n.slice(0,r)),r=0,n=Pr(65535),a=65530)}return e.push(n.slice(0,r)),ft(e)}var bt=/\u0000/g,Wa=/[\u0001-\u0006]/g;function _a(t){for(var e="",r=t.length-1;r>=0;)e+=t.charAt(r--);return e}function rr(t,e){var r=""+t;return r.length>=e?r:Ke("0",e-r.length)+r}function os(t,e){var r=""+t;return r.length>=e?r:Ke(" ",e-r.length)+r}function Xn(t,e){var r=""+t;return r.length>=e?r:r+Ke(" ",e-r.length)}function Dh(t,e){var r=""+Math.round(t);return r.length>=e?r:Ke("0",e-r.length)+r}function Rh(t,e){var r=""+t;return r.length>=e?r:Ke("0",e-r.length)+r}var lo=Math.pow(2,32);function ga(t,e){if(t>lo||t<-lo)return Dh(t,e);var r=Math.round(t);return Rh(r,e)}function jn(t,e){return e=e||0,t.length>=7+e&&(t.charCodeAt(e)|32)===103&&(t.charCodeAt(e+1)|32)===101&&(t.charCodeAt(e+2)|32)===110&&(t.charCodeAt(e+3)|32)===101&&(t.charCodeAt(e+4)|32)===114&&(t.charCodeAt(e+5)|32)===97&&(t.charCodeAt(e+6)|32)===108}var co=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],vi=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function Bh(t){return t||(t={}),t[0]="General",t[1]="0",t[2]="0.00",t[3]="#,##0",t[4]="#,##0.00",t[9]="0%",t[10]="0.00%",t[11]="0.00E+00",t[12]="# ?/?",t[13]="# ??/??",t[14]="m/d/yy",t[15]="d-mmm-yy",t[16]="d-mmm",t[17]="mmm-yy",t[18]="h:mm AM/PM",t[19]="h:mm:ss AM/PM",t[20]="h:mm",t[21]="h:mm:ss",t[22]="m/d/yy h:mm",t[37]="#,##0 ;(#,##0)",t[38]="#,##0 ;[Red](#,##0)",t[39]="#,##0.00;(#,##0.00)",t[40]="#,##0.00;[Red](#,##0.00)",t[45]="mm:ss",t[46]="[h]:mm:ss",t[47]="mmss.0",t[48]="##0.0E+0",t[49]="@",t[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',t}var me={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'},fo={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},Vh={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function Kn(t,e,r){for(var a=t<0?-1:1,n=t*a,i=0,s=1,o=0,l=1,c=0,f=0,h=Math.floor(n);c<e&&(h=Math.floor(n),o=h*s+i,f=h*c+l,!(n-h<5e-8));)n=1/(n-h),i=s,s=o,l=c,c=f;if(f>e&&(c>e?(f=l,o=i):(f=c,o=s)),!r)return[0,a*o,f];var u=Math.floor(a*o/f);return[u,a*o-u*f,f]}function Yr(t,e,r){if(t>2958465||t<0)return null;var a=t|0,n=Math.floor(86400*(t-a)),i=0,s=[],o={D:a,T:n,u:86400*(t-a)-n,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(o.u)<1e-6&&(o.u=0),e&&e.date1904&&(a+=1462),o.u>.9999&&(o.u=0,++n==86400&&(o.T=n=0,++a,++o.D)),a===60)s=r?[1317,10,29]:[1900,2,29],i=3;else if(a===0)s=r?[1317,8,29]:[1900,1,0],i=6;else{a>60&&--a;var l=new Date(1900,0,1);l.setDate(l.getDate()+a-1),s=[l.getFullYear(),l.getMonth()+1,l.getDate()],i=l.getDay(),a<60&&(i=(i+6)%7),r&&(i=zh(l,s))}return o.y=s[0],o.m=s[1],o.d=s[2],o.S=n%60,n=Math.floor(n/60),o.M=n%60,n=Math.floor(n/60),o.H=n,o.q=i,o}var N0=new Date(1899,11,31,0,0,0),Uh=N0.getTime(),Hh=new Date(1900,2,1,0,0,0);function M0(t,e){var r=t.getTime();return e?r-=1461*24*60*60*1e3:t>=Hh&&(r+=24*60*60*1e3),(r-(Uh+(t.getTimezoneOffset()-N0.getTimezoneOffset())*6e4))/(24*60*60*1e3)}function ls(t){return t.indexOf(".")==-1?t:t.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function Wh(t){return t.indexOf("E")==-1?t:t.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function $h(t){var e=t<0?12:11,r=ls(t.toFixed(12));return r.length<=e||(r=t.toPrecision(10),r.length<=e)?r:t.toExponential(5)}function Gh(t){var e=ls(t.toFixed(11));return e.length>(t<0?12:11)||e==="0"||e==="-0"?t.toPrecision(6):e}function tn(t){var e=Math.floor(Math.log(Math.abs(t))*Math.LOG10E),r;return e>=-4&&e<=-1?r=t.toPrecision(10+e):Math.abs(e)<=9?r=$h(t):e===10?r=t.toFixed(10).substr(0,12):r=Gh(t),ls(Wh(r.toUpperCase()))}function na(t,e){switch(typeof t){case"string":return t;case"boolean":return t?"TRUE":"FALSE";case"number":return(t|0)===t?t.toString(10):tn(t);case"undefined":return"";case"object":if(t==null)return"";if(t instanceof Date)return Kt(14,M0(t,e&&e.date1904),e)}throw new Error("unsupported value in General format: "+t)}function zh(t,e){e[0]-=581;var r=t.getDay();return t<60&&(r=(r+6)%7),r}function Xh(t,e,r,a){var n="",i=0,s=0,o=r.y,l,c=0;switch(t){case 98:o=r.y+543;case 121:switch(e.length){case 1:case 2:l=o%100,c=2;break;default:l=o%1e4,c=4;break}break;case 109:switch(e.length){case 1:case 2:l=r.m,c=e.length;break;case 3:return vi[r.m-1][1];case 5:return vi[r.m-1][0];default:return vi[r.m-1][2]}break;case 100:switch(e.length){case 1:case 2:l=r.d,c=e.length;break;case 3:return co[r.q][0];default:return co[r.q][1]}break;case 104:switch(e.length){case 1:case 2:l=1+(r.H+11)%12,c=e.length;break;default:throw"bad hour format: "+e}break;case 72:switch(e.length){case 1:case 2:l=r.H,c=e.length;break;default:throw"bad hour format: "+e}break;case 77:switch(e.length){case 1:case 2:l=r.M,c=e.length;break;default:throw"bad minute format: "+e}break;case 115:if(e!="s"&&e!="ss"&&e!=".0"&&e!=".00"&&e!=".000")throw"bad second format: "+e;return r.u===0&&(e=="s"||e=="ss")?rr(r.S,e.length):(a>=2?s=a===3?1e3:100:s=a===1?10:1,i=Math.round(s*(r.S+r.u)),i>=60*s&&(i=0),e==="s"?i===0?"0":""+i/s:(n=rr(i,2+a),e==="ss"?n.substr(0,2):"."+n.substr(2,e.length-1)));case 90:switch(e){case"[h]":case"[hh]":l=r.D*24+r.H;break;case"[m]":case"[mm]":l=(r.D*24+r.H)*60+r.M;break;case"[s]":case"[ss]":l=((r.D*24+r.H)*60+r.M)*60+Math.round(r.S+r.u);break;default:throw"bad abstime format: "+e}c=e.length===3?1:2;break;case 101:l=o,c=1;break}var f=c>0?rr(l,c):"";return f}function Or(t){var e=3;if(t.length<=e)return t;for(var r=t.length%e,a=t.substr(0,r);r!=t.length;r+=e)a+=(a.length>0?",":"")+t.substr(r,e);return a}var O0=/%/g;function jh(t,e,r){var a=e.replace(O0,""),n=e.length-a.length;return kr(t,a,r*Math.pow(10,2*n))+Ke("%",n)}function Kh(t,e,r){for(var a=e.length-1;e.charCodeAt(a-1)===44;)--a;return kr(t,e.substr(0,a),r/Math.pow(10,3*(e.length-a)))}function P0(t,e){var r,a=t.indexOf("E")-t.indexOf(".")-1;if(t.match(/^#+0.0E\+0$/)){if(e==0)return"0.0E+0";if(e<0)return"-"+P0(t,-e);var n=t.indexOf(".");n===-1&&(n=t.indexOf("E"));var i=Math.floor(Math.log(e)*Math.LOG10E)%n;if(i<0&&(i+=n),r=(e/Math.pow(10,i)).toPrecision(a+1+(n+i)%n),r.indexOf("e")===-1){var s=Math.floor(Math.log(e)*Math.LOG10E);for(r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(s-r.length+i):r+="E+"+(s-i);r.substr(0,2)==="0.";)r=r.charAt(0)+r.substr(2,n)+"."+r.substr(2+n),r=r.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(o,l,c,f){return l+c+f.substr(0,(n+i)%n)+"."+f.substr(i)+"E"})}else r=e.toExponential(a);return t.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),t.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}var D0=/# (\?+)( ?)\/( ?)(\d+)/;function Yh(t,e,r){var a=parseInt(t[4],10),n=Math.round(e*a),i=Math.floor(n/a),s=n-i*a,o=a;return r+(i===0?"":""+i)+" "+(s===0?Ke(" ",t[1].length+1+t[4].length):os(s,t[1].length)+t[2]+"/"+t[3]+rr(o,t[4].length))}function Jh(t,e,r){return r+(e===0?"":""+e)+Ke(" ",t[1].length+2+t[4].length)}var R0=/^#*0*\.([0#]+)/,B0=/\).*[0#]/,V0=/\(###\) ###\\?-####/;function Tt(t){for(var e="",r,a=0;a!=t.length;++a)switch(r=t.charCodeAt(a)){case 35:break;case 63:e+=" ";break;case 48:e+="0";break;default:e+=String.fromCharCode(r)}return e}function ho(t,e){var r=Math.pow(10,e);return""+Math.round(t*r)/r}function uo(t,e){var r=t-Math.floor(t),a=Math.pow(10,e);return e<(""+Math.round(r*a)).length?0:Math.round(r*a)}function qh(t,e){return e<(""+Math.round((t-Math.floor(t))*Math.pow(10,e))).length?1:0}function Zh(t){return t<2147483647&&t>-2147483648?""+(t>=0?t|0:t-1|0):""+Math.floor(t)}function Wt(t,e,r){if(t.charCodeAt(0)===40&&!e.match(B0)){var a=e.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?Wt("n",a,r):"("+Wt("n",a,-r)+")"}if(e.charCodeAt(e.length-1)===44)return Kh(t,e,r);if(e.indexOf("%")!==-1)return jh(t,e,r);if(e.indexOf("E")!==-1)return P0(e,r);if(e.charCodeAt(0)===36)return"$"+Wt(t,e.substr(e.charAt(1)==" "?2:1),r);var n,i,s,o,l=Math.abs(r),c=r<0?"-":"";if(e.match(/^00+$/))return c+ga(l,e.length);if(e.match(/^[#?]+$/))return n=ga(r,0),n==="0"&&(n=""),n.length>e.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(D0))return Yh(i,l,c);if(e.match(/^#+0+$/))return c+ga(l,e.length-e.indexOf("0"));if(i=e.match(R0))return n=ho(r,i[1].length).replace(/^([^\.]+)$/,"$1."+Tt(i[1])).replace(/\.$/,"."+Tt(i[1])).replace(/\.(\d*)$/,function(m,d){return"."+d+Ke("0",Tt(i[1]).length-d.length)}),e.indexOf("0.")!==-1?n:n.replace(/^0\./,".");if(e=e.replace(/^#+([0.])/,"$1"),i=e.match(/^(0*)\.(#*)$/))return c+ho(l,i[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=e.match(/^#{1,3},##0(\.?)$/))return c+Or(ga(l,0));if(i=e.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+Wt(t,e,-r):Or(""+(Math.floor(r)+qh(r,i[1].length)))+"."+rr(uo(r,i[1].length),i[1].length);if(i=e.match(/^#,#*,#0/))return Wt(t,e.replace(/^#,#*,/,""),r);if(i=e.match(/^([0#]+)(\\?-([0#]+))+$/))return n=_a(Wt(t,e.replace(/[\\-]/g,""),r)),s=0,_a(_a(e.replace(/\\/g,"")).replace(/[0#]/g,function(m){return s<n.length?n.charAt(s++):m==="0"?"0":""}));if(e.match(V0))return n=Wt(t,"##########",r),"("+n.substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(i=e.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(i[4].length,7),o=Kn(l,Math.pow(10,s)-1,!1),n=""+c,f=kr("n",i[1],o[1]),f.charAt(f.length-1)==" "&&(f=f.substr(0,f.length-1)+"0"),n+=f+i[2]+"/"+i[3],f=Xn(o[2],s),f.length<i[4].length&&(f=Tt(i[4].substr(i[4].length-f.length))+f),n+=f,n;if(i=e.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(Math.max(i[1].length,i[4].length),7),o=Kn(l,Math.pow(10,s)-1,!0),c+(o[0]||(o[1]?"":"0"))+" "+(o[1]?os(o[1],s)+i[2]+"/"+i[3]+Xn(o[2],s):Ke(" ",2*s+1+i[2].length+i[3].length));if(i=e.match(/^[#0?]+$/))return n=ga(r,0),e.length<=n.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(/^([#0?]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),s=n.indexOf(".");var h=e.indexOf(".")-s,u=e.length-n.length-h;return Tt(e.substr(0,h)+n+e.substr(e.length-u))}if(i=e.match(/^00,000\.([#0]*0)$/))return s=uo(r,i[1].length),r<0?"-"+Wt(t,e,-r):Or(Zh(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(m){return"00,"+(m.length<3?rr(0,3-m.length):"")+m})+"."+rr(s,i[1].length);switch(e){case"###,##0.00":return Wt(t,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var p=Or(ga(l,0));return p!=="0"?c+p:"";case"###,###.00":return Wt(t,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return Wt(t,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+e+"|")}function Qh(t,e,r){for(var a=e.length-1;e.charCodeAt(a-1)===44;)--a;return kr(t,e.substr(0,a),r/Math.pow(10,3*(e.length-a)))}function eu(t,e,r){var a=e.replace(O0,""),n=e.length-a.length;return kr(t,a,r*Math.pow(10,2*n))+Ke("%",n)}function U0(t,e){var r,a=t.indexOf("E")-t.indexOf(".")-1;if(t.match(/^#+0.0E\+0$/)){if(e==0)return"0.0E+0";if(e<0)return"-"+U0(t,-e);var n=t.indexOf(".");n===-1&&(n=t.indexOf("E"));var i=Math.floor(Math.log(e)*Math.LOG10E)%n;if(i<0&&(i+=n),r=(e/Math.pow(10,i)).toPrecision(a+1+(n+i)%n),!r.match(/[Ee]/)){var s=Math.floor(Math.log(e)*Math.LOG10E);r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(s-r.length+i):r+="E+"+(s-i),r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(o,l,c,f){return l+c+f.substr(0,(n+i)%n)+"."+f.substr(i)+"E"})}else r=e.toExponential(a);return t.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),t.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}function hr(t,e,r){if(t.charCodeAt(0)===40&&!e.match(B0)){var a=e.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?hr("n",a,r):"("+hr("n",a,-r)+")"}if(e.charCodeAt(e.length-1)===44)return Qh(t,e,r);if(e.indexOf("%")!==-1)return eu(t,e,r);if(e.indexOf("E")!==-1)return U0(e,r);if(e.charCodeAt(0)===36)return"$"+hr(t,e.substr(e.charAt(1)==" "?2:1),r);var n,i,s,o,l=Math.abs(r),c=r<0?"-":"";if(e.match(/^00+$/))return c+rr(l,e.length);if(e.match(/^[#?]+$/))return n=""+r,r===0&&(n=""),n.length>e.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(D0))return Jh(i,l,c);if(e.match(/^#+0+$/))return c+rr(l,e.length-e.indexOf("0"));if(i=e.match(R0))return n=(""+r).replace(/^([^\.]+)$/,"$1."+Tt(i[1])).replace(/\.$/,"."+Tt(i[1])),n=n.replace(/\.(\d*)$/,function(m,d){return"."+d+Ke("0",Tt(i[1]).length-d.length)}),e.indexOf("0.")!==-1?n:n.replace(/^0\./,".");if(e=e.replace(/^#+([0.])/,"$1"),i=e.match(/^(0*)\.(#*)$/))return c+(""+l).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=e.match(/^#{1,3},##0(\.?)$/))return c+Or(""+l);if(i=e.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+hr(t,e,-r):Or(""+r)+"."+Ke("0",i[1].length);if(i=e.match(/^#,#*,#0/))return hr(t,e.replace(/^#,#*,/,""),r);if(i=e.match(/^([0#]+)(\\?-([0#]+))+$/))return n=_a(hr(t,e.replace(/[\\-]/g,""),r)),s=0,_a(_a(e.replace(/\\/g,"")).replace(/[0#]/g,function(m){return s<n.length?n.charAt(s++):m==="0"?"0":""}));if(e.match(V0))return n=hr(t,"##########",r),"("+n.substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(i=e.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(i[4].length,7),o=Kn(l,Math.pow(10,s)-1,!1),n=""+c,f=kr("n",i[1],o[1]),f.charAt(f.length-1)==" "&&(f=f.substr(0,f.length-1)+"0"),n+=f+i[2]+"/"+i[3],f=Xn(o[2],s),f.length<i[4].length&&(f=Tt(i[4].substr(i[4].length-f.length))+f),n+=f,n;if(i=e.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(Math.max(i[1].length,i[4].length),7),o=Kn(l,Math.pow(10,s)-1,!0),c+(o[0]||(o[1]?"":"0"))+" "+(o[1]?os(o[1],s)+i[2]+"/"+i[3]+Xn(o[2],s):Ke(" ",2*s+1+i[2].length+i[3].length));if(i=e.match(/^[#0?]+$/))return n=""+r,e.length<=n.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(/^([#0]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),s=n.indexOf(".");var h=e.indexOf(".")-s,u=e.length-n.length-h;return Tt(e.substr(0,h)+n+e.substr(e.length-u))}if(i=e.match(/^00,000\.([#0]*0)$/))return r<0?"-"+hr(t,e,-r):Or(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(m){return"00,"+(m.length<3?rr(0,3-m.length):"")+m})+"."+rr(0,i[1].length);switch(e){case"###,###":case"##,###":case"#,###":var p=Or(""+l);return p!=="0"?c+p:"";default:if(e.match(/\.[0#?]*$/))return hr(t,e.slice(0,e.lastIndexOf(".")),r)+Tt(e.slice(e.lastIndexOf(".")))}throw new Error("unsupported format |"+e+"|")}function kr(t,e,r){return(r|0)===r?hr(t,e,r):Wt(t,e,r)}function tu(t){for(var e=[],r=!1,a=0,n=0;a<t.length;++a)switch(t.charCodeAt(a)){case 34:r=!r;break;case 95:case 42:case 92:++a;break;case 59:e[e.length]=t.substr(n,a-n),n=a+1}if(e[e.length]=t.substr(n),r===!0)throw new Error("Format |"+t+"| unterminated string ");return e}var H0=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function Ia(t){for(var e=0,r="",a="";e<t.length;)switch(r=t.charAt(e)){case"G":jn(t,e)&&(e+=6),e++;break;case'"':for(;t.charCodeAt(++e)!==34&&e<t.length;);++e;break;case"\\":e+=2;break;case"_":e+=2;break;case"@":++e;break;case"B":case"b":if(t.charAt(e+1)==="1"||t.charAt(e+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(t.substr(e,3).toUpperCase()==="A/P"||t.substr(e,5).toUpperCase()==="AM/PM"||t.substr(e,5).toUpperCase()==="上午/下午")return!0;++e;break;case"[":for(a=r;t.charAt(e++)!=="]"&&e<t.length;)a+=t.charAt(e);if(a.match(H0))return!0;break;case".":case"0":case"#":for(;e<t.length&&("0#?.,E+-%".indexOf(r=t.charAt(++e))>-1||r=="\\"&&t.charAt(e+1)=="-"&&"0#".indexOf(t.charAt(e+2))>-1););break;case"?":for(;t.charAt(++e)===r;);break;case"*":++e,(t.charAt(e)==" "||t.charAt(e)=="*")&&++e;break;case"(":case")":++e;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;e<t.length&&"0123456789".indexOf(t.charAt(++e))>-1;);break;case" ":++e;break;default:++e;break}return!1}function ru(t,e,r,a){for(var n=[],i="",s=0,o="",l="t",c,f,h,u="H";s<t.length;)switch(o=t.charAt(s)){case"G":if(!jn(t,s))throw new Error("unrecognized character "+o+" in "+t);n[n.length]={t:"G",v:"General"},s+=7;break;case'"':for(i="";(h=t.charCodeAt(++s))!==34&&s<t.length;)i+=String.fromCharCode(h);n[n.length]={t:"t",v:i},++s;break;case"\\":var p=t.charAt(++s),m=p==="("||p===")"?p:"t";n[n.length]={t:m,v:p},++s;break;case"_":n[n.length]={t:"t",v:" "},s+=2;break;case"@":n[n.length]={t:"T",v:e},++s;break;case"B":case"b":if(t.charAt(s+1)==="1"||t.charAt(s+1)==="2"){if(c==null&&(c=Yr(e,r,t.charAt(s+1)==="2"),c==null))return"";n[n.length]={t:"X",v:t.substr(s,2)},l=o,s+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":o=o.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(e<0||c==null&&(c=Yr(e,r),c==null))return"";for(i=o;++s<t.length&&t.charAt(s).toLowerCase()===o;)i+=o;o==="m"&&l.toLowerCase()==="h"&&(o="M"),o==="h"&&(o=u),n[n.length]={t:o,v:i},l=o;break;case"A":case"a":case"上":var d={t:o,v:o};if(c==null&&(c=Yr(e,r)),t.substr(s,3).toUpperCase()==="A/P"?(c!=null&&(d.v=c.H>=12?"P":"A"),d.t="T",u="h",s+=3):t.substr(s,5).toUpperCase()==="AM/PM"?(c!=null&&(d.v=c.H>=12?"PM":"AM"),d.t="T",s+=5,u="h"):t.substr(s,5).toUpperCase()==="上午/下午"?(c!=null&&(d.v=c.H>=12?"下午":"上午"),d.t="T",s+=5,u="h"):(d.t="t",++s),c==null&&d.t==="T")return"";n[n.length]=d,l=o;break;case"[":for(i=o;t.charAt(s++)!=="]"&&s<t.length;)i+=t.charAt(s);if(i.slice(-1)!=="]")throw'unterminated "[" block: |'+i+"|";if(i.match(H0)){if(c==null&&(c=Yr(e,r),c==null))return"";n[n.length]={t:"Z",v:i.toLowerCase()},l=i.charAt(1)}else i.indexOf("$")>-1&&(i=(i.match(/\$([^-\[\]]*)/)||[])[1]||"$",Ia(t)||(n[n.length]={t:"t",v:i}));break;case".":if(c!=null){for(i=o;++s<t.length&&(o=t.charAt(s))==="0";)i+=o;n[n.length]={t:"s",v:i};break}case"0":case"#":for(i=o;++s<t.length&&"0#?.,E+-%".indexOf(o=t.charAt(s))>-1;)i+=o;n[n.length]={t:"n",v:i};break;case"?":for(i=o;t.charAt(++s)===o;)i+=o;n[n.length]={t:o,v:i},l=o;break;case"*":++s,(t.charAt(s)==" "||t.charAt(s)=="*")&&++s;break;case"(":case")":n[n.length]={t:a===1?"t":o,v:o},++s;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(i=o;s<t.length&&"0123456789".indexOf(t.charAt(++s))>-1;)i+=t.charAt(s);n[n.length]={t:"D",v:i};break;case" ":n[n.length]={t:o,v:o},++s;break;case"$":n[n.length]={t:"t",v:"$"},++s;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(o)===-1)throw new Error("unrecognized character "+o+" in "+t);n[n.length]={t:"t",v:o},++s;break}var g=0,x=0,w;for(s=n.length-1,l="t";s>=0;--s)switch(n[s].t){case"h":case"H":n[s].t=u,l="h",g<1&&(g=1);break;case"s":(w=n[s].v.match(/\.0+$/))&&(x=Math.max(x,w[0].length-1)),g<3&&(g=3);case"d":case"y":case"M":case"e":l=n[s].t;break;case"m":l==="s"&&(n[s].t="M",g<2&&(g=2));break;case"X":break;case"Z":g<1&&n[s].v.match(/[Hh]/)&&(g=1),g<2&&n[s].v.match(/[Mm]/)&&(g=2),g<3&&n[s].v.match(/[Ss]/)&&(g=3)}switch(g){case 0:break;case 1:c.u>=.5&&(c.u=0,++c.S),c.S>=60&&(c.S=0,++c.M),c.M>=60&&(c.M=0,++c.H);break;case 2:c.u>=.5&&(c.u=0,++c.S),c.S>=60&&(c.S=0,++c.M);break}var v="",F;for(s=0;s<n.length;++s)switch(n[s].t){case"t":case"T":case" ":case"D":break;case"X":n[s].v="",n[s].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":n[s].v=Xh(n[s].t.charCodeAt(0),n[s].v,c,x),n[s].t="t";break;case"n":case"?":for(F=s+1;n[F]!=null&&((o=n[F].t)==="?"||o==="D"||(o===" "||o==="t")&&n[F+1]!=null&&(n[F+1].t==="?"||n[F+1].t==="t"&&n[F+1].v==="/")||n[s].t==="("&&(o===" "||o==="n"||o===")")||o==="t"&&(n[F].v==="/"||n[F].v===" "&&n[F+1]!=null&&n[F+1].t=="?"));)n[s].v+=n[F].v,n[F]={v:"",t:";"},++F;v+=n[s].v,s=F-1;break;case"G":n[s].t="t",n[s].v=na(e,r);break}var N="",A,y;if(v.length>0){v.charCodeAt(0)==40?(A=e<0&&v.charCodeAt(0)===45?-e:e,y=kr("n",v,A)):(A=e<0&&a>1?-e:e,y=kr("n",v,A),A<0&&n[0]&&n[0].t=="t"&&(y=y.substr(1),n[0].v="-"+n[0].v)),F=y.length-1;var P=n.length;for(s=0;s<n.length;++s)if(n[s]!=null&&n[s].t!="t"&&n[s].v.indexOf(".")>-1){P=s;break}var I=n.length;if(P===n.length&&y.indexOf("E")===-1){for(s=n.length-1;s>=0;--s)n[s]==null||"n?".indexOf(n[s].t)===-1||(F>=n[s].v.length-1?(F-=n[s].v.length,n[s].v=y.substr(F+1,n[s].v.length)):F<0?n[s].v="":(n[s].v=y.substr(0,F+1),F=-1),n[s].t="t",I=s);F>=0&&I<n.length&&(n[I].v=y.substr(0,F+1)+n[I].v)}else if(P!==n.length&&y.indexOf("E")===-1){for(F=y.indexOf(".")-1,s=P;s>=0;--s)if(!(n[s]==null||"n?".indexOf(n[s].t)===-1)){for(f=n[s].v.indexOf(".")>-1&&s===P?n[s].v.indexOf(".")-1:n[s].v.length-1,N=n[s].v.substr(f+1);f>=0;--f)F>=0&&(n[s].v.charAt(f)==="0"||n[s].v.charAt(f)==="#")&&(N=y.charAt(F--)+N);n[s].v=N,n[s].t="t",I=s}for(F>=0&&I<n.length&&(n[I].v=y.substr(0,F+1)+n[I].v),F=y.indexOf(".")+1,s=P;s<n.length;++s)if(!(n[s]==null||"n?(".indexOf(n[s].t)===-1&&s!==P)){for(f=n[s].v.indexOf(".")>-1&&s===P?n[s].v.indexOf(".")+1:0,N=n[s].v.substr(0,f);f<n[s].v.length;++f)F<y.length&&(N+=y.charAt(F++));n[s].v=N,n[s].t="t",I=s}}}for(s=0;s<n.length;++s)n[s]!=null&&"n?".indexOf(n[s].t)>-1&&(A=a>1&&e<0&&s>0&&n[s-1].v==="-"?-e:e,n[s].v=kr(n[s].t,n[s].v,A),n[s].t="t");var z="";for(s=0;s!==n.length;++s)n[s]!=null&&(z+=n[s].v);return z}var po=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function mo(t,e){if(e==null)return!1;var r=parseFloat(e[2]);switch(e[1]){case"=":if(t==r)return!0;break;case">":if(t>r)return!0;break;case"<":if(t<r)return!0;break;case"<>":if(t!=r)return!0;break;case">=":if(t>=r)return!0;break;case"<=":if(t<=r)return!0;break}return!1}function au(t,e){var r=tu(t),a=r.length,n=r[a-1].indexOf("@");if(a<4&&n>-1&&--a,r.length>4)throw new Error("cannot find right format for |"+r.join("|")+"|");if(typeof e!="number")return[4,r.length===4||n>-1?r[r.length-1]:"@"];switch(r.length){case 1:r=n>-1?["General","General","General",r[0]]:[r[0],r[0],r[0],"@"];break;case 2:r=n>-1?[r[0],r[0],r[0],r[1]]:[r[0],r[1],r[0],"@"];break;case 3:r=n>-1?[r[0],r[1],r[0],r[2]]:[r[0],r[1],r[2],"@"];break}var i=e>0?r[0]:e<0?r[1]:r[2];if(r[0].indexOf("[")===-1&&r[1].indexOf("[")===-1)return[a,i];if(r[0].match(/\[[=<>]/)!=null||r[1].match(/\[[=<>]/)!=null){var s=r[0].match(po),o=r[1].match(po);return mo(e,s)?[a,r[0]]:mo(e,o)?[a,r[1]]:[a,r[s!=null&&o!=null?2:1]]}return[a,i]}function Kt(t,e,r){r==null&&(r={});var a="";switch(typeof t){case"string":t=="m/d/yy"&&r.dateNF?a=r.dateNF:a=t;break;case"number":t==14&&r.dateNF?a=r.dateNF:a=(r.table!=null?r.table:me)[t],a==null&&(a=r.table&&r.table[fo[t]]||me[fo[t]]),a==null&&(a=Vh[t]||"General");break}if(jn(a,0))return na(e,r);e instanceof Date&&(e=M0(e,r.date1904));var n=au(a,e);if(jn(n[1]))return na(e,r);if(e===!0)e="TRUE";else if(e===!1)e="FALSE";else if(e===""||e==null)return"";return ru(n[1],e,r,n[0])}function _r(t,e){if(typeof e!="number"){e=+e||-1;for(var r=0;r<392;++r){if(me[r]==null){e<0&&(e=r);continue}if(me[r]==t){e=r;break}}e<0&&(e=391)}return me[e]=t,e}function si(t){for(var e=0;e!=392;++e)t[e]!==void 0&&_r(t[e],e)}function Na(){me=Bh()}var nu={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},W0=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function iu(t){var e=typeof t=="number"?me[t]:t;return e=e.replace(W0,"(\\d+)"),new RegExp("^"+e+"$")}function su(t,e,r){var a=-1,n=-1,i=-1,s=-1,o=-1,l=-1;(e.match(W0)||[]).forEach(function(h,u){var p=parseInt(r[u+1],10);switch(h.toLowerCase().charAt(0)){case"y":a=p;break;case"d":i=p;break;case"h":s=p;break;case"s":l=p;break;case"m":s>=0?o=p:n=p;break}}),l>=0&&o==-1&&n>=0&&(o=n,n=-1);var c=(""+(a>=0?a:new Date().getFullYear())).slice(-4)+"-"+("00"+(n>=1?n:1)).slice(-2)+"-"+("00"+(i>=1?i:1)).slice(-2);c.length==7&&(c="0"+c),c.length==8&&(c="20"+c);var f=("00"+(s>=0?s:0)).slice(-2)+":"+("00"+(o>=0?o:0)).slice(-2)+":"+("00"+(l>=0?l:0)).slice(-2);return s==-1&&o==-1&&l==-1?c:a==-1&&n==-1&&i==-1?f:c+"T"+f}var ou=function(){var t={};t.version="1.2.0";function e(){for(var y=0,P=new Array(256),I=0;I!=256;++I)y=I,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,P[I]=y;return typeof Int32Array<"u"?new Int32Array(P):P}var r=e();function a(y){var P=0,I=0,z=0,V=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(z=0;z!=256;++z)V[z]=y[z];for(z=0;z!=256;++z)for(I=y[z],P=256+z;P<4096;P+=256)I=V[P]=I>>>8^y[I&255];var R=[];for(z=1;z!=16;++z)R[z-1]=typeof Int32Array<"u"?V.subarray(z*256,z*256+256):V.slice(z*256,z*256+256);return R}var n=a(r),i=n[0],s=n[1],o=n[2],l=n[3],c=n[4],f=n[5],h=n[6],u=n[7],p=n[8],m=n[9],d=n[10],g=n[11],x=n[12],w=n[13],v=n[14];function F(y,P){for(var I=P^-1,z=0,V=y.length;z<V;)I=I>>>8^r[(I^y.charCodeAt(z++))&255];return~I}function N(y,P){for(var I=P^-1,z=y.length-15,V=0;V<z;)I=v[y[V++]^I&255]^w[y[V++]^I>>8&255]^x[y[V++]^I>>16&255]^g[y[V++]^I>>>24]^d[y[V++]]^m[y[V++]]^p[y[V++]]^u[y[V++]]^h[y[V++]]^f[y[V++]]^c[y[V++]]^l[y[V++]]^o[y[V++]]^s[y[V++]]^i[y[V++]]^r[y[V++]];for(z+=15;V<z;)I=I>>>8^r[(I^y[V++])&255];return~I}function A(y,P){for(var I=P^-1,z=0,V=y.length,R=0,J=0;z<V;)R=y.charCodeAt(z++),R<128?I=I>>>8^r[(I^R)&255]:R<2048?(I=I>>>8^r[(I^(192|R>>6&31))&255],I=I>>>8^r[(I^(128|R&63))&255]):R>=55296&&R<57344?(R=(R&1023)+64,J=y.charCodeAt(z++)&1023,I=I>>>8^r[(I^(240|R>>8&7))&255],I=I>>>8^r[(I^(128|R>>2&63))&255],I=I>>>8^r[(I^(128|J>>6&15|(R&3)<<4))&255],I=I>>>8^r[(I^(128|J&63))&255]):(I=I>>>8^r[(I^(224|R>>12&15))&255],I=I>>>8^r[(I^(128|R>>6&63))&255],I=I>>>8^r[(I^(128|R&63))&255]);return~I}return t.table=r,t.bstr=F,t.buf=N,t.str=A,t}(),de=function(){var e={};e.version="1.2.1";function r(E,_){for(var C=E.split("/"),k=_.split("/"),T=0,S=0,U=Math.min(C.length,k.length);T<U;++T){if(S=C[T].length-k[T].length)return S;if(C[T]!=k[T])return C[T]<k[T]?-1:1}return C.length-k.length}function a(E){if(E.charAt(E.length-1)=="/")return E.slice(0,-1).indexOf("/")===-1?E:a(E.slice(0,-1));var _=E.lastIndexOf("/");return _===-1?E:E.slice(0,_+1)}function n(E){if(E.charAt(E.length-1)=="/")return n(E.slice(0,-1));var _=E.lastIndexOf("/");return _===-1?E:E.slice(_+1)}function i(E,_){typeof _=="string"&&(_=new Date(_));var C=_.getHours();C=C<<6|_.getMinutes(),C=C<<5|_.getSeconds()>>>1,E.write_shift(2,C);var k=_.getFullYear()-1980;k=k<<4|_.getMonth()+1,k=k<<5|_.getDate(),E.write_shift(2,k)}function s(E){var _=E.read_shift(2)&65535,C=E.read_shift(2)&65535,k=new Date,T=C&31;C>>>=5;var S=C&15;C>>>=4,k.setMilliseconds(0),k.setFullYear(C+1980),k.setMonth(S-1),k.setDate(T);var U=_&31;_>>>=5;var j=_&63;return _>>>=6,k.setHours(_),k.setMinutes(j),k.setSeconds(U<<1),k}function o(E){dt(E,0);for(var _={},C=0;E.l<=E.length-4;){var k=E.read_shift(2),T=E.read_shift(2),S=E.l+T,U={};switch(k){case 21589:C=E.read_shift(1),C&1&&(U.mtime=E.read_shift(4)),T>5&&(C&2&&(U.atime=E.read_shift(4)),C&4&&(U.ctime=E.read_shift(4))),U.mtime&&(U.mt=new Date(U.mtime*1e3));break}E.l=S,_[k]=U}return _}var l;function c(){return l||(l={})}function f(E,_){if(E[0]==80&&E[1]==75)return Ks(E,_);if((E[0]|32)==109&&(E[1]|32)==105)return Kc(E,_);if(E.length<512)throw new Error("CFB file size "+E.length+" < 512");var C=3,k=512,T=0,S=0,U=0,j=0,B=0,H=[],W=E.slice(0,512);dt(W,0);var Z=h(W);switch(C=Z[0],C){case 3:k=512;break;case 4:k=4096;break;case 0:if(Z[1]==0)return Ks(E,_);default:throw new Error("Major Version: Expected 3 or 4 saw "+C)}k!==512&&(W=E.slice(0,k),dt(W,28));var se=E.slice(0,k);u(W,C);var he=W.read_shift(4,"i");if(C===3&&he!==0)throw new Error("# Directory Sectors: Expected 0 saw "+he);W.l+=4,U=W.read_shift(4,"i"),W.l+=4,W.chk("00100000","Mini Stream Cutoff Size: "),j=W.read_shift(4,"i"),T=W.read_shift(4,"i"),B=W.read_shift(4,"i"),S=W.read_shift(4,"i");for(var ee=-1,fe=0;fe<109&&(ee=W.read_shift(4,"i"),!(ee<0));++fe)H[fe]=ee;var we=p(E,k);g(B,S,we,k,H);var Ge=w(we,U,H,k);Ge[U].name="!Directory",T>0&&j!==J&&(Ge[j].name="!MiniFAT"),Ge[H[0]].name="!FAT",Ge.fat_addrs=H,Ge.ssz=k;var ze={},mt=[],Ra=[],Ba=[];v(U,Ge,we,mt,T,ze,Ra,j),m(Ra,Ba,mt),mt.shift();var Va={FileIndex:Ra,FullPaths:Ba};return _&&_.raw&&(Va.raw={header:se,sectors:we}),Va}function h(E){if(E[E.l]==80&&E[E.l+1]==75)return[0,0];E.chk(le,"Header Signature: "),E.l+=16;var _=E.read_shift(2,"u");return[E.read_shift(2,"u"),_]}function u(E,_){var C=9;switch(E.l+=2,C=E.read_shift(2)){case 9:if(_!=3)throw new Error("Sector Shift: Expected 9 saw "+C);break;case 12:if(_!=4)throw new Error("Sector Shift: Expected 12 saw "+C);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+C)}E.chk("0600","Mini Sector Shift: "),E.chk("000000000000","Reserved: ")}function p(E,_){for(var C=Math.ceil(E.length/_)-1,k=[],T=1;T<C;++T)k[T-1]=E.slice(T*_,(T+1)*_);return k[C-1]=E.slice(C*_),k}function m(E,_,C){for(var k=0,T=0,S=0,U=0,j=0,B=C.length,H=[],W=[];k<B;++k)H[k]=W[k]=k,_[k]=C[k];for(;j<W.length;++j)k=W[j],T=E[k].L,S=E[k].R,U=E[k].C,H[k]===k&&(T!==-1&&H[T]!==T&&(H[k]=H[T]),S!==-1&&H[S]!==S&&(H[k]=H[S])),U!==-1&&(H[U]=k),T!==-1&&k!=H[k]&&(H[T]=H[k],W.lastIndexOf(T)<j&&W.push(T)),S!==-1&&k!=H[k]&&(H[S]=H[k],W.lastIndexOf(S)<j&&W.push(S));for(k=1;k<B;++k)H[k]===k&&(S!==-1&&H[S]!==S?H[k]=H[S]:T!==-1&&H[T]!==T&&(H[k]=H[T]));for(k=1;k<B;++k)if(E[k].type!==0){if(j=k,j!=H[j])do j=H[j],_[k]=_[j]+"/"+_[k];while(j!==0&&H[j]!==-1&&j!=H[j]);H[k]=-1}for(_[0]+="/",k=1;k<B;++k)E[k].type!==2&&(_[k]+="/")}function d(E,_,C){for(var k=E.start,T=E.size,S=[],U=k;C&&T>0&&U>=0;)S.push(_.slice(U*R,U*R+R)),T-=R,U=Xr(C,U*4);return S.length===0?X(0):ft(S).slice(0,E.size)}function g(E,_,C,k,T){var S=J;if(E===J){if(_!==0)throw new Error("DIFAT chain shorter than expected")}else if(E!==-1){var U=C[E],j=(k>>>2)-1;if(!U)return;for(var B=0;B<j&&(S=Xr(U,B*4))!==J;++B)T.push(S);g(Xr(U,k-4),_-1,C,k,T)}}function x(E,_,C,k,T){var S=[],U=[];T||(T=[]);var j=k-1,B=0,H=0;for(B=_;B>=0;){T[B]=!0,S[S.length]=B,U.push(E[B]);var W=C[Math.floor(B*4/k)];if(H=B*4&j,k<4+H)throw new Error("FAT boundary crossed: "+B+" 4 "+k);if(!E[W])break;B=Xr(E[W],H)}return{nodes:S,data:bo([U])}}function w(E,_,C,k){var T=E.length,S=[],U=[],j=[],B=[],H=k-1,W=0,Z=0,se=0,he=0;for(W=0;W<T;++W)if(j=[],se=W+_,se>=T&&(se-=T),!U[se]){B=[];var ee=[];for(Z=se;Z>=0;){ee[Z]=!0,U[Z]=!0,j[j.length]=Z,B.push(E[Z]);var fe=C[Math.floor(Z*4/k)];if(he=Z*4&H,k<4+he)throw new Error("FAT boundary crossed: "+Z+" 4 "+k);if(!E[fe]||(Z=Xr(E[fe],he),ee[Z]))break}S[se]={nodes:j,data:bo([B])}}return S}function v(E,_,C,k,T,S,U,j){for(var B=0,H=k.length?2:0,W=_[E].data,Z=0,se=0,he;Z<W.length;Z+=128){var ee=W.slice(Z,Z+128);dt(ee,64),se=ee.read_shift(2),he=ms(ee,0,se-H),k.push(he);var fe={name:he,type:ee.read_shift(1),color:ee.read_shift(1),L:ee.read_shift(4,"i"),R:ee.read_shift(4,"i"),C:ee.read_shift(4,"i"),clsid:ee.read_shift(16),state:ee.read_shift(4,"i"),start:0,size:0},we=ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2);we!==0&&(fe.ct=F(ee,ee.l-8));var Ge=ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2);Ge!==0&&(fe.mt=F(ee,ee.l-8)),fe.start=ee.read_shift(4,"i"),fe.size=ee.read_shift(4,"i"),fe.size<0&&fe.start<0&&(fe.size=fe.type=0,fe.start=J,fe.name=""),fe.type===5?(B=fe.start,T>0&&B!==J&&(_[B].name="!StreamData")):fe.size>=4096?(fe.storage="fat",_[fe.start]===void 0&&(_[fe.start]=x(C,fe.start,_.fat_addrs,_.ssz)),_[fe.start].name=fe.name,fe.content=_[fe.start].data.slice(0,fe.size)):(fe.storage="minifat",fe.size<0?fe.size=0:B!==J&&fe.start!==J&&_[B]&&(fe.content=d(fe,_[B].data,(_[j]||{}).data))),fe.content&&dt(fe.content,0),S[he]=fe,U.push(fe)}}function F(E,_){return new Date((Ot(E,_+4)/1e7*Math.pow(2,32)+Ot(E,_)/1e7-11644473600)*1e3)}function N(E,_){return c(),f(l.readFileSync(E),_)}function A(E,_){var C=_&&_.type;switch(C||_e&&Buffer.isBuffer(E)&&(C="buffer"),C||"base64"){case"file":return N(E,_);case"base64":return f(Dt(Bt(E)),_);case"binary":return f(Dt(E),_)}return f(E,_)}function y(E,_){var C=_||{},k=C.root||"Root Entry";if(E.FullPaths||(E.FullPaths=[]),E.FileIndex||(E.FileIndex=[]),E.FullPaths.length!==E.FileIndex.length)throw new Error("inconsistent CFB structure");E.FullPaths.length===0&&(E.FullPaths[0]=k+"/",E.FileIndex[0]={name:k,type:5}),C.CLSID&&(E.FileIndex[0].clsid=C.CLSID),P(E)}function P(E){var _="Sh33tJ5";if(!de.find(E,"/"+_)){var C=X(4);C[0]=55,C[1]=C[3]=50,C[2]=54,E.FileIndex.push({name:_,type:2,content:C,size:4,L:69,R:69,C:69}),E.FullPaths.push(E.FullPaths[0]+_),I(E)}}function I(E,_){y(E);for(var C=!1,k=!1,T=E.FullPaths.length-1;T>=0;--T){var S=E.FileIndex[T];switch(S.type){case 0:k?C=!0:(E.FileIndex.pop(),E.FullPaths.pop());break;case 1:case 2:case 5:k=!0,isNaN(S.R*S.L*S.C)&&(C=!0),S.R>-1&&S.L>-1&&S.R==S.L&&(C=!0);break;default:C=!0;break}}if(!(!C&&!_)){var U=new Date(1987,1,19),j=0,B=Object.create?Object.create(null):{},H=[];for(T=0;T<E.FullPaths.length;++T)B[E.FullPaths[T]]=!0,E.FileIndex[T].type!==0&&H.push([E.FullPaths[T],E.FileIndex[T]]);for(T=0;T<H.length;++T){var W=a(H[T][0]);k=B[W],k||(H.push([W,{name:n(W).replace("/",""),type:1,clsid:ue,ct:U,mt:U,content:null}]),B[W]=!0)}for(H.sort(function(he,ee){return r(he[0],ee[0])}),E.FullPaths=[],E.FileIndex=[],T=0;T<H.length;++T)E.FullPaths[T]=H[T][0],E.FileIndex[T]=H[T][1];for(T=0;T<H.length;++T){var Z=E.FileIndex[T],se=E.FullPaths[T];if(Z.name=n(se).replace("/",""),Z.L=Z.R=Z.C=-(Z.color=1),Z.size=Z.content?Z.content.length:0,Z.start=0,Z.clsid=Z.clsid||ue,T===0)Z.C=H.length>1?1:-1,Z.size=0,Z.type=5;else if(se.slice(-1)=="/"){for(j=T+1;j<H.length&&a(E.FullPaths[j])!=se;++j);for(Z.C=j>=H.length?-1:j,j=T+1;j<H.length&&a(E.FullPaths[j])!=a(se);++j);Z.R=j>=H.length?-1:j,Z.type=1}else a(E.FullPaths[T+1]||"")==a(se)&&(Z.R=T+1),Z.type=2}}}function z(E,_){var C=_||{};if(C.fileType=="mad")return Yc(E,C);switch(I(E),C.fileType){case"zip":return Wc(E,C)}var k=function(he){for(var ee=0,fe=0,we=0;we<he.FileIndex.length;++we){var Ge=he.FileIndex[we];if(Ge.content){var ze=Ge.content.length;ze>0&&(ze<4096?ee+=ze+63>>6:fe+=ze+511>>9)}}for(var mt=he.FullPaths.length+3>>2,Ra=ee+7>>3,Ba=ee+127>>7,Va=Ra+fe+mt+Ba,$r=Va+127>>7,mi=$r<=109?0:Math.ceil(($r-109)/127);Va+$r+mi+127>>7>$r;)mi=++$r<=109?0:Math.ceil(($r-109)/127);var Er=[1,mi,$r,Ba,mt,fe,ee,0];return he.FileIndex[0].size=ee<<6,Er[7]=(he.FileIndex[0].start=Er[0]+Er[1]+Er[2]+Er[3]+Er[4]+Er[5])+(Er[6]+7>>3),Er}(E),T=X(k[7]<<9),S=0,U=0;{for(S=0;S<8;++S)T.write_shift(1,ie[S]);for(S=0;S<8;++S)T.write_shift(2,0);for(T.write_shift(2,62),T.write_shift(2,3),T.write_shift(2,65534),T.write_shift(2,9),T.write_shift(2,6),S=0;S<3;++S)T.write_shift(2,0);for(T.write_shift(4,0),T.write_shift(4,k[2]),T.write_shift(4,k[0]+k[1]+k[2]+k[3]-1),T.write_shift(4,0),T.write_shift(4,4096),T.write_shift(4,k[3]?k[0]+k[1]+k[2]-1:J),T.write_shift(4,k[3]),T.write_shift(-4,k[1]?k[0]-1:J),T.write_shift(4,k[1]),S=0;S<109;++S)T.write_shift(-4,S<k[2]?k[1]+S:-1)}if(k[1])for(U=0;U<k[1];++U){for(;S<236+U*127;++S)T.write_shift(-4,S<k[2]?k[1]+S:-1);T.write_shift(-4,U===k[1]-1?J:U+1)}var j=function(he){for(U+=he;S<U-1;++S)T.write_shift(-4,S+1);he&&(++S,T.write_shift(-4,J))};for(U=S=0,U+=k[1];S<U;++S)T.write_shift(-4,ce.DIFSECT);for(U+=k[2];S<U;++S)T.write_shift(-4,ce.FATSECT);j(k[3]),j(k[4]);for(var B=0,H=0,W=E.FileIndex[0];B<E.FileIndex.length;++B)W=E.FileIndex[B],W.content&&(H=W.content.length,!(H<4096)&&(W.start=U,j(H+511>>9)));for(j(k[6]+7>>3);T.l&511;)T.write_shift(-4,ce.ENDOFCHAIN);for(U=S=0,B=0;B<E.FileIndex.length;++B)W=E.FileIndex[B],W.content&&(H=W.content.length,!(!H||H>=4096)&&(W.start=U,j(H+63>>6)));for(;T.l&511;)T.write_shift(-4,ce.ENDOFCHAIN);for(S=0;S<k[4]<<2;++S){var Z=E.FullPaths[S];if(!Z||Z.length===0){for(B=0;B<17;++B)T.write_shift(4,0);for(B=0;B<3;++B)T.write_shift(4,-1);for(B=0;B<12;++B)T.write_shift(4,0);continue}W=E.FileIndex[S],S===0&&(W.start=W.size?W.start-1:J);var se=S===0&&C.root||W.name;if(H=2*(se.length+1),T.write_shift(64,se,"utf16le"),T.write_shift(2,H),T.write_shift(1,W.type),T.write_shift(1,W.color),T.write_shift(-4,W.L),T.write_shift(-4,W.R),T.write_shift(-4,W.C),W.clsid)T.write_shift(16,W.clsid,"hex");else for(B=0;B<4;++B)T.write_shift(4,0);T.write_shift(4,W.state||0),T.write_shift(4,0),T.write_shift(4,0),T.write_shift(4,0),T.write_shift(4,0),T.write_shift(4,W.start),T.write_shift(4,W.size),T.write_shift(4,0)}for(S=1;S<E.FileIndex.length;++S)if(W=E.FileIndex[S],W.size>=4096)if(T.l=W.start+1<<9,_e&&Buffer.isBuffer(W.content))W.content.copy(T,T.l,0,W.size),T.l+=W.size+511&-512;else{for(B=0;B<W.size;++B)T.write_shift(1,W.content[B]);for(;B&511;++B)T.write_shift(1,0)}for(S=1;S<E.FileIndex.length;++S)if(W=E.FileIndex[S],W.size>0&&W.size<4096)if(_e&&Buffer.isBuffer(W.content))W.content.copy(T,T.l,0,W.size),T.l+=W.size+63&-64;else{for(B=0;B<W.size;++B)T.write_shift(1,W.content[B]);for(;B&63;++B)T.write_shift(1,0)}if(_e)T.l=T.length;else for(;T.l<T.length;)T.write_shift(1,0);return T}function V(E,_){var C=E.FullPaths.map(function(B){return B.toUpperCase()}),k=C.map(function(B){var H=B.split("/");return H[H.length-(B.slice(-1)=="/"?2:1)]}),T=!1;_.charCodeAt(0)===47?(T=!0,_=C[0].slice(0,-1)+_):T=_.indexOf("/")!==-1;var S=_.toUpperCase(),U=T===!0?C.indexOf(S):k.indexOf(S);if(U!==-1)return E.FileIndex[U];var j=!S.match(Wa);for(S=S.replace(bt,""),j&&(S=S.replace(Wa,"!")),U=0;U<C.length;++U)if((j?C[U].replace(Wa,"!"):C[U]).replace(bt,"")==S||(j?k[U].replace(Wa,"!"):k[U]).replace(bt,"")==S)return E.FileIndex[U];return null}var R=64,J=-2,le="d0cf11e0a1b11ae1",ie=[208,207,17,224,161,177,26,225],ue="00000000000000000000000000000000",ce={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:J,FREESECT:-1,HEADER_SIGNATURE:le,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:ue,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function De(E,_,C){c();var k=z(E,C);l.writeFileSync(_,k)}function G(E){for(var _=new Array(E.length),C=0;C<E.length;++C)_[C]=String.fromCharCode(E[C]);return _.join("")}function pe(E,_){var C=z(E,_);switch(_&&_.type||"buffer"){case"file":return c(),l.writeFileSync(_.filename,C),C;case"binary":return typeof C=="string"?C:G(C);case"base64":return en(typeof C=="string"?C:G(C));case"buffer":if(_e)return Buffer.isBuffer(C)?C:br(C);case"array":return typeof C=="string"?Dt(C):C}return C}var Ee;function L(E){try{var _=E.InflateRaw,C=new _;if(C._processChunk(new Uint8Array([3,0]),C._finishFlushFlag),C.bytesRead)Ee=E;else throw new Error("zlib does not expose bytesRead")}catch(k){console.error("cannot use native zlib: "+(k.message||k))}}function D(E,_){if(!Ee)return Xs(E,_);var C=Ee.InflateRaw,k=new C,T=k._processChunk(E.slice(E.l),k._finishFlushFlag);return E.l+=k.bytesRead,T}function M(E){return Ee?Ee.deflateRawSync(E):Te(E)}var O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],te=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function re(E){var _=(E<<1|E<<11)&139536|(E<<5|E<<15)&558144;return(_>>16|_>>8|_)&255}for(var Q=typeof Uint8Array<"u",q=Q?new Uint8Array(256):[],ke=0;ke<256;++ke)q[ke]=re(ke);function b(E,_){var C=q[E&255];return _<=8?C>>>8-_:(C=C<<8|q[E>>8&255],_<=16?C>>>16-_:(C=C<<8|q[E>>16&255],C>>>24-_))}function Ve(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=6?0:E[k+1]<<8))>>>C&3}function Fe(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=5?0:E[k+1]<<8))>>>C&7}function Be(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=4?0:E[k+1]<<8))>>>C&15}function be(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=3?0:E[k+1]<<8))>>>C&31}function oe(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=1?0:E[k+1]<<8))>>>C&127}function qe(E,_,C){var k=_&7,T=_>>>3,S=(1<<C)-1,U=E[T]>>>k;return C<8-k||(U|=E[T+1]<<8-k,C<16-k)||(U|=E[T+2]<<16-k,C<24-k)||(U|=E[T+3]<<24-k),U&S}function Vt(E,_,C){var k=_&7,T=_>>>3;return k<=5?E[T]|=(C&7)<<k:(E[T]|=C<<k&255,E[T+1]=(C&7)>>8-k),_+3}function or(E,_,C){var k=_&7,T=_>>>3;return C=(C&1)<<k,E[T]|=C,_+1}function xr(E,_,C){var k=_&7,T=_>>>3;return C<<=k,E[T]|=C&255,C>>>=8,E[T+1]=C,_+8}function Pa(E,_,C){var k=_&7,T=_>>>3;return C<<=k,E[T]|=C&255,C>>>=8,E[T+1]=C&255,E[T+2]=C>>>8,_+16}function Ar(E,_){var C=E.length,k=2*C>_?2*C:_+5,T=0;if(C>=_)return E;if(_e){var S=oo(k);if(E.copy)E.copy(S);else for(;T<E.length;++T)S[T]=E[T];return S}else if(Q){var U=new Uint8Array(k);if(U.set)U.set(E);else for(;T<C;++T)U[T]=E[T];return U}return E.length=k,E}function It(E){for(var _=new Array(E),C=0;C<E;++C)_[C]=0;return _}function vr(E,_,C){var k=1,T=0,S=0,U=0,j=0,B=E.length,H=Q?new Uint16Array(32):It(32);for(S=0;S<32;++S)H[S]=0;for(S=B;S<C;++S)E[S]=0;B=E.length;var W=Q?new Uint16Array(B):It(B);for(S=0;S<B;++S)H[T=E[S]]++,k<T&&(k=T),W[S]=0;for(H[0]=0,S=1;S<=k;++S)H[S+16]=j=j+H[S-1]<<1;for(S=0;S<B;++S)j=E[S],j!=0&&(W[S]=H[j+16]++);var Z=0;for(S=0;S<B;++S)if(Z=E[S],Z!=0)for(j=b(W[S],k)>>k-Z,U=(1<<k+4-Z)-1;U>=0;--U)_[j|U<<Z]=Z&15|S<<4;return k}var Ir=Q?new Uint16Array(512):It(512),Da=Q?new Uint16Array(32):It(32);if(!Q){for(var _t=0;_t<512;++_t)Ir[_t]=0;for(_t=0;_t<32;++_t)Da[_t]=0}(function(){for(var E=[],_=0;_<32;_++)E.push(5);vr(E,Da,32);var C=[];for(_=0;_<=143;_++)C.push(8);for(;_<=255;_++)C.push(9);for(;_<=279;_++)C.push(7);for(;_<=287;_++)C.push(8);vr(C,Ir,288)})();var lr=function(){for(var _=Q?new Uint8Array(32768):[],C=0,k=0;C<te.length-1;++C)for(;k<te[C+1];++k)_[k]=C;for(;k<32768;++k)_[k]=29;var T=Q?new Uint8Array(259):[];for(C=0,k=0;C<K.length-1;++C)for(;k<K[C+1];++k)T[k]=C;function S(j,B){for(var H=0;H<j.length;){var W=Math.min(65535,j.length-H),Z=H+W==j.length;for(B.write_shift(1,+Z),B.write_shift(2,W),B.write_shift(2,~W&65535);W-- >0;)B[B.l++]=j[H++]}return B.l}function U(j,B){for(var H=0,W=0,Z=Q?new Uint16Array(32768):[];W<j.length;){var se=Math.min(65535,j.length-W);if(se<10){for(H=Vt(B,H,+(W+se==j.length)),H&7&&(H+=8-(H&7)),B.l=H/8|0,B.write_shift(2,se),B.write_shift(2,~se&65535);se-- >0;)B[B.l++]=j[W++];H=B.l*8;continue}H=Vt(B,H,+(W+se==j.length)+2);for(var he=0;se-- >0;){var ee=j[W];he=(he<<5^ee)&32767;var fe=-1,we=0;if((fe=Z[he])&&(fe|=W&-32768,fe>W&&(fe-=32768),fe<W))for(;j[fe+we]==j[W+we]&&we<250;)++we;if(we>2){ee=T[we],ee<=22?H=xr(B,H,q[ee+1]>>1)-1:(xr(B,H,3),H+=5,xr(B,H,q[ee-23]>>5),H+=3);var Ge=ee<8?0:ee-4>>2;Ge>0&&(Pa(B,H,we-K[ee]),H+=Ge),ee=_[W-fe],H=xr(B,H,q[ee]>>3),H-=3;var ze=ee<4?0:ee-2>>1;ze>0&&(Pa(B,H,W-fe-te[ee]),H+=ze);for(var mt=0;mt<we;++mt)Z[he]=W&32767,he=(he<<5^j[W])&32767,++W;se-=we-1}else ee<=143?ee=ee+48:H=or(B,H,1),H=xr(B,H,q[ee]),Z[he]=W&32767,++W}H=xr(B,H,0)-1}return B.l=(H+7)/8|0,B.l}return function(B,H){return B.length<8?S(B,H):U(B,H)}}();function Te(E){var _=X(50+Math.floor(E.length*1.1)),C=lr(E,_);return _.slice(0,C)}var Ze=Q?new Uint16Array(32768):It(32768),Ut=Q?new Uint16Array(32768):It(32768),it=Q?new Uint16Array(128):It(128),Wr=1,zs=1;function Vc(E,_){var C=be(E,_)+257;_+=5;var k=be(E,_)+1;_+=5;var T=Be(E,_)+4;_+=4;for(var S=0,U=Q?new Uint8Array(19):It(19),j=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B=1,H=Q?new Uint8Array(8):It(8),W=Q?new Uint8Array(8):It(8),Z=U.length,se=0;se<T;++se)U[O[se]]=S=Fe(E,_),B<S&&(B=S),H[S]++,_+=3;var he=0;for(H[0]=0,se=1;se<=B;++se)W[se]=he=he+H[se-1]<<1;for(se=0;se<Z;++se)(he=U[se])!=0&&(j[se]=W[he]++);var ee=0;for(se=0;se<Z;++se)if(ee=U[se],ee!=0){he=q[j[se]]>>8-ee;for(var fe=(1<<7-ee)-1;fe>=0;--fe)it[he|fe<<ee]=ee&7|se<<3}var we=[];for(B=1;we.length<C+k;)switch(he=it[oe(E,_)],_+=he&7,he>>>=3){case 16:for(S=3+Ve(E,_),_+=2,he=we[we.length-1];S-- >0;)we.push(he);break;case 17:for(S=3+Fe(E,_),_+=3;S-- >0;)we.push(0);break;case 18:for(S=11+oe(E,_),_+=7;S-- >0;)we.push(0);break;default:we.push(he),B<he&&(B=he);break}var Ge=we.slice(0,C),ze=we.slice(C);for(se=C;se<286;++se)Ge[se]=0;for(se=k;se<30;++se)ze[se]=0;return Wr=vr(Ge,Ze,286),zs=vr(ze,Ut,30),_}function Uc(E,_){if(E[0]==3&&!(E[1]&3))return[Pr(_),2];for(var C=0,k=0,T=oo(_||1<<18),S=0,U=T.length>>>0,j=0,B=0;!(k&1);){if(k=Fe(E,C),C+=3,k>>>1)k>>1==1?(j=9,B=5):(C=Vc(E,C),j=Wr,B=zs);else{C&7&&(C+=8-(C&7));var H=E[C>>>3]|E[(C>>>3)+1]<<8;if(C+=32,H>0)for(!_&&U<S+H&&(T=Ar(T,S+H),U=T.length);H-- >0;)T[S++]=E[C>>>3],C+=8;continue}for(;;){!_&&U<S+32767&&(T=Ar(T,S+32767),U=T.length);var W=qe(E,C,j),Z=k>>>1==1?Ir[W]:Ze[W];if(C+=Z&15,Z>>>=4,!(Z>>>8&255))T[S++]=Z;else{if(Z==256)break;Z-=257;var se=Z<8?0:Z-4>>2;se>5&&(se=0);var he=S+K[Z];se>0&&(he+=qe(E,C,se),C+=se),W=qe(E,C,B),Z=k>>>1==1?Da[W]:Ut[W],C+=Z&15,Z>>>=4;var ee=Z<4?0:Z-2>>1,fe=te[Z];for(ee>0&&(fe+=qe(E,C,ee),C+=ee),!_&&U<he&&(T=Ar(T,he+100),U=T.length);S<he;)T[S]=T[S-fe],++S}}}return _?[T,C+7>>>3]:[T.slice(0,S),C+7>>>3]}function Xs(E,_){var C=E.slice(E.l||0),k=Uc(C,_);return E.l+=k[1],k[0]}function js(E,_){if(E)typeof console<"u"&&console.error(_);else throw new Error(_)}function Ks(E,_){var C=E;dt(C,0);var k=[],T=[],S={FileIndex:k,FullPaths:T};y(S,{root:_.root});for(var U=C.length-4;(C[U]!=80||C[U+1]!=75||C[U+2]!=5||C[U+3]!=6)&&U>=0;)--U;C.l=U+4,C.l+=4;var j=C.read_shift(2);C.l+=6;var B=C.read_shift(4);for(C.l=B,U=0;U<j;++U){C.l+=20;var H=C.read_shift(4),W=C.read_shift(4),Z=C.read_shift(2),se=C.read_shift(2),he=C.read_shift(2);C.l+=8;var ee=C.read_shift(4),fe=o(C.slice(C.l+Z,C.l+Z+se));C.l+=Z+se+he;var we=C.l;C.l=ee+4,Hc(C,H,W,S,fe),C.l=we}return S}function Hc(E,_,C,k,T){E.l+=2;var S=E.read_shift(2),U=E.read_shift(2),j=s(E);if(S&8257)throw new Error("Unsupported ZIP encryption");for(var B=E.read_shift(4),H=E.read_shift(4),W=E.read_shift(4),Z=E.read_shift(2),se=E.read_shift(2),he="",ee=0;ee<Z;++ee)he+=String.fromCharCode(E[E.l++]);if(se){var fe=o(E.slice(E.l,E.l+se));(fe[21589]||{}).mt&&(j=fe[21589].mt),((T||{})[21589]||{}).mt&&(j=T[21589].mt)}E.l+=se;var we=E.slice(E.l,E.l+H);switch(U){case 8:we=D(E,W);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+U)}var Ge=!1;S&8&&(B=E.read_shift(4),B==134695760&&(B=E.read_shift(4),Ge=!0),H=E.read_shift(4),W=E.read_shift(4)),H!=_&&js(Ge,"Bad compressed size: "+_+" != "+H),W!=C&&js(Ge,"Bad uncompressed size: "+C+" != "+W),pi(k,he,we,{unsafe:!0,mt:j})}function Wc(E,_){var C=_||{},k=[],T=[],S=X(1),U=C.compression?8:0,j=0,B=0,H=0,W=0,Z=0,se=E.FullPaths[0],he=se,ee=E.FileIndex[0],fe=[],we=0;for(B=1;B<E.FullPaths.length;++B)if(he=E.FullPaths[B].slice(se.length),ee=E.FileIndex[B],!(!ee.size||!ee.content||he=="Sh33tJ5")){var Ge=W,ze=X(he.length);for(H=0;H<he.length;++H)ze.write_shift(1,he.charCodeAt(H)&127);ze=ze.slice(0,ze.l),fe[Z]=ou.buf(ee.content,0);var mt=ee.content;U==8&&(mt=M(mt)),S=X(30),S.write_shift(4,67324752),S.write_shift(2,20),S.write_shift(2,j),S.write_shift(2,U),ee.mt?i(S,ee.mt):S.write_shift(4,0),S.write_shift(-4,fe[Z]),S.write_shift(4,mt.length),S.write_shift(4,ee.content.length),S.write_shift(2,ze.length),S.write_shift(2,0),W+=S.length,k.push(S),W+=ze.length,k.push(ze),W+=mt.length,k.push(mt),S=X(46),S.write_shift(4,33639248),S.write_shift(2,0),S.write_shift(2,20),S.write_shift(2,j),S.write_shift(2,U),S.write_shift(4,0),S.write_shift(-4,fe[Z]),S.write_shift(4,mt.length),S.write_shift(4,ee.content.length),S.write_shift(2,ze.length),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(4,0),S.write_shift(4,Ge),we+=S.l,T.push(S),we+=ze.length,T.push(ze),++Z}return S=X(22),S.write_shift(4,101010256),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(2,Z),S.write_shift(2,Z),S.write_shift(4,we),S.write_shift(4,W),S.write_shift(2,0),ft([ft(k),ft(T),S])}var yn={htm:"text/html",xml:"text/xml",gif:"image/gif",jpg:"image/jpeg",png:"image/png",mso:"application/x-mso",thmx:"application/vnd.ms-officetheme",sh33tj5:"application/octet-stream"};function $c(E,_){if(E.ctype)return E.ctype;var C=E.name||"",k=C.match(/\.([^\.]+)$/);return k&&yn[k[1]]||_&&(k=(C=_).match(/[\.\\]([^\.\\])+$/),k&&yn[k[1]])?yn[k[1]]:"application/octet-stream"}function Gc(E){for(var _=en(E),C=[],k=0;k<_.length;k+=76)C.push(_.slice(k,k+76));return C.join(`\r
|
|
317
|
+
</svg>`,Bi="Enter text in {language}...",bh="Enter text in ",xe=(t,e,r)=>({label:e,placeholder:`${bh}${t}`}),b0={en:xe("en","English"),ka:xe("ka","ქართული"),de:xe("de","Deutsch"),fr:xe("fr","Français"),es:xe("es","Español"),it:xe("it","Italiano"),pt:xe("pt","Português"),nl:xe("nl","Nederlands"),sv:xe("sv","Svenska"),no:xe("no","Norsk"),da:xe("da","Dansk"),fi:xe("fi","Suomi"),pl:xe("pl","Polski"),cs:xe("cs","Čeština"),sk:xe("sk","Slovenčina"),hu:xe("hu","Magyar"),ro:xe("ro","Română"),bg:xe("bg","Български"),uk:xe("uk","Українська"),ru:xe("ru","Русский"),sr:xe("sr","Српски"),hr:xe("hr","Hrvatski"),sl:xe("sl","Slovenščina"),el:xe("el","Ελληνικά"),tr:xe("tr","Türkçe"),ar:xe("ar","العربية"),he:xe("he","עברית"),fa:xe("fa","فارسی"),ur:xe("ur","اردو"),hi:xe("hi","हिन्दी"),bn:xe("bn","বাংলা"),ta:xe("ta","தமிழ்"),te:xe("te","తెలుగు"),mr:xe("mr","मराठी"),gu:xe("gu","ગુજરાતી"),pa:xe("pa","ਪੰਜਾਬੀ"),th:xe("th","ไทย"),vi:xe("vi","TiếngViệt"),id:xe("id","BahasaIndonesia"),ms:xe("ms","BahasaMelayu"),fil:xe("fil","Filipino"),zh:xe("zh","中文"),ja:xe("ja","日本語"),ko:xe("ko","한국어"),sw:xe("sw","Kiswahili"),am:xe("am","አማርኛ"),yo:xe("yo","Yorùbá"),zu:xe("zu","IsiZulu")};function F0(t){var r,a;const e=b0[((r=t==null?void 0:t.toLowerCase)==null?void 0:r.call(t))||""];return e!=null&&e.label?e.label:((a=t==null?void 0:t.toUpperCase)==null?void 0:a.call(t))||String(t)}function Vn(t,e=Bi){var n;const r=b0[((n=t==null?void 0:t.toLowerCase)==null?void 0:n.call(t))||""];if(r!=null&&r.placeholder)return r.placeholder;const a=F0(t);return e.includes("{language}")?e.replace("{language}",a):e}function Fh(t){const e=document.createElement("div");e.classList.add("simple-multi-language-title");const r=document.createElement("span");r.textContent=t.title??"";const a=document.createElement("button");return a.classList.add("multi-language-eye-icon"),a.innerHTML=Th,a.addEventListener("click",n=>{n.preventDefault(),t.onEyeIconClick()}),e.appendChild(r),e.appendChild(a),e}let xi;function no(t,e){xi||(xi=document.createElement("canvas"));const r=xi.getContext("2d");if(!r)return t.length*10;const a=`${e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`.trim();return r.font=a,r.measureText(t).width}function Kr(t,e){const r=window.getComputedStyle(t),a=parseFloat(r.paddingLeft)||0,n=parseFloat(r.paddingRight)||0,i=parseFloat(r.borderLeftWidth)||0,s=parseFloat(r.borderRightWidth)||0,o=Math.max(0,t.clientWidth-a-n-i-s);if(o<=0){t.placeholder=e;return}if(no(e,r)<=o){t.placeholder=e;return}const c="...";let f=0,h=e.length,u=0;for(;f<=h;){const m=Math.floor((f+h)/2),d=e.slice(0,m).trimEnd()+c;no(d,r)<=o?(u=m,f=m+1):h=m-1}const p=e.slice(0,u).trimEnd()+c;t.placeholder=p}function rs(t,e=3){t.style.height="auto";const r=window.getComputedStyle(t),a=parseFloat(r.lineHeight)||20,n=parseFloat(r.paddingTop)+parseFloat(r.paddingBottom),i=parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth),s=a*e+n+i,o=Math.min(t.scrollHeight||55,s);t.style.height=`${o}px`,t.scrollHeight>s?t.style.overflowY="auto":t.style.overflowY="hidden"}function Lh(t,e=3){requestAnimationFrame(()=>{t.offsetHeight,rs(t,e);const r=t.getAttribute("data-full-placeholder");r&&Kr(t,r)})}function L0(t){const e=document.createElement("div");e.classList.add("simple-multi-language-row");const r=document.createElement("label");if(r.classList.add("simple-language-label"),r.textContent=F0(t.languageCode),r.setAttribute("for",`textarea-${t.languageCode}`),e.appendChild(r),t.multiImg&&t.uploadSetting){const a=t.uploadSetting.draw();a.classList.add("simple-language-upload"),e.appendChild(a)}else{const a=document.createElement("textarea");a.id=`textarea-${t.languageCode}`,a.classList.add("simple-language-textarea"),t.isPopupMode&&a.classList.add("popup-mode"),a.value=t.value||"",a.rows=1,a.style.overflowY="hidden",a.setAttribute("data-full-placeholder",t.placeholder),Kr(a,t.placeholder),t.dataTestId&&a.setAttribute("data-test-id",t.dataTestId);const n=t.maxRows??3;let i=null;a.addEventListener("input",s=>{const o=s.target;t.onInput(t.languageCode,o.value),rs(o,n);const l=a.getAttribute("data-full-placeholder")||"";l&&Kr(a,l),i&&clearTimeout(i),i=setTimeout(()=>{const c=a.value;a.value=c+"",t.onInput(t.languageCode,a.value),setTimeout(()=>{a.value=c,t.onInput(t.languageCode,a.value)},100),i=null},500)}),e.appendChild(a),Lh(a,n)}return e}function Ah(t){const e=document.createElement("div");e.classList.add("multi-language-popup-overlay");const r=document.createElement("div");r.classList.add("multi-language-popup");const a=document.createElement("div");a.classList.add("multi-language-popup-header");const n=document.createElement("h3");n.classList.add("multi-language-popup-title"),n.textContent="All Languages";const i=document.createElement("button");i.classList.add("multi-language-close-button"),i.innerHTML=Sh,i.addEventListener("click",()=>t.onClose()),a.appendChild(n),a.appendChild(i),r.appendChild(a);const s=document.createElement("div");s.classList.add("multi-language-popup-content"),t.languages.forEach(c=>{var d;const f=((d=t.values)==null?void 0:d[c])||"",h=Vn(c,t.placeholder),u=t.uploadSettings.get(c),p=t.dataTestPath?`${t.dataTestPath}_${c}`:void 0,m=L0({languageCode:c,value:f,placeholder:h,isDefaultLanguage:!1,isPopupMode:!0,multiImg:t.multiImg,onInput:t.onInput,uploadSetting:u,dataTestId:p});s.appendChild(m)}),r.appendChild(s);const o=document.createElement("div");o.classList.add("multi-language-popup-footer");const l=document.createElement("button");return l.classList.add("multi-language-done-button"),l.textContent="Done",l.addEventListener("click",()=>t.onClose()),o.appendChild(l),r.appendChild(o),e.appendChild(r),e.addEventListener("mousedown",c=>{c.target===e&&t.onClose()}),e}/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */var zn={};zn.version="0.18.5";var A0=1252,Ih=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],as={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969},ns=function(t){Ih.indexOf(t)!=-1&&(A0=as[0]=t)};function Nh(){ns(1252)}var tr=function(t){ns(t)};function is(){tr(1200),Nh()}function io(t){for(var e=[],r=0,a=t.length;r<a;++r)e[r]=t.charCodeAt(r);return e}function Mh(t){for(var e=[],r=0;r<t.length>>1;++r)e[r]=String.fromCharCode(t.charCodeAt(2*r)+(t.charCodeAt(2*r+1)<<8));return e.join("")}function I0(t){for(var e=[],r=0;r<t.length>>1;++r)e[r]=String.fromCharCode(t.charCodeAt(2*r+1)+(t.charCodeAt(2*r)<<8));return e.join("")}var Ha=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1);return e==255&&r==254?Mh(t.slice(2)):e==254&&r==255?I0(t.slice(2)):e==65279?t.slice(1):t},kn=function(e){return String.fromCharCode(e)},so=function(e){return String.fromCharCode(e)},Vi,Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function en(t){for(var e="",r=0,a=0,n=0,i=0,s=0,o=0,l=0,c=0;c<t.length;)r=t.charCodeAt(c++),i=r>>2,a=t.charCodeAt(c++),s=(r&3)<<4|a>>4,n=t.charCodeAt(c++),o=(a&15)<<2|n>>6,l=n&63,isNaN(a)?o=l=64:isNaN(n)&&(l=64),e+=Mr.charAt(i)+Mr.charAt(s)+Mr.charAt(o)+Mr.charAt(l);return e}function Bt(t){var e="",r=0,a=0,n=0,i=0,s=0,o=0,l=0;t=t.replace(/[^\w\+\/\=]/g,"");for(var c=0;c<t.length;)i=Mr.indexOf(t.charAt(c++)),s=Mr.indexOf(t.charAt(c++)),r=i<<2|s>>4,e+=String.fromCharCode(r),o=Mr.indexOf(t.charAt(c++)),a=(s&15)<<4|o>>2,o!==64&&(e+=String.fromCharCode(a)),l=Mr.indexOf(t.charAt(c++)),n=(o&3)<<6|l,l!==64&&(e+=String.fromCharCode(n));return e}var _e=function(){return typeof Buffer<"u"&&typeof process<"u"&&typeof process.versions<"u"&&!!process.versions.node}(),br=function(){if(typeof Buffer<"u"){var t=!Buffer.from;if(!t)try{Buffer.from("foo","utf8")}catch{t=!0}return t?function(e,r){return r?new Buffer(e,r):new Buffer(e)}:Buffer.from.bind(Buffer)}return function(){}}();function Pr(t){return _e?Buffer.alloc?Buffer.alloc(t):new Buffer(t):typeof Uint8Array<"u"?new Uint8Array(t):new Array(t)}function oo(t){return _e?Buffer.allocUnsafe?Buffer.allocUnsafe(t):new Buffer(t):typeof Uint8Array<"u"?new Uint8Array(t):new Array(t)}var Dt=function(e){return _e?br(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)&255})};function ii(t){if(typeof ArrayBuffer>"u")return Dt(t);for(var e=new ArrayBuffer(t.length),r=new Uint8Array(e),a=0;a!=t.length;++a)r[a]=t.charCodeAt(a)&255;return e}function Vr(t){if(Array.isArray(t))return t.map(function(a){return String.fromCharCode(a)}).join("");for(var e=[],r=0;r<t.length;++r)e[r]=String.fromCharCode(t[r]);return e.join("")}function Oh(t){if(typeof Uint8Array>"u")throw new Error("Unsupported");return new Uint8Array(t)}function ss(t){if(typeof ArrayBuffer>"u")throw new Error("Unsupported");if(t instanceof ArrayBuffer)return ss(new Uint8Array(t));for(var e=new Array(t.length),r=0;r<t.length;++r)e[r]=t[r];return e}var ft=_e?function(t){return Buffer.concat(t.map(function(e){return Buffer.isBuffer(e)?e:br(e)}))}:function(t){if(typeof Uint8Array<"u"){var e=0,r=0;for(e=0;e<t.length;++e)r+=t[e].length;var a=new Uint8Array(r),n=0;for(e=0,r=0;e<t.length;r+=n,++e)if(n=t[e].length,t[e]instanceof Uint8Array)a.set(t[e],r);else{if(typeof t[e]=="string")throw"wtf";a.set(new Uint8Array(t[e]),r)}return a}return[].concat.apply([],t.map(function(i){return Array.isArray(i)?i:[].slice.call(i)}))};function Ph(t){for(var e=[],r=0,a=t.length+250,n=Pr(t.length+255),i=0;i<t.length;++i){var s=t.charCodeAt(i);if(s<128)n[r++]=s;else if(s<2048)n[r++]=192|s>>6&31,n[r++]=128|s&63;else if(s>=55296&&s<57344){s=(s&1023)+64;var o=t.charCodeAt(++i)&1023;n[r++]=240|s>>8&7,n[r++]=128|s>>2&63,n[r++]=128|o>>6&15|(s&3)<<4,n[r++]=128|o&63}else n[r++]=224|s>>12&15,n[r++]=128|s>>6&63,n[r++]=128|s&63;r>a&&(e.push(n.slice(0,r)),r=0,n=Pr(65535),a=65530)}return e.push(n.slice(0,r)),ft(e)}var bt=/\u0000/g,Wa=/[\u0001-\u0006]/g;function _a(t){for(var e="",r=t.length-1;r>=0;)e+=t.charAt(r--);return e}function rr(t,e){var r=""+t;return r.length>=e?r:Ke("0",e-r.length)+r}function os(t,e){var r=""+t;return r.length>=e?r:Ke(" ",e-r.length)+r}function Xn(t,e){var r=""+t;return r.length>=e?r:r+Ke(" ",e-r.length)}function Dh(t,e){var r=""+Math.round(t);return r.length>=e?r:Ke("0",e-r.length)+r}function Rh(t,e){var r=""+t;return r.length>=e?r:Ke("0",e-r.length)+r}var lo=Math.pow(2,32);function ga(t,e){if(t>lo||t<-lo)return Dh(t,e);var r=Math.round(t);return Rh(r,e)}function jn(t,e){return e=e||0,t.length>=7+e&&(t.charCodeAt(e)|32)===103&&(t.charCodeAt(e+1)|32)===101&&(t.charCodeAt(e+2)|32)===110&&(t.charCodeAt(e+3)|32)===101&&(t.charCodeAt(e+4)|32)===114&&(t.charCodeAt(e+5)|32)===97&&(t.charCodeAt(e+6)|32)===108}var co=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],vi=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function Bh(t){return t||(t={}),t[0]="General",t[1]="0",t[2]="0.00",t[3]="#,##0",t[4]="#,##0.00",t[9]="0%",t[10]="0.00%",t[11]="0.00E+00",t[12]="# ?/?",t[13]="# ??/??",t[14]="m/d/yy",t[15]="d-mmm-yy",t[16]="d-mmm",t[17]="mmm-yy",t[18]="h:mm AM/PM",t[19]="h:mm:ss AM/PM",t[20]="h:mm",t[21]="h:mm:ss",t[22]="m/d/yy h:mm",t[37]="#,##0 ;(#,##0)",t[38]="#,##0 ;[Red](#,##0)",t[39]="#,##0.00;(#,##0.00)",t[40]="#,##0.00;[Red](#,##0.00)",t[45]="mm:ss",t[46]="[h]:mm:ss",t[47]="mmss.0",t[48]="##0.0E+0",t[49]="@",t[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',t}var me={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'},fo={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},Vh={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function Kn(t,e,r){for(var a=t<0?-1:1,n=t*a,i=0,s=1,o=0,l=1,c=0,f=0,h=Math.floor(n);c<e&&(h=Math.floor(n),o=h*s+i,f=h*c+l,!(n-h<5e-8));)n=1/(n-h),i=s,s=o,l=c,c=f;if(f>e&&(c>e?(f=l,o=i):(f=c,o=s)),!r)return[0,a*o,f];var u=Math.floor(a*o/f);return[u,a*o-u*f,f]}function Yr(t,e,r){if(t>2958465||t<0)return null;var a=t|0,n=Math.floor(86400*(t-a)),i=0,s=[],o={D:a,T:n,u:86400*(t-a)-n,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(o.u)<1e-6&&(o.u=0),e&&e.date1904&&(a+=1462),o.u>.9999&&(o.u=0,++n==86400&&(o.T=n=0,++a,++o.D)),a===60)s=r?[1317,10,29]:[1900,2,29],i=3;else if(a===0)s=r?[1317,8,29]:[1900,1,0],i=6;else{a>60&&--a;var l=new Date(1900,0,1);l.setDate(l.getDate()+a-1),s=[l.getFullYear(),l.getMonth()+1,l.getDate()],i=l.getDay(),a<60&&(i=(i+6)%7),r&&(i=zh(l,s))}return o.y=s[0],o.m=s[1],o.d=s[2],o.S=n%60,n=Math.floor(n/60),o.M=n%60,n=Math.floor(n/60),o.H=n,o.q=i,o}var N0=new Date(1899,11,31,0,0,0),Uh=N0.getTime(),Hh=new Date(1900,2,1,0,0,0);function M0(t,e){var r=t.getTime();return e?r-=1461*24*60*60*1e3:t>=Hh&&(r+=24*60*60*1e3),(r-(Uh+(t.getTimezoneOffset()-N0.getTimezoneOffset())*6e4))/(24*60*60*1e3)}function ls(t){return t.indexOf(".")==-1?t:t.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function Wh(t){return t.indexOf("E")==-1?t:t.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function $h(t){var e=t<0?12:11,r=ls(t.toFixed(12));return r.length<=e||(r=t.toPrecision(10),r.length<=e)?r:t.toExponential(5)}function Gh(t){var e=ls(t.toFixed(11));return e.length>(t<0?12:11)||e==="0"||e==="-0"?t.toPrecision(6):e}function tn(t){var e=Math.floor(Math.log(Math.abs(t))*Math.LOG10E),r;return e>=-4&&e<=-1?r=t.toPrecision(10+e):Math.abs(e)<=9?r=$h(t):e===10?r=t.toFixed(10).substr(0,12):r=Gh(t),ls(Wh(r.toUpperCase()))}function na(t,e){switch(typeof t){case"string":return t;case"boolean":return t?"TRUE":"FALSE";case"number":return(t|0)===t?t.toString(10):tn(t);case"undefined":return"";case"object":if(t==null)return"";if(t instanceof Date)return Kt(14,M0(t,e&&e.date1904),e)}throw new Error("unsupported value in General format: "+t)}function zh(t,e){e[0]-=581;var r=t.getDay();return t<60&&(r=(r+6)%7),r}function Xh(t,e,r,a){var n="",i=0,s=0,o=r.y,l,c=0;switch(t){case 98:o=r.y+543;case 121:switch(e.length){case 1:case 2:l=o%100,c=2;break;default:l=o%1e4,c=4;break}break;case 109:switch(e.length){case 1:case 2:l=r.m,c=e.length;break;case 3:return vi[r.m-1][1];case 5:return vi[r.m-1][0];default:return vi[r.m-1][2]}break;case 100:switch(e.length){case 1:case 2:l=r.d,c=e.length;break;case 3:return co[r.q][0];default:return co[r.q][1]}break;case 104:switch(e.length){case 1:case 2:l=1+(r.H+11)%12,c=e.length;break;default:throw"bad hour format: "+e}break;case 72:switch(e.length){case 1:case 2:l=r.H,c=e.length;break;default:throw"bad hour format: "+e}break;case 77:switch(e.length){case 1:case 2:l=r.M,c=e.length;break;default:throw"bad minute format: "+e}break;case 115:if(e!="s"&&e!="ss"&&e!=".0"&&e!=".00"&&e!=".000")throw"bad second format: "+e;return r.u===0&&(e=="s"||e=="ss")?rr(r.S,e.length):(a>=2?s=a===3?1e3:100:s=a===1?10:1,i=Math.round(s*(r.S+r.u)),i>=60*s&&(i=0),e==="s"?i===0?"0":""+i/s:(n=rr(i,2+a),e==="ss"?n.substr(0,2):"."+n.substr(2,e.length-1)));case 90:switch(e){case"[h]":case"[hh]":l=r.D*24+r.H;break;case"[m]":case"[mm]":l=(r.D*24+r.H)*60+r.M;break;case"[s]":case"[ss]":l=((r.D*24+r.H)*60+r.M)*60+Math.round(r.S+r.u);break;default:throw"bad abstime format: "+e}c=e.length===3?1:2;break;case 101:l=o,c=1;break}var f=c>0?rr(l,c):"";return f}function Or(t){var e=3;if(t.length<=e)return t;for(var r=t.length%e,a=t.substr(0,r);r!=t.length;r+=e)a+=(a.length>0?",":"")+t.substr(r,e);return a}var O0=/%/g;function jh(t,e,r){var a=e.replace(O0,""),n=e.length-a.length;return kr(t,a,r*Math.pow(10,2*n))+Ke("%",n)}function Kh(t,e,r){for(var a=e.length-1;e.charCodeAt(a-1)===44;)--a;return kr(t,e.substr(0,a),r/Math.pow(10,3*(e.length-a)))}function P0(t,e){var r,a=t.indexOf("E")-t.indexOf(".")-1;if(t.match(/^#+0.0E\+0$/)){if(e==0)return"0.0E+0";if(e<0)return"-"+P0(t,-e);var n=t.indexOf(".");n===-1&&(n=t.indexOf("E"));var i=Math.floor(Math.log(e)*Math.LOG10E)%n;if(i<0&&(i+=n),r=(e/Math.pow(10,i)).toPrecision(a+1+(n+i)%n),r.indexOf("e")===-1){var s=Math.floor(Math.log(e)*Math.LOG10E);for(r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(s-r.length+i):r+="E+"+(s-i);r.substr(0,2)==="0.";)r=r.charAt(0)+r.substr(2,n)+"."+r.substr(2+n),r=r.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(o,l,c,f){return l+c+f.substr(0,(n+i)%n)+"."+f.substr(i)+"E"})}else r=e.toExponential(a);return t.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),t.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}var D0=/# (\?+)( ?)\/( ?)(\d+)/;function Yh(t,e,r){var a=parseInt(t[4],10),n=Math.round(e*a),i=Math.floor(n/a),s=n-i*a,o=a;return r+(i===0?"":""+i)+" "+(s===0?Ke(" ",t[1].length+1+t[4].length):os(s,t[1].length)+t[2]+"/"+t[3]+rr(o,t[4].length))}function Jh(t,e,r){return r+(e===0?"":""+e)+Ke(" ",t[1].length+2+t[4].length)}var R0=/^#*0*\.([0#]+)/,B0=/\).*[0#]/,V0=/\(###\) ###\\?-####/;function Tt(t){for(var e="",r,a=0;a!=t.length;++a)switch(r=t.charCodeAt(a)){case 35:break;case 63:e+=" ";break;case 48:e+="0";break;default:e+=String.fromCharCode(r)}return e}function ho(t,e){var r=Math.pow(10,e);return""+Math.round(t*r)/r}function uo(t,e){var r=t-Math.floor(t),a=Math.pow(10,e);return e<(""+Math.round(r*a)).length?0:Math.round(r*a)}function qh(t,e){return e<(""+Math.round((t-Math.floor(t))*Math.pow(10,e))).length?1:0}function Zh(t){return t<2147483647&&t>-2147483648?""+(t>=0?t|0:t-1|0):""+Math.floor(t)}function Wt(t,e,r){if(t.charCodeAt(0)===40&&!e.match(B0)){var a=e.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?Wt("n",a,r):"("+Wt("n",a,-r)+")"}if(e.charCodeAt(e.length-1)===44)return Kh(t,e,r);if(e.indexOf("%")!==-1)return jh(t,e,r);if(e.indexOf("E")!==-1)return P0(e,r);if(e.charCodeAt(0)===36)return"$"+Wt(t,e.substr(e.charAt(1)==" "?2:1),r);var n,i,s,o,l=Math.abs(r),c=r<0?"-":"";if(e.match(/^00+$/))return c+ga(l,e.length);if(e.match(/^[#?]+$/))return n=ga(r,0),n==="0"&&(n=""),n.length>e.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(D0))return Yh(i,l,c);if(e.match(/^#+0+$/))return c+ga(l,e.length-e.indexOf("0"));if(i=e.match(R0))return n=ho(r,i[1].length).replace(/^([^\.]+)$/,"$1."+Tt(i[1])).replace(/\.$/,"."+Tt(i[1])).replace(/\.(\d*)$/,function(m,d){return"."+d+Ke("0",Tt(i[1]).length-d.length)}),e.indexOf("0.")!==-1?n:n.replace(/^0\./,".");if(e=e.replace(/^#+([0.])/,"$1"),i=e.match(/^(0*)\.(#*)$/))return c+ho(l,i[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=e.match(/^#{1,3},##0(\.?)$/))return c+Or(ga(l,0));if(i=e.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+Wt(t,e,-r):Or(""+(Math.floor(r)+qh(r,i[1].length)))+"."+rr(uo(r,i[1].length),i[1].length);if(i=e.match(/^#,#*,#0/))return Wt(t,e.replace(/^#,#*,/,""),r);if(i=e.match(/^([0#]+)(\\?-([0#]+))+$/))return n=_a(Wt(t,e.replace(/[\\-]/g,""),r)),s=0,_a(_a(e.replace(/\\/g,"")).replace(/[0#]/g,function(m){return s<n.length?n.charAt(s++):m==="0"?"0":""}));if(e.match(V0))return n=Wt(t,"##########",r),"("+n.substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(i=e.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(i[4].length,7),o=Kn(l,Math.pow(10,s)-1,!1),n=""+c,f=kr("n",i[1],o[1]),f.charAt(f.length-1)==" "&&(f=f.substr(0,f.length-1)+"0"),n+=f+i[2]+"/"+i[3],f=Xn(o[2],s),f.length<i[4].length&&(f=Tt(i[4].substr(i[4].length-f.length))+f),n+=f,n;if(i=e.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(Math.max(i[1].length,i[4].length),7),o=Kn(l,Math.pow(10,s)-1,!0),c+(o[0]||(o[1]?"":"0"))+" "+(o[1]?os(o[1],s)+i[2]+"/"+i[3]+Xn(o[2],s):Ke(" ",2*s+1+i[2].length+i[3].length));if(i=e.match(/^[#0?]+$/))return n=ga(r,0),e.length<=n.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(/^([#0?]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),s=n.indexOf(".");var h=e.indexOf(".")-s,u=e.length-n.length-h;return Tt(e.substr(0,h)+n+e.substr(e.length-u))}if(i=e.match(/^00,000\.([#0]*0)$/))return s=uo(r,i[1].length),r<0?"-"+Wt(t,e,-r):Or(Zh(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(m){return"00,"+(m.length<3?rr(0,3-m.length):"")+m})+"."+rr(s,i[1].length);switch(e){case"###,##0.00":return Wt(t,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var p=Or(ga(l,0));return p!=="0"?c+p:"";case"###,###.00":return Wt(t,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return Wt(t,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+e+"|")}function Qh(t,e,r){for(var a=e.length-1;e.charCodeAt(a-1)===44;)--a;return kr(t,e.substr(0,a),r/Math.pow(10,3*(e.length-a)))}function eu(t,e,r){var a=e.replace(O0,""),n=e.length-a.length;return kr(t,a,r*Math.pow(10,2*n))+Ke("%",n)}function U0(t,e){var r,a=t.indexOf("E")-t.indexOf(".")-1;if(t.match(/^#+0.0E\+0$/)){if(e==0)return"0.0E+0";if(e<0)return"-"+U0(t,-e);var n=t.indexOf(".");n===-1&&(n=t.indexOf("E"));var i=Math.floor(Math.log(e)*Math.LOG10E)%n;if(i<0&&(i+=n),r=(e/Math.pow(10,i)).toPrecision(a+1+(n+i)%n),!r.match(/[Ee]/)){var s=Math.floor(Math.log(e)*Math.LOG10E);r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(s-r.length+i):r+="E+"+(s-i),r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(o,l,c,f){return l+c+f.substr(0,(n+i)%n)+"."+f.substr(i)+"E"})}else r=e.toExponential(a);return t.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),t.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}function hr(t,e,r){if(t.charCodeAt(0)===40&&!e.match(B0)){var a=e.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?hr("n",a,r):"("+hr("n",a,-r)+")"}if(e.charCodeAt(e.length-1)===44)return Qh(t,e,r);if(e.indexOf("%")!==-1)return eu(t,e,r);if(e.indexOf("E")!==-1)return U0(e,r);if(e.charCodeAt(0)===36)return"$"+hr(t,e.substr(e.charAt(1)==" "?2:1),r);var n,i,s,o,l=Math.abs(r),c=r<0?"-":"";if(e.match(/^00+$/))return c+rr(l,e.length);if(e.match(/^[#?]+$/))return n=""+r,r===0&&(n=""),n.length>e.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(D0))return Jh(i,l,c);if(e.match(/^#+0+$/))return c+rr(l,e.length-e.indexOf("0"));if(i=e.match(R0))return n=(""+r).replace(/^([^\.]+)$/,"$1."+Tt(i[1])).replace(/\.$/,"."+Tt(i[1])),n=n.replace(/\.(\d*)$/,function(m,d){return"."+d+Ke("0",Tt(i[1]).length-d.length)}),e.indexOf("0.")!==-1?n:n.replace(/^0\./,".");if(e=e.replace(/^#+([0.])/,"$1"),i=e.match(/^(0*)\.(#*)$/))return c+(""+l).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=e.match(/^#{1,3},##0(\.?)$/))return c+Or(""+l);if(i=e.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+hr(t,e,-r):Or(""+r)+"."+Ke("0",i[1].length);if(i=e.match(/^#,#*,#0/))return hr(t,e.replace(/^#,#*,/,""),r);if(i=e.match(/^([0#]+)(\\?-([0#]+))+$/))return n=_a(hr(t,e.replace(/[\\-]/g,""),r)),s=0,_a(_a(e.replace(/\\/g,"")).replace(/[0#]/g,function(m){return s<n.length?n.charAt(s++):m==="0"?"0":""}));if(e.match(V0))return n=hr(t,"##########",r),"("+n.substr(0,3)+") "+n.substr(3,3)+"-"+n.substr(6);var f="";if(i=e.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(i[4].length,7),o=Kn(l,Math.pow(10,s)-1,!1),n=""+c,f=kr("n",i[1],o[1]),f.charAt(f.length-1)==" "&&(f=f.substr(0,f.length-1)+"0"),n+=f+i[2]+"/"+i[3],f=Xn(o[2],s),f.length<i[4].length&&(f=Tt(i[4].substr(i[4].length-f.length))+f),n+=f,n;if(i=e.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return s=Math.min(Math.max(i[1].length,i[4].length),7),o=Kn(l,Math.pow(10,s)-1,!0),c+(o[0]||(o[1]?"":"0"))+" "+(o[1]?os(o[1],s)+i[2]+"/"+i[3]+Xn(o[2],s):Ke(" ",2*s+1+i[2].length+i[3].length));if(i=e.match(/^[#0?]+$/))return n=""+r,e.length<=n.length?n:Tt(e.substr(0,e.length-n.length))+n;if(i=e.match(/^([#0]+)\.([#0]+)$/)){n=""+r.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),s=n.indexOf(".");var h=e.indexOf(".")-s,u=e.length-n.length-h;return Tt(e.substr(0,h)+n+e.substr(e.length-u))}if(i=e.match(/^00,000\.([#0]*0)$/))return r<0?"-"+hr(t,e,-r):Or(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(m){return"00,"+(m.length<3?rr(0,3-m.length):"")+m})+"."+rr(0,i[1].length);switch(e){case"###,###":case"##,###":case"#,###":var p=Or(""+l);return p!=="0"?c+p:"";default:if(e.match(/\.[0#?]*$/))return hr(t,e.slice(0,e.lastIndexOf(".")),r)+Tt(e.slice(e.lastIndexOf(".")))}throw new Error("unsupported format |"+e+"|")}function kr(t,e,r){return(r|0)===r?hr(t,e,r):Wt(t,e,r)}function tu(t){for(var e=[],r=!1,a=0,n=0;a<t.length;++a)switch(t.charCodeAt(a)){case 34:r=!r;break;case 95:case 42:case 92:++a;break;case 59:e[e.length]=t.substr(n,a-n),n=a+1}if(e[e.length]=t.substr(n),r===!0)throw new Error("Format |"+t+"| unterminated string ");return e}var H0=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function Ia(t){for(var e=0,r="",a="";e<t.length;)switch(r=t.charAt(e)){case"G":jn(t,e)&&(e+=6),e++;break;case'"':for(;t.charCodeAt(++e)!==34&&e<t.length;);++e;break;case"\\":e+=2;break;case"_":e+=2;break;case"@":++e;break;case"B":case"b":if(t.charAt(e+1)==="1"||t.charAt(e+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(t.substr(e,3).toUpperCase()==="A/P"||t.substr(e,5).toUpperCase()==="AM/PM"||t.substr(e,5).toUpperCase()==="上午/下午")return!0;++e;break;case"[":for(a=r;t.charAt(e++)!=="]"&&e<t.length;)a+=t.charAt(e);if(a.match(H0))return!0;break;case".":case"0":case"#":for(;e<t.length&&("0#?.,E+-%".indexOf(r=t.charAt(++e))>-1||r=="\\"&&t.charAt(e+1)=="-"&&"0#".indexOf(t.charAt(e+2))>-1););break;case"?":for(;t.charAt(++e)===r;);break;case"*":++e,(t.charAt(e)==" "||t.charAt(e)=="*")&&++e;break;case"(":case")":++e;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;e<t.length&&"0123456789".indexOf(t.charAt(++e))>-1;);break;case" ":++e;break;default:++e;break}return!1}function ru(t,e,r,a){for(var n=[],i="",s=0,o="",l="t",c,f,h,u="H";s<t.length;)switch(o=t.charAt(s)){case"G":if(!jn(t,s))throw new Error("unrecognized character "+o+" in "+t);n[n.length]={t:"G",v:"General"},s+=7;break;case'"':for(i="";(h=t.charCodeAt(++s))!==34&&s<t.length;)i+=String.fromCharCode(h);n[n.length]={t:"t",v:i},++s;break;case"\\":var p=t.charAt(++s),m=p==="("||p===")"?p:"t";n[n.length]={t:m,v:p},++s;break;case"_":n[n.length]={t:"t",v:" "},s+=2;break;case"@":n[n.length]={t:"T",v:e},++s;break;case"B":case"b":if(t.charAt(s+1)==="1"||t.charAt(s+1)==="2"){if(c==null&&(c=Yr(e,r,t.charAt(s+1)==="2"),c==null))return"";n[n.length]={t:"X",v:t.substr(s,2)},l=o,s+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":o=o.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(e<0||c==null&&(c=Yr(e,r),c==null))return"";for(i=o;++s<t.length&&t.charAt(s).toLowerCase()===o;)i+=o;o==="m"&&l.toLowerCase()==="h"&&(o="M"),o==="h"&&(o=u),n[n.length]={t:o,v:i},l=o;break;case"A":case"a":case"上":var d={t:o,v:o};if(c==null&&(c=Yr(e,r)),t.substr(s,3).toUpperCase()==="A/P"?(c!=null&&(d.v=c.H>=12?"P":"A"),d.t="T",u="h",s+=3):t.substr(s,5).toUpperCase()==="AM/PM"?(c!=null&&(d.v=c.H>=12?"PM":"AM"),d.t="T",s+=5,u="h"):t.substr(s,5).toUpperCase()==="上午/下午"?(c!=null&&(d.v=c.H>=12?"下午":"上午"),d.t="T",s+=5,u="h"):(d.t="t",++s),c==null&&d.t==="T")return"";n[n.length]=d,l=o;break;case"[":for(i=o;t.charAt(s++)!=="]"&&s<t.length;)i+=t.charAt(s);if(i.slice(-1)!=="]")throw'unterminated "[" block: |'+i+"|";if(i.match(H0)){if(c==null&&(c=Yr(e,r),c==null))return"";n[n.length]={t:"Z",v:i.toLowerCase()},l=i.charAt(1)}else i.indexOf("$")>-1&&(i=(i.match(/\$([^-\[\]]*)/)||[])[1]||"$",Ia(t)||(n[n.length]={t:"t",v:i}));break;case".":if(c!=null){for(i=o;++s<t.length&&(o=t.charAt(s))==="0";)i+=o;n[n.length]={t:"s",v:i};break}case"0":case"#":for(i=o;++s<t.length&&"0#?.,E+-%".indexOf(o=t.charAt(s))>-1;)i+=o;n[n.length]={t:"n",v:i};break;case"?":for(i=o;t.charAt(++s)===o;)i+=o;n[n.length]={t:o,v:i},l=o;break;case"*":++s,(t.charAt(s)==" "||t.charAt(s)=="*")&&++s;break;case"(":case")":n[n.length]={t:a===1?"t":o,v:o},++s;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(i=o;s<t.length&&"0123456789".indexOf(t.charAt(++s))>-1;)i+=t.charAt(s);n[n.length]={t:"D",v:i};break;case" ":n[n.length]={t:o,v:o},++s;break;case"$":n[n.length]={t:"t",v:"$"},++s;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(o)===-1)throw new Error("unrecognized character "+o+" in "+t);n[n.length]={t:"t",v:o},++s;break}var g=0,x=0,w;for(s=n.length-1,l="t";s>=0;--s)switch(n[s].t){case"h":case"H":n[s].t=u,l="h",g<1&&(g=1);break;case"s":(w=n[s].v.match(/\.0+$/))&&(x=Math.max(x,w[0].length-1)),g<3&&(g=3);case"d":case"y":case"M":case"e":l=n[s].t;break;case"m":l==="s"&&(n[s].t="M",g<2&&(g=2));break;case"X":break;case"Z":g<1&&n[s].v.match(/[Hh]/)&&(g=1),g<2&&n[s].v.match(/[Mm]/)&&(g=2),g<3&&n[s].v.match(/[Ss]/)&&(g=3)}switch(g){case 0:break;case 1:c.u>=.5&&(c.u=0,++c.S),c.S>=60&&(c.S=0,++c.M),c.M>=60&&(c.M=0,++c.H);break;case 2:c.u>=.5&&(c.u=0,++c.S),c.S>=60&&(c.S=0,++c.M);break}var v="",F;for(s=0;s<n.length;++s)switch(n[s].t){case"t":case"T":case" ":case"D":break;case"X":n[s].v="",n[s].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":n[s].v=Xh(n[s].t.charCodeAt(0),n[s].v,c,x),n[s].t="t";break;case"n":case"?":for(F=s+1;n[F]!=null&&((o=n[F].t)==="?"||o==="D"||(o===" "||o==="t")&&n[F+1]!=null&&(n[F+1].t==="?"||n[F+1].t==="t"&&n[F+1].v==="/")||n[s].t==="("&&(o===" "||o==="n"||o===")")||o==="t"&&(n[F].v==="/"||n[F].v===" "&&n[F+1]!=null&&n[F+1].t=="?"));)n[s].v+=n[F].v,n[F]={v:"",t:";"},++F;v+=n[s].v,s=F-1;break;case"G":n[s].t="t",n[s].v=na(e,r);break}var N="",A,y;if(v.length>0){v.charCodeAt(0)==40?(A=e<0&&v.charCodeAt(0)===45?-e:e,y=kr("n",v,A)):(A=e<0&&a>1?-e:e,y=kr("n",v,A),A<0&&n[0]&&n[0].t=="t"&&(y=y.substr(1),n[0].v="-"+n[0].v)),F=y.length-1;var P=n.length;for(s=0;s<n.length;++s)if(n[s]!=null&&n[s].t!="t"&&n[s].v.indexOf(".")>-1){P=s;break}var I=n.length;if(P===n.length&&y.indexOf("E")===-1){for(s=n.length-1;s>=0;--s)n[s]==null||"n?".indexOf(n[s].t)===-1||(F>=n[s].v.length-1?(F-=n[s].v.length,n[s].v=y.substr(F+1,n[s].v.length)):F<0?n[s].v="":(n[s].v=y.substr(0,F+1),F=-1),n[s].t="t",I=s);F>=0&&I<n.length&&(n[I].v=y.substr(0,F+1)+n[I].v)}else if(P!==n.length&&y.indexOf("E")===-1){for(F=y.indexOf(".")-1,s=P;s>=0;--s)if(!(n[s]==null||"n?".indexOf(n[s].t)===-1)){for(f=n[s].v.indexOf(".")>-1&&s===P?n[s].v.indexOf(".")-1:n[s].v.length-1,N=n[s].v.substr(f+1);f>=0;--f)F>=0&&(n[s].v.charAt(f)==="0"||n[s].v.charAt(f)==="#")&&(N=y.charAt(F--)+N);n[s].v=N,n[s].t="t",I=s}for(F>=0&&I<n.length&&(n[I].v=y.substr(0,F+1)+n[I].v),F=y.indexOf(".")+1,s=P;s<n.length;++s)if(!(n[s]==null||"n?(".indexOf(n[s].t)===-1&&s!==P)){for(f=n[s].v.indexOf(".")>-1&&s===P?n[s].v.indexOf(".")+1:0,N=n[s].v.substr(0,f);f<n[s].v.length;++f)F<y.length&&(N+=y.charAt(F++));n[s].v=N,n[s].t="t",I=s}}}for(s=0;s<n.length;++s)n[s]!=null&&"n?".indexOf(n[s].t)>-1&&(A=a>1&&e<0&&s>0&&n[s-1].v==="-"?-e:e,n[s].v=kr(n[s].t,n[s].v,A),n[s].t="t");var z="";for(s=0;s!==n.length;++s)n[s]!=null&&(z+=n[s].v);return z}var po=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function mo(t,e){if(e==null)return!1;var r=parseFloat(e[2]);switch(e[1]){case"=":if(t==r)return!0;break;case">":if(t>r)return!0;break;case"<":if(t<r)return!0;break;case"<>":if(t!=r)return!0;break;case">=":if(t>=r)return!0;break;case"<=":if(t<=r)return!0;break}return!1}function au(t,e){var r=tu(t),a=r.length,n=r[a-1].indexOf("@");if(a<4&&n>-1&&--a,r.length>4)throw new Error("cannot find right format for |"+r.join("|")+"|");if(typeof e!="number")return[4,r.length===4||n>-1?r[r.length-1]:"@"];switch(r.length){case 1:r=n>-1?["General","General","General",r[0]]:[r[0],r[0],r[0],"@"];break;case 2:r=n>-1?[r[0],r[0],r[0],r[1]]:[r[0],r[1],r[0],"@"];break;case 3:r=n>-1?[r[0],r[1],r[0],r[2]]:[r[0],r[1],r[2],"@"];break}var i=e>0?r[0]:e<0?r[1]:r[2];if(r[0].indexOf("[")===-1&&r[1].indexOf("[")===-1)return[a,i];if(r[0].match(/\[[=<>]/)!=null||r[1].match(/\[[=<>]/)!=null){var s=r[0].match(po),o=r[1].match(po);return mo(e,s)?[a,r[0]]:mo(e,o)?[a,r[1]]:[a,r[s!=null&&o!=null?2:1]]}return[a,i]}function Kt(t,e,r){r==null&&(r={});var a="";switch(typeof t){case"string":t=="m/d/yy"&&r.dateNF?a=r.dateNF:a=t;break;case"number":t==14&&r.dateNF?a=r.dateNF:a=(r.table!=null?r.table:me)[t],a==null&&(a=r.table&&r.table[fo[t]]||me[fo[t]]),a==null&&(a=Vh[t]||"General");break}if(jn(a,0))return na(e,r);e instanceof Date&&(e=M0(e,r.date1904));var n=au(a,e);if(jn(n[1]))return na(e,r);if(e===!0)e="TRUE";else if(e===!1)e="FALSE";else if(e===""||e==null)return"";return ru(n[1],e,r,n[0])}function _r(t,e){if(typeof e!="number"){e=+e||-1;for(var r=0;r<392;++r){if(me[r]==null){e<0&&(e=r);continue}if(me[r]==t){e=r;break}}e<0&&(e=391)}return me[e]=t,e}function si(t){for(var e=0;e!=392;++e)t[e]!==void 0&&_r(t[e],e)}function Na(){me=Bh()}var nu={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},W0=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function iu(t){var e=typeof t=="number"?me[t]:t;return e=e.replace(W0,"(\\d+)"),new RegExp("^"+e+"$")}function su(t,e,r){var a=-1,n=-1,i=-1,s=-1,o=-1,l=-1;(e.match(W0)||[]).forEach(function(h,u){var p=parseInt(r[u+1],10);switch(h.toLowerCase().charAt(0)){case"y":a=p;break;case"d":i=p;break;case"h":s=p;break;case"s":l=p;break;case"m":s>=0?o=p:n=p;break}}),l>=0&&o==-1&&n>=0&&(o=n,n=-1);var c=(""+(a>=0?a:new Date().getFullYear())).slice(-4)+"-"+("00"+(n>=1?n:1)).slice(-2)+"-"+("00"+(i>=1?i:1)).slice(-2);c.length==7&&(c="0"+c),c.length==8&&(c="20"+c);var f=("00"+(s>=0?s:0)).slice(-2)+":"+("00"+(o>=0?o:0)).slice(-2)+":"+("00"+(l>=0?l:0)).slice(-2);return s==-1&&o==-1&&l==-1?c:a==-1&&n==-1&&i==-1?f:c+"T"+f}var ou=function(){var t={};t.version="1.2.0";function e(){for(var y=0,P=new Array(256),I=0;I!=256;++I)y=I,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,P[I]=y;return typeof Int32Array<"u"?new Int32Array(P):P}var r=e();function a(y){var P=0,I=0,z=0,V=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(z=0;z!=256;++z)V[z]=y[z];for(z=0;z!=256;++z)for(I=y[z],P=256+z;P<4096;P+=256)I=V[P]=I>>>8^y[I&255];var R=[];for(z=1;z!=16;++z)R[z-1]=typeof Int32Array<"u"?V.subarray(z*256,z*256+256):V.slice(z*256,z*256+256);return R}var n=a(r),i=n[0],s=n[1],o=n[2],l=n[3],c=n[4],f=n[5],h=n[6],u=n[7],p=n[8],m=n[9],d=n[10],g=n[11],x=n[12],w=n[13],v=n[14];function F(y,P){for(var I=P^-1,z=0,V=y.length;z<V;)I=I>>>8^r[(I^y.charCodeAt(z++))&255];return~I}function N(y,P){for(var I=P^-1,z=y.length-15,V=0;V<z;)I=v[y[V++]^I&255]^w[y[V++]^I>>8&255]^x[y[V++]^I>>16&255]^g[y[V++]^I>>>24]^d[y[V++]]^m[y[V++]]^p[y[V++]]^u[y[V++]]^h[y[V++]]^f[y[V++]]^c[y[V++]]^l[y[V++]]^o[y[V++]]^s[y[V++]]^i[y[V++]]^r[y[V++]];for(z+=15;V<z;)I=I>>>8^r[(I^y[V++])&255];return~I}function A(y,P){for(var I=P^-1,z=0,V=y.length,R=0,J=0;z<V;)R=y.charCodeAt(z++),R<128?I=I>>>8^r[(I^R)&255]:R<2048?(I=I>>>8^r[(I^(192|R>>6&31))&255],I=I>>>8^r[(I^(128|R&63))&255]):R>=55296&&R<57344?(R=(R&1023)+64,J=y.charCodeAt(z++)&1023,I=I>>>8^r[(I^(240|R>>8&7))&255],I=I>>>8^r[(I^(128|R>>2&63))&255],I=I>>>8^r[(I^(128|J>>6&15|(R&3)<<4))&255],I=I>>>8^r[(I^(128|J&63))&255]):(I=I>>>8^r[(I^(224|R>>12&15))&255],I=I>>>8^r[(I^(128|R>>6&63))&255],I=I>>>8^r[(I^(128|R&63))&255]);return~I}return t.table=r,t.bstr=F,t.buf=N,t.str=A,t}(),de=function(){var e={};e.version="1.2.1";function r(E,_){for(var C=E.split("/"),k=_.split("/"),T=0,S=0,U=Math.min(C.length,k.length);T<U;++T){if(S=C[T].length-k[T].length)return S;if(C[T]!=k[T])return C[T]<k[T]?-1:1}return C.length-k.length}function a(E){if(E.charAt(E.length-1)=="/")return E.slice(0,-1).indexOf("/")===-1?E:a(E.slice(0,-1));var _=E.lastIndexOf("/");return _===-1?E:E.slice(0,_+1)}function n(E){if(E.charAt(E.length-1)=="/")return n(E.slice(0,-1));var _=E.lastIndexOf("/");return _===-1?E:E.slice(_+1)}function i(E,_){typeof _=="string"&&(_=new Date(_));var C=_.getHours();C=C<<6|_.getMinutes(),C=C<<5|_.getSeconds()>>>1,E.write_shift(2,C);var k=_.getFullYear()-1980;k=k<<4|_.getMonth()+1,k=k<<5|_.getDate(),E.write_shift(2,k)}function s(E){var _=E.read_shift(2)&65535,C=E.read_shift(2)&65535,k=new Date,T=C&31;C>>>=5;var S=C&15;C>>>=4,k.setMilliseconds(0),k.setFullYear(C+1980),k.setMonth(S-1),k.setDate(T);var U=_&31;_>>>=5;var j=_&63;return _>>>=6,k.setHours(_),k.setMinutes(j),k.setSeconds(U<<1),k}function o(E){dt(E,0);for(var _={},C=0;E.l<=E.length-4;){var k=E.read_shift(2),T=E.read_shift(2),S=E.l+T,U={};switch(k){case 21589:C=E.read_shift(1),C&1&&(U.mtime=E.read_shift(4)),T>5&&(C&2&&(U.atime=E.read_shift(4)),C&4&&(U.ctime=E.read_shift(4))),U.mtime&&(U.mt=new Date(U.mtime*1e3));break}E.l=S,_[k]=U}return _}var l;function c(){return l||(l={})}function f(E,_){if(E[0]==80&&E[1]==75)return Ks(E,_);if((E[0]|32)==109&&(E[1]|32)==105)return Kc(E,_);if(E.length<512)throw new Error("CFB file size "+E.length+" < 512");var C=3,k=512,T=0,S=0,U=0,j=0,B=0,H=[],W=E.slice(0,512);dt(W,0);var Z=h(W);switch(C=Z[0],C){case 3:k=512;break;case 4:k=4096;break;case 0:if(Z[1]==0)return Ks(E,_);default:throw new Error("Major Version: Expected 3 or 4 saw "+C)}k!==512&&(W=E.slice(0,k),dt(W,28));var se=E.slice(0,k);u(W,C);var he=W.read_shift(4,"i");if(C===3&&he!==0)throw new Error("# Directory Sectors: Expected 0 saw "+he);W.l+=4,U=W.read_shift(4,"i"),W.l+=4,W.chk("00100000","Mini Stream Cutoff Size: "),j=W.read_shift(4,"i"),T=W.read_shift(4,"i"),B=W.read_shift(4,"i"),S=W.read_shift(4,"i");for(var ee=-1,fe=0;fe<109&&(ee=W.read_shift(4,"i"),!(ee<0));++fe)H[fe]=ee;var we=p(E,k);g(B,S,we,k,H);var Ge=w(we,U,H,k);Ge[U].name="!Directory",T>0&&j!==J&&(Ge[j].name="!MiniFAT"),Ge[H[0]].name="!FAT",Ge.fat_addrs=H,Ge.ssz=k;var ze={},mt=[],Ra=[],Ba=[];v(U,Ge,we,mt,T,ze,Ra,j),m(Ra,Ba,mt),mt.shift();var Va={FileIndex:Ra,FullPaths:Ba};return _&&_.raw&&(Va.raw={header:se,sectors:we}),Va}function h(E){if(E[E.l]==80&&E[E.l+1]==75)return[0,0];E.chk(le,"Header Signature: "),E.l+=16;var _=E.read_shift(2,"u");return[E.read_shift(2,"u"),_]}function u(E,_){var C=9;switch(E.l+=2,C=E.read_shift(2)){case 9:if(_!=3)throw new Error("Sector Shift: Expected 9 saw "+C);break;case 12:if(_!=4)throw new Error("Sector Shift: Expected 12 saw "+C);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+C)}E.chk("0600","Mini Sector Shift: "),E.chk("000000000000","Reserved: ")}function p(E,_){for(var C=Math.ceil(E.length/_)-1,k=[],T=1;T<C;++T)k[T-1]=E.slice(T*_,(T+1)*_);return k[C-1]=E.slice(C*_),k}function m(E,_,C){for(var k=0,T=0,S=0,U=0,j=0,B=C.length,H=[],W=[];k<B;++k)H[k]=W[k]=k,_[k]=C[k];for(;j<W.length;++j)k=W[j],T=E[k].L,S=E[k].R,U=E[k].C,H[k]===k&&(T!==-1&&H[T]!==T&&(H[k]=H[T]),S!==-1&&H[S]!==S&&(H[k]=H[S])),U!==-1&&(H[U]=k),T!==-1&&k!=H[k]&&(H[T]=H[k],W.lastIndexOf(T)<j&&W.push(T)),S!==-1&&k!=H[k]&&(H[S]=H[k],W.lastIndexOf(S)<j&&W.push(S));for(k=1;k<B;++k)H[k]===k&&(S!==-1&&H[S]!==S?H[k]=H[S]:T!==-1&&H[T]!==T&&(H[k]=H[T]));for(k=1;k<B;++k)if(E[k].type!==0){if(j=k,j!=H[j])do j=H[j],_[k]=_[j]+"/"+_[k];while(j!==0&&H[j]!==-1&&j!=H[j]);H[k]=-1}for(_[0]+="/",k=1;k<B;++k)E[k].type!==2&&(_[k]+="/")}function d(E,_,C){for(var k=E.start,T=E.size,S=[],U=k;C&&T>0&&U>=0;)S.push(_.slice(U*R,U*R+R)),T-=R,U=Xr(C,U*4);return S.length===0?X(0):ft(S).slice(0,E.size)}function g(E,_,C,k,T){var S=J;if(E===J){if(_!==0)throw new Error("DIFAT chain shorter than expected")}else if(E!==-1){var U=C[E],j=(k>>>2)-1;if(!U)return;for(var B=0;B<j&&(S=Xr(U,B*4))!==J;++B)T.push(S);g(Xr(U,k-4),_-1,C,k,T)}}function x(E,_,C,k,T){var S=[],U=[];T||(T=[]);var j=k-1,B=0,H=0;for(B=_;B>=0;){T[B]=!0,S[S.length]=B,U.push(E[B]);var W=C[Math.floor(B*4/k)];if(H=B*4&j,k<4+H)throw new Error("FAT boundary crossed: "+B+" 4 "+k);if(!E[W])break;B=Xr(E[W],H)}return{nodes:S,data:bo([U])}}function w(E,_,C,k){var T=E.length,S=[],U=[],j=[],B=[],H=k-1,W=0,Z=0,se=0,he=0;for(W=0;W<T;++W)if(j=[],se=W+_,se>=T&&(se-=T),!U[se]){B=[];var ee=[];for(Z=se;Z>=0;){ee[Z]=!0,U[Z]=!0,j[j.length]=Z,B.push(E[Z]);var fe=C[Math.floor(Z*4/k)];if(he=Z*4&H,k<4+he)throw new Error("FAT boundary crossed: "+Z+" 4 "+k);if(!E[fe]||(Z=Xr(E[fe],he),ee[Z]))break}S[se]={nodes:j,data:bo([B])}}return S}function v(E,_,C,k,T,S,U,j){for(var B=0,H=k.length?2:0,W=_[E].data,Z=0,se=0,he;Z<W.length;Z+=128){var ee=W.slice(Z,Z+128);dt(ee,64),se=ee.read_shift(2),he=ms(ee,0,se-H),k.push(he);var fe={name:he,type:ee.read_shift(1),color:ee.read_shift(1),L:ee.read_shift(4,"i"),R:ee.read_shift(4,"i"),C:ee.read_shift(4,"i"),clsid:ee.read_shift(16),state:ee.read_shift(4,"i"),start:0,size:0},we=ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2);we!==0&&(fe.ct=F(ee,ee.l-8));var Ge=ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2)+ee.read_shift(2);Ge!==0&&(fe.mt=F(ee,ee.l-8)),fe.start=ee.read_shift(4,"i"),fe.size=ee.read_shift(4,"i"),fe.size<0&&fe.start<0&&(fe.size=fe.type=0,fe.start=J,fe.name=""),fe.type===5?(B=fe.start,T>0&&B!==J&&(_[B].name="!StreamData")):fe.size>=4096?(fe.storage="fat",_[fe.start]===void 0&&(_[fe.start]=x(C,fe.start,_.fat_addrs,_.ssz)),_[fe.start].name=fe.name,fe.content=_[fe.start].data.slice(0,fe.size)):(fe.storage="minifat",fe.size<0?fe.size=0:B!==J&&fe.start!==J&&_[B]&&(fe.content=d(fe,_[B].data,(_[j]||{}).data))),fe.content&&dt(fe.content,0),S[he]=fe,U.push(fe)}}function F(E,_){return new Date((Ot(E,_+4)/1e7*Math.pow(2,32)+Ot(E,_)/1e7-11644473600)*1e3)}function N(E,_){return c(),f(l.readFileSync(E),_)}function A(E,_){var C=_&&_.type;switch(C||_e&&Buffer.isBuffer(E)&&(C="buffer"),C||"base64"){case"file":return N(E,_);case"base64":return f(Dt(Bt(E)),_);case"binary":return f(Dt(E),_)}return f(E,_)}function y(E,_){var C=_||{},k=C.root||"Root Entry";if(E.FullPaths||(E.FullPaths=[]),E.FileIndex||(E.FileIndex=[]),E.FullPaths.length!==E.FileIndex.length)throw new Error("inconsistent CFB structure");E.FullPaths.length===0&&(E.FullPaths[0]=k+"/",E.FileIndex[0]={name:k,type:5}),C.CLSID&&(E.FileIndex[0].clsid=C.CLSID),P(E)}function P(E){var _="Sh33tJ5";if(!de.find(E,"/"+_)){var C=X(4);C[0]=55,C[1]=C[3]=50,C[2]=54,E.FileIndex.push({name:_,type:2,content:C,size:4,L:69,R:69,C:69}),E.FullPaths.push(E.FullPaths[0]+_),I(E)}}function I(E,_){y(E);for(var C=!1,k=!1,T=E.FullPaths.length-1;T>=0;--T){var S=E.FileIndex[T];switch(S.type){case 0:k?C=!0:(E.FileIndex.pop(),E.FullPaths.pop());break;case 1:case 2:case 5:k=!0,isNaN(S.R*S.L*S.C)&&(C=!0),S.R>-1&&S.L>-1&&S.R==S.L&&(C=!0);break;default:C=!0;break}}if(!(!C&&!_)){var U=new Date(1987,1,19),j=0,B=Object.create?Object.create(null):{},H=[];for(T=0;T<E.FullPaths.length;++T)B[E.FullPaths[T]]=!0,E.FileIndex[T].type!==0&&H.push([E.FullPaths[T],E.FileIndex[T]]);for(T=0;T<H.length;++T){var W=a(H[T][0]);k=B[W],k||(H.push([W,{name:n(W).replace("/",""),type:1,clsid:ue,ct:U,mt:U,content:null}]),B[W]=!0)}for(H.sort(function(he,ee){return r(he[0],ee[0])}),E.FullPaths=[],E.FileIndex=[],T=0;T<H.length;++T)E.FullPaths[T]=H[T][0],E.FileIndex[T]=H[T][1];for(T=0;T<H.length;++T){var Z=E.FileIndex[T],se=E.FullPaths[T];if(Z.name=n(se).replace("/",""),Z.L=Z.R=Z.C=-(Z.color=1),Z.size=Z.content?Z.content.length:0,Z.start=0,Z.clsid=Z.clsid||ue,T===0)Z.C=H.length>1?1:-1,Z.size=0,Z.type=5;else if(se.slice(-1)=="/"){for(j=T+1;j<H.length&&a(E.FullPaths[j])!=se;++j);for(Z.C=j>=H.length?-1:j,j=T+1;j<H.length&&a(E.FullPaths[j])!=a(se);++j);Z.R=j>=H.length?-1:j,Z.type=1}else a(E.FullPaths[T+1]||"")==a(se)&&(Z.R=T+1),Z.type=2}}}function z(E,_){var C=_||{};if(C.fileType=="mad")return Yc(E,C);switch(I(E),C.fileType){case"zip":return Wc(E,C)}var k=function(he){for(var ee=0,fe=0,we=0;we<he.FileIndex.length;++we){var Ge=he.FileIndex[we];if(Ge.content){var ze=Ge.content.length;ze>0&&(ze<4096?ee+=ze+63>>6:fe+=ze+511>>9)}}for(var mt=he.FullPaths.length+3>>2,Ra=ee+7>>3,Ba=ee+127>>7,Va=Ra+fe+mt+Ba,$r=Va+127>>7,mi=$r<=109?0:Math.ceil(($r-109)/127);Va+$r+mi+127>>7>$r;)mi=++$r<=109?0:Math.ceil(($r-109)/127);var Er=[1,mi,$r,Ba,mt,fe,ee,0];return he.FileIndex[0].size=ee<<6,Er[7]=(he.FileIndex[0].start=Er[0]+Er[1]+Er[2]+Er[3]+Er[4]+Er[5])+(Er[6]+7>>3),Er}(E),T=X(k[7]<<9),S=0,U=0;{for(S=0;S<8;++S)T.write_shift(1,ie[S]);for(S=0;S<8;++S)T.write_shift(2,0);for(T.write_shift(2,62),T.write_shift(2,3),T.write_shift(2,65534),T.write_shift(2,9),T.write_shift(2,6),S=0;S<3;++S)T.write_shift(2,0);for(T.write_shift(4,0),T.write_shift(4,k[2]),T.write_shift(4,k[0]+k[1]+k[2]+k[3]-1),T.write_shift(4,0),T.write_shift(4,4096),T.write_shift(4,k[3]?k[0]+k[1]+k[2]-1:J),T.write_shift(4,k[3]),T.write_shift(-4,k[1]?k[0]-1:J),T.write_shift(4,k[1]),S=0;S<109;++S)T.write_shift(-4,S<k[2]?k[1]+S:-1)}if(k[1])for(U=0;U<k[1];++U){for(;S<236+U*127;++S)T.write_shift(-4,S<k[2]?k[1]+S:-1);T.write_shift(-4,U===k[1]-1?J:U+1)}var j=function(he){for(U+=he;S<U-1;++S)T.write_shift(-4,S+1);he&&(++S,T.write_shift(-4,J))};for(U=S=0,U+=k[1];S<U;++S)T.write_shift(-4,ce.DIFSECT);for(U+=k[2];S<U;++S)T.write_shift(-4,ce.FATSECT);j(k[3]),j(k[4]);for(var B=0,H=0,W=E.FileIndex[0];B<E.FileIndex.length;++B)W=E.FileIndex[B],W.content&&(H=W.content.length,!(H<4096)&&(W.start=U,j(H+511>>9)));for(j(k[6]+7>>3);T.l&511;)T.write_shift(-4,ce.ENDOFCHAIN);for(U=S=0,B=0;B<E.FileIndex.length;++B)W=E.FileIndex[B],W.content&&(H=W.content.length,!(!H||H>=4096)&&(W.start=U,j(H+63>>6)));for(;T.l&511;)T.write_shift(-4,ce.ENDOFCHAIN);for(S=0;S<k[4]<<2;++S){var Z=E.FullPaths[S];if(!Z||Z.length===0){for(B=0;B<17;++B)T.write_shift(4,0);for(B=0;B<3;++B)T.write_shift(4,-1);for(B=0;B<12;++B)T.write_shift(4,0);continue}W=E.FileIndex[S],S===0&&(W.start=W.size?W.start-1:J);var se=S===0&&C.root||W.name;if(H=2*(se.length+1),T.write_shift(64,se,"utf16le"),T.write_shift(2,H),T.write_shift(1,W.type),T.write_shift(1,W.color),T.write_shift(-4,W.L),T.write_shift(-4,W.R),T.write_shift(-4,W.C),W.clsid)T.write_shift(16,W.clsid,"hex");else for(B=0;B<4;++B)T.write_shift(4,0);T.write_shift(4,W.state||0),T.write_shift(4,0),T.write_shift(4,0),T.write_shift(4,0),T.write_shift(4,0),T.write_shift(4,W.start),T.write_shift(4,W.size),T.write_shift(4,0)}for(S=1;S<E.FileIndex.length;++S)if(W=E.FileIndex[S],W.size>=4096)if(T.l=W.start+1<<9,_e&&Buffer.isBuffer(W.content))W.content.copy(T,T.l,0,W.size),T.l+=W.size+511&-512;else{for(B=0;B<W.size;++B)T.write_shift(1,W.content[B]);for(;B&511;++B)T.write_shift(1,0)}for(S=1;S<E.FileIndex.length;++S)if(W=E.FileIndex[S],W.size>0&&W.size<4096)if(_e&&Buffer.isBuffer(W.content))W.content.copy(T,T.l,0,W.size),T.l+=W.size+63&-64;else{for(B=0;B<W.size;++B)T.write_shift(1,W.content[B]);for(;B&63;++B)T.write_shift(1,0)}if(_e)T.l=T.length;else for(;T.l<T.length;)T.write_shift(1,0);return T}function V(E,_){var C=E.FullPaths.map(function(B){return B.toUpperCase()}),k=C.map(function(B){var H=B.split("/");return H[H.length-(B.slice(-1)=="/"?2:1)]}),T=!1;_.charCodeAt(0)===47?(T=!0,_=C[0].slice(0,-1)+_):T=_.indexOf("/")!==-1;var S=_.toUpperCase(),U=T===!0?C.indexOf(S):k.indexOf(S);if(U!==-1)return E.FileIndex[U];var j=!S.match(Wa);for(S=S.replace(bt,""),j&&(S=S.replace(Wa,"!")),U=0;U<C.length;++U)if((j?C[U].replace(Wa,"!"):C[U]).replace(bt,"")==S||(j?k[U].replace(Wa,"!"):k[U]).replace(bt,"")==S)return E.FileIndex[U];return null}var R=64,J=-2,le="d0cf11e0a1b11ae1",ie=[208,207,17,224,161,177,26,225],ue="00000000000000000000000000000000",ce={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:J,FREESECT:-1,HEADER_SIGNATURE:le,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:ue,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function De(E,_,C){c();var k=z(E,C);l.writeFileSync(_,k)}function G(E){for(var _=new Array(E.length),C=0;C<E.length;++C)_[C]=String.fromCharCode(E[C]);return _.join("")}function pe(E,_){var C=z(E,_);switch(_&&_.type||"buffer"){case"file":return c(),l.writeFileSync(_.filename,C),C;case"binary":return typeof C=="string"?C:G(C);case"base64":return en(typeof C=="string"?C:G(C));case"buffer":if(_e)return Buffer.isBuffer(C)?C:br(C);case"array":return typeof C=="string"?Dt(C):C}return C}var Ee;function L(E){try{var _=E.InflateRaw,C=new _;if(C._processChunk(new Uint8Array([3,0]),C._finishFlushFlag),C.bytesRead)Ee=E;else throw new Error("zlib does not expose bytesRead")}catch(k){console.error("cannot use native zlib: "+(k.message||k))}}function D(E,_){if(!Ee)return Xs(E,_);var C=Ee.InflateRaw,k=new C,T=k._processChunk(E.slice(E.l),k._finishFlushFlag);return E.l+=k.bytesRead,T}function M(E){return Ee?Ee.deflateRawSync(E):Te(E)}var O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],te=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function re(E){var _=(E<<1|E<<11)&139536|(E<<5|E<<15)&558144;return(_>>16|_>>8|_)&255}for(var Q=typeof Uint8Array<"u",q=Q?new Uint8Array(256):[],ke=0;ke<256;++ke)q[ke]=re(ke);function b(E,_){var C=q[E&255];return _<=8?C>>>8-_:(C=C<<8|q[E>>8&255],_<=16?C>>>16-_:(C=C<<8|q[E>>16&255],C>>>24-_))}function Ve(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=6?0:E[k+1]<<8))>>>C&3}function Fe(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=5?0:E[k+1]<<8))>>>C&7}function Be(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=4?0:E[k+1]<<8))>>>C&15}function be(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=3?0:E[k+1]<<8))>>>C&31}function oe(E,_){var C=_&7,k=_>>>3;return(E[k]|(C<=1?0:E[k+1]<<8))>>>C&127}function qe(E,_,C){var k=_&7,T=_>>>3,S=(1<<C)-1,U=E[T]>>>k;return C<8-k||(U|=E[T+1]<<8-k,C<16-k)||(U|=E[T+2]<<16-k,C<24-k)||(U|=E[T+3]<<24-k),U&S}function Vt(E,_,C){var k=_&7,T=_>>>3;return k<=5?E[T]|=(C&7)<<k:(E[T]|=C<<k&255,E[T+1]=(C&7)>>8-k),_+3}function or(E,_,C){var k=_&7,T=_>>>3;return C=(C&1)<<k,E[T]|=C,_+1}function xr(E,_,C){var k=_&7,T=_>>>3;return C<<=k,E[T]|=C&255,C>>>=8,E[T+1]=C,_+8}function Pa(E,_,C){var k=_&7,T=_>>>3;return C<<=k,E[T]|=C&255,C>>>=8,E[T+1]=C&255,E[T+2]=C>>>8,_+16}function Ar(E,_){var C=E.length,k=2*C>_?2*C:_+5,T=0;if(C>=_)return E;if(_e){var S=oo(k);if(E.copy)E.copy(S);else for(;T<E.length;++T)S[T]=E[T];return S}else if(Q){var U=new Uint8Array(k);if(U.set)U.set(E);else for(;T<C;++T)U[T]=E[T];return U}return E.length=k,E}function It(E){for(var _=new Array(E),C=0;C<E;++C)_[C]=0;return _}function vr(E,_,C){var k=1,T=0,S=0,U=0,j=0,B=E.length,H=Q?new Uint16Array(32):It(32);for(S=0;S<32;++S)H[S]=0;for(S=B;S<C;++S)E[S]=0;B=E.length;var W=Q?new Uint16Array(B):It(B);for(S=0;S<B;++S)H[T=E[S]]++,k<T&&(k=T),W[S]=0;for(H[0]=0,S=1;S<=k;++S)H[S+16]=j=j+H[S-1]<<1;for(S=0;S<B;++S)j=E[S],j!=0&&(W[S]=H[j+16]++);var Z=0;for(S=0;S<B;++S)if(Z=E[S],Z!=0)for(j=b(W[S],k)>>k-Z,U=(1<<k+4-Z)-1;U>=0;--U)_[j|U<<Z]=Z&15|S<<4;return k}var Ir=Q?new Uint16Array(512):It(512),Da=Q?new Uint16Array(32):It(32);if(!Q){for(var _t=0;_t<512;++_t)Ir[_t]=0;for(_t=0;_t<32;++_t)Da[_t]=0}(function(){for(var E=[],_=0;_<32;_++)E.push(5);vr(E,Da,32);var C=[];for(_=0;_<=143;_++)C.push(8);for(;_<=255;_++)C.push(9);for(;_<=279;_++)C.push(7);for(;_<=287;_++)C.push(8);vr(C,Ir,288)})();var lr=function(){for(var _=Q?new Uint8Array(32768):[],C=0,k=0;C<te.length-1;++C)for(;k<te[C+1];++k)_[k]=C;for(;k<32768;++k)_[k]=29;var T=Q?new Uint8Array(259):[];for(C=0,k=0;C<K.length-1;++C)for(;k<K[C+1];++k)T[k]=C;function S(j,B){for(var H=0;H<j.length;){var W=Math.min(65535,j.length-H),Z=H+W==j.length;for(B.write_shift(1,+Z),B.write_shift(2,W),B.write_shift(2,~W&65535);W-- >0;)B[B.l++]=j[H++]}return B.l}function U(j,B){for(var H=0,W=0,Z=Q?new Uint16Array(32768):[];W<j.length;){var se=Math.min(65535,j.length-W);if(se<10){for(H=Vt(B,H,+(W+se==j.length)),H&7&&(H+=8-(H&7)),B.l=H/8|0,B.write_shift(2,se),B.write_shift(2,~se&65535);se-- >0;)B[B.l++]=j[W++];H=B.l*8;continue}H=Vt(B,H,+(W+se==j.length)+2);for(var he=0;se-- >0;){var ee=j[W];he=(he<<5^ee)&32767;var fe=-1,we=0;if((fe=Z[he])&&(fe|=W&-32768,fe>W&&(fe-=32768),fe<W))for(;j[fe+we]==j[W+we]&&we<250;)++we;if(we>2){ee=T[we],ee<=22?H=xr(B,H,q[ee+1]>>1)-1:(xr(B,H,3),H+=5,xr(B,H,q[ee-23]>>5),H+=3);var Ge=ee<8?0:ee-4>>2;Ge>0&&(Pa(B,H,we-K[ee]),H+=Ge),ee=_[W-fe],H=xr(B,H,q[ee]>>3),H-=3;var ze=ee<4?0:ee-2>>1;ze>0&&(Pa(B,H,W-fe-te[ee]),H+=ze);for(var mt=0;mt<we;++mt)Z[he]=W&32767,he=(he<<5^j[W])&32767,++W;se-=we-1}else ee<=143?ee=ee+48:H=or(B,H,1),H=xr(B,H,q[ee]),Z[he]=W&32767,++W}H=xr(B,H,0)-1}return B.l=(H+7)/8|0,B.l}return function(B,H){return B.length<8?S(B,H):U(B,H)}}();function Te(E){var _=X(50+Math.floor(E.length*1.1)),C=lr(E,_);return _.slice(0,C)}var Ze=Q?new Uint16Array(32768):It(32768),Ut=Q?new Uint16Array(32768):It(32768),it=Q?new Uint16Array(128):It(128),Wr=1,zs=1;function Vc(E,_){var C=be(E,_)+257;_+=5;var k=be(E,_)+1;_+=5;var T=Be(E,_)+4;_+=4;for(var S=0,U=Q?new Uint8Array(19):It(19),j=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B=1,H=Q?new Uint8Array(8):It(8),W=Q?new Uint8Array(8):It(8),Z=U.length,se=0;se<T;++se)U[O[se]]=S=Fe(E,_),B<S&&(B=S),H[S]++,_+=3;var he=0;for(H[0]=0,se=1;se<=B;++se)W[se]=he=he+H[se-1]<<1;for(se=0;se<Z;++se)(he=U[se])!=0&&(j[se]=W[he]++);var ee=0;for(se=0;se<Z;++se)if(ee=U[se],ee!=0){he=q[j[se]]>>8-ee;for(var fe=(1<<7-ee)-1;fe>=0;--fe)it[he|fe<<ee]=ee&7|se<<3}var we=[];for(B=1;we.length<C+k;)switch(he=it[oe(E,_)],_+=he&7,he>>>=3){case 16:for(S=3+Ve(E,_),_+=2,he=we[we.length-1];S-- >0;)we.push(he);break;case 17:for(S=3+Fe(E,_),_+=3;S-- >0;)we.push(0);break;case 18:for(S=11+oe(E,_),_+=7;S-- >0;)we.push(0);break;default:we.push(he),B<he&&(B=he);break}var Ge=we.slice(0,C),ze=we.slice(C);for(se=C;se<286;++se)Ge[se]=0;for(se=k;se<30;++se)ze[se]=0;return Wr=vr(Ge,Ze,286),zs=vr(ze,Ut,30),_}function Uc(E,_){if(E[0]==3&&!(E[1]&3))return[Pr(_),2];for(var C=0,k=0,T=oo(_||1<<18),S=0,U=T.length>>>0,j=0,B=0;!(k&1);){if(k=Fe(E,C),C+=3,k>>>1)k>>1==1?(j=9,B=5):(C=Vc(E,C),j=Wr,B=zs);else{C&7&&(C+=8-(C&7));var H=E[C>>>3]|E[(C>>>3)+1]<<8;if(C+=32,H>0)for(!_&&U<S+H&&(T=Ar(T,S+H),U=T.length);H-- >0;)T[S++]=E[C>>>3],C+=8;continue}for(;;){!_&&U<S+32767&&(T=Ar(T,S+32767),U=T.length);var W=qe(E,C,j),Z=k>>>1==1?Ir[W]:Ze[W];if(C+=Z&15,Z>>>=4,!(Z>>>8&255))T[S++]=Z;else{if(Z==256)break;Z-=257;var se=Z<8?0:Z-4>>2;se>5&&(se=0);var he=S+K[Z];se>0&&(he+=qe(E,C,se),C+=se),W=qe(E,C,B),Z=k>>>1==1?Da[W]:Ut[W],C+=Z&15,Z>>>=4;var ee=Z<4?0:Z-2>>1,fe=te[Z];for(ee>0&&(fe+=qe(E,C,ee),C+=ee),!_&&U<he&&(T=Ar(T,he+100),U=T.length);S<he;)T[S]=T[S-fe],++S}}}return _?[T,C+7>>>3]:[T.slice(0,S),C+7>>>3]}function Xs(E,_){var C=E.slice(E.l||0),k=Uc(C,_);return E.l+=k[1],k[0]}function js(E,_){if(E)typeof console<"u"&&console.error(_);else throw new Error(_)}function Ks(E,_){var C=E;dt(C,0);var k=[],T=[],S={FileIndex:k,FullPaths:T};y(S,{root:_.root});for(var U=C.length-4;(C[U]!=80||C[U+1]!=75||C[U+2]!=5||C[U+3]!=6)&&U>=0;)--U;C.l=U+4,C.l+=4;var j=C.read_shift(2);C.l+=6;var B=C.read_shift(4);for(C.l=B,U=0;U<j;++U){C.l+=20;var H=C.read_shift(4),W=C.read_shift(4),Z=C.read_shift(2),se=C.read_shift(2),he=C.read_shift(2);C.l+=8;var ee=C.read_shift(4),fe=o(C.slice(C.l+Z,C.l+Z+se));C.l+=Z+se+he;var we=C.l;C.l=ee+4,Hc(C,H,W,S,fe),C.l=we}return S}function Hc(E,_,C,k,T){E.l+=2;var S=E.read_shift(2),U=E.read_shift(2),j=s(E);if(S&8257)throw new Error("Unsupported ZIP encryption");for(var B=E.read_shift(4),H=E.read_shift(4),W=E.read_shift(4),Z=E.read_shift(2),se=E.read_shift(2),he="",ee=0;ee<Z;++ee)he+=String.fromCharCode(E[E.l++]);if(se){var fe=o(E.slice(E.l,E.l+se));(fe[21589]||{}).mt&&(j=fe[21589].mt),((T||{})[21589]||{}).mt&&(j=T[21589].mt)}E.l+=se;var we=E.slice(E.l,E.l+H);switch(U){case 8:we=D(E,W);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+U)}var Ge=!1;S&8&&(B=E.read_shift(4),B==134695760&&(B=E.read_shift(4),Ge=!0),H=E.read_shift(4),W=E.read_shift(4)),H!=_&&js(Ge,"Bad compressed size: "+_+" != "+H),W!=C&&js(Ge,"Bad uncompressed size: "+C+" != "+W),pi(k,he,we,{unsafe:!0,mt:j})}function Wc(E,_){var C=_||{},k=[],T=[],S=X(1),U=C.compression?8:0,j=0,B=0,H=0,W=0,Z=0,se=E.FullPaths[0],he=se,ee=E.FileIndex[0],fe=[],we=0;for(B=1;B<E.FullPaths.length;++B)if(he=E.FullPaths[B].slice(se.length),ee=E.FileIndex[B],!(!ee.size||!ee.content||he=="Sh33tJ5")){var Ge=W,ze=X(he.length);for(H=0;H<he.length;++H)ze.write_shift(1,he.charCodeAt(H)&127);ze=ze.slice(0,ze.l),fe[Z]=ou.buf(ee.content,0);var mt=ee.content;U==8&&(mt=M(mt)),S=X(30),S.write_shift(4,67324752),S.write_shift(2,20),S.write_shift(2,j),S.write_shift(2,U),ee.mt?i(S,ee.mt):S.write_shift(4,0),S.write_shift(-4,fe[Z]),S.write_shift(4,mt.length),S.write_shift(4,ee.content.length),S.write_shift(2,ze.length),S.write_shift(2,0),W+=S.length,k.push(S),W+=ze.length,k.push(ze),W+=mt.length,k.push(mt),S=X(46),S.write_shift(4,33639248),S.write_shift(2,0),S.write_shift(2,20),S.write_shift(2,j),S.write_shift(2,U),S.write_shift(4,0),S.write_shift(-4,fe[Z]),S.write_shift(4,mt.length),S.write_shift(4,ee.content.length),S.write_shift(2,ze.length),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(4,0),S.write_shift(4,Ge),we+=S.l,T.push(S),we+=ze.length,T.push(ze),++Z}return S=X(22),S.write_shift(4,101010256),S.write_shift(2,0),S.write_shift(2,0),S.write_shift(2,Z),S.write_shift(2,Z),S.write_shift(4,we),S.write_shift(4,W),S.write_shift(2,0),ft([ft(k),ft(T),S])}var yn={htm:"text/html",xml:"text/xml",gif:"image/gif",jpg:"image/jpeg",png:"image/png",mso:"application/x-mso",thmx:"application/vnd.ms-officetheme",sh33tj5:"application/octet-stream"};function $c(E,_){if(E.ctype)return E.ctype;var C=E.name||"",k=C.match(/\.([^\.]+)$/);return k&&yn[k[1]]||_&&(k=(C=_).match(/[\.\\]([^\.\\])+$/),k&&yn[k[1]])?yn[k[1]]:"application/octet-stream"}function Gc(E){for(var _=en(E),C=[],k=0;k<_.length;k+=76)C.push(_.slice(k,k+76));return C.join(`\r
|
|
318
318
|
`)+`\r
|
|
319
319
|
`}function zc(E){var _=E.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(H){var W=H.charCodeAt(0).toString(16).toUpperCase();return"="+(W.length==1?"0"+W:W)});_=_.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),_.charAt(0)==`
|
|
320
320
|
`&&(_="=0D"+_.slice(1)),_=_.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
|