@viamedici-spc/configurator-framer-bundle 2.0.0 → 2.1.0-alpha0001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1240,7 +1240,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1240
1240
  }
1241
1241
  `;function irr(e){const t=bm(),n=(t==null?void 0:t.displayMode)==="dialog";return J.jsx(Dnr,{open:n,onOpenChange:r=>!r&&n&&(t==null?void 0:t.dismiss()),children:J.jsx(arr,{...e,isOpen:n,children:de.Children.toArray(e.content)[0]??J.jsx(nrr,{children:J.jsx(ltr,{})})})})}function arr(e){return J.jsx(ce.AnimatePresence,{initial:!1,children:e.isOpen&&J.jsx(mme.Provider,{value:e,children:J.jsx(rrr,{...e,components:{Overlay:urr},children:J.jsx(Hut,{children:e.children})})})})}const orr=St(ce.motion(qut))`
1242
1242
  ${Gut}
1243
- `;function urr(e){return J.jsx(orr,{...e,initial:{backgroundColor:"rgba(0,0,0,0)"},animate:{backgroundColor:"rgba(0,0,0,0.1)"},exit:{backgroundColor:"rgba(0,0,0,0)"}})}function crr(e){const[t,n]=de.useState(null),{explain:r,applySolution:i}=oZn(),a=de.useRef(null),o=de.useCallback(async(p,v,h,$)=>{const y=tR.guid();a.current=y,n(null);try{const b=await p(),m=b,g=b,I=(m==null?void 0:m.decisionExplanations)??[],_=(g==null?void 0:g.constraintExplanations)??[];y==a.current&&n({controlId:$,displayMode:I.length===0&&_.length>0?"dialog":h,explainQuestion:v,hasError:!1,decisionExplanations:srr(I),constraintExplanations:_})}catch{y==a.current&&n({controlId:$,displayMode:h,explainQuestion:v,hasError:!0,decisionExplanations:null,constraintExplanations:null})}},[]),u=de.useCallback((p,v,h)=>{const $=typeof p=="function"?p(Cit):p;return o(()=>e.explainConstraints?r($,"full"):r($,"decisions"),$,v,h)},[e.explainConstraints,r,o]),c=de.useCallback((p,v,h)=>o(()=>Promise.resolve(p),null,v,h),[o]),s=de.useCallback(()=>{n(null)},[]),f=de.useCallback(p=>(s(),i(p)),[i,s]),l=de.useCallback(p=>{n(v=>v!=null?{...v,displayMode:p}:v)},[]),d=de.useMemo(()=>({process:t,applySolution:f,explain:u,handleExplainAnswer:c,dismiss:s,switchMode:l}),[t,f,u,c,s,l]);return J.jsx(yC.Provider,{value:d,children:e.children})}function srr(e){const t=M(Rle,Nc(r=>r.solution==null)),n=M(X$,Nc(r=>r.causedByDecisions.length));return M(e,nze([t,n]))}const VS=new Map;function o3(e){const{singletonId:t,children:n}=e,[r,i]=de.useState(!1),a=de.useRef({chose:()=>i(!0)});return de.useEffect(()=>(frr(t,a.current),()=>lrr(t,a.current)),[]),r?J.jsx(J.Fragment,{children:n}):null}function frr(e,t){prr(e).candidates.add(t),Jut(e)}function lrr(e,t){let n=VS.get(e);n!=null&&(n.candidates.delete(t),n.chosen===t&&(n.chosen=null),drr(e),Jut(e))}function Jut(e){let t=VS.get(e);if(t==null||t.chosen!=null)return;const n=t.candidates.values().next().value;n!=null&&(t.chosen=n,n.chose())}function drr(e){let t=VS.get(e);t==null||t.candidates.size>0||VS.delete(e)}function prr(e){let t=VS.get(e);return t==null&&(t={chosen:null,candidates:new Set},VS.set(e,t)),t}const xc={attributeId:{title:"Attribute Id",type:ce.ControlType.String},componentPath:{title:"Component Path",type:ce.ControlType.String},sharedConfigurationModel:{title:"Shared Configuration Model",type:ce.ControlType.String}},QAe={description:{title:"Description",type:ce.ControlType.String},regex:{title:"Regex",type:ce.ControlType.String},direction:{title:"Direction",type:ce.ControlType.Enum,defaultValue:"asc",options:["asc","desc"],displaySegmentedControl:!0},mode:{title:"Mode",type:ce.ControlType.Enum,defaultValue:"isMatch",options:["isMatch","string","numeric"]}},hrr={choiceValueSorting:{title:"Choice Value Sorting",type:ce.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{defaultRules:{title:"Default Rules",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:QAe}},attributes:{title:"Attribute",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:{...xc,choiceValues:{title:"Choice Values",type:ce.ControlType.Array,control:{type:ce.ControlType.String}},rules:{title:"Rules",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:QAe}}}}},jsonDefinition:{title:"Definition – JSON",type:ce.ControlType.String,displayTextArea:!0}}}};function vrr(e,t){const n=[],r=(a,o)=>{const u=n.find(s=>e.equals(s.first,a)&&e.equals(s.second,o));if(u)return u.ordering;const c=t.compare(a,o);return n.push({first:a,second:o,ordering:c}),c},i=Fv(r);return{cachedOrderings:n,...i}}function mrr(){const e=[];return{getCache:(t,n)=>{const r=e.find(a=>a.eq===t&&a.ord===n);if(r)return r.ordCache;const i=vrr(t,n);return e.push({eq:t,ord:n,ordCache:i}),i}}}const Yut=vN(),grr=new Intl.Collator("en",{sensitivity:"base"}),yrr=new Intl.Collator("en",{sensitivity:"variant"}),brr={regex:".*",direction:"asc",mode:"string"},$rr=M([grr,yrr],it(Orr),JM(vN())),_rr=M(Rle,Nc(e=>Rh(e))),Irr=X$;function Srr(e,t){return M((t==null?void 0:t.attributes)??[],Ms(n=>ei.equals(oa(n),e)),ji(n=>[wrr(n.choiceValues??[]),XAe(n.rules??[])]),Df(()=>[XAe((t==null?void 0:t.defaultRules)??[])]),r0(Qut(brr)),JM(Yut))}function wrr(e){return M(X$,hg,Ece,hg,Nc(t=>M(e,ON(n=>He.equals(t,n)))))}function XAe(e){return M(e,it(Qut),JM(Yut))}function Qut(e){const t=qce(()=>new RegExp(e.regex)),n=Xe(e.mode).returnType().with("string",()=>Arr(e.direction)).with("numeric",()=>Mrr(e.direction)).with("isMatch",()=>Rrr(e.direction)).exhaustive();return M(n,Nc(r=>M(t,Dce(i=>(i.lastIndex=0,i[Symbol.match](r))),AM(i=>M(i,Mh(1),Fce(()=>M(i,Mh(0))))))))}function Arr(e){return M($rr,Tme(e),Xut)}function Mrr(e){return M(Irr,Tme(e),Xut,Nc(AM(Lbn)))}function Rrr(e){return M(_rr,Tme(e))}function Xut(e){return M(e,hg,Ece,hg)}function Tme(e){return t=>Xe(e).returnType().with("asc",()=>t).with("desc",()=>hg(t)).exhaustive()}function Orr(e){return Fv((t,n)=>Xe(e.compare(t,n)).returnType().with(ea.number.gt(0),()=>1).with(ea.number.lt(0),()=>-1).otherwise(()=>0))}const Trr=mrr(),ect=de.createContext(null);function u3(e,t,n){const r=de.useContext(ect),i=de.useMemo(()=>M(Srr(e,r),o=>Trr.getCache(He,o),Nc(o=>t.get(o.id)??o.id)),[t]),{attribute:a}=ZR(e);return M(n??(a==null?void 0:a.values)??[],TN(i))}const Err={localization:{title:"Localization",type:ce.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:ce.ControlType.String,displayTextArea:!0}}}};function Crr(e){return e}var Prr=function(e){return{_tag:"Left",left:e}},Frr=function(e){return{_tag:"Right",right:e}},Wrr=Prr,Nrr=Frr,krr=function(e,t){try{return Nrr(e())}catch(n){return Wrr(t(n))}},jrr=function(e){return krr(function(){return JSON.parse(e)},Crr)};const c3=Gi.object({localId:Gi.string(),componentPath:Gi.string().array().optional().nullish(),sharedConfigurationModelId:Gi.string().optional().nullish()});function tct(e){var t;return{sharedConfigurationModel:e.sharedConfigurationModelId??"",componentPath:((t=e.componentPath)==null?void 0:t.join(" -> "))??"",attributeId:e.localId}}function Eme(e,t,n){return r=>de.useMemo(()=>M(r,gp,xN(i0(IGe)),Ooe(()=>null),oZ(Ie(jrr,fd(i=>`The JSON content could not be parsed. Please check for syntax errors.
1243
+ `;function urr(e){return J.jsx(orr,{...e,initial:{backgroundColor:"rgba(0,0,0,0)"},animate:{backgroundColor:"rgba(0,0,0,0.1)"},exit:{backgroundColor:"rgba(0,0,0,0)"}})}function crr(e){const[t,n]=de.useState(null),{explain:r,applySolution:i}=oZn(),a=de.useRef(null),o=de.useCallback(async(p,v,h,$)=>{const y=tR.guid();a.current=y,n(null);try{const b=await p(),m=b,g=b,I=(m==null?void 0:m.decisionExplanations)??[],_=(g==null?void 0:g.constraintExplanations)??[];y==a.current&&n({controlId:$,displayMode:I.length===0&&_.length>0?"dialog":h,explainQuestion:v,hasError:!1,decisionExplanations:srr(I),constraintExplanations:_})}catch{y==a.current&&n({controlId:$,displayMode:h,explainQuestion:v,hasError:!0,decisionExplanations:null,constraintExplanations:null})}},[]),u=de.useCallback((p,v,h)=>{const $=typeof p=="function"?p(Cit):p;return o(()=>e.explainConstraints?r($,"full"):r($,"decisions"),$,v,h)},[e.explainConstraints,r,o]),c=de.useCallback((p,v,h)=>o(()=>Promise.resolve(p),null,v,h),[o]),s=de.useCallback(()=>{n(null)},[]),f=de.useCallback(p=>(s(),i(p)),[i,s]),l=de.useCallback(p=>{n(v=>v!=null?{...v,displayMode:p}:v)},[]),d=de.useMemo(()=>({process:t,applySolution:f,explain:u,handleExplainAnswer:c,dismiss:s,switchMode:l}),[t,f,u,c,s,l]);return J.jsx(yC.Provider,{value:d,children:e.children})}function srr(e){const t=M(Rle,Nc(r=>r.solution==null)),n=M(X$,Nc(r=>r.causedByDecisions.length));return M(e,nze([t,n]))}const VS=new Map;function o3(e){const{singletonId:t,children:n}=e,[r,i]=de.useState(!1),a=de.useRef({chose:()=>i(!0)});return de.useEffect(()=>(frr(t,a.current),()=>lrr(t,a.current)),[]),r?J.jsx(J.Fragment,{children:n}):null}function frr(e,t){prr(e).candidates.add(t),Jut(e)}function lrr(e,t){let n=VS.get(e);n!=null&&(n.candidates.delete(t),n.chosen===t&&(n.chosen=null),drr(e),Jut(e))}function Jut(e){let t=VS.get(e);if(t==null||t.chosen!=null)return;const n=t.candidates.values().next().value;n!=null&&(t.chosen=n,n.chose())}function drr(e){let t=VS.get(e);t==null||t.candidates.size>0||VS.delete(e)}function prr(e){let t=VS.get(e);return t==null&&(t={chosen:null,candidates:new Set},VS.set(e,t)),t}const xc={attributeId:{title:"Attribute Id",type:ce.ControlType.String},componentPath:{title:"Component Path",type:ce.ControlType.String},sharedConfigurationModel:{title:"Shared Configuration Model",type:ce.ControlType.String}},QAe={description:{title:"Description",type:ce.ControlType.String},regex:{title:"Regex",type:ce.ControlType.String},direction:{title:"Direction",type:ce.ControlType.Enum,defaultValue:"asc",options:["asc","desc"],displaySegmentedControl:!0},mode:{title:"Mode",type:ce.ControlType.Enum,defaultValue:"isMatch",options:["isMatch","string","numeric"]}},hrr={choiceValueSorting:{title:"Choice Value Sorting",type:ce.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{defaultRules:{title:"Default Rules",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:QAe}},attributes:{title:"Attribute",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:{...xc,choiceValues:{title:"Choice Values",type:ce.ControlType.Array,control:{type:ce.ControlType.String}},rules:{title:"Rules",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:QAe}}}}},jsonDefinition:{title:"Definition – JSON",type:ce.ControlType.String,displayTextArea:!0}}}};function vrr(e,t){const n=[],r=(a,o)=>{const u=n.find(s=>e.equals(s.first,a)&&e.equals(s.second,o));if(u)return u.ordering;const c=t.compare(a,o);return n.push({first:a,second:o,ordering:c}),c},i=Fv(r);return{cachedOrderings:n,...i}}function mrr(){const e=[];return{getCache:(t,n)=>{const r=e.find(a=>a.eq===t&&a.ord===n);if(r)return r.ordCache;const i=vrr(t,n);return e.push({eq:t,ord:n,ordCache:i}),i}}}const Yut=vN(),grr=new Intl.Collator("en",{sensitivity:"base"}),yrr=new Intl.Collator("en",{sensitivity:"variant"}),brr={regex:".*",direction:"asc",mode:"string"},$rr=M([grr,yrr],it(Orr),JM(vN())),_rr=M(Rle,Nc(e=>Rh(e))),Irr=X$;function Srr(e,t){return M((t==null?void 0:t.attributes)??[],Ms(n=>ei.equals(oa(n),e)),ji(n=>[wrr(n.choiceValues??[]),XAe(n.rules??[])]),Df(()=>[XAe((t==null?void 0:t.defaultRules)??[])]),r0(Qut(brr)),JM(Yut))}function wrr(e){return M(X$,hg,Ece,hg,Nc(t=>M(e,ON(n=>He.equals(t,n)))))}function XAe(e){return M(e,it(Qut),JM(Yut))}function Qut(e){const t=qce(()=>new RegExp(e.regex)),n=Xe(e.mode).returnType().with("string",()=>Arr(e.direction)).with("numeric",()=>Mrr(e.direction)).with("isMatch",()=>Rrr(e.direction)).exhaustive();return M(n,Nc(r=>M(t,Dce(i=>(i.lastIndex=0,i[Symbol.match](r))),AM(i=>M(i,Mh(1),Fce(()=>M(i,Mh(0))))))))}function Arr(e){return M($rr,Tme(e),Xut)}function Mrr(e){return M(Irr,Tme(e),Xut,Nc(AM(Lbn)))}function Rrr(e){return M(_rr,Tme(e))}function Xut(e){return M(e,hg,Ece,hg)}function Tme(e){return t=>Xe(e).returnType().with("asc",()=>t).with("desc",()=>hg(t)).exhaustive()}function Orr(e){return Fv((t,n)=>Xe(e.compare(t,n)).returnType().with(ea.number.gt(0),()=>1).with(ea.number.lt(0),()=>-1).otherwise(()=>0))}const Trr=mrr(),ect=de.createContext(null);function u3(e,t){const n=de.useContext(ect),r=de.useMemo(()=>M(Srr(e,n),a=>Trr.getCache(He,a),Nc(a=>a.id)),[]),{attribute:i}=ZR(e);return M(t??(i==null?void 0:i.values)??[],TN(r))}const Err={localization:{title:"Localization",type:ce.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:ce.ControlType.String,displayTextArea:!0}}}};function Crr(e){return e}var Prr=function(e){return{_tag:"Left",left:e}},Frr=function(e){return{_tag:"Right",right:e}},Wrr=Prr,Nrr=Frr,krr=function(e,t){try{return Nrr(e())}catch(n){return Wrr(t(n))}},jrr=function(e){return krr(function(){return JSON.parse(e)},Crr)};const c3=Gi.object({localId:Gi.string(),componentPath:Gi.string().array().optional().nullish(),sharedConfigurationModelId:Gi.string().optional().nullish()});function tct(e){var t;return{sharedConfigurationModel:e.sharedConfigurationModelId??"",componentPath:((t=e.componentPath)==null?void 0:t.join(" -> "))??"",attributeId:e.localId}}function Eme(e,t,n){return r=>de.useMemo(()=>M(r,gp,xN(i0(IGe)),Ooe(()=>null),oZ(Ie(jrr,fd(i=>`The JSON content could not be parsed. Please check for syntax errors.
1244
1244
  `+i.toString()),oZ(i=>M(t.safeParse(i),a=>a.success?Zt(a.data):tn(a.error),fd(a=>zXn(a,{maxIssuesInMessage:5,issueSeparator:`
