1import{a as Ue}from"./chunk-L4XY2MND.js";import{a as Re}from"./chunk-36JHVAXO.js";import{g as ve}from"./chunk-7MBWALNH.js";import{a as Ce,b as xe}from"./chunk-4WLDP6IT.js";import"./chunk-PFFI2ISF.js";import"./chunk-V6GSNGFJ.js";import{a as be}from"./chunk-53JQ5TNC.js";import"./chunk-U7Q3O7VX.js";import"./chunk-5VPXBEUU.js";import"./chunk-VZWI2VH6.js";import{A as ze,b as ye,c as k,d as Pe,e as Me,h as we,i as ke,j as Se,k as Ee,n as Oe,o as Ve,p as Ie,q as Fe,r as Te,s as Ne,t as De,v as Ae,y as Le,z as $e}from"./chunk-P5GJR4AC.js";import"./chunk-ME32OR76.js";import{j as ge,l as fe,m as _e,r as he}from"./chunk-A7ET6VDF.js";import"./chunk-RGZ4OJ2S.js";import{z as ue}from"./chunk-BQVU46A6.js";import{$a as oe,$b as q,Ab as y,I as O,Ib as w,Ja as j,Mb as h,Na as s,Ob as p,Qb as le,Rb as se,S as F,Sb as de,Vb as T,X as g,Y as f,Yb as o,Zb as P,bc as ce,cc as me,d as ie,dc as pe,gc as K,h as ne,ha as _,pb as ae,rb as x,s as z,sb as v,tb as Q,ub as R,vb as V,wb as I,x as re,xb as M,yb as r,zb as n}from"./chunk-NLDCKMPI.js";import"./chunk-ODN5LVDJ.js";var Ge=["richEditor"],Be=()=>({standalone:!0}),We=(a,d)=>d.value,G=(a,d)=>d.id;function He(a,d){a&1&&(r(0,"div",5),y(1,"div",9),r(2,"p"),o(3,"Loading..."),n()())}function Je(a,d){if(a&1&&(r(0,"li"),o(1),n()),a&2){let e=d.$implicit;s(),P(e)}}function Ye(a,d){if(a&1&&(r(0,"ul",59),V(1,Je,2,1,"li",null,R),n()),a&2){let e=p();s(),I(e.items)}}function Ze(a,d){if(a&1){let e=w();r(0,"div",56)(1,"span",4),o(2),n(),r(3,"div",57)(4,"div",58),o(5),n(),x(6,Ye,3,0,"ul",59),n(),r(7,"button",60),h("click",function(){g(e);let i=p(2);return f(i.formStatus.set(null))}),o(8,"\xD7"),n()()}if(a&2){let e=d;T("status-error",e.kind==="error")("status-success",e.kind==="success"),s(2),P(e.kind==="error"?"error":"check_circle"),s(3),P(e.title),s(),v(e.items.length>0?6:-1)}}function Xe(a,d){if(a&1&&(r(0,"label",61),y(1,"input",62),r(2,"span",4),o(3),n(),r(4,"span",63),o(5),n(),r(6,"span",64),o(7),n()()),a&2){let e,t=d.$implicit,i=p(2);T("selected",((e=i.form.get("type"))==null?null:e.value)===t.value),s(),M("value",t.value),s(2),P(t.icon),s(2),P(t.label),s(2),P(t.description)}}function et(a,d){a&1&&(r(0,"span",18),o(1,"Title is required"),n())}function tt(a,d){a&1&&y(0,"span",65)}function it(a,d){if(a&1&&(r(0,"span",68),o(1),n()),a&2){let e=p(2).$implicit;s(),P(e.value==="h2"?"2":"3")}}function nt(a,d){if(a&1){let e=w();r(0,"button",67),h("click",function(){g(e);let i=p().$implicit,l=p(2);return f(l.execCommand(i.command,i.value))}),r(1,"span",4),o(2),n(),x(3,it,2,1,"span",68),n()}if(a&2){let e=p().$implicit,t=p(2);T("active",t.activeCommands().has(e.command)),M("title",e.title),s(2),P(e.icon),s(),v(e.value==="h2"||e.value==="h3"?3:-1)}}function rt(a,d){if(a&1&&x(0,tt,1,0,"span",65)(1,nt,4,5,"button",66),a&2){let e=d.$implicit;v(e.command==="separator"?0:1)}}function ot(a,d){a&1&&(r(0,"span",76),o(1,"Primary"),n())}function at(a,d){if(a&1){let e=w();r(0,"button",82),h("click",function(){g(e);let i=p().$index,l=p(3);return f(l.moveImage(i,i-1))}),r(1,"span",4),o(2,"chevron_left"),n()()}}function lt(a,d){if(a&1){let e=w();r(0,"button",83),h("click",function(){g(e);let i=p().$index,l=p(3);return f(l.moveImage(i,i+1))}),r(1,"span",4),o(2,"chevron_right"),n()()}}function st(a,d){if(a&1){let e=w();r(0,"div",74)(1,"img",75),h("error",function(i){g(e);let l=p(3);return f(l.onImageError(i))}),n(),x(2,ot,2,0,"span",76),r(3,"div",77)(4,"button",78),h("click",function(){let i=g(e).$index,l=p(3);return f(l.setPrimaryImage(i))}),r(5,"span",4),o(6),n()(),x(7,at,3,0,"button",79),x(8,lt,3,0,"button",80),r(9,"button",81),h("click",function(){let i=g(e).$implicit,l=p(3);return f(l.removeProductImage(i))}),r(10,"span",4),o(11,"close"),n()()()()}if(a&2){let e=d.$implicit,t=d.$index,i=p(3);T("is-primary",i.primaryImageIndex()===t),s(),M("src",e,j),s(),v(i.primaryImageIndex()===t?2:-1),s(2),T("active",i.primaryImageIndex()===t),s(2),P(i.primaryImageIndex()===t?"star":"star_border"),s(),v(t>0?7:-1),s(),v(t<i.productImageUrls().length-1?8:-1)}}function dt(a,d){if(a&1){let e=w();r(0,"div",69),V(1,st,12,9,"div",70,R),n(),r(3,"div",71)(4,"button",72),h("click",function(){g(e);let i=p(2);return f(i.openMediaPicker())}),r(5,"span",4),o(6,"add_photo_alternate"),n(),o(7," Add more images "),n(),r(8,"button",73),h("click",function(){g(e);let i=p(2);return f(i.clearAllImages())}),r(9,"span",4),o(10,"delete_sweep"),n(),o(11," Remove all "),n()()}if(a&2){let e=p(2);s(),I(e.productImageUrls())}}function ct(a,d){if(a&1){let e=w();r(0,"button",84),h("click",function(){g(e);let i=p(2);return f(i.openMediaPicker())}),r(1,"span",4),o(2,"add_photo_alternate"),n(),o(3," Select from Media Library "),n()}}function mt(a,d){if(a&1&&(r(0,"option",33),o(1),n()),a&2){let e=d.$implicit;M("value",e.id),s(),P(e.name)}
1}function pt(a,d){if(a&1&&(r(0,"option",33),o(1),n()),a&2){let e=d.$implicit;M("value",e.name),s(),P(e.name)}}function ut(a,d){if(a&1){let e=w();r(0,"section",12)(1,"h3")(2,"span",85),o(3,"forum"),n(),o(4," Community "),n(),r(5,"p",86),o(6,"Enable community features for this product. Visitors can leave reviews and/or comments."),n(),r(7,"div",29)(8,"label",30),o(9,"Community Mode"),n(),r(10,"select",87),h("ngModelChange",function(i){g(e);let l=p(2);return f(l.setNetworkingMode(i))}),r(11,"option",88),o(12,"None"),n(),r(13,"option",89),o(14,"Comments only"),n(),r(15,"option",90),o(16,"Reviews / Ratings only"),n(),r(17,"option",91),o(18,"Comments & Reviews"),n()()()()}if(a&2){let e=p(2);s(10),M("ngModel",e.networkingMode())("ngModelOptions",K(2,Be))}}function gt(a,d){a&1&&(r(0,"p",26),o(1,"No variants. Add variants for different sizes, colors, etc."),n())}function ft(a,d){if(a&1){let e=w();r(0,"div",92)(1,"div",28)(2,"div",29)(3,"label",30),o(4,"Name *"),n(),y(5,"input",93),n(),r(6,"div",29)(7,"label",30),o(8,"SKU"),n(),y(9,"input",94),n(),r(10,"div",29)(11,"label",30),o(12,"Price *"),n(),y(13,"input",95),n(),r(14,"div",29)(15,"label",30),o(16,"Stock"),n(),y(17,"input",96),n()(),r(18,"button",97),h("click",function(){let i=g(e).$index,l=p(3);return f(l.removeVariant(i))}),r(19,"span",4),o(20,"close"),n()()()}if(a&2){let e=d.$index;M("formGroupName",e)}}function _t(a,d){if(a&1&&(r(0,"div",50),V(1,ft,21,1,"div",92,Q),n()),a&2){let e=p(2);s(),I(e.variants.controls)}}function ht(a,d){a&1&&(r(0,"section",12)(1,"h3"),o(2,"Service Plan"),n(),r(3,"div",98)(4,"div",28)(5,"div",29)(6,"label",30),o(7,"Billing Interval *"),n(),r(8,"select",99)(9,"option",100),o(10,"One-time"),n(),r(11,"option",101),o(12,"Daily"),n(),r(13,"option",102),o(14,"Weekly"),n(),r(15,"option",103),o(16,"Monthly"),n(),r(17,"option",104),o(18,"Yearly"),n()()(),r(19,"div",29)(20,"label",30),o(21,"Recurring Price *"),n(),y(22,"input",105),n(),r(23,"div",29)(24,"label",30),o(25,"Trial Days"),n(),y(26,"input",106),n()(),r(27,"div",29)(28,"label",30),o(29,"Features"),n(),y(30,"textarea",107),n()()())}function bt(a,d){a&1&&(r(0,"section",12)(1,"h3"),o(2,"Digital Asset"),n(),r(3,"div",108)(4,"div",28)(5,"div",29)(6,"label",30),o(7,"Storage Key / File Path *"),n(),y(8,"input",109),n(),r(9,"div",29)(10,"label",30),o(11,"File Name"),n(),y(12,"input",110),n()(),r(13,"div",28)(14,"div",29)(15,"label",30),o(16,"File Type"),n(),y(17,"input",111),n(),r(18,"div",29)(19,"label",30),o(20,"Max Downloads"),n(),y(21,"input",112),n()(),r(22,"div",29)(23,"label",30),o(24,"Delivery Method"),n(),r(25,"select",113)(26,"option",114),o(27,"Download Link"),n(),r(28,"option",115),o(29,"Email Delivery"),n()()()()())}function Ct(a,d){if(a&1&&(r(0,"li"),o(1),n()),a&2){let e=d.$implicit;s(),P(e)}}function xt(a,d){if(a&1&&(r(0,"ul",59),V(1,Ct,2,1,"li",null,R),n()),a&2){let e=p();s(),I(e.items)}}function vt(a,d){if(a&1&&(r(0,"div",116)(1,"span",4),o(2),n(),r(3,"div",57)(4,"div",58),o(5),n(),x(6,xt,3,0,"ul",59),n()()),a&2){let e=d;T("status-error",e.kind==="error")("status-success",e.kind==="success"),s(2),P(e.kind==="error"?"error":"check_circle"),s(3),P(e.title),s(),v(e.items.length>0?6:-1)}}function yt(a,d){a&1&&(y(0,"span",117),o(1," Saving... "))}function Pt(a,d){a&1&&o(0," Update Product ")}function Mt(a,d){a&1&&o(0," Create Product ")}function wt(a,d){if(a&1){let e=w();r(0,"form",10),h("ngSubmit",function(){g(e);let i=p();return f(i.onSubmit())}),x(1,Ze,9,7,"div",11),r(2,"section",12)(3,"h3"),o(4,"Product Type"),n(),r(5,"div",13),V(6,Xe,8,6,"label",14,We),n()(),r(8,"section",15)(9,"h3"),o(10,"Product Details"),n(),r(11,"div",16),y(12,"input",17),x(13,et,2,0,"span",18),n(),r(14,"div",19)(15,"div",20),V(16,rt,2,1,null,null,Q),n()(),r(18,"div",21)(19,"div",22,0),h("focus",function(){g(e);let i=p();return f(i.isEditorFocused.set(!0))})("blur",function(){g(e);let i=p();return f(i.isEditorFocused.set(!1))}),n()(),r(21,"div",23)(22,"span",24),o(23),n(),r(24,"span",25),o(25,"\u2022"),n(),r(26,"span",24),o(27),n()()(),r(28,"section",12)(29,"h3"),o(30,"Product Images"),n(),r(31,"p",26),o(32,"Add photos of your product. Click the star icon to set the primary image. Use arrows to reorder."),n(),x(33,dt,12,0)(34,ct,4,0,"button",27),n(),r(35,"section",12)(36,"h3"),o(37,"Category & Tags"),n(),r(38,"div",28)(39,"div",29)(40,"label",30),o(41,"Category"),n(),r(42,"select",31),h("change",function(i){g(e);let l=p();return f(l.onRootCategoryChange(i.target.value))}),r(43,"option",32),o(44,"\u2014 Select category \u2014"),n(),V(45,mt,2,2,"option",33,G),n()(),r(47,"div",29)(48,"label",30),o(49,"Subcategory"),n(),r(50,"select",34)(51,"option",32),o(52,"\u2014 Select subcategory \u2014"),n(),V(53,pt,2,2,"option",33,G),n(),r(55,"span",26),o(56,"Select a category first"),n()()(),r(57,"div",29)(58,"label",30),o(59,"Tags"),n(),y(60,"input",35),n()(),x(61,ut,19,3,"section",12),r(62,"
1section",12)(63,"h3"),o(64,"Pricing"),n(),r(65,"div",36)(66,"label",37)(67,"input",38),h("change",function(i){g(e);let l=p();return f(l.onFreeToggle(i.target.checked))}),n(),r(68,"span",39)(69,"span",40),o(70,"Free"),n(),r(71,"span",26),o(72,"List this item as Free (no charge). Listings will show Free instead of a price."),n()()()(),r(73,"div",28)(74,"div",29)(75,"label",30),o(76,"Base Price *"),n(),r(77,"div",41)(78,"span",42),o(79,"$"),n(),y(80,"input",43),n()(),r(81,"div",29)(82,"label",30),o(83,"Currency"),n(),r(84,"select",44)(85,"option",45),o(86,"USD"),n(),r(87,"option",46),o(88,"EUR"),n(),r(89,"option",47),o(90,"GBP"),n()()()()(),r(91,"section",12)(92,"div",48)(93,"h3"),o(94,"Variants"),n(),r(95,"button",49),h("click",function(){g(e);let i=p();return f(i.addVariant())}),r(96,"span",4),o(97,"add"),n(),o(98," Add Variant "),n()(),x(99,gt,2,0,"p",26)(100,_t,3,0,"div",50),n(),x(101,ht,31,0,"section",12),x(102,bt,30,0,"section",12),x(103,vt,7,7,"div",51),r(104,"div",52)(105,"button",53),x(106,yt,2,0)(107,Pt,1,0)(108,Mt,1,0),n(),r(109,"button",54),h("click",function(){g(e);let i=p();return f(i.openPreview())}),r(110,"span",4),o(111,"visibility"),n(),o(112," Preview "),n(),r(113,"a",55),o(114,"Cancel"),n()()()}if(a&2){let e,t,i,l,m,c=p();M("formGroup",c.form),s(),v((e=c.formStatus())?1:-1,e),s(5),I(c.productTypes),s(7),v((t=c.form.get("title"))!=null&&t.invalid&&((t=c.form.get("title"))!=null&&t.touched)?13:-1),s(3),I(c.toolbarCommands),s(7),q("",c.wordCount()," ",c.wordCount()===1?"word":"words"),s(4),q("",c.charCount()," ",c.charCount()===1?"character":"characters"),s(6),v(c.productImageUrls().length>0?33:34),s(9),M("value",c.selectedRootCategoryId()),s(3),I(c.rootCategories()),s(5),ae("disabled",c.subcategories().length===0?!0:null),s(3),I(c.subcategories()),s(8),v(c.networkingEnabled()?61:-1),s(6),M("checked",c.isFree()),s(32),v(c.variants.length===0?99:100),s(2),v(((i=c.form.get("type"))==null?null:i.value)==="service"?101:-1),s(),v(((l=c.form.get("type"))==null?null:l.value)==="digital"?102:-1),s(),v((m=c.formStatus())?103:-1,m),s(2),M("disabled",c.form.invalid||c.isSaving()),s(),v(c.isSaving()?106:c.isEditing()?107:108)}}function kt(a,d){if(a&1){let e=w();r(0,"app-product-preview-modal",118),h("closed",function(){g(e);let i=p();return f(i.showPreview.set(!1))}),n()}if(a&2){let e=p();M("product",e.previewProductDTO())}}function St(a,d){a&1&&(r(0,"div",126),y(1,"div",9),r(2,"p"),o(3,"Loading images..."),n()())}function Et(a,d){a&1&&(r(0,"div",127)(1,"span",4),o(2,"photo_library"),n(),r(3,"p"),o(4,"No images found"),n(),r(5,"a",129),o(6,"Go to Media Library"),n()())}function Ot(a,d){if(a&1){let e=w();r(0,"div",131),h("click",function(){let i=g(e).$implicit,l=p(3);return f(l.selectMediaFile(i))}),r(1,"img",132),h("error",function(i){g(e);let l=p(3);return f(l.onImageError(i))}),n(),r(2,"div",133)(3,"span",4),o(4),n()(),r(5,"span",134),o(6),n()()}if(a&2){let e=d.$implicit,t=p(3);T("selected",t.isImageSelected(e)),s(),M("src",t.getMediaImageUrl(e),j)("alt",e.altText||e.filename),s(3),P(t.isImageSelected(e)?"check_circle":"add_circle"),s(2),P(e.filename)}}function Vt(a,d){if(a&1&&(r(0,"div",128),V(1,Ot,7,6,"div",130,G),n()),a&2){let e=p(2);s(),I(e.mediaFiles())}}function It(a,d){if(a&1){let e=w();r(0,"div",119),h("click",function(){g(e);let i=p();return f(i.closeMediaPicker())}),r(1,"div",120),h("click",function(i){return i.stopPropagation()}),r(2,"div",121)(3,"h3")(4,"span",4),o(5,"image"),n(),o(6," Select Product Images (click to add) "),n(),r(7,"button",122),h("click",function(){g(e);let i=p();return f(i.closeMediaPicker())}),r(8,"span",4),o(9,"close"),n()()(),r(10,"div",123)(11,"div",124)(12,"span",4),o(13,"search"),n(),r(14,"input",125),pe("ngModelChange",function(i){g(e);let l=p();return me(l.mediaSearchQuery,i)||(l.mediaSearchQuery=i),f(i)}),h("ngModelChange",function(){g(e);let i=p();return f(i.searchMedia())}),n()(),x(15,St,4,0,"div",126)(16,Et,7,0,"div",127)(17,Vt,3,0,"div",128),n()()()}if(a&2){let e=p();s(14),ce("ngModel",e.mediaSearchQuery),M("ngModelOptions",K(3,Be)),s(),v(e.mediaLoading()?15:e.mediaFiles().length===0?16:17)}}var Jt=(()=>{class a{constructor(){this.fb=F(Le),this.marketplaceService=F(Re),this.contentService=F(be),this.mediaService=F(xe),this.tenantService=F(ve),this.route=F(ge),this.router=F(fe),this.destroy$=new ie,this.isLoading=_(!1),this.isSaving=_(!1),this.isEditing=_(!1),this.error=_(null),this.formStatus=_(null),this.productId=_(null),this.editorContent=_(""),this.isEditorFocused=_(!1),this.activeCommands=_(new Set),this.wordCount=_(0),this.charCount=_(0),this.productImageUrls=_([]),this.primaryImageIndex=_(0),this.originalImages=_([]),this.originalVariants=_([]),this.showMediaPicker=_(!1),this.mediaFiles=_([]),this.mediaLoading=_(!1),this.mediaSearchQuery="",this.rootCategories=_([]),this.subcategories=_([]),this.selectedRootCategoryId=_(""),this.networkingEnabled=_(!1),this.networkingMode=_("none"),this.showPreview=_(!1),this.previewProductDTO=_(null),this.isFree=_(!1),this.lastPaidPrice=null,this.productTypes=[{value:"physical",label:"Physical",description:"Tangible items shipped to buyers",icon:"inventory_2"},{value:"digital",label:"Digital",description:"Downloadable files & content",icon:"cloud_download"},{value:"service",label:"Service",description:"One-time or recurring services",icon:"miscellaneous_services"}],this.toolbarCommands=[{command:"bold",icon:"format_bold",title:"Bold (Ctrl+B)"},{command:"italic",icon:"format_italic",title:"Italic (Ctrl+I)"},{command:"underline",icon:"format_underlined",title:"Underline (Ctrl+U)"}
1,{command:"strikeThrough",icon:"strikethrough_s",title:"Strikethrough"},{command:"separator",icon:"",title:""},{command:"formatBlock",icon:"title",title:"Heading 2",value:"h2"},{command:"formatBlock",icon:"title",title:"Heading 3",value:"h3"},{command:"formatBlock",icon:"notes",title:"Paragraph",value:"p"},{command:"separator",icon:"",title:""},{command:"insertUnorderedList",icon:"format_list_bulleted",title:"Bullet List"},{command:"insertOrderedList",icon:"format_list_numbered",title:"Numbered List"},{command:"separator",icon:"",title:""},{command:"justifyLeft",icon:"format_align_left",title:"Align Left"},{command:"justifyCenter",icon:"format_align_center",title:"Align Center"},{command:"justifyRight",icon:"format_align_right",title:"Align Right"},{command:"separator",icon:"",title:""},{command:"createLink",icon:"link",title:"Insert Link"},{command:"insertImage",icon:"image",title:"Insert Image from Media"},{command:"separator",icon:"",title:""},{command:"insertHorizontalRule",icon:"horizontal_rule",title:"Horizontal Line"},{command:"removeFormat",icon:"format_clear",title:"Clear Formatting"}],this.editorListenersAttached=!1,this.savedRange=null,this.insertIntoEditor=!1}get variants(){return this.form.get("variants")}ngOnInit(){this.initForm(),this.loadRootCategories(),this.loadNetworkingFeature();let e=this.route.snapshot.paramMap.get("productId");e&&(this.productId.set(e),this.isEditing.set(!0),this.loadProduct(e))}ngAfterViewInit(){this.attachEditorListeners()}attachEditorListeners(){if(!this.editorListenersAttached&&this.richEditor?.nativeElement){let e=this.richEditor.nativeElement;e.addEventListener("input",()=>this.onEditorInput()),e.addEventListener("mouseup",()=>this.updateActiveCommands()),e.addEventListener("keyup",()=>this.updateActiveCommands()),this.editorListenersAttached=!0}}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onEditorInput(){let e=this.richEditor?.nativeElement?.innerHTML||"";this.editorContent.set(e),this.form.patchValue({description:e},{emitEvent:!1}),this.updateWordCount(e),this.updateActiveCommands()}updateWordCount(e){let t=e.replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/\s+/g," ").trim();this.wordCount.set(t?t.split(" ").length:0),this.charCount.set(t.length)}updateActiveCommands(){let e=new Set,t=["bold","italic","underline","strikeThrough","insertUnorderedList","insertOrderedList","justifyLeft","justifyCenter","justifyRight"];for(let i of t)try{document.queryCommandState(i)&&e.add(i)}catch(l){}this.activeCommands.set(e)}execCommand(e,t){if(e!=="separator"){if(e==="createLink"){let i=prompt("Enter URL:");if(!i)return;this.richEditor?.nativeElement?.focus(),document.execCommand("createLink",!1,i),this.onEditorInput();return}if(e==="insertImage"){this.openInlineImagePicker();return}this.richEditor?.nativeElement?.focus(),document.execCommand(e,!1,t),this.onEditorInput()}}openInlineImagePicker(){this.saveSelection(),this.showMediaPicker.set(!0),this.loadMediaFiles()}saveSelection(){let e=window.getSelection();e&&e.rangeCount>0&&(this.savedRange=e.getRangeAt(0)),this.insertIntoEditor=!0}restoreSelectionAndInsertImage(e){if(this.richEditor?.nativeElement?.focus(),this.savedRange){let t=window.getSelection();t?.removeAllRanges(),t?.addRange(this.savedRange)}document.execCommand("insertImage",!1,e),this.onEditorInput(),this.savedRange=null,this.insertIntoEditor=!1}openMediaPicker(){this.insertIntoEditor=!1,this.showMediaPicker.set(!0),this.loadMediaFiles()}closeMediaPicker(){this.showMediaPicker.set(!1),this.insertIntoEditor=!1}selectMediaFile(e){let t=this.mediaService.getMediaUrl(e,!1);if(this.insertIntoEditor){this.restoreSelectionAndInsertImage(t),this.closeMediaPicker();return}let i=this.productImageUrls();i.includes(t)?this.productImageUrls.set(i.filter(l=>l!==t)):this.productImageUrls.set([...i,t])}removeProductImage(e){let t=this.productImageUrls(),i=t.indexOf(e);if(this.productImageUrls.set(t.filter(l=>l!==e)),i!==-1){let l=this.primaryImageIndex();i===l?this.primaryImageIndex.set(0):i<l&&this.primaryImageIndex.set(l-1)}}clearAllImages(){this.productImageUrls.set([]),this.primaryImageIndex.set(0)}setPrimaryImage(e){this.primaryImageIndex.set(e)}moveImage(e,t){let i=[...this.productImageUrls()],[l]=i.splice(e,1);i.splice(t,0,l),this.productImageUrls.set(i);let m=this.primaryImageIndex();m===e?this.primaryImageIndex.set(t):e<m&&t>=m?this.primaryImageIndex.set(m-1):e>m&&t<=m&&this.primaryImageIndex.set(m+1)}isImageSelected(e){let t=this.mediaService.getMediaUrl(e,!1);return this.productImageUrls().includes(t)}getMediaImageUrl(e){return this.mediaService.getMediaUrl(e,!0)}onImageError(e){e.target.src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect fill="%23f3f4f6" width="100" height="100"/><text x="50" y="55" text-anchor="middle" fill="%239ca3af" font-size="12">No image</text></svg>'}loadMediaFiles(){this.mediaLoading.set(!0),this.mediaService.getFiles({type:Ce.IMAGE,search:this.mediaSearchQuery||void 0},0,50).pipe(O(this.destroy$)).subscribe({next:e=>{this.mediaFiles.set(e.items),this.mediaLoading.set(!1)},error:()=>this.mediaLoading.set(!1)})}searchMedia(){this.loadMediaFiles()}loadRootCategories(){this.contentService.getCategories(null).pipe(O(this.destroy$)).subscribe({next:e=>this.rootCategories.set(e.filter(t=>t.categoryType==="MARKET")),error:()=>{}})}onRootCategoryChange(e){if(this.selectedRootCategoryId.set(e),this.form.patchValue({category:""}),!e){this.subcategories.set([]);return}this.contentService.getCategories(e).pipe(O(this.destroy$)).subscribe(t=>
1{if(t.length===0){let i=this.rootCategories().find(l=>l.id===e);i&&this.form.patchValue({category:i.name}),this.subcategories.set([])}else this.subcategories.set(t)})}resolveProductCategory(e){let t=this.rootCategories();t.length===0?this.contentService.getCategories(null).pipe(O(this.destroy$)).subscribe(i=>{let l=i.filter(m=>m.categoryType==="MARKET");this.rootCategories.set(l),this.matchCategoryInRoots(e,l)}):this.matchCategoryInRoots(e,t)}matchCategoryInRoots(e,t){let i=t.find(m=>m.name===e);if(i){this.selectedRootCategoryId.set(i.id),this.contentService.getCategories(i.id).pipe(O(this.destroy$)).subscribe(m=>{m.length>0?this.subcategories.set(m):(this.subcategories.set([]),this.form.patchValue({category:i.name}))});return}let l=t.map(m=>this.contentService.getCategories(m.id));z(l).pipe(O(this.destroy$)).subscribe(m=>{for(let c=0;c<t.length;c++)if(m[c].find(C=>C.name===e)){this.selectedRootCategoryId.set(t[c].id),this.subcategories.set(m[c]),this.form.patchValue({category:e});return}})}loadNetworkingFeature(){let e=this.tenantService.profile();if(e){this.networkingEnabled.set(e.features?.networkingEnabled===!0);return}this.tenantService.getTenantProfile().pipe(O(this.destroy$)).subscribe({next:t=>this.networkingEnabled.set(t.features?.networkingEnabled===!0),error:()=>this.networkingEnabled.set(!1)})}setNetworkingMode(e){this.networkingMode.set(e),this.form.patchValue({commentsEnabled:e==="comments"||e==="both",ratingsEnabled:e==="ratings"||e==="both"})}syncNetworkingMode(){let e=this.form.get("commentsEnabled")?.value,t=this.form.get("ratingsEnabled")?.value;e&&t?this.networkingMode.set("both"):e?this.networkingMode.set("comments"):t?this.networkingMode.set("ratings"):this.networkingMode.set("none")}onFreeToggle(e){if(e){let t=Number(this.form.get("basePrice")?.value);!Number.isNaN(t)&&t>0&&(this.lastPaidPrice=t),this.form.patchValue({basePrice:0}),this.isFree.set(!0),this.form.get("basePrice")?.disable({emitEvent:!1}),this.form.get("currency")?.disable({emitEvent:!1})}else this.isFree.set(!1),this.form.get("basePrice")?.enable({emitEvent:!1}),this.form.get("currency")?.enable({emitEvent:!1}),this.lastPaidPrice!=null&&this.lastPaidPrice>0&&this.form.patchValue({basePrice:this.lastPaidPrice})}syncFreeFromPrice(e){let t=this.marketplaceService.isFreePrice(e);this.isFree.set(t),t?(this.form.get("basePrice")?.disable({emitEvent:!1}),this.form.get("currency")?.disable({emitEvent:!1})):(this.form.get("basePrice")?.enable({emitEvent:!1}),this.form.get("currency")?.enable({emitEvent:!1}),e!=null&&Number(e)>0&&(this.lastPaidPrice=Number(e)))}initForm(){this.form=this.fb.group({type:["physical",k.required],title:["",[k.required,k.maxLength(500)]],description:[""],basePrice:[0,[k.required,k.min(0)]],currency:["USD"],category:[""],tagsInput:[""],commentsEnabled:[!1],ratingsEnabled:[!1],variants:this.fb.array([]),servicePlan:this.fb.group({billingInterval:["monthly"],recurringPrice:[0,[k.min(0)]],trialDays:[0,[k.min(0)]],features:[""]}),digitalAsset:this.fb.group({storageKey:[""],fileName:[""],fileType:[""],maxDownloads:[5],deliveryMethod:["download"]})})}loadProduct(e){this.isLoading.set(!0),this.marketplaceService.getVendorProduct(e).pipe(O(this.destroy$)).subscribe({next:t=>{if(this.form.patchValue({type:t.type,title:t.title,description:t.description||"",basePrice:t.basePrice,currency:t.currency||"USD",category:t.category||"",tagsInput:(t.tags||[]).join(", ")}),this.syncFreeFromPrice(t.basePrice),t.category&&this.resolveProductCategory(t.category),t.metadata)try{let i=typeof t.metadata=="string"?JSON.parse(t.metadata):t.metadata;this.form.patchValue({commentsEnabled:i?.comments_enabled===!0,ratingsEnabled:i?.ratings_enabled===!0}),this.syncNetworkingMode()}catch(i){}if(t.images&&t.images.length>0){let i=[...t.images].sort((m,c)=>(m.sortOrder??0)-(c.sortOrder??0));this.productImageUrls.set(i.map(m=>m.url)),this.originalImages.set(i);let l=i.findIndex(m=>m.isPrimary);this.primaryImageIndex.set(l>=0?l:0)}this.variants.clear(),this.originalVariants.set([...t.variants]);for(let i of t.variants)this.variants.push(this.fb.group({id:[i.id],name:[i.name,k.required],sku:[i.sku||""],price:[i.price,[k.required,k.min(0)]],stockQuantity:[i.stockQuantity||0]}));t.servicePlan&&this.form.get("servicePlan")?.patchValue({billingInterval:t.servicePlan.billingInterval,recurringPrice:t.servicePlan.recurringPrice,trialDays:t.servicePlan.trialDays||0,features:t.servicePlan.features||""}),t.digitalAsset&&this.form.get("digitalAsset")?.patchValue({storageKey:t.digitalAsset.storageKey,fileName:t.digitalAsset.fileName||"",fileType:t.digitalAsset.fileType||"",maxDownloads:t.digitalAsset.maxDownloads||5,deliveryMethod:t.digitalAsset.deliveryMethod||"download"}),this.isLoading.set(!1),setTimeout(()=>{this.richEditor?.nativeElement&&(this.attachEditorListeners(),t.description&&(this.richEditor.nativeElement.innerHTML=t.description,this.editorContent.set(t.description),this.updateWordCount(t.description)))})},error:t=>{this.error.set(t?.error?.message||t?.error?.detail||"Failed to load product"),this.isLoading.set(!1)}})}addVariant(){this.variants.push(this.fb.group({name:["",k.required],sku:[""],price:[0,[k.required,k.min(0)]],stockQuantity:[0]}))}removeVariant(e){this.variants.removeAt(e)}openPreview(){let e=this.form.getRawValue(),t=e.tagsInput?e.tagsInput.split(",").map(C=>
1C.trim()).filter(Boolean):[],i=this.primaryImageIndex(),l=this.productImageUrls().map((C,E)=>({id:`preview-img-${E}`,url:C,sortOrder:E,isPrimary:E===i})),m=(e.variants||[]).map((C,E)=>({id:`preview-var-${E}`,name:C.name||"Untitled",price:C.price||0,sku:C.sku||void 0,stockQuantity:C.stockQuantity??void 0})),c=this.richEditor?.nativeElement?.innerHTML||e.description||"",S={id:this.productId()||"preview",tenantId:"",vendorId:"",type:e.type||"physical",title:e.title||"Untitled Product",description:c,status:"draft",basePrice:e.basePrice||0,currency:e.currency||"USD",category:e.category||void 0,tags:t.length>0?t:void 0,variants:m,images:l,servicePlan:e.type==="service"&&e.servicePlan?.recurringPrice>0?{id:"preview-plan",billingInterval:e.servicePlan.billingInterval,recurringPrice:e.servicePlan.recurringPrice,trialDays:e.servicePlan.trialDays||void 0,features:e.servicePlan.features||void 0}:void 0,digitalAsset:e.type==="digital"&&e.digitalAsset?.storageKey?{id:"preview-asset",storageKey:e.digitalAsset.storageKey,fileName:e.digitalAsset.fileName||void 0,fileType:e.digitalAsset.fileType||void 0,maxDownloads:e.digitalAsset.maxDownloads||void 0,deliveryMethod:e.digitalAsset.deliveryMethod||void 0}:void 0};this.previewProductDTO.set(S),this.showPreview.set(!0)}static{this.FIELD_LABELS={type:"Product type",title:"Title",description:"Description",basePrice:"Base price",currency:"Currency",category:"Category",tags:"Tags",metadata:"Metadata",variants:"Variants",images:"Images",digitalAsset:"Digital asset",servicePlan:"Service plan",name:"name",sku:"SKU",price:"price",stockQuantity:"stock quantity",url:"URL",altText:"alt text",sortOrder:"sort order",isPrimary:"primary flag",storageKey:"storage key",fileName:"file name",fileType:"file type",fileSize:"file size",deliveryMethod:"delivery method",maxDownloads:"max downloads",billingInterval:"billing interval",recurringPrice:"recurring price",trialDays:"trial days",features:"features"}}humanizeField(e){let t=a.FIELD_LABELS,i=e.match(/^([A-Za-z_][\w]*)\[(\d+)\](?:\.(.+))?$/);if(i){let[,m,c,S]=i,C=t[m]??m,E=C.endsWith("s")?C.slice(0,-1):C,A=parseInt(c,10)+1;if(!S)return`${E} ${A}`;let L=t[S]??S;return`${E} ${A} ${L}`}let l=e.match(/^([A-Za-z_][\w]*)\.(.+)$/);if(l){let[,m,c]=l,S=t[m]??m,C=t[c]??c;return`${S} ${C}`}return t[e]??e}buildErrorStatus(e,t){let i=e?.error,l=e?.status,m=[];if(i?.errors&&typeof i.errors=="object")for(let[S,C]of Object.entries(i.errors))m.push(`${this.humanizeField(S)}: ${C}`);let c=t;return m.length>0?c=m.length===1?"1 field needs attention":`${m.length} fields need attention`:i?.detail?c=i.detail:i?.message?c=i.message:l===0?c="Cannot reach the server. Check your connection and try again.":typeof l=="number"&&l>=500&&(c=`Server error (${l}). Please try again.`),{kind:"error",title:c,items:m}}collectFormErrors(){let e=this.form.getRawValue(),t=[];
1return(e.title??"").trim()||t.push("Title is required"),e.basePrice==null||e.basePrice===""?t.push("Base price is required"):Number(e.basePrice)<0&&t.push("Base price must be 0 or greater"),e.type||t.push("Product type is required"),(e.variants??[]).forEach((i,l)=>{(i?.name??"").trim()||t.push(`Variant ${l+1} name is required`),i?.price==null||i.price===""?t.push(`Variant ${l+1} price is required`):Number(i.price)<0&&t.push(`Variant ${l+1} price must be 0 or greater`)}),t}markAllTouched(){this.form.markAllAsTouched()}onSubmit(){this.formStatus.set(null),this.error.set(null);let e=this.collectFormErrors();if(this.form.invalid||e.length>0){this.markAllTouched(),this.formStatus.set({kind:"error",title:e.length===1?"1 field needs attention":`${e.length||"Some"} fields need attention`,items:e});return}this.isSaving.set(!0);let t=this.form.getRawValue();this.isFree()&&(t.basePrice=0);let i=(t.title??"").trim(),l=t.tagsInput?t.tagsInput.split(",").map(b=>b.trim()).filter(Boolean):[],m=this.productImageUrls(),c=this.primaryImageIndex(),S=m[c]?.trim(),C=m.map(b=>b.trim()).filter(b=>b.length>0),E=S?C.indexOf(S):0;E<0&&(E=0);let A=C.map((b,N)=>({url:b,sortOrder:N,isPrimary:N===E})),L=(t.variants||[]).map(b=>({name:(b.name??"").trim(),sku:b.sku&&String(b.sku).trim()||void 0,price:b.price,stockQuantity:b.stockQuantity??void 0})),$={};this.networkingEnabled()&&($.comments_enabled=t.commentsEnabled||!1,$.ratings_enabled=t.ratingsEnabled||!1);let W=Object.keys($).length>0?JSON.stringify($):void 0,H=this.richEditor?.nativeElement?.innerHTML||t.description||"";if(this.isEditing()){let b=this.productId(),N=this.primaryImageIndex(),U=this.productImageUrls(),J=this.originalImages(),je=J.map(u=>u.url),Y=U.filter(u=>!je.includes(u)),Qe=J.filter(u=>!U.includes(u.url)),D=[];D.push(this.marketplaceService.updateProduct(b,{title:i,description:H||void 0,basePrice:t.basePrice,currency:t.currency,category:t.category||void 0,tags:l.length>0?l:void 0,metadata:W}));for(let u of Qe)D.push(this.marketplaceService.deleteProductImage(b,u.id));for(let u=0;u<Y.length;u++){let ee=Y[u],te=U.indexOf(ee);D.push(this.marketplaceService.addProductImage(b,{url:ee,sortOrder:te,isPrimary:te===N}))}let Z=this.originalVariants(),qe=new Set(Z.map(u=>u.id)),X=t.variants||[],Ke=new Set(X.filter(u=>u.id).map(u=>u.id)),B=[];for(let u of Z)Ke.has(u.id)||B.push(this.marketplaceService.deleteVariant(b,u.id));for(let u of X)u.id&&qe.has(u.id)?D.push(this.marketplaceService.updateVariant(b,u.id,{name:(u.name??"").trim(),sku:u.sku&&String(u.sku).trim()||void 0,price:u.price,stockQuantity:u.stockQuantity})):u.id||D.push(this.marketplaceService.addVariant(b,{name:(u.name??"").trim(),sku:u.sku&&String(u.sku).trim()||void 0,price:u.price,stockQuantity:u.stockQuantity}));(B.length>0?z(B):ne(null)).pipe(re(()=>z(D)),O(this.destroy$)).subscribe({next:()=>{this.isSaving.set(!1),this.formStatus.set({kind:"success",title:"Product updated",items:[]}),setTimeout(()=>this.router.navigate(["/tenant/marketplace/products"]),600)},error:u=>{this.formStatus.set(this.buildErrorStatus(u,"Failed to update product")),this.isSaving.set(!1)}})}else{let b={type:t.type,title:i,description:H||void 0,basePrice:t.basePrice,currency:t.currency,category:t.category||void 0,tags:l.length>0?l:void 0,metadata:W,variants:L.length>0?L:void 0,images:A.length>0?A:void 0};t.type==="service"&&t.servicePlan.recurringPrice>0&&(b.servicePlan={billingInterval:t.servicePlan.billingInterval,recurringPrice:t.servicePlan.recurringPrice,trialDays:t.servicePlan.trialDays||void 0,features:t.servicePlan.features||void 0}),t.type==="digital"&&t.digitalAsset.storageKey?.trim()&&(b.digitalAsset={storageKey:t.digitalAsset.storageKey.trim(),fileName:t.digitalAsset.fileName||void 0,fileType:t.digitalAsset.fileType||void 0,maxDownloads:t.digitalAsset.maxDownloads||void 0,deliveryMethod:t.digitalAsset.deliveryMethod||void 0}),this.marketplaceService.createProduct(b).pipe(O(this.destroy$)).subscribe({next:()=>{this.isSaving.set(!1),this.formStatus.set({kind:"success",title:"Product created",items:[]}),setTimeout(()=>this.router.navigate(["/tenant/marketplace/products"]),600)},error:N=>{this.formStatus.set(this.buildErrorStatus(N,"Failed to create product")),this.isSaving.set(!1)}})}}static{this.\u0275fac=function(t){return new(t||a)}}static{this.\u0275cmp=oe({type:a,selectors:[["app-vendor-product-form"]],viewQuery:function(t,i){if(t&1&&le(Ge,5),t&2){let l;se(l=de())&&(i.richEditor=l.first)}}
vendor: 9,896 bytes, line 1
1,decls:12,vars:4,consts:[["richEditor",""],[1,"product-form-page"],[1,"page-toolbar"],["routerLink","/tenant/marketplace/products",1,"back-link"],[1,"material-icons"],[1,"loading-state"],[3,"formGroup"],[3,"product"],[1,"modal-overlay"],[1,"spinner"],[3,"ngSubmit","formGroup"],["role","alert",1,"status-banner",3,"status-error","status-success"],[1,"form-section"],[1,"type-selector"],[1,"type-option",3,"selected"],[1,"form-section","editor-section"],[1,"form-group","title-group"],["type","text","formControlName","title","placeholder","Enter your title...",1,"title-input"],[1,"form-error"],[1,"editor-toolbar"],[1,"toolbar-group"],[1,"editor-wrapper"],["contenteditable","true","data-placeholder","Write your product description here...",1,"rich-editor",3,"focus","blur"],[1,"editor-meta"],[1,"stat"],[1,"stat-sep"],[1,"hint-text"],["type","button",1,"btn","btn-secondary","btn-block"],[1,"form-row"],[1,"form-group"],[1,"form-label"],[1,"form-input","form-select",3,"change","value"],["value",""],[3,"value"],["formControlName","category",1,"form-input","form-select"],["type","text","formControlName","tagsInput","placeholder","Comma-separated tags",1,"form-input"],[1,"form-group","free-option"],["for","product-is-free",1,"checkbox-row"],["id","product-is-free","type","checkbox","data-cy","product-is-free",1,"form-checkbox",3,"change","checked"],[1,"checkbox-label-text"],[1,"label-text"],[1,"input-prefix"],[1,"prefix"],["type","number","formControlName","basePrice","step","0.01","min","0","placeholder","0.00",1,"form-input","with-prefix"],["formControlName","currency",1,"form-input","form-select"],["value","USD"],["value","EUR"],["value","GBP"],[1,"section-toolbar"],["type","button",1,"btn","btn-sm","btn-secondary",3,"click"],["formArrayName","variants",1,"variants-list"],["role","status",1,"inline-status",3,"status-error","status-success"],[1,"form-actions"],["type","submit",1,"btn","btn-primary",3,"disabled"],["type","button",1,"btn","btn-secondary",3,"click"],["routerLink","/tenant/marketplace/products",1,"btn","btn-secondary"],["role","alert",1,"status-banner"],[1,"status-body"],[1,"status-title"],[1,"status-items"],["type","button","aria-label","Dismiss",1,"close-btn",3,"click"],[1,"type-option"],["type","radio","formControlName","type",3,"value"],[1,"type-label"],[1,"type-desc"],[1,"toolbar-separator"],["type","button",1,"toolbar-btn",3,"active","title"],["type","button",1,"toolbar-btn",3,"click","title"],[1,"heading-label"],[1,"image-gallery"],[1,"gallery-thumb",3,"is-primary"],[1,"image-actions"],["type","button",1,"btn","btn-secondary","btn-sm",3,"click"],["type","button",1,"btn","btn-outline","btn-sm",3,"click"],[1,"gallery-thumb"],["alt","Product image","loading","lazy",3,"error","src"],[1,"primary-badge"],[1,"img-controls"],["type","button","title","Set as primary",1,"img-ctrl-btn",3,"click"],["type","button","title","Move left",1,"img-ctrl-btn"],["type","button","title","Move right",1,"img-ctrl-btn"],["type","button","title","Remove",1,"img-ctrl-btn","remove",3,"click"],["type","button","title","Move left",1,"img-ctrl-btn",3,"click"],["type","button","title","Move right",1,"img-ctrl-btn",3,"click"],["type","button",1,"btn","btn-secondary","btn-block",3,"click"],[1,"material-icons",2,"font-size","1.125rem","vertical-align","middle","margin-right","0.25rem"],[1,"hint-text",2,"margin-bottom","0.75rem"],[1,"form-input","form-select",3,"ngModelChange","ngModel","ngModelOptions"],["value","none"],["value","comments"],["value","ratings"],["value","both"],[1,"variant-card",3,"formGroupName"],["type","text","formControlName","name","placeholder","e.g. Small, Blue",1,"form-input"],["type","text","formControlName","sku","placeholder","SKU code",1,"form-input"],["type","number","formControlName","price","step","0.01","min","0",1,"form-input"],["type","number","formControlName","stockQuantity","min","0",1,"form-input"],["type","button","title","Remove variant",1,"remove-variant",3,"click"],["formGroupName","servicePlan"],["formControlName","billingInterval",1,"form-input","form-select"],["value","one_time"],["value","daily"],["value","weekly"],["value","monthly"],["value","yearly"],["type","number","formControlName","recurringPrice","step","0.01","min","0",1,"form-input"],["type","number","formControlName","trialDays","min","0",1,"form-input"],["formControlName","features","rows","3","placeholder","Describe what's included...",1,"form-input"],["formGroupName","digitalAsset"],["type","text","formControlName","storageKey","placeholder","Path in MinIO storage",1,"form-input"],["type","text","formControlName","fileName","placeholder","display-name.pdf",1,"form-input"],["type","text","formControlName","fileType","placeholder","e.g. application/pdf",1,"form-input"],["type","number","formControlName","maxDownloads","min","1",1,"form-input"],["formControlName","deliveryMethod",1,"form-input","form-select"],["value","download"],["value","email"],["role","status",1,"inline-status"],[1,"spinner-sm"],[3,"closed","product"],[1,"modal-overlay",3,"click"],[1,"media-picker-modal",3,"click"],[1,"modal-header"],[1,"modal-close-btn",3,"click"],[1,"modal-content"],[1,"media-search"],["type","text","placeholder","Search images...",3,"ngModelChange","ngModel","ngModelOptions"],[1,"media-loading"],[1,"media-empty"],[1,"media-grid"],["routerLink","/tenant/media",1,"btn","btn-secondary"],[1,"media-item",3,"selected"],[1,"media-item",3,"click"],[3,"error","src","alt"],[1,"media-item-overlay"],[1,"media-name"]],template:function(t,i){t&1&&(r(0,"div",1)(1,"div",2)(2,"a",3)(3,"span",4),o(4,"arrow_back"),n(),o(5," Back to Products "),n()(),r(6,"h2"),o(7),n(),x(8,He,4,0,"div",5)(9,wt,115,18,"form",6),x(10,kt,1,1,"app-product-preview-modal",7),x(11,It,18,4,"div",8),n()),t&2&&(s(7),P(i.isEditing()?"Edit Product":"New Product"),s(),v(i.isLoading()?8:9),s(2),v(i.showPreview()?10:-1),s(),v(i.showMediaPicker()?11:-1))},dependencies:[ue,ze,ke,Ne,De,ye,Se,Te,Ee,Pe,Me,Ae,Fe,Ie,Oe,Ve,$e,we,he,_e,Ue],styles:[".product-form-page[_ngcontent-%COMP%]{max-width:900px}.page-toolbar[_ngcontent-%COMP%]{margin-bottom:1rem}.back-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;color:var(--text-muted, #6b7280);text-decoration:none;font-size:.875rem}.back-link[_ngcontent-%COMP%]:hover{color:var(--text-primary, #111827)}.back-link[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:1.125rem}h2[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;color:var(--text-primary, #111827);margin:0 0 1.5rem}.loading-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:4rem 0;color:var(--text-muted, #6b7280)}.spinner[_ngcontent-%COMP%]{width:32px;height:32px;border:3px solid var(--border-light, #e5e7eb);border-top-color:var(--primary, #4f46e5);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}.spinner-sm[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:_ngcontent-%COMP%_spin .6s linear infinite;display:inline-block}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}.form-section[_ngcontent-%COMP%]{background:var(--bg-primary, #fff);border:1px solid var(--border-light, #e5e7eb);border-radius:12px;padding:1.5rem;margin-bottom:1.5rem}.form-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:1rem;font-weight:600;color:var(--text-primary, #111827);margin:0 0 1rem}.section-toolbar[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.section-toolbar[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0}.type-selector[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:.75rem}.type-option[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:.375rem;padding:1rem;border:2px solid var(--border-light, #e5e7eb);border-radius:12px;cursor:pointer;transition:all .2s;text-align:center}.type-option[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{display:none}.type-option[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:1.75rem;color:var(--text-muted, #6b7280)}.type-option.selected[_ngcontent-%COMP%]{border-color:var(--primary, #4f46e5);background:#4f46e50a}.type-option.selected[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{color:var(--primary, #4f46e5)}.type-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--text-primary, #111827)}.type-desc[_ngcontent-%COMP%]{font-size:.75rem;color:var(--text-muted, #6b7280)}.editor-section[_ngcontent-%COMP%]{padding:0;overflow:hidden}.editor-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{padding:1.5rem 1.5rem 0}.title-group[_ngcontent-%COMP%]{padding:.5rem 1.5rem}.title-input[_ngcontent-%COMP%]{width:100%;font-size:1.75rem;font-weight:700;border:none;padding:.5rem 0;background:transparent;color:var(--text-primary, #111827);font-family:Plus Jakarta Sans,Inter,sans-serif;letter-spacing:-.02em;line-height:1.2;outline:none}.title-input[_ngcontent-%COMP%]::placeholder{color:#d1d5db}.title-input[_ngcontent-%COMP%]:focus{box-shadow:none}.editor-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.5rem 1rem;margin:0 1rem;background:var(--bg-secondary, #f9fafb);border:1px solid var(--border-light, #e5e7eb);border-radius:10px;flex-wrap:wrap;gap:.25rem}.toolbar-group[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:.125rem}.toolbar-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;background:transparent;border:none;border-radius:6px;color:#6b7280;cursor:pointer;transition:all .15s;position:relative}.toolbar-btn[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:19px}.toolbar-btn[_ngcontent-%COMP%]:hover{background:#fff;color:#111827;box-shadow:0 1px 3px #00000014}.toolbar-btn.active[_ngcontent-%COMP%]{background:var(--primary, #4f46e5);color:#fff}
1.toolbar-separator[_ngcontent-%COMP%]{width:1px;height:20px;background:var(--border-light, #e5e7eb);margin:0 .25rem}.heading-label[_ngcontent-%COMP%]{position:absolute;bottom:1px;right:2px;font-size:9px;font-weight:700;color:inherit;line-height:1}.editor-wrapper[_ngcontent-%COMP%]{padding:.75rem 1.5rem 1.5rem}.rich-editor[_ngcontent-%COMP%]{min-height:250px;padding:1rem;background:#fff;border:2px solid var(--border-light, #e5e7eb);border-radius:10px;font-size:.9375rem;line-height:1.75;color:var(--text-primary, #374151);outline:none;overflow-y:auto;transition:border-color .2s,box-shadow .2s}.rich-editor[_ngcontent-%COMP%]:focus{border-color:var(--primary, #4f46e5);box-shadow:0 0 0 3px #4f46e51a}.rich-editor[_ngcontent-%COMP%]:empty:before{content:attr(data-placeholder);color:#d1d5db;pointer-events:none}.rich-editor[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:100%;height:auto;border-radius:6px;margin:.5rem 0}.image-gallery[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;margin-bottom:.75rem}.gallery-thumb[_ngcontent-%COMP%]{position:relative;width:110px;height:130px;border-radius:10px;overflow:visible;border:2px solid var(--border-light, #e5e7eb);transition:border-color .2s;display:flex;flex-direction:column}.gallery-thumb.is-primary[_ngcontent-%COMP%]{border-color:var(--primary, #4f46e5)}.gallery-thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100px;object-fit:cover;border-radius:8px 8px 0 0}.primary-badge[_ngcontent-%COMP%]{position:absolute;top:4px;left:4px;font-size:.625rem;font-weight:600;background:var(--primary, #4f46e5);color:#fff;padding:1px 6px;border-radius:4px;z-index:1}.img-controls[_ngcontent-%COMP%]{display:flex;gap:2px;justify-content:center;padding:2px 0;background:var(--bg-secondary, #f9fafb);border-radius:0 0 8px 8px}.img-ctrl-btn[_ngcontent-%COMP%]{width:24px;height:24px;display:flex;align-items:center;justify-content:center;background:transparent;color:var(--text-muted, #6b7280);border:none;border-radius:4px;cursor:pointer;transition:all .15s;padding:0}.img-ctrl-btn[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:16px}.img-ctrl-btn[_ngcontent-%COMP%]:hover{background:var(--border-light, #e5e7eb);color:var(--text-primary, #111827)}.img-ctrl-btn.active[_ngcontent-%COMP%]{color:#f59e0b}.img-ctrl-btn.active[_ngcontent-%COMP%]:hover{color:#d97706}.img-ctrl-btn.remove[_ngcontent-%COMP%]:hover{background:#fef2f2;color:#ef4444}.image-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-wrap:wrap}.form-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem}.form-group[_ngcontent-%COMP%]{margin-bottom:.75rem}.form-label[_ngcontent-%COMP%]{display:block;font-size:.8125rem;font-weight:500;color:var(--text-primary, #374151);margin-bottom:.375rem}.form-input[_ngcontent-%COMP%]{width:100%;padding:.5rem .75rem;border:1px solid var(--border-light, #d1d5db);border-radius:8px;font-size:.875rem;background:var(--bg-primary, #fff);color:var(--text-primary, #111827);box-sizing:border-box}.form-input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--primary, #4f46e5);box-shadow:0 0 0 3px #4f46e51a}.form-input[_ngcontent-%COMP%]:disabled{background:var(--bg-secondary, #f3f4f6);color:var(--text-muted, #6b7280);cursor:not-allowed}.form-select[_ngcontent-%COMP%]{cursor:pointer}textarea.form-input[_ngcontent-%COMP%]{resize:vertical}.form-error[_ngcontent-%COMP%]{font-size:.75rem;color:#dc2626;margin-top:.25rem;display:block}.hint-text[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--text-muted, #9ca3af);margin:0}.input-prefix[_ngcontent-%COMP%]{position:relative}.prefix[_ngcontent-%COMP%]{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);color:var(--text-muted, #6b7280);font-size:.875rem}.with-prefix[_ngcontent-%COMP%]{padding-left:1.75rem}.free-option[_ngcontent-%COMP%]{margin-bottom:1rem}.checkbox-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.625rem;cursor:pointer}.form-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;margin-top:.2rem;flex-shrink:0;accent-color:var(--primary, #4f46e5);cursor:pointer}.checkbox-label-text[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.125rem}.checkbox-label-text[_ngcontent-%COMP%] .label-text[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--text-primary, #111827)}.checkbox-label-text[_ngcontent-%COMP%] .hint-text[_ngcontent-%COMP%]{font-size:.75rem}.variants-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.variant-card[_ngcontent-%COMP%]{position:relative;padding:1rem;background:var(--bg-secondary, #f9fafb);border:1px solid var(--border-light, #e5e7eb);border-radius:8px}.remove-variant[_ngcontent-%COMP%]{position:absolute;top:.5rem;right:.5rem;background:none;border:none;cursor:pointer;color:var(--text-muted, #9ca3af);padding:.125rem}.remove-variant[_ngcontent-%COMP%]:hover{color:#dc2626}.remove-variant[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:1.125rem}.form-actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-bottom:2rem}.btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.625rem 1.25rem;border:none;border-radius:8px;font-size:.875rem;font-weight:500;cursor:pointer;text-decoration:none;transition:all .2s}.btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.btn-primary[_ngcontent-%COMP%]{background:var(--primary, #4f46e5);color:#fff}.btn-primary[_ngcontent-%COMP%]:hover:not(:disabled){background:#4338ca}.btn-secondary[_ngcontent-%COMP%]{background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #374151)}.btn-secondary[_ngcontent-%COMP%]:hover{background:#e5e7eb}.btn-outline[_ngcontent-%COMP%]{background:transparent;border:1px solid var(--border-light, #d1d5db);color:var(--text-muted, #6b7280)}.btn-outline[_ngcontent-%COMP%]:hover{border-color:#ef4444;color:#ef4444}.btn-sm[_ngcontent-%COMP%]{padding:.375rem .75rem;font-size:.8125rem}.btn-sm[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:1rem}.btn-block[_ngcontent-%COMP%]{width:100%;justify-content:center}.editor-meta[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;padding:0 .25rem;font-size:.75rem;color:var(--text-muted, #6b7280)}.editor-meta[_ngcontent-%COMP%] .stat[_ngcontent-%COMP%]{display:inline-flex;align-items:center}.editor-meta[_ngcontent-%COMP%] .stat-sep[_ngcontent-%COMP%]{color:var(--text-muted, #9ca3af);opacity:.6}.message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:8px;margin-bottom:1rem;font-size:.875rem}.error-message[_ngcontent-%COMP%]{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}.close-btn[_ngcontent-%COMP%]{margin-left:auto;background:none;border:none;font-size:1.25rem;cursor:pointer;color:inherit}.status-banner[_ngcontent-%COMP%], .inline-status[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.625rem;padding:.75rem 1rem;border-radius:8px;font-size:.875rem;border:1px solid transparent}.status-banner[_ngcontent-%COMP%]{margin-bottom:1rem}.inline-status[_ngcontent-%COMP%]{margin-bottom:.75rem}.status-banner.status-error[_ngcontent-%COMP%], .inline-status.status-error[_ngcontent-%COMP%]{background:#fee2e2;color:#991b1b;border-color:#fecaca}.status-banner.status-success[_ngcontent-%COMP%], .inline-status.status-success[_ngcontent-%COMP%]{background:#dcfce7;color:#166534;border-color:#bbf7d0}.status-banner[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%], .inline-status[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:1.125rem;line-height:1.25rem;flex-shrink:0}.status-body[_ngcontent-%COMP%]{flex:1;min-width:0}.status-title[_ngcontent-%COMP%]{font-weight:600}.status-items[_ngcontent-%COMP%]{margin:.375rem 0 0;padding-left:1.1rem;display:flex;flex-direction:column;gap:.125rem}.status-items[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{line-height:1.35}.modal-overlay[_ngcontent-%COMP%]{position:fixed;inset:0;background:#00000080;z-index:1000;display:flex;align-items:center;justify-content:center}.media-picker-modal[_ngcontent-%COMP%]{width:800px;max-width:95vw;max-height:85vh;background:#fff;border-radius:16px;box-shadow:0 25px 50px -12px #00000040;overflow:hidden;display:flex;flex-direction:column}.modal-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:1rem 1.5rem;border-bottom:1px solid var(--border-light, #e5e7eb)}.modal-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin:0}.modal-close-btn[_ngcontent-%COMP%]{background:none;border:none;color:#6b7280;cursor:pointer;padding:.25rem;border-radius:6px}.modal-close-btn[_ngcontent-%COMP%]:hover{background:#f3f4f6;color:#111827}.modal-content[_ngcontent-%COMP%]{padding:1rem 1.5rem;overflow-y:auto;flex:1}.media-search[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border:1px solid var(--border-light, #e5e7eb);border-radius:8px;margin-bottom:1rem}.media-search[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{color:#9ca3af;font-size:1.25rem}.media-search[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;font-size:.875rem;background:transparent}.media-loading[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:3rem;color:#6b7280}.media-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:3rem;gap:.75rem;color:#9ca3af}.media-empty[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:3rem}.media-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,1fr);gap:.75rem}.media-item[_ngcontent-%COMP%]{position:relative;aspect-ratio:1;border-radius:10px;overflow:hidden;cursor:pointer;transition:transform .2s,box-shadow .2s;border:2px solid transparent}.media-item[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.media-item-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;background:#4f46e599;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s}.media-item-overlay[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{font-size:2rem;color:#fff}.media-item[_ngcontent-%COMP%]:hover{transform:scale(1.03);box-shadow:0 4px 15px #0000001f}.media-item[_ngcontent-%COMP%]:hover .media-item-overlay[_ngcontent-%COMP%]{opacity:1}.media-item.selected[_ngcontent-%COMP%]{border-color:var(--primary, #4f46e5)}.media-item.selected[_ngcontent-%COMP%] .media-item-overlay[_ngcontent-%COMP%]{opacity:1;background:#4f46e566}
1.media-name[_ngcontent-%COMP%]{position:absolute;bottom:0;left:0;right:0;padding:.375rem .5rem;background:linear-gradient(transparent,#000000b3);color:#fff;font-size:.6875rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:600px){.type-selector[_ngcontent-%COMP%], .form-row[_ngcontent-%COMP%]{grid-template-columns:1fr}.media-grid[_ngcontent-%COMP%]{grid-template-columns:repeat(2,1fr)}}"]})}}return a})();export{Jt as VendorProductFormComponent};
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.