homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
5 lines (4 loc) • 19.9 kB
JavaScript
import{M as ne,P as oe,a as pe,b as E,c as te,d as C,e as M,f as ie,g as W,h as j,i as q,j as N}from"./chunk-XSOYPTQY.js";import{b as R}from"./chunk-OS3DVZYM.js";import{$b as Z,Bc as k,Ca as O,Dc as ee,Ec as A,Ib as X,La as I,Lb as Y,Nb as c,Qa as a,Xc as D,Yb as F,Zb as _,_b as x,a as $,b as V,db as L,eb as w,g as ce,ia as T,ja as v,la as G,ma as K,na as f,o as J,pb as z,qb as p,rb as u,sa as Q,ta as U,wb as y,xb as d,yb as h,zb as g}from"./chunk-HYMBXFUO.js";var m=ce(pe(),1);function ue(i,n){if(i&1){let s=X();d(0,"button",5),Y("click",function(){Q(s);let o=c();return U(o.removeItem())}),d(1,"span",6),x(2,"\xD7"),h(),d(3,"span"),x(4,"Close"),h()()}if(i&2){let s=c();_(s.widgetStyles().__remove_item__),a(3),_(s.widgetStyles().__screen_reader__)}}function he(i,n){if(i&1&&g(0,"p",7),i&2){let s=c(2);_(s.widgetStyles().__help_block__),y("innerHTML",s.options==null?null:s.options.helpBlock,I)}}function me(i,n){if(i&1&&(d(0,"div"),p(1,he,1,3,"p",2),h()),i&2){let s=c();a(),u(s.options!=null&&s.options.helpBlock?1:-1)}}function fe(i,n){if(i&1&&g(0,"label",7),i&2){let s,t=c();_((t.options==null?null:t.options.labelHtmlClass)||""),F("sr-only",t.options==null?null:t.options.notitle),y("innerHTML",t.dynamicTitle,I),z("for","control"+((s=t.layoutNode())==null?null:s._id))}}function ge(i,n){if(i&1&&(d(0,"p")(1,"strong"),x(2,"*"),h(),x(3," = required fields "),h()),i&2){let s=c();a(),_(s.widgetStyles().__required_asterisk__)}}function _e(i,n){if(i&1&&g(0,"span",7),i&2){let s=c();_(s.widgetStyles().__field_addon_left__),y("innerHTML",s.options==null?null:s.options.fieldAddonLeft,I)}}function be(i,n){if(i&1&&g(0,"span",7),i&2){let s=c();_(s.widgetStyles().__field_addon_right__),y("innerHTML",s.options==null?null:s.options.fieldAddonRight,I)}}function ye(i,n){if(i&1&&g(0,"span",8),i&2){let s=c();F("glyphicon-ok",(s.options==null?null:s.options.enableSuccessState)&&!(s.formControl!=null&&s.formControl.errors))("glyphicon-remove",(s.options==null?null:s.options.enableErrorState)&&(s.formControl==null?null:s.formControl.errors))}}function Ce(i,n){if(i&1&&g(0,"p",7),i&2){let s=c(2);_(s.widgetStyles().__help_block__),y("innerHTML",s.options==null?null:s.options.helpBlock,I)}}function ve(i,n){if(i&1&&(d(0,"div"),p(1,Ce,1,3,"p",2),h()),i&2){let s=c();a(),u(s.options!=null&&s.options.helpBlock?1:-1)}}function we(i,n){if(i&1&&(d(0,"div"),x(1,"debug: "),d(2,"pre"),x(3),h()()),i&2){let s=c();a(3),Z(s.debugOutput)}}var H=(()=>{let n=class n{constructor(){this.frameworkThemeSubject=new J("default"),this.frameworkTheme$=this.frameworkThemeSubject.asObservable()}requestThemeChange(t){this.frameworkThemeSubject.next(t),this.activeRequestedTheme=t}getActiveRequestedTheme(){return this.activeRequestedTheme}};n.\u0275fac=function(o){return new(o||n)},n.\u0275prov=T({token:n,factory:n.\u0275fac,providedIn:"root"});let i=n;return i})(),P=(()=>{let n=class n{applyCssClasses(t,o,e){let r=this.widgetStyles()[t];(!r||m.default.isEmpty(r))&&(r=this.widgetStyles().default),Object.keys(r).forEach(l=>{let b=r[l];b.length&&(o[l]=C(o[l],b)),e&&(o[l]=C(o[l],e))})}flattenWidgetStyles(t){var o={};let e=["__themes__"];return Object.keys(t).forEach(r=>{let l=t[r];if(e.indexOf(r)>=0){o[r]=l;return}m.default.isArray(l)&&(o[r]=l.join(" ")),m.default.isObject(l)&&(o[r]=o[r]||{},Object.keys(l).forEach(b=>{let S=l[b];m.default.isArray(S)?o[r][b]=S.join(" "):o[r][b]=S})),m.default.isString(l)&&(o[r]=l)}),o}constructor(){this.cdr=f(A),this.jsf=f(M),this.jsfFLService=f(j),this.cssFWService=f(H),this.frameworkInitialized=!1,this.formControl=null,this.debugOutput="",this.debug="",this.parentArray=null,this.isOrderable=!1,this.dynamicTitle=null,this.layoutNode=k(void 0),this.layoutIndex=k(void 0),this.dataIndex=k(void 0),this.widgetStyles=ee(void 0),this.defaultStyling={array:{},default:{fieldHtmlClass:"cssfw-form-control"},__themes__:[{name:"notheme",text:"None"}],__remove_item__:"cssfw-remove-item",__array_item_nonref__:{htmlClass:"cssfw-array-item-nonref"},__active__:{activeClass:"cssfw-active"},__array__:{htmlClass:"cssfw-array"},__control_label__:{labelHtmlClass:"cssfw-control-label"},__form_group__:{htmlClass:"cssfw-form-group"},__field_addon_left__:"cssfw-addon-left",__field_addon_right__:"cssfw-addon-right",__help_block__:"cssfw-help-block",__required_asterisk__:"cssfw-required-astersisk",__screen_reader__:"cssfw-screen-reader"};let t=this.cssFWService,e=this.jsfFLService.activeFramework.config||{};this.widgetStyles.set(Object.assign(this.defaultStyling,e.widgetstyles));let r=this.widgetStyles().__themes__[0],l=t.activeRequestedTheme||r.name;this.theme=this.options?.theme||l}ngOnDestroy(){this.frameworkThemeSubs?.unsubscribe(),this.frameworkThemeSubs=null}get showRemoveButton(){let t=this.layoutNode();return!this.options.removable||this.options.readonly||t.type==="$ref"?!1:t.recursiveReference?!0:!t.arrayItem||!this.parentArray||this.parentArray.items.length-1<=this.parentArray.options.minItems?!1:t.arrayItemType==="list"?!0:this.layoutIndex()[this.layoutIndex().length-1]===this.parentArray.items.length-2}ngOnInit(){let t=this.cssFWService;this.frameworkThemeSubs=t.frameworkTheme$.subscribe(e=>{this.theme=e,this.cdr.detectChanges()}),this.initializeFramework();let o=this.layoutNode();o.arrayItem&&o.type!=="$ref"&&(this.parentArray=this.jsf.getParentNode(this),this.parentArray&&(this.isOrderable=o.arrayItemType==="list"&&!this.options.readonly&&this.parentArray.options.orderable))}ngOnChanges(t){this.frameworkInitialized||this.initializeFramework(),this.isDynamicTitle&&this.updateTitle()}initializeFramework(){let t=this.layoutNode();if(t){if(this.options=(0,m.cloneDeep)(t.options),this.widgetLayoutNode=V($({},t),{options:(0,m.cloneDeep)(t.options)}),this.widgetOptions=this.widgetLayoutNode.options,this.formControl=this.jsf.getFormControl(this),this.options.isInputWidget=te(t.type,["button","checkbox","checkboxes-inline","checkboxes","color","date","datetime-local","datetime","email","file","hidden","image","integer","month","number","password","radio","radiobuttons","radios-inline","radios","range","reset","search","select","submit","tel","text","textarea","time","url","week"]),this.isDynamicTitle=this.options?.title&&/{{.+?}}/.test(this.options.title),this.dynamicTitle=this.options?.title,!["$ref","advancedfieldset","authfieldset","button","card","checkbox","expansion-panel","help","message","msg","section","submit","tabarray","tabs"].includes(t.type)&&/{{.+?}}/.test(this.widgetOptions.title||"")&&this.updateTitle(),this.options.title=this.setTitle(),this.widgetOptions.title&&(this.dynamicTitle=""),this.options.htmlClass=C(this.options.htmlClass,"schema-form-"+t.type),t.type==="array"?this.options.htmlClass=C(this.options.htmlClass,this.widgetStyles().__array__.htmlClass):t.arrayItem&&t.type!=="$ref"?this.options.htmlClass=C(this.options.htmlClass,this.widgetStyles().__array_item_nonref__.htmlClass):this.options.htmlClass=C(this.options.htmlClass,this.widgetStyles().__form_group__.htmlClass),this.widgetOptions.htmlClass="",this.options.labelHtmlClass=C(this.options.labelHtmlClass,this.widgetStyles().__control_label__.labelHtmlClass),this.widgetOptions.activeClass=C(this.widgetOptions.activeClass,this.widgetStyles().__active__.activeClass),this.options.fieldAddonLeft=this.options.fieldAddonLeft||this.options.prepend,this.options.fieldAddonRight=this.options.fieldAddonRight||this.options.append,this.options.title&&t.type!=="tab"&&!this.options.notitle&&this.options.required&&!this.options.title.includes("*")){let o=this.widgetStyles().__required_asterisk__||"text-danger";this.options.title+=`<strong class="${o}">◦</strong>`}if(t.type=="optionfieldset"&&(this.options.messageLocation="top"),this.applyCssClasses(t.type,this.widgetOptions,this.options.style),this.formControl&&(this.updateHelpBlock(this.formControl.status),this.formControl.statusChanges.subscribe(o=>this.updateHelpBlock(o)),this.options.debug)){let o=[];this.debugOutput=(0,m.map)(o,e=>JSON.stringify(e,null,2)).join(`
`)}this.updateTitle(),this.frameworkInitialized=!0}}updateHelpBlock(t){this.options.helpBlock=t==="INVALID"&&this.options.enableErrorState&&this.formControl.errors&&(this.formControl.dirty||this.options.feedbackOnRender)?this.jsf.formatErrors(this.formControl.errors,this.options.validationMessages):this.options.description||this.options.help||null}setTitle(){switch(this.layoutNode().type){case"button":case"checkbox":case"section":case"help":case"msg":case"submit":case"message":case"tabarray":case"tabs":case"$ref":return null;case"advancedfieldset":return this.widgetOptions.expandable=!0,this.widgetOptions.title="Advanced options",null;case"authfieldset":return this.widgetOptions.expandable=!0,this.widgetOptions.title="Authentication settings",null;case"fieldset":return this.widgetOptions.title=this.options.title,null;case"array":return this.widgetOptions.title=this.options.title,null;default:return this.widgetOptions.title=null,this.jsf.setItemTitle(this)}}updateTitle(){this.dynamicTitle=this.jsf.parseText(this.options?.title,this.jsf.getFormControlValue(this),this.jsf.getFormControlGroup(this)?.value,this.dataIndex()[this.dataIndex().length-1])}removeItem(){this.jsf.removeItem(this)}};n.\u0275fac=function(o){return new(o||n)},n.\u0275cmp=L({type:n,selectors:[["css-framework"]],inputs:{layoutNode:[1,"layoutNode"],layoutIndex:[1,"layoutIndex"],dataIndex:[1,"dataIndex"],widgetStyles:[1,"widgetStyles"]},outputs:{widgetStyles:"widgetStylesChange"},standalone:!1,features:[O],decls:12,vars:24,consts:[["type","button",3,"class"],[3,"class","sr-only","innerHTML"],[3,"class","innerHTML"],[3,"layoutNode","dataIndex","layoutIndex"],["aria-hidden","true",1,"form-control-feedback","glyphicon",3,"glyphicon-ok","glyphicon-remove"],["type","button",3,"click"],["aria-hidden","true"],[3,"innerHTML"],["aria-hidden","true",1,"form-control-feedback","glyphicon"]],template:function(o,e){if(o&1&&(d(0,"div"),p(1,ue,5,4,"button",0),p(2,me,2,1,"div"),p(3,fe,1,6,"label",1),p(4,ge,4,2,"p"),d(5,"div"),p(6,_e,1,3,"span",2),g(7,"select-widget-widget",3),p(8,be,1,3,"span",2),h(),p(9,ye,1,4,"span",4),p(10,ve,2,1,"div"),h(),p(11,we,4,1,"div")),o&2){let r,l,b,S;_((e.options==null?null:e.options.htmlClass)||""),F("has-feedback",(e.options==null?null:e.options.feedback)&&(e.options==null?null:e.options.isInputWidget)&&((e.formControl==null?null:e.formControl.dirty)||(e.options==null?null:e.options.feedbackOnRender)))("has-error",(e.options==null?null:e.options.enableErrorState)&&(e.formControl==null?null:e.formControl.errors)&&((e.formControl==null?null:e.formControl.dirty)||(e.options==null?null:e.options.feedbackOnRender)))("has-success",(e.options==null?null:e.options.enableSuccessState)&&!(e.formControl!=null&&e.formControl.errors)&&((e.formControl==null?null:e.formControl.dirty)||(e.options==null?null:e.options.feedbackOnRender))),z("data-bs-theme",e.theme)("data-theme",e.theme),a(),u(e.showRemoveButton?1:-1),a(),u((e.options==null?null:e.options.messageLocation)==="top"&&((r=e.layoutNode())==null?null:r.type)!=="array"?2:-1),a(),u(e.options!=null&&e.options.title&&((l=e.layoutNode())==null?null:l.type)!=="tab"&&((l=e.layoutNode())==null?null:l.type)!=="array"?3:-1),a(),u(((b=e.layoutNode())==null?null:b.type)==="submit"&&(!(e.jsf==null||e.jsf.formOptions==null)&&e.jsf.formOptions.fieldsRequired)?4:-1),a(),F("input-group",(e.options==null?null:e.options.fieldAddonLeft)||(e.options==null?null:e.options.fieldAddonRight)),a(),u(e.options!=null&&e.options.fieldAddonLeft?6:-1),a(),y("layoutNode",e.widgetLayoutNode)("dataIndex",e.dataIndex())("layoutIndex",e.layoutIndex()),a(),u(e.options!=null&&e.options.fieldAddonRight?8:-1),a(),u(e.options!=null&&e.options.feedback&&(e.options!=null&&e.options.isInputWidget)&&!(e.options!=null&&e.options.fieldAddonRight)&&!e.layoutNode().arrayItem&&(e.formControl!=null&&e.formControl.dirty||e.options!=null&&e.options.feedbackOnRender)?9:-1),a(),u((e.options==null?null:e.options.messageLocation)!=="top"&&((S=e.layoutNode())==null?null:S.type)!=="array"?10:-1),a(),u(e.debug&&e.debugOutput?11:-1)}},dependencies:[ie],styles:[`:host ::ng-deep .list-group-item .form-control-feedback{top:40px}:host ::ng-deep .checkbox,:host ::ng-deep .radio{margin-top:0;margin-bottom:0}:host ::ng-deep .checkbox-inline,:host ::ng-deep .checkbox-inline+.checkbox-inline,:host ::ng-deep .checkbox-inline+.radio-inline,:host ::ng-deep .radio-inline,:host ::ng-deep .radio-inline+.radio-inline,:host ::ng-deep .radio-inline+.checkbox-inline{margin-left:0;margin-right:10px}:host ::ng-deep .checkbox-inline:last-child,:host ::ng-deep .radio-inline:last-child{margin-right:0}:host ::ng-deep .ng-invalid.ng-touched{border:1px solid #f44336}.checkbox-inline,.checkbox-inline+.checkbox-inline,.checkbox-inline+.radio-inline,.radio-inline,.radio-inline+.radio-inline,.radio-inline+.checkbox-inline{margin-left:0;margin-right:10px}.checkbox-inline:last-child,.radio-inline:last-child{margin-right:0}.ng-invalid.ng-touched{border:1px solid #f44336}
`],encapsulation:2});let i=n;return i})(),ke=new G("CSS_FRAMEWORK_CFG"),se;(function(i){class n{}i.csscategories=n})(se||(se={}));var le=(()=>{let n=class n{};n.\u0275fac=function(o){return new(o||n)},n.\u0275mod=w({type:n}),n.\u0275inj=v({providers:[M,j,W,H],imports:[N,D,q]});let i=n;return i})(),re=(()=>{let n=class n extends E{constructor(t){super(),this.cssFWService=f(H),this.name="css",this.framework=P,this.name=t.name,this.text=t.text||this.name,this.stylesheets=t.stylesheets,this.scripts=t.scripts,this.config=t,this.widgets=t.widgets}getActiveTheme(){let t=this.cssFWService.getActiveRequestedTheme(),o=this.config?.widgetstyles?.__themes__,e=o&&o[0];if(t&&(e={name:t,text:t},o)){let r=o.filter(l=>l.name==t);e=r&&r[0]||e}return e}requestThemeChange(t){this.cssFWService.requestThemeChange(t)}registerTheme(t,o=!0){let r=(this.config?.widgetstyles?.__themes__||[]).filter(l=>t.name==l.name);if(r&&r[0]){if(o)return r[0].text=t.text,!0;if(!o)return!1}if(!r||r.length==0){let l=this.config;return l.widgetstyles=this.config.widgetstyles||{},l.widgetstyles.__themes__=l.widgetstyles.__themes__||[],l.widgetstyles.__themes__.push(t),!0}}unregisterTheme(t){let o=this.config?.widgetstyles?.__themes__,e=-1;return o&&(o.forEach((r,l)=>{t==r.name&&(e=l)}),e>=0)?(o.splice(e,1),!0):!1}getConfig(){return this.config}};n.\u0275fac=function(o){return new(o||n)(K(ke))},n.\u0275prov=T({token:n,factory:n.\u0275fac});let i=n;return i})();var Se=(()=>{let n=class n{constructor(){this.changeDetector=f(A),this.jsf=f(M),this.frameworkInitialized=!1,this.formControl=null,this.debugOutput="",this.debug="",this.parentArray=null,this.isOrderable=!1,this.layoutNode=k(void 0),this.layoutIndex=k(void 0),this.dataIndex=k(void 0)}ngOnInit(){}ngOnChanges(){}};n.\u0275fac=function(o){return new(o||n)},n.\u0275cmp=L({type:n,selectors:[["bootstrap-5-framework"]],inputs:{layoutNode:[1,"layoutNode"],layoutIndex:[1,"layoutIndex"],dataIndex:[1,"dataIndex"]},standalone:!1,features:[O],decls:2,vars:3,consts:[[3,"layoutNode","layoutIndex","dataIndex"]],template:function(o,e){o&1&&(d(0,"div"),g(1,"css-framework",0),h()),o&2&&(a(),y("layoutNode",e.layoutNode())("layoutIndex",e.layoutIndex())("dataIndex",e.dataIndex()))},dependencies:[P],styles:[`:host ::ng-deep .list-group-item .list-group-item-hb .form-control-feedback{top:40px}:host ::ng-deep .checkbox,:host ::ng-deep .radio{margin-top:0;margin-bottom:0}:host ::ng-deep .checkbox-inline,:host ::ng-deep .checkbox-inline+.checkbox-inline,:host ::ng-deep .checkbox-inline+.radio-inline,:host ::ng-deep .radio-inline,:host ::ng-deep .radio-inline+.radio-inline,:host ::ng-deep .radio-inline+.checkbox-inline{margin-left:0;margin-right:10px}:host ::ng-deep .checkbox-inline:last-child,:host ::ng-deep .radio-inline:last-child{margin-right:0}:host ::ng-deep .ng-invalid.ng-touched{border:1px solid #f44336}.input-group .form-control:first-child,.input-group-text:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-text:first-child{border-right:0}.input-group .form-control:last-child,.input-group-text:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-text:last-child{border-left:0}.input-group .form-control:not(:first-child):not(:last-child),.input-group-text:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.btn-close>span:first-child{display:none}
`],encapsulation:2});let i=n;return i})(),Ie={name:"bootstrap-5",text:"Bootstrap 5",scripts:["//cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"],stylesheets:["//cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"],widgetstyles:{__themes__:[{name:"bootstrap5_default",text:"Bootstrap5 default"},{name:"dark",text:"Dark"},{name:"light",text:"Light"}],$ref:{fieldHtmlClass:"btn btn-primary"},__array_item_nonref__:{htmlClass:"list-group-item list-group-item-hb"},__form_group__:{htmlClass:"form-group"},__control_label__:{labelHtmlClass:"control-label"},__active__:{activeClass:"active"},__required_asterisk__:"text-danger",__screen_reader__:"visually-hidden",__remove_item__:"btn-close float-end",__help_block__:"help-block grey-text small",__field_addon_left__:"input-group-text",__field_addon_right__:"input-group-text","alt-date":{},"alt-datetime":{},__array__:{htmlClass:"list-group list-group-hb"},array:{},authfieldset:{},advancedfieldset:{},button:{fieldHtmlClass:"btn btn-sm btn-primary"},checkbox:{fieldHtmlClass:"form-check-input"},checkboxes:{fieldHtmlClass:"form-check-input"},checkboxbuttons:{fieldHtmlClass:"visually-hidden",htmlClass:"btn-group",itemLabelHtmlClass:"btn"},"checkboxes-inline":{htmlClass:"form-check-input",itemLabelHtmlClass:"form-check-inline"},date:{},"datetime-local":{},fieldset:{},integer:{},number:{},optionfieldset:{},password:{},radiobuttons:{fieldHtmlClass:"visually-hidden",htmlClass:"btn-group",itemLabelHtmlClass:"btn"},radio:{fieldHtmlClass:"form-check-input"},radios:{fieldHtmlClass:"form-check-input"},"radios-inline":{htmlClass:"form-check form-check-inline",itemLabelHtmlClass:"form-check-label"},range:{},section:{},selectfieldset:{},select:{fieldHtmlClass:"form-select"},submit:{fieldHtmlClass:"btn btn-primary"},text:{},tabs:{labelHtmlClass:"nav nav-tabs",htmlClass:"tab-content",fieldHtmlClass:"tab-pane",widget_radioClass:"form-check-input"},tabarray:{labelHtmlClass:"nav nav-tabs",htmlClass:"tab-content",fieldHtmlClass:"tab-pane",widget_radioClass:"form-check-input"},"one-of":{labelHtmlClass:"nav nav-tabs",htmlClass:"tab-content",fieldHtmlClass:"tab-pane",widget_radioClass:"form-check-input"},textarea:{},default:{fieldHtmlClass:"form-control"}}},Me=(()=>{let n=class n extends re{constructor(){let t=f(H);super(Ie),this.framework=Se,this.cssFWService=t}};n.\u0275fac=function(o){return new(o||n)},n.\u0275prov=T({token:n,factory:n.\u0275fac});let i=n;return i})(),ae=(()=>{let n=class n{};n.\u0275fac=function(o){return new(o||n)},n.\u0275mod=w({type:n}),n.\u0275inj=v({providers:[M,j,W,{provide:E,useClass:Me,multi:!0}],imports:[N,D,q,le,N]});let i=n;return i})();var de=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=w({type:i});static \u0275inj=v({providers:[ne],imports:[ae,R]})}return i})();var tt=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=w({type:i});static \u0275inj=v({providers:[oe],imports:[R,de]})}return i})();export{tt as a};