1245
1245
  - `})),fd(a=>`The JSON schema is invalid. Ensure all required fields and types are correctly defined.
1246
1246
  `+a.toString()))),Z$(n),fd(i=>J.jsx(nut,{type:"warning",title:e+" definition is invalid and was ignored",message:i}))))),[r])}const nct=Gi.object({attributeId:c3,name:Gi.array(Gi.object({localeCode:Gi.string(),translation:Gi.string()}))}),Urr=nct.extend({choiceValueId:Gi.string()}),xrr=Gi.object({attributes:nct.array().optional().nullish(),choiceValues:Urr.array().optional().nullish()});function eMe(e){return{...tct(e.attributeId),name:M(e.name,it(t=>t),Mc)}}function qrr(e){const t=M(e.attributes??[],it(eMe),Mc),n=M(e.choiceValues??[],it(r=>({...eMe(r),choiceValueId:r.choiceValueId})),Mc);return{attributes:t,choiceValues:n}}const Drr=Eme("Localization",xrr,qrr),Lrr=Drr,tMe=Gi.object({regex:Gi.string(),direction:Gi.enum(["asc","desc"]),mode:Gi.enum(["isMatch","string","numeric"]),description:Gi.string().optional()}),Brr=Gi.object({defaultRules:tMe.array().optional().nullish(),attributes:Gi.object({attributeId:c3,choiceValues:Gi.string().array(),rules:tMe.array()}).array().optional().nullish()});function Vrr(e){const t=M(e.defaultRules??[],it(n=>n),Mc);return{attributes:M(e.attributes??[],it(n=>({...tct(n.attributeId),choiceValues:Mc(n.choiceValues),rules:M(n.rules,it(r=>r),Mc)})),Mc),defaultRules:t}}const zrr=Eme("ChoiceValueSorting",Brr,Vrr),Krr=zrr,Grr=Gi.object({attributeId:c3,decisions:c3.array()}),Hrr=Grr.array(),Zrr=Eme("AttributeRelations",Hrr,e=>e),Jrr=Zrr,rct=lf(e=>{var t,n,r;const{hcaBaseUrl:i,sessionCreation:a,accessToken:o,sessionCreateUrl:u,sessionDeleteUrl:c,deploymentName:s,channel:f,children:l,explainDialogProps:d,explainPopoverProps:p,explainConstraints:v}=e,{activeLocale:h}=ce.useLocaleInfo(),$=h.code;if(de.useEffect(()=>{console.info("Current locale code:",$)},[$]),Li())return J.jsxs(J.Fragment,{children:[l,J.jsx(o3,{singletonId:"Configuration",children:J.jsx(AAe,{})})]});const y=Jrr((t=e.attributeRelations)==null?void 0:t.jsonDefinition),b=de.useMemo(()=>M(y,ld,ph),[y]),m=Krr((n=e.choiceValueSorting)==null?void 0:n.jsonDefinition),g=de.useMemo(()=>M(m,Q5e(()=>M(e.choiceValueSorting,z5(null))),aZ(()=>({attributes:[],defaultRules:[]}))),[m,e.choiceValueSorting]),I=Lrr((r=e.localization)==null?void 0:r.jsonDefinition),_=de.useMemo(()=>M(I,aZ(()=>({attributes:[],choiceValues:[]}))),[I]),A=de.useMemo(()=>({apiBaseUrl:fZn(i,"api","engine"),sessionInitialisationOptions:Xe(a).with("client-side",()=>({accessToken:o})).with("server-side",()=>({sessionCreateUrl:u})).exhaustive(),configurationModelSource:{type:ES.Channel,channel:f,deploymentName:s},attributeRelations:b,allowedInExplain:{rules:{type:tg.all}}}),[i,a,o,u,c,f,s,b]);return J.jsxs(J.Fragment,{children:[J.jsxs(rZn,{sessionContext:A,children:[M(I,kb,ld,ph),M(m,kb,ld,ph),M(y,kb,ld,ph),J.jsx(Ner,{...e}),J.jsx(de.Suspense,{children:J.jsx(d7.Provider,{value:_,children:J.jsxs(crr,{explainConstraints:v,children:[J.jsx(hme.Provider,{value:p,children:J.jsx(ect.Provider,{value:g,children:l})}),J.jsx(irr,{...d})]})})})]}),J.jsx(o3,{singletonId:"Configuration",children:J.jsx(AAe,{})})]})}),Yrr=rct;ce.addPropertyControls(rct,{children:{title:"Content",type:ce.ControlType.ComponentInstance},channel:{type:ce.ControlType.String,title:"Channel",defaultValue:"release"},deploymentName:{type:ce.ControlType.String,title:"Deployment Name"},hcaBaseUrl:{title:"HCA Base URL",type:ce.ControlType.String,defaultValue:"https://spc.cloud.ceventis.de/hca"},sessionCreation:{title:"Session Creation",type:ce.ControlType.Enum,displaySegmentedControl:!0,segmentedControlDirection:"horizontal",defaultValue:"client-side",options:["client-side","server-side"]},accessToken:{title:"HCA Access Token",type:ce.ControlType.String,obscured:!0,hidden:e=>e.sessionCreation!=="client-side"},sessionCreateUrl:{title:"Create Session URl",type:ce.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},sessionDeleteUrl:{title:"Close Session URl",type:ce.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},configurationModelNotFoundContent:{title:"Content – Configuration Model not found",type:ce.ControlType.ComponentInstance},errorContent:{title:"Content – Error",type:ce.ControlType.ComponentInstance},accessTokenInvalidContent:{title:"Content – HCA Access Token invalid",type:ce.ControlType.ComponentInstance},accessTokenRestrictionContent:{title:"Content – HCA Access Token restriction",type:ce.ControlType.ComponentInstance},explainDialogProps:{title:"Explain Dialog",type:ce.ControlType.Object,optional:!1,controls:zer,buttonTitle:"Props…"},explainPopoverProps:{title:"Explain Popover",type:ce.ControlType.Object,optional:!1,controls:Ver,buttonTitle:"Props…"},explainConstraints:{title:"Explain Constraints",type:ce.ControlType.Boolean,defaultValue:!1},attributeRelations:{title:"Attribute Relations",type:ce.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:ce.ControlType.String,displayTextArea:!0}}},...hrr,...Err});const ict={padding:{type:ce.ControlType.FusedNumber,title:"Padding",toggleKey:"isMixedPadding",toggleTitles:["Padding","Padding per Side"],valueKeys:["paddingTop","paddingRight","paddingBottom","paddingLeft"],valueLabels:["Top","Right","Bottom","Left"],min:0,defaultValue:0}},Qrr=e=>({paddingTop:e.isMixedPadding?e.paddingTop:e.padding,paddingRight:e.isMixedPadding?e.paddingRight:e.padding,paddingBottom:e.isMixedPadding?e.paddingBottom:e.padding,paddingLeft:e.isMixedPadding?e.paddingLeft:e.padding}),Xrr={radius:{title:"Radius",type:ce.ControlType.Number,defaultValue:6},...ict,border:{title:"Border",type:ce.ControlType.Object,controls:{color:{type:ce.ControlType.Color,title:"Color"},width:{type:ce.ControlType.FusedNumber,title:"Width",toggleKey:"isMixedWidth",toggleTitles:["Width","Width per Side"],valueKeys:["widthTop","widthRight","widthBottom","widthLeft"],valueLabels:["Top","Right","Bottom","Left"],min:0,defaultValue:0}}}},eir=e=>{var t,n,r,i,a,o,u,c,s,f,l,d,p;return{borderRadius:e.radius,borderColor:(t=e.border)==null?void 0:t.color,borderTopWidth:(n=e.border)!=null&&n.isMixedWidth?(r=e.border)==null?void 0:r.widthTop:(i=e.border)==null?void 0:i.width,borderRightWidth:(a=e.border)!=null&&a.isMixedWidth?(o=e.border)==null?void 0:o.widthRight:(u=e.border)==null?void 0:u.width,borderBottomWidth:(c=e.border)!=null&&c.isMixedWidth?(s=e.border)==null?void 0:s.widthBottom:(f=e.border)==null?void 0:f.width,borderLeftWidth:(l=e.border)!=null&&l.isMixedWidth?(d=e.border)==null?void 0:d.widthLeft:(p=e.border)==null?void 0:p.width}},tir={fill:{title:"Fill",type:ce.ControlType.Color,defaultValue:"#EBEBEB"},...ict,...Xrr},nir=e=>({...Qrr(e),...eir(e),backgroundColor:e.fill}),rir={color:{title:"Color",type:ce.ControlType.Color,defaultValue:"black"},text:{title:"Text",type:ce.ControlType.Font,controls:"basic",displayTextAlignment:!0,displayFontSize:!0}},iir=e=>({...e.text,color:e.color}),eO={explain:{title:"Explain",type:ce.ControlType.Enum,defaultValue:"popover",options:["popover","dialog","disabled"]}},CJ={type:ce.ControlType.Object,optional:!0,controls:{fill:{title:"Fill",type:ce.ControlType.Color,optional:!0},color:{title:"Color",type:ce.ControlType.Color,optional:!0},borderColor:{title:"Border Color",type:ce.ControlType.Color,optional:!0}}},act={...xc,...rir,...tir,implicitLabelPrefix:{title:"Implicit Label Prefix",type:ce.ControlType.String,defaultValue:"Implicit: "},unsatisfiedColors:{...CJ,title:"Unsatisfied Colors"},implicitSelectedColors:{...CJ,title:"Implicit Selected Colors"},...eO},PJ=(e,t,n)=>{var r,i,a,o,u,c;const s=nir(e),f=iir(e);return{...s,...f,backgroundColor:Xe({isSatisfied:t,isImplicitSelected:n,unsatisfiedFill:(r=e.unsatisfiedColors)==null?void 0:r.fill,implicitSelectedFill:(i=e.implicitSelectedColors)==null?void 0:i.fill}).with({isSatisfied:!1,unsatisfiedFill:ea.string.minLength(1)},l=>l.unsatisfiedFill).with({isImplicitSelected:!0,implicitSelectedFill:ea.string.minLength(1)},l=>l.implicitSelectedFill).otherwise(()=>s.backgroundColor),borderColor:Xe({isSatisfied:t,isImplicitSelected:n,unsatisfiedBorderColor:(a=e.unsatisfiedColors)==null?void 0:a.borderColor,implicitSelectedBorderColor:(o=e.implicitSelectedColors)==null?void 0:o.borderColor}).with({isSatisfied:!1,unsatisfiedBorderColor:ea.string.minLength(1)},l=>l.unsatisfiedBorderColor).with({isImplicitSelected:!0,implicitSelectedBorderColor:ea.string.minLength(1)},l=>l.implicitSelectedBorderColor).otherwise(()=>s.borderColor),color:Xe({isSatisfied:t,isImplicitSelected:n,unsatisfiedColor:(u=e.unsatisfiedColors)==null?void 0:u.color,implicitSelectedColor:(c=e.implicitSelectedColors)==null?void 0:c.color}).with({isSatisfied:!1,unsatisfiedColor:ea.string.minLength(1)},l=>l.unsatisfiedColor).with({isImplicitSelected:!0,implicitSelectedColor:ea.string.minLength(1)},l=>l.implicitSelectedColor).otherwise(()=>f.color),...e.style}},Cme={...act,resetLabel:{title:"Reset Label",type:ce.ControlType.String,defaultValue:"Reset"},blockedLabel:{title:"Blocked Label",type:ce.ControlType.String,defaultValue:"Blocked"},appearance:{title:"Appearance",type:ce.ControlType.Enum,defaultValue:"auto",displaySegmentedControl:!0,segmentedControlDirection:"horizontal",options:["auto","none"]}},zS=(e,t,n)=>({...PJ(e,t,n),appearance:e.appearance});function Bp(){const{explain:e,handleExplainAnswer:t}=de.useContext(yC);return{explain:e,handleExplainAnswer:t}}function air(e={}){const{initialOpen:t=!1,placement:n="top",modal:r=!1,open:i,onOpenChange:a,arrow:o}=e,[u,c]=de.useState(t),s=i??u,f=a??c,l=But({placement:n,open:s,onOpenChange:f,whileElementsMounted:Ztr,middleware:[Ptr(((o==null?void 0:o.height)??0)+5),Ytr({crossAxis:n.includes("-"),fallbackAxisSideDirection:"end",padding:5}),Jtr({padding:5}),...o?[Xtr(o)]:[]]}),d=l.context,p=Dut(d,{enabled:i==null}),v=Lut(d),h=Vut([p,v]);return de.useMemo(()=>({open:s,setOpen:f,...h,...l,modal:r,arrow:o}),[s,f,h,l,r,o])}const oct=de.createContext(null),V2=()=>{const e=de.useContext(oct);if(e==null)throw new Error("Popover components must be wrapped in <Popover />");return e};function oir({children:e,...t}){const n=air(t);return J.jsx(oct.Provider,{value:n,children:e})}const uir=de.forwardRef(function(e,t){const n=de.Children.toArray(e.children)[0],r=V2(),i=e.children.ref,a=Ame([r.refs.setReference,t,i]);return de.isValidElement(n)?de.cloneElement(n,r.getReferenceProps({ref:a,...e,...n.props,"data-state":r.open?"open":"closed"})):J.jsx("span",{children:"Not valid children for PopoverTrigger"})}),cir=uir,sir=St.div`
