1import{b as ct,d as pt,j as xt,p as gt,v as Ct,w as ft}from"./chunk-YU42GV4L.js";import"./chunk-BJ57MII2.js";import{a as lt}from"./chunk-C3X3CA7X.js";import"./chunk-SWWRRX4E.js";import{B as st,s as dt}from"./chunk-5ENJ4FEZ.js";import"./chunk-EU4I4SIR.js";import"./chunk-QSZ5WMPH.js";import{c as _t}from"./chunk-27MGQOBK.js";import{c as ut}from"./chunk-SOZ7EWTF.js";import{c as mt}from"./chunk-HPFLNKNH.js";import"./chunk-6RQO4IFH.js";import"./chunk-KFJKK367.js";import"./chunk-WIC7UYUY.js";import"./chunk-XKMNP3QQ.js";import"./chunk-SBVZ5TC5.js";import"./chunk-C332HE7F.js";import{i as rt,k as at}from"./chunk-BUPSVSKU.js";import"./chunk-ERT55GZD.js";import"./chunk-JSEE3QHX.js";import{Ca as A,Dc as it,Fc as ot,Gb as tt,Ha as Q,Oa as G,P as q,Pa as y,Qa as b,Ra as W,Sa as z,T as F,Ta as $,Ua as M,Ub as w,Va as h,Vb as et,Wa as s,Xa as d,Xb as nt,Y as g,Ya as H,Yb as O,Z as C,ab as X,bb as Y,db as v,fa as T,fb as f,hb as l,pb as L,qb as Z,rb as N,sa as r,ub as c,vb as m,wb as E,xb as U}from"./chunk-FRXGJQCG.js";import{a as S,b as I}from"./chunk-HZ6M6AS2.js";var D=class extends Error{constructor(e){super(e),this.name="EditError"}};function yt(i,e){let t=i.nodes.find(n=>n.slot===e);if(!t)throw new D(`no node with slot "${e}"`);return t}function P(i,e,t){return yt(i,e),I(S({},i),{nodes:i.nodes.map(n=>n.slot===e?t(n):n)})}function bt(i,e,t){let n=t.trim();return P(i,e,o=>{let a=S({},o.attrs??{});n?a["aria-label"]=n:delete a["aria-label"];let p=S({},o);return Object.keys(a).length?p.attrs=a:delete p.attrs,p})}function vt(i,e,t){let n=t.trim().toLowerCase();if(!/^[a-z][a-z0-9-]*$/.test(n))throw new D(`"${t}" is not a valid tag name`);return P(i,e,o=>I(S({},o),{tag:n}))}function ht(i,e,t){yt(i,e);let n=t.trim();if(!n)throw new D("a slot cannot be empty");if(n===e)return i;if(i.nodes.some(o=>o.slot===n))throw new D(`slot "${n}" is already taken`);return I(S({},i),{nodes:i.nodes.map(o=>I(S({},o),{slot:o.slot===e?n:o.slot,parent:o.parent===e?n:o.parent}))})}function j(i,e,t,n){let o=t.trim().toLowerCase();if(!/^[a-z-][a-z0-9-]*$/.test(o))throw new D(`"${t}" is not a valid CSS property`);return P(i,e,a=>{let p=S({},a.styles??{});n.trim()?p[o]=n.trim():delete p[o];let _=S({},a);return Object.keys(p).length?_.styles=p:delete _.styles,_})}function St(i,e,t,n){let o=n.trim().toLowerCase();if(!/^[a-z-][a-z0-9-]*$/.test(o))throw new D(`"${n}" is not a valid CSS property`);return o===t?i:P(i,e,a=>{let p=a.styles??{};if(o in p)throw new D(`"${o}" is already set on this node`);let _={};for(let[x,u]of Object.entries(p))x===t?_[o]=u:_[x]=u;return I(S({},a),{styles:_})})}function wt(i,e,t){return P(i,e,n=>{let o=S({},n);return t?o.content=t:delete o.content,o})}function J(i,e){return JSON.stringify(i)!==JSON.stringify(e)}var Tt=50,B=class{entries=new Map;entryFor(e){let t=this.entries.get(e);return t||(t={past:[],future:[]},this.entries.set(e,t)),t}record(e,t){let n=this.entryFor(e);n.past.push(t),n.past.length>Tt&&n.past.shift(),n.future=[]}canUndo(e){return(this.entries.get(e)?.past.length??0)>0}canRedo(e){return(this.entries.get(e)?.future.length??0)>0}undo(e,t){let n=this.entryFor(e),o=n.past.pop();return o?(n.future.push(t),o):null}redo(e,t){let n=this.entryFor(e),o=n.future.pop();return o?(n.past.push(t),o):null}clear(e){this.entries.delete(e)}};var K=[pt,_t,ut,mt],R=class i{selectedKey=T(null);selectedSlotState=T(null);query=T("");category=T(null);searchQuery=this.query.asReadonly();activeCategory=this.category.asReadonly();drafts=T(new Map);history=new B;base=w(()=>K.flatMap(e=>e.definitions.map(t=>this.build(t))));all=w(()=>{let e=this.drafts();return e.size?this.base().map(t=>{let n=e.get(t.definition.key);return n?this.build(n):t}):this.base()});dirtyKeys=w(()=>[...this.drafts().keys()]);categories=ct.map(e=>({id:e.id,name:e.name}));totals=w(()=>{let e=this.all();return{components:e.length,nodes:e.reduce((t,n)=>t+n.nodes.length,0),clean:e.filter(t=>t.violations.length===0).length,errors:e.reduce((t,n)=>t+n.errors,0),warnings:e.reduce((t,n)=>t+n.warnings,0)}});visible=w(()=>{let e=this.query().trim().toLowerCase(),t=this.category();return this.all().filter(n=>t&&n.definition.category!==t?!1:e?n.definition.name.toLowerCase().includes(e)||n.definition.key.toLowerCase().includes(e):!0)});selected=w(()=>{let e=this.selectedKey(),t=this.visible();return t.find(n=>n.definition.key===e)??t[0]??null});select(e){this.selectedKey.set(e),this.selectedSlotState.set(null)}selectSlot(e){this.selectedSlotState.set(e)}edit(e){let t=this.selected();if(!t)return null;try{let n=t.definition,o=e(n);return J(n,o)&&(this.history.record(n.key,n),this.apply(o)),null}catch(n){return n.message}}canUndo=w(()=>{let e=this.selected()?.definition.key;return this.drafts(),e?this.history.canUndo(e):!1});canRedo=w(()=>{let e=this.selected()?.definition.key;return this.drafts(),e?this.history.canRedo(e):!1});undo(){let e=this.selected();if(!e)return;let t=this.history.undo(e.definition.key,e.definition);t&&this.apply(t)}redo(){let e=this.selected();if(!e)return;let t=this.history.redo(e.definition.key,e.definition);t&&this.apply(t)}revert(e){this.history.clear(e),this.drafts.update(t=>{let n=new Map(t);return n.delete(e),n})}apply(e){this.drafts.update(t=>{let n=new Map(t);return J(this.shipped(e.key),e)?n.set(e.key,e):n.delete(e.key),n})}isDirty(e){return this.drafts().has(e)}shipped(e){return this.base().find(t=>t.definition.key===e).definition}setQuery(e){this.query.set(e)}setCategory(e){this.category.set(e)}selectedNode=w(()=>{let e=this.selectedSlotState();return e?this.selected()?.nodes.find(t=>t.slot===e)??null:null});serialize(e){return JSON.stringify(e.definition,null,2)}dirtyCategories=w(()=>{let e=this.drafts();return K.filter(n=>n.definitions.some(o=>e.has(o.key))).map(n=>n.category)});exportManifest(e){let t=K.find(a=>a.category===e);if(!t)throw new Error(`no manifest for category "${e}"`);let n=this.drafts(),o=I(S({},t),{definitions:t.definitions.map(a=>
1n.get(a.key)??a)});return{filename:`${e}.json`,contents:`${JSON.stringify(o,null,2)} 2`}}changeSummary(){let e=this.drafts();return e.size?[...e.values()].map(t=>{let n=this.shipped(t.key),o=this.describeChanges(n,t);return`- ${t.key}: ${o.join("; ")}`}).join(` 3`):""}describeChanges(e,t){let n=[],o=new Map(e.nodes.map(x=>[x.slot,x])),a=new Set(t.nodes.map(x=>x.slot)),p=e.nodes.filter(x=>!a.has(x.slot)).map(x=>x.slot),_=t.nodes.filter(x=>!o.has(x.slot)).map(x=>x.slot);p.forEach((x,u)=>{n.push(_[u]?`renamed ${x} \u2192 ${_[u]}`:`removed ${x}`)});for(let x of t.nodes){let u=o.get(x.slot);if(!u)continue;u.tag!==x.tag&&n.push(`${x.slot}: <${u.tag}> \u2192 <${x.tag}>`);let k=u.attrs?.["aria-label"]??"",V=x.attrs?.["aria-label"]??"";k!==V&&n.push(`${x.slot}: named "${V||"(none)"}"`)}return n.length?n:["edited"]}build(e){let t=st(e),n=xt(t),o=new Map(e.nodes.map(u=>[u.slot,u])),a=u=>{let k=0,V=o.get(u)?.parent??null;for(;V!=null&&k<32;)k++,V=o.get(V)?.parent??null;return k},p=new Map;for(let u of n){let k=p.get(u.elementId);k?k.push(u):p.set(u.elementId,[u])}let _=new Map(t.elements.map(u=>[u.id,u])),x=e.nodes.map(u=>{let k=dt(e.key,u.slot);return{slot:u.slot,tag:u.tag,depth:a(u.slot),label:_.has(k)?p.get(k)?.[0]?.label??this.displayName(u):this.displayName(u),rawLabel:u.attrs?.["aria-label"]?.trim()??"",content:u.content??"",styles:Object.entries(u.styles??{}).map(([V,Et])=>({property:V,value:Et})),violations:p.get(k)??[]}});return{definition:e,template:t,nodes:x,violations:n,errors:n.filter(u=>u.severity==="error").length,warnings:n.filter(u=>u.severity==="warning").length}}displayName(e){let t=e.attrs?.["aria-label"]?.trim();return t||(e.content??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()||e.tag.toLowerCase()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=q({token:i,factory:i.\u0275fac})};var Vt=(i,e)=>e.id,It=(i,e)=>e.definition.key,$t=(i,e)=>e.slot,Mt=(i,e)=>e.property;function Nt(i,e){if(i&1&&(s(0,"div",3),c(1),d()),i&2){let t=l().$implicit;r(),E(" ",t("studio.ui.notEnabled")," ")}}function Ft(i,e){if(i&1){let t=v();s(0,"button",25),f("click",function(){g(t);let o=l(3);return C(o.exit.emit())}),c(1," \u2190 Back to project "),d()}}function Lt(i,e){if(i&1&&(c(0," \xB7 "),s(1,"span",27),c(2),d()),i&2){let t=l();r(2),E("",t.errors," errors")}}function Pt(i,e){if(i&1&&(c(0," \xB7 "),s(1,"span",28),c(2),d()),i&2){let t=l();r(2),E("",t.warnings," warnings")}}function jt(i,e){if(i&1&&(s(0,"p",8),c(1),s(2,"span",26),c(3),d(),y(4,Lt,3,1),y(5,Pt,3,1),d()),i&2){let t=e;r(),U(" ",t.components," components \xB7 ",t.nodes," nodes \xB7 "),r(2),E("",t.clean," clean"),r(),b(t.errors?4:-1),r(),b(t.warnings?5:-1)}}function Rt(i,e){if(i&1){let t=v();s(0,"button",31),f("click",function(){let o=g(t).$implicit,a=l(4);return C(a.download(o))}),c(1),d()}if(i&2){let t=e.$implicit;r(),E(" Export ",t,".json ")}}function Ot(i,e){if(i&1){let t=v();s(0,"div",9)(1,"span",29),c(2),d(),$(3,Rt,2,1,"button",30,z),s(5,"button",25),f("click",function(){g(t);let o=l(3);return C(o.copySummary())}),c(6),d()()}if(i&2){let t=l(2).$implicit,n=l();r(2),E(" ",e," edited "),r(),M(n.studio.dirtyCategories()),r(3),E(" ",n.summaryCopied()?t("common.states.copied"):t("studio.ui.copySummary")," ")}}function Bt(i,e){if(i&1&&(s(0,"p",10),c(1),d()),i&2){let t=l(2).$implicit;r(),E(" ",t("studio.ui.tabOnlyNote")," ")}}function zt(i,e){if(i&1){let t=v();s(0,"button",16),f("click",function(){let o=g(t).$implicit,a=l(3);return C(a.studio.setCategory(o.id))}),c(1),d()}if(i&2){let t=e.$implicit,n=l(3);N("bg-blue-600",n.studio.activeCategory()===t.id)("text-white",n.studio.activeCategory()===t.id)("text-gray-600",n.studio.activeCategory()!==t.id)("dark:text-gray-300",n.studio.activeCategory()!==t.id),r(),m(t.name)}}function Ht(i,e){if(i&1&&(s(0,"span",34),c(1),d()),i&2){let t=l().$implicit;r(),m(t.errors)}}function Ut(i,e){if(i&1&&(s(0,"span",35),c(1),d()),i&2){let t=l().$implicit;r(),m(t.warnings)}}function Jt(i,e){if(i&1){let t=v();s(0,"li")(1,"button",32),f("click",function(){let o=g(t).$implicit,a=l(3);return C(a.studio.select(o.definition.key))}),s(2,"span",33),c(3),d(),y(4,Ht,2,1,"span",34),y(5,Ut,2,1,"span",35),d()()}if(i&2){let t=e.$implicit,n=l(3);r(),N("bg-gray-200",n.isSelected(t))("dark:bg-gray-700",n.isSelected(t)),r(2),E(" ",t.definition.name," "),r(),b(t.errors?4:-1),r(),b(t.warnings?5:-1)}}function Kt(i,e){if(i&1&&(s(0,"li",19),c(1),d()),i&2){let t=l(2).$implicit;r(),m(t("studio.noMatches"))}}function qt(i,e){if(i&1){let t=v();s(0,"span",43),c(1," unsaved "),d(),s(2,"button",44),f("click",function(){g(t);let o=l(),a=l(3);return C(a.studio.revert(o.definition.key))}),c(3),d()}if(i&2){let t=l(3).$implicit;r(3),m(t("studio.revert"))}}function At(i,e){if(i&1){let t=v();s(0,"div",36)(1,"h2",7),c(2),d(),s(3,"div",37)(4,"p",38),c(5),d(),y(6,qt,4,1),s(7,"button",39),f("click",function(){g(t);let o=l(3);return C(o.studio.undo())}),c(8),d(),s(9,"button",39),f("click",function(){g(t);let o=l(3);return C(o.studio.redo())}),c(10),d()()(),s(11,"div",40)(12,"div",41),H(13,"app-component-template-preview",42),d()()}if(i&2){let t=e,n=l(2).$implicit,o=l();r(2),m(t.definition.name),r(3),U(" ",t.definition.key,"@",t.definition.version," "),r(),b(o.studio.isDirty(t.definition.key)?6:-1),r(),h("disabled",!o.studio.canUndo()),r(),m(n("studio.undo")),r(),h("disabled",!o.studio.canRedo()),r(),m(n("studio.redo")),r(3),h("template",t.template)}}function Qt(i,e){if(i&1&&(s(0,"div",21),c(1),d()),i&2){let t=l(2).$implicit;r(),m(t("studio.selectComponent"))}}function Gt(i,e){if(i&1){let t=v();s(0,"button",45),f("click",function(){let o=g(t).$implicit,a=l(3);return C(a.panel.set(o))}),c(1),d()}if(i&2){let t=e.$implicit,n=l(3);N("font-semibold",n.panel()===t)("text-gray-900",n.panel()===t)("dark:text-white",n.panel()===t)("text-gray-500",n.panel()!==t),r(),m(t)}}function Wt(i,e){if(i&1&&(s(0,"p",48),c(1),d()),i&2){let t=l(4).$implicit;r(),E(" ",t("studio.ui.pickNode")," ")}}function Xt(i,e){if(i&1){let t=v();s(0,"button",55),f("click",function(){let o=g(t).$implicit,a=l(5);return C(a.studio.selectSlot(o.slot))}),s(1,"span",56),c(2),d(),s(3,"span",57),c(4),d()()}if(i&2){let t=e.$implicit,n=l(5);Z("padding-left",4+t.depth*14,"px"),N("bg-red-50",t.violations.length>0)("dark:bg-red-900/20",t.violations.length>0)("ring-1",n.isNodeSelected(t.slot))("ring-blue-500",n.isNodeSelected(t.slot)),h("title",t.violations.length?t.violations[0].message:t.slot),r(2),m(t.label),r(2),m(t.tag)}}function Yt(i,e){if(i&1){let t=v();s(0,"label",67)(1,"span",60),c(2),d(),s(3,"input",76),f("input",function(o){g(t);let a=l(),p=l(5);return C(p.onContent(a.slot,o))}),d()()}if(i&2){let t=l(),n=l(4).$implicit;r(2),m(n("studio.text")),r(),h("value",t.content)}}function Zt(i,e){if(i&1){let t=v();s(0,"div",78)(1,"app-color-control",81),f("valueChange",function(o){g(t);let a=l().$implicit,p=l(),_=l(5);return C(_.setStyleValue(p.slot,a.property,o.value))}),d()()}if(i&2){let t=l().$implicit;r(),h("value",t.value)("showActionButtons",!1)("canHideColor",!1)("canClearColor",!1)}}function te(i,e){if(i&1){let t=v();
3s(0,"div",78)(1,"app-box-shadow-control",82),f("valueChange",function(o){g(t);let a=l().$implicit,p=l(),_=l(5);return C(_.setStyleValue(p.slot,a.property,o))}),d()()}if(i&2){let t=l().$implicit;r(),h("value",t.value)("hideSpread",t.property==="text-shadow")}}function ee(i,e){if(i&1){let t=v();s(0,"input",83),f("input",function(o){g(t);let a=l().$implicit,p=l(),_=l(5);return C(_.onStyleValue(p.slot,a.property,o))}),d()}if(i&2){let t=l().$implicit;h("value",t.value)}}function ne(i,e){if(i&1){let t=v();s(0,"div",69)(1,"input",77),f("change",function(o){let a=g(t).$implicit,p=l(),_=l(5);return C(_.onStyleProperty(p.slot,a.property,o))}),d(),y(2,Zt,2,4,"div",78)(3,te,2,2,"div",78)(4,ee,1,1,"input",79),s(5,"button",80),f("click",function(){let o=g(t).$implicit,a=l(),p=l(5);return C(p.removeStyle(a.slot,o.property))}),c(6,"\xD7"),d()()}if(i&2){let t,n=e.$implicit,o=l(6);r(),h("value",n.property),r(),b((t=o.controlFor(n.property))==="color"?2:t==="shadow"?3:4),r(3),G("aria-label","Remove "+n.property)}}function ie(i,e){if(i&1&&(s(0,"p",70),c(1),d()),i&2){let t=l(5).$implicit;r(),m(t("studio.noStyles"))}}function oe(i,e){i&1&&(s(0,"p",75),c(1),d()),i&2&&(r(),m(e))}function re(i,e){if(i&1){let t=v();s(0,"div",50)(1,"h3",58),c(2),d(),s(3,"label",59)(4,"span",60),c(5),d(),s(6,"input",61),f("input",function(o){let a=g(t),p=l(5);return C(p.onLabel(a.slot,o))}),d(),s(7,"span",62),c(8),d()(),s(9,"div",63)(10,"label",64)(11,"span",60),c(12),d(),s(13,"input",65),f("change",function(o){let a=g(t),p=l(5);return C(p.onSlot(a.slot,o))}),d()(),s(14,"label",66)(15,"span",60),c(16),d(),s(17,"input",65),f("change",function(o){let a=g(t),p=l(5);return C(p.onTag(a.slot,o))}),d()()(),y(18,Yt,4,2,"label",67),s(19,"h3",68),c(20),d(),$(21,ne,7,3,"div",69,Mt,!1,ie,2,1,"p",70),s(24,"div",71),H(25,"input",72,0),s(27,"input",73,1),f("keydown.enter",function(){let o=g(t),a=L(26),p=L(28),_=l(5);return C(_.addStyle(o.slot,a,p))}),d(),s(29,"button",74),f("click",function(){let o=g(t),a=L(26),p=L(28),_=l(5);return C(_.addStyle(o.slot,a,p))}),c(30),d()(),y(31,oe,2,1,"p",75),d()}if(i&2){let t,n=e,o=l(4).$implicit,a=l();r(2),m(o("studio.slot")),r(3),m(o("studio.name")),r(),h("value",n.rawLabel)("placeholder",n.label),r(2),m(o("studio.nameHint")),r(4),m(o("studio.slotId")),r(),h("value",n.slot),r(3),m(o("studio.tag")),r(),h("value",n.tag),r(),b(n.content?18:-1),r(2),m(o("studio.styles")),r(),M(n.styles),r(4),h("placeholder",o("studio.propertyPlaceholder")),r(2),h("placeholder",o("studio.valuePlaceholder")),r(3),m(o("studio.add")),r(),b((t=a.editError())?31:-1,t)}}function ae(i,e){if(i&1&&(s(0,"div",53)(1,"span",84),c(2),d(),s(3,"span",85),c(4),d(),s(5,"p",85),c(6),d()()),i&2){let t=e.$implicit;r(),N("text-red-600",t.severity==="error")("dark:text-red-400",t.severity==="error")("text-amber-600",t.severity!=="error")("dark:text-amber-400",t.severity!=="error"),r(),m(t.rule),r(2),E(" \u2014 ",t.label),r(2),m(t.message)}}function le(i,e){if(i&1&&(s(0,"p",54),c(1),d()),i&2){let t=l(4).$implicit;r(),m(t("studio.meetsContract"))}}function de(i,e){if(i&1&&(s(0,"div",47),y(1,Wt,2,1,"p",48),$(2,Xt,5,13,"button",49,$t),d(),y(4,re,32,16,"div",50),s(5,"div",51)(6,"h3",52),c(7),d(),$(8,ae,7,11,"div",53,W,!1,le,2,1,"p",54),d()),i&2){let t,n=l(),o=l(2).$implicit,a=l();r(),b(a.studio.selectedNode()?-1:1),r(),M(n.nodes),r(2),b((t=a.studio.selectedNode())?4:-1,t),r(3),m(o("studio.atomicContract")),r(),M(n.violations)}}function se(i,e){if(i&1&&(s(0,"pre",46),c(1),d()),i&2){let t=l(4);r(),m(t.json())}}function ce(i,e){if(i&1&&y(0,de,11,4)(1,se,2,1,"pre",46),i&2){let t=l(3);b(t.panel()==="structure"?0:1)}}function pe(i,e){if(i&1){let t=v();s(0,"div",4)(1,"header",5),y(2,Ft,2,0,"button",6),s(3,"h1",7),c(4),d(),y(5,jt,6,5,"p",8),y(6,Ot,7,2,"div",9),d(),y(7,Bt,2,1,"p",10),s(8,"div",11)(9,"aside",12)(10,"div",13)(11,"input",14),f("input",function(o){g(t);let a=l(2);return C(a.onSearch(o))}),d(),s(12,"div",15)(13,"button",16),f("click",function(){g(t);let o=l(2);return C(o.studio.setCategory(null))}),c(14),d(),$(15,zt,2,9,"button",17,Vt),d()(),s(17,"ul",18),$(18,Jt,6,7,"li",null,It,!1,Kt,2,1,"li",19),d()(),s(21,"main",20),y(22,At,14,9)(23,Qt,2,1,"div",21),d(),s(24,"aside",22)(25,"div",23),$(26,Gt,2,9,"button",24,z),d(),y(28,ce,2,1),d()()()}if(i&2){let t,n,o,a,p=l().$implicit,_=l();r(2),b(_.embedded()?2:-1),r(2),m(p("studio.title")),r(),b((t=_.studio.totals())?5:-1,t),r(),b((n=_.studio.dirtyKeys().length)?6:-1,n),r(),b(_.studio.dirtyKeys().length?7:-1),r(4),h("placeholder",p("studio.searchPlaceholder"))("value",_.studio.searchQuery()),r(2),N("bg-blue-600",_.studio.activeCategory()===null)("text-white",_.studio.activeCategory()===null)("text-gray-600",_.studio.activeCategory()!==null)("dark:text-gray-300",_.studio.activeCategory()!==null),r(),m(p("studio.all")),r(),M(_.studio.categories),r(3),M(_.studio.visible()),r(4),b((o=_.selected())?22:23,o),r(4),M(_.panels),r(2),b((a=_.selected())?28:-1,a)}}function _e(i,e){if(i&1&&(X(0),y(1,Nt,2,1,"div",3)(2,pe,29,19,"div",4),Y()),i&2){let t=l();r(),b(t.enabled()?2:1)}}var ue=new Set(["color","background-color","background","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color","outline-color","fill","stroke","caret-color","text-decoration-color"]),kt=class i{studio=F(R);featureFlags=F(lt);router=F(ot);route=F(it);embedded=O(!1);category=O(null);component=O(null);exit=nt();enabled=this.featureFlags.enabled("component-studio");panels=["structure","json"];panel=T("structure");editError=T(null);summaryCopied=T(!1);selected=this.studio.selected;json=w(()=>{let e=this.selected();return e?this.studio.serialize(e):""});constructor(){et(()=>{!this.embedded()&&this.featureFlags.isLoaded()&&!this.enabled()&&this.router.navigate(["/dashboard"])});
3let e=this.route.snapshot.queryParamMap,t=this.category()??e.get("category"),n=this.component()??e.get("component");t&&this.studio.setCategory(t),n&&this.studio.select(n)}isSelected(e){return this.selected()?.definition.key===e.definition.key}isNodeSelected(e){return this.studio.selectedNode()?.slot===e}onSearch(e){this.studio.setQuery(e.target.value)}onLabel(e,t){let n=t.target.value;this.editError.set(this.studio.edit(o=>bt(o,e,n)))}onSlot(e,t){let n=t.target,o=this.studio.edit(a=>ht(a,e,n.value));this.editError.set(o),o?n.value=e:this.studio.selectSlot(n.value.trim())}onContent(e,t){let n=t.target.value;this.editError.set(this.studio.edit(o=>wt(o,e,n)))}onStyleValue(e,t,n){let o=n.target.value;this.editError.set(this.studio.edit(a=>j(a,e,t,o)))}onStyleProperty(e,t,n){let o=n.target,a=this.studio.edit(p=>St(p,e,t,o.value));this.editError.set(a),a&&(o.value=t)}controlFor(e){return ue.has(e)?"color":e==="box-shadow"||e==="text-shadow"?"shadow":"text"}setStyleValue(e,t,n){this.editError.set(this.studio.edit(o=>j(o,e,t,n)))}removeStyle(e,t){this.editError.set(this.studio.edit(n=>j(n,e,t,"")))}addStyle(e,t,n){if(!t.value.trim())return;let o=this.studio.edit(a=>j(a,e,t.value,n.value));this.editError.set(o),!o&&(t.value="",n.value="")}download(e){let{filename:t,contents:n}=this.studio.exportManifest(e),o=URL.createObjectURL(new Blob([n],{type:"application/json"})),a=document.createElement("a");a.href=o,a.download=t,a.click(),URL.revokeObjectURL(o)}async copySummary(){await navigator.clipboard.writeText(this.studio.changeSummary()),this.summaryCopied.set(!0),setTimeout(()=>this.summaryCopied.set(!1),2e3)}onTag(e,t){let n=t.target,o=this.studio.edit(a=>vt(a,e,n.value));this.editError.set(o),o&&(n.value=this.studio.selectedNode()?.tag??n.value)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=A({type:i,selectors:[["app-component-studio"]],inputs:{embedded:[1,"embedded"],category:[1,"category"],component:[1,"component"]},outputs:{exit:"exit"},features:[tt([R,at("studio")])],decls:1,vars:0,consts:[["newProperty",""],["newValue",""],[4,"transloco"],[1,"grid","h-full","place-items-center","text-sm","text-gray-500","dark:text-gray-400"],[1,"flex","h-full","flex-col","bg-gray-50","dark:bg-gray-900"],[1,"flex","items-center","gap-4","border-b","border-gray-200","px-4","py-3","dark:border-gray-700"],["type","button",1,"rounded-lg","border","border-gray-300","px-2.5","py-1","text-xs","text-gray-700","transition-colors","hover:bg-gray-100","dark:border-gray-600","dark:text-gray-200","dark:hover:bg-gray-800"],[1,"text-sm","font-semibold","text-gray-900","dark:text-white"],[1,"text-xs","text-gray-500","dark:text-gray-400"],[1,"ml-auto","flex","items-center","gap-2"],[1,"border-b","border-amber-200","bg-amber-50","px-4","py-1.5","text-[11px]","text-amber-800","dark:border-amber-900","dark:bg-amber-900/20","dark:text-amber-200"],[1,"flex","min-h-0","flex-1"],[1,"flex","w-72","shrink-0","flex-col","border-r","border-gray-200","dark:border-gray-700"],[1,"p-3"],["type","search",1,"w-full","rounded-lg","border","border-gray-300","bg-white","px-3","py-1.5","text-xs","text-gray-900","outline-none","focus:ring-2","focus:ring-blue-500","dark:border-gray-600","dark:bg-gray-800","dark:text-white",3,"input","placeholder","value"],[1,"mt-2","flex","flex-wrap","gap-1"],["type","button",1,"rounded-full","px-2","py-0.5","text-[11px]","transition-colors",3,"click"],["type","button",1,"rounded-full","px-2","py-0.5","text-[11px]","transition-colors",3,"bg-blue-600","text-white","text-gray-600","dark:text-gray-300"],[1,"min-h-0","flex-1","overflow-y-auto","px-2","pb-2"],[1,"px-2","py-6","text-center","text-xs","text-gray-500","dark:text-gray-400"],[1,"flex","min-w-0","flex-1","flex-col"],[1,"grid","h-full","place-items-center","text-sm","text-gray-500"],[1,"flex","w-96","shrink-0","flex-col","border-l","border-gray-200","dark:border-gray-700"],[1,"flex","border-b","border-gray-200","dark:border-gray-700"],["type","button",1,"flex-1","px-3","py-2","text-xs","capitalize","transition-colors",3,"font-semibold","text-gray-900","dark:text-white","text-gray-500"],["type","button",1,"rounded-lg","border","border-gray-300","px-2.5","py-1","text-xs","text-gray-700","transition-colors","hover:bg-gray-100","dark:border-gray-600","dark:text-gray-200","dark:hover:bg-gray-800",3,"click"],[1,"font-medium","text-gray-700","dark:text-gray-200"],[1,"font-medium","text-red-600","dark:text-red-400"],[1,"text-amber-600","dark:text-amber-400"],[1,"text-xs","text-amber-700","dark:text-amber-300"],["type","button",1,"rounded-lg","bg-blue-600","px-2.5","py-1","text-xs","font-medium","text-white","transition-colors","hover:bg-blue-700"],["type","button",1,"rounded-lg","bg-blue-600","px-2.5","py-1","text-xs","font-medium","text-white","transition-colors","hover:bg-blue-700",3,"click"],["type","button",1,"flex","w-full","items-center","gap-2","rounded-lg","px-2","py-1.5","text-left","transition-colors","hover:bg-gray-100","dark:hover:bg-gray-800",3,"click"],[1,"min-w-0","flex-1","truncate","text-xs","text-gray-900","dark:text-white"],[1,"shrink-0","rounded","bg-red-100","px-1","text-[10px]","font-semibold","text-red-700","dark:bg-red-900/40","dark:text-red-300"],[1,"shrink-0","rounded","bg-amber-100","px-1","text-[10px]","font-semibold","text-amber-700","dark:bg-amber-900/40","dark:text-amber-300"],[1,"border-b","border-gray-200","px-4","py-2","dark:border-gray-700"],[1,"flex","items-center","gap-2"],[1,"font-mono","text-[11px]","text-gray-500","dark:text-gray-400"],["type","button",1,"text-[11px]","text-gray-500","disabled:opacity-40","enabled:hover:underline","dar
3k:text-gray-400",3,"click","disabled"],[1,"grid","min-h-0","flex-1","place-items-center","overflow-auto","p-8"],[1,"w-full","max-w-lg"],[1,"block","aspect-video","w-full",3,"template"],[1,"rounded","bg-amber-100","px-1.5","py-0.5","text-[10px]","font-semibold","text-amber-800","dark:bg-amber-900/40","dark:text-amber-300"],["type","button",1,"text-[11px]","text-blue-600","hover:underline","dark:text-blue-400",3,"click"],["type","button",1,"flex-1","px-3","py-2","text-xs","capitalize","transition-colors",3,"click"],[1,"min-h-0","flex-1","overflow-auto","p-3","text-[10px]","leading-relaxed","text-gray-800","dark:text-gray-200"],[1,"min-h-0","flex-1","overflow-auto","p-2"],[1,"px-1","pb-2","text-[11px]","text-gray-500","dark:text-gray-400"],["type","button",1,"flex","w-full","items-center","gap-2","rounded","px-1","py-0.5","text-left","text-[11px]","hover:bg-gray-100","dark:hover:bg-gray-800",3,"bg-red-50","dark:bg-red-900/20","ring-1","ring-blue-500","padding-left","title"],[1,"border-t","border-gray-200","p-3","dark:border-gray-700"],[1,"max-h-56","overflow-auto","border-t","border-gray-200","p-2","dark:border-gray-700"],[1,"px-1","pb-1","text-[11px]","font-semibold","text-gray-700","dark:text-gray-200"],[1,"rounded","px-1","py-1","text-[11px]"],[1,"px-1","py-2","text-[11px]","text-green-700","dark:text-green-400"],["type","button",1,"flex","w-full","items-center","gap-2","rounded","px-1","py-0.5","text-left","text-[11px]","hover:bg-gray-100","dark:hover:bg-gray-800",3,"click","title"],[1,"min-w-0","flex-1","truncate","text-gray-900","dark:text-gray-100"],[1,"shrink-0","font-mono","text-[10px]","text-blue-600","dark:text-blue-400"],[1,"pb-2","text-[11px]","font-semibold","text-gray-700","dark:text-gray-200"],[1,"block","pb-2"],[1,"text-[10px]","uppercase","tracking-wide","text-gray-500"],["type","text",1,"mt-0.5","w-full","rounded","border","border-gray-300","bg-white","px-2","py-1","text-[11px]","text-gray-900","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:bg-gray-800","dark:text-white",3,"input","value","placeholder"],[1,"text-[10px]","text-gray-400"],[1,"flex","gap-2"],[1,"block","flex-1"],["type","text",1,"mt-0.5","w-full","rounded","border","border-gray-300","bg-white","px-2","py-1","font-mono","text-[11px]","text-gray-900","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:bg-gray-800","dark:text-white",3,"change","value"],[1,"block","w-24"],[1,"block","pt-2"],[1,"pb-1","pt-3","text-[11px]","font-semibold","text-gray-700","dark:text-gray-200"],[1,"flex","items-center","gap-1","pb-1"],[1,"pb-1","text-[10px]","text-gray-400"],[1,"flex","items-center","gap-1","pt-1"],["type","text",1,"w-2/5","rounded","border","border-dashed","border-gray-300","bg-transparent","px-1.5","py-1","font-mono","text-[10px]","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:text-gray-300",3,"placeholder"],["type","text",1,"min-w-0","flex-1","rounded","border","border-dashed","border-gray-300","bg-transparent","px-1.5","py-1","font-mono","text-[10px]","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:text-gray-300",3,"keydown.enter","placeholder"],["type","button",1,"shrink-0","px-1","text-[11px]","text-blue-600","hover:underline","dark:text-blue-400",3,"click"],[1,"pt-2","text-[11px]","text-red-600","dark:text-red-400"],["type","text",1,"mt-0.5","w-full","rounded","border","border-gray-300","bg-white","px-2","py-1","text-[11px]","text-gray-900","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:bg-gray-800","dark:text-white",3,"input","value"],["type","text",1,"w-2/5","rounded","border","border-gray-300","bg-white","px-1.5","py-1","font-mono","text-[10px]","text-gray-600","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:bg-gray-800","dark:text-gray-300",3,"change","value"],[1,"min-w-0","flex-1"],["type","text",1,"min-w-0","flex-1","rounded","border","border-gray-300","bg-white","px-1.5","py-1","font-mono","text-[10px]","text-gray-900","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:bg-gray-800","dark:text-white",3,"value"],["type","button",1,"shrink-0","px-1","text-[11px]","text-gray-400","hover:text-red-600",3,"click"],[3,"valueChange","value","showActionButtons","canHideColor","canClearColor"],[3,"valueChange","value","hideSpread"],["type","text",1,"min-w-0","flex-1","rounded","border","border-gray-300","bg-white","px-1.5","py-1","font-mono","text-[10px]","text-gray-900","outline-none","focus:ring-1","focus:ring-blue-500","dark:border-gray-600","dark:bg-gray-800","dark:text-white",3,"input","value"],[1,"font-mono"],[1,"text-gray-500","dark:text-gray-400"]],template:function(t,n){t&1&&Q(0,_e,3,1,"ng-container",2)},dependencies:[gt,Ct,ft,rt],styles:["[_nghost-%COMP%]{display:block;height:100%}"],changeDetection:0})};export{kt as ComponentStudioComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.