import{c as F,a as c,d as R,f as _,e as W,s as E}from"./DktbhmWA.js";import{f as L,p as C,o as D,a as G,c as k,g as l,d as N,r as x,b as f,s as z,t as y}from"./CPWcrcMP.js";import{i as P}from"./0jvM7PZf.js";import{I as H,h as J,c as K,r as O,a as I,j as Q,k as U,m as X}from"./CNDZS43m.js";import{b as Y}from"./CX78IQmC.js";import{l as Z,s as tt,p as V}from"./DBypTyp2.js";import"./CvCfPjaJ.js";function et(s,a){const m=Z(a,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const u=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];H(s,tt({name:"pencil"},()=>m,{get iconNode(){return u},children:(g,v)=>{var p=F(),o=L(p);J(o,a,"default",{}),c(g,p)},$$slots:{default:!0}}))}var at=(s,a)=>f(a,s.target.value,!0),rt=(s,a)=>s.key==="Enter"&&a(),st=_("<span> </span>"),ot=_("<input/> <!>",1),nt=_("<span> </span>"),it=_('<button type="button"> <!> <!></button>'),lt=_('<div class="relative group editable-container"><!></div>');function mt(s,a){C(a,!0);let m=V(a,"topic",3,"App/Name"),u=V(a,"unit",3,""),g=V(a,"font",3,"text-2xl lg:text-xl"),v=new K(m()),p=N(!1),o=N(""),h=N(null),w=!1;D(()=>{window.addEventListener("virtual-keypress",()=>{w=!0,setTimeout(()=>w=!1,200)})});function M(){f(p,!0),f(o,v.value,!0),setTimeout(()=>{var t;(t=l(h))==null||t.focus()},0)}function B(){var r;f(p,!1);const t=l(o).trim();t!==v.value&&(v.value=t,X.publish(m(),t)),(r=l(h))==null||r.blur()}var $=lt(),S=k($);{var j=t=>{var r=ot(),e=L(r);O(e),e.__input=[at,o],e.__keydown=[rt,B],Y(e,n=>f(h,n),()=>l(h));var b=z(e,2);{var T=n=>{var i=st(),d=k(i,!0);x(i),y(()=>E(d,u())),c(n,i)};P(b,n=>{u().length>0&&n(T)})}y(()=>{I(e,1,`input ${g()??""} font-bold tracking-tighter`),Q(e,`max-width: ${l(o).length*12+50}px;`),U(e,l(o))}),W("blur",e,()=>{w||B()}),c(t,r)},q=t=>{var r=it();r.__click=M;var e=k(r),b=z(e);{var T=i=>{var d=nt(),A=k(d,!0);x(d),y(()=>E(A,u())),c(i,d)};P(b,i=>{u().length>0&&i(T)})}var n=z(b,2);et(n,{class:"inline-block opacity-0 group-hover:opacity-100 transition-opacity",strokeWidth:"1",size:"16"}),x(r),y(()=>{I(r,1,`${g()??""} font-bold tracking-tighter cursor-pointer focus:outline-none`),E(e,`${v.value??""} `)}),c(t,r)};P(S,t=>{l(p)?t(j):t(q,!1)})}x($),c(s,$),G()}R(["input","keydown","click"]);export{et as P,mt as T};