@@ -1385,7 +1385,7 @@ Please check your internet connection and try again.`)}function Pir(){alert(`Fai
1385
1385
  Please check your internet connection and try again.`)}const rMe=St.select`
1386
1386
  color: inherit;
1387
1387
  cursor: inherit;
1388
- `,iMe="<reset>",aMe="<nothing>",cct=Vp((e,t)=>{if(Li()){const N=zS(e,!0,!1);return J.jsx(rMe,{style:N})}const n=df(),r=oa(e),i=ZR(r);if(!i)return J.jsx("span",{children:"Choice Attribute not found"});const{explain:a}=Bp(),o=q2(r),{attribute:u,makeDecision:c,clearDecisions:s,isMultiSelect:f,getIncludedChoiceValues:l,getBlockedChoiceValues:d,getAllowedChoiceValues:p}=i,v=u3(r,o,p()),h=u3(r,o,d()),$=l(),y=$.map(N=>N.id),b=y[0]??aMe,m=$.some(N=>{var U;return((U=N.decision)==null?void 0:U.kind)===bt.Explicit}),g=y.length>=1,I=$.some(N=>{var U;return((U=N.decision)==null?void 0:U.kind)===bt.Implicit}),_=v.length===0,A=async N=>{const U=e.explain,te=U!=="disabled"&&(()=>a(_e=>_e.whyIsStateNotPossible.choice(u.id).choiceValue(N).state(Ut.Included),U,n));if(N===iMe)try{await s()}catch{Rd()}else if(v.some(_e=>_e.id===N)){const _e=y.some(ke=>ke===N)?void 0:Ut.Included;try{await c(N,_e)}catch(ke){if(ke.type===mt.ConflictWithConsequence&&te){await te();return}Rd()}}else h.some(_e=>_e.id===N)&&te&&await te()},T=Nir(e,u.isSatisfied,I,_);return J.jsxs(rMe,{ref:t,value:f()?y:b,multiple:f(),onChange:N=>A(N.currentTarget.value),style:T,children:[!g&&!f()&&J.jsx("option",{value:aMe}),m&&J.jsx("option",{value:iMe,children:e.resetLabel}),v.map(N=>{var U;return J.jsxs("option",{value:N.id,children:[((U=N.decision)==null?void 0:U.kind)===bt.Implicit?e.implicitLabelPrefix:"",o.get(N.id)??N.id]},N.id)}),h.length>0&&J.jsx("optgroup",{label:e.blockedLabel,children:h.map(N=>J.jsx("option",{value:N.id,children:o.get(N.id)??N.id},N.id))})]})}),Fir=cct,Wir={...Cme,noOptionsAvailableColors:{...CJ,title:"No Options Available Colors"}};ce.addPropertyControls(cct,Wir);const Nir=(e,t,n,r)=>{var i,a,o;const u=zS(e,t,n);return{...u,backgroundColor:Xe({noOptionsAvailable:r,noOptionsAvailableFill:(i=e.noOptionsAvailableColors)==null?void 0:i.fill}).with({noOptionsAvailable:!0,noOptionsAvailableFill:ea.string.minLength(1)},c=>c.noOptionsAvailableFill).otherwise(()=>u.backgroundColor),borderColor:Xe({noOptionsAvailable:r,noOptionsAvailableBorderColor:(a=e.noOptionsAvailableColors)==null?void 0:a.borderColor}).with({noOptionsAvailable:!0,noOptionsAvailableBorderColor:ea.string.minLength(1)},c=>c.noOptionsAvailableBorderColor).otherwise(()=>u.borderColor),color:Xe({noOptionsAvailable:r,noOptionsAvailableColor:(o=e.noOptionsAvailableColors)==null?void 0:o.color}).with({noOptionsAvailable:!0,noOptionsAvailableColor:ea.string.minLength(1)},c=>c.noOptionsAvailableColor).otherwise(()=>u.color)}},oMe=St.select`
1388
+ `,iMe="<reset>",aMe="<nothing>",cct=Vp((e,t)=>{if(Li()){const N=zS(e,!0,!1);return J.jsx(rMe,{style:N})}const n=df(),r=oa(e),i=ZR(r);if(!i)return J.jsx("span",{children:"Choice Attribute not found"});const{explain:a}=Bp(),o=q2(r),{attribute:u,makeDecision:c,clearDecisions:s,isMultiSelect:f,getIncludedChoiceValues:l,getBlockedChoiceValues:d,getAllowedChoiceValues:p}=i,v=u3(r,p()),h=u3(r,d()),$=l(),y=$.map(N=>N.id),b=y[0]??aMe,m=$.some(N=>{var U;return((U=N.decision)==null?void 0:U.kind)===bt.Explicit}),g=y.length>=1,I=$.some(N=>{var U;return((U=N.decision)==null?void 0:U.kind)===bt.Implicit}),_=v.length===0,A=async N=>{const U=e.explain,te=U!=="disabled"&&(()=>a(_e=>_e.whyIsStateNotPossible.choice(u.id).choiceValue(N).state(Ut.Included),U,n));if(N===iMe)try{await s()}catch{Rd()}else if(v.some(_e=>_e.id===N)){const _e=y.some(ke=>ke===N)?void 0:Ut.Included;try{await c(N,_e)}catch(ke){if(ke.type===mt.ConflictWithConsequence&&te){await te();return}Rd()}}else h.some(_e=>_e.id===N)&&te&&await te()},T=Nir(e,u.isSatisfied,I,_);return J.jsxs(rMe,{ref:t,value:f()?y:b,multiple:f(),onChange:N=>A(N.currentTarget.value),style:T,children:[!g&&!f()&&J.jsx("option",{value:aMe}),m&&J.jsx("option",{value:iMe,children:e.resetLabel}),v.map(N=>{var U;return J.jsxs("option",{value:N.id,children:[((U=N.decision)==null?void 0:U.kind)===bt.Implicit?e.implicitLabelPrefix:"",o.get(N.id)??N.id]},N.id)}),h.length>0&&J.jsx("optgroup",{label:e.blockedLabel,children:h.map(N=>J.jsx("option",{value:N.id,children:o.get(N.id)??N.id},N.id))})]})}),Fir=cct,Wir={...Cme,noOptionsAvailableColors:{...CJ,title:"No Options Available Colors"}};ce.addPropertyControls(cct,Wir);const Nir=(e,t,n,r)=>{var i,a,o;const u=zS(e,t,n);return{...u,backgroundColor:Xe({noOptionsAvailable:r,noOptionsAvailableFill:(i=e.noOptionsAvailableColors)==null?void 0:i.fill}).with({noOptionsAvailable:!0,noOptionsAvailableFill:ea.string.minLength(1)},c=>c.noOptionsAvailableFill).otherwise(()=>u.backgroundColor),borderColor:Xe({noOptionsAvailable:r,noOptionsAvailableBorderColor:(a=e.noOptionsAvailableColors)==null?void 0:a.borderColor}).with({noOptionsAvailable:!0,noOptionsAvailableBorderColor:ea.string.minLength(1)},c=>c.noOptionsAvailableBorderColor).otherwise(()=>u.borderColor),color:Xe({noOptionsAvailable:r,noOptionsAvailableColor:(o=e.noOptionsAvailableColors)==null?void 0:o.color}).with({noOptionsAvailable:!0,noOptionsAvailableColor:ea.string.minLength(1)},c=>c.noOptionsAvailableColor).otherwise(()=>u.color)}},oMe=St.select`
1389
1389
  color: inherit;
