',dropdown:'',p2dpad:''};function q(t,e){const n=t.createElementNS(K,"svg");return n.innerHTML=z[e],n}function $(t,e,n){t.insertBefore(e,t.children[n])}function G(t){t.parentElement&&t.parentElement.removeChild(t)}function Y(t){for(;t.children.length>0;)t.removeChild(t.children[0])}function W(t){return t.relatedTarget?t.relatedTarget:"explicitOriginalTarget"in t?t.explicitOriginalTarget:null}const Q=f("lbl");class X{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(Q()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("div");n.classList.add(Q("l")),_(e.props,"label",(e=>{a(e)?this.element.classList.add(Q(void 0,"nol")):(this.element.classList.remove(Q(void 0,"nol")),function(t){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])}(n),n.appendChild(function(t,e){const n=t.createDocumentFragment();return e.split("\n").map((e=>t.createTextNode(e))).forEach(((e,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(e)})),n}(t,e)))})),this.element.appendChild(n),this.labelElement=n;const i=t.createElement("div");i.classList.add(Q("v")),this.element.appendChild(i),this.valueElement=i}}class Z extends U{constructor(t,e){const n=e.valueController.viewProps;super(Object.assign(Object.assign({},e),{view:new X(t,{props:e.props,viewProps:n}),viewProps:n})),this.props=e.props,this.valueController=e.valueController,this.view.valueElement.appendChild(this.valueController.view.element)}}const J={id:"button",type:"blade",accept(t){const e=D,n=A(t,{title:e.required.string,view:e.required.constant("button"),label:e.optional.string});return n?{params:n}:null},controller:t=>new Z(t.document,{blade:t.blade,props:V.fromObject({label:t.params.label}),valueController:new P(t.document,{props:V.fromObject({title:t.params.title}),viewProps:t.viewProps})}),api:t=>t.controller instanceof Z&&t.controller.valueController instanceof P?new u(t.controller):null};class tt extends U{constructor(t){super(t),this.value=t.value}}function et(){return new V({positions:M([],{equals:l})})}class nt extends V{constructor(t){super(t)}static create(t){const e=V.createCore({completed:!0,expanded:t,expandedHeight:null,shouldFixHeight:!1,temporaryExpanded:null});return new nt(e)}get styleExpanded(){var t;return null!==(t=this.get("temporaryExpanded"))&&void 0!==t?t:this.get("expanded")}get styleHeight(){if(!this.styleExpanded)return"0";const t=this.get("expandedHeight");return this.get("shouldFixHeight")&&!a(t)?`${t}px`:"auto"}bindExpandedClass(t,e){const n=()=>{this.styleExpanded?t.classList.add(e):t.classList.remove(e)};_(this,"expanded",n),_(this,"temporaryExpanded",n)}cleanUpTransition(){this.set("shouldFixHeight",!1),this.set("expandedHeight",null),this.set("completed",!0)}}function it(t,e){e.style.height=t.styleHeight}function rt(t,e){t.value("expanded").emitter.on("beforechange",(()=>{if(t.set("completed",!1),a(t.get("expandedHeight"))){const n=function(t,e){let n=0;return function(t,e){const n=t.style.transition;t.style.transition="none",e(),t.style.transition=n}(e,(()=>{t.set("expandedHeight",null),t.set("temporaryExpanded",!0),n=e.clientHeight,t.set("temporaryExpanded",null)})),n}(t,e);n>0&&t.set("expandedHeight",n)}t.set("shouldFixHeight",!0)})),t.emitter.on("change",(()=>{it(t,e)})),it(t,e),e.addEventListener("transitionend",(e=>{"height"===e.propertyName&&t.cleanUpTransition()}))}class ot extends e{constructor(t,e){super(t),this.rackApi_=e}}class st{constructor(t){this.emitter=new v,this.items_=[],this.cache_=new Set,this.onSubListAdd_=this.onSubListAdd_.bind(this),this.onSubListRemove_=this.onSubListRemove_.bind(this),this.extract_=t}get items(){return this.items_}allItems(){return Array.from(this.cache_)}find(t){for(const e of this.allItems())if(t(e))return e;return null}includes(t){return this.cache_.has(t)}add(t,e){if(this.includes(t))throw d.shouldNeverHappen();const n=void 0!==e?e:this.items_.length;this.items_.splice(n,0,t),this.cache_.add(t);const i=this.extract_(t);i&&(i.emitter.on("add",this.onSubListAdd_),i.emitter.on("remove",this.onSubListRemove_),i.allItems().forEach((t=>{this.cache_.add(t)}))),this.emitter.emit("add",{index:n,item:t,root:this,target:this})}remove(t){const e=this.items_.indexOf(t);if(e<0)return;this.items_.splice(e,1),this.cache_.delete(t);const n=this.extract_(t);n&&(n.emitter.off("add",this.onSubListAdd_),n.emitter.off("remove",this.onSubListRemove_)),this.emitter.emit("remove",{index:e,item:t,root:this,target:this})}onSubListAdd_(t){this.cache_.add(t.item),this.emitter.emit("add",{index:t.index,item:t.item,root:this,target:t.target})}onSubListRemove_(t){this.cache_.delete(t.item),this.emitter.emit("remove",{index:t.index,item:t.item,root:this,target:t.target})}}class at extends e{constructor(t){super(t),this.onBindingChange_=this.onBindingChange_.bind(this),this.emitter_=new v,this.controller_.binding.emitter.on("change",this.onBindingChange_)}get label(){return this.controller_.props.get("label")}set label(t){this.controller_.props.set("label",t)}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}refresh(){this.controller_.binding.read()}onBindingChange_(t){const e=t.sender.target.read();this.emitter_.emit("change",{event:new i(this,e,this.controller_.binding.target.presetKey,t.options.last)})}}class lt extends Z{constructor(t,e){super(t,e),this.binding=e.binding}}class pt extends e{constructor(t){super(t),this.onBindingUpdate_=this.onBindingUpdate_.bind(this),this.emitter_=new v,this.controller_.binding.emitter.on("update",this.onBindingUpdate_)}get label(){return this.controller_.props.get("label")}set label(t){this.controller_.props.set("label",t)}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}refresh(){this.controller_.binding.read()}onBindingUpdate_(t){const e=t.sender.target.read();this.emitter_.emit("update",{event:new r(this,e,this.controller_.binding.target.presetKey)})}}class ct extends Z{constructor(t,e){super(t,e),this.binding=e.binding,this.viewProps.bindDisabled(this.binding.ticker),this.viewProps.handleDispose((()=>{this.binding.dispose()}))}}function dt(t){return t instanceof vt?t.apiSet_:t instanceof ot?t.rackApi_.apiSet_:null}function ht(t,e){const n=t.find((t=>t.controller_===e));if(!n)throw d.shouldNeverHappen();return n}function ut(t,e,n){if(!h.isBindable(t))throw d.notBindable();return new h(t,e,n)}class vt extends e{constructor(t,e){super(t),this.onRackAdd_=this.onRackAdd_.bind(this),this.onRackRemove_=this.onRackRemove_.bind(this),this.onRackInputChange_=this.onRackInputChange_.bind(this),this.onRackMonitorUpdate_=this.onRackMonitorUpdate_.bind(this),this.emitter_=new v,this.apiSet_=new st(dt),this.pool_=e;const n=this.controller_.rack;n.emitter.on("add",this.onRackAdd_),n.emitter.on("remove",this.onRackRemove_),n.emitter.on("inputchange",this.onRackInputChange_),n.emitter.on("monitorupdate",this.onRackMonitorUpdate_),n.children.forEach((t=>{this.setUpApi_(t)}))}get children(){return this.controller_.rack.children.map((t=>ht(this.apiSet_,t)))}addInput(t,e,n){const i=null!=n?n:{},r=this.pool_.createInput(this.controller_.view.element.ownerDocument,ut(t,e,i.presetKey),i),o=new at(r);return this.add(o,i.index)}addMonitor(t,e,n){const i=null!=n?n:{},r=this.pool_.createMonitor(this.controller_.view.element.ownerDocument,ut(t,e),i),o=new pt(r);return this.add(o,i.index)}addFolder(t){return function(t,e){return t.addBlade(Object.assign(Object.assign({},e),{view:"folder"}))}(this,t)}addButton(t){return function(t,e){return t.addBlade(Object.assign(Object.assign({},e),{view:"button"}))}(this,t)}addSeparator(t){return function(t,e){return t.addBlade(Object.assign(Object.assign({},null!=e?e:{}),{view:"separator"}))}(this,t)}addTab(t){return function(t,e){return t.addBlade(Object.assign(Object.assign({},e),{view:"tab"}))}(this,t)}add(t,e){this.controller_.rack.add(t.controller_,e);const n=this.apiSet_.find((e=>e.controller_===t.controller_));return n&&this.apiSet_.remove(n),this.apiSet_.add(t),t}remove(t){this.controller_.rack.remove(t.controller_)}addBlade(t){const e=this.pool_.createBlade(this.controller_.view.element.ownerDocument,t),n=this.pool_.createBladeApi(e);return this.add(n,t.index)}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}setUpApi_(t){this.apiSet_.find((e=>e.controller_===t))||this.apiSet_.add(this.pool_.createBladeApi(t))}onRackAdd_(t){this.setUpApi_(t.bladeController)}onRackRemove_(t){if(t.isRoot){const e=ht(this.apiSet_,t.bladeController);this.apiSet_.remove(e)}}onRackInputChange_(t){const e=t.bladeController;if(e instanceof lt){const n=ht(this.apiSet_,e),r=e.binding;this.emitter_.emit("change",{event:new i(n,r.target.read(),r.target.presetKey,t.options.last)})}else if(e instanceof tt){const n=ht(this.apiSet_,e);this.emitter_.emit("change",{event:new i(n,e.value.rawValue,void 0,t.options.last)})}}onRackMonitorUpdate_(t){if(!(t.bladeController instanceof ct))throw d.shouldNeverHappen();const e=ht(this.apiSet_,t.bladeController),n=t.bladeController.binding;this.emitter_.emit("update",{event:new r(e,n.target.read(),n.target.presetKey)})}}class mt extends ot{constructor(t,e){super(t,new vt(t.rackController,e)),this.emitter_=new v,this.controller_.foldable.value("expanded").emitter.on("change",(t=>{this.emitter_.emit("fold",{event:new o(this,t.sender.rawValue)})})),this.rackApi_.on("change",(t=>{this.emitter_.emit("change",{event:t})})),this.rackApi_.on("update",(t=>{this.emitter_.emit("update",{event:t})}))}get expanded(){return this.controller_.foldable.get("expanded")}set expanded(t){this.controller_.foldable.set("expanded",t)}get title(){return this.controller_.props.get("title")}set title(t){this.controller_.props.set("title",t)}get children(){return this.rackApi_.children}addInput(t,e,n){return this.rackApi_.addInput(t,e,n)}addMonitor(t,e,n){return this.rackApi_.addMonitor(t,e,n)}addFolder(t){return this.rackApi_.addFolder(t)}addButton(t){return this.rackApi_.addButton(t)}addSeparator(t){return this.rackApi_.addSeparator(t)}addTab(t){return this.rackApi_.addTab(t)}add(t,e){return this.rackApi_.add(t,e)}remove(t){this.rackApi_.remove(t)}addBlade(t){return this.rackApi_.addBlade(t)}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}}class ft extends U{constructor(t){super({blade:t.blade,view:t.view,viewProps:t.rackController.viewProps}),this.rackController=t.rackController}}class bt{constructor(t,e){const n=f(e.viewName);this.element=t.createElement("div"),this.element.classList.add(n()),e.viewProps.bindClassModifiers(this.element)}}function gt(t){return t instanceof yt?t.rack:t instanceof ft?t.rackController.rack:null}function _t(t){const e=gt(t);return e?e.bcSet_:null}class wt{constructor(t){var e,n;this.onBladePositionsChange_=this.onBladePositionsChange_.bind(this),this.onSetAdd_=this.onSetAdd_.bind(this),this.onSetRemove_=this.onSetRemove_.bind(this),this.onChildDispose_=this.onChildDispose_.bind(this),this.onChildPositionsChange_=this.onChildPositionsChange_.bind(this),this.onChildInputChange_=this.onChildInputChange_.bind(this),this.onChildMonitorUpdate_=this.onChildMonitorUpdate_.bind(this),this.onChildValueChange_=this.onChildValueChange_.bind(this),this.onChildViewPropsChange_=this.onChildViewPropsChange_.bind(this),this.onDescendantLayout_=this.onDescendantLayout_.bind(this),this.onDescendantInputChange_=this.onDescendantInputChange_.bind(this),this.onDescendantMonitorUpdate_=this.onDescendantMonitorUpdate_.bind(this),this.emitter=new v,this.blade_=null!==(e=t.blade)&&void 0!==e?e:null,null===(n=this.blade_)||void 0===n||n.value("positions").emitter.on("change",this.onBladePositionsChange_),this.viewProps=t.viewProps,this.bcSet_=new st(_t),this.bcSet_.emitter.on("add",this.onSetAdd_),this.bcSet_.emitter.on("remove",this.onSetRemove_)}get children(){return this.bcSet_.items}add(t,e){var n;null===(n=t.parent)||void 0===n||n.remove(t),p(t,"parent")?t.parent=this:(t.parent_=this,T({key:"parent",target:"BladeController",place:"BladeRack.add"})),this.bcSet_.add(t,e)}remove(t){p(t,"parent")?t.parent=null:(t.parent_=null,T({key:"parent",target:"BladeController",place:"BladeRack.remove"})),this.bcSet_.remove(t)}find(t){return this.bcSet_.allItems().filter((e=>e instanceof t))}onSetAdd_(t){this.updatePositions_();const e=t.target===t.root;if(this.emitter.emit("add",{bladeController:t.item,index:t.index,isRoot:e,sender:this}),!e)return;const n=t.item;if(n.viewProps.emitter.on("change",this.onChildViewPropsChange_),n.blade.value("positions").emitter.on("change",this.onChildPositionsChange_),n.viewProps.handleDispose(this.onChildDispose_),n instanceof lt)n.binding.emitter.on("change",this.onChildInputChange_);else if(n instanceof ct)n.binding.emitter.on("update",this.onChildMonitorUpdate_);else if(n instanceof tt)n.value.emitter.on("change",this.onChildValueChange_);else{const t=gt(n);if(t){const e=t.emitter;e.on("layout",this.onDescendantLayout_),e.on("inputchange",this.onDescendantInputChange_),e.on("monitorupdate",this.onDescendantMonitorUpdate_)}}}onSetRemove_(t){this.updatePositions_();const e=t.target===t.root;if(this.emitter.emit("remove",{bladeController:t.item,isRoot:e,sender:this}),!e)return;const n=t.item;if(n instanceof lt)n.binding.emitter.off("change",this.onChildInputChange_);else if(n instanceof ct)n.binding.emitter.off("update",this.onChildMonitorUpdate_);else if(n instanceof tt)n.value.emitter.off("change",this.onChildValueChange_);else{const t=gt(n);if(t){const e=t.emitter;e.off("layout",this.onDescendantLayout_),e.off("inputchange",this.onDescendantInputChange_),e.off("monitorupdate",this.onDescendantMonitorUpdate_)}}}updatePositions_(){const t=this.bcSet_.items.filter((t=>!t.viewProps.get("hidden"))),e=t[0],n=t[t.length-1];this.bcSet_.items.forEach((t=>{const i=[];t===e&&(i.push("first"),this.blade_&&!this.blade_.get("positions").includes("veryfirst")||i.push("veryfirst")),t===n&&(i.push("last"),this.blade_&&!this.blade_.get("positions").includes("verylast")||i.push("verylast")),t.blade.set("positions",i)}))}onChildPositionsChange_(){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onChildViewPropsChange_(t){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onChildDispose_(){this.bcSet_.items.filter((t=>t.viewProps.get("disposed"))).forEach((t=>{this.bcSet_.remove(t)}))}onChildInputChange_(t){const e=function(t,e){for(let n=0;n{for(let t=this.rack.children.length-1;t>=0;t--){this.rack.children[t].viewProps.set("disposed",!0)}}))}onRackAdd_(t){t.isRoot&&$(this.view.element,t.bladeController.view.element,t.index)}onRackRemove_(t){t.isRoot&&G(t.bladeController.view.element)}}const xt=f("cnt");class Ct{constructor(t,e){var n;this.className_=f(null!==(n=e.viewName)&&void 0!==n?n:"fld"),this.element=t.createElement("div"),this.element.classList.add(this.className_(),xt()),e.viewProps.bindClassModifiers(this.element),this.foldable_=e.foldable,this.foldable_.bindExpandedClass(this.element,this.className_(void 0,"expanded")),_(this.foldable_,"completed",w(this.element,this.className_(void 0,"cpl")));const i=t.createElement("button");i.classList.add(this.className_("b")),_(e.props,"title",(t=>{a(t)?this.element.classList.add(this.className_(void 0,"not")):this.element.classList.remove(this.className_(void 0,"not"))})),e.viewProps.bindDisabled(i),this.element.appendChild(i),this.buttonElement=i;const r=t.createElement("div");r.classList.add(this.className_("i")),this.element.appendChild(r);const o=t.createElement("div");o.classList.add(this.className_("t")),y(e.props.value("title"),o),this.buttonElement.appendChild(o),this.titleElement=o;const s=t.createElement("div");s.classList.add(this.className_("m")),this.buttonElement.appendChild(s);const l=e.containerElement;l.classList.add(this.className_("c")),this.element.appendChild(l),this.containerElement=l}}class Pt extends ft{constructor(t,e){var n;const i=nt.create(null===(n=e.expanded)||void 0===n||n),r=new yt(t,{blade:e.blade,root:e.root,viewProps:e.viewProps});super(Object.assign(Object.assign({},e),{rackController:r,view:new Ct(t,{containerElement:r.view.element,foldable:i,props:e.props,viewName:e.root?"rot":void 0,viewProps:e.viewProps})})),this.onTitleClick_=this.onTitleClick_.bind(this),this.props=e.props,this.foldable=i,rt(this.foldable,this.view.containerElement),this.rackController.rack.emitter.on("add",(()=>{this.foldable.cleanUpTransition()})),this.rackController.rack.emitter.on("remove",(()=>{this.foldable.cleanUpTransition()})),this.view.buttonElement.addEventListener("click",this.onTitleClick_)}get document(){return this.view.element.ownerDocument}onTitleClick_(){this.foldable.set("expanded",!this.foldable.get("expanded"))}}const kt={id:"folder",type:"blade",accept(t){const e=D,n=A(t,{title:e.required.string,view:e.required.constant("folder"),expanded:e.optional.boolean});return n?{params:n}:null},controller:t=>new Pt(t.document,{blade:t.blade,expanded:t.params.expanded,props:V.fromObject({title:t.params.title}),viewProps:t.viewProps}),api:t=>t.controller instanceof Pt?new mt(t.controller,t.pool):null};class Et extends tt{constructor(t,e){const n=e.valueController.viewProps;super(Object.assign(Object.assign({},e),{value:e.valueController.value,view:new X(t,{props:e.props,viewProps:n}),viewProps:n})),this.props=e.props,this.valueController=e.valueController,this.view.valueElement.appendChild(this.valueController.view.element)}}class Mt extends e{}const Vt=f("spr");class St{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(Vt()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("hr");n.classList.add(Vt("r")),this.element.appendChild(n)}}class Lt extends U{constructor(t,e){super(Object.assign(Object.assign({},e),{view:new St(t,{viewProps:e.viewProps})}))}}const Dt={id:"separator",type:"blade",accept(t){const e=A(t,{view:D.required.constant("separator")});return e?{params:e}:null},controller:t=>new Lt(t.document,{blade:t.blade,viewProps:t.viewProps}),api:t=>t.controller instanceof Lt?new Mt(t.controller):null},At=f("tbi");class Tt{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(At()),e.viewProps.bindClassModifiers(this.element),_(e.props,"selected",(t=>{t?this.element.classList.add(At(void 0,"sel")):this.element.classList.remove(At(void 0,"sel"))}));const n=t.createElement("button");n.classList.add(At("b")),e.viewProps.bindDisabled(n),this.element.appendChild(n),this.buttonElement=n;const i=t.createElement("div");i.classList.add(At("t")),y(e.props.value("title"),i),this.buttonElement.appendChild(i),this.titleElement=i}}class jt{constructor(t,e){this.emitter=new v,this.onClick_=this.onClick_.bind(this),this.props=e.props,this.viewProps=e.viewProps,this.view=new Tt(t,{props:e.props,viewProps:e.viewProps}),this.view.buttonElement.addEventListener("click",this.onClick_)}onClick_(){this.emitter.emit("click",{sender:this})}}class Rt{constructor(t,e){this.onItemClick_=this.onItemClick_.bind(this),this.ic_=new jt(t,{props:e.itemProps,viewProps:N.create()}),this.ic_.emitter.on("click",this.onItemClick_),this.cc_=new yt(t,{blade:et(),viewProps:N.create()}),this.props=e.props,_(this.props,"selected",(t=>{this.itemController.props.set("selected",t),this.contentController.viewProps.set("hidden",!t)}))}get itemController(){return this.ic_}get contentController(){return this.cc_}onItemClick_(){this.props.set("selected",!0)}}class Ot{constructor(t,e){this.controller_=t,this.rackApi_=e}get title(){var t;return null!==(t=this.controller_.itemController.props.get("title"))&&void 0!==t?t:""}set title(t){this.controller_.itemController.props.set("title",t)}get selected(){return this.controller_.props.get("selected")}set selected(t){this.controller_.props.set("selected",t)}get children(){return this.rackApi_.children}addButton(t){return this.rackApi_.addButton(t)}addFolder(t){return this.rackApi_.addFolder(t)}addSeparator(t){return this.rackApi_.addSeparator(t)}addTab(t){return this.rackApi_.addTab(t)}add(t,e){this.rackApi_.add(t,e)}remove(t){this.rackApi_.remove(t)}addInput(t,e,n){return this.rackApi_.addInput(t,e,n)}addMonitor(t,e,n){return this.rackApi_.addMonitor(t,e,n)}addBlade(t){return this.rackApi_.addBlade(t)}}class Nt extends ot{constructor(t,e){super(t,new vt(t.rackController,e)),this.onPageAdd_=this.onPageAdd_.bind(this),this.onPageRemove_=this.onPageRemove_.bind(this),this.onSelect_=this.onSelect_.bind(this),this.emitter_=new v,this.pageApiMap_=new Map,this.rackApi_.on("change",(t=>{this.emitter_.emit("change",{event:t})})),this.rackApi_.on("update",(t=>{this.emitter_.emit("update",{event:t})})),this.controller_.tab.selectedIndex.emitter.on("change",this.onSelect_),this.controller_.pageSet.emitter.on("add",this.onPageAdd_),this.controller_.pageSet.emitter.on("remove",this.onPageRemove_),this.controller_.pageSet.items.forEach((t=>{this.setUpPageApi_(t)}))}get pages(){return this.controller_.pageSet.items.map((t=>{const e=this.pageApiMap_.get(t);if(!e)throw d.shouldNeverHappen();return e}))}addPage(t){const e=new Rt(this.controller_.view.element.ownerDocument,{itemProps:V.fromObject({selected:!1,title:t.title}),props:V.fromObject({selected:!1})});this.controller_.add(e,t.index);const n=this.pageApiMap_.get(e);if(!n)throw d.shouldNeverHappen();return n}removePage(t){this.controller_.remove(t)}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}setUpPageApi_(t){const e=this.rackApi_.apiSet_.find((e=>e.controller_===t.contentController));if(!e)throw d.shouldNeverHappen();const n=new Ot(t,e);this.pageApiMap_.set(t,n)}onPageAdd_(t){this.setUpPageApi_(t.item)}onPageRemove_(t){if(!this.pageApiMap_.get(t.item))throw d.shouldNeverHappen();this.pageApiMap_.delete(t.item)}onSelect_(t){this.emitter_.emit("select",{event:new s(this,t.rawValue)})}}class Ft{constructor(){this.onItemSelectedChange_=this.onItemSelectedChange_.bind(this),this.empty=M(!0),this.selectedIndex=M(-1),this.items_=[]}add(t,e){this.items_.splice(null!=e?e:this.items_.length,0,t),t.emitter.on("change",this.onItemSelectedChange_),this.keepSelection_()}remove(t){const e=this.items_.indexOf(t);e<0||(this.items_.splice(e,1),t.emitter.off("change",this.onItemSelectedChange_),this.keepSelection_())}keepSelection_(){if(0===this.items_.length)return this.selectedIndex.rawValue=-1,void(this.empty.rawValue=!0);const t=this.items_.findIndex((t=>t.rawValue));t<0?(this.items_.forEach(((t,e)=>{t.rawValue=0===e})),this.selectedIndex.rawValue=0):(this.items_.forEach(((e,n)=>{e.rawValue=n===t})),this.selectedIndex.rawValue=t),this.empty.rawValue=!1}onItemSelectedChange_(t){if(t.rawValue){const e=this.items_.findIndex((e=>e===t.sender));this.items_.forEach(((t,n)=>{t.rawValue=n===e})),this.selectedIndex.rawValue=e}else this.keepSelection_()}}const It=f("tab");class Ut{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(It(),xt()),e.viewProps.bindClassModifiers(this.element),g(e.empty,w(this.element,It(void 0,"nop")));const n=t.createElement("div");n.classList.add(It("t")),this.element.appendChild(n),this.itemsElement=n;const i=t.createElement("div");i.classList.add(It("i")),this.element.appendChild(i);const r=e.contentsElement;r.classList.add(It("c")),this.element.appendChild(r),this.contentsElement=r}}class Kt extends ft{constructor(t,e){const n=new yt(t,{blade:e.blade,viewProps:e.viewProps}),i=new Ft;super({blade:e.blade,rackController:n,view:new Ut(t,{contentsElement:n.view.element,empty:i.empty,viewProps:e.viewProps})}),this.onPageAdd_=this.onPageAdd_.bind(this),this.onPageRemove_=this.onPageRemove_.bind(this),this.pageSet_=new st((()=>null)),this.pageSet_.emitter.on("add",this.onPageAdd_),this.pageSet_.emitter.on("remove",this.onPageRemove_),this.tab=i}get pageSet(){return this.pageSet_}add(t,e){this.pageSet_.add(t,e)}remove(t){this.pageSet_.remove(this.pageSet_.items[t])}onPageAdd_(t){const e=t.item;$(this.view.itemsElement,e.itemController.view.element,t.index),e.itemController.viewProps.set("parent",this.viewProps),this.rackController.rack.add(e.contentController,t.index),this.tab.add(e.props.value("selected"))}onPageRemove_(t){const e=t.item;G(e.itemController.view.element),e.itemController.viewProps.set("parent",null),this.rackController.rack.remove(e.contentController),this.tab.remove(e.props.value("selected"))}}const Bt={id:"tab",type:"blade",accept(t){const e=D,n=A(t,{pages:e.required.array(e.required.object({title:e.required.string})),view:e.required.constant("tab")});return n&&0!==n.pages.length?{params:n}:null},controller(t){const e=new Kt(t.document,{blade:t.blade,viewProps:t.viewProps});return t.params.pages.forEach((n=>{const i=new Rt(t.document,{itemProps:V.fromObject({selected:!1,title:n.title}),props:V.fromObject({selected:!1})});e.add(i)})),e},api:t=>t.controller instanceof Kt?new Nt(t.controller,t.pool):null};class Ht{constructor(){this.disabled=!1,this.emitter=new v}dispose(){}tick(){this.disabled||this.emitter.emit("tick",{sender:this})}}class zt{constructor(t,e){this.disabled_=!1,this.timerId_=null,this.onTick_=this.onTick_.bind(this),this.doc_=t,this.emitter=new v,this.interval_=e,this.setTimer_()}get disabled(){return this.disabled_}set disabled(t){this.disabled_=t,this.disabled_?this.clearTimer_():this.setTimer_()}dispose(){this.clearTimer_()}clearTimer_(){if(null===this.timerId_)return;const t=this.doc_.defaultView;t&&t.clearInterval(this.timerId_),this.timerId_=null}setTimer_(){if(this.clearTimer_(),this.interval_<=0)return;const t=this.doc_.defaultView;t&&(this.timerId_=t.setInterval(this.onTick_,this.interval_))}onTick_(){this.disabled_||this.emitter.emit("tick",{sender:this})}}class qt{constructor(t){this.onValueChange_=this.onValueChange_.bind(this),this.reader=t.reader,this.writer=t.writer,this.emitter=new v,this.value=t.value,this.value.emitter.on("change",this.onValueChange_),this.target=t.target,this.read()}read(){const t=this.target.read();void 0!==t&&(this.value.rawValue=this.reader(t))}write_(t){this.writer(this.target,t)}onValueChange_(t){this.write_(t.rawValue),this.emitter.emit("change",{options:t.options,rawValue:t.rawValue,sender:this})}}function $t(t,e){for(;t.lengtht.length?n.splice(0,n.length-t.length):$t(n,t.length),n}(e,n),this.emitter.emit("update",{rawValue:n,sender:this})}onTick_(t){this.read()}}class Qt{constructor(t){this.constraints=t}constrain(t){return this.constraints.reduce(((t,e)=>e.constrain(t)),t)}}function Xt(t,e){if(t instanceof e)return t;if(t instanceof Qt){const n=t.constraints.reduce(((t,n)=>t||(n instanceof e?n:null)),null);if(n)return n}return null}class Zt{constructor(t){this.values=V.fromObject({max:t.max,min:t.min})}constrain(t){const e=this.values.get("max"),n=this.values.get("min");return Math.min(Math.max(t,n),e)}}class Jt{constructor(t){this.values=V.fromObject({options:t})}get options(){return this.values.get("options")}constrain(t){const e=this.values.get("options");if(0===e.length)return t;return e.filter((e=>e.value===t)).length>0?t:e[0].value}}class te{constructor(t){this.values=V.fromObject({max:t.max,min:t.min})}get maxValue(){return this.values.get("max")}get minValue(){return this.values.get("min")}constrain(t){const e=this.values.get("max"),n=this.values.get("min");let i=t;return a(n)||(i=Math.max(i,n)),a(e)||(i=Math.min(i,e)),i}}class ee{constructor(t,e=0){this.step=t,this.origin=e}constrain(t){const e=this.origin%this.step;return e+Math.round((t-e)/this.step)*this.step}}const ne=f("lst");class ie{constructor(t,e){this.onValueChange_=this.onValueChange_.bind(this),this.props_=e.props,this.element=t.createElement("div"),this.element.classList.add(ne()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("select");n.classList.add(ne("s")),_(this.props_,"options",(e=>{Y(n),e.forEach(((e,i)=>{const r=t.createElement("option");r.dataset.index=String(i),r.textContent=e.text,r.value=String(e.value),n.appendChild(r)}))})),e.viewProps.bindDisabled(n),this.element.appendChild(n),this.selectElement=n;const i=t.createElement("div");i.classList.add(ne("m")),i.appendChild(q(t,"dropdown")),this.element.appendChild(i),e.value.emitter.on("change",this.onValueChange_),this.value_=e.value,this.update_()}update_(){this.selectElement.value=String(this.value_.rawValue)}onValueChange_(){this.update_()}}class re{constructor(t,e){this.onSelectChange_=this.onSelectChange_.bind(this),this.props=e.props,this.value=e.value,this.viewProps=e.viewProps,this.view=new ie(t,{props:this.props,value:this.value,viewProps:this.viewProps}),this.view.selectElement.addEventListener("change",this.onSelectChange_)}onSelectChange_(t){const e=t.currentTarget.selectedOptions.item(0);if(!e)return;const n=Number(e.dataset.index);this.value.rawValue=this.props.get("options")[n].value}}const oe=f("pop");class se{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(oe()),e.viewProps.bindClassModifiers(this.element),g(e.shows,w(this.element,oe(void 0,"v")))}}class ae{constructor(t,e){this.shows=M(!1),this.viewProps=e.viewProps,this.view=new se(t,{shows:this.shows,viewProps:this.viewProps})}}const le=f("txt");class pe{constructor(t,e){this.onChange_=this.onChange_.bind(this),this.element=t.createElement("div"),this.element.classList.add(le()),e.viewProps.bindClassModifiers(this.element),this.props_=e.props,this.props_.emitter.on("change",this.onChange_);const n=t.createElement("input");n.classList.add(le("i")),n.type="text",e.viewProps.bindDisabled(n),this.element.appendChild(n),this.inputElement=n,e.value.emitter.on("change",this.onChange_),this.value_=e.value,this.refresh()}refresh(){const t=this.props_.get("formatter");this.inputElement.value=t(this.value_.rawValue)}onChange_(){this.refresh()}}class ce{constructor(t,e){this.onInputChange_=this.onInputChange_.bind(this),this.parser_=e.parser,this.props=e.props,this.value=e.value,this.viewProps=e.viewProps,this.view=new pe(t,{props:e.props,value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_)}onInputChange_(t){const e=this.parser_(t.currentTarget.value);a(e)||(this.value.rawValue=e),this.view.refresh()}}function de(t){return"false"!==t&&!!t}function he(t){return function(t){return String(t)}(t)}class ue{constructor(t){this.text=t}evaluate(){return Number(this.text)}toString(){return this.text}}const ve={"**":(t,e)=>Math.pow(t,e),"*":(t,e)=>t*e,"/":(t,e)=>t/e,"%":(t,e)=>t%e,"+":(t,e)=>t+e,"-":(t,e)=>t-e,"<<":(t,e)=>t<>":(t,e)=>t>>e,">>>":(t,e)=>t>>>e,"&":(t,e)=>t&e,"^":(t,e)=>t^e,"|":(t,e)=>t|e};class me{constructor(t,e,n){this.left=e,this.operator=t,this.right=n}evaluate(){const t=ve[this.operator];if(!t)throw new Error(`unexpected binary operator: '${this.operator}`);return t(this.left.evaluate(),this.right.evaluate())}toString(){return["b(",this.left.toString(),this.operator,this.right.toString(),")"].join(" ")}}const fe={"+":t=>t,"-":t=>-t,"~":t=>~t};class be{constructor(t,e){this.operator=t,this.expression=e}evaluate(){const t=fe[this.operator];if(!t)throw new Error(`unexpected unary operator: '${this.operator}`);return t(this.expression.evaluate())}toString(){return["u(",this.operator,this.expression.toString(),")"].join(" ")}}function ge(t){return(e,n)=>{for(let i=0;ie.startsWith(t,n)))[0];return i?(n+=i.length,{cursor:n+=_e(e,n).length,operator:i}):null}const Ve=[["**"],["*","/","%"],["+","-"],["<<",">>>",">>"],["&"],["^"],["|"]].reduce(((t,e)=>function(t,e){return(n,i)=>{const r=t(n,i);if(!r)return null;i=r.cursor;let o=r.evaluable;for(;;){const r=Me(e,n,i);if(!r)break;const s=t(n,i=r.cursor);if(!s)return null;i=s.cursor,o=new me(r.operator,o,s.evaluable)}return o?{cursor:i,evaluable:o}:null}}(t,e)),(function t(e,n){const i=Ee(e,n);if(i)return i;const r=e.substr(n,1);if("+"!==r&&"-"!==r&&"~"!==r)return null;const o=t(e,n+=r.length);return o?{cursor:n=o.cursor,evaluable:new be(r,o.evaluable)}:null}));function Se(t,e){return e+=_e(t,e).length,Ve(t,e)}function Le(t){var e;const n=function(t){const e=Se(t,0);return e?e.cursor+_e(t,e.cursor).length!==t.length?null:e.evaluable:null}(t);return null!==(e=null==n?void 0:n.evaluate())&&void 0!==e?e:null}function De(t){if("number"==typeof t)return t;if("string"==typeof t){const e=Le(t);if(!a(e))return e}return 0}function Ae(t){return String(t)}function Te(t){return e=>e.toFixed(Math.max(Math.min(t,20),0))}const je=Te(0);function Re(t){return je(t)+"%"}function Oe(t){return String(t)}function Ne(t){return t}function Fe({primary:t,secondary:e,forward:n,backward:i}){let r=!1;function o(t){r||(r=!0,t(),r=!1)}t.emitter.on("change",(i=>{o((()=>{e.setRawValue(n(t,e),i.options)}))})),e.emitter.on("change",(r=>{o((()=>{t.setRawValue(i(t,e),r.options)})),o((()=>{e.setRawValue(n(t,e),r.options)}))})),o((()=>{e.setRawValue(n(t,e),{forceEmit:!1,last:!0})}))}function Ie(t,e){const n=t*(e.altKey?.1:1)*(e.shiftKey?10:1);return e.upKey?+n:e.downKey?-n:0}function Ue(t){return{altKey:t.altKey,downKey:"ArrowDown"===t.key,shiftKey:t.shiftKey,upKey:"ArrowUp"===t.key}}function Ke(t){return{altKey:t.altKey,downKey:"ArrowLeft"===t.key,shiftKey:t.shiftKey,upKey:"ArrowRight"===t.key}}function Be(t){return function(t){return"ArrowUp"===t||"ArrowDown"===t}(t)||"ArrowLeft"===t||"ArrowRight"===t}function He(t,e){var n,i;const r=e.ownerDocument.defaultView,o=e.getBoundingClientRect();return{x:t.pageX-((null!==(n=r&&r.scrollX)&&void 0!==n?n:0)+o.left),y:t.pageY-((null!==(i=r&&r.scrollY)&&void 0!==i?i:0)+o.top)}}class ze{constructor(t){this.lastTouch_=null,this.onDocumentMouseMove_=this.onDocumentMouseMove_.bind(this),this.onDocumentMouseUp_=this.onDocumentMouseUp_.bind(this),this.onMouseDown_=this.onMouseDown_.bind(this),this.onTouchEnd_=this.onTouchEnd_.bind(this),this.onTouchMove_=this.onTouchMove_.bind(this),this.onTouchStart_=this.onTouchStart_.bind(this),this.elem_=t,this.emitter=new v,t.addEventListener("touchstart",this.onTouchStart_,{passive:!1}),t.addEventListener("touchmove",this.onTouchMove_,{passive:!0}),t.addEventListener("touchend",this.onTouchEnd_),t.addEventListener("mousedown",this.onMouseDown_)}computePosition_(t){const e=this.elem_.getBoundingClientRect();return{bounds:{width:e.width,height:e.height},point:t?{x:t.x,y:t.y}:null}}onMouseDown_(t){var e;t.preventDefault(),null===(e=t.currentTarget)||void 0===e||e.focus();const n=this.elem_.ownerDocument;n.addEventListener("mousemove",this.onDocumentMouseMove_),n.addEventListener("mouseup",this.onDocumentMouseUp_),this.emitter.emit("down",{altKey:t.altKey,data:this.computePosition_(He(t,this.elem_)),sender:this,shiftKey:t.shiftKey})}onDocumentMouseMove_(t){this.emitter.emit("move",{altKey:t.altKey,data:this.computePosition_(He(t,this.elem_)),sender:this,shiftKey:t.shiftKey})}onDocumentMouseUp_(t){const e=this.elem_.ownerDocument;e.removeEventListener("mousemove",this.onDocumentMouseMove_),e.removeEventListener("mouseup",this.onDocumentMouseUp_),this.emitter.emit("up",{altKey:t.altKey,data:this.computePosition_(He(t,this.elem_)),sender:this,shiftKey:t.shiftKey})}onTouchStart_(t){t.preventDefault();const e=t.targetTouches.item(0),n=this.elem_.getBoundingClientRect();this.emitter.emit("down",{altKey:t.altKey,data:this.computePosition_(e?{x:e.clientX-n.left,y:e.clientY-n.top}:void 0),sender:this,shiftKey:t.shiftKey}),this.lastTouch_=e}onTouchMove_(t){const e=t.targetTouches.item(0),n=this.elem_.getBoundingClientRect();this.emitter.emit("move",{altKey:t.altKey,data:this.computePosition_(e?{x:e.clientX-n.left,y:e.clientY-n.top}:void 0),sender:this,shiftKey:t.shiftKey}),this.lastTouch_=e}onTouchEnd_(t){var e;const n=null!==(e=t.targetTouches.item(0))&&void 0!==e?e:this.lastTouch_,i=this.elem_.getBoundingClientRect();this.emitter.emit("up",{altKey:t.altKey,data:this.computePosition_(n?{x:n.clientX-i.left,y:n.clientY-i.top}:void 0),sender:this,shiftKey:t.shiftKey})}}function qe(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}function $e(t){return String(t.toFixed(10)).split(".")[1].replace(/0+$/,"").length}function Ge(t,e,n){return Math.min(Math.max(t,e),n)}function Ye(t,e){return(t%e+e)%e}const We=f("txt");class Qe{constructor(t,e){this.onChange_=this.onChange_.bind(this),this.props_=e.props,this.props_.emitter.on("change",this.onChange_),this.element=t.createElement("div"),this.element.classList.add(We(),We(void 0,"num")),e.arrayPosition&&this.element.classList.add(We(void 0,e.arrayPosition)),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("input");n.classList.add(We("i")),n.type="text",e.viewProps.bindDisabled(n),this.element.appendChild(n),this.inputElement=n,this.onDraggingChange_=this.onDraggingChange_.bind(this),this.dragging_=e.dragging,this.dragging_.emitter.on("change",this.onDraggingChange_),this.element.classList.add(We()),this.inputElement.classList.add(We("i"));const i=t.createElement("div");i.classList.add(We("k")),this.element.appendChild(i),this.knobElement=i;const r=t.createElementNS(K,"svg");r.classList.add(We("g")),this.knobElement.appendChild(r);const o=t.createElementNS(K,"path");o.classList.add(We("gb")),r.appendChild(o),this.guideBodyElem_=o;const s=t.createElementNS(K,"path");s.classList.add(We("gh")),r.appendChild(s),this.guideHeadElem_=s;const a=t.createElement("div");a.classList.add(f("tt")()),this.knobElement.appendChild(a),this.tooltipElem_=a,e.value.emitter.on("change",this.onChange_),this.value=e.value,this.refresh()}onDraggingChange_(t){if(null===t.rawValue)return void this.element.classList.remove(We(void 0,"drg"));this.element.classList.add(We(void 0,"drg"));const e=t.rawValue/this.props_.get("draggingScale"),n=e+(e>0?-1:e<0?1:0),i=Ge(-n,-4,4);this.guideHeadElem_.setAttributeNS(null,"d",[`M ${n+i},0 L${n},4 L${n+i},8`,`M ${e},-1 L${e},9`].join(" ")),this.guideBodyElem_.setAttributeNS(null,"d",`M 0,4 L${e},4`);const r=this.props_.get("formatter");this.tooltipElem_.textContent=r(this.value.rawValue),this.tooltipElem_.style.left=`${e}px`}refresh(){const t=this.props_.get("formatter");this.inputElement.value=t(this.value.rawValue)}onChange_(){this.refresh()}}class Xe{constructor(t,e){var n;this.originRawValue_=0,this.onInputChange_=this.onInputChange_.bind(this),this.onInputKeyDown_=this.onInputKeyDown_.bind(this),this.onInputKeyUp_=this.onInputKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.baseStep_=e.baseStep,this.parser_=e.parser,this.props=e.props,this.sliderProps_=null!==(n=e.sliderProps)&&void 0!==n?n:null,this.value=e.value,this.viewProps=e.viewProps,this.dragging_=M(null),this.view=new Qe(t,{arrayPosition:e.arrayPosition,dragging:this.dragging_,props:this.props,value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_),this.view.inputElement.addEventListener("keydown",this.onInputKeyDown_),this.view.inputElement.addEventListener("keyup",this.onInputKeyUp_);const i=new ze(this.view.knobElement);i.emitter.on("down",this.onPointerDown_),i.emitter.on("move",this.onPointerMove_),i.emitter.on("up",this.onPointerUp_)}constrainValue_(t){var e,n;const i=null===(e=this.sliderProps_)||void 0===e?void 0:e.get("minValue"),r=null===(n=this.sliderProps_)||void 0===n?void 0:n.get("maxValue");let o=t;return void 0!==i&&(o=Math.max(o,i)),void 0!==r&&(o=Math.min(o,r)),o}onInputChange_(t){const e=this.parser_(t.currentTarget.value);a(e)||(this.value.rawValue=this.constrainValue_(e)),this.view.refresh()}onInputKeyDown_(t){const e=Ie(this.baseStep_,Ue(t));0!==e&&this.value.setRawValue(this.constrainValue_(this.value.rawValue+e),{forceEmit:!1,last:!1})}onInputKeyUp_(t){0!==Ie(this.baseStep_,Ue(t))&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}onPointerDown_(){this.originRawValue_=this.value.rawValue,this.dragging_.rawValue=0}computeDraggingValue_(t){if(!t.point)return null;return this.constrainValue_(this.originRawValue_+(t.point.x-t.bounds.width/2)*this.props.get("draggingScale"))}onPointerMove_(t){const e=this.computeDraggingValue_(t.data);null!==e&&(this.value.setRawValue(e,{forceEmit:!1,last:!1}),this.dragging_.rawValue=this.value.rawValue-this.originRawValue_)}onPointerUp_(t){const e=this.computeDraggingValue_(t.data);null!==e&&(this.value.setRawValue(e,{forceEmit:!0,last:!0}),this.dragging_.rawValue=null)}}const Ze=f("sld");class Je{constructor(t,e){this.onChange_=this.onChange_.bind(this),this.props_=e.props,this.props_.emitter.on("change",this.onChange_),this.element=t.createElement("div"),this.element.classList.add(Ze()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("div");n.classList.add(Ze("t")),e.viewProps.bindTabIndex(n),this.element.appendChild(n),this.trackElement=n;const i=t.createElement("div");i.classList.add(Ze("k")),this.trackElement.appendChild(i),this.knobElement=i,e.value.emitter.on("change",this.onChange_),this.value=e.value,this.update_()}update_(){const t=Ge(qe(this.value.rawValue,this.props_.get("minValue"),this.props_.get("maxValue"),0,100),0,100);this.knobElement.style.width=`${t}%`}onChange_(){this.update_()}}class tn{constructor(t,e){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDownOrMove_=this.onPointerDownOrMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.baseStep_=e.baseStep,this.value=e.value,this.viewProps=e.viewProps,this.props=e.props,this.view=new Je(t,{props:this.props,value:this.value,viewProps:this.viewProps}),this.ptHandler_=new ze(this.view.trackElement),this.ptHandler_.emitter.on("down",this.onPointerDownOrMove_),this.ptHandler_.emitter.on("move",this.onPointerDownOrMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.trackElement.addEventListener("keydown",this.onKeyDown_),this.view.trackElement.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(t,e){t.point&&this.value.setRawValue(qe(Ge(t.point.x,0,t.bounds.width),0,t.bounds.width,this.props.get("minValue"),this.props.get("maxValue")),e)}onPointerDownOrMove_(t){this.handlePointerEvent_(t.data,{forceEmit:!1,last:!1})}onPointerUp_(t){this.handlePointerEvent_(t.data,{forceEmit:!0,last:!0})}onKeyDown_(t){const e=Ie(this.baseStep_,Ke(t));0!==e&&this.value.setRawValue(this.value.rawValue+e,{forceEmit:!1,last:!1})}onKeyUp_(t){0!==Ie(this.baseStep_,Ke(t))&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const en=f("sldtxt");class nn{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(en());const n=t.createElement("div");n.classList.add(en("s")),this.sliderView_=e.sliderView,n.appendChild(this.sliderView_.element),this.element.appendChild(n);const i=t.createElement("div");i.classList.add(en("t")),this.textView_=e.textView,i.appendChild(this.textView_.element),this.element.appendChild(i)}}class rn{constructor(t,e){this.value=e.value,this.viewProps=e.viewProps,this.sliderC_=new tn(t,{baseStep:e.baseStep,props:e.sliderProps,value:e.value,viewProps:this.viewProps}),this.textC_=new Xe(t,{baseStep:e.baseStep,parser:e.parser,props:e.textProps,sliderProps:e.sliderProps,value:e.value,viewProps:e.viewProps}),this.view=new nn(t,{sliderView:this.sliderC_.view,textView:this.textC_.view})}get sliderController(){return this.sliderC_}get textController(){return this.textC_}}function on(t,e){t.write(e)}function sn(t){const e=D;return Array.isArray(t)?e.required.array(e.required.object({text:e.required.string,value:e.required.raw}))(t).value:"object"==typeof t?e.required.raw(t).value:void 0}function an(t){if("inline"===t||"popup"===t)return t}function ln(t){return D.required.object({max:D.optional.number,min:D.optional.number,step:D.optional.number})(t).value}function pn(t){if(Array.isArray(t))return t;const e=[];return Object.keys(t).forEach((n=>{e.push({text:n,value:t[n]})})),e}function cn(t){return a(t)?null:new Jt(pn(t))}function dn(t,e){const n=t&&Xt(t,ee);return n?$e(n.step):Math.max($e(e),2)}function hn(t){const e=function(t){const e=t?Xt(t,ee):null;return e?e.step:null}(t);return null!=e?e:1}function un(t,e){var n;const i=t&&Xt(t,ee),r=Math.abs(null!==(n=null==i?void 0:i.step)&&void 0!==n?n:e);return 0===r?.1:Math.pow(10,Math.floor(Math.log10(r))-1)}const vn=f("ckb");class mn{constructor(t,e){this.onValueChange_=this.onValueChange_.bind(this),this.element=t.createElement("div"),this.element.classList.add(vn()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("label");n.classList.add(vn("l")),this.element.appendChild(n);const i=t.createElement("input");i.classList.add(vn("i")),i.type="checkbox",n.appendChild(i),this.inputElement=i,e.viewProps.bindDisabled(this.inputElement);const r=t.createElement("div");r.classList.add(vn("w")),n.appendChild(r);const o=q(t,"check");r.appendChild(o),e.value.emitter.on("change",this.onValueChange_),this.value=e.value,this.update_()}update_(){this.inputElement.checked=this.value.rawValue}onValueChange_(){this.update_()}}class fn{constructor(t,e){this.onInputChange_=this.onInputChange_.bind(this),this.value=e.value,this.viewProps=e.viewProps,this.view=new mn(t,{value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_)}onInputChange_(t){this.value.rawValue=t.currentTarget.checked}}const bn={id:"input-bool",type:"input",accept:(t,e)=>{if("boolean"!=typeof t)return null;const n=A(e,{options:D.optional.custom(sn)});return n?{initialValue:t,params:n}:null},binding:{reader:t=>de,constraint:t=>function(t){const e=[],n=cn(t.options);return n&&e.push(n),new Qt(e)}(t.params),writer:t=>on},controller:t=>{const e=t.document,n=t.value,i=t.constraint,r=i&&Xt(i,Jt);return r?new re(e,{props:new V({options:r.values.value("options")}),value:n,viewProps:t.viewProps}):new fn(e,{value:n,viewProps:t.viewProps})}},gn=f("col");class _n{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(gn()),e.foldable.bindExpandedClass(this.element,gn(void 0,"expanded")),_(e.foldable,"completed",w(this.element,gn(void 0,"cpl")));const n=t.createElement("div");n.classList.add(gn("h")),this.element.appendChild(n);const i=t.createElement("div");i.classList.add(gn("s")),n.appendChild(i),this.swatchElement=i;const r=t.createElement("div");if(r.classList.add(gn("t")),n.appendChild(r),this.textElement=r,"inline"===e.pickerLayout){const e=t.createElement("div");e.classList.add(gn("p")),this.element.appendChild(e),this.pickerElement=e}else this.pickerElement=null}}function wn(t,e,n){const i=Ye(t,360),r=Ge(e/100,0,1),o=Ge(n/100,0,1),s=o*r,a=s*(1-Math.abs(i/60%2-1)),l=o-s;let p,c,d;return[p,c,d]=i>=0&&i<60?[s,a,0]:i>=60&&i<120?[a,s,0]:i>=120&&i<180?[0,s,a]:i>=180&&i<240?[0,a,s]:i>=240&&i<300?[a,0,s]:[s,0,a],[255*(p+l),255*(c+l),255*(d+l)]}function yn(t){return[t[0],t[1],t[2]]}function xn(t,e){return[t[0],t[1],t[2],e]}const Cn={hsl:{hsl:(t,e,n)=>[t,e,n],hsv:function(t,e,n){const i=n+e*(100-Math.abs(2*n-100))/200;return[t,0!==i?e*(100-Math.abs(2*n-100))/i:0,n+e*(100-Math.abs(2*n-100))/200]},rgb:function(t,e,n){const i=(t%360+360)%360,r=Ge(e/100,0,1),o=Ge(n/100,0,1),s=(1-Math.abs(2*o-1))*r,a=s*(1-Math.abs(i/60%2-1)),l=o-s/2;let p,c,d;return[p,c,d]=i>=0&&i<60?[s,a,0]:i>=60&&i<120?[a,s,0]:i>=120&&i<180?[0,s,a]:i>=180&&i<240?[0,a,s]:i>=240&&i<300?[a,0,s]:[s,0,a],[255*(p+l),255*(c+l),255*(d+l)]}},hsv:{hsl:function(t,e,n){const i=100-Math.abs(n*(200-e)/100-100);return[t,0!==i?e*n/i:0,n*(200-e)/200]},hsv:(t,e,n)=>[t,e,n],rgb:wn},rgb:{hsl:function(t,e,n){const i=Ge(t/255,0,1),r=Ge(e/255,0,1),o=Ge(n/255,0,1),s=Math.max(i,r,o),a=Math.min(i,r,o),l=s-a;let p=0,c=0;const d=(a+s)/2;return 0!==l&&(c=l/(1-Math.abs(s+a-1)),p=i===s?(r-o)/l:r===s?2+(o-i)/l:4+(i-r)/l,p=p/6+(p<0?1:0)),[360*p,100*c,100*d]},hsv:function(t,e,n){const i=Ge(t/255,0,1),r=Ge(e/255,0,1),o=Ge(n/255,0,1),s=Math.max(i,r,o),a=s-Math.min(i,r,o);let l;return l=0===a?0:s===i?((r-o)/a%6+6)%6*60:s===r?60*((o-i)/a+2):60*((i-r)/a+4),[l,100*(0===s?0:a/s),100*s]},rgb:(t,e,n)=>[t,e,n]}};function Pn(t,e){return["float"===e?1:"rgb"===t?255:360,"float"===e?1:"rgb"===t?255:100,"float"===e?1:"rgb"===t?255:100]}function kn(t,e,n,i){const r=Pn(e,n),o=Pn(e,i);return t.map(((t,e)=>t/r[e]*o[e]))}function En(t,e){return"object"==typeof t&&!a(t)&&(e in t&&"number"==typeof t[e])}class Mn{static black(t="int"){return new Mn([0,0,0],"rgb",t)}static fromObject(t,e="int"){return new Mn("a"in t?[t.r,t.g,t.b,t.a]:[t.r,t.g,t.b],"rgb",e)}static toRgbaObject(t,e="int"){return t.toRgbaObject(e)}static isRgbColorObject(t){return En(t,"r")&&En(t,"g")&&En(t,"b")}static isRgbaColorObject(t){return this.isRgbColorObject(t)&&En(t,"a")}static isColorObject(t){return this.isRgbColorObject(t)}static equals(t,e){if(t.mode!==e.mode)return!1;const n=t.comps_,i=e.comps_;for(let t=0;tt.inputElement))];return this.alphaViews_&&t.push(this.alphaViews_.palette.element,this.alphaViews_.text.inputElement),t}}function Ln(t){return"int"===t?"int":"float"===t?"float":void 0}function Dn(t){const e=D;return A(t,{alpha:e.optional.boolean,color:e.optional.object({alpha:e.optional.boolean,type:e.optional.custom(Ln)}),expanded:e.optional.boolean,picker:e.optional.custom(an)})}function An(t){return t?.1:1}function Tn(t){var e;return null===(e=t.color)||void 0===e?void 0:e.type}function jn(t,e){const n=t.match(/^(.+)%$/);return n?Math.min(.01*parseFloat(n[1])*e,e):Math.min(parseFloat(t),e)}const Rn={deg:t=>t,grad:t=>360*t/400,rad:t=>360*t/(2*Math.PI),turn:t=>360*t};function On(t){const e=t.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);if(!e)return parseFloat(t);const n=parseFloat(e[1]);return Rn[e[2]](n)}function Nn(t){const e=t.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const n=[jn(e[1],255),jn(e[2],255),jn(e[3],255)];return isNaN(n[0])||isNaN(n[1])||isNaN(n[2])?null:n}function Fn(t){return e=>{const n=Nn(e);return n?new Mn(n,"rgb",t):null}}function In(t){const e=t.match(/^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const n=[jn(e[1],255),jn(e[2],255),jn(e[3],255),jn(e[4],1)];return isNaN(n[0])||isNaN(n[1])||isNaN(n[2])||isNaN(n[3])?null:n}function Un(t){return e=>{const n=In(e);return n?new Mn(n,"rgb",t):null}}function Kn(t){const e=t.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const n=[On(e[1]),jn(e[2],100),jn(e[3],100)];return isNaN(n[0])||isNaN(n[1])||isNaN(n[2])?null:n}function Bn(t){return e=>{const n=Kn(e);return n?new Mn(n,"hsl",t):null}}function Hn(t){const e=t.match(/^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const n=[On(e[1]),jn(e[2],100),jn(e[3],100),jn(e[4],1)];return isNaN(n[0])||isNaN(n[1])||isNaN(n[2])||isNaN(n[3])?null:n}function zn(t){return e=>{const n=Hn(e);return n?new Mn(n,"hsl",t):null}}function qn(t){const e=t.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);if(e)return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)];const n=t.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:null}function $n(t){const e=t.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);if(e)return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),qe(parseInt(e[4]+e[4],16),0,255,0,1)];const n=t.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),qe(parseInt(n[4],16),0,255,0,1)]:null}function Gn(t){const e=t.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);if(!e)return null;const n=[parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])];return isNaN(n[0])||isNaN(n[1])||isNaN(n[2])?null:n}function Yn(t){return e=>{const n=Gn(e);return n?new Mn(n,"rgb",t):null}}function Wn(t){const e=t.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*a\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);if(!e)return null;const n=[parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]),parseFloat(e[4])];return isNaN(n[0])||isNaN(n[1])||isNaN(n[2])||isNaN(n[3])?null:n}function Qn(t){return e=>{const n=Wn(e);return n?new Mn(n,"rgb",t):null}}const Xn=[{parser:qn,result:{alpha:!1,mode:"rgb",notation:"hex"}},{parser:$n,result:{alpha:!0,mode:"rgb",notation:"hex"}},{parser:Nn,result:{alpha:!1,mode:"rgb",notation:"func"}},{parser:In,result:{alpha:!0,mode:"rgb",notation:"func"}},{parser:Kn,result:{alpha:!1,mode:"hsl",notation:"func"}},{parser:Hn,result:{alpha:!0,mode:"hsl",notation:"func"}},{parser:Gn,result:{alpha:!1,mode:"rgb",notation:"object"}},{parser:Wn,result:{alpha:!0,mode:"rgb",notation:"object"}}];function Zn(t,e="int"){const n=function(t){return Xn.reduce(((e,{parser:n,result:i})=>e||(n(t)?i:null)),null)}(t);return n?"hex"===n.notation&&"float"!==e?Object.assign(Object.assign({},n),{type:"int"}):"func"===n.notation?Object.assign(Object.assign({},n),{type:e}):null:null}const Jn={int:[function(t){const e=qn(t);return e?new Mn(e,"rgb","int"):null},function(t){const e=$n(t);return e?new Mn(e,"rgb","int"):null},Fn("int"),Un("int"),Bn("int"),zn("int"),Yn("int"),Qn("int")],float:[Fn("float"),Un("float"),Bn("float"),zn("float"),Yn("float"),Qn("float")]};function ti(t){const e=Jn[t];return t=>e.reduce(((e,n)=>e||n(t)),null)}function ei(t){const e=Ge(Math.floor(t),0,255).toString(16);return 1===e.length?`0${e}`:e}function ni(t,e="#"){return`${e}${yn(t.getComponents("rgb")).map(ei).join("")}`}function ii(t,e="#"){const n=t.getComponents("rgb");return`${e}${[n[0],n[1],n[2],255*n[3]].map(ei).join("")}`}function ri(t,e){const n=Te("float"===e?2:0);return`rgb(${yn(t.getComponents("rgb",e)).map((t=>n(t))).join(", ")})`}function oi(t){return e=>ri(e,t)}function si(t,e){const n=Te(2),i=Te("float"===e?2:0);return`rgba(${t.getComponents("rgb",e).map(((t,e)=>(3===e?n:i)(t))).join(", ")})`}function ai(t){return e=>si(e,t)}function li(t,e){const n=Te("float"===e?2:0),i=["r","g","b"];return`{${yn(t.getComponents("rgb",e)).map(((t,e)=>`${i[e]}: ${n(t)}`)).join(", ")}}`}function pi(t){return e=>li(e,t)}function ci(t,e){const n=Te(2),i=Te("float"===e?2:0),r=["r","g","b","a"];return`{${t.getComponents("rgb",e).map(((t,e)=>`${r[e]}: ${(3===e?n:i)(t)}`)).join(", ")}}`}function di(t){return e=>ci(e,t)}const hi=[{format:{alpha:!1,mode:"rgb",notation:"hex",type:"int"},stringifier:ni},{format:{alpha:!0,mode:"rgb",notation:"hex",type:"int"},stringifier:ii},{format:{alpha:!1,mode:"hsl",notation:"func",type:"int"},stringifier:function(t){const e=[Te(0),Re,Re];return`hsl(${yn(t.getComponents("hsl")).map(((t,n)=>e[n](t))).join(", ")})`}},{format:{alpha:!0,mode:"hsl",notation:"func",type:"int"},stringifier:function(t){const e=[Te(0),Re,Re,Te(2)];return`hsla(${t.getComponents("hsl").map(((t,n)=>e[n](t))).join(", ")})`}},...["int","float"].reduce(((t,e)=>[...t,{format:{alpha:!1,mode:"rgb",notation:"func",type:e},stringifier:oi(e)},{format:{alpha:!0,mode:"rgb",notation:"func",type:e},stringifier:ai(e)},{format:{alpha:!1,mode:"rgb",notation:"object",type:e},stringifier:pi(e)},{format:{alpha:!0,mode:"rgb",notation:"object",type:e},stringifier:di(e)}]),[])];function ui(t){return hi.reduce(((e,n)=>{return e||((i=n.format).alpha===(r=t).alpha&&i.mode===r.mode&&i.notation===r.notation&&i.type===r.type?n.stringifier:null);var i,r}),null)}const vi=f("apl");class mi{constructor(t,e){this.onValueChange_=this.onValueChange_.bind(this),this.value=e.value,this.value.emitter.on("change",this.onValueChange_),this.element=t.createElement("div"),this.element.classList.add(vi()),e.viewProps.bindClassModifiers(this.element),e.viewProps.bindTabIndex(this.element);const n=t.createElement("div");n.classList.add(vi("b")),this.element.appendChild(n);const i=t.createElement("div");i.classList.add(vi("c")),n.appendChild(i),this.colorElem_=i;const r=t.createElement("div");r.classList.add(vi("m")),this.element.appendChild(r),this.markerElem_=r;const o=t.createElement("div");o.classList.add(vi("p")),this.markerElem_.appendChild(o),this.previewElem_=o,this.update_()}update_(){const t=this.value.rawValue,e=t.getComponents("rgb"),n=new Mn([e[0],e[1],e[2],0],"rgb"),i=new Mn([e[0],e[1],e[2],255],"rgb"),r=["to right",si(n),si(i)];this.colorElem_.style.background=`linear-gradient(${r.join(",")})`,this.previewElem_.style.backgroundColor=si(t);const o=qe(e[3],0,1,0,100);this.markerElem_.style.left=`${o}%`}onValueChange_(){this.update_()}}class fi{constructor(t,e){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=e.value,this.viewProps=e.viewProps,this.view=new mi(t,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new ze(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(t,e){if(!t.point)return;const n=t.point.x/t.bounds.width,i=this.value.rawValue,[r,o,s]=i.getComponents("hsv");this.value.setRawValue(new Mn([r,o,s,n],"hsv"),e)}onPointerDown_(t){this.handlePointerEvent_(t.data,{forceEmit:!1,last:!1})}onPointerMove_(t){this.handlePointerEvent_(t.data,{forceEmit:!1,last:!1})}onPointerUp_(t){this.handlePointerEvent_(t.data,{forceEmit:!0,last:!0})}onKeyDown_(t){const e=Ie(An(!0),Ke(t));if(0===e)return;const n=this.value.rawValue,[i,r,o,s]=n.getComponents("hsv");this.value.setRawValue(new Mn([i,r,o,s+e],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(t){0!==Ie(An(!0),Ke(t))&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const bi=f("coltxt");class gi{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(bi()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("div");n.classList.add(bi("m")),this.modeElem_=function(t){const e=t.createElement("select");return e.appendChild([{text:"RGB",value:"rgb"},{text:"HSL",value:"hsl"},{text:"HSV",value:"hsv"}].reduce(((e,n)=>{const i=t.createElement("option");return i.textContent=n.text,i.value=n.value,e.appendChild(i),e}),t.createDocumentFragment())),e}(t),this.modeElem_.classList.add(bi("ms")),n.appendChild(this.modeSelectElement),e.viewProps.bindDisabled(this.modeElem_);const i=t.createElement("div");i.classList.add(bi("mm")),i.appendChild(q(t,"dropdown")),n.appendChild(i),this.element.appendChild(n);const r=t.createElement("div");r.classList.add(bi("w")),this.element.appendChild(r),this.textsElem_=r,this.textViews_=e.textViews,this.applyTextViews_(),g(e.colorMode,(t=>{this.modeElem_.value=t}))}get modeSelectElement(){return this.modeElem_}get textViews(){return this.textViews_}set textViews(t){this.textViews_=t,this.applyTextViews_()}applyTextViews_(){Y(this.textsElem_);const t=this.element.ownerDocument;this.textViews_.forEach((e=>{const n=t.createElement("div");n.classList.add(bi("c")),n.appendChild(e.element),this.textsElem_.appendChild(n)}))}}function _i(t,e,n){const i=Pn(t,e)[n];return new Zt({min:0,max:i})}function wi(t,e,n){return new Xe(t,{arrayPosition:0===n?"fst":2===n?"lst":"mid",baseStep:An(!1),parser:e.parser,props:V.fromObject({draggingScale:"float"===e.colorType?.01:1,formatter:(i=e.colorType,Te("float"===i?2:0))}),value:M(0,{constraint:_i(e.colorMode,e.colorType,n)}),viewProps:e.viewProps});var i}class yi{constructor(t,e){this.onModeSelectChange_=this.onModeSelectChange_.bind(this),this.colorType_=e.colorType,this.parser_=e.parser,this.value=e.value,this.viewProps=e.viewProps,this.colorMode=M(this.value.rawValue.mode),this.ccs_=this.createComponentControllers_(t),this.view=new gi(t,{colorMode:this.colorMode,textViews:[this.ccs_[0].view,this.ccs_[1].view,this.ccs_[2].view],viewProps:this.viewProps}),this.view.modeSelectElement.addEventListener("change",this.onModeSelectChange_)}createComponentControllers_(t){const e={colorMode:this.colorMode.rawValue,colorType:this.colorType_,parser:this.parser_,viewProps:this.viewProps},n=[wi(t,e,0),wi(t,e,1),wi(t,e,2)];return n.forEach(((t,e)=>{Fe({primary:this.value,secondary:t.value,forward:t=>t.rawValue.getComponents(this.colorMode.rawValue,this.colorType_)[e],backward:(t,n)=>{const i=this.colorMode.rawValue,r=t.rawValue.getComponents(i,this.colorType_);return r[e]=n.rawValue,new Mn(xn(yn(r),r[3]),i,this.colorType_)}})})),n}onModeSelectChange_(t){this.colorMode.rawValue=t.currentTarget.value,this.ccs_=this.createComponentControllers_(this.view.element.ownerDocument),this.view.textViews=[this.ccs_[0].view,this.ccs_[1].view,this.ccs_[2].view]}}const xi=f("hpl");class Ci{constructor(t,e){this.onValueChange_=this.onValueChange_.bind(this),this.value=e.value,this.value.emitter.on("change",this.onValueChange_),this.element=t.createElement("div"),this.element.classList.add(xi()),e.viewProps.bindClassModifiers(this.element),e.viewProps.bindTabIndex(this.element);const n=t.createElement("div");n.classList.add(xi("c")),this.element.appendChild(n);const i=t.createElement("div");i.classList.add(xi("m")),this.element.appendChild(i),this.markerElem_=i,this.update_()}update_(){const t=this.value.rawValue,[e]=t.getComponents("hsv");this.markerElem_.style.backgroundColor=ri(new Mn([e,100,100],"hsv"));const n=qe(e,0,360,0,100);this.markerElem_.style.left=`${n}%`}onValueChange_(){this.update_()}}class Pi{constructor(t,e){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=e.value,this.viewProps=e.viewProps,this.view=new Ci(t,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new ze(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(t,e){if(!t.point)return;const n=qe(Ge(t.point.x,0,t.bounds.width),0,t.bounds.width,0,360),i=this.value.rawValue,[,r,o,s]=i.getComponents("hsv");this.value.setRawValue(new Mn([n,r,o,s],"hsv"),e)}onPointerDown_(t){this.handlePointerEvent_(t.data,{forceEmit:!1,last:!1})}onPointerMove_(t){this.handlePointerEvent_(t.data,{forceEmit:!1,last:!1})}onPointerUp_(t){this.handlePointerEvent_(t.data,{forceEmit:!0,last:!0})}onKeyDown_(t){const e=Ie(An(!1),Ke(t));if(0===e)return;const n=this.value.rawValue,[i,r,o,s]=n.getComponents("hsv");this.value.setRawValue(new Mn([i+e,r,o,s],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(t){0!==Ie(An(!1),Ke(t))&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const ki=f("svp");class Ei{constructor(t,e){this.onValueChange_=this.onValueChange_.bind(this),this.value=e.value,this.value.emitter.on("change",this.onValueChange_),this.element=t.createElement("div"),this.element.classList.add(ki()),e.viewProps.bindClassModifiers(this.element),e.viewProps.bindTabIndex(this.element);const n=t.createElement("canvas");n.height=64,n.width=64,n.classList.add(ki("c")),this.element.appendChild(n),this.canvasElement=n;const i=t.createElement("div");i.classList.add(ki("m")),this.element.appendChild(i),this.markerElem_=i,this.update_()}update_(){const t=function(t){const e=t.ownerDocument.defaultView;return e&&"document"in e?t.getContext("2d",{willReadFrequently:!0}):null}(this.canvasElement);if(!t)return;const e=this.value.rawValue.getComponents("hsv"),n=this.canvasElement.width,i=this.canvasElement.height,r=t.getImageData(0,0,n,i),o=r.data;for(let t=0;tt.rawValue.getComponents()[3],backward:(t,e)=>{const n=t.rawValue.getComponents();return n[3]=e.rawValue,new Mn(n,t.rawValue.mode)}}),this.textC_=new yi(t,{colorType:e.colorType,parser:Le,value:this.value,viewProps:this.viewProps}),this.view=new Sn(t,{alphaViews:this.alphaIcs_?{palette:this.alphaIcs_.palette.view,text:this.alphaIcs_.text.view}:null,hPaletteView:this.hPaletteC_.view,supportsAlpha:e.supportsAlpha,svPaletteView:this.svPaletteC_.view,textView:this.textC_.view,viewProps:this.viewProps})}get textController(){return this.textC_}}const Si=f("colsw");class Li{constructor(t,e){this.onValueChange_=this.onValueChange_.bind(this),e.value.emitter.on("change",this.onValueChange_),this.value=e.value,this.element=t.createElement("div"),this.element.classList.add(Si()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("div");n.classList.add(Si("sw")),this.element.appendChild(n),this.swatchElem_=n;const i=t.createElement("button");i.classList.add(Si("b")),e.viewProps.bindDisabled(i),this.element.appendChild(i),this.buttonElement=i,this.update_()}update_(){this.swatchElem_.style.backgroundColor=ii(this.value.rawValue)}onValueChange_(){this.update_()}}class Di{constructor(t,e){this.value=e.value,this.viewProps=e.viewProps,this.view=new Li(t,{value:this.value,viewProps:this.viewProps})}}class Ai{constructor(t,e){this.onButtonBlur_=this.onButtonBlur_.bind(this),this.onButtonClick_=this.onButtonClick_.bind(this),this.onPopupChildBlur_=this.onPopupChildBlur_.bind(this),this.onPopupChildKeydown_=this.onPopupChildKeydown_.bind(this),this.value=e.value,this.viewProps=e.viewProps,this.foldable_=nt.create(e.expanded),this.swatchC_=new Di(t,{value:this.value,viewProps:this.viewProps});const n=this.swatchC_.view.buttonElement;n.addEventListener("blur",this.onButtonBlur_),n.addEventListener("click",this.onButtonClick_),this.textC_=new ce(t,{parser:e.parser,props:V.fromObject({formatter:e.formatter}),value:this.value,viewProps:this.viewProps}),this.view=new _n(t,{foldable:this.foldable_,pickerLayout:e.pickerLayout}),this.view.swatchElement.appendChild(this.swatchC_.view.element),this.view.textElement.appendChild(this.textC_.view.element),this.popC_="popup"===e.pickerLayout?new ae(t,{viewProps:this.viewProps}):null;const i=new Vi(t,{colorType:e.colorType,supportsAlpha:e.supportsAlpha,value:this.value,viewProps:this.viewProps});i.view.allFocusableElements.forEach((t=>{t.addEventListener("blur",this.onPopupChildBlur_),t.addEventListener("keydown",this.onPopupChildKeydown_)})),this.pickerC_=i,this.popC_?(this.view.element.appendChild(this.popC_.view.element),this.popC_.view.element.appendChild(i.view.element),Fe({primary:this.foldable_.value("expanded"),secondary:this.popC_.shows,forward:t=>t.rawValue,backward:(t,e)=>e.rawValue})):this.view.pickerElement&&(this.view.pickerElement.appendChild(this.pickerC_.view.element),rt(this.foldable_,this.view.pickerElement))}get textController(){return this.textC_}onButtonBlur_(t){if(!this.popC_)return;const e=t.relatedTarget;e&&this.view.element.contains(e)||(this.popC_.shows.rawValue=!1)}onButtonClick_(){this.foldable_.set("expanded",!this.foldable_.get("expanded")),this.foldable_.get("expanded")&&this.pickerC_.view.allFocusableElements[0].focus()}onPopupChildBlur_(t){if(!this.popC_)return;const e=this.popC_.view.element,n=W(t);n&&e.contains(n)||n&&n===this.swatchC_.view.buttonElement&&!B(e.ownerDocument)||(this.popC_.shows.rawValue=!1)}onPopupChildKeydown_(t){this.popC_?"Escape"===t.key&&(this.popC_.shows.rawValue=!1):this.view.pickerElement&&"Escape"===t.key&&this.swatchC_.view.buttonElement.focus()}}function Ti(t){return yn(t.getComponents("rgb")).reduce(((t,e)=>t<<8|255&Math.floor(e)),0)}function ji(t){return t.getComponents("rgb").reduce(((t,e,n)=>t<<8|255&Math.floor(3===n?255*e:e)),0)>>>0}function Ri(t){return"number"!=typeof t?Mn.black():new Mn([(e=t)>>16&255,e>>8&255,255&e],"rgb");var e}function Oi(t){return"number"!=typeof t?Mn.black():new Mn([(e=t)>>24&255,e>>16&255,e>>8&255,qe(255&e,0,255,0,1)],"rgb");var e}function Ni(t){var e;return!(!(null==t?void 0:t.alpha)&&!(null===(e=null==t?void 0:t.color)||void 0===e?void 0:e.alpha))}function Fi(t){return t?t=>ii(t,"0x"):t=>ni(t,"0x")}const Ii={id:"input-color-number",type:"input",accept:(t,e)=>{if("number"!=typeof t)return null;if(!function(t){return"color"in t||"view"in t&&"color"===t.view}(e))return null;const n=Dn(e);return n?{initialValue:t,params:n}:null},binding:{reader:t=>Ni(t.params)?Oi:Ri,equals:Mn.equals,writer:t=>function(t){const e=t?ji:Ti;return(t,n)=>{on(t,e(n))}}(Ni(t.params))},controller:t=>{const e=Ni(t.params),n="expanded"in t.params?t.params.expanded:void 0,i="picker"in t.params?t.params.picker:void 0;return new Ai(t.document,{colorType:"int",expanded:null!=n&&n,formatter:Fi(e),parser:ti("int"),pickerLayout:null!=i?i:"popup",supportsAlpha:e,value:t.value,viewProps:t.viewProps})}};function Ui(t){return e=>function(t,e){return Mn.isColorObject(t)?Mn.fromObject(t,e):Mn.black(e)}(e,t)}function Ki(t,e){return n=>t?ci(n,e):li(n,e)}const Bi={id:"input-color-object",type:"input",accept:(t,e)=>{if(!Mn.isColorObject(t))return null;const n=Dn(e);return n?{initialValue:t,params:n}:null},binding:{reader:t=>Ui(Tn(t.params)),equals:Mn.equals,writer:t=>{return e=Mn.isRgbaColorObject(t.initialValue),n=Tn(t.params),(t,i)=>{e?function(t,e,n){const i=e.toRgbaObject(n);t.writeProperty("r",i.r),t.writeProperty("g",i.g),t.writeProperty("b",i.b),t.writeProperty("a",i.a)}(t,i,n):function(t,e,n){const i=e.toRgbaObject(n);t.writeProperty("r",i.r),t.writeProperty("g",i.g),t.writeProperty("b",i.b)}(t,i,n)};var e,n}},controller:t=>{var e;const n=Mn.isRgbaColorObject(t.initialValue),i="expanded"in t.params?t.params.expanded:void 0,r="picker"in t.params?t.params.picker:void 0,o=null!==(e=Tn(t.params))&&void 0!==e?e:"int";return new Ai(t.document,{colorType:o,expanded:null!=i&&i,formatter:Ki(n,o),parser:ti(o),pickerLayout:null!=r?r:"popup",supportsAlpha:n,value:t.value,viewProps:t.viewProps})}},Hi={id:"input-color-string",type:"input",accept:(t,e)=>{if("string"!=typeof t)return null;if("view"in e&&"text"===e.view)return null;const n=Zn(t,Tn(e));if(!n)return null;if(!ui(n))return null;const i=Dn(e);return i?{initialValue:t,params:i}:null},binding:{reader:t=>{var e;return function(t){const e=Jn[t];return n=>{if("string"!=typeof n)return Mn.black(t);const i=e.reduce(((t,e)=>t||e(n)),null);return null!=i?i:Mn.black(t)}}(null!==(e=Tn(t.params))&&void 0!==e?e:"int")},equals:Mn.equals,writer:t=>{const e=Zn(t.initialValue,Tn(t.params));if(!e)throw d.shouldNeverHappen();const n=function(t){const e=ui(t);return e?(t,n)=>{on(t,e(n))}:null}(e);if(!n)throw d.notBindable();return n}},controller:t=>{const e=Zn(t.initialValue,Tn(t.params));if(!e)throw d.shouldNeverHappen();const n=ui(e);if(!n)throw d.shouldNeverHappen();const i="expanded"in t.params?t.params.expanded:void 0,r="picker"in t.params?t.params.picker:void 0;return new Ai(t.document,{colorType:e.type,expanded:null!=i&&i,formatter:n,parser:ti(e.type),pickerLayout:null!=r?r:"popup",supportsAlpha:e.alpha,value:t.value,viewProps:t.viewProps})}};class zi{constructor(t){this.components=t.components,this.asm_=t.assembly}constrain(t){const e=this.asm_.toComponents(t).map(((t,e)=>{var n,i;return null!==(i=null===(n=this.components[e])||void 0===n?void 0:n.constrain(t))&&void 0!==i?i:t}));return this.asm_.fromComponents(e)}}const qi=f("pndtxt");class $i{constructor(t,e){this.textViews=e.textViews,this.element=t.createElement("div"),this.element.classList.add(qi()),this.textViews.forEach((e=>{const n=t.createElement("div");n.classList.add(qi("a")),n.appendChild(e.element),this.element.appendChild(n)}))}}class Gi{constructor(t,e){this.value=e.value,this.viewProps=e.viewProps,this.acs_=e.axes.map(((n,i)=>function(t,e,n){return new Xe(t,{arrayPosition:0===n?"fst":n===e.axes.length-1?"lst":"mid",baseStep:e.axes[n].baseStep,parser:e.parser,props:e.axes[n].textProps,value:M(0,{constraint:e.axes[n].constraint}),viewProps:e.viewProps})}(t,e,i))),this.acs_.forEach(((t,n)=>{Fe({primary:this.value,secondary:t.value,forward:t=>e.assembly.toComponents(t.rawValue)[n],backward:(t,i)=>{const r=e.assembly.toComponents(t.rawValue);return r[n]=i.rawValue,e.assembly.fromComponents(r)}})})),this.view=new $i(t,{textViews:this.acs_.map((t=>t.view))})}}function Yi(t,e){return"step"in t&&!a(t.step)?new ee(t.step,e):null}function Wi(t){return a(t.max)||a(t.min)?a(t.max)&&a(t.min)?null:new te({max:t.max,min:t.min}):new Zt({max:t.max,min:t.min})}const Qi={id:"input-number",type:"input",accept:(t,e)=>{if("number"!=typeof t)return null;const n=D,i=A(e,{format:n.optional.function,max:n.optional.number,min:n.optional.number,options:n.optional.custom(sn),step:n.optional.number});return i?{initialValue:t,params:i}:null},binding:{reader:t=>De,constraint:t=>function(t,e){const n=[],i=Yi(t,e);i&&n.push(i);const r=Wi(t);r&&n.push(r);const o=cn(t.options);return o&&n.push(o),new Qt(n)}(t.params,t.initialValue),writer:t=>on},controller:t=>{var e;const n=t.value,i=t.constraint,r=i&&Xt(i,Jt);if(r)return new re(t.document,{props:new V({options:r.values.value("options")}),value:n,viewProps:t.viewProps});const o=null!==(e="format"in t.params?t.params.format:void 0)&&void 0!==e?e:Te(dn(i,n.rawValue)),s=i&&Xt(i,Zt);return s?new rn(t.document,{baseStep:hn(i),parser:Le,sliderProps:new V({maxValue:s.values.value("max"),minValue:s.values.value("min")}),textProps:V.fromObject({draggingScale:un(i,n.rawValue),formatter:o}),value:n,viewProps:t.viewProps}):new Xe(t.document,{baseStep:hn(i),parser:Le,props:V.fromObject({draggingScale:un(i,n.rawValue),formatter:o}),value:n,viewProps:t.viewProps})}};class Xi{constructor(t=0,e=0){this.x=t,this.y=e}getComponents(){return[this.x,this.y]}static isObject(t){if(a(t))return!1;return"number"==typeof t.x&&"number"==typeof t.y}static equals(t,e){return t.x===e.x&&t.y===e.y}toObject(){return{x:this.x,y:this.y}}}const Zi={toComponents:t=>t.getComponents(),fromComponents:t=>new Xi(...t)},Ji=f("p2d");class tr{constructor(t,e){this.element=t.createElement("div"),this.element.classList.add(Ji()),e.viewProps.bindClassModifiers(this.element),g(e.expanded,w(this.element,Ji(void 0,"expanded")));const n=t.createElement("div");n.classList.add(Ji("h")),this.element.appendChild(n);const i=t.createElement("button");i.classList.add(Ji("b")),i.appendChild(q(t,"p2dpad")),e.viewProps.bindDisabled(i),n.appendChild(i),this.buttonElement=i;const r=t.createElement("div");if(r.classList.add(Ji("t")),n.appendChild(r),this.textElement=r,"inline"===e.pickerLayout){const e=t.createElement("div");e.classList.add(Ji("p")),this.element.appendChild(e),this.pickerElement=e}else this.pickerElement=null}}const er=f("p2dp");class nr{constructor(t,e){this.onFoldableChange_=this.onFoldableChange_.bind(this),this.onValueChange_=this.onValueChange_.bind(this),this.invertsY_=e.invertsY,this.maxValue_=e.maxValue,this.element=t.createElement("div"),this.element.classList.add(er()),"popup"===e.layout&&this.element.classList.add(er(void 0,"p")),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("div");n.classList.add(er("p")),e.viewProps.bindTabIndex(n),this.element.appendChild(n),this.padElement=n;const i=t.createElementNS(K,"svg");i.classList.add(er("g")),this.padElement.appendChild(i),this.svgElem_=i;const r=t.createElementNS(K,"line");r.classList.add(er("ax")),r.setAttributeNS(null,"x1","0"),r.setAttributeNS(null,"y1","50%"),r.setAttributeNS(null,"x2","100%"),r.setAttributeNS(null,"y2","50%"),this.svgElem_.appendChild(r);const o=t.createElementNS(K,"line");o.classList.add(er("ax")),o.setAttributeNS(null,"x1","50%"),o.setAttributeNS(null,"y1","0"),o.setAttributeNS(null,"x2","50%"),o.setAttributeNS(null,"y2","100%"),this.svgElem_.appendChild(o);const s=t.createElementNS(K,"line");s.classList.add(er("l")),s.setAttributeNS(null,"x1","50%"),s.setAttributeNS(null,"y1","50%"),this.svgElem_.appendChild(s),this.lineElem_=s;const a=t.createElement("div");a.classList.add(er("m")),this.padElement.appendChild(a),this.markerElem_=a,e.value.emitter.on("change",this.onValueChange_),this.value=e.value,this.update_()}get allFocusableElements(){return[this.padElement]}update_(){const[t,e]=this.value.rawValue.getComponents(),n=this.maxValue_,i=qe(t,-n,+n,0,100),r=qe(e,-n,+n,0,100),o=this.invertsY_?100-r:r;this.lineElem_.setAttributeNS(null,"x2",`${i}%`),this.lineElem_.setAttributeNS(null,"y2",`${o}%`),this.markerElem_.style.left=`${i}%`,this.markerElem_.style.top=`${o}%`}onValueChange_(){this.update_()}onFoldableChange_(){this.update_()}}function ir(t,e,n){return[Ie(e[0],Ke(t)),Ie(e[1],Ue(t))*(n?1:-1)]}class rr{constructor(t,e){this.onPadKeyDown_=this.onPadKeyDown_.bind(this),this.onPadKeyUp_=this.onPadKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=e.value,this.viewProps=e.viewProps,this.baseSteps_=e.baseSteps,this.maxValue_=e.maxValue,this.invertsY_=e.invertsY,this.view=new nr(t,{invertsY:this.invertsY_,layout:e.layout,maxValue:this.maxValue_,value:this.value,viewProps:this.viewProps}),this.ptHandler_=new ze(this.view.padElement),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.padElement.addEventListener("keydown",this.onPadKeyDown_),this.view.padElement.addEventListener("keyup",this.onPadKeyUp_)}handlePointerEvent_(t,e){if(!t.point)return;const n=this.maxValue_,i=qe(t.point.x,0,t.bounds.width,-n,+n),r=qe(this.invertsY_?t.bounds.height-t.point.y:t.point.y,0,t.bounds.height,-n,+n);this.value.setRawValue(new Xi(i,r),e)}onPointerDown_(t){this.handlePointerEvent_(t.data,{forceEmit:!1,last:!1})}onPointerMove_(t){this.handlePointerEvent_(t.data,{forceEmit:!1,last:!1})}onPointerUp_(t){this.handlePointerEvent_(t.data,{forceEmit:!0,last:!0})}onPadKeyDown_(t){Be(t.key)&&t.preventDefault();const[e,n]=ir(t,this.baseSteps_,this.invertsY_);0===e&&0===n||this.value.setRawValue(new Xi(this.value.rawValue.x+e,this.value.rawValue.y+n),{forceEmit:!1,last:!1})}onPadKeyUp_(t){const[e,n]=ir(t,this.baseSteps_,this.invertsY_);0===e&&0===n||this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}class or{constructor(t,e){var n,i;this.onPopupChildBlur_=this.onPopupChildBlur_.bind(this),this.onPopupChildKeydown_=this.onPopupChildKeydown_.bind(this),this.onPadButtonBlur_=this.onPadButtonBlur_.bind(this),this.onPadButtonClick_=this.onPadButtonClick_.bind(this),this.value=e.value,this.viewProps=e.viewProps,this.foldable_=nt.create(e.expanded),this.popC_="popup"===e.pickerLayout?new ae(t,{viewProps:this.viewProps}):null;const r=new rr(t,{baseSteps:[e.axes[0].baseStep,e.axes[1].baseStep],invertsY:e.invertsY,layout:e.pickerLayout,maxValue:e.maxValue,value:this.value,viewProps:this.viewProps});r.view.allFocusableElements.forEach((t=>{t.addEventListener("blur",this.onPopupChildBlur_),t.addEventListener("keydown",this.onPopupChildKeydown_)})),this.pickerC_=r,this.textC_=new Gi(t,{assembly:Zi,axes:e.axes,parser:e.parser,value:this.value,viewProps:this.viewProps}),this.view=new tr(t,{expanded:this.foldable_.value("expanded"),pickerLayout:e.pickerLayout,viewProps:this.viewProps}),this.view.textElement.appendChild(this.textC_.view.element),null===(n=this.view.buttonElement)||void 0===n||n.addEventListener("blur",this.onPadButtonBlur_),null===(i=this.view.buttonElement)||void 0===i||i.addEventListener("click",this.onPadButtonClick_),this.popC_?(this.view.element.appendChild(this.popC_.view.element),this.popC_.view.element.appendChild(this.pickerC_.view.element),Fe({primary:this.foldable_.value("expanded"),secondary:this.popC_.shows,forward:t=>t.rawValue,backward:(t,e)=>e.rawValue})):this.view.pickerElement&&(this.view.pickerElement.appendChild(this.pickerC_.view.element),rt(this.foldable_,this.view.pickerElement))}onPadButtonBlur_(t){if(!this.popC_)return;const e=t.relatedTarget;e&&this.view.element.contains(e)||(this.popC_.shows.rawValue=!1)}onPadButtonClick_(){this.foldable_.set("expanded",!this.foldable_.get("expanded")),this.foldable_.get("expanded")&&this.pickerC_.view.allFocusableElements[0].focus()}onPopupChildBlur_(t){if(!this.popC_)return;const e=this.popC_.view.element,n=W(t);n&&e.contains(n)||n&&n===this.view.buttonElement&&!B(e.ownerDocument)||(this.popC_.shows.rawValue=!1)}onPopupChildKeydown_(t){this.popC_?"Escape"===t.key&&(this.popC_.shows.rawValue=!1):this.view.pickerElement&&"Escape"===t.key&&this.view.buttonElement.focus()}}class sr{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}getComponents(){return[this.x,this.y,this.z]}static isObject(t){if(a(t))return!1;return"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.z}static equals(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z}toObject(){return{x:this.x,y:this.y,z:this.z}}}const ar={toComponents:t=>t.getComponents(),fromComponents:t=>new sr(...t)};function lr(t){return sr.isObject(t)?new sr(t.x,t.y,t.z):new sr}function pr(t,e){t.writeProperty("x",e.x),t.writeProperty("y",e.y),t.writeProperty("z",e.z)}function cr(t,e){return{baseStep:hn(e),constraint:e,textProps:V.fromObject({draggingScale:un(e,t),formatter:Te(dn(e,t))})}}const dr={id:"input-point3d",type:"input",accept:(t,e)=>{if(!sr.isObject(t))return null;const n=D,i=A(e,{x:n.optional.custom(ln),y:n.optional.custom(ln),z:n.optional.custom(ln)});return i?{initialValue:t,params:i}:null},binding:{reader:t=>lr,constraint:t=>{return new zi({assembly:ar,components:[Nr("x"in(e=t.params)?e.x:void 0,(n=t.initialValue).x),Nr("y"in e?e.y:void 0,n.y),Nr("z"in e?e.z:void 0,n.z)]});var e,n},equals:sr.equals,writer:t=>pr},controller:t=>{const e=t.value,n=t.constraint;if(!(n instanceof zi))throw d.shouldNeverHappen();return new Gi(t.document,{assembly:ar,axes:[cr(e.rawValue.x,n.components[0]),cr(e.rawValue.y,n.components[1]),cr(e.rawValue.z,n.components[2])],parser:Le,value:e,viewProps:t.viewProps})}};class hr{constructor(t=0,e=0,n=0,i=0){this.x=t,this.y=e,this.z=n,this.w=i}getComponents(){return[this.x,this.y,this.z,this.w]}static isObject(t){if(a(t))return!1;return"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.z&&"number"==typeof t.w}static equals(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w}toObject(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const ur={toComponents:t=>t.getComponents(),fromComponents:t=>new hr(...t)};function vr(t){return hr.isObject(t)?new hr(t.x,t.y,t.z,t.w):new hr}function mr(t,e){t.writeProperty("x",e.x),t.writeProperty("y",e.y),t.writeProperty("z",e.z),t.writeProperty("w",e.w)}const fr={id:"input-point4d",type:"input",accept:(t,e)=>{if(!hr.isObject(t))return null;const n=D,i=A(e,{x:n.optional.custom(ln),y:n.optional.custom(ln),z:n.optional.custom(ln),w:n.optional.custom(ln)});return i?{initialValue:t,params:i}:null},binding:{reader:t=>vr,constraint:t=>{return new zi({assembly:ur,components:[Nr("x"in(e=t.params)?e.x:void 0,(n=t.initialValue).x),Nr("y"in e?e.y:void 0,n.y),Nr("z"in e?e.z:void 0,n.z),Nr("w"in e?e.w:void 0,n.w)]});var e,n},equals:hr.equals,writer:t=>mr},controller:t=>{const e=t.value,n=t.constraint;if(!(n instanceof zi))throw d.shouldNeverHappen();return new Gi(t.document,{assembly:ur,axes:e.rawValue.getComponents().map(((t,e)=>{return i=t,{baseStep:hn(r=n.components[e]),constraint:r,textProps:V.fromObject({draggingScale:un(r,i),formatter:Te(dn(r,i))})};var i,r})),parser:Le,value:e,viewProps:t.viewProps})}};const br={id:"input-string",type:"input",accept:(t,e)=>{if("string"!=typeof t)return null;const n=A(e,{options:D.optional.custom(sn)});return n?{initialValue:t,params:n}:null},binding:{reader:t=>Oe,constraint:t=>function(t){const e=[],n=cn(t.options);return n&&e.push(n),new Qt(e)}(t.params),writer:t=>on},controller:t=>{const e=t.document,n=t.value,i=t.constraint,r=i&&Xt(i,Jt);return r?new re(e,{props:new V({options:r.values.value("options")}),value:n,viewProps:t.viewProps}):new ce(e,{parser:t=>t,props:V.fromObject({formatter:Ne}),value:n,viewProps:t.viewProps})}},gr={monitor:{defaultInterval:200,defaultLineCount:3}},_r=f("mll");class wr{constructor(t,e){this.onValueUpdate_=this.onValueUpdate_.bind(this),this.formatter_=e.formatter,this.element=t.createElement("div"),this.element.classList.add(_r()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("textarea");n.classList.add(_r("i")),n.style.height=`calc(var(--bld-us) * ${e.lineCount})`,n.readOnly=!0,e.viewProps.bindDisabled(n),this.element.appendChild(n),this.textareaElem_=n,e.value.emitter.on("change",this.onValueUpdate_),this.value=e.value,this.update_()}update_(){const t=this.textareaElem_,e=t.scrollTop===t.scrollHeight-t.clientHeight,n=[];this.value.rawValue.forEach((t=>{void 0!==t&&n.push(this.formatter_(t))})),t.textContent=n.join("\n"),e&&(t.scrollTop=t.scrollHeight)}onValueUpdate_(){this.update_()}}class yr{constructor(t,e){this.value=e.value,this.viewProps=e.viewProps,this.view=new wr(t,{formatter:e.formatter,lineCount:e.lineCount,value:this.value,viewProps:this.viewProps})}}const xr=f("sgl");class Cr{constructor(t,e){this.onValueUpdate_=this.onValueUpdate_.bind(this),this.formatter_=e.formatter,this.element=t.createElement("div"),this.element.classList.add(xr()),e.viewProps.bindClassModifiers(this.element);const n=t.createElement("input");n.classList.add(xr("i")),n.readOnly=!0,n.type="text",e.viewProps.bindDisabled(n),this.element.appendChild(n),this.inputElement=n,e.value.emitter.on("change",this.onValueUpdate_),this.value=e.value,this.update_()}update_(){const t=this.value.rawValue,e=t[t.length-1];this.inputElement.value=void 0!==e?this.formatter_(e):""}onValueUpdate_(){this.update_()}}class Pr{constructor(t,e){this.value=e.value,this.viewProps=e.viewProps,this.view=new Cr(t,{formatter:e.formatter,value:this.value,viewProps:this.viewProps})}}const kr={id:"monitor-bool",type:"monitor",accept:(t,e)=>{if("boolean"!=typeof t)return null;const n=A(e,{lineCount:D.optional.number});return n?{initialValue:t,params:n}:null},binding:{reader:t=>de},controller:t=>{var e;return 1===t.value.rawValue.length?new Pr(t.document,{formatter:he,value:t.value,viewProps:t.viewProps}):new yr(t.document,{formatter:he,lineCount:null!==(e=t.params.lineCount)&&void 0!==e?e:gr.monitor.defaultLineCount,value:t.value,viewProps:t.viewProps})}},Er=f("grl");class Mr{constructor(t,e){this.onCursorChange_=this.onCursorChange_.bind(this),this.onValueUpdate_=this.onValueUpdate_.bind(this),this.element=t.createElement("div"),this.element.classList.add(Er()),e.viewProps.bindClassModifiers(this.element),this.formatter_=e.formatter,this.props_=e.props,this.cursor_=e.cursor,this.cursor_.emitter.on("change",this.onCursorChange_);const n=t.createElementNS(K,"svg");n.classList.add(Er("g")),n.style.height=`calc(var(--bld-us) * ${e.lineCount})`,this.element.appendChild(n),this.svgElem_=n;const i=t.createElementNS(K,"polyline");this.svgElem_.appendChild(i),this.lineElem_=i;const r=t.createElement("div");r.classList.add(Er("t"),f("tt")()),this.element.appendChild(r),this.tooltipElem_=r,e.value.emitter.on("change",this.onValueUpdate_),this.value=e.value,this.update_()}get graphElement(){return this.svgElem_}update_(){const t=this.svgElem_.getBoundingClientRect(),e=this.value.rawValue.length-1,n=this.props_.get("minValue"),i=this.props_.get("maxValue"),r=[];this.value.rawValue.forEach(((o,s)=>{if(void 0===o)return;const a=qe(s,0,e,0,t.width),l=qe(o,n,i,t.height,0);r.push([a,l].join(","))})),this.lineElem_.setAttributeNS(null,"points",r.join(" "));const o=this.tooltipElem_,s=this.value.rawValue[this.cursor_.rawValue];if(void 0===s)return void o.classList.remove(Er("t","a"));const a=qe(this.cursor_.rawValue,0,e,0,t.width),l=qe(s,n,i,t.height,0);o.style.left=`${a}px`,o.style.top=`${l}px`,o.textContent=`${this.formatter_(s)}`,o.classList.contains(Er("t","a"))||(o.classList.add(Er("t","a"),Er("t","in")),o.classList.remove(Er("t","in")))}onValueUpdate_(){this.update_()}onCursorChange_(){this.update_()}}class Vr{constructor(t,e){if(this.onGraphMouseMove_=this.onGraphMouseMove_.bind(this),this.onGraphMouseLeave_=this.onGraphMouseLeave_.bind(this),this.onGraphPointerDown_=this.onGraphPointerDown_.bind(this),this.onGraphPointerMove_=this.onGraphPointerMove_.bind(this),this.onGraphPointerUp_=this.onGraphPointerUp_.bind(this),this.props_=e.props,this.value=e.value,this.viewProps=e.viewProps,this.cursor_=M(-1),this.view=new Mr(t,{cursor:this.cursor_,formatter:e.formatter,lineCount:e.lineCount,props:this.props_,value:this.value,viewProps:this.viewProps}),B(t)){const t=new ze(this.view.element);t.emitter.on("down",this.onGraphPointerDown_),t.emitter.on("move",this.onGraphPointerMove_),t.emitter.on("up",this.onGraphPointerUp_)}else this.view.element.addEventListener("mousemove",this.onGraphMouseMove_),this.view.element.addEventListener("mouseleave",this.onGraphMouseLeave_)}onGraphMouseLeave_(){this.cursor_.rawValue=-1}onGraphMouseMove_(t){const e=this.view.element.getBoundingClientRect();this.cursor_.rawValue=Math.floor(qe(t.offsetX,0,e.width,0,this.value.rawValue.length))}onGraphPointerDown_(t){this.onGraphPointerMove_(t)}onGraphPointerMove_(t){this.cursor_.rawValue=t.data.point?Math.floor(qe(t.data.point.x,0,t.data.bounds.width,0,this.value.rawValue.length)):-1}onGraphPointerUp_(){this.cursor_.rawValue=-1}}function Sr(t){return"format"in t&&!a(t.format)?t.format:Te(2)}function Lr(t){return"view"in t&&"graph"===t.view}const Dr={id:"monitor-number",type:"monitor",accept:(t,e)=>{if("number"!=typeof t)return null;const n=A(e,{format:D.optional.function,lineCount:D.optional.number,max:D.optional.number,min:D.optional.number,view:D.optional.string});return n?{initialValue:t,params:n}:null},binding:{defaultBufferSize:t=>Lr(t)?64:1,reader:t=>De},controller:t=>Lr(t.params)?function(t){var e,n,i;return new Vr(t.document,{formatter:Sr(t.params),lineCount:null!==(e=t.params.lineCount)&&void 0!==e?e:gr.monitor.defaultLineCount,props:V.fromObject({maxValue:null!==(n="max"in t.params?t.params.max:null)&&void 0!==n?n:100,minValue:null!==(i="min"in t.params?t.params.min:null)&&void 0!==i?i:0}),value:t.value,viewProps:t.viewProps})}(t):function(t){var e;return 1===t.value.rawValue.length?new Pr(t.document,{formatter:Sr(t.params),value:t.value,viewProps:t.viewProps}):new yr(t.document,{formatter:Sr(t.params),lineCount:null!==(e=t.params.lineCount)&&void 0!==e?e:gr.monitor.defaultLineCount,value:t.value,viewProps:t.viewProps})}(t)},Ar={id:"monitor-string",type:"monitor",accept:(t,e)=>{if("string"!=typeof t)return null;const n=A(e,{lineCount:D.optional.number,multiline:D.optional.boolean});return n?{initialValue:t,params:n}:null},binding:{reader:t=>Oe},controller:t=>{var e;const n=t.value;return n.rawValue.length>1||"multiline"in t.params&&t.params.multiline?new yr(t.document,{formatter:Ne,lineCount:null!==(e=t.params.lineCount)&&void 0!==e?e:gr.monitor.defaultLineCount,value:n,viewProps:t.viewProps}):new Pr(t.document,{formatter:Ne,value:n,viewProps:t.viewProps})}};function Tr(t,e){return 0===e?new Ht:new zt(t,null!=e?e:gr.monitor.defaultInterval)}class jr{constructor(){this.pluginsMap_={blades:[],inputs:[],monitors:[]}}getAll(){return[...this.pluginsMap_.blades,...this.pluginsMap_.inputs,...this.pluginsMap_.monitors]}register(t){"blade"===t.type?this.pluginsMap_.blades.unshift(t):"input"===t.type?this.pluginsMap_.inputs.unshift(t):"monitor"===t.type&&this.pluginsMap_.monitors.unshift(t)}createInput(t,e,n){if(a(e.read()))throw new d({context:{key:e.key},type:"nomatchingcontroller"});const i=this.pluginsMap_.inputs.reduce(((i,r)=>null!=i?i:function(t,e){const n=t.accept(e.target.read(),e.params);if(a(n))return null;const i=D,r={target:e.target,initialValue:n.initialValue,params:n.params},o=t.binding.reader(r),s=t.binding.constraint?t.binding.constraint(r):void 0,l=M(o(n.initialValue),{constraint:s,equals:t.binding.equals}),p=new qt({reader:o,target:e.target,value:l,writer:t.binding.writer(r)}),c=i.optional.boolean(e.params.disabled).value,d=i.optional.boolean(e.params.hidden).value,h=t.controller({constraint:s,document:e.document,initialValue:n.initialValue,params:n.params,value:p.value,viewProps:N.create({disabled:c,hidden:d})}),u=i.optional.string(e.params.label).value;return new lt(e.document,{binding:p,blade:et(),props:V.fromObject({label:null!=u?u:e.target.key}),valueController:h})}(r,{document:t,target:e,params:n})),null);if(i)return i;throw new d({context:{key:e.key},type:"nomatchingcontroller"})}createMonitor(t,e,n){const i=this.pluginsMap_.monitors.reduce(((i,r)=>null!=i?i:function(t,e){var n,i,r;const o=D,s=t.accept(e.target.read(),e.params);if(a(s))return null;const l=t.binding.reader({target:e.target,initialValue:s.initialValue,params:s.params}),p=null!==(i=null!==(n=o.optional.number(e.params.bufferSize).value)&&void 0!==n?n:t.binding.defaultBufferSize&&t.binding.defaultBufferSize(s.params))&&void 0!==i?i:1,c=o.optional.number(e.params.interval).value,d=new Wt({reader:l,target:e.target,ticker:Tr(e.document,c),value:Gt(p)}),h=o.optional.boolean(e.params.disabled).value,u=o.optional.boolean(e.params.hidden).value,v=t.controller({document:e.document,params:s.params,value:d.value,viewProps:N.create({disabled:h,hidden:u})}),m=null!==(r=o.optional.string(e.params.label).value)&&void 0!==r?r:e.target.key;return new ct(e.document,{binding:d,blade:et(),props:V.fromObject({label:m}),valueController:v})}(r,{document:t,params:n,target:e})),null);if(i)return i;throw new d({context:{key:e.key},type:"nomatchingcontroller"})}createBlade(t,e){const n=this.pluginsMap_.blades.reduce(((n,i)=>null!=n?n:function(t,e){const n=t.accept(e.params);if(!n)return null;const i=D.optional.boolean(e.params.disabled).value,r=D.optional.boolean(e.params.hidden).value;return t.controller({blade:et(),document:e.document,params:Object.assign(Object.assign({},n.params),{disabled:i,hidden:r}),viewProps:N.create({disabled:i,hidden:r})})}(i,{document:t,params:e})),null);if(!n)throw new d({type:"nomatchingview",context:{params:e}});return n}createBladeApi(t){if(t instanceof lt)return new at(t);if(t instanceof ct)return new pt(t);if(t instanceof yt)return new vt(t,this);const e=this.pluginsMap_.blades.reduce(((e,n)=>null!=e?e:n.api({controller:t,pool:this})),null);if(!e)throw d.shouldNeverHappen();return e}}function Rr(t){return Xi.isObject(t)?new Xi(t.x,t.y):new Xi}function Or(t,e){t.writeProperty("x",e.x),t.writeProperty("y",e.y)}function Nr(t,e){if(!t)return;const n=[],i=Yi(t,e);i&&n.push(i);const r=Wi(t);return r&&n.push(r),new Qt(n)}function Fr(t,e){const[n,i]=t?function(t){const e=Xt(t,Zt);if(e)return[e.values.get("min"),e.values.get("max")];const n=Xt(t,te);return n?[n.minValue,n.maxValue]:[void 0,void 0]}(t):[];if(!a(n)||!a(i))return Math.max(Math.abs(null!=n?n:0),Math.abs(null!=i?i:0));const r=hn(t);return Math.max(10*Math.abs(r),10*Math.abs(e))}function Ir(t,e){const n=e instanceof zi?e.components[1]:void 0,i=Fr(e instanceof zi?e.components[0]:void 0,t.x),r=Fr(n,t.y);return Math.max(i,r)}function Ur(t,e){return{baseStep:hn(e),constraint:e,textProps:V.fromObject({draggingScale:un(e,t),formatter:Te(dn(e,t))})}}function Kr(t){if(!("y"in t))return!1;const e=t.y;return!!e&&("inverted"in e&&!!e.inverted)}const Br={id:"input-point2d",type:"input",accept:(t,e)=>{if(!Xi.isObject(t))return null;const n=D,i=A(e,{expanded:n.optional.boolean,picker:n.optional.custom(an),x:n.optional.custom(ln),y:n.optional.object({inverted:n.optional.boolean,max:n.optional.number,min:n.optional.number,step:n.optional.number})});return i?{initialValue:t,params:i}:null},binding:{reader:t=>Rr,constraint:t=>{return new zi({assembly:Zi,components:[Nr("x"in(e=t.params)?e.x:void 0,(n=t.initialValue).x),Nr("y"in e?e.y:void 0,n.y)]});var e,n},equals:Xi.equals,writer:t=>Or},controller:t=>{const e=t.document,n=t.value,i=t.constraint;if(!(i instanceof zi))throw d.shouldNeverHappen();const r="expanded"in t.params?t.params.expanded:void 0,o="picker"in t.params?t.params.picker:void 0;return new or(e,{axes:[Ur(n.rawValue.x,i.components[0]),Ur(n.rawValue.y,i.components[1])],expanded:null!=r&&r,invertsY:Kr(t.params),maxValue:Ir(n.rawValue,i),parser:Le,pickerLayout:null!=o?o:"popup",value:n,viewProps:t.viewProps})}};class Hr extends e{constructor(t){super(t),this.emitter_=new v,this.controller_.valueController.value.emitter.on("change",(t=>{this.emitter_.emit("change",{event:new i(this,t.rawValue)})}))}get label(){return this.controller_.props.get("label")}set label(t){this.controller_.props.set("label",t)}get options(){return this.controller_.valueController.props.get("options")}set options(t){this.controller_.valueController.props.set("options",t)}get value(){return this.controller_.valueController.value.rawValue}set value(t){this.controller_.valueController.value.rawValue=t}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}}class zr extends e{constructor(t){super(t),this.emitter_=new v,this.controller_.valueController.value.emitter.on("change",(t=>{this.emitter_.emit("change",{event:new i(this,t.rawValue)})}))}get label(){return this.controller_.props.get("label")}set label(t){this.controller_.props.set("label",t)}get maxValue(){return this.controller_.valueController.sliderController.props.get("maxValue")}set maxValue(t){this.controller_.valueController.sliderController.props.set("maxValue",t)}get minValue(){return this.controller_.valueController.sliderController.props.get("minValue")}set minValue(t){this.controller_.valueController.sliderController.props.set("minValue",t)}get value(){return this.controller_.valueController.value.rawValue}set value(t){this.controller_.valueController.value.rawValue=t}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}}class qr extends e{constructor(t){super(t),this.emitter_=new v,this.controller_.valueController.value.emitter.on("change",(t=>{this.emitter_.emit("change",{event:new i(this,t.rawValue)})}))}get label(){return this.controller_.props.get("label")}set label(t){this.controller_.props.set("label",t)}get formatter(){return this.controller_.valueController.props.get("formatter")}set formatter(t){this.controller_.valueController.props.set("formatter",t)}get value(){return this.controller_.valueController.value.rawValue}set value(t){this.controller_.valueController.value.rawValue=t}on(t,e){const n=e.bind(this);return this.emitter_.on(t,(t=>{n(t.event)})),this}}const $r={id:"list",type:"blade",accept(t){const e=D,n=A(t,{options:e.required.custom(sn),value:e.required.raw,view:e.required.constant("list"),label:e.optional.string});return n?{params:n}:null},controller(t){const e=new Jt(pn(t.params.options)),n=M(t.params.value,{constraint:e}),i=new re(t.document,{props:new V({options:e.values.value("options")}),value:n,viewProps:t.viewProps});return new Et(t.document,{blade:t.blade,props:V.fromObject({label:t.params.label}),valueController:i})},api:t=>t.controller instanceof Et&&t.controller.valueController instanceof re?new Hr(t.controller):null};class Gr extends mt{constructor(t,e){super(t,e)}get element(){return this.controller_.view.element}importPreset(t){!function(t,e){t.forEach((t=>{const n=e[t.target.presetKey];void 0!==n&&t.writer(t.target,t.reader(n))}))}(this.controller_.rackController.rack.find(lt).map((t=>t.binding)),t),this.refresh()}exportPreset(){return function(t){return t.reduce(((t,e)=>Object.assign(t,{[e.presetKey]:e.read()})),{})}(this.controller_.rackController.rack.find(lt).map((t=>t.binding.target)))}refresh(){this.controller_.rackController.rack.find(lt).forEach((t=>{t.binding.read()})),this.controller_.rackController.rack.find(ct).forEach((t=>{t.binding.read()}))}}class Yr extends Pt{constructor(t,e){super(t,{expanded:e.expanded,blade:e.blade,props:e.props,root:!0,viewProps:e.viewProps})}}const Wr={id:"slider",type:"blade",accept(t){const e=D,n=A(t,{max:e.required.number,min:e.required.number,view:e.required.constant("slider"),format:e.optional.function,label:e.optional.string,value:e.optional.number});return n?{params:n}:null},controller(t){var e,n;const i=null!==(e=t.params.value)&&void 0!==e?e:0,r=new Zt({max:t.params.max,min:t.params.min}),o=new rn(t.document,{baseStep:1,parser:Le,sliderProps:new V({maxValue:r.values.value("max"),minValue:r.values.value("min")}),textProps:V.fromObject({draggingScale:un(void 0,i),formatter:null!==(n=t.params.format)&&void 0!==n?n:Ae}),value:M(i,{constraint:r}),viewProps:t.viewProps});return new Et(t.document,{blade:t.blade,props:V.fromObject({label:t.params.label}),valueController:o})},api:t=>t.controller instanceof Et&&t.controller.valueController instanceof rn?new zr(t.controller):null},Qr={id:"text",type:"blade",accept(t){const e=D,n=A(t,{parse:e.required.function,value:e.required.raw,view:e.required.constant("text"),format:e.optional.function,label:e.optional.string});return n?{params:n}:null},controller(t){var e;const n=new ce(t.document,{parser:t.params.parse,props:V.fromObject({formatter:null!==(e=t.params.format)&&void 0!==e?e:t=>String(t)}),value:M(t.params.value),viewProps:t.viewProps});return new Et(t.document,{blade:t.blade,props:V.fromObject({label:t.params.label}),valueController:n})},api:t=>t.controller instanceof Et&&t.controller.valueController instanceof ce?new qr(t.controller):null};function Xr(t,e,n){if(t.querySelector(`style[data-tp-style=${e}]`))return;const i=t.createElement("style");i.dataset.tpStyle=e,i.textContent=n,t.head.appendChild(i)}const Zr=new class{constructor(t){const[e,n]=t.split("-"),i=e.split(".");this.major=parseInt(i[0],10),this.minor=parseInt(i[1],10),this.patch=parseInt(i[2],10),this.prerelease=null!=n?n:null}toString(){const t=[this.major,this.minor,this.patch].join(".");return null!==this.prerelease?[t,this.prerelease].join("-"):t}}("3.1.6");t.BladeApi=e,t.ButtonApi=u,t.FolderApi=mt,t.InputBindingApi=at,t.ListApi=Hr,t.MonitorBindingApi=pt,t.Pane=class extends Gr{constructor(t){var e,n;const i=null!=t?t:{},r=null!==(e=i.document)&&void 0!==e?e:H(),o=function(){const t=new jr;return[Br,dr,fr,br,Qi,Hi,Bi,Ii,bn,kr,Ar,Dr,J,kt,Dt,Bt].forEach((e=>{t.register(e)})),t}();super(new Yr(r,{expanded:i.expanded,blade:et(),props:V.fromObject({title:i.title}),viewProps:N.create()}),o),this.pool_=o,this.containerElem_=null!==(n=i.container)&&void 0!==n?n:function(t){const e=t.createElement("div");return e.classList.add(f("dfw")()),t.body&&t.body.appendChild(e),e}(r),this.containerElem_.appendChild(this.element),this.doc_=r,this.usesDefaultWrapper_=!i.container,this.setUpDefaultPlugins_()}get document(){if(!this.doc_)throw d.alreadyDisposed();return this.doc_}dispose(){const t=this.containerElem_;if(!t)throw d.alreadyDisposed();if(this.usesDefaultWrapper_){const e=t.parentElement;e&&e.removeChild(t)}this.containerElem_=null,this.doc_=null,super.dispose()}registerPlugin(t){("plugin"in t?[t.plugin]:"plugins"in t?t.plugins:[]).forEach((t=>{this.pool_.register(t),this.embedPluginStyle_(t)}))}embedPluginStyle_(t){t.css&&Xr(this.document,`plugin-${t.id}`,t.css)}setUpDefaultPlugins_(){Xr(this.document,"default",'.tp-tbiv_b,.tp-coltxtv_ms,.tp-ckbv_i,.tp-rotv_b,.tp-fldv_b,.tp-mllv_i,.tp-sglv_i,.tp-grlv_g,.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw,.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-p2dv_b:hover,.tp-btnv_b:hover,.tp-lstv_s:hover{background-color:var(--btn-bg-h)}.tp-p2dv_b:focus,.tp-btnv_b:focus,.tp-lstv_s:focus{background-color:var(--btn-bg-f)}.tp-p2dv_b:active,.tp-btnv_b:active,.tp-lstv_s:active{background-color:var(--btn-bg-a)}.tp-p2dv_b:disabled,.tp-btnv_b:disabled,.tp-lstv_s:disabled{opacity:.5}.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-txtv_i:hover,.tp-p2dpv_p:hover,.tp-colswv_sw:hover{background-color:var(--in-bg-h)}.tp-txtv_i:focus,.tp-p2dpv_p:focus,.tp-colswv_sw:focus{background-color:var(--in-bg-f)}.tp-txtv_i:active,.tp-p2dpv_p:active,.tp-colswv_sw:active{background-color:var(--in-bg-a)}.tp-txtv_i:disabled,.tp-p2dpv_p:disabled,.tp-colswv_sw:disabled{opacity:.5}.tp-mllv_i,.tp-sglv_i,.tp-grlv_g{background-color:var(--mo-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--mo-fg);height:var(--bld-us);scrollbar-color:currentColor rgba(0,0,0,0);scrollbar-width:thin;width:100%}.tp-mllv_i::-webkit-scrollbar,.tp-sglv_i::-webkit-scrollbar,.tp-grlv_g::-webkit-scrollbar{height:8px;width:8px}.tp-mllv_i::-webkit-scrollbar-corner,.tp-sglv_i::-webkit-scrollbar-corner,.tp-grlv_g::-webkit-scrollbar-corner{background-color:rgba(0,0,0,0)}.tp-mllv_i::-webkit-scrollbar-thumb,.tp-sglv_i::-webkit-scrollbar-thumb,.tp-grlv_g::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:currentColor;border:rgba(0,0,0,0) solid 2px;border-radius:4px}.tp-rotv{--font-family: var(--tp-font-family, Roboto Mono, Source Code Pro, Menlo, Courier, monospace);--bs-br: var(--tp-base-border-radius, 6px);--cnt-h-p: var(--tp-container-horizontal-padding, 4px);--cnt-v-p: var(--tp-container-vertical-padding, 4px);--elm-br: var(--tp-element-border-radius, 2px);--bld-s: var(--tp-blade-spacing, 4px);--bld-us: var(--tp-blade-unit-size, 20px);--bs-bg: var(--tp-base-background-color, hsl(230, 7%, 17%));--bs-sh: var(--tp-base-shadow-color, rgba(0, 0, 0, 0.2));--btn-bg: var(--tp-button-background-color, hsl(230, 7%, 70%));--btn-bg-a: var(--tp-button-background-color-active, #d6d7db);--btn-bg-f: var(--tp-button-background-color-focus, #c8cad0);--btn-bg-h: var(--tp-button-background-color-hover, #bbbcc4);--btn-fg: var(--tp-button-foreground-color, hsl(230, 7%, 17%));--cnt-bg: var(--tp-container-background-color, rgba(187, 188, 196, 0.1));--cnt-bg-a: var(--tp-container-background-color-active, rgba(187, 188, 196, 0.25));--cnt-bg-f: var(--tp-container-background-color-focus, rgba(187, 188, 196, 0.2));--cnt-bg-h: var(--tp-container-background-color-hover, rgba(187, 188, 196, 0.15));--cnt-fg: var(--tp-container-foreground-color, hsl(230, 7%, 75%));--in-bg: var(--tp-input-background-color, rgba(187, 188, 196, 0.1));--in-bg-a: var(--tp-input-background-color-active, rgba(187, 188, 196, 0.25));--in-bg-f: var(--tp-input-background-color-focus, rgba(187, 188, 196, 0.2));--in-bg-h: var(--tp-input-background-color-hover, rgba(187, 188, 196, 0.15));--in-fg: var(--tp-input-foreground-color, hsl(230, 7%, 75%));--lbl-fg: var(--tp-label-foreground-color, rgba(187, 188, 196, 0.7));--mo-bg: var(--tp-monitor-background-color, rgba(0, 0, 0, 0.2));--mo-fg: var(--tp-monitor-foreground-color, rgba(187, 188, 196, 0.7));--grv-fg: var(--tp-groove-foreground-color, rgba(187, 188, 196, 0.1))}.tp-rotv_c>.tp-cntv.tp-v-lst,.tp-tabv_c .tp-brkv>.tp-cntv.tp-v-lst,.tp-fldv_c>.tp-cntv.tp-v-lst{margin-bottom:calc(-1*var(--cnt-v-p))}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_c{border-bottom-left-radius:0}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_b{border-bottom-left-radius:0}.tp-rotv_c>*:not(.tp-v-fst),.tp-tabv_c .tp-brkv>*:not(.tp-v-fst),.tp-fldv_c>*:not(.tp-v-fst){margin-top:var(--bld-s)}.tp-rotv_c>.tp-sprv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-fst),.tp-fldv_c>.tp-sprv:not(.tp-v-fst),.tp-rotv_c>.tp-cntv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-fst),.tp-fldv_c>.tp-cntv:not(.tp-v-fst){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-sprv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-rotv_c>.tp-cntv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-cntv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-cntv+*:not(.tp-v-hidden){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-fldv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-rotv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-fldv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv{margin-top:0}.tp-tabv_c .tp-brkv>.tp-cntv,.tp-fldv_c>.tp-cntv{margin-left:4px}.tp-tabv_c .tp-brkv>.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-fldv>.tp-fldv_b{border-top-left-radius:var(--elm-br);border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-fldv.tp-fldv-expanded>.tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-fldv-expanded>.tp-fldv_b{border-bottom-left-radius:0}.tp-tabv_c .tp-brkv .tp-fldv>.tp-fldv_c,.tp-fldv_c .tp-fldv>.tp-fldv_c{border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-cntv+.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-cntv+.tp-fldv>.tp-fldv_b{border-top-left-radius:0}.tp-tabv_c .tp-brkv>.tp-cntv+.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-cntv+.tp-tabv>.tp-tabv_t{border-top-left-radius:0}.tp-tabv_c .tp-brkv>.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-tabv>.tp-tabv_t{border-top-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv .tp-tabv>.tp-tabv_c,.tp-fldv_c .tp-tabv>.tp-tabv_c{border-bottom-left-radius:var(--elm-br)}.tp-rotv_b,.tp-fldv_b{background-color:var(--cnt-bg);color:var(--cnt-fg);cursor:pointer;display:block;height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);overflow:hidden;padding-left:var(--cnt-h-p);padding-right:calc(4px + var(--bld-us) + var(--cnt-h-p));position:relative;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%;transition:border-radius .2s ease-in-out .2s}.tp-rotv_b:hover,.tp-fldv_b:hover{background-color:var(--cnt-bg-h)}.tp-rotv_b:focus,.tp-fldv_b:focus{background-color:var(--cnt-bg-f)}.tp-rotv_b:active,.tp-fldv_b:active{background-color:var(--cnt-bg-a)}.tp-rotv_b:disabled,.tp-fldv_b:disabled{opacity:.5}.tp-rotv_m,.tp-fldv_m{background:linear-gradient(to left, var(--cnt-fg), var(--cnt-fg) 2px, transparent 2px, transparent 4px, var(--cnt-fg) 4px);border-radius:2px;bottom:0;content:"";display:block;height:6px;right:calc(var(--cnt-h-p) + (var(--bld-us) + 4px - 6px)/2 - 2px);margin:auto;opacity:.5;position:absolute;top:0;transform:rotate(90deg);transition:transform .2s ease-in-out;width:6px}.tp-rotv.tp-rotv-expanded .tp-rotv_m,.tp-fldv.tp-fldv-expanded>.tp-fldv_b>.tp-fldv_m{transform:none}.tp-rotv_c,.tp-fldv_c{box-sizing:border-box;height:0;opacity:0;overflow:hidden;padding-bottom:0;padding-top:0;position:relative;transition:height .2s ease-in-out,opacity .2s linear,padding .2s ease-in-out}.tp-rotv.tp-rotv-cpl:not(.tp-rotv-expanded) .tp-rotv_c,.tp-fldv.tp-fldv-cpl:not(.tp-fldv-expanded)>.tp-fldv_c{display:none}.tp-rotv.tp-rotv-expanded .tp-rotv_c,.tp-fldv.tp-fldv-expanded>.tp-fldv_c{opacity:1;padding-bottom:var(--cnt-v-p);padding-top:var(--cnt-v-p);transform:none;overflow:visible;transition:height .2s ease-in-out,opacity .2s linear .2s,padding .2s ease-in-out}.tp-lstv,.tp-coltxtv_m{position:relative}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m,.tp-coltxtv_mm{bottom:0;margin:auto;pointer-events:none;position:absolute;right:2px;top:0}.tp-lstv_m svg,.tp-coltxtv_mm svg{bottom:0;height:16px;margin:auto;position:absolute;right:0;top:0;width:16px}.tp-lstv_m svg path,.tp-coltxtv_mm svg path{fill:currentColor}.tp-pndtxtv,.tp-coltxtv_w{display:flex}.tp-pndtxtv_a,.tp-coltxtv_c{width:100%}.tp-pndtxtv_a+.tp-pndtxtv_a,.tp-coltxtv_c+.tp-pndtxtv_a,.tp-pndtxtv_a+.tp-coltxtv_c,.tp-coltxtv_c+.tp-coltxtv_c{margin-left:2px}.tp-btnv_b{width:100%}.tp-btnv_t{text-align:center}.tp-ckbv_l{display:block;position:relative}.tp-ckbv_i{left:0;opacity:0;position:absolute;top:0}.tp-ckbv_w{background-color:var(--in-bg);border-radius:var(--elm-br);cursor:pointer;display:block;height:var(--bld-us);position:relative;width:var(--bld-us)}.tp-ckbv_w svg{bottom:0;display:block;height:16px;left:0;margin:auto;opacity:0;position:absolute;right:0;top:0;width:16px}.tp-ckbv_w svg path{fill:none;stroke:var(--in-fg);stroke-width:2}.tp-ckbv_i:hover+.tp-ckbv_w{background-color:var(--in-bg-h)}.tp-ckbv_i:focus+.tp-ckbv_w{background-color:var(--in-bg-f)}.tp-ckbv_i:active+.tp-ckbv_w{background-color:var(--in-bg-a)}.tp-ckbv_i:checked+.tp-ckbv_w svg{opacity:1}.tp-ckbv.tp-v-disabled .tp-ckbv_w{opacity:.5}.tp-colv{position:relative}.tp-colv_h{display:flex}.tp-colv_s{flex-grow:0;flex-shrink:0;width:var(--bld-us)}.tp-colv_t{flex:1;margin-left:4px}.tp-colv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-colv.tp-colv-cpl .tp-colv_p{overflow:visible}.tp-colv.tp-colv-expanded .tp-colv_p{margin-top:var(--bld-s);opacity:1}.tp-colv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-colpv_h,.tp-colpv_ap{margin-left:6px;margin-right:6px}.tp-colpv_h{margin-top:var(--bld-s)}.tp-colpv_rgb{display:flex;margin-top:var(--bld-s);width:100%}.tp-colpv_a{display:flex;margin-top:var(--cnt-v-p);padding-top:calc(var(--cnt-v-p) + 2px);position:relative}.tp-colpv_a::before{background-color:var(--grv-fg);content:"";height:2px;left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:0}.tp-colpv.tp-v-disabled .tp-colpv_a::before{opacity:.5}.tp-colpv_ap{align-items:center;display:flex;flex:3}.tp-colpv_at{flex:1;margin-left:4px}.tp-svpv{border-radius:var(--elm-br);outline:none;overflow:hidden;position:relative}.tp-svpv.tp-v-disabled{opacity:.5}.tp-svpv_c{cursor:crosshair;display:block;height:calc(var(--bld-us)*4);width:100%}.tp-svpv_m{border-radius:100%;border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;filter:drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));height:12px;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;width:12px}.tp-svpv:focus .tp-svpv_m{border-color:#fff}.tp-hplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative}.tp-hplv.tp-v-disabled{opacity:.5}.tp-hplv_c{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAABCAYAAABubagXAAAAQ0lEQVQoU2P8z8Dwn0GCgQEDi2OK/RBgYHjBgIpfovFh8j8YBIgzFGQxuqEgPhaDOT5gOhPkdCxOZeBg+IDFZZiGAgCaSSMYtcRHLgAAAABJRU5ErkJggg==);background-position:left top;background-repeat:no-repeat;background-size:100% 100%;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;position:absolute;top:50%;width:100%}.tp-hplv_m{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-shadow:0 0 2px rgba(0,0,0,.1);box-sizing:border-box;height:12px;left:50%;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;top:50%;width:12px}.tp-hplv:focus .tp-hplv_m{border-color:#fff}.tp-aplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative;width:100%}.tp-aplv.tp-v-disabled{opacity:.5}.tp-aplv_b{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:4px 4px;background-position:0 0,2px 2px;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;overflow:hidden;position:absolute;top:50%;width:100%}.tp-aplv_c{bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv_m{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:12px 12px;background-position:0 0,6px 6px;border-radius:var(--elm-br);box-shadow:0 0 2px rgba(0,0,0,.1);height:12px;left:50%;margin-left:-6px;margin-top:-6px;overflow:hidden;pointer-events:none;position:absolute;top:50%;width:12px}.tp-aplv_p{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv:focus .tp-aplv_p{border-color:#fff}.tp-colswv{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:10px 10px;background-position:0 0,5px 5px;border-radius:var(--elm-br);overflow:hidden}.tp-colswv.tp-v-disabled{opacity:.5}.tp-colswv_sw{border-radius:0}.tp-colswv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;cursor:pointer;display:block;height:var(--bld-us);left:0;margin:0;outline:none;padding:0;position:absolute;top:0;width:var(--bld-us)}.tp-colswv_b:focus::after{border:rgba(255,255,255,.75) solid 2px;border-radius:var(--elm-br);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.tp-coltxtv{display:flex;width:100%}.tp-coltxtv_m{margin-right:4px}.tp-coltxtv_ms{border-radius:var(--elm-br);color:var(--lbl-fg);cursor:pointer;height:var(--bld-us);line-height:var(--bld-us);padding:0 18px 0 4px}.tp-coltxtv_ms:hover{background-color:var(--in-bg-h)}.tp-coltxtv_ms:focus{background-color:var(--in-bg-f)}.tp-coltxtv_ms:active{background-color:var(--in-bg-a)}.tp-coltxtv_mm{color:var(--lbl-fg)}.tp-coltxtv.tp-v-disabled .tp-coltxtv_mm{opacity:.5}.tp-coltxtv_w{flex:1}.tp-dfwv{position:absolute;top:8px;right:8px;width:256px}.tp-fldv{position:relative}.tp-fldv.tp-fldv-not .tp-fldv_b{display:none}.tp-fldv_t{padding-left:4px}.tp-fldv_b:disabled .tp-fldv_m{display:none}.tp-fldv_c{padding-left:4px}.tp-fldv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--bld-us) + 4px);width:var(--bs-br)}.tp-fldv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-fldv_b:hover+.tp-fldv_i{color:var(--cnt-bg-h)}.tp-fldv_b:focus+.tp-fldv_i{color:var(--cnt-bg-f)}.tp-fldv_b:active+.tp-fldv_i{color:var(--cnt-bg-a)}.tp-fldv.tp-v-disabled>.tp-fldv_i{opacity:.5}.tp-grlv{position:relative}.tp-grlv_g{display:block;height:calc(var(--bld-us)*3)}.tp-grlv_g polyline{fill:none;stroke:var(--mo-fg);stroke-linejoin:round}.tp-grlv_t{margin-top:-4px;transition:left .05s,top .05s;visibility:hidden}.tp-grlv_t.tp-grlv_t-a{visibility:visible}.tp-grlv_t.tp-grlv_t-in{transition:none}.tp-grlv.tp-v-disabled .tp-grlv_g{opacity:.5}.tp-grlv .tp-ttv{background-color:var(--mo-fg)}.tp-grlv .tp-ttv::before{border-top-color:var(--mo-fg)}.tp-lblv{align-items:center;display:flex;line-height:1.3;padding-left:var(--cnt-h-p);padding-right:var(--cnt-h-p)}.tp-lblv.tp-lblv-nol{display:block}.tp-lblv_l{color:var(--lbl-fg);flex:1;-webkit-hyphens:auto;hyphens:auto;overflow:hidden;padding-left:4px;padding-right:16px}.tp-lblv.tp-v-disabled .tp-lblv_l{opacity:.5}.tp-lblv.tp-lblv-nol .tp-lblv_l{display:none}.tp-lblv_v{align-self:flex-start;flex-grow:0;flex-shrink:0;width:160px}.tp-lblv.tp-lblv-nol .tp-lblv_v{width:100%}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m{color:var(--btn-fg)}.tp-sglv_i{padding:0 4px}.tp-sglv.tp-v-disabled .tp-sglv_i{opacity:.5}.tp-mllv_i{display:block;height:calc(var(--bld-us)*3);line-height:var(--bld-us);padding:0 4px;resize:none;white-space:pre}.tp-mllv.tp-v-disabled .tp-mllv_i{opacity:.5}.tp-p2dv{position:relative}.tp-p2dv_h{display:flex}.tp-p2dv_b{height:var(--bld-us);margin-right:4px;position:relative;width:var(--bld-us)}.tp-p2dv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-p2dv_b svg path{stroke:currentColor;stroke-width:2}.tp-p2dv_b svg circle{fill:currentColor}.tp-p2dv_t{flex:1}.tp-p2dv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-p2dv.tp-p2dv-expanded .tp-p2dv_p{margin-top:var(--bld-s);opacity:1}.tp-p2dv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-p2dpv{padding-left:calc(var(--bld-us) + 4px)}.tp-p2dpv_p{cursor:crosshair;height:0;overflow:hidden;padding-bottom:100%;position:relative}.tp-p2dpv.tp-v-disabled .tp-p2dpv_p{opacity:.5}.tp-p2dpv_g{display:block;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.tp-p2dpv_ax{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_l{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_m{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;position:absolute;width:4px}.tp-p2dpv_p:focus .tp-p2dpv_m{background-color:var(--in-fg);border-width:0}.tp-popv{background-color:var(--bs-bg);border-radius:6px;box-shadow:0 2px 4px var(--bs-sh);display:none;max-width:168px;padding:var(--cnt-v-p) var(--cnt-h-p);position:absolute;visibility:hidden;z-index:1000}.tp-popv.tp-popv-v{display:block;visibility:visible}.tp-sprv_r{background-color:var(--grv-fg);border-width:0;display:block;height:2px;margin:0;width:100%}.tp-sprv.tp-v-disabled .tp-sprv_r{opacity:.5}.tp-sldv.tp-v-disabled{opacity:.5}.tp-sldv_t{box-sizing:border-box;cursor:pointer;height:var(--bld-us);margin:0 6px;outline:none;position:relative}.tp-sldv_t::before{background-color:var(--in-bg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin:auto;position:absolute;right:0;top:0}.tp-sldv_k{height:100%;left:0;position:absolute;top:0}.tp-sldv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin-bottom:auto;margin-top:auto;position:absolute;right:0;top:0}.tp-sldv_k::after{background-color:var(--btn-bg);border-radius:var(--elm-br);bottom:0;content:"";display:block;height:12px;margin-bottom:auto;margin-top:auto;position:absolute;right:-6px;top:0;width:12px}.tp-sldv_t:hover .tp-sldv_k::after{background-color:var(--btn-bg-h)}.tp-sldv_t:focus .tp-sldv_k::after{background-color:var(--btn-bg-f)}.tp-sldv_t:active .tp-sldv_k::after{background-color:var(--btn-bg-a)}.tp-sldtxtv{display:flex}.tp-sldtxtv_s{flex:2}.tp-sldtxtv_t{flex:1;margin-left:4px}.tp-tabv{position:relative}.tp-tabv_t{align-items:flex-end;color:var(--cnt-bg);display:flex;overflow:hidden;position:relative}.tp-tabv_t:hover{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus){color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active){color:var(--cnt-bg-a)}.tp-tabv_t::before{background-color:currentColor;bottom:0;content:"";height:2px;left:0;pointer-events:none;position:absolute;right:0}.tp-tabv.tp-v-disabled .tp-tabv_t::before{opacity:.5}.tp-tabv.tp-tabv-nop .tp-tabv_t{height:calc(var(--bld-us) + 4px);position:relative}.tp-tabv.tp-tabv-nop .tp-tabv_t::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:0;position:absolute;right:0}.tp-tabv_c{padding-bottom:var(--cnt-v-p);padding-left:4px;padding-top:var(--cnt-v-p)}.tp-tabv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--bld-us) + 4px);width:var(--bs-br)}.tp-tabv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-tabv_t:hover+.tp-tabv_i{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus)+.tp-tabv_i{color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active)+.tp-tabv_i{color:var(--cnt-bg-a)}.tp-tabv.tp-v-disabled>.tp-tabv_i{opacity:.5}.tp-tbiv{flex:1;min-width:0;position:relative}.tp-tbiv+.tp-tbiv{margin-left:2px}.tp-tbiv+.tp-tbiv.tp-v-disabled::before{opacity:.5}.tp-tbiv_b{display:block;padding-left:calc(var(--cnt-h-p) + 4px);padding-right:calc(var(--cnt-h-p) + 4px);position:relative;width:100%}.tp-tbiv_b:disabled{opacity:.5}.tp-tbiv_b::before{background-color:var(--cnt-bg);bottom:2px;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.tp-tbiv_b:hover::before{background-color:var(--cnt-bg-h)}.tp-tbiv_b:focus::before{background-color:var(--cnt-bg-f)}.tp-tbiv_b:active::before{background-color:var(--cnt-bg-a)}.tp-tbiv_t{color:var(--cnt-fg);height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);opacity:.5;overflow:hidden;text-overflow:ellipsis}.tp-tbiv.tp-tbiv-sel .tp-tbiv_t{opacity:1}.tp-txtv{position:relative}.tp-txtv_i{padding:0 4px}.tp-txtv.tp-txtv-fst .tp-txtv_i{border-bottom-right-radius:0;border-top-right-radius:0}.tp-txtv.tp-txtv-mid .tp-txtv_i{border-radius:0}.tp-txtv.tp-txtv-lst .tp-txtv_i{border-bottom-left-radius:0;border-top-left-radius:0}.tp-txtv.tp-txtv-num .tp-txtv_i{text-align:right}.tp-txtv.tp-txtv-drg .tp-txtv_i{opacity:.3}.tp-txtv_k{cursor:pointer;height:100%;left:-3px;position:absolute;top:0;width:12px}.tp-txtv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";height:calc(var(--bld-us) - 4px);left:50%;margin-bottom:auto;margin-left:-1px;margin-top:auto;opacity:.1;position:absolute;top:0;transition:border-radius .1s,height .1s,transform .1s,width .1s;width:2px}.tp-txtv_k:hover::before,.tp-txtv.tp-txtv-drg .tp-txtv_k::before{opacity:1}.tp-txtv.tp-txtv-drg .tp-txtv_k::before{border-radius:50%;height:4px;transform:translateX(-1px);width:4px}.tp-txtv_g{bottom:0;display:block;height:8px;left:50%;margin:auto;overflow:visible;pointer-events:none;position:absolute;top:0;visibility:hidden;width:100%}.tp-txtv.tp-txtv-drg .tp-txtv_g{visibility:visible}.tp-txtv_gb{fill:none;stroke:var(--in-fg);stroke-dasharray:1}.tp-txtv_gh{fill:none;stroke:var(--in-fg)}.tp-txtv .tp-ttv{margin-left:6px;visibility:hidden}.tp-txtv.tp-txtv-drg .tp-ttv{visibility:visible}.tp-ttv{background-color:var(--in-fg);border-radius:var(--elm-br);color:var(--bs-bg);padding:2px 4px;pointer-events:none;position:absolute;transform:translate(-50%, -100%)}.tp-ttv::before{border-color:var(--in-fg) rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0);border-style:solid;border-width:2px;box-sizing:border-box;content:"";font-size:.9em;height:4px;left:50%;margin-left:-2px;position:absolute;top:100%;width:4px}.tp-rotv{background-color:var(--bs-bg);border-radius:var(--bs-br);box-shadow:0 2px 4px var(--bs-sh);font-family:var(--font-family);font-size:11px;font-weight:500;line-height:1;text-align:left}.tp-rotv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br);border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br);padding-left:calc(4px + var(--bld-us) + var(--cnt-h-p));text-align:center}.tp-rotv.tp-rotv-expanded .tp-rotv_b{border-bottom-left-radius:0;border-bottom-right-radius:0}.tp-rotv.tp-rotv-not .tp-rotv_b{display:none}.tp-rotv_b:disabled .tp-rotv_m{display:none}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c .tp-fldv.tp-v-vlst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst>.tp-fldv_b{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst>.tp-tabv_t{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-v-disabled,.tp-rotv .tp-v-disabled{pointer-events:none}.tp-rotv.tp-v-hidden,.tp-rotv .tp-v-hidden{display:none}'),this.pool_.getAll().forEach((t=>{this.embedPluginStyle_(t)})),this.registerPlugin({plugins:[Wr,$r,Bt,Qr]})}},t.SeparatorApi=Mt,t.SliderApi=zr,t.TabApi=Nt,t.TabPageApi=Ot,t.TextApi=qr,t.TpChangeEvent=i,t.VERSION=Zr,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],9:[function(t,e,n){const i=t("canvas-sketch"),r=t("canvas-sketch-util/random"),o=t("canvas-sketch-util/math");t("tweakpane");let s;document.body.style.background="#000000",s=window.innerWidth>768?r.range(5,16):r.range(4,9);let a=r.range(.5,4);const l=r.range(1,10);let p=20;l<2?(p=15,a=5):p=l>9?25:20;const c={cols:Math.floor(s),rows:Math.floor(s),scaleMin:1,scaleMax:30,freq:r.range(5e-4,.006),amp:1,frame:0,animate:!0,lineCap:"round"};let d=0,h=0;i((()=>({context:t,width:e,height:n,frame:i})=>{e=window.innerWidth,n=window.innerHeight,t.fillStyle="black",t.fillRect(0,0,e,n);const l=Math.floor(s),u=Math.floor(s),v=l*u,m=Math.max(e,n),f=1.5*m,b=1.5*m,g=f/l,_=b/u,w=.6*(e-f),y=.6*(n-b);for(let s=0;sp&&(t.strokeStyle="#b4fcfe",b=!0,t.scale(.025*f,.025*f)),t.lineCap=c.lineCap,t.beginPath(),t.moveTo(-.5*u,.5*v),t.lineTo(.5*u,.5*v),t.stroke(),b&&(t.shadowColor="#eff5c1",t.shadowBlur=30,t.shadowOffsetX=0,t.shadowOffsetY=0,t.stroke(),t.fill()),t.beginPath(),t.moveTo(-.5*u,-.5*v),t.lineTo(.5*u,-.5*v),t.stroke(),b&&(t.shadowColor="#eff5c1",t.stroke(),t.fill()),t.beginPath(),t.moveTo(-.5*u,-.5*v),t.lineTo(-.5*u,.5*v),t.stroke(),b&&(t.shadowColor="#eff5c1",t.stroke(),t.fill()),t.beginPath(),t.moveTo(.5*u,.5*v),t.lineTo(.5*u,-.5*v),t.stroke(),b&&(t.shadowColor="#eff5c1",t.stroke(),t.fill()),t.restore()}onmousemove=function(t){d=t.clientX,h=t.clientY},h>20&&d>20&&d