@mathews_cometchat/bubble-builder 1.0.0-alpha26 → 1.0.0-alpha27

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.
@@ -16965,7 +16965,7 @@ var Kn = 375, qn = 667, Jn = /* @__PURE__ */ new Date(), Yn = Jn.toLocaleTimeStr
16965
16965
  transition: "all 0.15s"
16966
16966
  }, tr = (0, S.memo)(function({ platform: e, setPlatform: t }) {
16967
16967
  let n = P((e) => e.canvasView), r = P((e) => e.setCanvasView), i = P((e) => e.channels);
16968
- return i === "inapp" ? null : /* @__PURE__ */ (0, F.jsxs)("div", {
16968
+ return i === "inapp" || O.notification?.showPreview === !1 ? null : /* @__PURE__ */ (0, F.jsxs)("div", {
16969
16969
  style: {
16970
16970
  display: "flex",
16971
16971
  flexDirection: "column",
@@ -17128,7 +17128,7 @@ var rr = /* @__PURE__ */ (0, F.jsxs)("div", {
17128
17128
  /* @__PURE__ */ (0, F.jsxs)("div", {
17129
17129
  className: "canvas-area",
17130
17130
  ref: w,
17131
- children: [b === "notification" ? /* @__PURE__ */ (0, F.jsx)(Qn, { platform: x }) : /* @__PURE__ */ (0, F.jsx)("div", {
17131
+ children: [b === "notification" && O.notification?.showPreview !== !1 ? /* @__PURE__ */ (0, F.jsx)(Qn, { platform: x }) : /* @__PURE__ */ (0, F.jsx)("div", {
17132
17132
  style: {
17133
17133
  width: 375 * f,
17134
17134
  height: 667 * f,
@@ -22558,7 +22558,9 @@ function os(e, t) {
22558
22558
  }
22559
22559
  var ss = (0, S.memo)(function() {
22560
22560
  let e = P((e) => e.selectedPath), t = P((e) => e.body), n = P((e) => e.updateElement), r = P((e) => e.setCanvasView), i = P((e) => e.channels), [a, o] = (0, S.useState)(i === "push" ? "notification" : "tree"), s = i === "push" || i === "both", c = e ? os(t, e) : null, l = (0, S.useCallback)((e) => {
22561
- o(e), r(e === "notification" ? "notification" : "bubble");
22561
+ o(e);
22562
+ let t = O.notification?.showPreview !== !1;
22563
+ r(e === "notification" && t ? "notification" : "bubble");
22562
22564
  }, [r]), u = (0, S.useCallback)((e) => {
22563
22565
  let t = P.getState().selectedPath;
22564
22566
  t && n(t, e);
@@ -22741,7 +22743,7 @@ function fs() {
22741
22743
  //#endregion
22742
22744
  //#region src/lib.tsx
22743
22745
  function ps(e, t) {
22744
- O.appId = t.appId, O.region = t.region, O.token = t.token, O.onSave = t.onSave, O.onChange = t.onChange, O.hideTopBar = t.hideTopBar, O.hideTemplateLibrary = t.hideTemplateLibrary, O.channels = t.channels ?? "inapp", O.notification = t.notification, P.getState().setChannels(O.channels), t.variables && P.getState().setVariables(t.variables), t.hiddenElements && P.getState().setHiddenElements(t.hiddenElements), t.hiddenComponents && P.getState().setHiddenComponents(t.hiddenComponents), t.hideTemplateLibrary && P.getState().setView("editor"), console.log("[BubbleBuilder] mountBubbleBuilder called with:", {
22746
+ O.appId = t.appId, O.region = t.region, O.token = t.token, O.onSave = t.onSave, O.onChange = t.onChange, O.hideTopBar = t.hideTopBar, O.hideTemplateLibrary = t.hideTemplateLibrary, O.channels = t.channels ?? "both", O.notification = t.notification, P.getState().setChannels(O.channels), t.variables && P.getState().setVariables(t.variables), t.hiddenElements && P.getState().setHiddenElements(t.hiddenElements), t.hiddenComponents && P.getState().setHiddenComponents(t.hiddenComponents), t.hideTemplateLibrary && P.getState().setView("editor"), console.log("[BubbleBuilder] mountBubbleBuilder called with:", {
22745
22747
  appId: t.appId,
22746
22748
  region: t.region,
22747
22749
  token: t.token ? "***" + t.token.slice(-4) : void 0,
@@ -13,8 +13,8 @@ Error generating stack: `+e.message+`
13
13
  || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),Pe=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assignDefaults=void 0;var t=L(),n=R();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),Fe=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=L(),n=R(),r=Oe(),i=R();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),Ie=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=L(),n=Oe(),r=Fe(),i=ke();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),Le=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=L(),n=R();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),Re=c(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),ze=c(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),Be=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=R(),n=Re(),r=ze(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),Ve=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=Ae(),n=Ne(),r=Me(),i=Ne(),a=Pe(),o=Ie(),s=Le(),c=L(),l=Oe(),u=Be(),d=R(),f=ke();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&O(e),te(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),ne(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&O(e),E(e),D(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),ee(e)}function T(e,t){if(e.opts.jtd)return re(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);re(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function ee(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function te(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function E(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function D(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function O({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function ne(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&k(e),t.return((0,c._)`${l.default.errors} === 0`))}function k({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function re(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>le(e,`$ref`,h.all.$ref.definition));return}p.jtd||ae(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),ie(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):ie(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function ie(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&le(e,n.keyword,n.definition,t.type)})}function ae(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(A(e,t),e.opts.allowUnionTypes||j(e,t),oe(e,e.dataTypes))}function A(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{ce(e.dataTypes,t)||N(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),M(e,t)}}function j(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&N(e,`use allowUnionTypes to allow union type keyword`)}function oe(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>se(t,e))&&N(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function se(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function ce(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function M(e,t){let n=[];for(let r of e.dataTypes)ce(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function N(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var P=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,fe(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=P;function le(e,t,n,r){let i=new P(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var ue=/^\/(?:[^~]|~0|~1)*$/,de=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function fe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!ue.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=de.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=fe})),He=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),Ue=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Be();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),We=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=L(),n=He(),r=Oe(),i=Be(),a=R(),o=Ve(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),Ge=l({$id:()=>Ke,additionalProperties:()=>!1,default:()=>Ze,description:()=>qe,properties:()=>Xe,required:()=>Ye,type:()=>Je}),Ke,qe,Je,Ye,Xe,Ze,Qe=s((()=>{Ke=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,qe=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,Je=`object`,Ye=[`$data`],Xe={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},Ze={$id:Ke,description:qe,type:Je,required:Ye,properties:Xe,additionalProperties:!1}})),$e=c(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(!(s===`[`||s===`]`))if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}else if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),et=c(((e,t)=>{var{isUUID:n}=$e(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=S(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=S(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},y={scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},b={scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0},x={http:h,https:g,ws:_,wss:v,urn:y,"urn:uuid":b};Object.setPrototypeOf(x,null);function S(e){return e&&(x[e]||x[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:x,isValidSchemeName:a,getSchemeHandler:S}})),tt=c(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=$e(),{SCHEMES:c,getSchemeHandler:l}=et();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}var h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}var _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),nt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=tt();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),rt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ve();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return t.KeywordCxt}});var n=L();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return n.CodeGen}});var r=He(),i=Ue(),a=je(),o=We(),s=L(),c=Be(),l=Ne(),u=R(),d=(Qe(),f(Ge).default),p=nt(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=D(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=te.call(this),e.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&ee.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=d;n===`id`&&(r={...d},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(ne.call(this,n,t),!t)return(0,u.eachItem)(n,e=>k.call(this,e)),this;ie.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>k.call(this,e,r):e=>r.type.forEach(t=>k.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=A(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=r.default,x.MissingRefError=i.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function T(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function ee(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function te(){let e={...this.opts};for(let t of h)delete e[t];return e}var E={log(){},warn(){},error(){}};function D(e){if(e===!1)return E;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var O=/^[a-z_$][a-z0-9_$:-]*$/i;function ne(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!O.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function k(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?re.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function re(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function ie(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=A(t)),e.validateSchema=this.compile(t,!0))}var ae={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function A(e){return{anyOf:[e,ae]}}})),it=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),at=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;var t=Ue(),n=Fe(),r=L(),i=Oe(),a=We(),o=R(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0)if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),ot=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=it(),n=at();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),st=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),ct=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),lt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),ut=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R(),r=lt();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),dt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Fe(),n=R(),r=L();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),ft=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),pt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Fe(),n=L(),r=R();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),mt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),ht=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Re();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),gt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ne(),n=L(),r=R(),i=ht();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),_t=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R(),r=ht();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),vt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R(),r=ht();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),yt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=st(),n=ct(),r=ut(),i=dt(),a=ft(),o=pt(),s=mt(),c=gt(),l=_t(),u=vt();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),bt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateAdditionalItems=void 0;var t=L(),n=R(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),xt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;var t=L(),n=R(),r=Fe(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),St=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=xt();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),Ct=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R(),r=Fe(),i=bt();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),wt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Tt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=L(),n=R(),r=Fe();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
14
14
  missingProperty: ${i},
15
15
  depsCount: ${n},
16
- deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Et=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Dt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Fe(),n=L(),r=Oe(),i=R();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Ot=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ve(),n=Fe(),r=R(),i=Dt();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),kt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Fe(),n=L(),r=R(),i=R();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),At=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=R();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),jt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Fe().validateUnion,error:{message:`must match a schema in anyOf`}}})),Mt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Nt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=R();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Pt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Ft=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=R();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),It=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=bt(),n=St(),r=xt(),i=Ct(),a=wt(),o=Tt(),s=Et(),c=Dt(),l=Ot(),u=kt(),d=At(),f=jt(),p=Mt(),m=Nt(),h=Pt(),g=Ft();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),Lt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Rt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[Lt().default]})),zt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Bt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=ot(),n=yt(),r=It(),i=Rt(),a=zt();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),Vt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),Ht=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=Vt(),r=We(),i=Ue(),a=R();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),Ut=l({$id:()=>Gt,$schema:()=>Wt,default:()=>Xt,definitions:()=>qt,properties:()=>Yt,title:()=>Kt,type:()=>Jt}),Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt=s((()=>{Wt=`http://json-schema.org/draft-07/schema#`,Gt=`http://json-schema.org/draft-07/schema#`,Kt=`Core schema meta-schema`,qt={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},Jt=[`object`,`boolean`],Yt={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},Xt={$schema:Wt,$id:Gt,title:Kt,definitions:qt,type:Jt,properties:Yt,default:!0}})),Qt=c(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=rt(),r=Bt(),i=Ht(),a=(Zt(),f(Ut).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=Ve();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=L();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var d=He();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var p=Ue();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})})),$t=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:ee,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var T=/[^\\]\\Z/;function ee(e){if(T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),en=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;var t=Qt(),n=L(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),tn=c(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=$t(),r=en(),i=L(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s})),nn=d(Qt(),1);(0,d(tn(),1).default)(new nn.default({allErrors:!0,strict:!1}));function rn(e){let t=[];e.version!==`1.0`&&t.push({path:`version`,message:`Version must be "1.0"`}),(!e.body||e.body.length===0)&&t.push({path:`body`,message:`Body must have at least one element`}),(!e.fallbackText||e.fallbackText.trim()===``)&&t.push({path:`fallbackText`,message:`Fallback text is required`});let n=new Set;return e.body?.forEach((e,r)=>sn(e,`body[${r}]`,t,n)),t}var an=new Set([`variant`,`align`,`fontWeight`,`fit`,`layout`,`iconPosition`,`snap`,`tabAlign`,`openIn`,`method`,`callType`]),on=new Set([`text`,`image`,`icon`,`avatar`,`badge`,`divider`,`spacer`,`chip`,`progressBar`,`codeBlock`,`markdown`,`row`,`column`,`grid`,`accordion`,`tabs`,`button`,`iconButton`,`link`,`table`]);function sn(e,t,n,r){if(!e.type){n.push({path:t,message:`Element missing "type"`});return}if(!on.has(e.type)){n.push({path:t,message:`Unknown element type "${e.type}" — not supported in current schema`});return}!e.id||typeof e.id!=`string`?n.push({path:t,message:`Element missing "id"`}):r.has(e.id)?n.push({path:t,message:`Duplicate id "${e.id}"`}):r.add(e.id);for(let[r,i]of Object.entries(e))i===``&&an.has(r)&&n.push({path:`${t}.${r}`,message:`"${r}" must not be an empty string — omit it or use a valid value`});switch(e.type){case`text`:e.content||n.push({path:t,message:`Text element requires "content"`});break;case`image`:e.url||n.push({path:t,message:`Image element requires "url"`});break;case`icon`:e.name||n.push({path:t,message:`Icon element requires "name"`});break;case`spacer`:e.height??n.push({path:t,message:`Spacer requires "height"`});break;case`button`:e.label||n.push({path:t,message:`Button requires "label"`}),e.action||n.push({path:t,message:`Button requires "action"`});break;case`iconButton`:e.icon||n.push({path:t,message:`IconButton requires "icon"`}),e.action||n.push({path:t,message:`IconButton requires "action"`});break;case`link`:e.text||n.push({path:t,message:`Link requires "text"`}),e.action||n.push({path:t,message:`Link requires "action"`});break;case`badge`:case`chip`:e.text||n.push({path:t,message:`${e.type} requires "text"`});break;case`table`:e.columns||n.push({path:t,message:`Table requires "columns"`}),e.rows||n.push({path:t,message:`Table requires "rows"`});break}let i=e.items??e.body;Array.isArray(i)&&(i.length===0&&(e.type===`row`||e.type===`column`||e.type===`grid`||e.type===`accordion`)&&n.push({path:t,message:`${e.type} must have at least one child element`}),i.forEach((e,i)=>sn(e,`${t}.items[${i}]`,n,r))),e.type===`tabs`&&Array.isArray(e.tabs)&&e.tabs.forEach((e,i)=>{(!e.content||e.content.length===0)&&n.push({path:`${t}.tabs[${i}]`,message:`Tab "${e.label}" must have at least one element`}),e.content?.forEach((e,a)=>sn(e,`${t}.tabs[${i}].content[${a}]`,n,r))})}var cn={position:`fixed`,inset:0,background:`rgba(0,0,0,0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3},ln={background:`#fff`,border:`1px solid #E9EAEB`,borderRadius:12,boxShadow:`0 10px 25px rgba(0,0,0,0.1)`,padding:24,width:400,maxWidth:`90vw`},un={fontSize:16,fontWeight:700,marginBottom:16,color:`#141414`},dn={display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},fn=(0,C.memo)(function({title:e,onClose:t,children:n,footer:r,width:i,style:a}){return(0,I.jsx)(`div`,{style:cn,onClick:t,children:(0,I.jsxs)(`div`,{style:(0,C.useMemo)(()=>({...ln,...i?{width:i}:void 0,...a}),[i,a]),onClick:e=>e.stopPropagation(),children:[(0,I.jsx)(`div`,{style:un,children:e}),n,r?(0,I.jsx)(`div`,{style:dn,children:r}):null]})})}),pn=/\s+/g,mn=(0,C.memo)(function(){let e=F(e=>e.templateName),t=F(e=>e.setTemplateName),n=F(e=>e.setView),r=F(e=>e.getBubbleJSON),i=F(e=>e.isDirty),a=F(e=>e.undo),o=F(e=>e.redo),s=F(e=>e.canUndo),c=F(e=>e.canRedo),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(!1),[p,m]=(0,C.useState)(!1),h=(0,C.useMemo)(()=>{try{return rn(r())}catch{return[]}},[F(e=>e.body),r]),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(!1),[b,x]=(0,C.useState)(!1),[S,w]=(0,C.useState)(!1),T=F(e=>e.showTemplatePicker),ee=F(e=>e.setShowTemplatePicker),te=(0,C.useRef)(null),E=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!b&&!S)return;let e=e=>{b&&te.current&&!te.current.contains(e.target)&&x(!1),S&&E.current&&!E.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[b,S]);let D=(0,C.useCallback)(e=>{u(e),setTimeout(()=>u(null),2500)},[]),O=(0,C.useCallback)(()=>{let e=r({stripEmpty:!0}),t=rn(e);navigator.clipboard.writeText(JSON.stringify(e,null,2)),D(t.length>0?`Copied (${t.length} issue${t.length===1?``:`s`})`:`JSON copied`)},[r,D]),ne=(0,C.useCallback)(()=>{let t=r({stripEmpty:!0}),n=rn(t),i=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${e.replace(pn,`-`).toLowerCase()}.json`,o.click(),URL.revokeObjectURL(a),D(n.length>0?`Downloaded (${n.length} issue${n.length===1?``:`s`})`:`Downloaded`)},[r,e,D]),k=(0,C.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`.json`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{let e=await t.text(),n=JSON.parse(e);F.getState().loadBubble(n,void 0,t.name.replace(`.json`,``));let r=rn(n);D(r.length>0?`Imported (${r.length} issue${r.length===1?``:`s`})`:`Imported`)}catch{D(`Invalid JSON file`)}},e.click()},[D]),re=(0,C.useCallback)(async()=>{try{let e=await navigator.clipboard.readText(),t=JSON.parse(e);F.getState().loadBubble(t,void 0,`Pasted Bubble`);let n=rn(t);D(n.length>0?`Imported (${n.length} issue${n.length===1?``:`s`})`:`Imported from clipboard`)}catch{D(`No valid JSON in clipboard`)}},[D]),ie=(0,C.useCallback)(async()=>{let e=F.getState();if(e.templateName&&e.templateName!==`Untitled Bubble`)try{await e.saveTemplate(),D(`Template saved`)}catch(e){D(e instanceof Error?e.message:`Failed to save`)}else m(!0)},[D]),ae=(0,C.useCallback)(()=>{let e=rn(r({stripEmpty:!0}));if(e.length>0){D(`Fix ${e.length} issue${e.length===1?``:`s`} before sending`);return}y(!0)},[r,D]);return(0,I.jsxs)(`div`,{className:`topbar`,children:[(0,I.jsxs)(`div`,{className:`topbar-left`,children:[(0,I.jsx)(`button`,{className:`topbar-back`,onClick:()=>n(`library`),"aria-label":`Back to library`,children:`←`}),(0,I.jsxs)(`div`,{className:`topbar-logo`,children:[(0,I.jsx)(`div`,{className:`topbar-logo-icon`,children:`CC`}),(0,I.jsx)(`span`,{children:`cometchat`})]}),(0,I.jsx)(`span`,{className:`topbar-sep`}),(0,I.jsx)(`input`,{className:`topbar-name`,value:e,onChange:e=>t(e.target.value),"aria-label":`Template name`}),i?(0,I.jsx)(`span`,{className:`topbar-dirty`,title:`Unsaved changes`,children:`●`}):null,(0,I.jsx)(`span`,{className:`topbar-sep`}),(0,I.jsx)(`button`,{className:`topbar-btn-icon`,onClick:a,disabled:!s(),title:`Undo (⌘Z)`,children:`↩`}),(0,I.jsx)(`button`,{className:`topbar-btn-icon`,onClick:o,disabled:!c(),title:`Redo (⌘⇧Z)`,children:`↪`})]}),(0,I.jsxs)(`div`,{className:`topbar-right`,children:[h.length>0?(0,I.jsxs)(`div`,{style:{position:`relative`},children:[(0,I.jsxs)(`button`,{className:`topbar-btn topbar-btn-warn`,onClick:()=>f(!d),children:[`⚠ `,h.length,` issue`,h.length===1?``:`s`]}),d?(0,I.jsx)(`div`,{className:`topbar-errors`,children:h.map((e,t)=>(0,I.jsxs)(`div`,{className:`topbar-error-item`,children:[(0,I.jsx)(`span`,{className:`topbar-error-path`,children:e.path}),(0,I.jsx)(`span`,{children:e.message})]},t))}):null]}):null,(0,I.jsxs)(`div`,{className:`topbar-dropdown`,ref:te,children:[(0,I.jsx)(Se,{variant:`secondary`,onClick:()=>{x(!b),w(!1)},children:`Import ▾`}),b?(0,I.jsxs)(`div`,{className:`topbar-dropdown-menu`,children:[(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{k(),x(!1)},children:`From File`}),(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{re(),x(!1)},children:`From Clipboard`}),(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{ee(!0),x(!1)},children:`From Saved Template`})]}):null]}),(0,I.jsx)(Se,{variant:`secondary`,onClick:()=>_(!0),children:`Clear`}),(0,I.jsxs)(`div`,{className:`topbar-dropdown`,ref:E,children:[(0,I.jsx)(Se,{variant:`secondary`,onClick:()=>{w(!S),x(!1)},children:`Export ▾`}),S?(0,I.jsxs)(`div`,{className:`topbar-dropdown-menu`,children:[(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{O(),w(!1)},children:`Copy to Clipboard`}),(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{ne(),w(!1)},children:`Download as File`})]}):null]}),(0,I.jsx)(Se,{variant:`secondary`,onClick:ie,children:`Save`}),(0,I.jsx)(Se,{variant:`primary`,onClick:ae,children:`Send`})]}),l?(0,I.jsx)(`div`,{className:`topbar-toast`,children:l}):null,p?(0,I.jsx)(hn,{onClose:()=>m(!1),onSaved:()=>{m(!1),D(`Template saved`)}}):null,v?(0,I.jsx)(gn,{onClose:()=>y(!1),onSent:()=>{y(!1),D(`Message sent`)}}):null,T?(0,I.jsx)(vn,{onClose:()=>ee(!1),onLoaded:()=>{ee(!1),D(`Template loaded`)}}):null,g?(0,I.jsx)(fn,{title:`Clear all elements?`,onClose:()=>_(!1),footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Se,{onClick:()=>_(!1),children:`Cancel`}),(0,I.jsx)(Se,{variant:`danger`,onClick:()=>{F.getState().clearAll(),_(!1)},children:`Clear All`})]}),children:(0,I.jsx)(`p`,{style:{fontSize:13,color:`var(--text-secondary)`,margin:`0 0 16px`},children:`This will remove all elements from the bubble. You can undo this with ⌘Z.`})}):null]})}),hn=(0,C.memo)(function({onClose:e,onSaved:t}){let n=F(e=>e.templateName),r=F(e=>e.templateDescription),i=F(e=>e.setTemplateName),a=F(e=>e.setTemplateDescription),o=F(e=>e.saveTemplate),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(null);return(0,I.jsxs)(fn,{title:`Save Template`,onClose:e,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Se,{onClick:e,children:`Cancel`}),(0,I.jsx)(Se,{variant:`primary`,onClick:async()=>{if(n.trim()){c(!0),u(null);try{await o(),t()}catch(e){u(e instanceof Error?e.message:`Failed to save`)}finally{c(!1)}}},disabled:s,children:s?`Saving...`:`Save`})]}),children:[(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:`Name *`}),(0,I.jsx)(`input`,{value:n,onChange:e=>i(e.target.value),placeholder:`Template name`})]}),(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:`Description`}),(0,I.jsx)(`textarea`,{rows:3,value:r,onChange:e=>a(e.target.value),placeholder:`Optional description`})]}),l?(0,I.jsx)(`div`,{style:{color:`#DC2626`,fontSize:12,marginBottom:8},children:l}):null]})}),gn=(0,C.memo)(function({onClose:e,onSent:t}){let[n,r]=(0,C.useState)(``),i=F(e=>e.getBubbleJSON)(),a=_n(JSON.stringify(i)),[o,s]=(0,C.useState)({});return(0,I.jsxs)(fn,{title:`Send Message`,onClose:e,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Se,{onClick:e,children:`Cancel`}),(0,I.jsx)(Se,{variant:`primary`,onClick:()=>{n.trim()&&t()},children:`Send`})]}),children:[(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:`User UID or Conversation ID *`}),(0,I.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`user-123`})]}),a.length>0?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`modal-subtitle`,children:`Placeholder Values`}),a.map(e=>(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:e}),(0,I.jsx)(`input`,{value:o[e]??``,onChange:t=>s({...o,[e]:t.target.value}),placeholder:`Value for ${e}`})]},e))]}):null]})});function _n(e){let t=e.match(/\{\{(?!theme\.)[^}]+\}\}/g);return t?[...new Set(t.map(e=>e.replace(/^\{\{|\}\}$/g,``)))]:[]}var vn=(0,C.memo)(function({onClose:e,onLoaded:t}){let n=F(e=>e.templates),r=F(e=>e.templatesLoading),i=F(e=>e.templatesMeta),a=F(e=>e.fetchTemplates),o=F(e=>e.fetchNextPage),s=F(e=>e.fetchPrevPage),c=F(e=>e.loadBubble),[l,u]=(0,C.useState)(``);(0,C.useState)(()=>{a()});let d=e=>{u(e),a(e||void 0)};return(0,I.jsxs)(fn,{title:`Load Saved Template`,onClose:e,width:500,style:{maxHeight:`70vh`,display:`flex`,flexDirection:`column`},footer:(0,I.jsx)(Se,{onClick:e,children:`Cancel`}),children:[(0,I.jsx)(`input`,{value:l,onChange:e=>d(e.target.value),placeholder:`Search templates...`,style:{marginBottom:12}}),(0,I.jsx)(`div`,{style:{flex:1,overflowY:`auto`,minHeight:0},children:r&&n.length===0?(0,I.jsx)(`div`,{style:{textAlign:`center`,padding:24,color:`var(--text-tertiary)`,fontSize:13},children:`Loading...`}):n.length===0?(0,I.jsx)(`div`,{style:{textAlign:`center`,padding:24,color:`var(--text-tertiary)`,fontSize:13},children:`No saved templates`}):(0,I.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:n.map(e=>(0,I.jsxs)(`button`,{onClick:()=>{c(e.bubbleData,e.id,e.name,e.description),t()},style:{display:`flex`,flexDirection:`column`,gap:2,padding:`10px 12px`,background:`var(--bg-secondary)`,border:`1px solid var(--border-subtle)`,borderRadius:`var(--radius-sm)`,textAlign:`left`,cursor:`pointer`,transition:`all 0.15s`,width:`100%`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`var(--border-accent)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`var(--border-subtle)`},children:[(0,I.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:`var(--text-primary)`},children:e.name}),e.description?(0,I.jsx)(`span`,{style:{fontSize:11,color:`var(--text-secondary)`},children:e.description}):null,(0,I.jsx)(`span`,{style:{fontSize:10,color:`var(--text-tertiary)`},children:new Date(e.updatedAt*1e3).toLocaleDateString()})]},e.id))})}),i?.previous||i?.next?(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0 0`},children:[(0,I.jsx)(Se,{variant:`link`,onClick:s,disabled:!i?.previous||r,children:`‹ Previous`}),(0,I.jsx)(Se,{variant:`link`,onClick:o,disabled:!i?.next||r,children:`Next ›`})]}):null]})}),yn=new Map([[`text`,()=>({id:O(`text`),type:`text`,content:`Text content`,variant:`body`,color:`#2D3436`,align:`left`,fontWeight:`regular`})],[`image`,()=>({id:O(`image`),type:`image`,url:``,altText:``,fit:`cover`})],[`icon`,()=>({id:O(`icon`),type:`icon`,name:`https://assets.cc-cluster-2.io/bubble-builder/account_circle.png`,size:20,color:`#666666`,borderRadius:0,padding:4})],[`avatar`,()=>({id:O(`avatar`),type:`avatar`,size:36,borderRadius:18,backgroundColor:`#6C5CE7`,fontSize:14,fontWeight:`regular`})],[`badge`,()=>({id:O(`badge`),type:`badge`,text:`Badge`,color:`#FFFFFF`,backgroundColor:`#6C5CE7`,size:24,borderRadius:12,padding:6,fontSize:12})],[`divider`,()=>({id:O(`divider`),type:`divider`,color:`#e0e0e0`,thickness:1,margin:8})],[`spacer`,()=>({id:O(`spacer`),type:`spacer`,height:16})],[`chip`,()=>({id:O(`chip`),type:`chip`,text:`Chip`,color:`#333333`,backgroundColor:`#e0e0e0`,borderRadius:16,padding:4,fontSize:12})],[`progressBar`,()=>({id:O(`progressBar`),type:`progressBar`,value:50,color:`#6C5CE7`,trackColor:`#e0e0e0`,height:6,borderRadius:3,labelFontSize:12,labelColor:`#666666`})],[`codeBlock`,()=>({id:O(`codeBlock`),type:`codeBlock`,content:`console.log("hello");`,language:`javascript`,backgroundColor:`#1e1e1e`,textColor:`#d4d4d4`,padding:12,borderRadius:4,fontSize:12,languageLabelFontSize:10,languageLabelColor:`#888888`})],[`markdown`,()=>({id:O(`markdown`),type:`markdown`,content:`**Bold** and *italic*`,baseFontSize:14,color:`#333333`,lineHeight:1.5,linkColor:`#6C5CE7`})],[`row`,()=>({id:O(`row`),type:`row`,items:[],gap:8,align:`start`,wrap:!1,scrollable:!1,snap:`item`})],[`column`,()=>({id:O(`column`),type:`column`,items:[],gap:8,align:`start`})],[`grid`,()=>({id:O(`grid`),type:`grid`,items:[],columns:2,gap:8})],[`accordion`,()=>({id:O(`accordion`),type:`accordion`,header:`Accordion`,body:[],expandedByDefault:!1,padding:8,fontSize:14,fontWeight:`regular`,borderRadius:4})],[`tabs`,()=>({id:O(`tabs`),type:`tabs`,tabs:[{label:`Tab 1`,content:[]},{label:`Tab 2`,content:[]}],defaultActiveTab:0,tabAlign:`start`,tabPadding:{top:8,right:16,bottom:8,left:16},contentPadding:8,fontSize:13})],[`button`,()=>({id:O(`button`),type:`button`,label:`Button`,action:{type:`openUrl`,url:``,openIn:`browser`},backgroundColor:`#6C5CE7`,textColor:`#FFFFFF`,borderRadius:6,iconPosition:`left`,size:40,fullWidth:!1,padding:{top:0,right:16,bottom:0,left:16},fontSize:13})],[`iconButton`,()=>({id:O(`iconButton`),type:`iconButton`,icon:`https://assets.cc-cluster-2.io/bubble-builder/account_circle.png`,action:{type:`openUrl`,url:``,openIn:`browser`},size:32,color:`#333333`,backgroundColor:`#f0f0f0`,borderRadius:16})],[`link`,()=>({id:O(`link`),type:`link`,text:`Click here`,action:{type:`openUrl`,url:``,openIn:`browser`},color:`#6C5CE7`,underline:!0,fontSize:14})],[`table`,()=>({id:O(`table`),type:`table`,columns:[`Col 1`,`Col 2`],rows:[[`A`,`B`]],headerBackgroundColor:`#f5f5f5`,cellPadding:6,fontSize:12,stripedRowColor:`#fafafa`,borderColor:`#e0e0e0`})]]),bn={Layout:[`row`,`column`,`grid`,`accordion`,`tabs`],Content:[`text`,`image`,`icon`,`avatar`,`badge`,`divider`,`spacer`,`chip`,`markdown`,`codeBlock`],"Data Display":[`table`,`progressBar`],Actions:[`button`,`iconButton`,`link`]};function xn(e){return e.type===`row`||e.type===`column`||e.type===`grid`||e.type===`accordion`||e.type===`tabs`}function Sn(e,t){if(t.length===0)return null;let n=e[t[0]];for(let e=1;e<t.length;e++){if(!n)return null;let r=null;if(n.type===`row`||n.type===`column`||n.type===`grid`?r=n.items:n.type===`accordion`?r=n.body:n.type===`tabs`&&(r=n.tabs[n.defaultActiveTab??0]?.content??null),!r)return null;n=r[t[e]]}return n??null}var Cn=(0,I.jsx)(`div`,{className:`lp-footer`,children:(0,I.jsx)(`div`,{className:`lp-footer-hint`,children:`Click to add element`})}),wn=(0,C.memo)(function(){let[e,t]=(0,C.useState)(`elements`),[n,r]=(0,C.useState)(``),i=F(e=>e.addElement),a=F(e=>e.loadBubble),o=F(e=>e.hiddenElements),s=F(e=>e.hiddenComponents),c=(0,C.useCallback)(e=>{let t=yn.get(e);if(!t)return;let n=F.getState().selectedPath;if(n&&n.length>0){let e=F.getState().body,r=Sn(e,n);if(r&&xn(r)){i(t(),n);return}if(n.length>1){let r=n.slice(0,-1),a=Sn(r.length>0?e:[],r);if(a&&xn(a)){i(t(),r);return}}}i(t())},[i]),l=(0,C.useCallback)(e=>{let t=_e.find(t=>t.name===e);if(!t)return;let n=ne(structuredClone(t.elements)),r=F.getState();if(r.body.length===0){let e={version:`1.0`,body:n,fallbackText:``},i=r.templateName;a(e,void 0,i&&i!==`Untitled Bubble`?i:t.name)}else n.forEach(e=>i(e))},[i,a]);return(0,I.jsxs)(`div`,{className:`left-panel`,children:[(0,I.jsx)(`div`,{className:`palette-header`,children:(0,I.jsxs)(`div`,{className:`lp-tabs`,children:[(0,I.jsxs)(`button`,{className:`lp-tab ${e===`components`?`active`:``}`,onClick:()=>t(`components`),children:[(0,I.jsx)(`span`,{className:`lp-tab-icon`,children:`⊞`}),` Components`]}),(0,I.jsxs)(`button`,{className:`lp-tab ${e===`elements`?`active`:``}`,onClick:()=>t(`elements`),children:[(0,I.jsx)(`span`,{className:`lp-tab-icon`,children:`◇`}),` Elements`]})]})}),(0,I.jsx)(`div`,{className:`lp-content`,children:e===`elements`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{style:{padding:`8px 12px`},children:(0,I.jsx)(`input`,{className:`lp-search`,placeholder:`Search elements...`,value:n,onChange:e=>r(e.target.value)})}),Object.entries(bn).map(([e,t])=>{let r=t.filter(e=>!o.has(e)),i=n?r.filter(e=>Dn(e).toLowerCase().includes(n.toLowerCase())):r;return i.length===0?null:(0,I.jsx)(Tn,{title:e,icon:En(e),children:(0,I.jsx)(`div`,{className:`lp-element-list`,children:i.map(e=>(0,I.jsxs)(`button`,{className:`lp-element-btn`,onClick:()=>c(e),title:`Add ${e}`,children:[(0,I.jsx)(`span`,{className:`lp-element-icon`,children:kn(e)}),(0,I.jsx)(`span`,{className:`lp-element-label`,children:Dn(e)})]},e))})},e)})]}):ve.map(e=>{let t=_e.filter(t=>t.category===e&&!s.has(t.name));return t.length===0?null:(0,I.jsx)(Tn,{title:e,icon:`⊞`,children:(0,I.jsx)(`div`,{className:`lp-component-list`,children:t.map(e=>(0,I.jsxs)(`button`,{className:`lp-component-card`,onClick:()=>l(e.name),children:[(0,I.jsx)(`span`,{className:`lp-card-icon`,children:e.icon}),(0,I.jsxs)(`div`,{className:`lp-card-info`,children:[(0,I.jsx)(`span`,{className:`lp-card-name`,children:e.name}),(0,I.jsx)(`span`,{className:`lp-card-desc`,children:e.description})]})]},e.name))})},e)})}),Cn]})});function Tn({title:e,icon:t,children:n}){let[r,i]=(0,C.useState)(!0);return(0,I.jsxs)(`div`,{className:`lp-category`,children:[(0,I.jsxs)(`div`,{className:`lp-category-header`,onClick:()=>i(!r),children:[(0,I.jsxs)(`div`,{className:`lp-category-title`,children:[(0,I.jsx)(`span`,{className:`lp-category-icon`,children:t}),e]}),(0,I.jsx)(`span`,{className:`lp-category-arrow ${r?`open`:`closed`}`,children:`▾`})]}),r?n:null]})}function En(e){switch(e){case`Layout`:return`⊞`;case`Content`:return`Tt`;case`Data Display`:return`⊟`;case`Media`:return`▶`;case`Actions`:return`⊡`;default:return`◇`}}function Dn(e){return e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}var On=new Map([[`text`,`T`],[`image`,`🖼`],[`icon`,`★`],[`avatar`,`👤`],[`badge`,`🏷`],[`divider`,`—`],[`spacer`,`↕`],[`chip`,`◉`],[`progressBar`,`▓`],[`codeBlock`,`</>`],[`markdown`,`M↓`],[`row`,`↔`],[`column`,`↕`],[`grid`,`⊞`],[`accordion`,`▼`],[`tabs`,`⊟`],[`button`,`▣`],[`iconButton`,`◎`],[`link`,`🔗`],[`table`,`⊞`]]);function kn(e){return On.get(e)??`?`}var An=v(),jn={title:{fontSize:32,fontWeight:700,lineHeight:1.2},heading1:{fontSize:24,fontWeight:700,lineHeight:1.2},heading2:{fontSize:20,fontWeight:600,lineHeight:1.2},heading3:{fontSize:18,fontWeight:600,lineHeight:1.2},heading4:{fontSize:16,fontWeight:600,lineHeight:1.3},body:{fontSize:14,fontWeight:400,lineHeight:1.4},caption1:{fontSize:12,fontWeight:400,lineHeight:1.4},caption2:{fontSize:10,fontWeight:400,lineHeight:1.4}},z=`https://assets.cc-cluster-2.io/bubble-builder`,Mn=[{name:`arrow_back`,label:`Back`,url:`${z}/arrow_back.png`,category:`Navigation`},{name:`arrow_forward`,label:`Forward`,url:`${z}/arrow_forward.png`,category:`Navigation`},{name:`close`,label:`Close`,url:`${z}/close.png`,category:`Navigation`},{name:`check`,label:`Check`,url:`${z}/check.png`,category:`Navigation`},{name:`check_circle`,label:`Check Circle`,url:`${z}/check_circle.png`,category:`Navigation`},{name:`add`,label:`Add`,url:`${z}/add.png`,category:`Navigation`},{name:`remove`,label:`Remove`,url:`${z}/remove.png`,category:`Navigation`},{name:`edit`,label:`Edit`,url:`${z}/edit.png`,category:`Navigation`},{name:`delete`,label:`Delete`,url:`${z}/delete.png`,category:`Navigation`},{name:`search`,label:`Search`,url:`${z}/search.png`,category:`Navigation`},{name:`refresh`,label:`Refresh`,url:`${z}/refresh.png`,category:`Navigation`},{name:`chat`,label:`Chat`,url:`${z}/chat.png`,category:`Communication`},{name:`mail`,label:`Mail`,url:`${z}/mail.png`,category:`Communication`},{name:`phone`,label:`Phone`,url:`${z}/phone.png`,category:`Communication`},{name:`call`,label:`Call`,url:`${z}/call.png`,category:`Communication`},{name:`videocam`,label:`Video`,url:`${z}/videocam.png`,category:`Communication`},{name:`send`,label:`Send`,url:`${z}/send.png`,category:`Communication`},{name:`notifications`,label:`Notifications`,url:`${z}/notifications.png`,category:`Communication`},{name:`person`,label:`Person`,url:`${z}/person.png`,category:`People`},{name:`group`,label:`Group`,url:`${z}/group.png`,category:`People`},{name:`account_circle`,label:`Account`,url:`${z}/account_circle.png`,category:`People`},{name:`account_box`,label:`Profile`,url:`${z}/account_box.png`,category:`People`},{name:`favorite`,label:`Favorite`,url:`${z}/favorite.png`,category:`People`},{name:`star`,label:`Star`,url:`${z}/star.png`,category:`People`},{name:`thumb_up`,label:`Thumb Up`,url:`${z}/thumb_up.png`,category:`People`},{name:`thumb_down`,label:`Thumb Down`,url:`${z}/thumb_down.png`,category:`People`},{name:`share`,label:`Share`,url:`${z}/share.png`,category:`People`},{name:`link`,label:`Link`,url:`${z}/link.png`,category:`Content`},{name:`attach_file`,label:`Attach`,url:`${z}/attach_file.png`,category:`Content`},{name:`image`,label:`Image`,url:`${z}/image.png`,category:`Content`},{name:`file_copy`,label:`Copy`,url:`${z}/file_copy.png`,category:`Content`},{name:`download`,label:`Download`,url:`${z}/download.png`,category:`Content`},{name:`upload`,label:`Upload`,url:`${z}/upload.png`,category:`Content`},{name:`info`,label:`Info`,url:`${z}/info.png`,category:`Status`},{name:`warning`,label:`Warning`,url:`${z}/warning.png`,category:`Status`},{name:`error`,label:`Error`,url:`${z}/error.png`,category:`Status`},{name:`help`,label:`Help`,url:`${z}/help.png`,category:`Status`},{name:`schedule`,label:`Schedule`,url:`${z}/schedule.png`,category:`Status`},{name:`calendar_today`,label:`Calendar`,url:`${z}/calendar_today.png`,category:`Status`},{name:`location_on`,label:`Location`,url:`${z}/location_on.png`,category:`Status`},{name:`shopping_cart`,label:`Cart`,url:`${z}/shopping_cart.png`,category:`Commerce`},{name:`credit_card`,label:`Card`,url:`${z}/credit_card.png`,category:`Commerce`},{name:`payments`,label:`Payment`,url:`${z}/payments.png`,category:`Commerce`},{name:`account_balance`,label:`Bank`,url:`${z}/account_balance.png`,category:`Commerce`},{name:`account_balance_wallet`,label:`Wallet`,url:`${z}/account_balance_wallet.png`,category:`Commerce`},{name:`add_card`,label:`Add Card`,url:`${z}/add_card.png`,category:`Commerce`},{name:`add_shopping_cart`,label:`Add to Cart`,url:`${z}/add_shopping_cart.png`,category:`Commerce`},{name:`add_home`,label:`Add Home`,url:`${z}/add_home.png`,category:`Misc`},{name:`add_task`,label:`Add Task`,url:`${z}/add_task.png`,category:`Misc`}],Nn=new Map(Mn.map(e=>[e.name,e])),Pn=[...new Set(Mn.map(e=>e.category))];function Fn(e){return e.startsWith(`http`)||e.startsWith(`/`)?e:Nn.get(e)?.url??e}var In=document.body;function Ln(e){In=e}function Rn(){return In}function zn(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Bn(e){if(e!=null)return typeof e==`number`?`${e}px`:`${e.top??0}px ${e.right??0}px ${e.bottom??0}px ${e.left??0}px`}function Vn(e){let t=e.split(/(\{\{[^}]+\}\})/g);return t.length===1?e:t.map((e,t)=>e.startsWith(`{{`)?(0,I.jsx)(`span`,{style:{background:`rgba(108,92,231,0.2)`,borderRadius:3,padding:`0 4px`,fontSize:`0.9em`},children:e},t):e)}var Hn=(0,C.memo)(function({element:e,path:t,selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:d,isLast:f,inRow:p}){let m=zn(n,t),h=r.some(e=>zn(e,t)),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(null),b=(0,C.useCallback)(e=>{e.stopPropagation(),y(null),e.shiftKey?a(t):i(t),_(!1)},[i,a,t]),x=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),i(t),y({x:e.clientX,y:e.clientY})},[i,t]),S=e.type===`row`||e.type===`column`||e.type===`grid`||e.type===`accordion`||e.type===`tabs`,w=(0,C.useRef)(null),[T,ee]=(0,C.useState)(null),te=(0,C.useCallback)(()=>{if(!w.current)return;let e=w.current.getBoundingClientRect();ee({top:e.top-2,left:e.right})},[]),E=Gn(e,t,n,r,i,a,o,s,c,l,u);return(0,I.jsxs)(`div`,{ref:w,className:`el-wrapper ${m?`selected`:``} ${h&&!m?`multi-selected`:``}`,onClick:b,onContextMenu:x,onMouseEnter:te,style:p?{width:e.type===`button`&&e.fullWidth?`100%`:`auto`}:void 0,children:[v?(0,I.jsxs)(`div`,{className:`el-context-menu`,style:{position:`fixed`,left:v.x,top:v.y,zIndex:2e3},onClick:e=>e.stopPropagation(),children:[t.length>1?(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{i(t.slice(0,-1)),y(null)},children:`↰ Select Parent`}):null,d?null:(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{o(t,`up`),y(null)},children:`↑ Move Up`}),f?null:(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{o(t,`down`),y(null)},children:`↓ Move Down`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{u(t),y(null)},children:`⧉ Duplicate`}),(0,I.jsx)(`div`,{className:`el-ctx-sep`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{c(t,`row`),y(null)},children:`Wrap in Row`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{c(t,`column`),y(null)},children:`Wrap in Column`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{c(t,`grid`),y(null)},children:`Wrap in Grid`}),S?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`el-ctx-sep`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{l(t),y(null)},children:`⊟ Unwrap`})]}):null,(0,I.jsx)(`div`,{className:`el-ctx-sep`}),(0,I.jsx)(`button`,{className:`el-ctx-item danger`,onClick:()=>{s(t),y(null)},children:`× Delete`})]}):null,m&&T?(0,An.createPortal)((0,I.jsxs)(`div`,{className:`el-controls-portal`,style:{position:`fixed`,top:T.top,left:T.left,transform:`translate(-100%, -100%)`},onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[t.length>1?(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),i(t.slice(0,-1))},title:`Select parent`,children:`↰`}):null,d?null:(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),o(t,`up`)},title:`Move up`,children:`↑`}),f?null:(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),o(t,`down`)},title:`Move down`,children:`↓`}),S?(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),l(t)},title:`Unwrap container`,children:`⊟`}):null,(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),u(t)},title:`Duplicate`,children:`⧉`}),(0,I.jsxs)(`div`,{style:{position:`relative`},children:[(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),_(!g)},title:`Wrap in container`,children:`⊞`}),g?(0,I.jsxs)(`div`,{className:`el-wrap-menu`,children:[(0,I.jsx)(`button`,{className:`el-wrap-option`,onClick:e=>{e.stopPropagation(),c(t,`row`),_(!1)},children:`Wrap in Row`}),(0,I.jsx)(`button`,{className:`el-wrap-option`,onClick:e=>{e.stopPropagation(),c(t,`column`),_(!1)},children:`Wrap in Column`}),(0,I.jsx)(`button`,{className:`el-wrap-option`,onClick:e=>{e.stopPropagation(),c(t,`grid`),_(!1)},children:`Wrap in Grid`})]}):null]}),(0,I.jsx)(`button`,{className:`el-ctrl-btn danger`,onClick:e=>{e.stopPropagation(),s(t)},title:`Delete`,children:`×`})]}),Rn()):null,E]})}),Un=(0,I.jsx)(`div`,{style:{padding:`12px 16px`,color:`#adb5bd`,fontSize:12,textAlign:`center`,border:`1px dashed #dee2e6`,borderRadius:6,margin:4},children:`Drop elements here`});function Wn(e,t,n){return(0,I.jsx)(`span`,{style:{display:`inline-block`,width:t,height:t,verticalAlign:`middle`,backgroundColor:n||`currentColor`,WebkitMaskImage:`url(${Fn(e)})`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(${Fn(e)})`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}})}function Gn(e,t,n,r,i,a,o,s,c,l,u){switch(e.type){case`text`:return(0,I.jsx)(`div`,{style:{...jn[e.variant??`body`],color:e.color||`#2D3436`,textAlign:e.align,fontWeight:e.fontWeight===`medium`?500:e.fontWeight===`bold`?700:400,padding:Bn(e.padding),overflowWrap:`break-word`,wordBreak:`break-word`,...e.maxLines?{overflow:`hidden`,display:`-webkit-box`,WebkitLineClamp:e.maxLines,WebkitBoxOrient:`vertical`}:{}},children:Vn(e.content)});case`image`:{let t=e.url&&e.url.includes(`{{`),n=e.url&&!t;return(0,I.jsx)(`div`,{style:{padding:Bn(e.padding)},children:n?(0,I.jsx)(`img`,{src:e.url,alt:e.altText??``,style:{width:e.width?typeof e.width==`number`?`${e.width}px`:e.width:`100%`,height:e.height?typeof e.height==`number`?`${e.height}px`:e.height:`auto`,objectFit:e.fit??`cover`,borderRadius:e.borderRadius?`${e.borderRadius}px`:void 0,display:`block`}}):(0,I.jsxs)(`div`,{style:{width:e.width?typeof e.width==`number`?`${e.width}px`:e.width:`100%`,height:typeof e.height==`number`?e.height:180,background:`linear-gradient(135deg, #f1f3f5 0%, #e9ecef 50%, #f1f3f5 100%)`,borderRadius:e.borderRadius??6,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#727272`,fontSize:12,flexDirection:`column`,gap:8,border:`2px dashed #ced4da`,position:`relative`,overflow:`hidden`},children:[(0,I.jsx)(`div`,{style:{position:`absolute`,inset:0,opacity:.04,backgroundImage:`repeating-linear-gradient(45deg, #868e96 0, #868e96 1px, transparent 0, transparent 50%)`,backgroundSize:`12px 12px`}}),(0,I.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,background:`rgba(108,92,231,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:24},children:`🖼`}),t?(0,I.jsx)(`span`,{style:{background:`rgba(104,82,214,0.15)`,borderRadius:4,padding:`3px 10px`,fontSize:12,color:`#6852D6`,fontFamily:`monospace`},children:e.url}):(0,I.jsx)(`span`,{style:{color:`#adb5bd`,fontSize:13,fontWeight:500},children:`Image placeholder`})]})})}case`icon`:return(0,I.jsx)(`div`,{style:{width:e.size?e.size+(e.padding??4)*2:28,height:e.size?e.size+(e.padding??4)*2:28,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius??0},children:(0,I.jsx)(`div`,{style:{width:e.size??20,height:e.size??20,backgroundColor:e.color||`#666666`,WebkitMaskImage:`url(${Fn(e.name)})`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(${Fn(e.name)})`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}})});case`avatar`:{let t=e.size??36,n=e.fontWeight===`medium`?500:e.fontWeight===`bold`?700:400;return(0,I.jsx)(`div`,{style:{width:t,height:t,borderRadius:e.borderRadius??t/2,background:e.backgroundColor??`#6C5CE7`,color:`#FFFFFF`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:e.fontSize??t*.4,fontWeight:n,overflow:`hidden`},children:e.imageUrl?(0,I.jsx)(`img`,{src:e.imageUrl,alt:``,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):e.fallbackInitials??`?`})}case`badge`:{let t=e.size??24;return(0,I.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:t,height:t,padding:e.padding==null?`0 6px`:typeof e.padding==`number`?`0 ${e.padding}px`:`${e.padding.top??0}px ${e.padding.right??0}px ${e.padding.bottom??0}px ${e.padding.left??0}px`,borderRadius:e.borderRadius??12,fontSize:e.fontSize??12,fontWeight:600,background:e.backgroundColor||`#6C5CE7`,color:e.color||`#FFFFFF`,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#000000`}`:`none`},children:e.text})}case`divider`:return(0,I.jsx)(`hr`,{style:{border:`none`,borderTop:`${e.thickness??1}px solid ${e.color||`#e0e0e0`}`,margin:`${e.margin??8}px 0`}});case`spacer`:return(0,I.jsx)(`div`,{style:{height:e.height}});case`chip`:return(0,I.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:Bn(e.padding)??`4px 10px`,borderRadius:e.borderRadius??16,fontSize:e.fontSize??12,background:e.backgroundColor||`#e0e0e0`,color:e.color||`#333333`,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#000000`}`:`none`},children:[e.icon?Wn(e.icon,14,e.color||`#333333`):null,e.text]});case`progressBar`:return(0,I.jsxs)(`div`,{children:[e.label?(0,I.jsx)(`div`,{style:{fontSize:e.labelFontSize??12,color:e.labelColor??`#666666`,marginBottom:4},children:e.label}):null,(0,I.jsx)(`div`,{style:{height:e.height??6,background:e.trackColor||`#e0e0e0`,borderRadius:e.borderRadius??3,overflow:`hidden`},children:(0,I.jsx)(`div`,{style:{width:`${e.value}%`,height:`100%`,background:e.color||`#6C5CE7`,borderRadius:e.borderRadius??3,transition:`width 0.3s`}})})]});case`button`:{let t=e.size??40;return(0,I.jsxs)(`button`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,height:t,padding:Bn(e.padding)??`0 16px`,borderRadius:e.borderRadius??6,fontSize:e.fontSize??Math.max(11,t*.325),fontWeight:600,cursor:`pointer`,width:e.fullWidth?`100%`:void 0,justifyContent:e.fullWidth?`center`:void 0,background:e.backgroundColor??`transparent`,color:e.textColor||`#FFFFFF`,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#000000`}`:`none`},children:[e.icon&&e.iconPosition!==`right`?Wn(e.icon,14):null,e.label,e.icon&&e.iconPosition===`right`?Wn(e.icon,14):null]})}case`iconButton`:{let t=(e.size??32)*.5;return(0,I.jsx)(`button`,{style:{width:e.size??32,height:e.size??32,borderRadius:e.borderRadius??(e.size??32)/2,background:e.backgroundColor||`#f0f0f0`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,border:`none`},children:(0,I.jsx)(`div`,{style:{width:t,height:t,backgroundColor:e.color||`#333333`,WebkitMaskImage:`url(${Fn(e.icon)})`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(${Fn(e.icon)})`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}})})}case`link`:return(0,I.jsx)(`span`,{style:{color:e.color||`#6C5CE7`,textDecoration:e.underline===!1?`none`:`underline`,cursor:`pointer`,fontSize:e.fontSize??14},children:Vn(e.text)});case`table`:return(0,I.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:e.fontSize??12},children:[(0,I.jsx)(`thead`,{children:(0,I.jsx)(`tr`,{children:e.columns.map((t,n)=>(0,I.jsx)(`th`,{style:{padding:e.cellPadding==null?`6px 8px`:`${e.cellPadding}px`,textAlign:`left`,fontWeight:600,background:e.headerBackgroundColor||`#f5f5f5`,border:e.border?`1px solid ${e.borderColor||`#e0e0e0`}`:`none`},children:t},n))})}),(0,I.jsx)(`tbody`,{children:e.rows.map((t,n)=>(0,I.jsx)(`tr`,{style:{background:e.stripedRows&&n%2==1?e.stripedRowColor||`#fafafa`:void 0},children:t.map((t,n)=>(0,I.jsx)(`td`,{style:{padding:e.cellPadding==null?`6px 8px`:`${e.cellPadding}px`,border:e.border?`1px solid ${e.borderColor||`#e0e0e0`}`:`none`},children:Vn(t)},n))},n))})]});case`codeBlock`:return(0,I.jsxs)(`pre`,{style:{background:e.backgroundColor||`#1e1e1e`,color:e.textColor||`#d4d4d4`,padding:Bn(e.padding)??`12px`,borderRadius:e.borderRadius??4,fontSize:e.fontSize??12,overflow:`auto`,fontFamily:`monospace`,whiteSpace:`pre-wrap`},children:[e.language?(0,I.jsx)(`div`,{style:{fontSize:e.languageLabelFontSize??10,color:e.languageLabelColor??`#888888`,marginBottom:4},children:e.language}):null,e.content]});case`markdown`:return(0,I.jsx)(`div`,{style:{fontSize:e.baseFontSize??14,lineHeight:e.lineHeight??1.5,color:e.color??`#333333`,"--link-color":e.linkColor??`#6C5CE7`},children:e.content});case`row`:{let d=e.scrollable,f=e.peek??0,p=e.gap??0,m=d?{flex:`0 0 auto`,width:f>0?`calc(100% - ${f*2+p}px)`:`calc(100% - ${p}px)`}:void 0;return(0,I.jsx)(`div`,{style:{display:`flex`,gap:p,flexWrap:e.wrap?`wrap`:void 0,alignItems:d?`stretch`:`center`,padding:Bn(e.padding),width:`100%`,justifyContent:e.align===`spaceBetween`?`space-between`:e.align===`spaceAround`?`space-around`:e.align===`end`?`flex-end`:e.align===`center`?`center`:`flex-start`,overflowX:d?`auto`:void 0,scrollSnapType:d&&e.snap===`item`?`x mandatory`:void 0,background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#e0e0e0`}`:void 0},children:e.items.map((f,p)=>{let h=f.type===`button`&&f.fullWidth;return(0,I.jsx)(`div`,{style:{...m,scrollSnapAlign:d&&e.snap===`item`?`start`:void 0,...h?{flex:1}:void 0},children:(0,I.jsx)(Hn,{element:f,path:[...t,p],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:p===0,isLast:p===e.items.length-1,inRow:!d})},p)})})}case`column`:return(0,I.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:e.gap??0,width:`100%`,alignItems:e.align===`stretch`?`stretch`:e.align===`end`?`flex-end`:e.align===`center`?`center`:`flex-start`,padding:Bn(e.padding),background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#e0e0e0`}`:void 0},children:e.items.length===0?Un:e.items.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===e.items.length-1},f))});case`grid`:return(0,I.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${e.columns??2}, 1fr)`,gap:e.gap??0,padding:Bn(e.padding),width:`100%`,background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#e0e0e0`}`:void 0},children:e.items.length===0?Un:e.items.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===e.items.length-1},f))});case`accordion`:{let d=e.fontWeight===`medium`?500:e.fontWeight===`bold`?700:400;return(0,I.jsxs)(`details`,{open:e.expandedByDefault,style:{border:e.border?`1px solid #e0e0e0`:void 0,borderRadius:e.borderRadius??4},children:[(0,I.jsxs)(`summary`,{style:{padding:Bn(e.padding)??`8px`,cursor:`pointer`,fontSize:e.fontSize??14,fontWeight:d,display:`flex`,alignItems:`center`,gap:6},children:[e.headerIcon?Wn(e.headerIcon,18):null,e.header]}),(0,I.jsx)(`div`,{style:{padding:Bn(e.padding)??`8px`},children:e.body.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===e.body.length-1},f))})]})}case`tabs`:return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{style:{display:`flex`,borderBottom:`1px solid #e0e0e0`,justifyContent:e.tabAlign===`center`?`center`:e.tabAlign===`stretch`?`stretch`:`flex-start`},children:e.tabs.map((n,r)=>(0,I.jsx)(`div`,{onClick:e=>{e.stopPropagation(),F.getState().updateElement(t,{defaultActiveTab:r})},style:{padding:Bn(e.tabPadding)??`8px 16px`,fontSize:e.fontSize??13,cursor:`pointer`,flex:e.tabAlign===`stretch`?1:void 0,textAlign:e.tabAlign===`stretch`?`center`:void 0,fontWeight:r===(e.defaultActiveTab??0)?600:400,borderBottom:r===(e.defaultActiveTab??0)?`2px solid #6C5CE7`:`2px solid transparent`,color:r===(e.defaultActiveTab??0)?`#6C5CE7`:`#999999`},children:n.label},r))}),(0,I.jsx)(`div`,{style:{padding:Bn(e.contentPadding)??`8px`},children:e.tabs[e.defaultActiveTab??0]?.content.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===(e.tabs[e.defaultActiveTab??0]?.content.length??0)-1},f))})]});default:return(0,I.jsxs)(`div`,{style:{padding:8,color:`#999999`,fontSize:12},children:[`Unknown: `,e.type]})}}var Kn=375,qn=667,Jn=new Date,Yn=Jn.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),Xn=Jn.toLocaleDateString(`en-US`,{weekday:`long`,day:`numeric`,month:`long`}),Zn=(0,I.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[(0,I.jsxs)(`svg`,{width:`17`,height:`12`,viewBox:`0 0 17 12`,fill:`white`,children:[(0,I.jsx)(`rect`,{x:`0`,y:`9`,width:`3`,height:`3`,rx:`0.75`}),(0,I.jsx)(`rect`,{x:`4.5`,y:`6`,width:`3`,height:`6`,rx:`0.75`}),(0,I.jsx)(`rect`,{x:`9`,y:`3`,width:`3`,height:`9`,rx:`0.75`}),(0,I.jsx)(`rect`,{x:`13.5`,y:`0`,width:`3`,height:`12`,rx:`0.75`})]}),(0,I.jsxs)(`svg`,{width:`16`,height:`14`,viewBox:`0 0 16 14`,fill:`white`,children:[(0,I.jsx)(`circle`,{cx:`8`,cy:`12`,r:`1.5`}),(0,I.jsx)(`path`,{d:`M4.8 9.5a4.5 4.5 0 016.4 0`,stroke:`white`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`}),(0,I.jsx)(`path`,{d:`M2.2 6.8a8.2 8.2 0 0111.6 0`,stroke:`white`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`}),(0,I.jsx)(`path`,{d:`M0 4a11.5 11.5 0 0116 0`,stroke:`white`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`})]}),(0,I.jsxs)(`svg`,{width:`25`,height:`12`,viewBox:`0 0 25 12`,fill:`none`,children:[(0,I.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`20`,height:`11`,rx:`2.5`,stroke:`white`,strokeOpacity:`0.35`}),(0,I.jsx)(`rect`,{x:`2`,y:`2`,width:`14`,height:`8`,rx:`1.5`,fill:`white`}),(0,I.jsx)(`path`,{d:`M22 4v4a2 2 0 000-4z`,fill:`white`,fillOpacity:`0.4`})]})]}),Qn=(0,C.memo)(function({platform:e}){let t=F(e=>e.notificationTitle),n=F(e=>e.notificationBody),r=k.notification,i=r?.appName??`App`,a=r?.appIcon,o=(0,C.useRef)(null),[s,c]=(0,C.useState)(1);return(0,C.useEffect)(()=>{let e=o.current?.parentElement;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=t.height-64,r=t.width-100,i=Math.min(n/qn,r/Kn);c(Math.round(Math.max(i,.4)*100)/100)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,I.jsx)(`div`,{ref:o,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:(0,I.jsx)(`div`,{style:{width:Kn*s,height:qn*s,flexShrink:0},children:(0,I.jsxs)(`div`,{style:{width:Kn,height:qn,overflow:`hidden`,transform:`scale(${s})`,transformOrigin:`top left`,borderRadius:e===`ios`?48:24,background:`linear-gradient(162deg, rgb(131,151,230) 0%, rgb(130,84,219) 49%, rgb(135,184,189) 100%)`,boxShadow:`0 8px 32px rgba(0,0,0,0.18)`,fontFamily:e===`ios`?`-apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif`:`"Roboto", "Google Sans", sans-serif`,color:`#fff`,position:`relative`,display:`flex`,flexDirection:`column`,justifyContent:e===`ios`?`space-between`:`flex-start`,padding:16},children:[(0,I.jsxs)(`div`,{children:[e===`ios`?(0,I.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,padding:`0 8px`,height:32},children:Zn}):(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`0 8px`,height:32},children:[(0,I.jsx)(`span`,{style:{fontSize:13,fontWeight:600},children:Yn}),Zn]}),e===`ios`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{style:{marginTop:40,textAlign:`center`,fontSize:20,fontWeight:600,lineHeight:`20px`,color:`rgba(255,255,255,0.8)`},children:Xn}),(0,I.jsx)(`div`,{style:{textAlign:`center`,fontSize:86,lineHeight:`96px`,letterSpacing:-4,color:`rgba(255,255,255,0.8)`},children:Yn})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{style:{textAlign:`center`,fontSize:80,lineHeight:`94px`,letterSpacing:-4,color:`#fff`,marginTop:64},children:Yn}),(0,I.jsx)(`div`,{style:{textAlign:`center`,fontSize:16,textTransform:`uppercase`,letterSpacing:1.4,color:`#fff`,marginBottom:34},children:Xn})]})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{style:{borderRadius:20,background:`rgba(255,255,255,0.56)`,padding:e===`ios`?`16px 14px`:`14px 16px`,color:`#000`,backdropFilter:`blur(20px)`,display:`flex`,gap:10,alignItems:`flex-start`},children:[e===`ios`?a?(0,I.jsx)(`img`,{src:a,alt:``,style:{width:38,height:38,borderRadius:10,objectFit:`cover`,flexShrink:0,background:`#fff`}}):(0,I.jsx)(`div`,{style:{width:38,height:38,borderRadius:10,background:`#fff`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsx)(`div`,{style:{width:20,height:20,borderRadius:4,background:`#6852D6`}})}):null,(0,I.jsx)(`div`,{style:{flex:1,minWidth:0},children:e===`ios`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`baseline`},children:[(0,I.jsx)(`span`,{style:{fontWeight:700,fontSize:15,lineHeight:`18px`,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t||i}),(0,I.jsx)(`span`,{style:{fontSize:12,color:`#4f4f4f`,flexShrink:0},children:`now`})]}),n&&(0,I.jsx)(`div`,{style:{fontSize:15,lineHeight:`18px`,opacity:.88,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginTop:4},children:n}),!t&&!n&&(0,I.jsx)(`div`,{style:{fontSize:13,color:`#aaa`,fontStyle:`italic`,marginTop:2},children:`Enter title and body in the Notification tab`})]}):(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`flex-start`},children:[a?(0,I.jsx)(`img`,{src:a,alt:``,style:{width:38,height:38,borderRadius:19,objectFit:`cover`,flexShrink:0,background:`#fff`}}):(0,I.jsx)(`div`,{style:{width:38,height:38,borderRadius:19,background:`#fff`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsx)(`div`,{style:{width:20,height:20,borderRadius:4,background:`#6852D6`}})}),(0,I.jsxs)(`div`,{style:{flex:1,minWidth:0,display:`flex`,flexDirection:`column`,gap:6},children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[(0,I.jsx)(`span`,{style:{fontWeight:700,fontSize:14,lineHeight:`16px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t||i}),(0,I.jsx)(`span`,{style:{fontSize:12,color:`#4f4f4f`,flexGrow:1},children:`now`}),(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,style:{flexShrink:0},children:(0,I.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.53 6.47l.94-.94 3.53 3.53 3.53-3.53.94.94L8 10.94 3.53 6.47z`,fill:`#5E5E5E`})})]}),n&&(0,I.jsx)(`div`,{style:{fontSize:14,lineHeight:`16px`,color:`#4f4f4f`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n}),!t&&!n&&(0,I.jsx)(`div`,{style:{fontSize:13,color:`#aaa`,fontStyle:`italic`},children:`Enter title and body in the Notification tab`})]})]})})})]}),e===`ios`&&(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,gap:190,marginTop:16,marginBottom:-10},children:[(0,I.jsx)(`div`,{style:{width:50,height:50,borderRadius:25,background:`rgba(255,255,255,0.15)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`white`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M9 18h6`}),(0,I.jsx)(`path`,{d:`M10 22h4`}),(0,I.jsx)(`path`,{d:`M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0018 8 6 6 0 006 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 018.91 14`})]})}),(0,I.jsx)(`div`,{style:{width:50,height:50,borderRadius:25,background:`rgba(255,255,255,0.15)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`white`,children:[(0,I.jsx)(`path`,{d:`M12 15.2a3.2 3.2 0 100-6.4 3.2 3.2 0 000 6.4z`}),(0,I.jsx)(`path`,{d:`M9 2L7.17 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V6a2 2 0 00-2-2h-3.17L15 2H9zm3 15a5 5 0 110-10 5 5 0 010 10z`})]})})]}),e===`ios`&&(0,I.jsx)(`div`,{style:{height:5,width:134,borderRadius:3,background:`#fff`,alignSelf:`center`,margin:`0 auto`,marginTop:16}})]})]})})})}),$n={width:40,height:40,borderRadius:8,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#fff`,color:`#6852D6`,boxShadow:`0 1px 3px rgba(0,0,0,0.1)`,transition:`all 0.15s`},er={width:40,height:40,borderRadius:8,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`transparent`,color:`#999`,boxShadow:`none`,transition:`all 0.15s`},tr=(0,C.memo)(function({platform:e,setPlatform:t}){let n=F(e=>e.canvasView),r=F(e=>e.setCanvasView),i=F(e=>e.channels);return i===`inapp`?null:(0,I.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2,alignSelf:`center`,background:`#f0f0f0`,borderRadius:10,padding:3,marginLeft:16},children:[i===`both`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{onClick:()=>r(`bubble`),title:`In-App Message`,style:n===`bubble`?$n:er,children:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,I.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z`})})}),(0,I.jsx)(`div`,{style:{height:1,background:`#ddd`,margin:`2px 6px`}})]}),(0,I.jsx)(`button`,{onClick:()=>{r(`notification`),t(`ios`)},title:`Push — iOS`,style:n===`notification`&&e===`ios`?$n:er,children:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,I.jsx)(`path`,{d:`M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.8-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z`})})}),(0,I.jsx)(`button`,{onClick:()=>{r(`notification`),t(`android`)},title:`Push — Android`,style:n===`notification`&&e===`android`?$n:er,children:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,I.jsx)(`path`,{d:`M6 18c0 .55.45 1 1 1h1v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h2v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h1c.55 0 1-.45 1-1V8H6v10zM3.5 8C2.67 8 2 8.67 2 9.5v7c0 .83.67 1.5 1.5 1.5S5 17.33 5 16.5v-7C5 8.67 4.33 8 3.5 8zm17 0c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm-4.97-5.84l1.3-1.3c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0l-1.48 1.48C13.85 1.23 12.95 1 12 1c-.96 0-1.86.23-2.66.63L7.85.15c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l1.31 1.31C6.97 3.26 6 5.01 6 7h12c0-1.99-.97-3.75-2.47-4.84zM10 5H9V4h1v1zm5 0h-1V4h1v1z`})})})]})});function nr(e){return e==null?`12px`:typeof e==`number`?`${e}px`:`${e.top??0}px ${e.right??0}px ${e.bottom??0}px ${e.left??0}px`}var rr=(0,I.jsxs)(`div`,{className:`chat-header`,children:[(0,I.jsx)(`span`,{className:`chat-back-btn`,children:`←`}),(0,I.jsxs)(`div`,{className:`chat-user`,children:[(0,I.jsx)(`div`,{className:`chat-avatar`,children:`A`}),(0,I.jsx)(`div`,{className:`chat-name`,children:`Ada Stanton`})]})]}),ir=(0,I.jsxs)(`div`,{className:`chat-input-area`,children:[(0,I.jsx)(`input`,{className:`chat-input`,placeholder:`Enter your message here`,readOnly:!0}),(0,I.jsx)(`button`,{className:`chat-send-btn`,children:`▶`})]}),ar=new Date().toLocaleDateString(`en-US`,{day:`numeric`,month:`short`,year:`numeric`}),or=(0,C.memo)(function(){let e=F(e=>e.body),t=F(e=>e.settings),n=F(e=>e.selectedPath),r=F(e=>e.selectElement),i=F(e=>e.moveElement),a=F(e=>e.removeElement),o=F(e=>e.wrapElement),s=F(e=>e.unwrapElement),c=F(e=>e.selectedPaths),l=F(e=>e.toggleSelectElement),u=F(e=>e.wrapSelected),d=F(e=>e.duplicateElement),[f,p]=(0,C.useState)(1),[m,h]=(0,C.useState)(!1),[g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(!1),y=F(e=>e.getBubbleJSON),b=F(e=>e.canvasView),[x,S]=(0,C.useState)(`ios`),w=(0,C.useRef)(null);(0,C.useEffect)(()=>{let e=w.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=t.height-64,r=t.width-48,i=Math.min(n/667,r/375);p(Math.round(Math.max(i,.4)*100)/100)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let T=g?`#383838`:`#E8E8E8`,ee=g?`#FFFFFF`:`#141414`,te=(0,C.useCallback)(e=>{e.target===e.currentTarget&&r(null)},[r]),E={...(0,C.useMemo)(()=>{let e=t.background;return e?{background:e}:{background:T,color:ee}},[t.background,T,ee]),borderRadius:t.borderRadius??16,border:t.borderWidth?`${t.borderWidth}px solid ${t.borderColor??`#DFE6E9`}`:void 0,padding:nr(t.padding)},D=(0,C.useMemo)(()=>{if(!n||n.length===0)return[];let t=[{label:`body`,path:null}],r;for(let i=0;i<n.length;i++){let a=n.slice(0,i+1);if(i===0)r=e[n[0]];else if(r){let e=null;r.type===`row`||r.type===`column`||r.type===`grid`?e=r.items:r.type===`accordion`?e=r.body:r.type===`tabs`&&(e=r.tabs[r.defaultActiveTab??0]?.content??null),r=e?.[n[i]]}r&&t.push({label:`${r.type}[${n[i]}]`,path:a})}return t},[n,e]);return(0,I.jsxs)(`div`,{className:`canvas ${m?`preview-mode`:``}`,onClick:te,children:[D.length>1?(0,I.jsx)(`div`,{className:`canvas-breadcrumbs`,children:D.map((e,t)=>(0,I.jsxs)(`span`,{children:[t>0?(0,I.jsx)(`span`,{className:`canvas-bc-sep`,children:`›`}):null,(0,I.jsx)(`button`,{className:`canvas-bc-item ${t===D.length-1?`active`:``}`,onClick:t=>{t.stopPropagation(),r(e.path)},children:e.label})]},t))}):null,(0,I.jsxs)(`div`,{className:`canvas-area`,ref:w,children:[b===`notification`?(0,I.jsx)(Qn,{platform:x}):(0,I.jsx)(`div`,{style:{width:375*f,height:667*f,flexShrink:0},children:(0,I.jsx)(`div`,{className:`phone-frame`,style:{width:375,height:667,maxHeight:667,transform:`scale(${f})`,transformOrigin:`top left`},children:(0,I.jsxs)(`div`,{className:`phone-screen`,style:g?{background:`#1a1a1a`}:void 0,children:[rr,(0,I.jsxs)(`div`,{className:`chat-messages`,children:[(0,I.jsx)(`div`,{className:`message-date`,children:ar}),(0,I.jsx)(`div`,{className:`bubble-preview`,children:(0,I.jsx)(`div`,{className:`canvas-bubble`,style:E,children:e.length===0?(0,I.jsxs)(`div`,{className:`canvas-empty`,children:[(0,I.jsx)(`span`,{className:`canvas-empty-icon`,children:`+`}),(0,I.jsx)(`span`,{children:`Click an element or component to add it here`}),(0,I.jsx)(cr,{})]}):e.map((t,u)=>(0,I.jsx)(Hn,{element:t,path:[u],selectedPath:n,selectedPaths:c,onSelect:r,onToggleSelect:l,onMove:i,onRemove:a,onWrap:o,onUnwrap:s,onDuplicate:d,isLast:u===e.length-1,isFirst:u===0},u))})})]}),ir]})})}),(0,I.jsx)(tr,{platform:x,setPlatform:S})]}),c.length>=2?(0,I.jsxs)(`div`,{className:`multi-select-bar`,children:[(0,I.jsxs)(`span`,{children:[c.length,` elements selected`]}),(0,I.jsx)(`button`,{onClick:()=>u(`row`),children:`Wrap in Row`}),(0,I.jsx)(`button`,{onClick:()=>u(`column`),children:`Wrap in Column`}),(0,I.jsx)(`button`,{onClick:()=>u(`grid`),children:`Wrap in Grid`})]}):null,(0,I.jsxs)(`div`,{className:`canvas-toolbar`,children:[(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>p(e=>Math.max(.5,e-.1)),title:`Zoom out`,children:`−`}),(0,I.jsxs)(`span`,{className:`canvas-tool-label`,children:[Math.round(f*100),`%`]}),(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>p(e=>Math.min(1.5,e+.1)),title:`Zoom in`,children:`+`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>p(1),title:`Reset zoom`,children:`⊡`}),(0,I.jsx)(`span`,{className:`canvas-tool-sep`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn ${m?`active`:``}`,onClick:()=>h(e=>!e),title:`Preview mode`,children:`👁`}),(0,I.jsx)(`span`,{className:`canvas-tool-sep`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn ${_?`active`:``}`,onClick:()=>v(e=>!e),title:`JSON preview`,children:`{}`}),(0,I.jsx)(`span`,{className:`canvas-tool-sep`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>window.dispatchEvent(new KeyboardEvent(`keydown`,{key:`?`})),title:`Keyboard shortcuts`,children:`?`})]}),_?(0,I.jsxs)(`div`,{className:`json-preview-panel`,children:[(0,I.jsxs)(`div`,{className:`json-preview-header`,children:[(0,I.jsx)(`span`,{children:`JSON Output`}),(0,I.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(y(),null,2))},title:`Copy`,children:`📋`}),(0,I.jsx)(`button`,{onClick:()=>v(!1),children:`×`})]}),(0,I.jsx)(`pre`,{className:`json-preview-code`,children:JSON.stringify(y(),null,2)})]}):null]})}),sr={marginTop:12,padding:`8px 16px`,background:`none`,border:`1px solid var(--border-medium)`,borderRadius:8,fontSize:13,fontWeight:500,color:`var(--accent-primary)`,cursor:`pointer`,transition:`all 0.15s`},cr=(0,C.memo)(function(){let e=F(e=>e.templates),t=F(e=>e.fetchTemplates),n=F(e=>e.setShowTemplatePicker);return(0,C.useState)(()=>{e.length===0&&!k.hideTemplateLibrary&&t()}),k.hideTemplateLibrary?null:(0,I.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n(!0)},style:sr,children:`Load from Saved Template`})}),lr={padding:`0 6px`,borderRadius:4,height:28,border:`1px solid var(--border-subtle)`,background:`var(--bg-secondary)`,cursor:`pointer`,color:`#6852D6`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},ur=(0,I.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`,children:[(0,I.jsx)(`path`,{d:`M1 11v2.056h1c.098 0 .194-.004.29-.013A1 1 0 0 1 3 14v5.056a2.5 2.5 0 0 0 2.5 2.5H8v-2H5.5a.5.5 0 0 1-.5-.5V14c0-.755-.279-1.444-.739-1.972.46-.527.739-1.217.739-1.972V5a.5.5 0 0 1 .5-.5H8v-2H5.5A2.5 2.5 0 0 0 3 5v5.056a1 1 0 0 1-.71.958A3.047 3.047 0 0 0 2 11H1ZM21 10.056a1 1 0 0 0 .71.958c.096-.01.192-.014.29-.014h1v2.056h-1c-.098 0-.194-.004-.29-.013A1 1 0 0 0 21 14v5.056a2.5 2.5 0 0 1-2.5 2.5h-2v-2h2a.5.5 0 0 0 .5-.5V14c0-.755.279-1.444.739-1.972A2.989 2.989 0 0 1 19 10.056V5a.5.5 0 0 0-.5-.5H16v-2h2.5A2.5 2.5 0 0 1 21 5v5.056ZM12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z`}),(0,I.jsx)(`path`,{d:`M17 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM8 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z`})]}),dr=(0,C.memo)(function({value:e,onChange:t,placeholder:n,multiline:r,rows:i,style:a}){let o=F(e=>e.variables),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(``),d=(0,C.useRef)(null),f=(0,C.useRef)(null),[p,m]=(0,C.useState)(null),h=(0,C.useCallback)(()=>{if(s){c(!1),u(``);return}if(f.current){let e=f.current.getBoundingClientRect();m({top:e.bottom+4,left:e.left,width:e.width})}c(!0),u(``)},[s]);(0,C.useEffect)(()=>{if(!s)return;let e=e=>{let t=e.target;f.current?.contains(t)||document.getElementById(`variable-dropdown-portal`)?.contains(t)||c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]);let g=(0,C.useCallback)(n=>{let r=`{{${n}}}`,i=d.current;if(i){let n=i.selectionStart??e.length,a=i.selectionEnd??e.length;t(e.slice(0,n)+r+e.slice(a)),requestAnimationFrame(()=>{let e=n+r.length;i.setSelectionRange(e,e),i.focus()})}else t(e+r);c(!1),u(``)},[e,t]);if(!o||o.length===0)return r?(0,I.jsx)(`textarea`,{ref:d,rows:i??3,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:{resize:`vertical`,...a}}):(0,I.jsx)(`input`,{ref:d,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:a});let _=l?o.filter(e=>e.name.toLowerCase().includes(l.toLowerCase())||(e.label??``).toLowerCase().includes(l.toLowerCase())||(e.description??``).toLowerCase().includes(l.toLowerCase())):o,v=new Map;for(let e of _){let t=e.category??`Variables`;v.has(t)||v.set(t,[]),v.get(t).push(e)}return(0,I.jsxs)(`div`,{ref:f,style:{position:`relative`},children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`center`},children:[(0,I.jsx)(`div`,{style:{flex:1},children:r?(0,I.jsx)(`textarea`,{ref:d,rows:i??3,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:{resize:`vertical`,width:`100%`,...a}}):(0,I.jsx)(`input`,{ref:d,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:{width:`100%`,...a}})}),(0,I.jsx)(`button`,{type:`button`,onClick:h,style:lr,title:`Insert variable`,children:ur})]}),s&&p&&(0,An.createPortal)((0,I.jsxs)(`div`,{id:`variable-dropdown-portal`,style:{position:`fixed`,top:p.top,left:p.left,width:p.width,zIndex:9999,background:`#fff`,borderRadius:8,border:`1px solid #E2E4E9`,boxShadow:`0 8px 30px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06)`,display:`flex`,flexDirection:`column`,maxHeight:280},children:[(0,I.jsx)(`div`,{style:{padding:`8px 10px`,borderBottom:`1px solid #EFEFEF`,flexShrink:0},children:(0,I.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`Search variables...`,autoFocus:!0,style:{width:`100%`,fontSize:12,border:`1px solid #E2E4E9`,borderRadius:6,padding:`6px 10px`,outline:`none`,background:`#FAFAFA`,color:`#333`,margin:0,boxShadow:`none`}})}),(0,I.jsx)(`div`,{style:{overflowY:`auto`,flex:1,padding:`4px 0`},children:_.length===0?(0,I.jsx)(`div`,{style:{padding:`16px 12px`,fontSize:12,color:`#aaa`,textAlign:`center`},children:`No matching variables`}):[...v.entries()].map(([e,t],n)=>(0,I.jsxs)(`div`,{children:[v.size>1&&(0,I.jsx)(`div`,{style:{fontSize:10,fontWeight:600,color:`#999`,letterSpacing:.5,padding:`6px 12px 3px`,textTransform:`uppercase`,...n>0?{borderTop:`1px solid #F0F0F0`,marginTop:2}:{}},children:e}),t.map(e=>(0,I.jsx)(`div`,{onClick:()=>g(e.name),onMouseEnter:e=>{e.currentTarget.style.background=`#F5F5F7`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},title:[e.label,e.description].filter(Boolean).join(` — `)||void 0,style:{padding:`5px 12px`,cursor:`pointer`,transition:`background 0.1s`},children:(0,I.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`,fontSize:11,color:`#6852D6`},children:`{{${e.name}}}`})},e.name))]},e))})]}),Rn())]})}),fr={Navigation:[`openUrl`],Messaging:[`chatWithUser`,`chatWithGroup`,`sendMessage`],Utility:[`copyToClipboard`,`downloadFile`],CometChat:[`initiateCall`],Data:[`apiCall`],Developer:[`customCallback`]},pr={openUrl:{type:`openUrl`,url:``,openIn:`browser`},chatWithUser:{type:`chatWithUser`,uid:``},chatWithGroup:{type:`chatWithGroup`,guid:``},sendMessage:{type:`sendMessage`,text:``},copyToClipboard:{type:`copyToClipboard`,value:``},downloadFile:{type:`downloadFile`,url:``},initiateCall:{type:`initiateCall`,callType:`audio`},apiCall:{type:`apiCall`,url:``,method:`POST`},customCallback:{type:`customCallback`}},mr=(0,C.memo)(function({action:e,onChange:t}){let n=(0,C.useCallback)(e=>{t(pr[e]??{type:`openUrl`,url:``})},[t]);return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Action Type`}),(0,I.jsx)(`select`,{value:e.type,onChange:e=>n(e.target.value),children:Object.entries(fr).map(([e,t])=>(0,I.jsx)(`optgroup`,{label:e,children:t.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))},e))})]}),hr(e,t)]})});function hr(e,t){switch(e.type){case`openUrl`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`URL`}),(0,I.jsx)(dr,{value:e.url,onChange:n=>t({...e,url:n}),placeholder:`https://...`})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Open In`}),(0,I.jsxs)(`select`,{value:e.openIn??`browser`,onChange:n=>t({...e,openIn:n.target.value}),children:[(0,I.jsx)(`option`,{value:`browser`,children:`Browser`}),(0,I.jsx)(`option`,{value:`webview`,children:`Webview`})]})]})]});case`chatWithUser`:return(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`User UID`}),(0,I.jsx)(dr,{value:e.uid,onChange:n=>t({...e,uid:n})})]});case`chatWithGroup`:return(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Group GUID`}),(0,I.jsx)(dr,{value:e.guid,onChange:n=>t({...e,guid:n})})]});case`sendMessage`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Text`}),(0,I.jsx)(dr,{value:e.text,onChange:n=>t({...e,text:n})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Receiver UID (optional)`}),(0,I.jsx)(dr,{value:e.receiverUid??``,onChange:n=>t({...e,receiverUid:n||void 0})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Receiver GUID (optional)`}),(0,I.jsx)(dr,{value:e.receiverGuid??``,onChange:n=>t({...e,receiverGuid:n||void 0})})]})]});case`copyToClipboard`:return(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Value`}),(0,I.jsx)(dr,{value:e.value,onChange:n=>t({...e,value:n})})]});case`downloadFile`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`URL`}),(0,I.jsx)(dr,{value:e.url,onChange:n=>t({...e,url:n})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Filename`}),(0,I.jsx)(dr,{value:e.filename??``,onChange:n=>t({...e,filename:n||void 0})})]})]});case`initiateCall`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Call Type`}),(0,I.jsxs)(`select`,{value:e.callType,onChange:n=>t({...e,callType:n.target.value}),children:[(0,I.jsx)(`option`,{value:`audio`,children:`Audio`}),(0,I.jsx)(`option`,{value:`video`,children:`Video`})]})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`User UID`}),(0,I.jsx)(dr,{value:e.uid??``,onChange:n=>t({...e,uid:n||void 0})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Group GUID`}),(0,I.jsx)(dr,{value:e.guid??``,onChange:n=>t({...e,guid:n||void 0})})]})]});case`apiCall`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`URL`}),(0,I.jsx)(dr,{value:e.url,onChange:n=>t({...e,url:n})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Method`}),(0,I.jsxs)(`select`,{value:e.method??`POST`,onChange:n=>t({...e,method:n.target.value}),children:[(0,I.jsx)(`option`,{value:`GET`,children:`GET`}),(0,I.jsx)(`option`,{value:`POST`,children:`POST`}),(0,I.jsx)(`option`,{value:`PUT`,children:`PUT`}),(0,I.jsx)(`option`,{value:`DELETE`,children:`DELETE`})]})]})]});case`customCallback`:return(0,I.jsx)(`div`,{style:{fontSize:12,color:`var(--text-muted)`,padding:`4px 0`},children:`No additional properties`});default:return null}}var gr={maxHeight:220,overflowY:`auto`,padding:4,border:`1px solid var(--border-subtle)`,borderRadius:6,marginTop:4},_r={display:`flex`,flexWrap:`wrap`,gap:4,padding:`2px 0`},vr={width:34,height:34,borderRadius:6,border:`1px solid transparent`,background:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:2},yr={width:20,height:20,objectFit:`contain`},br=(0,C.memo)(function({value:e,onChange:t}){let[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(``),o=(0,C.useCallback)(e=>{let n=Mn.find(t=>t.name===e);t(n?n.url:e),r(!1),a(``)},[t]),s=Fn(e),c=Mn.find(t=>t.url===e),l=c?c.label:e,u=e&&(e.startsWith(`http`)||e.startsWith(`/`)||c),d=i.toLowerCase(),f=d?Mn.filter(e=>e.name.includes(d)||e.label.toLowerCase().includes(d)):Mn;return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[u?(0,I.jsx)(`img`,{src:s,alt:``,style:{width:20,height:20,objectFit:`contain`}}):null,(0,I.jsx)(`input`,{value:l,readOnly:!0,placeholder:`Select an icon`,style:{flex:1,cursor:`pointer`},onClick:()=>r(e=>!e)}),(0,I.jsx)(`button`,{onClick:()=>r(e=>!e),style:{padding:`4px 8px`,fontSize:11,borderRadius:4,border:`1px solid var(--border-subtle)`,background:`var(--bg-secondary)`,cursor:`pointer`},title:`Browse icons`,children:n?`▲`:`▼`})]}),e?(0,I.jsx)(`div`,{style:{fontSize:10,color:`var(--text-muted)`,marginTop:2,wordBreak:`break-all`},children:e}):null,n?(0,I.jsxs)(`div`,{style:{marginTop:4},children:[(0,I.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Search icons...`,style:{width:`100%`,marginBottom:4,fontSize:11}}),(0,I.jsxs)(`div`,{style:gr,children:[Pn.map(t=>{let n=f.filter(e=>e.category===t);return n.length===0?null:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{style:{fontSize:10,color:`var(--text-muted)`,padding:`6px 2px 2px`,fontWeight:600},children:t}),(0,I.jsx)(`div`,{style:_r,children:n.map(t=>(0,I.jsx)(`button`,{onClick:()=>o(t.name),title:t.label,style:{...vr,borderColor:e===t.url?`var(--accent-primary)`:`transparent`,background:e===t.url?`rgba(108,92,231,0.1)`:`none`},children:(0,I.jsx)(`img`,{src:t.url,alt:t.label,style:yr})},t.name))})]},t)}),f.length===0?(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,padding:8,textAlign:`center`},children:[`No icons match "`,i,`"`]}):null]})]}):null]})}),xr=/^(https?:\/\/|{{)/i;function Sr(e){let t=[];switch(e.type){case`text`:e.content||t.push({field:`content`,message:`Content is required`});break;case`image`:e.url?xr.test(e.url)||t.push({field:`url`,message:`Must be a valid URL`}):t.push({field:`url`,message:`URL is required`});break;case`icon`:e.name||t.push({field:`name`,message:`Icon name is required`});break;case`spacer`:(e.height==null||e.height<0)&&t.push({field:`height`,message:`Height must be ≥ 0`});break;case`button`:e.label||t.push({field:`label`,message:`Label is required`}),e.action?Cr(e.action,t):t.push({field:`action`,message:`Action is required`});break;case`iconButton`:e.icon||t.push({field:`icon`,message:`Icon is required`}),e.action?Cr(e.action,t):t.push({field:`action`,message:`Action is required`});break;case`link`:e.text||t.push({field:`text`,message:`Text is required`}),e.action?Cr(e.action,t):t.push({field:`action`,message:`Action is required`});break;case`badge`:case`chip`:e.text||t.push({field:`text`,message:`Text is required`});break;case`progressBar`:(e.value<0||e.value>100)&&t.push({field:`value`,message:`Must be 0–100`});break;case`table`:(!e.columns||e.columns.length===0)&&t.push({field:`columns`,message:`At least one column is required`}),(!e.rows||e.rows.length===0)&&t.push({field:`rows`,message:`At least one row is required`});break;case`codeBlock`:e.content||t.push({field:`content`,message:`Content is required`});break;case`markdown`:e.content||t.push({field:`content`,message:`Content is required`});break;case`accordion`:e.header||t.push({field:`header`,message:`Header is required`});break}return t}function Cr(e,t){switch(e.type){case`openUrl`:e.url||t.push({field:`action.url`,message:`URL is required for openUrl action`});break;case`chatWithUser`:e.uid||t.push({field:`action.uid`,message:`User ID is required`});break;case`chatWithGroup`:e.guid||t.push({field:`action.guid`,message:`Group ID is required`});break;case`sendMessage`:e.text||t.push({field:`action.text`,message:`Message text is required`});break;case`copyToClipboard`:e.value||t.push({field:`action.value`,message:`Value is required`});break;case`downloadFile`:e.url||t.push({field:`action.url`,message:`File URL is required`});break;case`apiCall`:e.url||t.push({field:`action.url`,message:`API URL is required`});break}}function wr(e){return Sr(e).length>0}var Tr=(0,C.memo)(function({element:e,onUpdate:t}){let n=(0,C.useMemo)(()=>Sr(e),[e]),r=(0,C.useMemo)(()=>{let e=new Map;for(let t of n)e.set(t.field,t.message);return e},[n]);return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`prop-badge`,children:e.type}),(0,I.jsx)(B,{label:`ID`,children:(0,I.jsx)(`input`,{defaultValue:e.id,onBlur:e=>t({id:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},style:{fontFamily:`var(--font-mono)`,fontSize:11}})}),n.length>0&&(0,I.jsxs)(`div`,{className:`prop-error-summary`,children:[`⚠ `,n.length,` issue`,n.length===1?``:`s`]}),Ur(e,t,r)]},e.id)});function B({label:e,children:t,error:n}){return(0,I.jsxs)(`div`,{className:`prop-field ${n?`prop-field-error`:``}`,children:[(0,I.jsxs)(`label`,{className:`prop-label`,children:[e,n?(0,I.jsx)(`span`,{className:`prop-field-error-hint`,children:n}):null]}),t]})}function Er({value:e,onChange:t,placeholder:n}){return(0,I.jsx)(dr,{value:e??``,onChange:t,placeholder:n})}function V({value:e,onChange:t,min:n,max:r,unit:i}){return(0,I.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`},children:[(0,I.jsx)(`input`,{type:`number`,value:e??``,onChange:e=>t(e.target.value===``?void 0:Number(e.target.value)),min:n,max:r,style:i?{paddingRight:28}:void 0}),i?(0,I.jsx)(`span`,{style:{position:`absolute`,right:8,fontSize:11,color:`var(--text-muted)`,pointerEvents:`none`},children:i}):null]})}var Dr=[{label:`Small (28px)`,value:28},{label:`Medium (36px)`,value:36},{label:`Large (48px)`,value:48}];function Or({value:e,onChange:t}){let n=e??36,r=Dr.some(e=>e.value===n),[i,a]=(0,C.useState)(!1),o=i||!r;return(0,I.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,I.jsxs)(`select`,{value:o?`custom`:String(n),onChange:e=>{if(e.target.value===`custom`){a(!0);return}a(!1),t(Number(e.target.value))},children:[Dr.map(e=>(0,I.jsx)(`option`,{value:e.value,children:e.label},e.value)),(0,I.jsx)(`option`,{value:`custom`,children:`Custom`})]}),o?(0,I.jsx)(V,{value:n,onChange:e=>t(e??36),min:12,unit:`px`}):null]})}function kr({value:e,onChange:t,options:n}){return(0,I.jsxs)(`select`,{value:e??``,onChange:e=>t(e.target.value||void 0),children:[(0,I.jsx)(`option`,{value:``,children:`Default`}),n.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))]})}var Ar={width:32,height:28,padding:0,border:`none`,cursor:`pointer`,position:`absolute`,opacity:0,top:0,left:0},jr={display:`flex`,alignItems:`center`,gap:6},Mr={width:32,height:28,borderRadius:4,position:`relative`,overflow:`hidden`,cursor:`pointer`},Nr={padding:`2px 6px`,fontSize:10,borderRadius:4,background:`var(--bg-tertiary)`,border:`1px solid var(--border-medium)`,cursor:`pointer`,color:`var(--text-secondary)`},Pr={width:32,height:28,borderRadius:4,position:`relative`,overflow:`hidden`,cursor:`pointer`,background:`repeating-conic-gradient(#d0d0d0 0% 25%, #f0f0f0 0% 50%) 50% / 10px 10px`,border:`1px solid var(--border-medium)`};function H({value:e,onChange:t,fallback:n}){let r=e??n,i=e==null&&n!=null;return(0,I.jsxs)(`div`,{style:jr,children:[(0,I.jsx)(`div`,{style:r?{...Mr,background:r,border:`1px solid var(--border-medium)`,opacity:i?.5:1}:Pr,children:(0,I.jsx)(`input`,{type:`color`,value:r??`#000000`,onChange:e=>t(e.target.value),style:Ar,title:i?`Default: ${n}`:e??`No color (transparent)`})}),e&&!n?(0,I.jsx)(`button`,{onClick:()=>t(void 0),style:Nr,title:`Remove color`,children:`✕`}):null]})}function Fr({value:e,onChange:t,label:n}){return(0,I.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:13,cursor:`pointer`},children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:e??!1,onChange:e=>t(e.target.checked)}),n]})}var Ir={display:`flex`,gap:4,alignItems:`center`},Lr={padding:`4px 6px`,fontSize:10,borderRadius:4,background:`var(--bg-tertiary)`,border:`1px solid var(--border-medium)`,cursor:`pointer`,color:`var(--text-secondary)`,whiteSpace:`nowrap`},Rr={display:`flex`,flexDirection:`column`,gap:4},zr={display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:4},Br={fontSize:10,color:`var(--text-muted)`},Vr={padding:`2px 6px`,fontSize:10,borderRadius:4,background:`var(--bg-tertiary)`,border:`1px solid var(--border-medium)`,cursor:`pointer`,color:`var(--text-secondary)`,alignSelf:`flex-start`};function Hr({value:e,onChange:t}){let[n,r]=(0,C.useState)(typeof e==`object`&&!!e);if(!n)return(0,I.jsxs)(`div`,{style:Ir,children:[(0,I.jsx)(`div`,{style:{flex:1},children:(0,I.jsx)(V,{value:typeof e==`number`?e:void 0,onChange:e=>t(e),min:0,unit:`px`})}),(0,I.jsx)(`button`,{onClick:()=>{r(!0);let n=typeof e==`number`?e:0;t({top:n,right:n,bottom:n,left:n})},style:Lr,title:`Edit each side`,children:`⊞`})]});let i=typeof e==`object`&&e?e:{top:0,right:0,bottom:0,left:0},a=(e,n)=>t({...i,[e]:n??0});return(0,I.jsxs)(`div`,{style:Rr,children:[(0,I.jsxs)(`div`,{style:zr,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Top`}),(0,I.jsx)(V,{value:i.top,onChange:e=>a(`top`,e),min:0,unit:`px`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Right`}),(0,I.jsx)(V,{value:i.right,onChange:e=>a(`right`,e),min:0,unit:`px`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Bottom`}),(0,I.jsx)(V,{value:i.bottom,onChange:e=>a(`bottom`,e),min:0,unit:`px`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Left`}),(0,I.jsx)(V,{value:i.left,onChange:e=>a(`left`,e),min:0,unit:`px`})]})]}),(0,I.jsx)(`button`,{onClick:()=>{r(!1),t(Math.round(((i.top??0)+(i.right??0)+(i.bottom??0)+(i.left??0))/4)||void 0)},style:Vr,children:`Collapse`})]})}function Ur(e,t,n=new Map){let r=e=>n.get(e);switch(e.type){case`text`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Content`,error:r(`content`),children:(0,I.jsx)(dr,{multiline:!0,rows:3,value:e.content,onChange:e=>t({content:e})})}),(0,I.jsx)(B,{label:`Variant`,children:(0,I.jsx)(kr,{value:e.variant,onChange:e=>t({variant:e}),options:[`title`,`heading1`,`heading2`,`heading3`,`heading4`,`body`,`caption1`,`caption2`]})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#2D3436`})}),(0,I.jsx)(B,{label:`Align`,children:(0,I.jsx)(kr,{value:e.align,onChange:e=>t({align:e}),options:[`left`,`center`,`right`,`justify`]})}),(0,I.jsx)(B,{label:`Font Weight`,children:(0,I.jsx)(kr,{value:e.fontWeight,onChange:e=>t({fontWeight:e}),options:[`regular`,`medium`,`bold`]})}),(0,I.jsx)(B,{label:`Max Lines`,children:(0,I.jsx)(V,{value:e.maxLines,onChange:e=>t({maxLines:e}),min:1})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})})]});case`image`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`URL`,error:r(`url`),children:(0,I.jsx)(Er,{value:e.url,onChange:e=>t({url:e}),placeholder:`https://...`})}),e.url&&!e.url.includes(`{{`)?(0,I.jsx)(`div`,{style:{padding:`4px 0`},children:(0,I.jsx)(`img`,{src:e.url,alt:`Preview`,style:{width:`100%`,maxHeight:80,objectFit:`cover`,borderRadius:4,border:`1px solid var(--border-subtle)`},onError:e=>{e.target.style.display=`none`}})}):null,(0,I.jsx)(B,{label:`Alt Text`,children:(0,I.jsx)(Er,{value:e.altText??``,onChange:e=>t({altText:e})})}),(0,I.jsx)(B,{label:`Fit`,children:(0,I.jsx)(kr,{value:e.fit,onChange:e=>t({fit:e}),options:[`cover`,`contain`,`fill`]})}),(0,I.jsx)(B,{label:`Width`,children:(0,I.jsx)(V,{value:typeof e.width==`number`?e.width:void 0,onChange:e=>t({width:e}),unit:`px`})}),(0,I.jsx)(B,{label:`Height`,children:(0,I.jsx)(V,{value:typeof e.height==`number`?e.height:void 0,onChange:e=>t({height:e}),unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})})]});case`icon`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Name`,error:r(`name`),children:(0,I.jsx)(br,{value:e.name,onChange:e=>t({name:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#666666`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(V,{value:e.padding,onChange:e=>t({padding:e}),min:0,unit:`px`})})]});case`avatar`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Image URL`,children:(0,I.jsx)(Er,{value:e.imageUrl??``,onChange:e=>t({imageUrl:e})})}),(0,I.jsx)(B,{label:`Fallback Initials`,children:(0,I.jsx)(Er,{value:e.fallbackInitials??``,onChange:e=>t({fallbackInitials:e.slice(0,2)})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(Or,{value:e.size,onChange:e=>t({size:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Weight`,children:(0,I.jsx)(kr,{value:e.fontWeight,onChange:e=>t({fontWeight:e}),options:[`regular`,`medium`,`bold`]})})]});case`badge`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Text`,error:r(`text`),children:(0,I.jsx)(Er,{value:e.text,onChange:e=>t({text:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#FFFFFF`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:n=>{let r={borderWidth:n};n&&!e.borderColor&&(r.borderColor=`#000000`),t(r)},min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})})]});case`divider`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#e0e0e0`})}),(0,I.jsx)(B,{label:`Thickness`,children:(0,I.jsx)(V,{value:e.thickness,onChange:e=>t({thickness:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Margin`,children:(0,I.jsx)(V,{value:e.margin,onChange:e=>t({margin:e}),min:0,unit:`px`})})]});case`spacer`:return(0,I.jsx)(`div`,{className:`prop-group`,children:(0,I.jsx)(B,{label:`Height`,error:r(`height`),children:(0,I.jsx)(V,{value:e.height,onChange:e=>t({height:e??16}),min:0,unit:`px`})})});case`chip`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Text`,error:r(`text`),children:(0,I.jsx)(Er,{value:e.text,onChange:e=>t({text:e})})}),(0,I.jsx)(B,{label:`Icon`,children:(0,I.jsx)(br,{value:e.icon??``,onChange:e=>t({icon:e})})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#333333`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:n=>{let r={borderWidth:n};n&&!e.borderColor&&(r.borderColor=`#000000`),t(r)},min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})})]});case`progressBar`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Value (0-100)`,error:r(`value`),children:(0,I.jsx)(V,{value:e.value,onChange:e=>t({value:e??0}),min:0,max:100})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#6C5CE7`})}),(0,I.jsx)(B,{label:`Track Color`,children:(0,I.jsx)(H,{value:e.trackColor,onChange:e=>t({trackColor:e}),fallback:`#e0e0e0`})}),(0,I.jsx)(B,{label:`Height`,children:(0,I.jsx)(V,{value:e.height,onChange:e=>t({height:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Label`,children:(0,I.jsx)(Er,{value:e.label??``,onChange:e=>t({label:e})})}),(0,I.jsx)(B,{label:`Label Font Size`,children:(0,I.jsx)(V,{value:e.labelFontSize,onChange:e=>t({labelFontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Label Color`,children:(0,I.jsx)(H,{value:e.labelColor,onChange:e=>t({labelColor:e}),fallback:`#666666`})})]});case`button`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Label`,error:r(`label`),children:(0,I.jsx)(Er,{value:e.label,onChange:e=>t({label:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.textColor,onChange:e=>t({textColor:e}),fallback:`#FFFFFF`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:n=>{let r={borderWidth:n};n&&!e.borderColor&&(r.borderColor=`#000000`),t(r)},min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Icon`,children:(0,I.jsx)(br,{value:e.icon??``,onChange:e=>t({icon:e})})}),(0,I.jsx)(B,{label:`Icon Position`,children:(0,I.jsx)(kr,{value:e.iconPosition,onChange:e=>t({iconPosition:e}),options:[`left`,`right`]})}),(0,I.jsx)(Fr,{value:e.fullWidth,onChange:e=>t({fullWidth:e}),label:`Full Width`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Action`}),(0,I.jsx)(mr,{action:e.action,onChange:e=>t({action:e})})]});case`iconButton`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Icon`,error:r(`icon`),children:(0,I.jsx)(br,{value:e.icon,onChange:e=>t({icon:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#333333`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Action`}),(0,I.jsx)(mr,{action:e.action,onChange:e=>t({action:e})})]});case`link`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Text`,error:r(`text`),children:(0,I.jsx)(Er,{value:e.text,onChange:e=>t({text:e})})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#6C5CE7`})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(Fr,{value:e.underline,onChange:e=>t({underline:e}),label:`Underline`}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Action`}),(0,I.jsx)(mr,{action:e.action,onChange:e=>t({action:e})})]});case`table`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Columns (comma-separated)`,error:r(`columns`),children:(0,I.jsx)(Er,{value:e.columns.join(`, `),onChange:e=>t({columns:e.split(`,`).map(e=>e.trim())})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Rows`}),e.rows.map((n,r)=>(0,I.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`center`,marginBottom:4},children:[(0,I.jsx)(`input`,{defaultValue:n.join(`, `),onBlur:n=>{let i=[...e.rows];i[r]=n.target.value.split(`,`).map(e=>e.trim()),t({rows:i})},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},style:{flex:1},placeholder:e.columns.join(`, `)}),(0,I.jsx)(`button`,{style:{width:24,height:24,borderRadius:4,fontSize:12,color:`var(--text-tertiary)`,flexShrink:0},onClick:()=>t({rows:e.rows.filter((e,t)=>t!==r)}),title:`Remove row`,children:`×`})]},r)),(0,I.jsx)(`button`,{style:{fontSize:11,color:`var(--accent-primary)`,padding:`4px 0`,background:`none`,border:`none`,cursor:`pointer`},onClick:()=>t({rows:[...e.rows,e.columns.map(()=>``)]}),children:`+ Add Row`}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Header Background`,children:(0,I.jsx)(H,{value:e.headerBackgroundColor,onChange:e=>t({headerBackgroundColor:e})})}),(0,I.jsx)(Fr,{value:e.border,onChange:e=>t({border:e}),label:`Show Borders`}),(0,I.jsx)(Fr,{value:e.stripedRows,onChange:e=>t({stripedRows:e}),label:`Striped Rows`}),(0,I.jsx)(B,{label:`Cell Padding`,children:(0,I.jsx)(V,{value:e.cellPadding,onChange:e=>t({cellPadding:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Striped Row Color`,children:(0,I.jsx)(H,{value:e.stripedRowColor,onChange:e=>t({stripedRowColor:e})})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})})]});case`row`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Layout`}),(0,I.jsx)(B,{label:`Gap`,children:(0,I.jsx)(V,{value:e.gap,onChange:e=>t({gap:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Align`,children:(0,I.jsx)(kr,{value:e.align,onChange:e=>t({align:e}),options:[`start`,`center`,`end`,`spaceBetween`,`spaceAround`]})}),(0,I.jsx)(Fr,{value:e.wrap,onChange:e=>t({wrap:e}),label:`Wrap`}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Scrollable`}),(0,I.jsx)(Fr,{value:e.scrollable,onChange:e=>t({scrollable:e}),label:`Scrollable (Carousel)`}),e.scrollable?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(B,{label:`Peek`,children:(0,I.jsx)(V,{value:e.peek,onChange:e=>t({peek:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Snap`,children:(0,I.jsx)(kr,{value:e.snap,onChange:e=>t({snap:e}),options:[`item`,`free`]})})]}):null,(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Spacing`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:e=>t({borderWidth:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,marginTop:4},children:[e.items.length,` child element`,e.items.length===1?``:`s`]})]});case`column`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Layout`}),(0,I.jsx)(B,{label:`Gap`,children:(0,I.jsx)(V,{value:e.gap,onChange:e=>t({gap:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Align`,children:(0,I.jsx)(kr,{value:e.align,onChange:e=>t({align:e}),options:[`start`,`center`,`end`,`stretch`]})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Spacing`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:e=>t({borderWidth:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,marginTop:4},children:[e.items.length,` child element`,e.items.length===1?``:`s`]})]});case`grid`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Layout`}),(0,I.jsx)(B,{label:`Columns`,children:(0,I.jsx)(kr,{value:String(e.columns??2),onChange:e=>t({columns:Number(e)}),options:[`2`,`3`,`4`]})}),(0,I.jsx)(B,{label:`Gap`,children:(0,I.jsx)(V,{value:e.gap,onChange:e=>t({gap:e}),min:0,unit:`px`})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Spacing`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:e=>t({borderWidth:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,marginTop:4},children:[e.items.length,` child element`,e.items.length===1?``:`s`]})]});case`accordion`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Header`,error:r(`header`),children:(0,I.jsx)(Er,{value:e.header,onChange:e=>t({header:e})})}),(0,I.jsx)(B,{label:`Header Icon`,children:(0,I.jsx)(br,{value:e.headerIcon??``,onChange:e=>t({headerIcon:e})})}),(0,I.jsx)(Fr,{value:e.expandedByDefault,onChange:e=>t({expandedByDefault:e}),label:`Expanded by Default`}),(0,I.jsx)(Fr,{value:e.border,onChange:e=>t({border:e}),label:`Show Border`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Weight`,children:(0,I.jsx)(kr,{value:e.fontWeight,onChange:e=>t({fontWeight:e}),options:[`regular`,`medium`,`bold`]})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})})]});case`tabs`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Tab Labels (comma-separated)`,children:(0,I.jsx)(Er,{value:e.tabs.map(e=>e.label).join(`, `),onChange:n=>{t({tabs:n.split(`,`).map(e=>e.trim()).map((t,n)=>({label:t,content:e.tabs[n]?.content??[]}))})}})}),(0,I.jsx)(B,{label:`Active Tab`,children:(0,I.jsx)(`select`,{value:e.defaultActiveTab??0,onChange:e=>t({defaultActiveTab:Number(e.target.value)}),children:e.tabs.map((e,t)=>(0,I.jsx)(`option`,{value:t,children:e.label},t))})}),(0,I.jsx)(B,{label:`Tab Align`,children:(0,I.jsx)(kr,{value:e.tabAlign,onChange:e=>t({tabAlign:e}),options:[`start`,`center`,`stretch`]})}),(0,I.jsx)(B,{label:`Tab Padding`,children:(0,I.jsx)(Hr,{value:e.tabPadding,onChange:e=>t({tabPadding:e})})}),(0,I.jsx)(B,{label:`Content Padding`,children:(0,I.jsx)(Hr,{value:e.contentPadding,onChange:e=>t({contentPadding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})})]});case`codeBlock`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Content`,error:r(`content`),children:(0,I.jsx)(dr,{multiline:!0,rows:4,value:e.content,onChange:e=>t({content:e}),style:{fontFamily:`monospace`}})}),(0,I.jsx)(B,{label:`Language`,children:(0,I.jsx)(Er,{value:e.language??``,onChange:e=>t({language:e})})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.textColor,onChange:e=>t({textColor:e})})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Language Label Size`,children:(0,I.jsx)(V,{value:e.languageLabelFontSize,onChange:e=>t({languageLabelFontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Language Label Color`,children:(0,I.jsx)(H,{value:e.languageLabelColor,onChange:e=>t({languageLabelColor:e})})})]});case`markdown`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Content`,error:r(`content`),children:(0,I.jsx)(dr,{multiline:!0,rows:4,value:e.content,onChange:e=>t({content:e})})}),(0,I.jsx)(B,{label:`Base Font Size`,children:(0,I.jsx)(V,{value:e.baseFontSize,onChange:e=>t({baseFontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e})})}),(0,I.jsx)(B,{label:`Line Height`,children:(0,I.jsx)(V,{value:e.lineHeight,onChange:e=>t({lineHeight:e}),min:0})}),(0,I.jsx)(B,{label:`Link Color`,children:(0,I.jsx)(H,{value:e.linkColor,onChange:e=>t({linkColor:e})})})]});default:return(0,I.jsx)(`div`,{className:`rp-empty`,children:`No properties for this element type`})}}var Wr=(0,C.memo)(function(){let e=F(e=>e.settings),t=F(e=>e.updateSettings),n=F(e=>e.fallbackText),r=F(e=>e.setFallbackText);return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`prop-badge`,children:`BUBBLE`}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Background`}),(0,I.jsx)(`div`,{className:`prop-field`,children:(0,I.jsx)(`input`,{type:`color`,value:e.background??`#E8E8E8`,onChange:e=>t({background:e.target.value}),style:{width:32,height:28,padding:0,border:`none`}})})]}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Border & Shape`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Border Radius (px)`}),(0,I.jsx)(`input`,{type:`number`,value:e.borderRadius??``,onChange:e=>t({borderRadius:e.target.value?Number(e.target.value):void 0}),min:0})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Border Width`}),(0,I.jsx)(`input`,{type:`number`,value:e.borderWidth??``,onChange:e=>t({borderWidth:e.target.value?Number(e.target.value):void 0}),min:0})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Border Color`}),(0,I.jsx)(`input`,{type:`color`,value:e.borderColor??`#DFE6E9`,onChange:e=>t({borderColor:e.target.value}),style:{width:32,height:28,padding:0,border:`none`}})]})]}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Spacing`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Padding`}),(0,I.jsx)(`input`,{type:`number`,value:typeof e.padding==`number`?e.padding:``,onChange:e=>t({padding:e.target.value?Number(e.target.value):void 0}),min:0})]})]}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Text`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Fallback Text (required)`}),(0,I.jsx)(dr,{multiline:!0,rows:3,value:n,onChange:r,placeholder:`Plain text for older UI Kit versions`})]})]})]})}),Gr=(0,C.memo)(function(){let e=F(e=>e.notificationTitle),t=F(e=>e.notificationBody),n=F(e=>e.notificationData),r=F(e=>e.setNotificationTitle),i=F(e=>e.setNotificationBody),a=F(e=>e.setNotificationData),o=k.notification?.enableData,s=(0,C.useCallback)(()=>{a([...n,{key:``,value:``}])},[n,a]),c=(0,C.useCallback)((e,t,r)=>{a(n.map((n,i)=>i===e?{...n,[t]:r}:n))},[n,a]),l=(0,C.useCallback)(e=>{a(n.filter((t,n)=>n!==e))},[n,a]);return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`prop-badge`,children:`NOTIFICATION`}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Push Notification Content`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Title`}),(0,I.jsx)(dr,{value:e,onChange:r,placeholder:`Notification title...`})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Body`}),(0,I.jsx)(dr,{value:t,onChange:i,placeholder:`Notification body...`,multiline:!0,rows:3})]})]}),o&&(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginBottom:0},children:`Data`}),(0,I.jsx)(`button`,{onClick:s,className:`prop-label`,style:{fontWeight:600,color:`var(--accent-primary)`,background:`var(--accent-light)`,border:`1px solid var(--border-accent)`,borderRadius:6,padding:`4px 10px`,cursor:`pointer`},children:`Add +`})]}),n.length===0?(0,I.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`8px 0`},children:`No data entries. Click "Add +" to add key-value pairs.`}):n.map((e,t)=>(0,I.jsxs)(`div`,{style:{border:`1px solid var(--border-subtle)`,borderRadius:6,padding:10,marginBottom:6},children:[(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,I.jsxs)(`span`,{className:`prop-label`,style:{fontWeight:600,marginBottom:0},children:[`Data `,t+1]}),(0,I.jsx)(`button`,{onClick:()=>l(t),title:`Remove`,style:{color:`var(--text-secondary)`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,I.jsx)(`path`,{d:`M8.5 2A2.5 2.5 0 0 0 6 4.5V6h2V4.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5V6h2V4.5A2.5 2.5 0 0 0 15.5 2h-7ZM13 18v-6h2v6h-2ZM9 12v6h2v-6H9Z`}),(0,I.jsx)(`path`,{fillRule:`evenodd`,d:`M4 7.5h16v.016h2v2h-2V19.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 4 19.5V9.516H2v-2h2V7.5Zm14 2.016H6V19.5a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5V9.516Z`,clipRule:`evenodd`})]})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Key`}),(0,I.jsx)(`input`,{value:e.key,onChange:e=>c(t,`key`,e.target.value),placeholder:`Up to 10 characters`,maxLength:10})]}),(0,I.jsxs)(`div`,{className:`prop-field`,style:{marginBottom:0},children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Value (optional)`}),(0,I.jsx)(`input`,{value:e.value,onChange:e=>c(t,`value`,e.target.value),placeholder:`Up to 50 characters`,maxLength:50})]})]},t))]}),(0,I.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`8px 12px`,lineHeight:1.5},children:`The notification preview is shown in the canvas area. Edit the title and body here to see it update in real-time.`})]})}),Kr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function qr(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Jr(e){return`nodeType`in e}function Yr(e){return e?qr(e)?e:Jr(e)?e.ownerDocument?.defaultView??window:window:window}function Xr(e){let{Document:t}=Yr(e);return e instanceof t}function Zr(e){return qr(e)?!1:e instanceof Yr(e).HTMLElement}function Qr(e){return e instanceof Yr(e).SVGElement}function $r(e){return e?qr(e)?e.document:Jr(e)?Xr(e)?e:Zr(e)||Qr(e)?e.ownerDocument:document:document:document}var ei=Kr?C.useLayoutEffect:C.useEffect;function ti(e){let t=(0,C.useRef)(e);return ei(()=>{t.current=e}),(0,C.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function ni(){let e=(0,C.useRef)(null);return[(0,C.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,C.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function ri(e,t){t===void 0&&(t=[e]);let n=(0,C.useRef)(e);return ei(()=>{n.current!==e&&(n.current=e)},t),n}function ii(e,t){let n=(0,C.useRef)();return(0,C.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function ai(e){let t=ti(e),n=(0,C.useRef)(null);return[n,(0,C.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function oi(e){let t=(0,C.useRef)();return(0,C.useEffect)(()=>{t.current=e},[e]),t.current}var si={};function ci(e,t){return(0,C.useMemo)(()=>{if(t)return t;let n=si[e]==null?0:si[e]+1;return si[e]=n,e+`-`+n},[e,t])}function li(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var ui=li(1),di=li(-1);function fi(e){return`clientX`in e&&`clientY`in e}function pi(e){if(!e)return!1;let{KeyboardEvent:t}=Yr(e.target);return t&&e instanceof t}function mi(e){if(!e)return!1;let{TouchEvent:t}=Yr(e.target);return t&&e instanceof t}function hi(e){if(mi(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return fi(e)?{x:e.clientX,y:e.clientY}:null}var gi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[gi.Translate.toString(e),gi.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),_i=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function vi(e){return e.matches(_i)?e:e.querySelector(_i)}var yi={display:`none`};function bi(e){let{id:t,value:n}=e;return C.createElement(`div`,{id:t,style:yi},n)}function xi(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return C.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Si(){let[e,t]=(0,C.useState)(``);return{announce:(0,C.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Ci=(0,C.createContext)(null);function wi(e){let t=(0,C.useContext)(Ci);(0,C.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ti(){let[e]=(0,C.useState)(()=>new Set),t=(0,C.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,C.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Ei={draggable:`
16
+ deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Et=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Dt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Fe(),n=L(),r=Oe(),i=R();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Ot=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ve(),n=Fe(),r=R(),i=Dt();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),kt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Fe(),n=L(),r=R(),i=R();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),At=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=R();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),jt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Fe().validateUnion,error:{message:`must match a schema in anyOf`}}})),Mt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Nt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=R();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Pt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=R(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Ft=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=R();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),It=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=bt(),n=St(),r=xt(),i=Ct(),a=wt(),o=Tt(),s=Et(),c=Dt(),l=Ot(),u=kt(),d=At(),f=jt(),p=Mt(),m=Nt(),h=Pt(),g=Ft();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),Lt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Rt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[Lt().default]})),zt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Bt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=ot(),n=yt(),r=It(),i=Rt(),a=zt();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),Vt=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),Ht=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=L(),n=Vt(),r=We(),i=Ue(),a=R();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),Ut=l({$id:()=>Gt,$schema:()=>Wt,default:()=>Xt,definitions:()=>qt,properties:()=>Yt,title:()=>Kt,type:()=>Jt}),Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt=s((()=>{Wt=`http://json-schema.org/draft-07/schema#`,Gt=`http://json-schema.org/draft-07/schema#`,Kt=`Core schema meta-schema`,qt={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},Jt=[`object`,`boolean`],Yt={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},Xt={$schema:Wt,$id:Gt,title:Kt,definitions:qt,type:Jt,properties:Yt,default:!0}})),Qt=c(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=rt(),r=Bt(),i=Ht(),a=(Zt(),f(Ut).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=Ve();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=L();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var d=He();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var p=Ue();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})})),$t=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:ee,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var T=/[^\\]\\Z/;function ee(e){if(T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),en=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;var t=Qt(),n=L(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),tn=c(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=$t(),r=en(),i=L(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s})),nn=d(Qt(),1);(0,d(tn(),1).default)(new nn.default({allErrors:!0,strict:!1}));function rn(e){let t=[];e.version!==`1.0`&&t.push({path:`version`,message:`Version must be "1.0"`}),(!e.body||e.body.length===0)&&t.push({path:`body`,message:`Body must have at least one element`}),(!e.fallbackText||e.fallbackText.trim()===``)&&t.push({path:`fallbackText`,message:`Fallback text is required`});let n=new Set;return e.body?.forEach((e,r)=>sn(e,`body[${r}]`,t,n)),t}var an=new Set([`variant`,`align`,`fontWeight`,`fit`,`layout`,`iconPosition`,`snap`,`tabAlign`,`openIn`,`method`,`callType`]),on=new Set([`text`,`image`,`icon`,`avatar`,`badge`,`divider`,`spacer`,`chip`,`progressBar`,`codeBlock`,`markdown`,`row`,`column`,`grid`,`accordion`,`tabs`,`button`,`iconButton`,`link`,`table`]);function sn(e,t,n,r){if(!e.type){n.push({path:t,message:`Element missing "type"`});return}if(!on.has(e.type)){n.push({path:t,message:`Unknown element type "${e.type}" — not supported in current schema`});return}!e.id||typeof e.id!=`string`?n.push({path:t,message:`Element missing "id"`}):r.has(e.id)?n.push({path:t,message:`Duplicate id "${e.id}"`}):r.add(e.id);for(let[r,i]of Object.entries(e))i===``&&an.has(r)&&n.push({path:`${t}.${r}`,message:`"${r}" must not be an empty string — omit it or use a valid value`});switch(e.type){case`text`:e.content||n.push({path:t,message:`Text element requires "content"`});break;case`image`:e.url||n.push({path:t,message:`Image element requires "url"`});break;case`icon`:e.name||n.push({path:t,message:`Icon element requires "name"`});break;case`spacer`:e.height??n.push({path:t,message:`Spacer requires "height"`});break;case`button`:e.label||n.push({path:t,message:`Button requires "label"`}),e.action||n.push({path:t,message:`Button requires "action"`});break;case`iconButton`:e.icon||n.push({path:t,message:`IconButton requires "icon"`}),e.action||n.push({path:t,message:`IconButton requires "action"`});break;case`link`:e.text||n.push({path:t,message:`Link requires "text"`}),e.action||n.push({path:t,message:`Link requires "action"`});break;case`badge`:case`chip`:e.text||n.push({path:t,message:`${e.type} requires "text"`});break;case`table`:e.columns||n.push({path:t,message:`Table requires "columns"`}),e.rows||n.push({path:t,message:`Table requires "rows"`});break}let i=e.items??e.body;Array.isArray(i)&&(i.length===0&&(e.type===`row`||e.type===`column`||e.type===`grid`||e.type===`accordion`)&&n.push({path:t,message:`${e.type} must have at least one child element`}),i.forEach((e,i)=>sn(e,`${t}.items[${i}]`,n,r))),e.type===`tabs`&&Array.isArray(e.tabs)&&e.tabs.forEach((e,i)=>{(!e.content||e.content.length===0)&&n.push({path:`${t}.tabs[${i}]`,message:`Tab "${e.label}" must have at least one element`}),e.content?.forEach((e,a)=>sn(e,`${t}.tabs[${i}].content[${a}]`,n,r))})}var cn={position:`fixed`,inset:0,background:`rgba(0,0,0,0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3},ln={background:`#fff`,border:`1px solid #E9EAEB`,borderRadius:12,boxShadow:`0 10px 25px rgba(0,0,0,0.1)`,padding:24,width:400,maxWidth:`90vw`},un={fontSize:16,fontWeight:700,marginBottom:16,color:`#141414`},dn={display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},fn=(0,C.memo)(function({title:e,onClose:t,children:n,footer:r,width:i,style:a}){return(0,I.jsx)(`div`,{style:cn,onClick:t,children:(0,I.jsxs)(`div`,{style:(0,C.useMemo)(()=>({...ln,...i?{width:i}:void 0,...a}),[i,a]),onClick:e=>e.stopPropagation(),children:[(0,I.jsx)(`div`,{style:un,children:e}),n,r?(0,I.jsx)(`div`,{style:dn,children:r}):null]})})}),pn=/\s+/g,mn=(0,C.memo)(function(){let e=F(e=>e.templateName),t=F(e=>e.setTemplateName),n=F(e=>e.setView),r=F(e=>e.getBubbleJSON),i=F(e=>e.isDirty),a=F(e=>e.undo),o=F(e=>e.redo),s=F(e=>e.canUndo),c=F(e=>e.canRedo),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(!1),[p,m]=(0,C.useState)(!1),h=(0,C.useMemo)(()=>{try{return rn(r())}catch{return[]}},[F(e=>e.body),r]),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(!1),[b,x]=(0,C.useState)(!1),[S,w]=(0,C.useState)(!1),T=F(e=>e.showTemplatePicker),ee=F(e=>e.setShowTemplatePicker),te=(0,C.useRef)(null),E=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!b&&!S)return;let e=e=>{b&&te.current&&!te.current.contains(e.target)&&x(!1),S&&E.current&&!E.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[b,S]);let D=(0,C.useCallback)(e=>{u(e),setTimeout(()=>u(null),2500)},[]),O=(0,C.useCallback)(()=>{let e=r({stripEmpty:!0}),t=rn(e);navigator.clipboard.writeText(JSON.stringify(e,null,2)),D(t.length>0?`Copied (${t.length} issue${t.length===1?``:`s`})`:`JSON copied`)},[r,D]),ne=(0,C.useCallback)(()=>{let t=r({stripEmpty:!0}),n=rn(t),i=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${e.replace(pn,`-`).toLowerCase()}.json`,o.click(),URL.revokeObjectURL(a),D(n.length>0?`Downloaded (${n.length} issue${n.length===1?``:`s`})`:`Downloaded`)},[r,e,D]),k=(0,C.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`.json`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{let e=await t.text(),n=JSON.parse(e);F.getState().loadBubble(n,void 0,t.name.replace(`.json`,``));let r=rn(n);D(r.length>0?`Imported (${r.length} issue${r.length===1?``:`s`})`:`Imported`)}catch{D(`Invalid JSON file`)}},e.click()},[D]),re=(0,C.useCallback)(async()=>{try{let e=await navigator.clipboard.readText(),t=JSON.parse(e);F.getState().loadBubble(t,void 0,`Pasted Bubble`);let n=rn(t);D(n.length>0?`Imported (${n.length} issue${n.length===1?``:`s`})`:`Imported from clipboard`)}catch{D(`No valid JSON in clipboard`)}},[D]),ie=(0,C.useCallback)(async()=>{let e=F.getState();if(e.templateName&&e.templateName!==`Untitled Bubble`)try{await e.saveTemplate(),D(`Template saved`)}catch(e){D(e instanceof Error?e.message:`Failed to save`)}else m(!0)},[D]),ae=(0,C.useCallback)(()=>{let e=rn(r({stripEmpty:!0}));if(e.length>0){D(`Fix ${e.length} issue${e.length===1?``:`s`} before sending`);return}y(!0)},[r,D]);return(0,I.jsxs)(`div`,{className:`topbar`,children:[(0,I.jsxs)(`div`,{className:`topbar-left`,children:[(0,I.jsx)(`button`,{className:`topbar-back`,onClick:()=>n(`library`),"aria-label":`Back to library`,children:`←`}),(0,I.jsxs)(`div`,{className:`topbar-logo`,children:[(0,I.jsx)(`div`,{className:`topbar-logo-icon`,children:`CC`}),(0,I.jsx)(`span`,{children:`cometchat`})]}),(0,I.jsx)(`span`,{className:`topbar-sep`}),(0,I.jsx)(`input`,{className:`topbar-name`,value:e,onChange:e=>t(e.target.value),"aria-label":`Template name`}),i?(0,I.jsx)(`span`,{className:`topbar-dirty`,title:`Unsaved changes`,children:`●`}):null,(0,I.jsx)(`span`,{className:`topbar-sep`}),(0,I.jsx)(`button`,{className:`topbar-btn-icon`,onClick:a,disabled:!s(),title:`Undo (⌘Z)`,children:`↩`}),(0,I.jsx)(`button`,{className:`topbar-btn-icon`,onClick:o,disabled:!c(),title:`Redo (⌘⇧Z)`,children:`↪`})]}),(0,I.jsxs)(`div`,{className:`topbar-right`,children:[h.length>0?(0,I.jsxs)(`div`,{style:{position:`relative`},children:[(0,I.jsxs)(`button`,{className:`topbar-btn topbar-btn-warn`,onClick:()=>f(!d),children:[`⚠ `,h.length,` issue`,h.length===1?``:`s`]}),d?(0,I.jsx)(`div`,{className:`topbar-errors`,children:h.map((e,t)=>(0,I.jsxs)(`div`,{className:`topbar-error-item`,children:[(0,I.jsx)(`span`,{className:`topbar-error-path`,children:e.path}),(0,I.jsx)(`span`,{children:e.message})]},t))}):null]}):null,(0,I.jsxs)(`div`,{className:`topbar-dropdown`,ref:te,children:[(0,I.jsx)(Se,{variant:`secondary`,onClick:()=>{x(!b),w(!1)},children:`Import ▾`}),b?(0,I.jsxs)(`div`,{className:`topbar-dropdown-menu`,children:[(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{k(),x(!1)},children:`From File`}),(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{re(),x(!1)},children:`From Clipboard`}),(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{ee(!0),x(!1)},children:`From Saved Template`})]}):null]}),(0,I.jsx)(Se,{variant:`secondary`,onClick:()=>_(!0),children:`Clear`}),(0,I.jsxs)(`div`,{className:`topbar-dropdown`,ref:E,children:[(0,I.jsx)(Se,{variant:`secondary`,onClick:()=>{w(!S),x(!1)},children:`Export ▾`}),S?(0,I.jsxs)(`div`,{className:`topbar-dropdown-menu`,children:[(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{O(),w(!1)},children:`Copy to Clipboard`}),(0,I.jsx)(`button`,{className:`topbar-dropdown-item`,onClick:()=>{ne(),w(!1)},children:`Download as File`})]}):null]}),(0,I.jsx)(Se,{variant:`secondary`,onClick:ie,children:`Save`}),(0,I.jsx)(Se,{variant:`primary`,onClick:ae,children:`Send`})]}),l?(0,I.jsx)(`div`,{className:`topbar-toast`,children:l}):null,p?(0,I.jsx)(hn,{onClose:()=>m(!1),onSaved:()=>{m(!1),D(`Template saved`)}}):null,v?(0,I.jsx)(gn,{onClose:()=>y(!1),onSent:()=>{y(!1),D(`Message sent`)}}):null,T?(0,I.jsx)(vn,{onClose:()=>ee(!1),onLoaded:()=>{ee(!1),D(`Template loaded`)}}):null,g?(0,I.jsx)(fn,{title:`Clear all elements?`,onClose:()=>_(!1),footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Se,{onClick:()=>_(!1),children:`Cancel`}),(0,I.jsx)(Se,{variant:`danger`,onClick:()=>{F.getState().clearAll(),_(!1)},children:`Clear All`})]}),children:(0,I.jsx)(`p`,{style:{fontSize:13,color:`var(--text-secondary)`,margin:`0 0 16px`},children:`This will remove all elements from the bubble. You can undo this with ⌘Z.`})}):null]})}),hn=(0,C.memo)(function({onClose:e,onSaved:t}){let n=F(e=>e.templateName),r=F(e=>e.templateDescription),i=F(e=>e.setTemplateName),a=F(e=>e.setTemplateDescription),o=F(e=>e.saveTemplate),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(null);return(0,I.jsxs)(fn,{title:`Save Template`,onClose:e,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Se,{onClick:e,children:`Cancel`}),(0,I.jsx)(Se,{variant:`primary`,onClick:async()=>{if(n.trim()){c(!0),u(null);try{await o(),t()}catch(e){u(e instanceof Error?e.message:`Failed to save`)}finally{c(!1)}}},disabled:s,children:s?`Saving...`:`Save`})]}),children:[(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:`Name *`}),(0,I.jsx)(`input`,{value:n,onChange:e=>i(e.target.value),placeholder:`Template name`})]}),(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:`Description`}),(0,I.jsx)(`textarea`,{rows:3,value:r,onChange:e=>a(e.target.value),placeholder:`Optional description`})]}),l?(0,I.jsx)(`div`,{style:{color:`#DC2626`,fontSize:12,marginBottom:8},children:l}):null]})}),gn=(0,C.memo)(function({onClose:e,onSent:t}){let[n,r]=(0,C.useState)(``),i=F(e=>e.getBubbleJSON)(),a=_n(JSON.stringify(i)),[o,s]=(0,C.useState)({});return(0,I.jsxs)(fn,{title:`Send Message`,onClose:e,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Se,{onClick:e,children:`Cancel`}),(0,I.jsx)(Se,{variant:`primary`,onClick:()=>{n.trim()&&t()},children:`Send`})]}),children:[(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:`User UID or Conversation ID *`}),(0,I.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`user-123`})]}),a.length>0?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`modal-subtitle`,children:`Placeholder Values`}),a.map(e=>(0,I.jsxs)(`div`,{className:`modal-field`,children:[(0,I.jsx)(`label`,{className:`modal-label`,children:e}),(0,I.jsx)(`input`,{value:o[e]??``,onChange:t=>s({...o,[e]:t.target.value}),placeholder:`Value for ${e}`})]},e))]}):null]})});function _n(e){let t=e.match(/\{\{(?!theme\.)[^}]+\}\}/g);return t?[...new Set(t.map(e=>e.replace(/^\{\{|\}\}$/g,``)))]:[]}var vn=(0,C.memo)(function({onClose:e,onLoaded:t}){let n=F(e=>e.templates),r=F(e=>e.templatesLoading),i=F(e=>e.templatesMeta),a=F(e=>e.fetchTemplates),o=F(e=>e.fetchNextPage),s=F(e=>e.fetchPrevPage),c=F(e=>e.loadBubble),[l,u]=(0,C.useState)(``);(0,C.useState)(()=>{a()});let d=e=>{u(e),a(e||void 0)};return(0,I.jsxs)(fn,{title:`Load Saved Template`,onClose:e,width:500,style:{maxHeight:`70vh`,display:`flex`,flexDirection:`column`},footer:(0,I.jsx)(Se,{onClick:e,children:`Cancel`}),children:[(0,I.jsx)(`input`,{value:l,onChange:e=>d(e.target.value),placeholder:`Search templates...`,style:{marginBottom:12}}),(0,I.jsx)(`div`,{style:{flex:1,overflowY:`auto`,minHeight:0},children:r&&n.length===0?(0,I.jsx)(`div`,{style:{textAlign:`center`,padding:24,color:`var(--text-tertiary)`,fontSize:13},children:`Loading...`}):n.length===0?(0,I.jsx)(`div`,{style:{textAlign:`center`,padding:24,color:`var(--text-tertiary)`,fontSize:13},children:`No saved templates`}):(0,I.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:n.map(e=>(0,I.jsxs)(`button`,{onClick:()=>{c(e.bubbleData,e.id,e.name,e.description),t()},style:{display:`flex`,flexDirection:`column`,gap:2,padding:`10px 12px`,background:`var(--bg-secondary)`,border:`1px solid var(--border-subtle)`,borderRadius:`var(--radius-sm)`,textAlign:`left`,cursor:`pointer`,transition:`all 0.15s`,width:`100%`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`var(--border-accent)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`var(--border-subtle)`},children:[(0,I.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:`var(--text-primary)`},children:e.name}),e.description?(0,I.jsx)(`span`,{style:{fontSize:11,color:`var(--text-secondary)`},children:e.description}):null,(0,I.jsx)(`span`,{style:{fontSize:10,color:`var(--text-tertiary)`},children:new Date(e.updatedAt*1e3).toLocaleDateString()})]},e.id))})}),i?.previous||i?.next?(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0 0`},children:[(0,I.jsx)(Se,{variant:`link`,onClick:s,disabled:!i?.previous||r,children:`‹ Previous`}),(0,I.jsx)(Se,{variant:`link`,onClick:o,disabled:!i?.next||r,children:`Next ›`})]}):null]})}),yn=new Map([[`text`,()=>({id:O(`text`),type:`text`,content:`Text content`,variant:`body`,color:`#2D3436`,align:`left`,fontWeight:`regular`})],[`image`,()=>({id:O(`image`),type:`image`,url:``,altText:``,fit:`cover`})],[`icon`,()=>({id:O(`icon`),type:`icon`,name:`https://assets.cc-cluster-2.io/bubble-builder/account_circle.png`,size:20,color:`#666666`,borderRadius:0,padding:4})],[`avatar`,()=>({id:O(`avatar`),type:`avatar`,size:36,borderRadius:18,backgroundColor:`#6C5CE7`,fontSize:14,fontWeight:`regular`})],[`badge`,()=>({id:O(`badge`),type:`badge`,text:`Badge`,color:`#FFFFFF`,backgroundColor:`#6C5CE7`,size:24,borderRadius:12,padding:6,fontSize:12})],[`divider`,()=>({id:O(`divider`),type:`divider`,color:`#e0e0e0`,thickness:1,margin:8})],[`spacer`,()=>({id:O(`spacer`),type:`spacer`,height:16})],[`chip`,()=>({id:O(`chip`),type:`chip`,text:`Chip`,color:`#333333`,backgroundColor:`#e0e0e0`,borderRadius:16,padding:4,fontSize:12})],[`progressBar`,()=>({id:O(`progressBar`),type:`progressBar`,value:50,color:`#6C5CE7`,trackColor:`#e0e0e0`,height:6,borderRadius:3,labelFontSize:12,labelColor:`#666666`})],[`codeBlock`,()=>({id:O(`codeBlock`),type:`codeBlock`,content:`console.log("hello");`,language:`javascript`,backgroundColor:`#1e1e1e`,textColor:`#d4d4d4`,padding:12,borderRadius:4,fontSize:12,languageLabelFontSize:10,languageLabelColor:`#888888`})],[`markdown`,()=>({id:O(`markdown`),type:`markdown`,content:`**Bold** and *italic*`,baseFontSize:14,color:`#333333`,lineHeight:1.5,linkColor:`#6C5CE7`})],[`row`,()=>({id:O(`row`),type:`row`,items:[],gap:8,align:`start`,wrap:!1,scrollable:!1,snap:`item`})],[`column`,()=>({id:O(`column`),type:`column`,items:[],gap:8,align:`start`})],[`grid`,()=>({id:O(`grid`),type:`grid`,items:[],columns:2,gap:8})],[`accordion`,()=>({id:O(`accordion`),type:`accordion`,header:`Accordion`,body:[],expandedByDefault:!1,padding:8,fontSize:14,fontWeight:`regular`,borderRadius:4})],[`tabs`,()=>({id:O(`tabs`),type:`tabs`,tabs:[{label:`Tab 1`,content:[]},{label:`Tab 2`,content:[]}],defaultActiveTab:0,tabAlign:`start`,tabPadding:{top:8,right:16,bottom:8,left:16},contentPadding:8,fontSize:13})],[`button`,()=>({id:O(`button`),type:`button`,label:`Button`,action:{type:`openUrl`,url:``,openIn:`browser`},backgroundColor:`#6C5CE7`,textColor:`#FFFFFF`,borderRadius:6,iconPosition:`left`,size:40,fullWidth:!1,padding:{top:0,right:16,bottom:0,left:16},fontSize:13})],[`iconButton`,()=>({id:O(`iconButton`),type:`iconButton`,icon:`https://assets.cc-cluster-2.io/bubble-builder/account_circle.png`,action:{type:`openUrl`,url:``,openIn:`browser`},size:32,color:`#333333`,backgroundColor:`#f0f0f0`,borderRadius:16})],[`link`,()=>({id:O(`link`),type:`link`,text:`Click here`,action:{type:`openUrl`,url:``,openIn:`browser`},color:`#6C5CE7`,underline:!0,fontSize:14})],[`table`,()=>({id:O(`table`),type:`table`,columns:[`Col 1`,`Col 2`],rows:[[`A`,`B`]],headerBackgroundColor:`#f5f5f5`,cellPadding:6,fontSize:12,stripedRowColor:`#fafafa`,borderColor:`#e0e0e0`})]]),bn={Layout:[`row`,`column`,`grid`,`accordion`,`tabs`],Content:[`text`,`image`,`icon`,`avatar`,`badge`,`divider`,`spacer`,`chip`,`markdown`,`codeBlock`],"Data Display":[`table`,`progressBar`],Actions:[`button`,`iconButton`,`link`]};function xn(e){return e.type===`row`||e.type===`column`||e.type===`grid`||e.type===`accordion`||e.type===`tabs`}function Sn(e,t){if(t.length===0)return null;let n=e[t[0]];for(let e=1;e<t.length;e++){if(!n)return null;let r=null;if(n.type===`row`||n.type===`column`||n.type===`grid`?r=n.items:n.type===`accordion`?r=n.body:n.type===`tabs`&&(r=n.tabs[n.defaultActiveTab??0]?.content??null),!r)return null;n=r[t[e]]}return n??null}var Cn=(0,I.jsx)(`div`,{className:`lp-footer`,children:(0,I.jsx)(`div`,{className:`lp-footer-hint`,children:`Click to add element`})}),wn=(0,C.memo)(function(){let[e,t]=(0,C.useState)(`elements`),[n,r]=(0,C.useState)(``),i=F(e=>e.addElement),a=F(e=>e.loadBubble),o=F(e=>e.hiddenElements),s=F(e=>e.hiddenComponents),c=(0,C.useCallback)(e=>{let t=yn.get(e);if(!t)return;let n=F.getState().selectedPath;if(n&&n.length>0){let e=F.getState().body,r=Sn(e,n);if(r&&xn(r)){i(t(),n);return}if(n.length>1){let r=n.slice(0,-1),a=Sn(r.length>0?e:[],r);if(a&&xn(a)){i(t(),r);return}}}i(t())},[i]),l=(0,C.useCallback)(e=>{let t=_e.find(t=>t.name===e);if(!t)return;let n=ne(structuredClone(t.elements)),r=F.getState();if(r.body.length===0){let e={version:`1.0`,body:n,fallbackText:``},i=r.templateName;a(e,void 0,i&&i!==`Untitled Bubble`?i:t.name)}else n.forEach(e=>i(e))},[i,a]);return(0,I.jsxs)(`div`,{className:`left-panel`,children:[(0,I.jsx)(`div`,{className:`palette-header`,children:(0,I.jsxs)(`div`,{className:`lp-tabs`,children:[(0,I.jsxs)(`button`,{className:`lp-tab ${e===`components`?`active`:``}`,onClick:()=>t(`components`),children:[(0,I.jsx)(`span`,{className:`lp-tab-icon`,children:`⊞`}),` Components`]}),(0,I.jsxs)(`button`,{className:`lp-tab ${e===`elements`?`active`:``}`,onClick:()=>t(`elements`),children:[(0,I.jsx)(`span`,{className:`lp-tab-icon`,children:`◇`}),` Elements`]})]})}),(0,I.jsx)(`div`,{className:`lp-content`,children:e===`elements`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{style:{padding:`8px 12px`},children:(0,I.jsx)(`input`,{className:`lp-search`,placeholder:`Search elements...`,value:n,onChange:e=>r(e.target.value)})}),Object.entries(bn).map(([e,t])=>{let r=t.filter(e=>!o.has(e)),i=n?r.filter(e=>Dn(e).toLowerCase().includes(n.toLowerCase())):r;return i.length===0?null:(0,I.jsx)(Tn,{title:e,icon:En(e),children:(0,I.jsx)(`div`,{className:`lp-element-list`,children:i.map(e=>(0,I.jsxs)(`button`,{className:`lp-element-btn`,onClick:()=>c(e),title:`Add ${e}`,children:[(0,I.jsx)(`span`,{className:`lp-element-icon`,children:kn(e)}),(0,I.jsx)(`span`,{className:`lp-element-label`,children:Dn(e)})]},e))})},e)})]}):ve.map(e=>{let t=_e.filter(t=>t.category===e&&!s.has(t.name));return t.length===0?null:(0,I.jsx)(Tn,{title:e,icon:`⊞`,children:(0,I.jsx)(`div`,{className:`lp-component-list`,children:t.map(e=>(0,I.jsxs)(`button`,{className:`lp-component-card`,onClick:()=>l(e.name),children:[(0,I.jsx)(`span`,{className:`lp-card-icon`,children:e.icon}),(0,I.jsxs)(`div`,{className:`lp-card-info`,children:[(0,I.jsx)(`span`,{className:`lp-card-name`,children:e.name}),(0,I.jsx)(`span`,{className:`lp-card-desc`,children:e.description})]})]},e.name))})},e)})}),Cn]})});function Tn({title:e,icon:t,children:n}){let[r,i]=(0,C.useState)(!0);return(0,I.jsxs)(`div`,{className:`lp-category`,children:[(0,I.jsxs)(`div`,{className:`lp-category-header`,onClick:()=>i(!r),children:[(0,I.jsxs)(`div`,{className:`lp-category-title`,children:[(0,I.jsx)(`span`,{className:`lp-category-icon`,children:t}),e]}),(0,I.jsx)(`span`,{className:`lp-category-arrow ${r?`open`:`closed`}`,children:`▾`})]}),r?n:null]})}function En(e){switch(e){case`Layout`:return`⊞`;case`Content`:return`Tt`;case`Data Display`:return`⊟`;case`Media`:return`▶`;case`Actions`:return`⊡`;default:return`◇`}}function Dn(e){return e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}var On=new Map([[`text`,`T`],[`image`,`🖼`],[`icon`,`★`],[`avatar`,`👤`],[`badge`,`🏷`],[`divider`,`—`],[`spacer`,`↕`],[`chip`,`◉`],[`progressBar`,`▓`],[`codeBlock`,`</>`],[`markdown`,`M↓`],[`row`,`↔`],[`column`,`↕`],[`grid`,`⊞`],[`accordion`,`▼`],[`tabs`,`⊟`],[`button`,`▣`],[`iconButton`,`◎`],[`link`,`🔗`],[`table`,`⊞`]]);function kn(e){return On.get(e)??`?`}var An=v(),jn={title:{fontSize:32,fontWeight:700,lineHeight:1.2},heading1:{fontSize:24,fontWeight:700,lineHeight:1.2},heading2:{fontSize:20,fontWeight:600,lineHeight:1.2},heading3:{fontSize:18,fontWeight:600,lineHeight:1.2},heading4:{fontSize:16,fontWeight:600,lineHeight:1.3},body:{fontSize:14,fontWeight:400,lineHeight:1.4},caption1:{fontSize:12,fontWeight:400,lineHeight:1.4},caption2:{fontSize:10,fontWeight:400,lineHeight:1.4}},z=`https://assets.cc-cluster-2.io/bubble-builder`,Mn=[{name:`arrow_back`,label:`Back`,url:`${z}/arrow_back.png`,category:`Navigation`},{name:`arrow_forward`,label:`Forward`,url:`${z}/arrow_forward.png`,category:`Navigation`},{name:`close`,label:`Close`,url:`${z}/close.png`,category:`Navigation`},{name:`check`,label:`Check`,url:`${z}/check.png`,category:`Navigation`},{name:`check_circle`,label:`Check Circle`,url:`${z}/check_circle.png`,category:`Navigation`},{name:`add`,label:`Add`,url:`${z}/add.png`,category:`Navigation`},{name:`remove`,label:`Remove`,url:`${z}/remove.png`,category:`Navigation`},{name:`edit`,label:`Edit`,url:`${z}/edit.png`,category:`Navigation`},{name:`delete`,label:`Delete`,url:`${z}/delete.png`,category:`Navigation`},{name:`search`,label:`Search`,url:`${z}/search.png`,category:`Navigation`},{name:`refresh`,label:`Refresh`,url:`${z}/refresh.png`,category:`Navigation`},{name:`chat`,label:`Chat`,url:`${z}/chat.png`,category:`Communication`},{name:`mail`,label:`Mail`,url:`${z}/mail.png`,category:`Communication`},{name:`phone`,label:`Phone`,url:`${z}/phone.png`,category:`Communication`},{name:`call`,label:`Call`,url:`${z}/call.png`,category:`Communication`},{name:`videocam`,label:`Video`,url:`${z}/videocam.png`,category:`Communication`},{name:`send`,label:`Send`,url:`${z}/send.png`,category:`Communication`},{name:`notifications`,label:`Notifications`,url:`${z}/notifications.png`,category:`Communication`},{name:`person`,label:`Person`,url:`${z}/person.png`,category:`People`},{name:`group`,label:`Group`,url:`${z}/group.png`,category:`People`},{name:`account_circle`,label:`Account`,url:`${z}/account_circle.png`,category:`People`},{name:`account_box`,label:`Profile`,url:`${z}/account_box.png`,category:`People`},{name:`favorite`,label:`Favorite`,url:`${z}/favorite.png`,category:`People`},{name:`star`,label:`Star`,url:`${z}/star.png`,category:`People`},{name:`thumb_up`,label:`Thumb Up`,url:`${z}/thumb_up.png`,category:`People`},{name:`thumb_down`,label:`Thumb Down`,url:`${z}/thumb_down.png`,category:`People`},{name:`share`,label:`Share`,url:`${z}/share.png`,category:`People`},{name:`link`,label:`Link`,url:`${z}/link.png`,category:`Content`},{name:`attach_file`,label:`Attach`,url:`${z}/attach_file.png`,category:`Content`},{name:`image`,label:`Image`,url:`${z}/image.png`,category:`Content`},{name:`file_copy`,label:`Copy`,url:`${z}/file_copy.png`,category:`Content`},{name:`download`,label:`Download`,url:`${z}/download.png`,category:`Content`},{name:`upload`,label:`Upload`,url:`${z}/upload.png`,category:`Content`},{name:`info`,label:`Info`,url:`${z}/info.png`,category:`Status`},{name:`warning`,label:`Warning`,url:`${z}/warning.png`,category:`Status`},{name:`error`,label:`Error`,url:`${z}/error.png`,category:`Status`},{name:`help`,label:`Help`,url:`${z}/help.png`,category:`Status`},{name:`schedule`,label:`Schedule`,url:`${z}/schedule.png`,category:`Status`},{name:`calendar_today`,label:`Calendar`,url:`${z}/calendar_today.png`,category:`Status`},{name:`location_on`,label:`Location`,url:`${z}/location_on.png`,category:`Status`},{name:`shopping_cart`,label:`Cart`,url:`${z}/shopping_cart.png`,category:`Commerce`},{name:`credit_card`,label:`Card`,url:`${z}/credit_card.png`,category:`Commerce`},{name:`payments`,label:`Payment`,url:`${z}/payments.png`,category:`Commerce`},{name:`account_balance`,label:`Bank`,url:`${z}/account_balance.png`,category:`Commerce`},{name:`account_balance_wallet`,label:`Wallet`,url:`${z}/account_balance_wallet.png`,category:`Commerce`},{name:`add_card`,label:`Add Card`,url:`${z}/add_card.png`,category:`Commerce`},{name:`add_shopping_cart`,label:`Add to Cart`,url:`${z}/add_shopping_cart.png`,category:`Commerce`},{name:`add_home`,label:`Add Home`,url:`${z}/add_home.png`,category:`Misc`},{name:`add_task`,label:`Add Task`,url:`${z}/add_task.png`,category:`Misc`}],Nn=new Map(Mn.map(e=>[e.name,e])),Pn=[...new Set(Mn.map(e=>e.category))];function Fn(e){return e.startsWith(`http`)||e.startsWith(`/`)?e:Nn.get(e)?.url??e}var In=document.body;function Ln(e){In=e}function Rn(){return In}function zn(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Bn(e){if(e!=null)return typeof e==`number`?`${e}px`:`${e.top??0}px ${e.right??0}px ${e.bottom??0}px ${e.left??0}px`}function Vn(e){let t=e.split(/(\{\{[^}]+\}\})/g);return t.length===1?e:t.map((e,t)=>e.startsWith(`{{`)?(0,I.jsx)(`span`,{style:{background:`rgba(108,92,231,0.2)`,borderRadius:3,padding:`0 4px`,fontSize:`0.9em`},children:e},t):e)}var Hn=(0,C.memo)(function({element:e,path:t,selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:d,isLast:f,inRow:p}){let m=zn(n,t),h=r.some(e=>zn(e,t)),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(null),b=(0,C.useCallback)(e=>{e.stopPropagation(),y(null),e.shiftKey?a(t):i(t),_(!1)},[i,a,t]),x=(0,C.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),i(t),y({x:e.clientX,y:e.clientY})},[i,t]),S=e.type===`row`||e.type===`column`||e.type===`grid`||e.type===`accordion`||e.type===`tabs`,w=(0,C.useRef)(null),[T,ee]=(0,C.useState)(null),te=(0,C.useCallback)(()=>{if(!w.current)return;let e=w.current.getBoundingClientRect();ee({top:e.top-2,left:e.right})},[]),E=Gn(e,t,n,r,i,a,o,s,c,l,u);return(0,I.jsxs)(`div`,{ref:w,className:`el-wrapper ${m?`selected`:``} ${h&&!m?`multi-selected`:``}`,onClick:b,onContextMenu:x,onMouseEnter:te,style:p?{width:e.type===`button`&&e.fullWidth?`100%`:`auto`}:void 0,children:[v?(0,I.jsxs)(`div`,{className:`el-context-menu`,style:{position:`fixed`,left:v.x,top:v.y,zIndex:2e3},onClick:e=>e.stopPropagation(),children:[t.length>1?(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{i(t.slice(0,-1)),y(null)},children:`↰ Select Parent`}):null,d?null:(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{o(t,`up`),y(null)},children:`↑ Move Up`}),f?null:(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{o(t,`down`),y(null)},children:`↓ Move Down`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{u(t),y(null)},children:`⧉ Duplicate`}),(0,I.jsx)(`div`,{className:`el-ctx-sep`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{c(t,`row`),y(null)},children:`Wrap in Row`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{c(t,`column`),y(null)},children:`Wrap in Column`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{c(t,`grid`),y(null)},children:`Wrap in Grid`}),S?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`el-ctx-sep`}),(0,I.jsx)(`button`,{className:`el-ctx-item`,onClick:()=>{l(t),y(null)},children:`⊟ Unwrap`})]}):null,(0,I.jsx)(`div`,{className:`el-ctx-sep`}),(0,I.jsx)(`button`,{className:`el-ctx-item danger`,onClick:()=>{s(t),y(null)},children:`× Delete`})]}):null,m&&T?(0,An.createPortal)((0,I.jsxs)(`div`,{className:`el-controls-portal`,style:{position:`fixed`,top:T.top,left:T.left,transform:`translate(-100%, -100%)`},onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[t.length>1?(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),i(t.slice(0,-1))},title:`Select parent`,children:`↰`}):null,d?null:(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),o(t,`up`)},title:`Move up`,children:`↑`}),f?null:(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),o(t,`down`)},title:`Move down`,children:`↓`}),S?(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),l(t)},title:`Unwrap container`,children:`⊟`}):null,(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),u(t)},title:`Duplicate`,children:`⧉`}),(0,I.jsxs)(`div`,{style:{position:`relative`},children:[(0,I.jsx)(`button`,{className:`el-ctrl-btn`,onClick:e=>{e.stopPropagation(),_(!g)},title:`Wrap in container`,children:`⊞`}),g?(0,I.jsxs)(`div`,{className:`el-wrap-menu`,children:[(0,I.jsx)(`button`,{className:`el-wrap-option`,onClick:e=>{e.stopPropagation(),c(t,`row`),_(!1)},children:`Wrap in Row`}),(0,I.jsx)(`button`,{className:`el-wrap-option`,onClick:e=>{e.stopPropagation(),c(t,`column`),_(!1)},children:`Wrap in Column`}),(0,I.jsx)(`button`,{className:`el-wrap-option`,onClick:e=>{e.stopPropagation(),c(t,`grid`),_(!1)},children:`Wrap in Grid`})]}):null]}),(0,I.jsx)(`button`,{className:`el-ctrl-btn danger`,onClick:e=>{e.stopPropagation(),s(t)},title:`Delete`,children:`×`})]}),Rn()):null,E]})}),Un=(0,I.jsx)(`div`,{style:{padding:`12px 16px`,color:`#adb5bd`,fontSize:12,textAlign:`center`,border:`1px dashed #dee2e6`,borderRadius:6,margin:4},children:`Drop elements here`});function Wn(e,t,n){return(0,I.jsx)(`span`,{style:{display:`inline-block`,width:t,height:t,verticalAlign:`middle`,backgroundColor:n||`currentColor`,WebkitMaskImage:`url(${Fn(e)})`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(${Fn(e)})`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}})}function Gn(e,t,n,r,i,a,o,s,c,l,u){switch(e.type){case`text`:return(0,I.jsx)(`div`,{style:{...jn[e.variant??`body`],color:e.color||`#2D3436`,textAlign:e.align,fontWeight:e.fontWeight===`medium`?500:e.fontWeight===`bold`?700:400,padding:Bn(e.padding),overflowWrap:`break-word`,wordBreak:`break-word`,...e.maxLines?{overflow:`hidden`,display:`-webkit-box`,WebkitLineClamp:e.maxLines,WebkitBoxOrient:`vertical`}:{}},children:Vn(e.content)});case`image`:{let t=e.url&&e.url.includes(`{{`),n=e.url&&!t;return(0,I.jsx)(`div`,{style:{padding:Bn(e.padding)},children:n?(0,I.jsx)(`img`,{src:e.url,alt:e.altText??``,style:{width:e.width?typeof e.width==`number`?`${e.width}px`:e.width:`100%`,height:e.height?typeof e.height==`number`?`${e.height}px`:e.height:`auto`,objectFit:e.fit??`cover`,borderRadius:e.borderRadius?`${e.borderRadius}px`:void 0,display:`block`}}):(0,I.jsxs)(`div`,{style:{width:e.width?typeof e.width==`number`?`${e.width}px`:e.width:`100%`,height:typeof e.height==`number`?e.height:180,background:`linear-gradient(135deg, #f1f3f5 0%, #e9ecef 50%, #f1f3f5 100%)`,borderRadius:e.borderRadius??6,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#727272`,fontSize:12,flexDirection:`column`,gap:8,border:`2px dashed #ced4da`,position:`relative`,overflow:`hidden`},children:[(0,I.jsx)(`div`,{style:{position:`absolute`,inset:0,opacity:.04,backgroundImage:`repeating-linear-gradient(45deg, #868e96 0, #868e96 1px, transparent 0, transparent 50%)`,backgroundSize:`12px 12px`}}),(0,I.jsx)(`div`,{style:{width:48,height:48,borderRadius:12,background:`rgba(108,92,231,0.1)`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:24},children:`🖼`}),t?(0,I.jsx)(`span`,{style:{background:`rgba(104,82,214,0.15)`,borderRadius:4,padding:`3px 10px`,fontSize:12,color:`#6852D6`,fontFamily:`monospace`},children:e.url}):(0,I.jsx)(`span`,{style:{color:`#adb5bd`,fontSize:13,fontWeight:500},children:`Image placeholder`})]})})}case`icon`:return(0,I.jsx)(`div`,{style:{width:e.size?e.size+(e.padding??4)*2:28,height:e.size?e.size+(e.padding??4)*2:28,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius??0},children:(0,I.jsx)(`div`,{style:{width:e.size??20,height:e.size??20,backgroundColor:e.color||`#666666`,WebkitMaskImage:`url(${Fn(e.name)})`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(${Fn(e.name)})`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}})});case`avatar`:{let t=e.size??36,n=e.fontWeight===`medium`?500:e.fontWeight===`bold`?700:400;return(0,I.jsx)(`div`,{style:{width:t,height:t,borderRadius:e.borderRadius??t/2,background:e.backgroundColor??`#6C5CE7`,color:`#FFFFFF`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:e.fontSize??t*.4,fontWeight:n,overflow:`hidden`},children:e.imageUrl?(0,I.jsx)(`img`,{src:e.imageUrl,alt:``,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):e.fallbackInitials??`?`})}case`badge`:{let t=e.size??24;return(0,I.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:t,height:t,padding:e.padding==null?`0 6px`:typeof e.padding==`number`?`0 ${e.padding}px`:`${e.padding.top??0}px ${e.padding.right??0}px ${e.padding.bottom??0}px ${e.padding.left??0}px`,borderRadius:e.borderRadius??12,fontSize:e.fontSize??12,fontWeight:600,background:e.backgroundColor||`#6C5CE7`,color:e.color||`#FFFFFF`,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#000000`}`:`none`},children:e.text})}case`divider`:return(0,I.jsx)(`hr`,{style:{border:`none`,borderTop:`${e.thickness??1}px solid ${e.color||`#e0e0e0`}`,margin:`${e.margin??8}px 0`}});case`spacer`:return(0,I.jsx)(`div`,{style:{height:e.height}});case`chip`:return(0,I.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:Bn(e.padding)??`4px 10px`,borderRadius:e.borderRadius??16,fontSize:e.fontSize??12,background:e.backgroundColor||`#e0e0e0`,color:e.color||`#333333`,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#000000`}`:`none`},children:[e.icon?Wn(e.icon,14,e.color||`#333333`):null,e.text]});case`progressBar`:return(0,I.jsxs)(`div`,{children:[e.label?(0,I.jsx)(`div`,{style:{fontSize:e.labelFontSize??12,color:e.labelColor??`#666666`,marginBottom:4},children:e.label}):null,(0,I.jsx)(`div`,{style:{height:e.height??6,background:e.trackColor||`#e0e0e0`,borderRadius:e.borderRadius??3,overflow:`hidden`},children:(0,I.jsx)(`div`,{style:{width:`${e.value}%`,height:`100%`,background:e.color||`#6C5CE7`,borderRadius:e.borderRadius??3,transition:`width 0.3s`}})})]});case`button`:{let t=e.size??40;return(0,I.jsxs)(`button`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,height:t,padding:Bn(e.padding)??`0 16px`,borderRadius:e.borderRadius??6,fontSize:e.fontSize??Math.max(11,t*.325),fontWeight:600,cursor:`pointer`,width:e.fullWidth?`100%`:void 0,justifyContent:e.fullWidth?`center`:void 0,background:e.backgroundColor??`transparent`,color:e.textColor||`#FFFFFF`,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#000000`}`:`none`},children:[e.icon&&e.iconPosition!==`right`?Wn(e.icon,14):null,e.label,e.icon&&e.iconPosition===`right`?Wn(e.icon,14):null]})}case`iconButton`:{let t=(e.size??32)*.5;return(0,I.jsx)(`button`,{style:{width:e.size??32,height:e.size??32,borderRadius:e.borderRadius??(e.size??32)/2,background:e.backgroundColor||`#f0f0f0`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,border:`none`},children:(0,I.jsx)(`div`,{style:{width:t,height:t,backgroundColor:e.color||`#333333`,WebkitMaskImage:`url(${Fn(e.icon)})`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(${Fn(e.icon)})`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}})})}case`link`:return(0,I.jsx)(`span`,{style:{color:e.color||`#6C5CE7`,textDecoration:e.underline===!1?`none`:`underline`,cursor:`pointer`,fontSize:e.fontSize??14},children:Vn(e.text)});case`table`:return(0,I.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:e.fontSize??12},children:[(0,I.jsx)(`thead`,{children:(0,I.jsx)(`tr`,{children:e.columns.map((t,n)=>(0,I.jsx)(`th`,{style:{padding:e.cellPadding==null?`6px 8px`:`${e.cellPadding}px`,textAlign:`left`,fontWeight:600,background:e.headerBackgroundColor||`#f5f5f5`,border:e.border?`1px solid ${e.borderColor||`#e0e0e0`}`:`none`},children:t},n))})}),(0,I.jsx)(`tbody`,{children:e.rows.map((t,n)=>(0,I.jsx)(`tr`,{style:{background:e.stripedRows&&n%2==1?e.stripedRowColor||`#fafafa`:void 0},children:t.map((t,n)=>(0,I.jsx)(`td`,{style:{padding:e.cellPadding==null?`6px 8px`:`${e.cellPadding}px`,border:e.border?`1px solid ${e.borderColor||`#e0e0e0`}`:`none`},children:Vn(t)},n))},n))})]});case`codeBlock`:return(0,I.jsxs)(`pre`,{style:{background:e.backgroundColor||`#1e1e1e`,color:e.textColor||`#d4d4d4`,padding:Bn(e.padding)??`12px`,borderRadius:e.borderRadius??4,fontSize:e.fontSize??12,overflow:`auto`,fontFamily:`monospace`,whiteSpace:`pre-wrap`},children:[e.language?(0,I.jsx)(`div`,{style:{fontSize:e.languageLabelFontSize??10,color:e.languageLabelColor??`#888888`,marginBottom:4},children:e.language}):null,e.content]});case`markdown`:return(0,I.jsx)(`div`,{style:{fontSize:e.baseFontSize??14,lineHeight:e.lineHeight??1.5,color:e.color??`#333333`,"--link-color":e.linkColor??`#6C5CE7`},children:e.content});case`row`:{let d=e.scrollable,f=e.peek??0,p=e.gap??0,m=d?{flex:`0 0 auto`,width:f>0?`calc(100% - ${f*2+p}px)`:`calc(100% - ${p}px)`}:void 0;return(0,I.jsx)(`div`,{style:{display:`flex`,gap:p,flexWrap:e.wrap?`wrap`:void 0,alignItems:d?`stretch`:`center`,padding:Bn(e.padding),width:`100%`,justifyContent:e.align===`spaceBetween`?`space-between`:e.align===`spaceAround`?`space-around`:e.align===`end`?`flex-end`:e.align===`center`?`center`:`flex-start`,overflowX:d?`auto`:void 0,scrollSnapType:d&&e.snap===`item`?`x mandatory`:void 0,background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#e0e0e0`}`:void 0},children:e.items.map((f,p)=>{let h=f.type===`button`&&f.fullWidth;return(0,I.jsx)(`div`,{style:{...m,scrollSnapAlign:d&&e.snap===`item`?`start`:void 0,...h?{flex:1}:void 0},children:(0,I.jsx)(Hn,{element:f,path:[...t,p],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:p===0,isLast:p===e.items.length-1,inRow:!d})},p)})})}case`column`:return(0,I.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:e.gap??0,width:`100%`,alignItems:e.align===`stretch`?`stretch`:e.align===`end`?`flex-end`:e.align===`center`?`center`:`flex-start`,padding:Bn(e.padding),background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#e0e0e0`}`:void 0},children:e.items.length===0?Un:e.items.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===e.items.length-1},f))});case`grid`:return(0,I.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${e.columns??2}, 1fr)`,gap:e.gap??0,padding:Bn(e.padding),width:`100%`,background:e.backgroundColor?e.backgroundColor:void 0,borderRadius:e.borderRadius,border:e.borderWidth?`${e.borderWidth}px solid ${e.borderColor||`#e0e0e0`}`:void 0},children:e.items.length===0?Un:e.items.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===e.items.length-1},f))});case`accordion`:{let d=e.fontWeight===`medium`?500:e.fontWeight===`bold`?700:400;return(0,I.jsxs)(`details`,{open:e.expandedByDefault,style:{border:e.border?`1px solid #e0e0e0`:void 0,borderRadius:e.borderRadius??4},children:[(0,I.jsxs)(`summary`,{style:{padding:Bn(e.padding)??`8px`,cursor:`pointer`,fontSize:e.fontSize??14,fontWeight:d,display:`flex`,alignItems:`center`,gap:6},children:[e.headerIcon?Wn(e.headerIcon,18):null,e.header]}),(0,I.jsx)(`div`,{style:{padding:Bn(e.padding)??`8px`},children:e.body.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===e.body.length-1},f))})]})}case`tabs`:return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{style:{display:`flex`,borderBottom:`1px solid #e0e0e0`,justifyContent:e.tabAlign===`center`?`center`:e.tabAlign===`stretch`?`stretch`:`flex-start`},children:e.tabs.map((n,r)=>(0,I.jsx)(`div`,{onClick:e=>{e.stopPropagation(),F.getState().updateElement(t,{defaultActiveTab:r})},style:{padding:Bn(e.tabPadding)??`8px 16px`,fontSize:e.fontSize??13,cursor:`pointer`,flex:e.tabAlign===`stretch`?1:void 0,textAlign:e.tabAlign===`stretch`?`center`:void 0,fontWeight:r===(e.defaultActiveTab??0)?600:400,borderBottom:r===(e.defaultActiveTab??0)?`2px solid #6C5CE7`:`2px solid transparent`,color:r===(e.defaultActiveTab??0)?`#6C5CE7`:`#999999`},children:n.label},r))}),(0,I.jsx)(`div`,{style:{padding:Bn(e.contentPadding)??`8px`},children:e.tabs[e.defaultActiveTab??0]?.content.map((d,f)=>(0,I.jsx)(Hn,{element:d,path:[...t,f],selectedPath:n,selectedPaths:r,onSelect:i,onToggleSelect:a,onMove:o,onRemove:s,onWrap:c,onUnwrap:l,onDuplicate:u,isFirst:f===0,isLast:f===(e.tabs[e.defaultActiveTab??0]?.content.length??0)-1},f))})]});default:return(0,I.jsxs)(`div`,{style:{padding:8,color:`#999999`,fontSize:12},children:[`Unknown: `,e.type]})}}var Kn=375,qn=667,Jn=new Date,Yn=Jn.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),Xn=Jn.toLocaleDateString(`en-US`,{weekday:`long`,day:`numeric`,month:`long`}),Zn=(0,I.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[(0,I.jsxs)(`svg`,{width:`17`,height:`12`,viewBox:`0 0 17 12`,fill:`white`,children:[(0,I.jsx)(`rect`,{x:`0`,y:`9`,width:`3`,height:`3`,rx:`0.75`}),(0,I.jsx)(`rect`,{x:`4.5`,y:`6`,width:`3`,height:`6`,rx:`0.75`}),(0,I.jsx)(`rect`,{x:`9`,y:`3`,width:`3`,height:`9`,rx:`0.75`}),(0,I.jsx)(`rect`,{x:`13.5`,y:`0`,width:`3`,height:`12`,rx:`0.75`})]}),(0,I.jsxs)(`svg`,{width:`16`,height:`14`,viewBox:`0 0 16 14`,fill:`white`,children:[(0,I.jsx)(`circle`,{cx:`8`,cy:`12`,r:`1.5`}),(0,I.jsx)(`path`,{d:`M4.8 9.5a4.5 4.5 0 016.4 0`,stroke:`white`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`}),(0,I.jsx)(`path`,{d:`M2.2 6.8a8.2 8.2 0 0111.6 0`,stroke:`white`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`}),(0,I.jsx)(`path`,{d:`M0 4a11.5 11.5 0 0116 0`,stroke:`white`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`})]}),(0,I.jsxs)(`svg`,{width:`25`,height:`12`,viewBox:`0 0 25 12`,fill:`none`,children:[(0,I.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`20`,height:`11`,rx:`2.5`,stroke:`white`,strokeOpacity:`0.35`}),(0,I.jsx)(`rect`,{x:`2`,y:`2`,width:`14`,height:`8`,rx:`1.5`,fill:`white`}),(0,I.jsx)(`path`,{d:`M22 4v4a2 2 0 000-4z`,fill:`white`,fillOpacity:`0.4`})]})]}),Qn=(0,C.memo)(function({platform:e}){let t=F(e=>e.notificationTitle),n=F(e=>e.notificationBody),r=k.notification,i=r?.appName??`App`,a=r?.appIcon,o=(0,C.useRef)(null),[s,c]=(0,C.useState)(1);return(0,C.useEffect)(()=>{let e=o.current?.parentElement;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=t.height-64,r=t.width-100,i=Math.min(n/qn,r/Kn);c(Math.round(Math.max(i,.4)*100)/100)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,I.jsx)(`div`,{ref:o,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:(0,I.jsx)(`div`,{style:{width:Kn*s,height:qn*s,flexShrink:0},children:(0,I.jsxs)(`div`,{style:{width:Kn,height:qn,overflow:`hidden`,transform:`scale(${s})`,transformOrigin:`top left`,borderRadius:e===`ios`?48:24,background:`linear-gradient(162deg, rgb(131,151,230) 0%, rgb(130,84,219) 49%, rgb(135,184,189) 100%)`,boxShadow:`0 8px 32px rgba(0,0,0,0.18)`,fontFamily:e===`ios`?`-apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif`:`"Roboto", "Google Sans", sans-serif`,color:`#fff`,position:`relative`,display:`flex`,flexDirection:`column`,justifyContent:e===`ios`?`space-between`:`flex-start`,padding:16},children:[(0,I.jsxs)(`div`,{children:[e===`ios`?(0,I.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,padding:`0 8px`,height:32},children:Zn}):(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`0 8px`,height:32},children:[(0,I.jsx)(`span`,{style:{fontSize:13,fontWeight:600},children:Yn}),Zn]}),e===`ios`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{style:{marginTop:40,textAlign:`center`,fontSize:20,fontWeight:600,lineHeight:`20px`,color:`rgba(255,255,255,0.8)`},children:Xn}),(0,I.jsx)(`div`,{style:{textAlign:`center`,fontSize:86,lineHeight:`96px`,letterSpacing:-4,color:`rgba(255,255,255,0.8)`},children:Yn})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{style:{textAlign:`center`,fontSize:80,lineHeight:`94px`,letterSpacing:-4,color:`#fff`,marginTop:64},children:Yn}),(0,I.jsx)(`div`,{style:{textAlign:`center`,fontSize:16,textTransform:`uppercase`,letterSpacing:1.4,color:`#fff`,marginBottom:34},children:Xn})]})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{style:{borderRadius:20,background:`rgba(255,255,255,0.56)`,padding:e===`ios`?`16px 14px`:`14px 16px`,color:`#000`,backdropFilter:`blur(20px)`,display:`flex`,gap:10,alignItems:`flex-start`},children:[e===`ios`?a?(0,I.jsx)(`img`,{src:a,alt:``,style:{width:38,height:38,borderRadius:10,objectFit:`cover`,flexShrink:0,background:`#fff`}}):(0,I.jsx)(`div`,{style:{width:38,height:38,borderRadius:10,background:`#fff`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsx)(`div`,{style:{width:20,height:20,borderRadius:4,background:`#6852D6`}})}):null,(0,I.jsx)(`div`,{style:{flex:1,minWidth:0},children:e===`ios`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`baseline`},children:[(0,I.jsx)(`span`,{style:{fontWeight:700,fontSize:15,lineHeight:`18px`,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t||i}),(0,I.jsx)(`span`,{style:{fontSize:12,color:`#4f4f4f`,flexShrink:0},children:`now`})]}),n&&(0,I.jsx)(`div`,{style:{fontSize:15,lineHeight:`18px`,opacity:.88,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginTop:4},children:n}),!t&&!n&&(0,I.jsx)(`div`,{style:{fontSize:13,color:`#aaa`,fontStyle:`italic`,marginTop:2},children:`Enter title and body in the Notification tab`})]}):(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`flex-start`},children:[a?(0,I.jsx)(`img`,{src:a,alt:``,style:{width:38,height:38,borderRadius:19,objectFit:`cover`,flexShrink:0,background:`#fff`}}):(0,I.jsx)(`div`,{style:{width:38,height:38,borderRadius:19,background:`#fff`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsx)(`div`,{style:{width:20,height:20,borderRadius:4,background:`#6852D6`}})}),(0,I.jsxs)(`div`,{style:{flex:1,minWidth:0,display:`flex`,flexDirection:`column`,gap:6},children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[(0,I.jsx)(`span`,{style:{fontWeight:700,fontSize:14,lineHeight:`16px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t||i}),(0,I.jsx)(`span`,{style:{fontSize:12,color:`#4f4f4f`,flexGrow:1},children:`now`}),(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,style:{flexShrink:0},children:(0,I.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.53 6.47l.94-.94 3.53 3.53 3.53-3.53.94.94L8 10.94 3.53 6.47z`,fill:`#5E5E5E`})})]}),n&&(0,I.jsx)(`div`,{style:{fontSize:14,lineHeight:`16px`,color:`#4f4f4f`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n}),!t&&!n&&(0,I.jsx)(`div`,{style:{fontSize:13,color:`#aaa`,fontStyle:`italic`},children:`Enter title and body in the Notification tab`})]})]})})})]}),e===`ios`&&(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,gap:190,marginTop:16,marginBottom:-10},children:[(0,I.jsx)(`div`,{style:{width:50,height:50,borderRadius:25,background:`rgba(255,255,255,0.15)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`white`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M9 18h6`}),(0,I.jsx)(`path`,{d:`M10 22h4`}),(0,I.jsx)(`path`,{d:`M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0018 8 6 6 0 006 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 018.91 14`})]})}),(0,I.jsx)(`div`,{style:{width:50,height:50,borderRadius:25,background:`rgba(255,255,255,0.15)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`white`,children:[(0,I.jsx)(`path`,{d:`M12 15.2a3.2 3.2 0 100-6.4 3.2 3.2 0 000 6.4z`}),(0,I.jsx)(`path`,{d:`M9 2L7.17 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V6a2 2 0 00-2-2h-3.17L15 2H9zm3 15a5 5 0 110-10 5 5 0 010 10z`})]})})]}),e===`ios`&&(0,I.jsx)(`div`,{style:{height:5,width:134,borderRadius:3,background:`#fff`,alignSelf:`center`,margin:`0 auto`,marginTop:16}})]})]})})})}),$n={width:40,height:40,borderRadius:8,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#fff`,color:`#6852D6`,boxShadow:`0 1px 3px rgba(0,0,0,0.1)`,transition:`all 0.15s`},er={width:40,height:40,borderRadius:8,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`transparent`,color:`#999`,boxShadow:`none`,transition:`all 0.15s`},tr=(0,C.memo)(function({platform:e,setPlatform:t}){let n=F(e=>e.canvasView),r=F(e=>e.setCanvasView),i=F(e=>e.channels);return i===`inapp`||k.notification?.showPreview===!1?null:(0,I.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2,alignSelf:`center`,background:`#f0f0f0`,borderRadius:10,padding:3,marginLeft:16},children:[i===`both`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{onClick:()=>r(`bubble`),title:`In-App Message`,style:n===`bubble`?$n:er,children:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,I.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z`})})}),(0,I.jsx)(`div`,{style:{height:1,background:`#ddd`,margin:`2px 6px`}})]}),(0,I.jsx)(`button`,{onClick:()=>{r(`notification`),t(`ios`)},title:`Push — iOS`,style:n===`notification`&&e===`ios`?$n:er,children:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,I.jsx)(`path`,{d:`M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.8-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z`})})}),(0,I.jsx)(`button`,{onClick:()=>{r(`notification`),t(`android`)},title:`Push — Android`,style:n===`notification`&&e===`android`?$n:er,children:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,I.jsx)(`path`,{d:`M6 18c0 .55.45 1 1 1h1v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h2v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h1c.55 0 1-.45 1-1V8H6v10zM3.5 8C2.67 8 2 8.67 2 9.5v7c0 .83.67 1.5 1.5 1.5S5 17.33 5 16.5v-7C5 8.67 4.33 8 3.5 8zm17 0c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm-4.97-5.84l1.3-1.3c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0l-1.48 1.48C13.85 1.23 12.95 1 12 1c-.96 0-1.86.23-2.66.63L7.85.15c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l1.31 1.31C6.97 3.26 6 5.01 6 7h12c0-1.99-.97-3.75-2.47-4.84zM10 5H9V4h1v1zm5 0h-1V4h1v1z`})})})]})});function nr(e){return e==null?`12px`:typeof e==`number`?`${e}px`:`${e.top??0}px ${e.right??0}px ${e.bottom??0}px ${e.left??0}px`}var rr=(0,I.jsxs)(`div`,{className:`chat-header`,children:[(0,I.jsx)(`span`,{className:`chat-back-btn`,children:`←`}),(0,I.jsxs)(`div`,{className:`chat-user`,children:[(0,I.jsx)(`div`,{className:`chat-avatar`,children:`A`}),(0,I.jsx)(`div`,{className:`chat-name`,children:`Ada Stanton`})]})]}),ir=(0,I.jsxs)(`div`,{className:`chat-input-area`,children:[(0,I.jsx)(`input`,{className:`chat-input`,placeholder:`Enter your message here`,readOnly:!0}),(0,I.jsx)(`button`,{className:`chat-send-btn`,children:`▶`})]}),ar=new Date().toLocaleDateString(`en-US`,{day:`numeric`,month:`short`,year:`numeric`}),or=(0,C.memo)(function(){let e=F(e=>e.body),t=F(e=>e.settings),n=F(e=>e.selectedPath),r=F(e=>e.selectElement),i=F(e=>e.moveElement),a=F(e=>e.removeElement),o=F(e=>e.wrapElement),s=F(e=>e.unwrapElement),c=F(e=>e.selectedPaths),l=F(e=>e.toggleSelectElement),u=F(e=>e.wrapSelected),d=F(e=>e.duplicateElement),[f,p]=(0,C.useState)(1),[m,h]=(0,C.useState)(!1),[g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(!1),y=F(e=>e.getBubbleJSON),b=F(e=>e.canvasView),[x,S]=(0,C.useState)(`ios`),w=(0,C.useRef)(null);(0,C.useEffect)(()=>{let e=w.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=t.height-64,r=t.width-48,i=Math.min(n/667,r/375);p(Math.round(Math.max(i,.4)*100)/100)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let T=g?`#383838`:`#E8E8E8`,ee=g?`#FFFFFF`:`#141414`,te=(0,C.useCallback)(e=>{e.target===e.currentTarget&&r(null)},[r]),E={...(0,C.useMemo)(()=>{let e=t.background;return e?{background:e}:{background:T,color:ee}},[t.background,T,ee]),borderRadius:t.borderRadius??16,border:t.borderWidth?`${t.borderWidth}px solid ${t.borderColor??`#DFE6E9`}`:void 0,padding:nr(t.padding)},D=(0,C.useMemo)(()=>{if(!n||n.length===0)return[];let t=[{label:`body`,path:null}],r;for(let i=0;i<n.length;i++){let a=n.slice(0,i+1);if(i===0)r=e[n[0]];else if(r){let e=null;r.type===`row`||r.type===`column`||r.type===`grid`?e=r.items:r.type===`accordion`?e=r.body:r.type===`tabs`&&(e=r.tabs[r.defaultActiveTab??0]?.content??null),r=e?.[n[i]]}r&&t.push({label:`${r.type}[${n[i]}]`,path:a})}return t},[n,e]);return(0,I.jsxs)(`div`,{className:`canvas ${m?`preview-mode`:``}`,onClick:te,children:[D.length>1?(0,I.jsx)(`div`,{className:`canvas-breadcrumbs`,children:D.map((e,t)=>(0,I.jsxs)(`span`,{children:[t>0?(0,I.jsx)(`span`,{className:`canvas-bc-sep`,children:`›`}):null,(0,I.jsx)(`button`,{className:`canvas-bc-item ${t===D.length-1?`active`:``}`,onClick:t=>{t.stopPropagation(),r(e.path)},children:e.label})]},t))}):null,(0,I.jsxs)(`div`,{className:`canvas-area`,ref:w,children:[b===`notification`&&k.notification?.showPreview!==!1?(0,I.jsx)(Qn,{platform:x}):(0,I.jsx)(`div`,{style:{width:375*f,height:667*f,flexShrink:0},children:(0,I.jsx)(`div`,{className:`phone-frame`,style:{width:375,height:667,maxHeight:667,transform:`scale(${f})`,transformOrigin:`top left`},children:(0,I.jsxs)(`div`,{className:`phone-screen`,style:g?{background:`#1a1a1a`}:void 0,children:[rr,(0,I.jsxs)(`div`,{className:`chat-messages`,children:[(0,I.jsx)(`div`,{className:`message-date`,children:ar}),(0,I.jsx)(`div`,{className:`bubble-preview`,children:(0,I.jsx)(`div`,{className:`canvas-bubble`,style:E,children:e.length===0?(0,I.jsxs)(`div`,{className:`canvas-empty`,children:[(0,I.jsx)(`span`,{className:`canvas-empty-icon`,children:`+`}),(0,I.jsx)(`span`,{children:`Click an element or component to add it here`}),(0,I.jsx)(cr,{})]}):e.map((t,u)=>(0,I.jsx)(Hn,{element:t,path:[u],selectedPath:n,selectedPaths:c,onSelect:r,onToggleSelect:l,onMove:i,onRemove:a,onWrap:o,onUnwrap:s,onDuplicate:d,isLast:u===e.length-1,isFirst:u===0},u))})})]}),ir]})})}),(0,I.jsx)(tr,{platform:x,setPlatform:S})]}),c.length>=2?(0,I.jsxs)(`div`,{className:`multi-select-bar`,children:[(0,I.jsxs)(`span`,{children:[c.length,` elements selected`]}),(0,I.jsx)(`button`,{onClick:()=>u(`row`),children:`Wrap in Row`}),(0,I.jsx)(`button`,{onClick:()=>u(`column`),children:`Wrap in Column`}),(0,I.jsx)(`button`,{onClick:()=>u(`grid`),children:`Wrap in Grid`})]}):null,(0,I.jsxs)(`div`,{className:`canvas-toolbar`,children:[(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>p(e=>Math.max(.5,e-.1)),title:`Zoom out`,children:`−`}),(0,I.jsxs)(`span`,{className:`canvas-tool-label`,children:[Math.round(f*100),`%`]}),(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>p(e=>Math.min(1.5,e+.1)),title:`Zoom in`,children:`+`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>p(1),title:`Reset zoom`,children:`⊡`}),(0,I.jsx)(`span`,{className:`canvas-tool-sep`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn ${m?`active`:``}`,onClick:()=>h(e=>!e),title:`Preview mode`,children:`👁`}),(0,I.jsx)(`span`,{className:`canvas-tool-sep`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn ${_?`active`:``}`,onClick:()=>v(e=>!e),title:`JSON preview`,children:`{}`}),(0,I.jsx)(`span`,{className:`canvas-tool-sep`}),(0,I.jsx)(`button`,{className:`canvas-tool-btn`,onClick:()=>window.dispatchEvent(new KeyboardEvent(`keydown`,{key:`?`})),title:`Keyboard shortcuts`,children:`?`})]}),_?(0,I.jsxs)(`div`,{className:`json-preview-panel`,children:[(0,I.jsxs)(`div`,{className:`json-preview-header`,children:[(0,I.jsx)(`span`,{children:`JSON Output`}),(0,I.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(y(),null,2))},title:`Copy`,children:`📋`}),(0,I.jsx)(`button`,{onClick:()=>v(!1),children:`×`})]}),(0,I.jsx)(`pre`,{className:`json-preview-code`,children:JSON.stringify(y(),null,2)})]}):null]})}),sr={marginTop:12,padding:`8px 16px`,background:`none`,border:`1px solid var(--border-medium)`,borderRadius:8,fontSize:13,fontWeight:500,color:`var(--accent-primary)`,cursor:`pointer`,transition:`all 0.15s`},cr=(0,C.memo)(function(){let e=F(e=>e.templates),t=F(e=>e.fetchTemplates),n=F(e=>e.setShowTemplatePicker);return(0,C.useState)(()=>{e.length===0&&!k.hideTemplateLibrary&&t()}),k.hideTemplateLibrary?null:(0,I.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n(!0)},style:sr,children:`Load from Saved Template`})}),lr={padding:`0 6px`,borderRadius:4,height:28,border:`1px solid var(--border-subtle)`,background:`var(--bg-secondary)`,cursor:`pointer`,color:`#6852D6`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},ur=(0,I.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`,children:[(0,I.jsx)(`path`,{d:`M1 11v2.056h1c.098 0 .194-.004.29-.013A1 1 0 0 1 3 14v5.056a2.5 2.5 0 0 0 2.5 2.5H8v-2H5.5a.5.5 0 0 1-.5-.5V14c0-.755-.279-1.444-.739-1.972.46-.527.739-1.217.739-1.972V5a.5.5 0 0 1 .5-.5H8v-2H5.5A2.5 2.5 0 0 0 3 5v5.056a1 1 0 0 1-.71.958A3.047 3.047 0 0 0 2 11H1ZM21 10.056a1 1 0 0 0 .71.958c.096-.01.192-.014.29-.014h1v2.056h-1c-.098 0-.194-.004-.29-.013A1 1 0 0 0 21 14v5.056a2.5 2.5 0 0 1-2.5 2.5h-2v-2h2a.5.5 0 0 0 .5-.5V14c0-.755.279-1.444.739-1.972A2.989 2.989 0 0 1 19 10.056V5a.5.5 0 0 0-.5-.5H16v-2h2.5A2.5 2.5 0 0 1 21 5v5.056ZM12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z`}),(0,I.jsx)(`path`,{d:`M17 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM8 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z`})]}),dr=(0,C.memo)(function({value:e,onChange:t,placeholder:n,multiline:r,rows:i,style:a}){let o=F(e=>e.variables),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(``),d=(0,C.useRef)(null),f=(0,C.useRef)(null),[p,m]=(0,C.useState)(null),h=(0,C.useCallback)(()=>{if(s){c(!1),u(``);return}if(f.current){let e=f.current.getBoundingClientRect();m({top:e.bottom+4,left:e.left,width:e.width})}c(!0),u(``)},[s]);(0,C.useEffect)(()=>{if(!s)return;let e=e=>{let t=e.target;f.current?.contains(t)||document.getElementById(`variable-dropdown-portal`)?.contains(t)||c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]);let g=(0,C.useCallback)(n=>{let r=`{{${n}}}`,i=d.current;if(i){let n=i.selectionStart??e.length,a=i.selectionEnd??e.length;t(e.slice(0,n)+r+e.slice(a)),requestAnimationFrame(()=>{let e=n+r.length;i.setSelectionRange(e,e),i.focus()})}else t(e+r);c(!1),u(``)},[e,t]);if(!o||o.length===0)return r?(0,I.jsx)(`textarea`,{ref:d,rows:i??3,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:{resize:`vertical`,...a}}):(0,I.jsx)(`input`,{ref:d,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:a});let _=l?o.filter(e=>e.name.toLowerCase().includes(l.toLowerCase())||(e.label??``).toLowerCase().includes(l.toLowerCase())||(e.description??``).toLowerCase().includes(l.toLowerCase())):o,v=new Map;for(let e of _){let t=e.category??`Variables`;v.has(t)||v.set(t,[]),v.get(t).push(e)}return(0,I.jsxs)(`div`,{ref:f,style:{position:`relative`},children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`center`},children:[(0,I.jsx)(`div`,{style:{flex:1},children:r?(0,I.jsx)(`textarea`,{ref:d,rows:i??3,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:{resize:`vertical`,width:`100%`,...a}}):(0,I.jsx)(`input`,{ref:d,value:e??``,onChange:e=>t(e.target.value),placeholder:n,style:{width:`100%`,...a}})}),(0,I.jsx)(`button`,{type:`button`,onClick:h,style:lr,title:`Insert variable`,children:ur})]}),s&&p&&(0,An.createPortal)((0,I.jsxs)(`div`,{id:`variable-dropdown-portal`,style:{position:`fixed`,top:p.top,left:p.left,width:p.width,zIndex:9999,background:`#fff`,borderRadius:8,border:`1px solid #E2E4E9`,boxShadow:`0 8px 30px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06)`,display:`flex`,flexDirection:`column`,maxHeight:280},children:[(0,I.jsx)(`div`,{style:{padding:`8px 10px`,borderBottom:`1px solid #EFEFEF`,flexShrink:0},children:(0,I.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`Search variables...`,autoFocus:!0,style:{width:`100%`,fontSize:12,border:`1px solid #E2E4E9`,borderRadius:6,padding:`6px 10px`,outline:`none`,background:`#FAFAFA`,color:`#333`,margin:0,boxShadow:`none`}})}),(0,I.jsx)(`div`,{style:{overflowY:`auto`,flex:1,padding:`4px 0`},children:_.length===0?(0,I.jsx)(`div`,{style:{padding:`16px 12px`,fontSize:12,color:`#aaa`,textAlign:`center`},children:`No matching variables`}):[...v.entries()].map(([e,t],n)=>(0,I.jsxs)(`div`,{children:[v.size>1&&(0,I.jsx)(`div`,{style:{fontSize:10,fontWeight:600,color:`#999`,letterSpacing:.5,padding:`6px 12px 3px`,textTransform:`uppercase`,...n>0?{borderTop:`1px solid #F0F0F0`,marginTop:2}:{}},children:e}),t.map(e=>(0,I.jsx)(`div`,{onClick:()=>g(e.name),onMouseEnter:e=>{e.currentTarget.style.background=`#F5F5F7`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},title:[e.label,e.description].filter(Boolean).join(` — `)||void 0,style:{padding:`5px 12px`,cursor:`pointer`,transition:`background 0.1s`},children:(0,I.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`,fontSize:11,color:`#6852D6`},children:`{{${e.name}}}`})},e.name))]},e))})]}),Rn())]})}),fr={Navigation:[`openUrl`],Messaging:[`chatWithUser`,`chatWithGroup`,`sendMessage`],Utility:[`copyToClipboard`,`downloadFile`],CometChat:[`initiateCall`],Data:[`apiCall`],Developer:[`customCallback`]},pr={openUrl:{type:`openUrl`,url:``,openIn:`browser`},chatWithUser:{type:`chatWithUser`,uid:``},chatWithGroup:{type:`chatWithGroup`,guid:``},sendMessage:{type:`sendMessage`,text:``},copyToClipboard:{type:`copyToClipboard`,value:``},downloadFile:{type:`downloadFile`,url:``},initiateCall:{type:`initiateCall`,callType:`audio`},apiCall:{type:`apiCall`,url:``,method:`POST`},customCallback:{type:`customCallback`}},mr=(0,C.memo)(function({action:e,onChange:t}){let n=(0,C.useCallback)(e=>{t(pr[e]??{type:`openUrl`,url:``})},[t]);return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Action Type`}),(0,I.jsx)(`select`,{value:e.type,onChange:e=>n(e.target.value),children:Object.entries(fr).map(([e,t])=>(0,I.jsx)(`optgroup`,{label:e,children:t.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))},e))})]}),hr(e,t)]})});function hr(e,t){switch(e.type){case`openUrl`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`URL`}),(0,I.jsx)(dr,{value:e.url,onChange:n=>t({...e,url:n}),placeholder:`https://...`})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Open In`}),(0,I.jsxs)(`select`,{value:e.openIn??`browser`,onChange:n=>t({...e,openIn:n.target.value}),children:[(0,I.jsx)(`option`,{value:`browser`,children:`Browser`}),(0,I.jsx)(`option`,{value:`webview`,children:`Webview`})]})]})]});case`chatWithUser`:return(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`User UID`}),(0,I.jsx)(dr,{value:e.uid,onChange:n=>t({...e,uid:n})})]});case`chatWithGroup`:return(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Group GUID`}),(0,I.jsx)(dr,{value:e.guid,onChange:n=>t({...e,guid:n})})]});case`sendMessage`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Text`}),(0,I.jsx)(dr,{value:e.text,onChange:n=>t({...e,text:n})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Receiver UID (optional)`}),(0,I.jsx)(dr,{value:e.receiverUid??``,onChange:n=>t({...e,receiverUid:n||void 0})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Receiver GUID (optional)`}),(0,I.jsx)(dr,{value:e.receiverGuid??``,onChange:n=>t({...e,receiverGuid:n||void 0})})]})]});case`copyToClipboard`:return(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Value`}),(0,I.jsx)(dr,{value:e.value,onChange:n=>t({...e,value:n})})]});case`downloadFile`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`URL`}),(0,I.jsx)(dr,{value:e.url,onChange:n=>t({...e,url:n})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Filename`}),(0,I.jsx)(dr,{value:e.filename??``,onChange:n=>t({...e,filename:n||void 0})})]})]});case`initiateCall`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Call Type`}),(0,I.jsxs)(`select`,{value:e.callType,onChange:n=>t({...e,callType:n.target.value}),children:[(0,I.jsx)(`option`,{value:`audio`,children:`Audio`}),(0,I.jsx)(`option`,{value:`video`,children:`Video`})]})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`User UID`}),(0,I.jsx)(dr,{value:e.uid??``,onChange:n=>t({...e,uid:n||void 0})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Group GUID`}),(0,I.jsx)(dr,{value:e.guid??``,onChange:n=>t({...e,guid:n||void 0})})]})]});case`apiCall`:return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`URL`}),(0,I.jsx)(dr,{value:e.url,onChange:n=>t({...e,url:n})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Method`}),(0,I.jsxs)(`select`,{value:e.method??`POST`,onChange:n=>t({...e,method:n.target.value}),children:[(0,I.jsx)(`option`,{value:`GET`,children:`GET`}),(0,I.jsx)(`option`,{value:`POST`,children:`POST`}),(0,I.jsx)(`option`,{value:`PUT`,children:`PUT`}),(0,I.jsx)(`option`,{value:`DELETE`,children:`DELETE`})]})]})]});case`customCallback`:return(0,I.jsx)(`div`,{style:{fontSize:12,color:`var(--text-muted)`,padding:`4px 0`},children:`No additional properties`});default:return null}}var gr={maxHeight:220,overflowY:`auto`,padding:4,border:`1px solid var(--border-subtle)`,borderRadius:6,marginTop:4},_r={display:`flex`,flexWrap:`wrap`,gap:4,padding:`2px 0`},vr={width:34,height:34,borderRadius:6,border:`1px solid transparent`,background:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:2},yr={width:20,height:20,objectFit:`contain`},br=(0,C.memo)(function({value:e,onChange:t}){let[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(``),o=(0,C.useCallback)(e=>{let n=Mn.find(t=>t.name===e);t(n?n.url:e),r(!1),a(``)},[t]),s=Fn(e),c=Mn.find(t=>t.url===e),l=c?c.label:e,u=e&&(e.startsWith(`http`)||e.startsWith(`/`)||c),d=i.toLowerCase(),f=d?Mn.filter(e=>e.name.includes(d)||e.label.toLowerCase().includes(d)):Mn;return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[u?(0,I.jsx)(`img`,{src:s,alt:``,style:{width:20,height:20,objectFit:`contain`}}):null,(0,I.jsx)(`input`,{value:l,readOnly:!0,placeholder:`Select an icon`,style:{flex:1,cursor:`pointer`},onClick:()=>r(e=>!e)}),(0,I.jsx)(`button`,{onClick:()=>r(e=>!e),style:{padding:`4px 8px`,fontSize:11,borderRadius:4,border:`1px solid var(--border-subtle)`,background:`var(--bg-secondary)`,cursor:`pointer`},title:`Browse icons`,children:n?`▲`:`▼`})]}),e?(0,I.jsx)(`div`,{style:{fontSize:10,color:`var(--text-muted)`,marginTop:2,wordBreak:`break-all`},children:e}):null,n?(0,I.jsxs)(`div`,{style:{marginTop:4},children:[(0,I.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Search icons...`,style:{width:`100%`,marginBottom:4,fontSize:11}}),(0,I.jsxs)(`div`,{style:gr,children:[Pn.map(t=>{let n=f.filter(e=>e.category===t);return n.length===0?null:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{style:{fontSize:10,color:`var(--text-muted)`,padding:`6px 2px 2px`,fontWeight:600},children:t}),(0,I.jsx)(`div`,{style:_r,children:n.map(t=>(0,I.jsx)(`button`,{onClick:()=>o(t.name),title:t.label,style:{...vr,borderColor:e===t.url?`var(--accent-primary)`:`transparent`,background:e===t.url?`rgba(108,92,231,0.1)`:`none`},children:(0,I.jsx)(`img`,{src:t.url,alt:t.label,style:yr})},t.name))})]},t)}),f.length===0?(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,padding:8,textAlign:`center`},children:[`No icons match "`,i,`"`]}):null]})]}):null]})}),xr=/^(https?:\/\/|{{)/i;function Sr(e){let t=[];switch(e.type){case`text`:e.content||t.push({field:`content`,message:`Content is required`});break;case`image`:e.url?xr.test(e.url)||t.push({field:`url`,message:`Must be a valid URL`}):t.push({field:`url`,message:`URL is required`});break;case`icon`:e.name||t.push({field:`name`,message:`Icon name is required`});break;case`spacer`:(e.height==null||e.height<0)&&t.push({field:`height`,message:`Height must be ≥ 0`});break;case`button`:e.label||t.push({field:`label`,message:`Label is required`}),e.action?Cr(e.action,t):t.push({field:`action`,message:`Action is required`});break;case`iconButton`:e.icon||t.push({field:`icon`,message:`Icon is required`}),e.action?Cr(e.action,t):t.push({field:`action`,message:`Action is required`});break;case`link`:e.text||t.push({field:`text`,message:`Text is required`}),e.action?Cr(e.action,t):t.push({field:`action`,message:`Action is required`});break;case`badge`:case`chip`:e.text||t.push({field:`text`,message:`Text is required`});break;case`progressBar`:(e.value<0||e.value>100)&&t.push({field:`value`,message:`Must be 0–100`});break;case`table`:(!e.columns||e.columns.length===0)&&t.push({field:`columns`,message:`At least one column is required`}),(!e.rows||e.rows.length===0)&&t.push({field:`rows`,message:`At least one row is required`});break;case`codeBlock`:e.content||t.push({field:`content`,message:`Content is required`});break;case`markdown`:e.content||t.push({field:`content`,message:`Content is required`});break;case`accordion`:e.header||t.push({field:`header`,message:`Header is required`});break}return t}function Cr(e,t){switch(e.type){case`openUrl`:e.url||t.push({field:`action.url`,message:`URL is required for openUrl action`});break;case`chatWithUser`:e.uid||t.push({field:`action.uid`,message:`User ID is required`});break;case`chatWithGroup`:e.guid||t.push({field:`action.guid`,message:`Group ID is required`});break;case`sendMessage`:e.text||t.push({field:`action.text`,message:`Message text is required`});break;case`copyToClipboard`:e.value||t.push({field:`action.value`,message:`Value is required`});break;case`downloadFile`:e.url||t.push({field:`action.url`,message:`File URL is required`});break;case`apiCall`:e.url||t.push({field:`action.url`,message:`API URL is required`});break}}function wr(e){return Sr(e).length>0}var Tr=(0,C.memo)(function({element:e,onUpdate:t}){let n=(0,C.useMemo)(()=>Sr(e),[e]),r=(0,C.useMemo)(()=>{let e=new Map;for(let t of n)e.set(t.field,t.message);return e},[n]);return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`prop-badge`,children:e.type}),(0,I.jsx)(B,{label:`ID`,children:(0,I.jsx)(`input`,{defaultValue:e.id,onBlur:e=>t({id:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},style:{fontFamily:`var(--font-mono)`,fontSize:11}})}),n.length>0&&(0,I.jsxs)(`div`,{className:`prop-error-summary`,children:[`⚠ `,n.length,` issue`,n.length===1?``:`s`]}),Ur(e,t,r)]},e.id)});function B({label:e,children:t,error:n}){return(0,I.jsxs)(`div`,{className:`prop-field ${n?`prop-field-error`:``}`,children:[(0,I.jsxs)(`label`,{className:`prop-label`,children:[e,n?(0,I.jsx)(`span`,{className:`prop-field-error-hint`,children:n}):null]}),t]})}function Er({value:e,onChange:t,placeholder:n}){return(0,I.jsx)(dr,{value:e??``,onChange:t,placeholder:n})}function V({value:e,onChange:t,min:n,max:r,unit:i}){return(0,I.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`},children:[(0,I.jsx)(`input`,{type:`number`,value:e??``,onChange:e=>t(e.target.value===``?void 0:Number(e.target.value)),min:n,max:r,style:i?{paddingRight:28}:void 0}),i?(0,I.jsx)(`span`,{style:{position:`absolute`,right:8,fontSize:11,color:`var(--text-muted)`,pointerEvents:`none`},children:i}):null]})}var Dr=[{label:`Small (28px)`,value:28},{label:`Medium (36px)`,value:36},{label:`Large (48px)`,value:48}];function Or({value:e,onChange:t}){let n=e??36,r=Dr.some(e=>e.value===n),[i,a]=(0,C.useState)(!1),o=i||!r;return(0,I.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,I.jsxs)(`select`,{value:o?`custom`:String(n),onChange:e=>{if(e.target.value===`custom`){a(!0);return}a(!1),t(Number(e.target.value))},children:[Dr.map(e=>(0,I.jsx)(`option`,{value:e.value,children:e.label},e.value)),(0,I.jsx)(`option`,{value:`custom`,children:`Custom`})]}),o?(0,I.jsx)(V,{value:n,onChange:e=>t(e??36),min:12,unit:`px`}):null]})}function kr({value:e,onChange:t,options:n}){return(0,I.jsxs)(`select`,{value:e??``,onChange:e=>t(e.target.value||void 0),children:[(0,I.jsx)(`option`,{value:``,children:`Default`}),n.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))]})}var Ar={width:32,height:28,padding:0,border:`none`,cursor:`pointer`,position:`absolute`,opacity:0,top:0,left:0},jr={display:`flex`,alignItems:`center`,gap:6},Mr={width:32,height:28,borderRadius:4,position:`relative`,overflow:`hidden`,cursor:`pointer`},Nr={padding:`2px 6px`,fontSize:10,borderRadius:4,background:`var(--bg-tertiary)`,border:`1px solid var(--border-medium)`,cursor:`pointer`,color:`var(--text-secondary)`},Pr={width:32,height:28,borderRadius:4,position:`relative`,overflow:`hidden`,cursor:`pointer`,background:`repeating-conic-gradient(#d0d0d0 0% 25%, #f0f0f0 0% 50%) 50% / 10px 10px`,border:`1px solid var(--border-medium)`};function H({value:e,onChange:t,fallback:n}){let r=e??n,i=e==null&&n!=null;return(0,I.jsxs)(`div`,{style:jr,children:[(0,I.jsx)(`div`,{style:r?{...Mr,background:r,border:`1px solid var(--border-medium)`,opacity:i?.5:1}:Pr,children:(0,I.jsx)(`input`,{type:`color`,value:r??`#000000`,onChange:e=>t(e.target.value),style:Ar,title:i?`Default: ${n}`:e??`No color (transparent)`})}),e&&!n?(0,I.jsx)(`button`,{onClick:()=>t(void 0),style:Nr,title:`Remove color`,children:`✕`}):null]})}function Fr({value:e,onChange:t,label:n}){return(0,I.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:13,cursor:`pointer`},children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:e??!1,onChange:e=>t(e.target.checked)}),n]})}var Ir={display:`flex`,gap:4,alignItems:`center`},Lr={padding:`4px 6px`,fontSize:10,borderRadius:4,background:`var(--bg-tertiary)`,border:`1px solid var(--border-medium)`,cursor:`pointer`,color:`var(--text-secondary)`,whiteSpace:`nowrap`},Rr={display:`flex`,flexDirection:`column`,gap:4},zr={display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:4},Br={fontSize:10,color:`var(--text-muted)`},Vr={padding:`2px 6px`,fontSize:10,borderRadius:4,background:`var(--bg-tertiary)`,border:`1px solid var(--border-medium)`,cursor:`pointer`,color:`var(--text-secondary)`,alignSelf:`flex-start`};function Hr({value:e,onChange:t}){let[n,r]=(0,C.useState)(typeof e==`object`&&!!e);if(!n)return(0,I.jsxs)(`div`,{style:Ir,children:[(0,I.jsx)(`div`,{style:{flex:1},children:(0,I.jsx)(V,{value:typeof e==`number`?e:void 0,onChange:e=>t(e),min:0,unit:`px`})}),(0,I.jsx)(`button`,{onClick:()=>{r(!0);let n=typeof e==`number`?e:0;t({top:n,right:n,bottom:n,left:n})},style:Lr,title:`Edit each side`,children:`⊞`})]});let i=typeof e==`object`&&e?e:{top:0,right:0,bottom:0,left:0},a=(e,n)=>t({...i,[e]:n??0});return(0,I.jsxs)(`div`,{style:Rr,children:[(0,I.jsxs)(`div`,{style:zr,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Top`}),(0,I.jsx)(V,{value:i.top,onChange:e=>a(`top`,e),min:0,unit:`px`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Right`}),(0,I.jsx)(V,{value:i.right,onChange:e=>a(`right`,e),min:0,unit:`px`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Bottom`}),(0,I.jsx)(V,{value:i.bottom,onChange:e=>a(`bottom`,e),min:0,unit:`px`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`label`,{style:Br,children:`Left`}),(0,I.jsx)(V,{value:i.left,onChange:e=>a(`left`,e),min:0,unit:`px`})]})]}),(0,I.jsx)(`button`,{onClick:()=>{r(!1),t(Math.round(((i.top??0)+(i.right??0)+(i.bottom??0)+(i.left??0))/4)||void 0)},style:Vr,children:`Collapse`})]})}function Ur(e,t,n=new Map){let r=e=>n.get(e);switch(e.type){case`text`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Content`,error:r(`content`),children:(0,I.jsx)(dr,{multiline:!0,rows:3,value:e.content,onChange:e=>t({content:e})})}),(0,I.jsx)(B,{label:`Variant`,children:(0,I.jsx)(kr,{value:e.variant,onChange:e=>t({variant:e}),options:[`title`,`heading1`,`heading2`,`heading3`,`heading4`,`body`,`caption1`,`caption2`]})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#2D3436`})}),(0,I.jsx)(B,{label:`Align`,children:(0,I.jsx)(kr,{value:e.align,onChange:e=>t({align:e}),options:[`left`,`center`,`right`,`justify`]})}),(0,I.jsx)(B,{label:`Font Weight`,children:(0,I.jsx)(kr,{value:e.fontWeight,onChange:e=>t({fontWeight:e}),options:[`regular`,`medium`,`bold`]})}),(0,I.jsx)(B,{label:`Max Lines`,children:(0,I.jsx)(V,{value:e.maxLines,onChange:e=>t({maxLines:e}),min:1})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})})]});case`image`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`URL`,error:r(`url`),children:(0,I.jsx)(Er,{value:e.url,onChange:e=>t({url:e}),placeholder:`https://...`})}),e.url&&!e.url.includes(`{{`)?(0,I.jsx)(`div`,{style:{padding:`4px 0`},children:(0,I.jsx)(`img`,{src:e.url,alt:`Preview`,style:{width:`100%`,maxHeight:80,objectFit:`cover`,borderRadius:4,border:`1px solid var(--border-subtle)`},onError:e=>{e.target.style.display=`none`}})}):null,(0,I.jsx)(B,{label:`Alt Text`,children:(0,I.jsx)(Er,{value:e.altText??``,onChange:e=>t({altText:e})})}),(0,I.jsx)(B,{label:`Fit`,children:(0,I.jsx)(kr,{value:e.fit,onChange:e=>t({fit:e}),options:[`cover`,`contain`,`fill`]})}),(0,I.jsx)(B,{label:`Width`,children:(0,I.jsx)(V,{value:typeof e.width==`number`?e.width:void 0,onChange:e=>t({width:e}),unit:`px`})}),(0,I.jsx)(B,{label:`Height`,children:(0,I.jsx)(V,{value:typeof e.height==`number`?e.height:void 0,onChange:e=>t({height:e}),unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})})]});case`icon`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Name`,error:r(`name`),children:(0,I.jsx)(br,{value:e.name,onChange:e=>t({name:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#666666`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(V,{value:e.padding,onChange:e=>t({padding:e}),min:0,unit:`px`})})]});case`avatar`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Image URL`,children:(0,I.jsx)(Er,{value:e.imageUrl??``,onChange:e=>t({imageUrl:e})})}),(0,I.jsx)(B,{label:`Fallback Initials`,children:(0,I.jsx)(Er,{value:e.fallbackInitials??``,onChange:e=>t({fallbackInitials:e.slice(0,2)})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(Or,{value:e.size,onChange:e=>t({size:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Weight`,children:(0,I.jsx)(kr,{value:e.fontWeight,onChange:e=>t({fontWeight:e}),options:[`regular`,`medium`,`bold`]})})]});case`badge`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Text`,error:r(`text`),children:(0,I.jsx)(Er,{value:e.text,onChange:e=>t({text:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#FFFFFF`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:n=>{let r={borderWidth:n};n&&!e.borderColor&&(r.borderColor=`#000000`),t(r)},min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})})]});case`divider`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#e0e0e0`})}),(0,I.jsx)(B,{label:`Thickness`,children:(0,I.jsx)(V,{value:e.thickness,onChange:e=>t({thickness:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Margin`,children:(0,I.jsx)(V,{value:e.margin,onChange:e=>t({margin:e}),min:0,unit:`px`})})]});case`spacer`:return(0,I.jsx)(`div`,{className:`prop-group`,children:(0,I.jsx)(B,{label:`Height`,error:r(`height`),children:(0,I.jsx)(V,{value:e.height,onChange:e=>t({height:e??16}),min:0,unit:`px`})})});case`chip`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Text`,error:r(`text`),children:(0,I.jsx)(Er,{value:e.text,onChange:e=>t({text:e})})}),(0,I.jsx)(B,{label:`Icon`,children:(0,I.jsx)(br,{value:e.icon??``,onChange:e=>t({icon:e})})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#333333`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:n=>{let r={borderWidth:n};n&&!e.borderColor&&(r.borderColor=`#000000`),t(r)},min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})})]});case`progressBar`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Value (0-100)`,error:r(`value`),children:(0,I.jsx)(V,{value:e.value,onChange:e=>t({value:e??0}),min:0,max:100})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#6C5CE7`})}),(0,I.jsx)(B,{label:`Track Color`,children:(0,I.jsx)(H,{value:e.trackColor,onChange:e=>t({trackColor:e}),fallback:`#e0e0e0`})}),(0,I.jsx)(B,{label:`Height`,children:(0,I.jsx)(V,{value:e.height,onChange:e=>t({height:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Label`,children:(0,I.jsx)(Er,{value:e.label??``,onChange:e=>t({label:e})})}),(0,I.jsx)(B,{label:`Label Font Size`,children:(0,I.jsx)(V,{value:e.labelFontSize,onChange:e=>t({labelFontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Label Color`,children:(0,I.jsx)(H,{value:e.labelColor,onChange:e=>t({labelColor:e}),fallback:`#666666`})})]});case`button`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Label`,error:r(`label`),children:(0,I.jsx)(Er,{value:e.label,onChange:e=>t({label:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.textColor,onChange:e=>t({textColor:e}),fallback:`#FFFFFF`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:n=>{let r={borderWidth:n};n&&!e.borderColor&&(r.borderColor=`#000000`),t(r)},min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Icon`,children:(0,I.jsx)(br,{value:e.icon??``,onChange:e=>t({icon:e})})}),(0,I.jsx)(B,{label:`Icon Position`,children:(0,I.jsx)(kr,{value:e.iconPosition,onChange:e=>t({iconPosition:e}),options:[`left`,`right`]})}),(0,I.jsx)(Fr,{value:e.fullWidth,onChange:e=>t({fullWidth:e}),label:`Full Width`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Action`}),(0,I.jsx)(mr,{action:e.action,onChange:e=>t({action:e})})]});case`iconButton`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Icon`,error:r(`icon`),children:(0,I.jsx)(br,{value:e.icon,onChange:e=>t({icon:e})})}),(0,I.jsx)(B,{label:`Size`,children:(0,I.jsx)(V,{value:e.size,onChange:e=>t({size:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#333333`})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Action`}),(0,I.jsx)(mr,{action:e.action,onChange:e=>t({action:e})})]});case`link`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Text`,error:r(`text`),children:(0,I.jsx)(Er,{value:e.text,onChange:e=>t({text:e})})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e}),fallback:`#6C5CE7`})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(Fr,{value:e.underline,onChange:e=>t({underline:e}),label:`Underline`}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Action`}),(0,I.jsx)(mr,{action:e.action,onChange:e=>t({action:e})})]});case`table`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Columns (comma-separated)`,error:r(`columns`),children:(0,I.jsx)(Er,{value:e.columns.join(`, `),onChange:e=>t({columns:e.split(`,`).map(e=>e.trim())})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Rows`}),e.rows.map((n,r)=>(0,I.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`center`,marginBottom:4},children:[(0,I.jsx)(`input`,{defaultValue:n.join(`, `),onBlur:n=>{let i=[...e.rows];i[r]=n.target.value.split(`,`).map(e=>e.trim()),t({rows:i})},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()},style:{flex:1},placeholder:e.columns.join(`, `)}),(0,I.jsx)(`button`,{style:{width:24,height:24,borderRadius:4,fontSize:12,color:`var(--text-tertiary)`,flexShrink:0},onClick:()=>t({rows:e.rows.filter((e,t)=>t!==r)}),title:`Remove row`,children:`×`})]},r)),(0,I.jsx)(`button`,{style:{fontSize:11,color:`var(--accent-primary)`,padding:`4px 0`,background:`none`,border:`none`,cursor:`pointer`},onClick:()=>t({rows:[...e.rows,e.columns.map(()=>``)]}),children:`+ Add Row`}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Header Background`,children:(0,I.jsx)(H,{value:e.headerBackgroundColor,onChange:e=>t({headerBackgroundColor:e})})}),(0,I.jsx)(Fr,{value:e.border,onChange:e=>t({border:e}),label:`Show Borders`}),(0,I.jsx)(Fr,{value:e.stripedRows,onChange:e=>t({stripedRows:e}),label:`Striped Rows`}),(0,I.jsx)(B,{label:`Cell Padding`,children:(0,I.jsx)(V,{value:e.cellPadding,onChange:e=>t({cellPadding:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Striped Row Color`,children:(0,I.jsx)(H,{value:e.stripedRowColor,onChange:e=>t({stripedRowColor:e})})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})})]});case`row`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Layout`}),(0,I.jsx)(B,{label:`Gap`,children:(0,I.jsx)(V,{value:e.gap,onChange:e=>t({gap:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Align`,children:(0,I.jsx)(kr,{value:e.align,onChange:e=>t({align:e}),options:[`start`,`center`,`end`,`spaceBetween`,`spaceAround`]})}),(0,I.jsx)(Fr,{value:e.wrap,onChange:e=>t({wrap:e}),label:`Wrap`}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Scrollable`}),(0,I.jsx)(Fr,{value:e.scrollable,onChange:e=>t({scrollable:e}),label:`Scrollable (Carousel)`}),e.scrollable?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(B,{label:`Peek`,children:(0,I.jsx)(V,{value:e.peek,onChange:e=>t({peek:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Snap`,children:(0,I.jsx)(kr,{value:e.snap,onChange:e=>t({snap:e}),options:[`item`,`free`]})})]}):null,(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Spacing`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:e=>t({borderWidth:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,marginTop:4},children:[e.items.length,` child element`,e.items.length===1?``:`s`]})]});case`column`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Layout`}),(0,I.jsx)(B,{label:`Gap`,children:(0,I.jsx)(V,{value:e.gap,onChange:e=>t({gap:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Align`,children:(0,I.jsx)(kr,{value:e.align,onChange:e=>t({align:e}),options:[`start`,`center`,`end`,`stretch`]})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Spacing`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:e=>t({borderWidth:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,marginTop:4},children:[e.items.length,` child element`,e.items.length===1?``:`s`]})]});case`grid`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Layout`}),(0,I.jsx)(B,{label:`Columns`,children:(0,I.jsx)(kr,{value:String(e.columns??2),onChange:e=>t({columns:Number(e)}),options:[`2`,`3`,`4`]})}),(0,I.jsx)(B,{label:`Gap`,children:(0,I.jsx)(V,{value:e.gap,onChange:e=>t({gap:e}),min:0,unit:`px`})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Spacing`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginTop:12},children:`Style`}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Width`,children:(0,I.jsx)(V,{value:e.borderWidth,onChange:e=>t({borderWidth:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Border Color`,children:(0,I.jsx)(H,{value:e.borderColor,onChange:e=>t({borderColor:e})})}),(0,I.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-muted)`,marginTop:4},children:[e.items.length,` child element`,e.items.length===1?``:`s`]})]});case`accordion`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Header`,error:r(`header`),children:(0,I.jsx)(Er,{value:e.header,onChange:e=>t({header:e})})}),(0,I.jsx)(B,{label:`Header Icon`,children:(0,I.jsx)(br,{value:e.headerIcon??``,onChange:e=>t({headerIcon:e})})}),(0,I.jsx)(Fr,{value:e.expandedByDefault,onChange:e=>t({expandedByDefault:e}),label:`Expanded by Default`}),(0,I.jsx)(Fr,{value:e.border,onChange:e=>t({border:e}),label:`Show Border`}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Weight`,children:(0,I.jsx)(kr,{value:e.fontWeight,onChange:e=>t({fontWeight:e}),options:[`regular`,`medium`,`bold`]})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})})]});case`tabs`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Tab Labels (comma-separated)`,children:(0,I.jsx)(Er,{value:e.tabs.map(e=>e.label).join(`, `),onChange:n=>{t({tabs:n.split(`,`).map(e=>e.trim()).map((t,n)=>({label:t,content:e.tabs[n]?.content??[]}))})}})}),(0,I.jsx)(B,{label:`Active Tab`,children:(0,I.jsx)(`select`,{value:e.defaultActiveTab??0,onChange:e=>t({defaultActiveTab:Number(e.target.value)}),children:e.tabs.map((e,t)=>(0,I.jsx)(`option`,{value:t,children:e.label},t))})}),(0,I.jsx)(B,{label:`Tab Align`,children:(0,I.jsx)(kr,{value:e.tabAlign,onChange:e=>t({tabAlign:e}),options:[`start`,`center`,`stretch`]})}),(0,I.jsx)(B,{label:`Tab Padding`,children:(0,I.jsx)(Hr,{value:e.tabPadding,onChange:e=>t({tabPadding:e})})}),(0,I.jsx)(B,{label:`Content Padding`,children:(0,I.jsx)(Hr,{value:e.contentPadding,onChange:e=>t({contentPadding:e})})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})})]});case`codeBlock`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Content`,error:r(`content`),children:(0,I.jsx)(dr,{multiline:!0,rows:4,value:e.content,onChange:e=>t({content:e}),style:{fontFamily:`monospace`}})}),(0,I.jsx)(B,{label:`Language`,children:(0,I.jsx)(Er,{value:e.language??``,onChange:e=>t({language:e})})}),(0,I.jsx)(B,{label:`Background`,children:(0,I.jsx)(H,{value:e.backgroundColor,onChange:e=>t({backgroundColor:e})})}),(0,I.jsx)(B,{label:`Text Color`,children:(0,I.jsx)(H,{value:e.textColor,onChange:e=>t({textColor:e})})}),(0,I.jsx)(B,{label:`Padding`,children:(0,I.jsx)(Hr,{value:e.padding,onChange:e=>t({padding:e})})}),(0,I.jsx)(B,{label:`Border Radius`,children:(0,I.jsx)(V,{value:e.borderRadius,onChange:e=>t({borderRadius:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Font Size`,children:(0,I.jsx)(V,{value:e.fontSize,onChange:e=>t({fontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Language Label Size`,children:(0,I.jsx)(V,{value:e.languageLabelFontSize,onChange:e=>t({languageLabelFontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Language Label Color`,children:(0,I.jsx)(H,{value:e.languageLabelColor,onChange:e=>t({languageLabelColor:e})})})]});case`markdown`:return(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(B,{label:`Content`,error:r(`content`),children:(0,I.jsx)(dr,{multiline:!0,rows:4,value:e.content,onChange:e=>t({content:e})})}),(0,I.jsx)(B,{label:`Base Font Size`,children:(0,I.jsx)(V,{value:e.baseFontSize,onChange:e=>t({baseFontSize:e}),min:0,unit:`px`})}),(0,I.jsx)(B,{label:`Color`,children:(0,I.jsx)(H,{value:e.color,onChange:e=>t({color:e})})}),(0,I.jsx)(B,{label:`Line Height`,children:(0,I.jsx)(V,{value:e.lineHeight,onChange:e=>t({lineHeight:e}),min:0})}),(0,I.jsx)(B,{label:`Link Color`,children:(0,I.jsx)(H,{value:e.linkColor,onChange:e=>t({linkColor:e})})})]});default:return(0,I.jsx)(`div`,{className:`rp-empty`,children:`No properties for this element type`})}}var Wr=(0,C.memo)(function(){let e=F(e=>e.settings),t=F(e=>e.updateSettings),n=F(e=>e.fallbackText),r=F(e=>e.setFallbackText);return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`prop-badge`,children:`BUBBLE`}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Background`}),(0,I.jsx)(`div`,{className:`prop-field`,children:(0,I.jsx)(`input`,{type:`color`,value:e.background??`#E8E8E8`,onChange:e=>t({background:e.target.value}),style:{width:32,height:28,padding:0,border:`none`}})})]}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Border & Shape`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Border Radius (px)`}),(0,I.jsx)(`input`,{type:`number`,value:e.borderRadius??``,onChange:e=>t({borderRadius:e.target.value?Number(e.target.value):void 0}),min:0})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Border Width`}),(0,I.jsx)(`input`,{type:`number`,value:e.borderWidth??``,onChange:e=>t({borderWidth:e.target.value?Number(e.target.value):void 0}),min:0})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Border Color`}),(0,I.jsx)(`input`,{type:`color`,value:e.borderColor??`#DFE6E9`,onChange:e=>t({borderColor:e.target.value}),style:{width:32,height:28,padding:0,border:`none`}})]})]}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Spacing`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Padding`}),(0,I.jsx)(`input`,{type:`number`,value:typeof e.padding==`number`?e.padding:``,onChange:e=>t({padding:e.target.value?Number(e.target.value):void 0}),min:0})]})]}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Text`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Fallback Text (required)`}),(0,I.jsx)(dr,{multiline:!0,rows:3,value:n,onChange:r,placeholder:`Plain text for older UI Kit versions`})]})]})]})}),Gr=(0,C.memo)(function(){let e=F(e=>e.notificationTitle),t=F(e=>e.notificationBody),n=F(e=>e.notificationData),r=F(e=>e.setNotificationTitle),i=F(e=>e.setNotificationBody),a=F(e=>e.setNotificationData),o=k.notification?.enableData,s=(0,C.useCallback)(()=>{a([...n,{key:``,value:``}])},[n,a]),c=(0,C.useCallback)((e,t,r)=>{a(n.map((n,i)=>i===e?{...n,[t]:r}:n))},[n,a]),l=(0,C.useCallback)(e=>{a(n.filter((t,n)=>n!==e))},[n,a]);return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`prop-badge`,children:`NOTIFICATION`}),(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsx)(`div`,{className:`prop-group-title`,children:`Push Notification Content`}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Title`}),(0,I.jsx)(dr,{value:e,onChange:r,placeholder:`Notification title...`})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Body`}),(0,I.jsx)(dr,{value:t,onChange:i,placeholder:`Notification body...`,multiline:!0,rows:3})]})]}),o&&(0,I.jsxs)(`div`,{className:`prop-group`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,I.jsx)(`div`,{className:`prop-group-title`,style:{marginBottom:0},children:`Data`}),(0,I.jsx)(`button`,{onClick:s,className:`prop-label`,style:{fontWeight:600,color:`var(--accent-primary)`,background:`var(--accent-light)`,border:`1px solid var(--border-accent)`,borderRadius:6,padding:`4px 10px`,cursor:`pointer`},children:`Add +`})]}),n.length===0?(0,I.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`8px 0`},children:`No data entries. Click "Add +" to add key-value pairs.`}):n.map((e,t)=>(0,I.jsxs)(`div`,{style:{border:`1px solid var(--border-subtle)`,borderRadius:6,padding:10,marginBottom:6},children:[(0,I.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,I.jsxs)(`span`,{className:`prop-label`,style:{fontWeight:600,marginBottom:0},children:[`Data `,t+1]}),(0,I.jsx)(`button`,{onClick:()=>l(t),title:`Remove`,style:{color:`var(--text-secondary)`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,I.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,I.jsx)(`path`,{d:`M8.5 2A2.5 2.5 0 0 0 6 4.5V6h2V4.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5V6h2V4.5A2.5 2.5 0 0 0 15.5 2h-7ZM13 18v-6h2v6h-2ZM9 12v6h2v-6H9Z`}),(0,I.jsx)(`path`,{fillRule:`evenodd`,d:`M4 7.5h16v.016h2v2h-2V19.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 4 19.5V9.516H2v-2h2V7.5Zm14 2.016H6V19.5a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5V9.516Z`,clipRule:`evenodd`})]})})]}),(0,I.jsxs)(`div`,{className:`prop-field`,children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Key`}),(0,I.jsx)(`input`,{value:e.key,onChange:e=>c(t,`key`,e.target.value),placeholder:`Up to 10 characters`,maxLength:10})]}),(0,I.jsxs)(`div`,{className:`prop-field`,style:{marginBottom:0},children:[(0,I.jsx)(`label`,{className:`prop-label`,children:`Value (optional)`}),(0,I.jsx)(`input`,{value:e.value,onChange:e=>c(t,`value`,e.target.value),placeholder:`Up to 50 characters`,maxLength:50})]})]},t))]}),(0,I.jsx)(`div`,{style:{color:`var(--text-muted)`,padding:`8px 12px`,lineHeight:1.5},children:`The notification preview is shown in the canvas area. Edit the title and body here to see it update in real-time.`})]})}),Kr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function qr(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Jr(e){return`nodeType`in e}function Yr(e){return e?qr(e)?e:Jr(e)?e.ownerDocument?.defaultView??window:window:window}function Xr(e){let{Document:t}=Yr(e);return e instanceof t}function Zr(e){return qr(e)?!1:e instanceof Yr(e).HTMLElement}function Qr(e){return e instanceof Yr(e).SVGElement}function $r(e){return e?qr(e)?e.document:Jr(e)?Xr(e)?e:Zr(e)||Qr(e)?e.ownerDocument:document:document:document}var ei=Kr?C.useLayoutEffect:C.useEffect;function ti(e){let t=(0,C.useRef)(e);return ei(()=>{t.current=e}),(0,C.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function ni(){let e=(0,C.useRef)(null);return[(0,C.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,C.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function ri(e,t){t===void 0&&(t=[e]);let n=(0,C.useRef)(e);return ei(()=>{n.current!==e&&(n.current=e)},t),n}function ii(e,t){let n=(0,C.useRef)();return(0,C.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function ai(e){let t=ti(e),n=(0,C.useRef)(null);return[n,(0,C.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function oi(e){let t=(0,C.useRef)();return(0,C.useEffect)(()=>{t.current=e},[e]),t.current}var si={};function ci(e,t){return(0,C.useMemo)(()=>{if(t)return t;let n=si[e]==null?0:si[e]+1;return si[e]=n,e+`-`+n},[e,t])}function li(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var ui=li(1),di=li(-1);function fi(e){return`clientX`in e&&`clientY`in e}function pi(e){if(!e)return!1;let{KeyboardEvent:t}=Yr(e.target);return t&&e instanceof t}function mi(e){if(!e)return!1;let{TouchEvent:t}=Yr(e.target);return t&&e instanceof t}function hi(e){if(mi(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return fi(e)?{x:e.clientX,y:e.clientY}:null}var gi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[gi.Translate.toString(e),gi.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),_i=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function vi(e){return e.matches(_i)?e:e.querySelector(_i)}var yi={display:`none`};function bi(e){let{id:t,value:n}=e;return C.createElement(`div`,{id:t,style:yi},n)}function xi(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return C.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Si(){let[e,t]=(0,C.useState)(``);return{announce:(0,C.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Ci=(0,C.createContext)(null);function wi(e){let t=(0,C.useContext)(Ci);(0,C.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ti(){let[e]=(0,C.useState)(()=>new Set),t=(0,C.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,C.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Ei={draggable:`
17
17
  To pick up a draggable item, press the space bar.
18
18
  While dragging, use the arrow keys to move the item.
19
19
  Press space again to drop the item in its new position, or press escape to cancel.
20
- `},Di={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Oi(e){let{announcements:t=Di,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ei}=e,{announce:a,announcement:o}=Si(),s=ci(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),wi((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(bi,{id:r,value:i.draggable}),C.createElement(xi,{id:s,announcement:o}));return n?(0,An.createPortal)(u,n):u}var U;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(U||={});function W(){}function G(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function ki(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,C.useMemo)(()=>[...t].filter(e=>e!=null),[...t])}var Ai=Object.freeze({x:0,y:0});function ji(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Mi(e,t){let n=hi(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Ni(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Pi(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Fi(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Ii(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Li=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Ii(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ji(Ii(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Ni)};function Ri(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var zi=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Ri(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Pi)};function Bi(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Vi(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ai}function Hi(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Ui=Hi(1);function Wi(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Gi(e,t,n){let r=Wi(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Ki={ignoreTransform:!1};function qi(e,t){t===void 0&&(t=Ki);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Yr(e).getComputedStyle(e);t&&(n=Gi(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Ji(e){return qi(e,{ignoreTransform:!0})}function Yi(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Xi(e,t){return t===void 0&&(t=Yr(e).getComputedStyle(e)),t.position===`fixed`}function Zi(e,t){t===void 0&&(t=Yr(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Qi(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Xr(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Zr(i)||Qr(i)||n.includes(i))return n;let a=Yr(e).getComputedStyle(i);return i!==e&&Zi(i,a)&&n.push(i),Xi(i,a)?n:r(i.parentNode)}return e?r(e):n}function $i(e){let[t]=Qi(e,1);return t??null}function ea(e){return!Kr||!e?null:qr(e)?e:Jr(e)?Xr(e)||e===$r(e).scrollingElement?window:Zr(e)?e:null:null}function ta(e){return qr(e)?e.scrollX:e.scrollLeft}function na(e){return qr(e)?e.scrollY:e.scrollTop}function ra(e){return{x:ta(e),y:na(e)}}var ia;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(ia||={});function aa(e){return!Kr||!e?!1:e===document.scrollingElement}function oa(e){let t={x:0,y:0},n=aa(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var sa={x:.2,y:.2};function ca(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=sa);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=oa(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=ia.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=ia.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=ia.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=ia.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function la(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function ua(e){return e.reduce((e,t)=>ui(e,ra(t)),Ai)}function da(e){return e.reduce((e,t)=>e+ta(t),0)}function fa(e){return e.reduce((e,t)=>e+na(t),0)}function pa(e,t){if(t===void 0&&(t=qi),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);$i(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var ma=[[`x`,[`left`,`right`],da],[`y`,[`top`,`bottom`],fa]],ha=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Qi(t),r=ua(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of ma)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},ga=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function _a(e){let{EventTarget:t}=Yr(e);return e instanceof t?e:$r(e)}function va(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var ya;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(ya||={});function ba(e){e.preventDefault()}function xa(e){e.stopPropagation()}var K;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(K||={});var Sa={start:[K.Space,K.Enter],cancel:[K.Esc],end:[K.Space,K.Enter,K.Tab]},Ca=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case K.Right:return{...n,x:n.x+25};case K.Left:return{...n,x:n.x-25};case K.Down:return{...n,y:n.y+25};case K.Up:return{...n,y:n.y-25}}},wa=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new ga($r(t)),this.windowListeners=new ga(Yr(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ya.Resize,this.handleCancel),this.windowListeners.add(ya.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ya.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&pa(n),t(Ai)}handleKeyDown(e){if(pi(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Sa,coordinateGetter:a=Ca,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Ai;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=di(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=oa(n),p=la(n),m={x:Math.min(i===K.Right?p.right-p.width/2:p.right,Math.max(i===K.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===K.Down?p.bottom-p.height/2:p.bottom,Math.max(i===K.Down?p.top:p.top+p.height/2,u.y))},h=i===K.Right&&!s||i===K.Left&&!c,g=i===K.Down&&!l||i===K.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===K.Right&&e<=d.x||i===K.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===K.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===K.Down&&e<=d.y||i===K.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===K.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,ui(di(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};wa.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Sa,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Ta(e){return!!(e&&`distance`in e)}function Ea(e){return!!(e&&`delay`in e)}var Da=class{constructor(e,t,n){n===void 0&&(n=_a(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=$r(i),this.documentListeners=new ga(this.document),this.listeners=new ga(n),this.windowListeners=new ga(Yr(i)),this.initialCoordinates=hi(r)??Ai,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(ya.Resize,this.handleCancel),this.windowListeners.add(ya.DragStart,ba),this.windowListeners.add(ya.VisibilityChange,this.handleCancel),this.windowListeners.add(ya.ContextMenu,ba),this.documentListeners.add(ya.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ea(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Ta(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(ya.Click,xa,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ya.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=hi(e)??Ai,s=di(n,o);if(!t&&a){if(Ta(a)){if(a.tolerance!=null&&va(s,a.tolerance))return this.handleCancel();if(va(s,a.distance))return this.handleStart()}if(Ea(a)&&va(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===K.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Oa={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},ka=class extends Da{constructor(e){let{event:t}=e,n=$r(t.target);super(e,Oa,n)}};ka.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Aa={move:{name:`mousemove`},end:{name:`mouseup`}},ja;(function(e){e[e.RightClick=2]=`RightClick`})(ja||={});var Ma=class extends Da{constructor(e){super(e,Aa,$r(e.event.target))}};Ma.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ja.RightClick?!1:(r?.({event:n}),!0)}}];var Na={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Pa=class extends Da{constructor(e){super(e,Na)}static setup(){return window.addEventListener(Na.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Na.move.name,e)};function e(){}}};Pa.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Fa;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Fa||={});var Ia;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Ia||={});function La(e){let{acceleration:t,activator:n=Fa.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Ia.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=za({delta:d,disabled:!a}),[m,h]=ni(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case Fa.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Fa.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===Ia.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=ca(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Ra={x:{[ia.Backward]:!1,[ia.Forward]:!1},y:{[ia.Backward]:!1,[ia.Forward]:!1}};function za(e){let{delta:t,disabled:n}=e,r=oi(t);return ii(e=>{if(n||!r||!e)return Ra;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ia.Backward]:e.x[ia.Backward]||i.x===-1,[ia.Forward]:e.x[ia.Forward]||i.x===1},y:{[ia.Backward]:e.y[ia.Backward]||i.y===-1,[ia.Forward]:e.y[ia.Forward]||i.y===1}}},[n,t,r])}function Ba(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return ii(e=>t==null?null:r??e??null,[r,t])}function Va(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var Ha;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Ha||={});var Ua;(function(e){e.Optimized=`optimized`})(Ua||={});var Wa=new Map;function Ga(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=ri(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=ii(t=>{if(d&&!n)return Wa;if(!t||t===Wa||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new ha(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case Ha.Always:return!1;case Ha.BeforeDragging:return n;default:return!n}}}function Ka(e,t){return ii(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function qa(e,t){return Ka(e,t)}function Ja(e){let{callback:t,disabled:n}=e,r=ti(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ya(e){let{callback:t,disabled:n}=e,r=ti(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Xa(e){return new ha(qi(e),e)}function Za(e,t,n){t===void 0&&(t=Xa);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Ja({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Ya({callback:a});return ei(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Qa(e){return Vi(e,Ka(e))}var $a=[];function eo(e){let t=(0,C.useRef)(e),n=ii(n=>e?n&&n!==$a&&e&&t.current&&e.parentNode===t.current.parentNode?n:Qi(e):$a,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function to(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=ea(e.target);t&&n(e=>e?(e.set(t,ra(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ea(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,ra(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ea(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>ui(e,t),Ai):ua(e):Ai,[e,t])}function no(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==Ai;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?di(e,n.current):Ai}function ro(e){(0,C.useEffect)(()=>{if(!Kr)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function io(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function ao(e){return(0,C.useMemo)(()=>e?Yi(e):null,[e])}var q=[];function J(e,t){t===void 0&&(t=qi);let[n]=e,r=ao(n?Yr(n):null),[i,a]=(0,C.useState)(q);function o(){a(()=>e.length?e.map(e=>aa(e)?r:new ha(t(e),e)):q)}let s=Ya({callback:o});return ei(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function oo(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Zr(t)?t:e}function so(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=Ya({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(Zr(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=ai((0,C.useCallback)(e=>{let n=oo(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var co=[{sensor:ka,options:{}},{sensor:wa,options:{}}],lo={current:{}},uo={draggable:{measure:Ji},droppable:{measure:Ji,strategy:Ha.WhileDragging,frequency:Ua.Optimized},dragOverlay:{measure:qi}},fo=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},po={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new fo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:W},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:uo,measureDroppableContainers:W,windowRect:null,measuringScheduled:!1},mo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:W,draggableNodes:new Map,over:null,measureDroppableContainers:W},ho=(0,C.createContext)(mo),go=(0,C.createContext)(po);function _o(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new fo}}}function vo(e,t){switch(t.type){case U.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case U.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case U.DragEnd:case U.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case U.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new fo(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case U.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new fo(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case U.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new fo(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function yo(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(ho),a=oi(r),o=oi(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!pi(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=vi(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function bo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function xo(e){return(0,C.useMemo)(()=>({draggable:{...uo.draggable,...e?.draggable},droppable:{...uo.droppable,...e?.droppable},dragOverlay:{...uo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function So(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;ei(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Vi(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=$i(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Co=(0,C.createContext)({...Ai,scaleX:1,scaleY:1}),wo;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(wo||={});var To=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=co,collisionDetection:o=zi,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(vo,void 0,_o),[f,p]=Ti(),[m,h]=(0,C.useState)(wo.Uninitialized),g=m===wo.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??lo,rect:S},[_,x]),T=(0,C.useRef)(null),[ee,te]=(0,C.useState)(null),[E,D]=(0,C.useState)(null),O=ri(l,Object.values(l)),ne=ci(`DndDescribedBy`,t),k=(0,C.useMemo)(()=>b.getEnabled(),[b]),re=xo(s),{droppableRects:ie,measureDroppableContainers:ae,measuringScheduled:A}=Ga(k,{dragging:g,dependencies:[y.x,y.y],config:re.droppable}),j=Ba(v,_),oe=(0,C.useMemo)(()=>E?hi(E):null,[E]),se=je(),ce=qa(j,re.draggable.measure);So({activeNode:_==null?null:v.get(_),config:se.layoutShiftCompensation,initialRect:ce,measure:re.draggable.measure});let M=Za(j,re.draggable.measure,ce),N=Za(j?j.parentElement:null),P=(0,C.useRef)({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),le=b.getNodeFor(P.current.over?.id),ue=so({measure:re.dragOverlay.measure}),de=ue.nodeRef.current??j,fe=g?ue.rect??M:null,pe=!!(ue.nodeRef.current&&ue.rect),F=Qa(pe?null:M),me=ao(de?Yr(de):null),he=eo(g?le??j:null),ge=J(he),_e=bo(c,{transform:{x:y.x-F.x,y:y.y-F.y,scaleX:1,scaleY:1},activatorEvent:E,active:w,activeNodeRect:M,containerNodeRect:N,draggingNodeRect:fe,over:P.current.over,overlayNodeRect:ue.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=oe?ui(oe,y):null,ye=to(he),I=no(ye),be=no(ye,[M]),xe=ui(_e,I),Se=fe?Ui(fe,_e):null,Ce=w&&Se?o({active:w,collisionRect:Se,droppableRects:ie,droppableContainers:k,pointerCoordinates:ve}):null,we=Fi(Ce,`id`),[Te,Ee]=(0,C.useState)(null),De=Bi(pe?_e:ui(_e,be),Te?.rect??null,M),L=(0,C.useRef)(null),R=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;L.current=new n({active:T.current,activeNode:i,event:a,options:r,context:P,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=O.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=O.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=O.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,An.unstable_batchedUpdates)(()=>{r?.(i),h(wo.Initializing),d({type:U.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),te(L.current),D(a)})},onMove(e){d({type:U.DragMove,coordinates:e})},onEnd:o(U.DragEnd),onCancel:o(U.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=P.current,o=null;if(t&&i){let{cancelDrop:s}=O.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===U.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=U.DragCancel)}T.current=null,(0,An.unstable_batchedUpdates)(()=>{d({type:e}),h(wo.Uninitialized),Ee(null),te(null),D(null),L.current=null;let t=e===U.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=O.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=Va(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,R(n,t))},[v,R]));ro(a),ei(()=>{M&&m===wo.Initializing&&h(wo.Initialized)},[M,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=O.current,{active:t,activatorEvent:n,collisions:r,over:i}=P.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:xe.x,y:xe.y},over:i};(0,An.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[xe.x,xe.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=P.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=O.current,o=r.get(we),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,An.unstable_batchedUpdates)(()=>{Ee(s),a?.(c),f({type:`onDragOver`,event:c})})},[we]),ei(()=>{P.current={activatorEvent:E,active:w,activeNode:j,collisionRect:Se,collisions:Ce,droppableRects:ie,draggableNodes:v,draggingNode:de,draggingNodeRect:fe,droppableContainers:b,over:Te,scrollableAncestors:he,scrollAdjustedTranslate:xe},S.current={initial:fe,translated:Se}},[w,j,Ce,Se,v,de,fe,ie,b,Te,he,xe]),La({...se,delta:y,draggingRect:Se,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let ke=(0,C.useMemo)(()=>({active:w,activeNode:j,activeNodeRect:M,activatorEvent:E,collisions:Ce,containerNodeRect:N,dragOverlay:ue,draggableNodes:v,droppableContainers:b,droppableRects:ie,over:Te,measureDroppableContainers:ae,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:re,measuringScheduled:A,windowRect:me}),[w,j,M,E,Ce,N,ue,v,b,ie,Te,ae,he,ge,re,A,me]),Ae=(0,C.useMemo)(()=>({activatorEvent:E,activators:Oe,active:w,activeNodeRect:M,ariaDescribedById:{draggable:ne},dispatch:d,draggableNodes:v,over:Te,measureDroppableContainers:ae}),[E,Oe,w,M,d,ne,v,Te,ae]);return C.createElement(Ci.Provider,{value:p},C.createElement(ho.Provider,{value:Ae},C.createElement(go.Provider,{value:ke},C.createElement(Co.Provider,{value:De},i)),C.createElement(yo,{disabled:n?.restoreFocus===!1})),C.createElement(Oi,{...n,hiddenTextDescribedById:ne}));function je(){let e=ee?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Eo=(0,C.createContext)(null),Do=`button`,Oo=`Draggable`;function ko(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=ci(Oo),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(ho),{role:p=Do,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?Co:Eo),[v,y]=ai(),[b,x]=ai(),S=io(o,t),w=ri(n);return ei(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Do?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Ao(){return(0,C.useContext)(go)}var jo=`Droppable`,Mo={timeout:25};function No(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=ci(jo),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(ho),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Mo,...i},_=ri(h??r),v=Ya({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=ai((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=ri(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:U.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:U.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:U.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Po(e){let{animation:t,children:n}=e,[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),s=oi(n);return!n&&!r&&s&&i(s),ei(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),C.createElement(C.Fragment,null,n,r?(0,C.cloneElement)(r,{ref:o}):null)}var Fo={x:0,y:0,scaleX:1,scaleY:1};function Io(e){let{children:t}=e;return C.createElement(ho.Provider,{value:mo},C.createElement(Co.Provider,{value:Fo},t))}var Lo={position:`fixed`,touchAction:`none`},Ro=e=>pi(e)?`transform 250ms ease`:void 0,zo=(0,C.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Ro}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Lo,width:s.width,height:s.height,top:s.top,left:s.left,transform:gi.Transform.toString(d),transformOrigin:i&&r?Mi(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return C.createElement(n,{className:o,style:f,ref:t},a)}),Bo={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:gi.Transform.toString(t)},{transform:gi.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Vo(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return ti((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=oo(a);if(!c)return;let{transform:l}=Yr(a).getComputedStyle(a),u=Wi(l);if(!u)return;let d=typeof t==`function`?t:Ho(t);return pa(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Ho(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Bo,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var Uo=0;function Wo(e){return(0,C.useMemo)(()=>{if(e!=null)return Uo++,Uo},[e])}var Go=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Ao(),S=(0,C.useContext)(Co),w=Wo(d?.id),T=bo(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),ee=Ka(f),te=Vo({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),E=ee?g.setRef:void 0;return C.createElement(Io,null,C.createElement(Po,{animation:te},d&&w?C.createElement(zo,{key:w,id:d.id,ref:E,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:ee,style:{zIndex:l,...i},transform:T},n):null))});function Ko(e){return e.type===`row`||e.type===`column`||e.type===`grid`?e.items:e.type===`accordion`?e.body:e.type===`tabs`?e.tabs.flatMap(e=>e.content):null}function qo(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Jo(e){switch(e.type){case`text`:return`"${(e.content??``).slice(0,20)}"`;case`button`:return`"${e.label}"`;case`image`:return e.url?`image`:`(empty)`;case`badge`:return`"${e.text}"`;case`chip`:return`"${e.text}"`;case`link`:return`"${e.text}"`;case`accordion`:return`"${e.header}"`;default:return``}}function Yo(e){return`n-`+e.join(`-`)}function Xo(e,t){return`g-`+e.join(`-`)+`_`+t}function Zo(e){if(!e.startsWith(`g-`))return null;let t=e.slice(2).split(`_`);return t.length===2?{parentPath:t[0]===``?[]:t[0].split(`-`).map(Number),index:Number(t[1])}:null}function Qo(e){return e.startsWith(`n-`)?e.slice(2).split(`-`).map(Number):null}function $o({parentPath:e,index:t,depth:n}){let{setNodeRef:r,isOver:i}=No({id:Xo(e,t)});return(0,I.jsx)(`div`,{ref:r,className:`tree-drop-gap ${i?`active`:``}`,style:{paddingLeft:20+n*16},children:(0,I.jsx)(`div`,{className:`tree-drop-line`})})}var es=(0,C.memo)(function e({element:t,path:n,selectedPath:r,selectedPaths:i,onSelect:a,depth:o,isDraggingAny:s}){let c=Yo(n),l=qo(r,n),u=i.length>1&&i.some(e=>qo(e,n)),d=Ko(t),f=d!==null,[p,m]=(0,C.useState)(!1),{attributes:h,listeners:g,setNodeRef:_,isDragging:v}=ko({id:c,data:{path:n,element:t}}),{setNodeRef:y,isOver:b}=No({id:c,data:{path:n,element:t}}),x=(0,C.useCallback)(e=>{_(e),y(e)},[_,y]),S=(0,C.useCallback)(e=>{e.stopPropagation(),a(n)},[a,n]),w=(0,C.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),m(e=>!e)},[]),T=n.slice(0,-1);return(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)($o,{parentPath:T,index:n[n.length-1],depth:o}):null,(0,I.jsxs)(`div`,{className:`tree-node`,ref:x,style:{opacity:v?.3:1},children:[(0,I.jsxs)(`div`,{className:`tree-item ${l?`selected`:``} ${u&&!l?`multi-selected`:``} ${f?`container`:``} ${b&&f?`drop-target`:``}`,style:{paddingLeft:8+o*16},onClick:S,...h,...g,children:[f?(0,I.jsx)(`span`,{className:`tree-arrow ${p?`collapsed`:``}`,onPointerDown:e=>e.stopPropagation(),onClick:w,children:`▾`}):(0,I.jsx)(`span`,{className:`tree-dot`,children:`·`}),(0,I.jsx)(`span`,{className:`tree-type`,children:t.type}),(0,I.jsx)(`span`,{className:`tree-label`,children:Jo(t)}),f&&d?(0,I.jsx)(`span`,{className:`tree-badge`,children:d.length}):null,wr(t)?(0,I.jsx)(`span`,{className:`tree-error-dot`,title:`Has validation errors`}):null]}),f&&!p&&d&&d.length>0?(0,I.jsxs)(`div`,{className:`tree-children`,children:[d.map((t,c)=>(0,I.jsx)(e,{element:t,path:[...n,c],selectedPath:r,selectedPaths:i,onSelect:a,depth:o+1,isDraggingAny:s},Yo([...n,c]))),s?(0,I.jsx)($o,{parentPath:n,index:d.length,depth:o+1}):null]}):null]})]})});function ts({element:e}){return(0,I.jsx)(`div`,{className:`tree-drag-overlay`,children:(0,I.jsxs)(`div`,{className:`tree-item selected`,style:{paddingLeft:8},children:[Ko(e)?(0,I.jsx)(`span`,{className:`tree-arrow`,children:`▾`}):(0,I.jsx)(`span`,{className:`tree-dot`,children:`·`}),(0,I.jsx)(`span`,{className:`tree-type`,children:e.type}),(0,I.jsx)(`span`,{className:`tree-label`,children:Jo(e)})]})})}function ns(e,t){let n=t.toLowerCase();if(e.type.toLowerCase().includes(n)||Jo(e).toLowerCase().includes(n))return!0;let r=Ko(e);return r?r.some(e=>ns(e,n)):!1}function rs(){let e=F(e=>e.body),t=F(e=>e.selectedPath),n=F(e=>e.selectedPaths),r=F(e=>e.selectElement),i=F(e=>e.moveElementToPath),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(``),l=ki(G(ka,{activationConstraint:{distance:8}})),u=(0,C.useCallback)(e=>{o(e.active.data.current?.element??null)},[]),d=(0,C.useCallback)(e=>{o(null);let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=Qo(t.id);if(!r)return;let a=n.id,s=t.id;if(a.startsWith(s.replace(`n-`,`n-`)+`-`)||a.startsWith(s.replace(`n-`,`g-`)+`-`))return;let c=Zo(a);if(c){i(r,c.parentPath,c.index);return}let l=Qo(a);if(!l)return;let u=n.data.current?.element;u&&Ko(u)!==null?i(r,l,(Ko(u)??[]).length):i(r,l.slice(0,-1),l[l.length-1])},[i]);if(e.length===0)return(0,I.jsx)(`div`,{className:`tree-empty`,children:`No elements yet`});let f=s?e.filter(e=>ns(e,s)):e;return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`tree-search-wrap`,children:[(0,I.jsx)(`input`,{className:`tree-search`,placeholder:`Search elements...`,value:s,onChange:e=>c(e.target.value)}),s?(0,I.jsx)(`button`,{className:`tree-search-clear`,onClick:()=>c(``),children:`×`}):null]}),f.length===0&&s?(0,I.jsxs)(`div`,{className:`tree-empty`,children:[`No matches for "`,s,`"`]}):(0,I.jsxs)(To,{sensors:l,collisionDetection:Li,onDragStart:u,onDragEnd:d,children:[(0,I.jsxs)(`div`,{className:`tree-root`,children:[f.map(i=>{let o=e.indexOf(i);return(0,I.jsx)(es,{element:i,path:[o],selectedPath:t,selectedPaths:n,onSelect:r,depth:0,isDraggingAny:!!a},Yo([o]))}),!s&&a?(0,I.jsx)($o,{parentPath:[],index:e.length,depth:0}):null]}),(0,I.jsx)(Go,{children:a?(0,I.jsx)(ts,{element:a}):null})]})]})}function is(e,t){if(t.length===0)return null;let n=e[t[0]];for(let e=1;e<t.length;e++){if(!n)return null;let r=null;if(n.type===`row`||n.type===`column`||n.type===`grid`?r=n.items:n.type===`accordion`?r=n.body:n.type===`tabs`&&(r=n.tabs[n.defaultActiveTab??0]?.content??null),!r)return null;n=r[t[e]]}return n??null}var as=(0,C.memo)(function(){let e=F(e=>e.selectedPath),t=F(e=>e.body),n=F(e=>e.updateElement),r=F(e=>e.setCanvasView),i=F(e=>e.channels),[a,o]=(0,C.useState)(i===`push`?`notification`:`tree`),s=i===`push`||i===`both`,c=e?is(t,e):null,l=(0,C.useCallback)(e=>{o(e),r(e===`notification`?`notification`:`bubble`)},[r]),u=(0,C.useCallback)(e=>{let t=F.getState().selectedPath;t&&n(t,e)},[n]);return(0,I.jsxs)(`div`,{className:`right-panel`,children:[(0,I.jsxs)(`div`,{className:`rp-tabs`,children:[i!==`push`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:`rp-tab ${a===`tree`?`active`:``}`,onClick:()=>l(`tree`),children:`Tree`}),(0,I.jsx)(`button`,{className:`rp-tab ${a===`element`?`active`:``}`,onClick:()=>l(`element`),children:`Element`}),(0,I.jsx)(`button`,{className:`rp-tab ${a===`bubble`?`active`:``}`,onClick:()=>l(`bubble`),children:`Bubble`})]}),s&&(0,I.jsx)(`button`,{className:`rp-tab ${a===`notification`?`active`:``}`,onClick:()=>l(`notification`),children:`Notification`})]}),(0,I.jsx)(`div`,{className:`rp-content`,children:a===`tree`?(0,I.jsx)(rs,{}):a===`element`?c?(0,I.jsx)(Tr,{element:c,onUpdate:u}):(0,I.jsxs)(`div`,{className:`rp-empty`,children:[(0,I.jsx)(`span`,{className:`rp-empty-icon`,children:`⊡`}),`Select an element to edit its properties`]}):a===`notification`?(0,I.jsx)(Gr,{}):(0,I.jsx)(Wr,{})})]})}),os=[{keys:`⌘ Z`,action:`Undo`},{keys:`⌘ ⇧ Z`,action:`Redo`},{keys:`⌘ D`,action:`Duplicate element`},{keys:`⌘ C`,action:`Copy element`},{keys:`⌘ V`,action:`Paste element`},{keys:`Delete`,action:`Remove element`},{keys:`Esc`,action:`Deselect`},{keys:`?`,action:`Toggle this panel`}],ss=(0,C.memo)(function(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let e=e=>{let n=e.target;n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.tagName===`SELECT`||e.key===`?`&&(e.preventDefault(),t(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),e?(0,I.jsx)(`div`,{className:`shortcuts-overlay`,onClick:()=>t(!1),children:(0,I.jsxs)(`div`,{className:`shortcuts-panel`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,I.jsx)(`span`,{children:`Keyboard Shortcuts`}),(0,I.jsx)(`button`,{className:`shortcuts-close`,onClick:()=>t(!1),children:`×`})]}),(0,I.jsx)(`div`,{className:`shortcuts-list`,children:os.map(e=>(0,I.jsxs)(`div`,{className:`shortcut-row`,children:[(0,I.jsx)(`span`,{className:`shortcut-action`,children:e.action}),(0,I.jsx)(`kbd`,{className:`shortcut-keys`,children:e.keys})]},e.keys))})]})}):null});function cs(){(0,C.useEffect)(()=>{let e=e=>{let t=e.metaKey||e.ctrlKey,n=e.target;if(n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.tagName===`SELECT`)return;let r=F.getState();if(t&&!e.shiftKey&&e.key===`z`){e.preventDefault(),r.undo();return}if(t&&e.shiftKey&&e.key===`z`){e.preventDefault(),r.redo();return}if(t&&e.key===`d`){e.preventDefault(),r.selectedPath&&r.duplicateElement(r.selectedPath);return}if(t&&e.key===`c`){e.preventDefault(),r.selectedPath&&r.copyElement(r.selectedPath);return}if(t&&e.key===`v`){e.preventDefault(),r.pasteElement(r.selectedPath??void 0);return}if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault(),r.selectedPath&&r.removeElement(r.selectedPath);return}if(e.key===`Escape`){r.selectElement(null);return}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}var ls=(0,C.memo)(function(){cs();let e=F(e=>e.channels)===`push`;return(0,I.jsxs)(`div`,{className:`editor-root`,children:[!k.hideTopBar&&(0,I.jsx)(mn,{}),(0,I.jsxs)(`div`,{className:`editor-panels`,children:[!e&&(0,I.jsx)(wn,{}),(0,I.jsx)(or,{}),(0,I.jsx)(as,{})]}),!e&&(0,I.jsx)(ss,{})]})});function us(){return F(e=>e.view)===`library`?(0,I.jsx)(Te,{}):(0,I.jsx)(ls,{})}function ds(e,t){k.appId=t.appId,k.region=t.region,k.token=t.token,k.onSave=t.onSave,k.onChange=t.onChange,k.hideTopBar=t.hideTopBar,k.hideTemplateLibrary=t.hideTemplateLibrary,k.channels=t.channels??`inapp`,k.notification=t.notification,F.getState().setChannels(k.channels),t.variables&&F.getState().setVariables(t.variables),t.hiddenElements&&F.getState().setHiddenElements(t.hiddenElements),t.hiddenComponents&&F.getState().setHiddenComponents(t.hiddenComponents),t.hideTemplateLibrary&&F.getState().setView(`editor`),console.log(`[BubbleBuilder] mountBubbleBuilder called with:`,{appId:t.appId,region:t.region,token:t.token?`***`+t.token.slice(-4):void 0,hasBubble:!!t.bubble,templateName:t.templateName,hasOnSave:!!t.onSave});let n=(0,E.createRoot)(e);n.render((0,I.jsx)(C.StrictMode,{children:(0,I.jsx)(`div`,{className:`bb-root`,style:{height:`100%`,width:`100%`,overflow:`hidden`,position:`relative`},ref:e=>{e&&Ln(e)},children:(0,I.jsx)(us,{})})}));let r;if(t.onChange){let e=t.onChange,n=F.getState().body,i=F.getState().settings,a=F.getState().fallbackText,o=F.getState().notificationTitle,s=F.getState().notificationBody;r=F.subscribe(t=>{(t.body!==n||t.settings!==i||t.fallbackText!==a||t.notificationTitle!==o||t.notificationBody!==s)&&(n=t.body,i=t.settings,a=t.fallbackText,o=t.notificationTitle,s=t.notificationBody,e(t.getBubbleJSON()))})}return t.bubble&&setTimeout(()=>{F.getState().loadBubble(t.bubble,void 0,t.templateName??`Untitled`)},0),{loadBubble:(e,t)=>F.getState().loadBubble(e,void 0,t??`Untitled`),getBubbleJSON:()=>F.getState().getBubbleJSON(),setVariables:e=>F.getState().setVariables(e),setChannels:e=>{k.channels=e,F.getState().setChannels(e)},setCanvasView:e=>F.getState().setCanvasView(e),setHiddenElements:e=>F.getState().setHiddenElements(e),setHiddenComponents:e=>F.getState().setHiddenComponents(e),destroy:()=>{r?.(),n.unmount(),Object.keys(k).forEach(e=>delete k[e])}}}e.builderConfig=k,e.mountBubbleBuilder=ds});
20
+ `},Di={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Oi(e){let{announcements:t=Di,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ei}=e,{announce:a,announcement:o}=Si(),s=ci(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),wi((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(bi,{id:r,value:i.draggable}),C.createElement(xi,{id:s,announcement:o}));return n?(0,An.createPortal)(u,n):u}var U;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(U||={});function W(){}function G(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function ki(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,C.useMemo)(()=>[...t].filter(e=>e!=null),[...t])}var Ai=Object.freeze({x:0,y:0});function ji(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Mi(e,t){let n=hi(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Ni(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Pi(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Fi(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Ii(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Li=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Ii(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ji(Ii(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Ni)};function Ri(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var zi=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Ri(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Pi)};function Bi(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Vi(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ai}function Hi(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Ui=Hi(1);function Wi(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Gi(e,t,n){let r=Wi(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Ki={ignoreTransform:!1};function qi(e,t){t===void 0&&(t=Ki);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Yr(e).getComputedStyle(e);t&&(n=Gi(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Ji(e){return qi(e,{ignoreTransform:!0})}function Yi(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Xi(e,t){return t===void 0&&(t=Yr(e).getComputedStyle(e)),t.position===`fixed`}function Zi(e,t){t===void 0&&(t=Yr(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Qi(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Xr(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Zr(i)||Qr(i)||n.includes(i))return n;let a=Yr(e).getComputedStyle(i);return i!==e&&Zi(i,a)&&n.push(i),Xi(i,a)?n:r(i.parentNode)}return e?r(e):n}function $i(e){let[t]=Qi(e,1);return t??null}function ea(e){return!Kr||!e?null:qr(e)?e:Jr(e)?Xr(e)||e===$r(e).scrollingElement?window:Zr(e)?e:null:null}function ta(e){return qr(e)?e.scrollX:e.scrollLeft}function na(e){return qr(e)?e.scrollY:e.scrollTop}function ra(e){return{x:ta(e),y:na(e)}}var ia;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(ia||={});function aa(e){return!Kr||!e?!1:e===document.scrollingElement}function oa(e){let t={x:0,y:0},n=aa(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var sa={x:.2,y:.2};function ca(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=sa);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=oa(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=ia.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=ia.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=ia.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=ia.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function la(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function ua(e){return e.reduce((e,t)=>ui(e,ra(t)),Ai)}function da(e){return e.reduce((e,t)=>e+ta(t),0)}function fa(e){return e.reduce((e,t)=>e+na(t),0)}function pa(e,t){if(t===void 0&&(t=qi),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);$i(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var ma=[[`x`,[`left`,`right`],da],[`y`,[`top`,`bottom`],fa]],ha=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Qi(t),r=ua(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of ma)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},ga=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function _a(e){let{EventTarget:t}=Yr(e);return e instanceof t?e:$r(e)}function va(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var ya;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(ya||={});function ba(e){e.preventDefault()}function xa(e){e.stopPropagation()}var K;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(K||={});var Sa={start:[K.Space,K.Enter],cancel:[K.Esc],end:[K.Space,K.Enter,K.Tab]},Ca=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case K.Right:return{...n,x:n.x+25};case K.Left:return{...n,x:n.x-25};case K.Down:return{...n,y:n.y+25};case K.Up:return{...n,y:n.y-25}}},wa=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new ga($r(t)),this.windowListeners=new ga(Yr(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ya.Resize,this.handleCancel),this.windowListeners.add(ya.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ya.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&pa(n),t(Ai)}handleKeyDown(e){if(pi(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Sa,coordinateGetter:a=Ca,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Ai;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=di(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=oa(n),p=la(n),m={x:Math.min(i===K.Right?p.right-p.width/2:p.right,Math.max(i===K.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===K.Down?p.bottom-p.height/2:p.bottom,Math.max(i===K.Down?p.top:p.top+p.height/2,u.y))},h=i===K.Right&&!s||i===K.Left&&!c,g=i===K.Down&&!l||i===K.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===K.Right&&e<=d.x||i===K.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===K.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===K.Down&&e<=d.y||i===K.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===K.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,ui(di(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};wa.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Sa,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Ta(e){return!!(e&&`distance`in e)}function Ea(e){return!!(e&&`delay`in e)}var Da=class{constructor(e,t,n){n===void 0&&(n=_a(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=$r(i),this.documentListeners=new ga(this.document),this.listeners=new ga(n),this.windowListeners=new ga(Yr(i)),this.initialCoordinates=hi(r)??Ai,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(ya.Resize,this.handleCancel),this.windowListeners.add(ya.DragStart,ba),this.windowListeners.add(ya.VisibilityChange,this.handleCancel),this.windowListeners.add(ya.ContextMenu,ba),this.documentListeners.add(ya.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ea(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Ta(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(ya.Click,xa,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ya.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=hi(e)??Ai,s=di(n,o);if(!t&&a){if(Ta(a)){if(a.tolerance!=null&&va(s,a.tolerance))return this.handleCancel();if(va(s,a.distance))return this.handleStart()}if(Ea(a)&&va(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===K.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Oa={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},ka=class extends Da{constructor(e){let{event:t}=e,n=$r(t.target);super(e,Oa,n)}};ka.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Aa={move:{name:`mousemove`},end:{name:`mouseup`}},ja;(function(e){e[e.RightClick=2]=`RightClick`})(ja||={});var Ma=class extends Da{constructor(e){super(e,Aa,$r(e.event.target))}};Ma.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ja.RightClick?!1:(r?.({event:n}),!0)}}];var Na={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Pa=class extends Da{constructor(e){super(e,Na)}static setup(){return window.addEventListener(Na.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Na.move.name,e)};function e(){}}};Pa.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Fa;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Fa||={});var Ia;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Ia||={});function La(e){let{acceleration:t,activator:n=Fa.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Ia.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=za({delta:d,disabled:!a}),[m,h]=ni(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case Fa.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Fa.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===Ia.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=ca(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Ra={x:{[ia.Backward]:!1,[ia.Forward]:!1},y:{[ia.Backward]:!1,[ia.Forward]:!1}};function za(e){let{delta:t,disabled:n}=e,r=oi(t);return ii(e=>{if(n||!r||!e)return Ra;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ia.Backward]:e.x[ia.Backward]||i.x===-1,[ia.Forward]:e.x[ia.Forward]||i.x===1},y:{[ia.Backward]:e.y[ia.Backward]||i.y===-1,[ia.Forward]:e.y[ia.Forward]||i.y===1}}},[n,t,r])}function Ba(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return ii(e=>t==null?null:r??e??null,[r,t])}function Va(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var Ha;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Ha||={});var Ua;(function(e){e.Optimized=`optimized`})(Ua||={});var Wa=new Map;function Ga(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=ri(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=ii(t=>{if(d&&!n)return Wa;if(!t||t===Wa||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new ha(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case Ha.Always:return!1;case Ha.BeforeDragging:return n;default:return!n}}}function Ka(e,t){return ii(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function qa(e,t){return Ka(e,t)}function Ja(e){let{callback:t,disabled:n}=e,r=ti(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ya(e){let{callback:t,disabled:n}=e,r=ti(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Xa(e){return new ha(qi(e),e)}function Za(e,t,n){t===void 0&&(t=Xa);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Ja({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Ya({callback:a});return ei(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Qa(e){return Vi(e,Ka(e))}var $a=[];function eo(e){let t=(0,C.useRef)(e),n=ii(n=>e?n&&n!==$a&&e&&t.current&&e.parentNode===t.current.parentNode?n:Qi(e):$a,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function to(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=ea(e.target);t&&n(e=>e?(e.set(t,ra(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ea(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,ra(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ea(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>ui(e,t),Ai):ua(e):Ai,[e,t])}function no(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==Ai;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?di(e,n.current):Ai}function ro(e){(0,C.useEffect)(()=>{if(!Kr)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function io(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function ao(e){return(0,C.useMemo)(()=>e?Yi(e):null,[e])}var q=[];function J(e,t){t===void 0&&(t=qi);let[n]=e,r=ao(n?Yr(n):null),[i,a]=(0,C.useState)(q);function o(){a(()=>e.length?e.map(e=>aa(e)?r:new ha(t(e),e)):q)}let s=Ya({callback:o});return ei(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function oo(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Zr(t)?t:e}function so(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=Ya({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(Zr(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=ai((0,C.useCallback)(e=>{let n=oo(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var co=[{sensor:ka,options:{}},{sensor:wa,options:{}}],lo={current:{}},uo={draggable:{measure:Ji},droppable:{measure:Ji,strategy:Ha.WhileDragging,frequency:Ua.Optimized},dragOverlay:{measure:qi}},fo=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},po={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new fo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:W},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:uo,measureDroppableContainers:W,windowRect:null,measuringScheduled:!1},mo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:W,draggableNodes:new Map,over:null,measureDroppableContainers:W},ho=(0,C.createContext)(mo),go=(0,C.createContext)(po);function _o(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new fo}}}function vo(e,t){switch(t.type){case U.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case U.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case U.DragEnd:case U.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case U.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new fo(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case U.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new fo(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case U.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new fo(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function yo(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(ho),a=oi(r),o=oi(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!pi(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=vi(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function bo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function xo(e){return(0,C.useMemo)(()=>({draggable:{...uo.draggable,...e?.draggable},droppable:{...uo.droppable,...e?.droppable},dragOverlay:{...uo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function So(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;ei(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Vi(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=$i(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Co=(0,C.createContext)({...Ai,scaleX:1,scaleY:1}),wo;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(wo||={});var To=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=co,collisionDetection:o=zi,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(vo,void 0,_o),[f,p]=Ti(),[m,h]=(0,C.useState)(wo.Uninitialized),g=m===wo.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??lo,rect:S},[_,x]),T=(0,C.useRef)(null),[ee,te]=(0,C.useState)(null),[E,D]=(0,C.useState)(null),O=ri(l,Object.values(l)),ne=ci(`DndDescribedBy`,t),k=(0,C.useMemo)(()=>b.getEnabled(),[b]),re=xo(s),{droppableRects:ie,measureDroppableContainers:ae,measuringScheduled:A}=Ga(k,{dragging:g,dependencies:[y.x,y.y],config:re.droppable}),j=Ba(v,_),oe=(0,C.useMemo)(()=>E?hi(E):null,[E]),se=je(),ce=qa(j,re.draggable.measure);So({activeNode:_==null?null:v.get(_),config:se.layoutShiftCompensation,initialRect:ce,measure:re.draggable.measure});let M=Za(j,re.draggable.measure,ce),N=Za(j?j.parentElement:null),P=(0,C.useRef)({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),le=b.getNodeFor(P.current.over?.id),ue=so({measure:re.dragOverlay.measure}),de=ue.nodeRef.current??j,fe=g?ue.rect??M:null,pe=!!(ue.nodeRef.current&&ue.rect),F=Qa(pe?null:M),me=ao(de?Yr(de):null),he=eo(g?le??j:null),ge=J(he),_e=bo(c,{transform:{x:y.x-F.x,y:y.y-F.y,scaleX:1,scaleY:1},activatorEvent:E,active:w,activeNodeRect:M,containerNodeRect:N,draggingNodeRect:fe,over:P.current.over,overlayNodeRect:ue.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=oe?ui(oe,y):null,ye=to(he),I=no(ye),be=no(ye,[M]),xe=ui(_e,I),Se=fe?Ui(fe,_e):null,Ce=w&&Se?o({active:w,collisionRect:Se,droppableRects:ie,droppableContainers:k,pointerCoordinates:ve}):null,we=Fi(Ce,`id`),[Te,Ee]=(0,C.useState)(null),De=Bi(pe?_e:ui(_e,be),Te?.rect??null,M),L=(0,C.useRef)(null),R=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;L.current=new n({active:T.current,activeNode:i,event:a,options:r,context:P,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=O.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=O.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=O.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,An.unstable_batchedUpdates)(()=>{r?.(i),h(wo.Initializing),d({type:U.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),te(L.current),D(a)})},onMove(e){d({type:U.DragMove,coordinates:e})},onEnd:o(U.DragEnd),onCancel:o(U.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=P.current,o=null;if(t&&i){let{cancelDrop:s}=O.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===U.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=U.DragCancel)}T.current=null,(0,An.unstable_batchedUpdates)(()=>{d({type:e}),h(wo.Uninitialized),Ee(null),te(null),D(null),L.current=null;let t=e===U.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=O.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=Va(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,R(n,t))},[v,R]));ro(a),ei(()=>{M&&m===wo.Initializing&&h(wo.Initialized)},[M,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=O.current,{active:t,activatorEvent:n,collisions:r,over:i}=P.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:xe.x,y:xe.y},over:i};(0,An.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[xe.x,xe.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=P.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=O.current,o=r.get(we),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,An.unstable_batchedUpdates)(()=>{Ee(s),a?.(c),f({type:`onDragOver`,event:c})})},[we]),ei(()=>{P.current={activatorEvent:E,active:w,activeNode:j,collisionRect:Se,collisions:Ce,droppableRects:ie,draggableNodes:v,draggingNode:de,draggingNodeRect:fe,droppableContainers:b,over:Te,scrollableAncestors:he,scrollAdjustedTranslate:xe},S.current={initial:fe,translated:Se}},[w,j,Ce,Se,v,de,fe,ie,b,Te,he,xe]),La({...se,delta:y,draggingRect:Se,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let ke=(0,C.useMemo)(()=>({active:w,activeNode:j,activeNodeRect:M,activatorEvent:E,collisions:Ce,containerNodeRect:N,dragOverlay:ue,draggableNodes:v,droppableContainers:b,droppableRects:ie,over:Te,measureDroppableContainers:ae,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:re,measuringScheduled:A,windowRect:me}),[w,j,M,E,Ce,N,ue,v,b,ie,Te,ae,he,ge,re,A,me]),Ae=(0,C.useMemo)(()=>({activatorEvent:E,activators:Oe,active:w,activeNodeRect:M,ariaDescribedById:{draggable:ne},dispatch:d,draggableNodes:v,over:Te,measureDroppableContainers:ae}),[E,Oe,w,M,d,ne,v,Te,ae]);return C.createElement(Ci.Provider,{value:p},C.createElement(ho.Provider,{value:Ae},C.createElement(go.Provider,{value:ke},C.createElement(Co.Provider,{value:De},i)),C.createElement(yo,{disabled:n?.restoreFocus===!1})),C.createElement(Oi,{...n,hiddenTextDescribedById:ne}));function je(){let e=ee?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Eo=(0,C.createContext)(null),Do=`button`,Oo=`Draggable`;function ko(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=ci(Oo),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(ho),{role:p=Do,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?Co:Eo),[v,y]=ai(),[b,x]=ai(),S=io(o,t),w=ri(n);return ei(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Do?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Ao(){return(0,C.useContext)(go)}var jo=`Droppable`,Mo={timeout:25};function No(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=ci(jo),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(ho),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Mo,...i},_=ri(h??r),v=Ya({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=ai((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=ri(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:U.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:U.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:U.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Po(e){let{animation:t,children:n}=e,[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),s=oi(n);return!n&&!r&&s&&i(s),ei(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),C.createElement(C.Fragment,null,n,r?(0,C.cloneElement)(r,{ref:o}):null)}var Fo={x:0,y:0,scaleX:1,scaleY:1};function Io(e){let{children:t}=e;return C.createElement(ho.Provider,{value:mo},C.createElement(Co.Provider,{value:Fo},t))}var Lo={position:`fixed`,touchAction:`none`},Ro=e=>pi(e)?`transform 250ms ease`:void 0,zo=(0,C.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Ro}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Lo,width:s.width,height:s.height,top:s.top,left:s.left,transform:gi.Transform.toString(d),transformOrigin:i&&r?Mi(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return C.createElement(n,{className:o,style:f,ref:t},a)}),Bo={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:gi.Transform.toString(t)},{transform:gi.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Vo(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return ti((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=oo(a);if(!c)return;let{transform:l}=Yr(a).getComputedStyle(a),u=Wi(l);if(!u)return;let d=typeof t==`function`?t:Ho(t);return pa(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Ho(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Bo,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var Uo=0;function Wo(e){return(0,C.useMemo)(()=>{if(e!=null)return Uo++,Uo},[e])}var Go=C.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Ao(),S=(0,C.useContext)(Co),w=Wo(d?.id),T=bo(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),ee=Ka(f),te=Vo({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),E=ee?g.setRef:void 0;return C.createElement(Io,null,C.createElement(Po,{animation:te},d&&w?C.createElement(zo,{key:w,id:d.id,ref:E,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:ee,style:{zIndex:l,...i},transform:T},n):null))});function Ko(e){return e.type===`row`||e.type===`column`||e.type===`grid`?e.items:e.type===`accordion`?e.body:e.type===`tabs`?e.tabs.flatMap(e=>e.content):null}function qo(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Jo(e){switch(e.type){case`text`:return`"${(e.content??``).slice(0,20)}"`;case`button`:return`"${e.label}"`;case`image`:return e.url?`image`:`(empty)`;case`badge`:return`"${e.text}"`;case`chip`:return`"${e.text}"`;case`link`:return`"${e.text}"`;case`accordion`:return`"${e.header}"`;default:return``}}function Yo(e){return`n-`+e.join(`-`)}function Xo(e,t){return`g-`+e.join(`-`)+`_`+t}function Zo(e){if(!e.startsWith(`g-`))return null;let t=e.slice(2).split(`_`);return t.length===2?{parentPath:t[0]===``?[]:t[0].split(`-`).map(Number),index:Number(t[1])}:null}function Qo(e){return e.startsWith(`n-`)?e.slice(2).split(`-`).map(Number):null}function $o({parentPath:e,index:t,depth:n}){let{setNodeRef:r,isOver:i}=No({id:Xo(e,t)});return(0,I.jsx)(`div`,{ref:r,className:`tree-drop-gap ${i?`active`:``}`,style:{paddingLeft:20+n*16},children:(0,I.jsx)(`div`,{className:`tree-drop-line`})})}var es=(0,C.memo)(function e({element:t,path:n,selectedPath:r,selectedPaths:i,onSelect:a,depth:o,isDraggingAny:s}){let c=Yo(n),l=qo(r,n),u=i.length>1&&i.some(e=>qo(e,n)),d=Ko(t),f=d!==null,[p,m]=(0,C.useState)(!1),{attributes:h,listeners:g,setNodeRef:_,isDragging:v}=ko({id:c,data:{path:n,element:t}}),{setNodeRef:y,isOver:b}=No({id:c,data:{path:n,element:t}}),x=(0,C.useCallback)(e=>{_(e),y(e)},[_,y]),S=(0,C.useCallback)(e=>{e.stopPropagation(),a(n)},[a,n]),w=(0,C.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),m(e=>!e)},[]),T=n.slice(0,-1);return(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)($o,{parentPath:T,index:n[n.length-1],depth:o}):null,(0,I.jsxs)(`div`,{className:`tree-node`,ref:x,style:{opacity:v?.3:1},children:[(0,I.jsxs)(`div`,{className:`tree-item ${l?`selected`:``} ${u&&!l?`multi-selected`:``} ${f?`container`:``} ${b&&f?`drop-target`:``}`,style:{paddingLeft:8+o*16},onClick:S,...h,...g,children:[f?(0,I.jsx)(`span`,{className:`tree-arrow ${p?`collapsed`:``}`,onPointerDown:e=>e.stopPropagation(),onClick:w,children:`▾`}):(0,I.jsx)(`span`,{className:`tree-dot`,children:`·`}),(0,I.jsx)(`span`,{className:`tree-type`,children:t.type}),(0,I.jsx)(`span`,{className:`tree-label`,children:Jo(t)}),f&&d?(0,I.jsx)(`span`,{className:`tree-badge`,children:d.length}):null,wr(t)?(0,I.jsx)(`span`,{className:`tree-error-dot`,title:`Has validation errors`}):null]}),f&&!p&&d&&d.length>0?(0,I.jsxs)(`div`,{className:`tree-children`,children:[d.map((t,c)=>(0,I.jsx)(e,{element:t,path:[...n,c],selectedPath:r,selectedPaths:i,onSelect:a,depth:o+1,isDraggingAny:s},Yo([...n,c]))),s?(0,I.jsx)($o,{parentPath:n,index:d.length,depth:o+1}):null]}):null]})]})});function ts({element:e}){return(0,I.jsx)(`div`,{className:`tree-drag-overlay`,children:(0,I.jsxs)(`div`,{className:`tree-item selected`,style:{paddingLeft:8},children:[Ko(e)?(0,I.jsx)(`span`,{className:`tree-arrow`,children:`▾`}):(0,I.jsx)(`span`,{className:`tree-dot`,children:`·`}),(0,I.jsx)(`span`,{className:`tree-type`,children:e.type}),(0,I.jsx)(`span`,{className:`tree-label`,children:Jo(e)})]})})}function ns(e,t){let n=t.toLowerCase();if(e.type.toLowerCase().includes(n)||Jo(e).toLowerCase().includes(n))return!0;let r=Ko(e);return r?r.some(e=>ns(e,n)):!1}function rs(){let e=F(e=>e.body),t=F(e=>e.selectedPath),n=F(e=>e.selectedPaths),r=F(e=>e.selectElement),i=F(e=>e.moveElementToPath),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(``),l=ki(G(ka,{activationConstraint:{distance:8}})),u=(0,C.useCallback)(e=>{o(e.active.data.current?.element??null)},[]),d=(0,C.useCallback)(e=>{o(null);let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=Qo(t.id);if(!r)return;let a=n.id,s=t.id;if(a.startsWith(s.replace(`n-`,`n-`)+`-`)||a.startsWith(s.replace(`n-`,`g-`)+`-`))return;let c=Zo(a);if(c){i(r,c.parentPath,c.index);return}let l=Qo(a);if(!l)return;let u=n.data.current?.element;u&&Ko(u)!==null?i(r,l,(Ko(u)??[]).length):i(r,l.slice(0,-1),l[l.length-1])},[i]);if(e.length===0)return(0,I.jsx)(`div`,{className:`tree-empty`,children:`No elements yet`});let f=s?e.filter(e=>ns(e,s)):e;return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`tree-search-wrap`,children:[(0,I.jsx)(`input`,{className:`tree-search`,placeholder:`Search elements...`,value:s,onChange:e=>c(e.target.value)}),s?(0,I.jsx)(`button`,{className:`tree-search-clear`,onClick:()=>c(``),children:`×`}):null]}),f.length===0&&s?(0,I.jsxs)(`div`,{className:`tree-empty`,children:[`No matches for "`,s,`"`]}):(0,I.jsxs)(To,{sensors:l,collisionDetection:Li,onDragStart:u,onDragEnd:d,children:[(0,I.jsxs)(`div`,{className:`tree-root`,children:[f.map(i=>{let o=e.indexOf(i);return(0,I.jsx)(es,{element:i,path:[o],selectedPath:t,selectedPaths:n,onSelect:r,depth:0,isDraggingAny:!!a},Yo([o]))}),!s&&a?(0,I.jsx)($o,{parentPath:[],index:e.length,depth:0}):null]}),(0,I.jsx)(Go,{children:a?(0,I.jsx)(ts,{element:a}):null})]})]})}function is(e,t){if(t.length===0)return null;let n=e[t[0]];for(let e=1;e<t.length;e++){if(!n)return null;let r=null;if(n.type===`row`||n.type===`column`||n.type===`grid`?r=n.items:n.type===`accordion`?r=n.body:n.type===`tabs`&&(r=n.tabs[n.defaultActiveTab??0]?.content??null),!r)return null;n=r[t[e]]}return n??null}var as=(0,C.memo)(function(){let e=F(e=>e.selectedPath),t=F(e=>e.body),n=F(e=>e.updateElement),r=F(e=>e.setCanvasView),i=F(e=>e.channels),[a,o]=(0,C.useState)(i===`push`?`notification`:`tree`),s=i===`push`||i===`both`,c=e?is(t,e):null,l=(0,C.useCallback)(e=>{o(e);let t=k.notification?.showPreview!==!1;r(e===`notification`&&t?`notification`:`bubble`)},[r]),u=(0,C.useCallback)(e=>{let t=F.getState().selectedPath;t&&n(t,e)},[n]);return(0,I.jsxs)(`div`,{className:`right-panel`,children:[(0,I.jsxs)(`div`,{className:`rp-tabs`,children:[i!==`push`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:`rp-tab ${a===`tree`?`active`:``}`,onClick:()=>l(`tree`),children:`Tree`}),(0,I.jsx)(`button`,{className:`rp-tab ${a===`element`?`active`:``}`,onClick:()=>l(`element`),children:`Element`}),(0,I.jsx)(`button`,{className:`rp-tab ${a===`bubble`?`active`:``}`,onClick:()=>l(`bubble`),children:`Bubble`})]}),s&&(0,I.jsx)(`button`,{className:`rp-tab ${a===`notification`?`active`:``}`,onClick:()=>l(`notification`),children:`Notification`})]}),(0,I.jsx)(`div`,{className:`rp-content`,children:a===`tree`?(0,I.jsx)(rs,{}):a===`element`?c?(0,I.jsx)(Tr,{element:c,onUpdate:u}):(0,I.jsxs)(`div`,{className:`rp-empty`,children:[(0,I.jsx)(`span`,{className:`rp-empty-icon`,children:`⊡`}),`Select an element to edit its properties`]}):a===`notification`?(0,I.jsx)(Gr,{}):(0,I.jsx)(Wr,{})})]})}),os=[{keys:`⌘ Z`,action:`Undo`},{keys:`⌘ ⇧ Z`,action:`Redo`},{keys:`⌘ D`,action:`Duplicate element`},{keys:`⌘ C`,action:`Copy element`},{keys:`⌘ V`,action:`Paste element`},{keys:`Delete`,action:`Remove element`},{keys:`Esc`,action:`Deselect`},{keys:`?`,action:`Toggle this panel`}],ss=(0,C.memo)(function(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let e=e=>{let n=e.target;n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.tagName===`SELECT`||e.key===`?`&&(e.preventDefault(),t(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),e?(0,I.jsx)(`div`,{className:`shortcuts-overlay`,onClick:()=>t(!1),children:(0,I.jsxs)(`div`,{className:`shortcuts-panel`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`div`,{className:`shortcuts-header`,children:[(0,I.jsx)(`span`,{children:`Keyboard Shortcuts`}),(0,I.jsx)(`button`,{className:`shortcuts-close`,onClick:()=>t(!1),children:`×`})]}),(0,I.jsx)(`div`,{className:`shortcuts-list`,children:os.map(e=>(0,I.jsxs)(`div`,{className:`shortcut-row`,children:[(0,I.jsx)(`span`,{className:`shortcut-action`,children:e.action}),(0,I.jsx)(`kbd`,{className:`shortcut-keys`,children:e.keys})]},e.keys))})]})}):null});function cs(){(0,C.useEffect)(()=>{let e=e=>{let t=e.metaKey||e.ctrlKey,n=e.target;if(n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.tagName===`SELECT`)return;let r=F.getState();if(t&&!e.shiftKey&&e.key===`z`){e.preventDefault(),r.undo();return}if(t&&e.shiftKey&&e.key===`z`){e.preventDefault(),r.redo();return}if(t&&e.key===`d`){e.preventDefault(),r.selectedPath&&r.duplicateElement(r.selectedPath);return}if(t&&e.key===`c`){e.preventDefault(),r.selectedPath&&r.copyElement(r.selectedPath);return}if(t&&e.key===`v`){e.preventDefault(),r.pasteElement(r.selectedPath??void 0);return}if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault(),r.selectedPath&&r.removeElement(r.selectedPath);return}if(e.key===`Escape`){r.selectElement(null);return}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}var ls=(0,C.memo)(function(){cs();let e=F(e=>e.channels)===`push`;return(0,I.jsxs)(`div`,{className:`editor-root`,children:[!k.hideTopBar&&(0,I.jsx)(mn,{}),(0,I.jsxs)(`div`,{className:`editor-panels`,children:[!e&&(0,I.jsx)(wn,{}),(0,I.jsx)(or,{}),(0,I.jsx)(as,{})]}),!e&&(0,I.jsx)(ss,{})]})});function us(){return F(e=>e.view)===`library`?(0,I.jsx)(Te,{}):(0,I.jsx)(ls,{})}function ds(e,t){k.appId=t.appId,k.region=t.region,k.token=t.token,k.onSave=t.onSave,k.onChange=t.onChange,k.hideTopBar=t.hideTopBar,k.hideTemplateLibrary=t.hideTemplateLibrary,k.channels=t.channels??`both`,k.notification=t.notification,F.getState().setChannels(k.channels),t.variables&&F.getState().setVariables(t.variables),t.hiddenElements&&F.getState().setHiddenElements(t.hiddenElements),t.hiddenComponents&&F.getState().setHiddenComponents(t.hiddenComponents),t.hideTemplateLibrary&&F.getState().setView(`editor`),console.log(`[BubbleBuilder] mountBubbleBuilder called with:`,{appId:t.appId,region:t.region,token:t.token?`***`+t.token.slice(-4):void 0,hasBubble:!!t.bubble,templateName:t.templateName,hasOnSave:!!t.onSave});let n=(0,E.createRoot)(e);n.render((0,I.jsx)(C.StrictMode,{children:(0,I.jsx)(`div`,{className:`bb-root`,style:{height:`100%`,width:`100%`,overflow:`hidden`,position:`relative`},ref:e=>{e&&Ln(e)},children:(0,I.jsx)(us,{})})}));let r;if(t.onChange){let e=t.onChange,n=F.getState().body,i=F.getState().settings,a=F.getState().fallbackText,o=F.getState().notificationTitle,s=F.getState().notificationBody;r=F.subscribe(t=>{(t.body!==n||t.settings!==i||t.fallbackText!==a||t.notificationTitle!==o||t.notificationBody!==s)&&(n=t.body,i=t.settings,a=t.fallbackText,o=t.notificationTitle,s=t.notificationBody,e(t.getBubbleJSON()))})}return t.bubble&&setTimeout(()=>{F.getState().loadBubble(t.bubble,void 0,t.templateName??`Untitled`)},0),{loadBubble:(e,t)=>F.getState().loadBubble(e,void 0,t??`Untitled`),getBubbleJSON:()=>F.getState().getBubbleJSON(),setVariables:e=>F.getState().setVariables(e),setChannels:e=>{k.channels=e,F.getState().setChannels(e)},setCanvasView:e=>F.getState().setCanvasView(e),setHiddenElements:e=>F.getState().setHiddenElements(e),setHiddenComponents:e=>F.getState().setHiddenComponents(e),destroy:()=>{r?.(),n.unmount(),Object.keys(k).forEach(e=>delete k[e])}}}e.builderConfig=k,e.mountBubbleBuilder=ds});
@@ -16,6 +16,8 @@ export interface NotificationConfig {
16
16
  appIcon?: string;
17
17
  /** Show the Data key-value editor in the notification tab */
18
18
  enableData?: boolean;
19
+ /** Show the push notification phone preview in the canvas. Default: true */
20
+ showPreview?: boolean;
19
21
  /** Called when notification data changes */
20
22
  onNotificationDataChange?: (data: Record<string, string>) => void;
21
23
  }
package/dist/lib.d.ts CHANGED
@@ -25,7 +25,7 @@ export interface BubbleBuilderOptions {
25
25
  hideTopBar?: boolean;
26
26
  /** Hide the template library view — go straight to editor. Default: false */
27
27
  hideTemplateLibrary?: boolean;
28
- /** Which channels to show: 'inapp' (default), 'push', or 'both'. */
28
+ /** Which channels to show: 'inapp', 'push', or 'both' (default). */
29
29
  channels?: BuilderChannels;
30
30
  /** Push notification preview config (app name, icon). Only used when channels is 'push' or 'both'. */
31
31
  notification?: NotificationConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mathews_cometchat/bubble-builder",
3
- "version": "1.0.0-alpha26",
3
+ "version": "1.0.0-alpha27",
4
4
  "type": "module",
5
5
  "main": "dist/bubble-builder.umd.js",
6
6
  "module": "dist/bubble-builder.es.js",