1390
1390
  cursor: inherit;
1391
1391
  `,uMe="<reset>",nH="<nothing>",rH="yes",cMe="no",sct=Vp((e,t)=>{var n,r,i;if(Li()){const g=zS(e,!0,!1);return J.jsx(oMe,{style:g})}const a=df(),o=oa(e),u=nHn(o),{explain:c}=Bp();if(!u)return J.jsx("span",{children:"Boolean Attribute not found"});const{attribute:s,makeDecision:f}=u,l=async g=>{var I;const _=((I=s.decision)==null?void 0:I.kind)===bt.Explicit;if(g===uMe&&_)try{await f(void 0)}catch{Rd()}else{const A=g===rH,T=s.possibleDecisionStates.includes(A),N=e.explain,U=N!=="disabled"&&(()=>c(te=>te.whyIsStateNotPossible.boolean(s.id).state(A),N,a));if(T)try{await f(A)}catch(te){if(te.type===mt.ConflictWithConsequence&&U){await U();return}Rd()}else U&&await U()}},d=Xe((n=s.decision)==null?void 0:n.state).with(!0,()=>rH).with(!1,()=>cMe).otherwise(()=>nH),p=((r=s.decision)==null?void 0:r.kind)===bt.Explicit,v=((i=s.decision)==null?void 0:i.kind)===bt.Implicit,h=zS(e,s.isSatisfied,v),$=s.possibleDecisionStates.includes(!0),y=s.possibleDecisionStates.includes(!1),b=J.jsxs("option",{value:rH,children:[sMe(s,!0,e.implicitLabelPrefix),e.trueLabel]}),m=J.jsxs("option",{value:cMe,children:[sMe(s,!1,e.implicitLabelPrefix),e.falseLabel]});return J.jsxs(oMe,{ref:t,value:d,onChange:g=>l(g.currentTarget.value),style:h,children:[d===nH&&J.jsx("option",{value:nH}),p&&J.jsx("option",{value:uMe,children:e.resetLabel}),$&&b,y&&m,(!$||!y)&&J.jsxs("optgroup",{label:e.blockedLabel,children:[!$&&b,!y&&m]})]})}),kir=sct,sMe=(e,t,n)=>{var r,i;return((r=e.decision)==null?void 0:r.kind)===bt.Implicit&&((i=e.decision)==null?void 0:i.state)===t?n:""},jir={...Cme,trueLabel:{title:"True Label",type:ce.ControlType.String,defaultValue:"Yes"},falseLabel:{title:"False Label",type:ce.ControlType.String,defaultValue:"No"}};ce.addPropertyControls(sct,jir);const fMe=St.select`
@@ -1405,4 +1405,4 @@ Please check your internet connection and try again.`)}const rMe=St.select`
1405
1405
  display: contents !important;
1406
1406
  }
1407
1407
  }
1408
- `,Sct=lf(Pme(e=>{const t=df(),n=Li(),r=(()=>{const l=d=>{var p;const v=de.Children.toArray(d)[0],h=(p=v.props)==null?void 0:p.children;return h?l(h):v};return l(e.itemTemplate)})();if(!r)return J.jsx("span",{children:"Choice Value Template not defined"});const i=(l,d)=>l.map(p=>de.cloneElement(r,{key:p,layoutId:`${t}_${p}`,attributeId:e.attributeId,componentPath:e.componentPath,sharedConfigurationModel:e.sharedConfigurationModel,choiceValueId:p,choiceValueName:d.get(p)??p}));if(n)return J.jsx(hMe,{...e,children:i(["Choice Value 1","Choice Value 2","Choice Value 3"],Eo)});const a=oa(e),o=ZR(a);if(!o)return J.jsx("span",{children:"Choice Attribute not found"});const u=q2(a),c=e.filter??new Array,s=[...o.attribute.values.values()].filter(l=>c.length===0||c.some(({selection:d,condition:p})=>Xe({selection:d,condition:p}).with({selection:"included",condition:"blocked"},()=>!l.possibleDecisionStates.includes(Ut.Included)).with({selection:"included",condition:"implicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Included&&((h=l.decision)==null?void 0:h.kind)===bt.Implicit}).with({selection:"included",condition:"explicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Included&&((h=l.decision)==null?void 0:h.kind)===bt.Explicit}).with({selection:"included",condition:"none"},()=>{var v;return((v=l.decision)==null?void 0:v.state)===Ut.Included}).with({selection:"excluded",condition:"blocked"},()=>!l.possibleDecisionStates.includes(Ut.Excluded)).with({selection:"excluded",condition:"implicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Excluded&&((h=l.decision)==null?void 0:h.kind)===bt.Implicit}).with({selection:"excluded",condition:"explicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Excluded&&((h=l.decision)==null?void 0:h.kind)===bt.Explicit}).with({selection:"excluded",condition:"none"},()=>{var v;return((v=l.decision)==null?void 0:v.state)===Ut.Excluded}).with({selection:"undefined"},()=>l.decision==null).otherwise(()=>!1))),f=u3(a,u,s).map(l=>l.id);return J.jsx(hMe,{...e,children:i(f,u)})}));function hMe(e){return J.jsxs(J.Fragment,{children:[J.jsx(o3,{singletonId:"ChoiceValueListRenderer",children:J.jsx(car,{})}),J.jsx(Ict,{style:e.style,children:e.children})]})}const sar=Sct,far={...xc,itemTemplate:{title:"Choice Value Template",type:ce.ControlType.ComponentInstance},filter:{title:"Filter",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:{selection:{title:"Selection",type:ce.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded"]},condition:{title:"Condition",type:ce.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]}}}}};ce.addPropertyControls(Sct,far);const{isValidElement:vMe,cloneElement:mMe}=qe;function lar(e,t){return t?(Array.isArray(t)&&(t=t.map((n,r)=>vMe(n)&&typeof n.props=="object"?mMe(n,{...n.props,key:r}):n)),!e||Array.isArray(e)?t:vMe(e)?mMe(e,{...e.props,children:t}):e):e}const{isValidElement:dar}=qe;function wct(e,t,n){function r(a,o){return t.visit(a,n,o)}function i(a,o){return wct(a,t,o||n)}if(dar(e)){if(typeof e.type=="function")return"prototype"in e.type&&e.type.prototype.isReactComponent?e=new e.type(e.props).render():e=e.type(e.props),i(e);if(e.props&&"children"in e.props){const a=e.props.children;return r(e,o=>Array.isArray(a)?a.map(u=>i(u,o)):i(a,o))}}else if(Array.isArray(e)){const a=e;return r(e,o=>a.map(u=>i(u,o)))}return r(e)}const{isValidElement:gMe}=qe;function par(e,t){let n;const{replace:r,updateState:i}=t;return"matchElement"in t?n=a=>gMe(a)&&a.type===t.matchElement:"matchLiteral"in t?n=a=>!Array.isArray(a)&&!gMe(a)&&t.matchLiteral(a):n=t.match,wct(e,{visit(a,o,u){const c=i?i(o):o,s=u?u(c):void 0,f=lar(a,s);return n(f,c)?r(f,c):f}},t.initialState)}function yMe(e){return J.jsx(J.Fragment,{children:par(e.children,e)})}function har(e){return M(e,_Ge(/[\s\u2013]/g,"-"),Cer)}const mar=lf(e=>{const{children:t,mode:n,replaceString:r,propName:i,elementName:a,text:o}=e;return n==="replace"?J.jsx(yMe,{match:u=>typeof u=="string",replace:u=>u===r?o:u,children:t}):n==="set-prop"?J.jsx(yMe,{match:u=>{var c;return((c=u.type)==null?void 0:c.displayName)===a},replace:u=>de.cloneElement(u,{[har(i)]:o}),children:t}):t}),g7=mar,Fme=e=>({children:{title:"Content",type:ce.ControlType.ComponentInstance},mode:{title:"Mode",type:ce.ControlType.Enum,defaultValue:"replace",options:["replace","set-prop"],displaySegmentedControl:!0},replaceString:{title:"Replace Text",type:ce.ControlType.String,defaultValue:e,hidden:t=>t.mode!=="replace"},elementName:{title:"Element Name",type:ce.ControlType.String,hidden:t=>t.mode!=="set-prop"},propName:{title:"Property Name",type:ce.ControlType.String,hidden:t=>t.mode!=="set-prop"}}),Act=lf(e=>{const{attributeId:t,children:n,customName:r}=e,i=oa(e),a=(r==null?void 0:r.length)>0,o=Li(),u=a?r:o?t:(()=>HR([i],!1)[0]?p7(i)??t:"Attribute not found")();return J.jsx(g7,{...e,text:u})}),gar=Act,yar={...xc,customName:{title:"Custom Name",type:ce.ControlType.String},...Fme("<AttributeName>")};ce.addPropertyControls(Act,yar);const Mct=lf(e=>{const{choiceValueId:t,children:n,customName:r,mode:i,replaceString:a,propName:o,elementName:u}=e,c=oa(e),s=r.length>0,f=t.length>0,l=Li(),d=s?r:l?t.length>0?t:"Choice Value":(()=>{const p=ZR(c);return p?f?p.attribute.values.get(t)==null?"Choice Value not found":uut(c,t)??t:"Choice Value Id missing":"Choice Attribute not found"})();return J.jsx(g7,{...e,text:d})}),bar=Mct,$ar={...xc,...tO,customName:{title:"Custom Name",type:ce.ControlType.String},...Fme("<ChoiceValueName>")};ce.addPropertyControls(Mct,$ar);function Rct(e){return e.children}const _ar={children:{title:"Content",type:ce.ControlType.ComponentInstance}};ce.addPropertyControls(Rct,_ar);function Oct(e){const{children:t,fileExtension:n,fileName:r,target:i}=e;if(Li())return t;const{storeConfiguration:a}=Nat();return zp(t,{onClick:async()=>{const o={type:"spc-stored-configuration",storedConfiguration:await a()};i==="file"?Sar(o,`${r}.${n}`):i==="clipboard"&&war(o)}})}const Iar={children:{title:"Content",type:ce.ControlType.ComponentInstance},target:{title:"Target",type:ce.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileName:{title:"File Name",type:ce.ControlType.String,defaultValue:"configuration",hidden:e=>e.target!=="file"},fileExtension:{title:"File Extension",type:ce.ControlType.String,defaultValue:"json",hidden:e=>e.target!=="file"}};ce.addPropertyControls(Oct,Iar);function Sar(e,t){const n=JSON.stringify(e),r=new Blob([n],{type:"application/json"}),i=window.URL.createObjectURL(r),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(i)}function war(e){const t=JSON.stringify(e);navigator.clipboard.writeText(t).catch(n=>{alert("Failed to copy the configuration to clipboard: "+n)})}var Tct=(e=>(e[e.parseError=0]="parseError",e[e.noConfiguration=1]="noConfiguration",e[e.noFileSelected=2]="noFileSelected",e[e.fileReadError=3]="fileReadError",e[e.noClipboardData=4]="noClipboardData",e[e.clipboardReadError=5]="clipboardReadError",e))(Tct||{});const Ect=Vp((e,t)=>{const{children:n,fileExtension:r,source:i}=e;if(Li())return n;const a=df(),{restoreConfiguration:o}=Nat(),{handleExplainAnswer:u}=Bp();return zp(n,{onClick:async()=>{const c=M(await Tar(i,r),ph);if(!c)return;const s={type:"DropExistingDecisions",conflictHandling:Xe(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()};try{await o(c,s)}catch(f){const l=f;if(console.debug("Failed to restore stored configuration",l),l.type===mt.StoredConfigurationInvalid){alert("The specific configuration is not supported. Maybe the configuration was created with new application version than the current one.");return}if((l==null?void 0:l.type)===mt.MakeManyDecisionsConflict&&l.decisionExplanations){e.explain!=="disabled"&&await u(l,e.explain,a);return}alert("Failed to restore your configuration.");return}},ref:t})}),Aar=Ect,Mar={children:{title:"Content",type:ce.ControlType.ComponentInstance},source:{title:"Source",type:ce.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileExtension:{title:"File Extension",type:ce.ControlType.String,defaultValue:"json",hidden:e=>e.source!=="file"},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:ce.ControlType.Boolean,defaultValue:!0},...eO};ce.addPropertyControls(Ect,Mar);function Rar(e){return()=>new Promise(t=>{const n=document.createElement("input");n.type="file",n.accept=`.${e}`,n.onchange=r=>{const i=r.target;if(!i.files||i.files.length===0){t(tn(2));return}const a=i.files[0],o=new FileReader;o.onload=()=>{t(Zt(o.result))},o.onerror=()=>{t(tn(3))},o.readAsText(a)},n.oncancel=()=>{t(tn(2))},n.click()})}function Oar(){return()=>navigator.clipboard.readText().then(e=>e?Zt(e):tn(4)).catch(()=>tn(5))}function Tar(e,t){return M(e==="file"?Rar(t):Oar(),b8e(n=>Pv(()=>JSON.parse(n),()=>0)),use(n=>n.type==="spc-stored-configuration",()=>1),To(n=>n.storedConfiguration),Wdn(n=>()=>{console.debug(`Failed to load stored configuration: ${Tct[n]}`),n==3?alert("Failed to read the selected file. Maybe it is damaged."):n==1||n==0?e==="file"?alert("The selected file doesn't contain a valid configuration."):e==="clipboard"&&alert("The clipboard doesn't contain a valid configuration."):n==5?alert("Can't read the clipboard. Make to give a permission for reading the clipboard."):n==4&&alert("The clipboard doesn't contain a configuration.")}),E8e)()}const Cct=lf(e=>{const{fallback:t}=e,n=oa(e),r=Li()?"0.0":(()=>{var i;const a=Pat(n);if(!a)return"Numeric Attribute not found";const o=(i=a.attribute.decision)==null?void 0:i.state;return o!=null?o.toLocaleString():t})();return J.jsx(g7,{...e,text:r})}),Ear=Cct,Car={...xc,fallback:{title:"Unselected Text",type:ce.ControlType.String,defaultValue:""},...Fme("<NumericValue>")};ce.addPropertyControls(Cct,Car);const Par=Object.freeze(Object.defineProperty({__proto__:null,AttributeName:gar,BooleanSelect:kir,ChoiceSelect:Fir,ChoiceValueListRenderer:sar,ChoiceValueName:bar,Colorize:tar,ComponentSelect:Uir,Configuration:Yrr,InitializationRetry:rar,NumericInput:qir,ReplaceText:g7,ResetConfiguration:Zir,RestoreConfiguration:Aar,SatisfactionIndicator:Yir,ScrollIntoView:_ct,SelectedNumericValue:Ear,SelectionIndicator:Xir,SelectionToggle:Bir,SetSelection:zir,SetSelections:Gir,Singleton:o3,Slot:Rct,StoreConfiguration:Oct,attributeIdPropertyControls:xc,choiceValueIdPropertyControls:tO,cloneChildrenWithProps:zp,explainableComponent:Vp,parseGlobalAttributeId:oa,useAttributeName:p7,useChoiceValueName:uut,useChoiceValueNames:q2,useControlId:df,useDebounceValue:lct,useExplain:Bp,useExplainProcess:bm,useRenderPlaceholder:Li,useSortedChoiceValues:u3,withControlId:Pme,withErrorBoundary:lf,withFullSize:aar},Symbol.toStringTag,{value:"Module"}));exports.Configurator=Ren;exports.ConfiguratorFramer=Par;exports.ConfiguratorReact=Tnn;
1408
+ `,Sct=lf(Pme(e=>{const t=df(),n=Li(),r=(()=>{const l=d=>{var p;const v=de.Children.toArray(d)[0],h=(p=v.props)==null?void 0:p.children;return h?l(h):v};return l(e.itemTemplate)})();if(!r)return J.jsx("span",{children:"Choice Value Template not defined"});const i=(l,d)=>l.map(p=>de.cloneElement(r,{key:p,layoutId:`${t}_${p}`,attributeId:e.attributeId,componentPath:e.componentPath,sharedConfigurationModel:e.sharedConfigurationModel,choiceValueId:p,choiceValueName:d.get(p)??p}));if(n)return J.jsx(hMe,{...e,children:i(["Choice Value 1","Choice Value 2","Choice Value 3"],Eo)});const a=oa(e),o=ZR(a);if(!o)return J.jsx("span",{children:"Choice Attribute not found"});const u=q2(a),c=e.filter??new Array,s=[...o.attribute.values.values()].filter(l=>c.length===0||c.some(({selection:d,condition:p})=>Xe({selection:d,condition:p}).with({selection:"included",condition:"blocked"},()=>!l.possibleDecisionStates.includes(Ut.Included)).with({selection:"included",condition:"implicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Included&&((h=l.decision)==null?void 0:h.kind)===bt.Implicit}).with({selection:"included",condition:"explicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Included&&((h=l.decision)==null?void 0:h.kind)===bt.Explicit}).with({selection:"included",condition:"none"},()=>{var v;return((v=l.decision)==null?void 0:v.state)===Ut.Included}).with({selection:"excluded",condition:"blocked"},()=>!l.possibleDecisionStates.includes(Ut.Excluded)).with({selection:"excluded",condition:"implicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Excluded&&((h=l.decision)==null?void 0:h.kind)===bt.Implicit}).with({selection:"excluded",condition:"explicit"},()=>{var v,h;return((v=l.decision)==null?void 0:v.state)===Ut.Excluded&&((h=l.decision)==null?void 0:h.kind)===bt.Explicit}).with({selection:"excluded",condition:"none"},()=>{var v;return((v=l.decision)==null?void 0:v.state)===Ut.Excluded}).with({selection:"undefined"},()=>l.decision==null).otherwise(()=>!1))),f=u3(a,s).map(l=>l.id);return J.jsx(hMe,{...e,children:i(f,u)})}));function hMe(e){return J.jsxs(J.Fragment,{children:[J.jsx(o3,{singletonId:"ChoiceValueListRenderer",children:J.jsx(car,{})}),J.jsx(Ict,{style:e.style,children:e.children})]})}const sar=Sct,far={...xc,itemTemplate:{title:"Choice Value Template",type:ce.ControlType.ComponentInstance},filter:{title:"Filter",type:ce.ControlType.Array,control:{type:ce.ControlType.Object,controls:{selection:{title:"Selection",type:ce.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded"]},condition:{title:"Condition",type:ce.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]}}}}};ce.addPropertyControls(Sct,far);const{isValidElement:vMe,cloneElement:mMe}=qe;function lar(e,t){return t?(Array.isArray(t)&&(t=t.map((n,r)=>vMe(n)&&typeof n.props=="object"?mMe(n,{...n.props,key:r}):n)),!e||Array.isArray(e)?t:vMe(e)?mMe(e,{...e.props,children:t}):e):e}const{isValidElement:dar}=qe;function wct(e,t,n){function r(a,o){return t.visit(a,n,o)}function i(a,o){return wct(a,t,o||n)}if(dar(e)){if(typeof e.type=="function")return"prototype"in e.type&&e.type.prototype.isReactComponent?e=new e.type(e.props).render():e=e.type(e.props),i(e);if(e.props&&"children"in e.props){const a=e.props.children;return r(e,o=>Array.isArray(a)?a.map(u=>i(u,o)):i(a,o))}}else if(Array.isArray(e)){const a=e;return r(e,o=>a.map(u=>i(u,o)))}return r(e)}const{isValidElement:gMe}=qe;function par(e,t){let n;const{replace:r,updateState:i}=t;return"matchElement"in t?n=a=>gMe(a)&&a.type===t.matchElement:"matchLiteral"in t?n=a=>!Array.isArray(a)&&!gMe(a)&&t.matchLiteral(a):n=t.match,wct(e,{visit(a,o,u){const c=i?i(o):o,s=u?u(c):void 0,f=lar(a,s);return n(f,c)?r(f,c):f}},t.initialState)}function yMe(e){return J.jsx(J.Fragment,{children:par(e.children,e)})}function har(e){return M(e,_Ge(/[\s\u2013]/g,"-"),Cer)}const mar=lf(e=>{const{children:t,mode:n,replaceString:r,propName:i,elementName:a,text:o}=e;return n==="replace"?J.jsx(yMe,{match:u=>typeof u=="string",replace:u=>u===r?o:u,children:t}):n==="set-prop"?J.jsx(yMe,{match:u=>{var c;return((c=u.type)==null?void 0:c.displayName)===a},replace:u=>de.cloneElement(u,{[har(i)]:o}),children:t}):t}),g7=mar,Fme=e=>({children:{title:"Content",type:ce.ControlType.ComponentInstance},mode:{title:"Mode",type:ce.ControlType.Enum,defaultValue:"replace",options:["replace","set-prop"],displaySegmentedControl:!0},replaceString:{title:"Replace Text",type:ce.ControlType.String,defaultValue:e,hidden:t=>t.mode!=="replace"},elementName:{title:"Element Name",type:ce.ControlType.String,hidden:t=>t.mode!=="set-prop"},propName:{title:"Property Name",type:ce.ControlType.String,hidden:t=>t.mode!=="set-prop"}}),Act=lf(e=>{const{attributeId:t,children:n,customName:r}=e,i=oa(e),a=(r==null?void 0:r.length)>0,o=Li(),u=a?r:o?t:(()=>HR([i],!1)[0]?p7(i)??t:"Attribute not found")();return J.jsx(g7,{...e,text:u})}),gar=Act,yar={...xc,customName:{title:"Custom Name",type:ce.ControlType.String},...Fme("<AttributeName>")};ce.addPropertyControls(Act,yar);const Mct=lf(e=>{const{choiceValueId:t,children:n,customName:r,mode:i,replaceString:a,propName:o,elementName:u}=e,c=oa(e),s=r.length>0,f=t.length>0,l=Li(),d=s?r:l?t.length>0?t:"Choice Value":(()=>{const p=ZR(c);return p?f?p.attribute.values.get(t)==null?"Choice Value not found":uut(c,t)??t:"Choice Value Id missing":"Choice Attribute not found"})();return J.jsx(g7,{...e,text:d})}),bar=Mct,$ar={...xc,...tO,customName:{title:"Custom Name",type:ce.ControlType.String},...Fme("<ChoiceValueName>")};ce.addPropertyControls(Mct,$ar);function Rct(e){return e.children}const _ar={children:{title:"Content",type:ce.ControlType.ComponentInstance}};ce.addPropertyControls(Rct,_ar);function Oct(e){const{children:t,fileExtension:n,fileName:r,target:i}=e;if(Li())return t;const{storeConfiguration:a}=Nat();return zp(t,{onClick:async()=>{const o={type:"spc-stored-configuration",storedConfiguration:await a()};i==="file"?Sar(o,`${r}.${n}`):i==="clipboard"&&war(o)}})}const Iar={children:{title:"Content",type:ce.ControlType.ComponentInstance},target:{title:"Target",type:ce.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileName:{title:"File Name",type:ce.ControlType.String,defaultValue:"configuration",hidden:e=>e.target!=="file"},fileExtension:{title:"File Extension",type:ce.ControlType.String,defaultValue:"json",hidden:e=>e.target!=="file"}};ce.addPropertyControls(Oct,Iar);function Sar(e,t){const n=JSON.stringify(e),r=new Blob([n],{type:"application/json"}),i=window.URL.createObjectURL(r),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(i)}function war(e){const t=JSON.stringify(e);navigator.clipboard.writeText(t).catch(n=>{alert("Failed to copy the configuration to clipboard: "+n)})}var Tct=(e=>(e[e.parseError=0]="parseError",e[e.noConfiguration=1]="noConfiguration",e[e.noFileSelected=2]="noFileSelected",e[e.fileReadError=3]="fileReadError",e[e.noClipboardData=4]="noClipboardData",e[e.clipboardReadError=5]="clipboardReadError",e))(Tct||{});const Ect=Vp((e,t)=>{const{children:n,fileExtension:r,source:i}=e;if(Li())return n;const a=df(),{restoreConfiguration:o}=Nat(),{handleExplainAnswer:u}=Bp();return zp(n,{onClick:async()=>{const c=M(await Tar(i,r),ph);if(!c)return;const s={type:"DropExistingDecisions",conflictHandling:Xe(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()};try{await o(c,s)}catch(f){const l=f;if(console.debug("Failed to restore stored configuration",l),l.type===mt.StoredConfigurationInvalid){alert("The specific configuration is not supported. Maybe the configuration was created with new application version than the current one.");return}if((l==null?void 0:l.type)===mt.MakeManyDecisionsConflict&&l.decisionExplanations){e.explain!=="disabled"&&await u(l,e.explain,a);return}alert("Failed to restore your configuration.");return}},ref:t})}),Aar=Ect,Mar={children:{title:"Content",type:ce.ControlType.ComponentInstance},source:{title:"Source",type:ce.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileExtension:{title:"File Extension",type:ce.ControlType.String,defaultValue:"json",hidden:e=>e.source!=="file"},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:ce.ControlType.Boolean,defaultValue:!0},...eO};ce.addPropertyControls(Ect,Mar);function Rar(e){return()=>new Promise(t=>{const n=document.createElement("input");n.type="file",n.accept=`.${e}`,n.onchange=r=>{const i=r.target;if(!i.files||i.files.length===0){t(tn(2));return}const a=i.files[0],o=new FileReader;o.onload=()=>{t(Zt(o.result))},o.onerror=()=>{t(tn(3))},o.readAsText(a)},n.oncancel=()=>{t(tn(2))},n.click()})}function Oar(){return()=>navigator.clipboard.readText().then(e=>e?Zt(e):tn(4)).catch(()=>tn(5))}function Tar(e,t){return M(e==="file"?Rar(t):Oar(),b8e(n=>Pv(()=>JSON.parse(n),()=>0)),use(n=>n.type==="spc-stored-configuration",()=>1),To(n=>n.storedConfiguration),Wdn(n=>()=>{console.debug(`Failed to load stored configuration: ${Tct[n]}`),n==3?alert("Failed to read the selected file. Maybe it is damaged."):n==1||n==0?e==="file"?alert("The selected file doesn't contain a valid configuration."):e==="clipboard"&&alert("The clipboard doesn't contain a valid configuration."):n==5?alert("Can't read the clipboard. Make to give a permission for reading the clipboard."):n==4&&alert("The clipboard doesn't contain a configuration.")}),E8e)()}const Cct=lf(e=>{const{fallback:t}=e,n=oa(e),r=Li()?"0.0":(()=>{var i;const a=Pat(n);if(!a)return"Numeric Attribute not found";const o=(i=a.attribute.decision)==null?void 0:i.state;return o!=null?o.toLocaleString():t})();return J.jsx(g7,{...e,text:r})}),Ear=Cct,Car={...xc,fallback:{title:"Unselected Text",type:ce.ControlType.String,defaultValue:""},...Fme("<NumericValue>")};ce.addPropertyControls(Cct,Car);const Par=Object.freeze(Object.defineProperty({__proto__:null,AttributeName:gar,BooleanSelect:kir,ChoiceSelect:Fir,ChoiceValueListRenderer:sar,ChoiceValueName:bar,Colorize:tar,ComponentSelect:Uir,Configuration:Yrr,InitializationRetry:rar,NumericInput:qir,ReplaceText:g7,ResetConfiguration:Zir,RestoreConfiguration:Aar,SatisfactionIndicator:Yir,ScrollIntoView:_ct,SelectedNumericValue:Ear,SelectionIndicator:Xir,SelectionToggle:Bir,SetSelection:zir,SetSelections:Gir,Singleton:o3,Slot:Rct,StoreConfiguration:Oct,attributeIdPropertyControls:xc,choiceValueIdPropertyControls:tO,cloneChildrenWithProps:zp,explainableComponent:Vp,parseGlobalAttributeId:oa,useAttributeName:p7,useChoiceValueName:uut,useChoiceValueNames:q2,useControlId:df,useDebounceValue:lct,useExplain:Bp,useExplainProcess:bm,useRenderPlaceholder:Li,useSortedChoiceValues:u3,withControlId:Pme,withErrorBoundary:lf,withFullSize:aar},Symbol.toStringTag,{value:"Module"}));exports.Configurator=Ren;exports.ConfiguratorFramer=Par;exports.ConfiguratorReact=Tnn;
package/dist/index.js CHANGED
@@ -98265,15 +98265,15 @@ function Jrr(e) {
98265
98265
  return Vv((t, n) => Qe(e.compare(t, n)).returnType().with(ia.number.gt(0), () => 1).with(ia.number.lt(0), () => -1).otherwise(() => 0));
98266
98266
  }
98267
98267
  const Yrr = jrr(), $ct = ec(null);
98268
- function _3(e, t, n) {
98269
- const r = Xi($ct), i = $r(() => M(
98270
- zrr(e, r),
98271
- (o) => Yrr.getCache(Ge, o),
98272
- Bc((o) => t.get(o.id) ?? o.id)
98273
- ), [t]), { attribute: a } = uO(e);
98268
+ function _3(e, t) {
98269
+ const n = Xi($ct), r = $r(() => M(
98270
+ zrr(e, n),
98271
+ (a) => Yrr.getCache(Ge, a),
98272
+ Bc((a) => a.id)
98273
+ ), []), { attribute: i } = uO(e);
98274
98274
  return M(
98275
- n ?? (a == null ? void 0 : a.values) ?? [],
98276
- LN(i)
98275
+ t ?? (i == null ? void 0 : i.values) ?? [],
98276
+ LN(r)
98277
98277
  );
98278
98278
  }
98279
98279
  const Qrr = {
@@ -99149,7 +99149,7 @@ const SMe = It.select`
99149
99149
  const n = $s(), r = la(e), i = uO(r);
99150
99150
  if (!i)
99151
99151
  return /* @__PURE__ */ de("span", { children: "Choice Attribute not found" });
99152
- const { explain: a } = Qp(), o = XU(r), { attribute: u, makeDecision: c, clearDecisions: f, isMultiSelect: s, getIncludedChoiceValues: l, getBlockedChoiceValues: d, getAllowedChoiceValues: p } = i, v = _3(r, o, p()), h = _3(r, o, d()), $ = l(), y = $.map((N) => N.id), b = y[0] ?? AMe, m = $.some((N) => {
99152
+ const { explain: a } = Qp(), o = XU(r), { attribute: u, makeDecision: c, clearDecisions: f, isMultiSelect: s, getIncludedChoiceValues: l, getBlockedChoiceValues: d, getAllowedChoiceValues: p } = i, v = _3(r, p()), h = _3(r, d()), $ = l(), y = $.map((N) => N.id), b = y[0] ?? AMe, m = $.some((N) => {
99153
99153
  var j;
99154
99154
  return ((j = N.decision) == null ? void 0 : j.kind) === yt.Explicit;
99155
99155
  }), g = y.length >= 1, I = $.some((N) => {
@@ -100118,7 +100118,7 @@ const Lct = It.div`
100118
100118
  var v;
100119
100119
  return ((v = l.decision) == null ? void 0 : v.state) === jt.Excluded;
100120
100120
  }).with({ selection: "undefined" }, () => l.decision == null).otherwise(() => !1))
100121
- ), s = _3(a, u, f).map((l) => l.id);
100121
+ ), s = _3(a, f).map((l) => l.id);
100122
100122
  return /* @__PURE__ */ de(FMe, { ...e, children: i(s, u) });
100123
100123
  }));
100124
100124
  function FMe(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamedici-spc/configurator-framer-bundle",
3
- "version": "2.0.0",
3
+ "version": "2.1.0-alpha0001",
4
4
  "description": "Component library to build configurator apps with Framer based on Viamedici SPC. All dependencies are bundled together.",
5
5
  "repository": {
6
6
  "type": "git",