diff --git a/.github/extensions/replica-prototype/assets/canvas-bridge.js b/.github/extensions/replica-prototype/assets/canvas-bridge.js index ff6253c..1a6afed 100644 --- a/.github/extensions/replica-prototype/assets/canvas-bridge.js +++ b/.github/extensions/replica-prototype/assets/canvas-bridge.js @@ -1,4 +1,4 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=/* @__PURE__ */ ((n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)))((/* @__PURE__ */ o((e=>{var t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r=55296&&i<=56319&&r{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}})),i=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t}));e.validateShape=P;var a={type:`object`,additionalProperties:!1,required:[`version`,`scope`,`controls`],properties:{$schema:{type:`string`},version:{const:1},scope:{$ref:`#/$defs/id`},label:{$ref:`#/$defs/label`},role:{enum:[`shared`,`page`]},container:{$ref:`#/$defs/selector`},panel:{type:`object`,additionalProperties:!1,required:[`width`],properties:{width:{type:`integer`,minimum:160,maximum:4096}}},groups:{type:`array`,maxItems:100,items:{type:`object`,additionalProperties:!1,required:[`id`,`label`],properties:{id:{$ref:`#/$defs/id`},label:{$ref:`#/$defs/label`},when:{$ref:`#/$defs/condition`}}}},controls:{type:`array`,maxItems:500,items:{oneOf:[{$ref:`#/$defs/boolean`},{$ref:`#/$defs/number`},{$ref:`#/$defs/slider`},{$ref:`#/$defs/choice`},{$ref:`#/$defs/checkboxGroup`},{$ref:`#/$defs/text`},{$ref:`#/$defs/color`},{$ref:`#/$defs/button`}]}}}},o=Object.prototype.hasOwnProperty,s=n().default,c=RegExp(`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`,`u`),l={type:[`string`,`number`,`boolean`]},u=i().default,d={validate:f};function f(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0,s=o,p=!1,m=null,h=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.control===void 0){let e={instancePath:t,schemaPath:`#/oneOf/0/required`,keyword:`required`,params:{missingProperty:`control`},message:`must have required property 'control'`};a===null?a=[e]:a.push(e),o++}if(e.equals===void 0){let e={instancePath:t,schemaPath:`#/oneOf/0/required`,keyword:`required`,params:{missingProperty:`equals`},message:`must have required property 'equals'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`control`&&n!==`equals`){let e={instancePath:t,schemaPath:`#/oneOf/0/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.control!==void 0){let n=e.control;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/control`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/control`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.equals!==void 0){let n=e.equals;if(typeof n!=`string`&&!(typeof n==`number`&&isFinite(n))&&typeof n!=`boolean`){let e={instancePath:t+`/equals`,schemaPath:`#/$defs/scalar/type`,keyword:`type`,params:{type:l.type},message:`must be string,number,boolean`};a===null?a=[e]:a.push(e),o++}}}else{let e={instancePath:t,schemaPath:`#/oneOf/0/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var g=h===o;g&&(p=!0,m=0);let _=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.control===void 0){let e={instancePath:t,schemaPath:`#/oneOf/1/required`,keyword:`required`,params:{missingProperty:`control`},message:`must have required property 'control'`};a===null?a=[e]:a.push(e),o++}if(e.in===void 0){let e={instancePath:t,schemaPath:`#/oneOf/1/required`,keyword:`required`,params:{missingProperty:`in`},message:`must have required property 'in'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`control`&&n!==`in`){let e={instancePath:t,schemaPath:`#/oneOf/1/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.control!==void 0){let n=e.control;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/control`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/control`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.in!==void 0){let n=e.in;if(Array.isArray(n)){if(n.length>20){let e={instancePath:t+`/in`,schemaPath:`#/oneOf/1/properties/in/maxItems`,keyword:`maxItems`,params:{limit:20},message:`must NOT have more than 20 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/in`,schemaPath:`#/oneOf/1/properties/in/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r1){outer0:for(;r--;)for(i=r;i--;)if(u(n[r],n[i])){let e={instancePath:t+`/in`,schemaPath:`#/oneOf/1/properties/in/uniqueItems`,keyword:`uniqueItems`,params:{i:r,j:i},message:`must NOT have duplicate items (items ## `+i+` and `+r+` are identical)`};a===null?a=[e]:a.push(e),o++;break outer0}}}else{let e={instancePath:t+`/in`,schemaPath:`#/oneOf/1/properties/in/type`,keyword:`type`,params:{type:`array`},message:`must be array`};a===null?a=[e]:a.push(e),o++}}}else{let e={instancePath:t,schemaPath:`#/oneOf/1/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var g=_===o;if(g&&p)p=!1,m=[m,1];else{g&&(p=!0,m=1);let n=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.control===void 0){let e={instancePath:t,schemaPath:`#/oneOf/2/required`,keyword:`required`,params:{missingProperty:`control`},message:`must have required property 'control'`};a===null?a=[e]:a.push(e),o++}if(e.includes===void 0){let e={instancePath:t,schemaPath:`#/oneOf/2/required`,keyword:`required`,params:{missingProperty:`includes`},message:`must have required property 'includes'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`control`&&n!==`includes`){let e={instancePath:t,schemaPath:`#/oneOf/2/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.control!==void 0){let n=e.control;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/control`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/control`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.includes!==void 0&&typeof e.includes!=`string`){let e={instancePath:t+`/includes`,schemaPath:`#/oneOf/2/properties/includes/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t,schemaPath:`#/oneOf/2/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var g=n===o;if(g&&p)p=!1,m=[m,2];else{g&&(p=!0,m=2);let n=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.all===void 0){let e={instancePath:t,schemaPath:`#/oneOf/3/required`,keyword:`required`,params:{missingProperty:`all`},message:`must have required property 'all'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`all`){let e={instancePath:t,schemaPath:`#/oneOf/3/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.all!==void 0){let n=e.all;if(Array.isArray(n)){if(n.length>10){let e={instancePath:t+`/all`,schemaPath:`#/oneOf/3/properties/all/maxItems`,keyword:`maxItems`,params:{limit:10},message:`must NOT have more than 10 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/all`,schemaPath:`#/oneOf/3/properties/all/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r10){let e={instancePath:t+`/any`,schemaPath:`#/oneOf/4/properties/any/maxItems`,keyword:`maxItems`,params:{limit:10},message:`must NOT have more than 10 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/any`,schemaPath:`#/oneOf/4/properties/any/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r512){let e={instancePath:t+`/selector`,schemaPath:`#/$defs/selector/maxLength`,keyword:`maxLength`,params:{limit:512},message:`must NOT have more than 512 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/selector`,schemaPath:`#/$defs/selector/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/selector`,schemaPath:`#/$defs/selector/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}}else{let e={instancePath:t,schemaPath:`#/oneOf/0/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var f=d===o;f&&(l=!0,u=0);let v=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.type===void 0){let e={instancePath:t,schemaPath:`#/oneOf/1/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.selector===void 0){let e={instancePath:t,schemaPath:`#/oneOf/1/required`,keyword:`required`,params:{missingProperty:`selector`},message:`must have required property 'selector'`};a===null?a=[e]:a.push(e),o++}if(e.property===void 0){let e={instancePath:t,schemaPath:`#/oneOf/1/required`,keyword:`required`,params:{missingProperty:`property`},message:`must have required property 'property'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`type`&&n!==`selector`&&n!==`property`){let e={instancePath:t,schemaPath:`#/oneOf/1/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.type!==void 0&&e.type!==`style`){let e={instancePath:t+`/type`,schemaPath:`#/oneOf/1/properties/type/const`,keyword:`const`,params:{allowedValue:`style`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.selector!==void 0){let n=e.selector;if(typeof n==`string`){if(s(n)>512){let e={instancePath:t+`/selector`,schemaPath:`#/$defs/selector/maxLength`,keyword:`maxLength`,params:{limit:512},message:`must NOT have more than 512 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/selector`,schemaPath:`#/$defs/selector/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/selector`,schemaPath:`#/$defs/selector/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.property!==void 0){let n=e.property;if(typeof n==`string`){if(s(n)>100){let e={instancePath:t+`/property`,schemaPath:`#/oneOf/1/properties/property/maxLength`,keyword:`maxLength`,params:{limit:100},message:`must NOT have more than 100 characters`};a===null?a=[e]:a.push(e),o++}if(!m.test(n)){let e={instancePath:t+`/property`,schemaPath:`#/oneOf/1/properties/property/pattern`,keyword:`pattern`,params:{pattern:`^(--[a-zA-Z0-9_-]+|[a-z][a-z-]*)$`},message:`must match pattern "^(--[a-zA-Z0-9_-]+|[a-z][a-z-]*)$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/property`,schemaPath:`#/oneOf/1/properties/property/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}}else{let e={instancePath:t,schemaPath:`#/oneOf/1/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var f=v===o;if(f&&l)l=!1,u=[u,1];else{f&&(l=!0,u=1);let n=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.type===void 0){let e={instancePath:t,schemaPath:`#/oneOf/2/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.key===void 0){let e={instancePath:t,schemaPath:`#/oneOf/2/required`,keyword:`required`,params:{missingProperty:`key`},message:`must have required property 'key'`};a===null?a=[e]:a.push(e),o++}if(e.mode===void 0){let e={instancePath:t,schemaPath:`#/oneOf/2/required`,keyword:`required`,params:{missingProperty:`mode`},message:`must have required property 'mode'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`type`&&n!==`key`&&n!==`mode`){let e={instancePath:t,schemaPath:`#/oneOf/2/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.type!==void 0&&e.type!==`query`){let e={instancePath:t+`/type`,schemaPath:`#/oneOf/2/properties/type/const`,keyword:`const`,params:{allowedValue:`query`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.key!==void 0){let n=e.key;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/key`,schemaPath:`#/oneOf/2/properties/key/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/key`,schemaPath:`#/oneOf/2/properties/key/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/key`,schemaPath:`#/oneOf/2/properties/key/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.mode!==void 0){let n=e.mode;if(n!==`in-place`&&n!==`navigate`){let e={instancePath:t+`/mode`,schemaPath:`#/oneOf/2/properties/mode/enum`,keyword:`enum`,params:{allowedValues:p.oneOf[2].properties.mode.enum},message:`must be equal to one of the allowed values`};a===null?a=[e]:a.push(e),o++}}}else{let e={instancePath:t,schemaPath:`#/oneOf/2/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var f=n===o;if(f&&l)l=!1,u=[u,2];else{f&&(l=!0,u=2);let n=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.type===void 0){let e={instancePath:t,schemaPath:`#/oneOf/3/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.mode===void 0){let e={instancePath:t,schemaPath:`#/oneOf/3/required`,keyword:`required`,params:{missingProperty:`mode`},message:`must have required property 'mode'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`type`&&n!==`mode`){let e={instancePath:t,schemaPath:`#/oneOf/3/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.type!==void 0&&e.type!==`hash`){let e={instancePath:t+`/type`,schemaPath:`#/oneOf/3/properties/type/const`,keyword:`const`,params:{allowedValue:`hash`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.mode!==void 0){let n=e.mode;if(n!==`in-place`&&n!==`navigate`){let e={instancePath:t+`/mode`,schemaPath:`#/oneOf/3/properties/mode/enum`,keyword:`enum`,params:{allowedValues:p.oneOf[3].properties.mode.enum},message:`must be equal to one of the allowed values`};a===null?a=[e]:a.push(e),o++}}}else{let e={instancePath:t,schemaPath:`#/oneOf/3/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var f=n===o;if(f&&l)l=!1,u=[u,3];else{f&&(l=!0,u=3);let n=o;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.type===void 0){let e={instancePath:t,schemaPath:`#/oneOf/4/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.object===void 0){let e={instancePath:t,schemaPath:`#/oneOf/4/required`,keyword:`required`,params:{missingProperty:`object`},message:`must have required property 'object'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`type`&&n!==`object`&&n!==`read`&&n!==`write`&&n!==`action`&&n!==`subscribe`&&n!==`pollMs`){let e={instancePath:t,schemaPath:`#/oneOf/4/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.type!==void 0&&e.type!==`api`){let e={instancePath:t+`/type`,schemaPath:`#/oneOf/4/properties/type/const`,keyword:`const`,params:{allowedValue:`api`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.object!==void 0){let n=e.object;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/object`,schemaPath:`#/oneOf/4/properties/object/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(!h.test(n)){let e={instancePath:t+`/object`,schemaPath:`#/oneOf/4/properties/object/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z_$][a-zA-Z0-9_$]*(\\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$`},message:`must match pattern "^[a-zA-Z_$][a-zA-Z0-9_$]*(\\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/object`,schemaPath:`#/oneOf/4/properties/object/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.read!==void 0){let n=e.read;if(typeof n==`string`){if(s(n)>64){let e={instancePath:t+`/read`,schemaPath:`#/$defs/method/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};a===null?a=[e]:a.push(e),o++}if(!g.test(n)){let e={instancePath:t+`/read`,schemaPath:`#/$defs/method/pattern`,keyword:`pattern`,params:{pattern:`^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$`},message:`must match pattern "^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/read`,schemaPath:`#/$defs/method/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.write!==void 0){let n=e.write;if(typeof n==`string`){if(s(n)>64){let e={instancePath:t+`/write`,schemaPath:`#/$defs/method/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};a===null?a=[e]:a.push(e),o++}if(!g.test(n)){let e={instancePath:t+`/write`,schemaPath:`#/$defs/method/pattern`,keyword:`pattern`,params:{pattern:`^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$`},message:`must match pattern "^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/write`,schemaPath:`#/$defs/method/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.action!==void 0){let n=e.action;if(typeof n==`string`){if(s(n)>64){let e={instancePath:t+`/action`,schemaPath:`#/$defs/method/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};a===null?a=[e]:a.push(e),o++}if(!g.test(n)){let e={instancePath:t+`/action`,schemaPath:`#/$defs/method/pattern`,keyword:`pattern`,params:{pattern:`^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$`},message:`must match pattern "^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/action`,schemaPath:`#/$defs/method/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.subscribe!==void 0){let n=e.subscribe;if(typeof n==`string`){if(s(n)>64){let e={instancePath:t+`/subscribe`,schemaPath:`#/$defs/method/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};a===null?a=[e]:a.push(e),o++}if(!g.test(n)){let e={instancePath:t+`/subscribe`,schemaPath:`#/$defs/method/pattern`,keyword:`pattern`,params:{pattern:`^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$`},message:`must match pattern "^(?!constructor$|prototype$|__proto__$)[a-zA-Z_$][a-zA-Z0-9_$]*$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/subscribe`,schemaPath:`#/$defs/method/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.pollMs!==void 0){let n=e.pollMs;if(typeof n!=`number`||n%1||isNaN(n)||!isFinite(n)){let e={instancePath:t+`/pollMs`,schemaPath:`#/oneOf/4/properties/pollMs/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};a===null?a=[e]:a.push(e),o++}if(typeof n==`number`&&isFinite(n)){if(n>6e4||isNaN(n)){let e={instancePath:t+`/pollMs`,schemaPath:`#/oneOf/4/properties/pollMs/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:6e4},message:`must be <= 60000`};a===null?a=[e]:a.push(e),o++}if(n<100||isNaN(n)){let e={instancePath:t+`/pollMs`,schemaPath:`#/oneOf/4/properties/pollMs/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:100},message:`must be >= 100`};a===null?a=[e]:a.push(e),o++}}}}else{let e={instancePath:t,schemaPath:`#/oneOf/4/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}var f=n===o;f&&l?(l=!1,u=[u,4]):f&&(l=!0,u=4)}}}if(l)o=c,a!==null&&(c?a.length=c:a=null);else{let e={instancePath:t,schemaPath:`#/oneOf`,keyword:`oneOf`,params:{passingSchemas:u},message:`must match exactly one schema in oneOf`};a===null?a=[e]:a.push(e),o++}return _.errors=a,o===0}function v(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!=="default"&&n!==`binding`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`boolean`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`boolean`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.default!==void 0&&typeof e.default!=`boolean`){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return v.errors=a,o===0}var y={type:`object`,additionalProperties:!1,required:[`id`,`label`,`type`,`default`,`min`,`max`],properties:{id:{$ref:`#/$defs/id`},label:{$ref:`#/$defs/label`},type:{const:`number`},default:{type:`number`},binding:{$ref:`#/$defs/binding`},min:{type:`number`},max:{type:`number`},step:{type:`number`,exclusiveMinimum:0},group:{$ref:`#/$defs/id`},when:{$ref:`#/$defs/condition`}}};function b(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),l++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),l++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),l++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),l++}if(e.min===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`min`},message:`must have required property 'min'`};a===null?a=[e]:a.push(e),l++}if(e.max===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`max`},message:`must have required property 'max'`};a===null?a=[e]:a.push(e),l++}for(let n in e)if(!o.call(y.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),l++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),l++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.type!==void 0&&e.type!==`number`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`number`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),l++}if(e.default!==void 0){let n=e.default;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),l=a.length)),e.min!==void 0){let n=e.min;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/min`,schemaPath:`#/properties/min/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.max!==void 0){let n=e.max;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/max`,schemaPath:`#/properties/max/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.step!==void 0){let n=e.step;if(typeof n==`number`&&isFinite(n)){if(n<=0||isNaN(n)){let e={instancePath:t+`/step`,schemaPath:`#/properties/step/exclusiveMinimum`,keyword:`exclusiveMinimum`,params:{comparison:`>`,limit:0},message:`must be > 0`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/step`,schemaPath:`#/properties/step/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),l=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),l++}return b.errors=a,l===0}var x={type:`object`,additionalProperties:!1,required:[`id`,`label`,`type`,`default`,`min`,`max`],properties:{id:{$ref:`#/$defs/id`},label:{$ref:`#/$defs/label`},type:{const:`slider`},default:{type:`number`},binding:{$ref:`#/$defs/binding`},min:{type:`number`},max:{type:`number`},step:{type:`number`,exclusiveMinimum:0},group:{$ref:`#/$defs/id`},when:{$ref:`#/$defs/condition`}}};function S(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),l++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),l++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),l++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),l++}if(e.min===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`min`},message:`must have required property 'min'`};a===null?a=[e]:a.push(e),l++}if(e.max===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`max`},message:`must have required property 'max'`};a===null?a=[e]:a.push(e),l++}for(let n in e)if(!o.call(x.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),l++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),l++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.type!==void 0&&e.type!==`slider`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`slider`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),l++}if(e.default!==void 0){let n=e.default;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),l=a.length)),e.min!==void 0){let n=e.min;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/min`,schemaPath:`#/properties/min/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.max!==void 0){let n=e.max;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/max`,schemaPath:`#/properties/max/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.step!==void 0){let n=e.step;if(typeof n==`number`&&isFinite(n)){if(n<=0||isNaN(n)){let e={instancePath:t+`/step`,schemaPath:`#/properties/step/exclusiveMinimum`,keyword:`exclusiveMinimum`,params:{comparison:`>`,limit:0},message:`must be > 0`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/step`,schemaPath:`#/properties/step/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),l=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),l++}return S.errors=a,l===0}var C={type:`object`,additionalProperties:!1,required:[`id`,`label`,`type`,`default`,`options`],properties:{id:{$ref:`#/$defs/id`},label:{$ref:`#/$defs/label`},type:{enum:[`select`,`radio`,`segmented`]},default:{type:`string`},binding:{$ref:`#/$defs/binding`},options:{$ref:`#/$defs/options`},group:{$ref:`#/$defs/id`},when:{$ref:`#/$defs/condition`}}};function w(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),o++}if(e.options===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`options`},message:`must have required property 'options'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!=="default"&&n!==`binding`&&n!==`options`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0){let n=e.type;if(n!==`select`&&n!==`radio`&&n!==`segmented`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/enum`,keyword:`enum`,params:{allowedValues:C.properties.type.enum},message:`must be equal to one of the allowed values`};a===null?a=[e]:a.push(e),o++}}if(e.default!==void 0&&typeof e.default!=`string`){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.options!==void 0){let n=e.options;if(Array.isArray(n)){if(n.length>100){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(e)<1){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}let r=n.length,i;if(r>1){let e={};for(;r--;){let s=n[r];if(typeof s==`string`){if(typeof e[s]==`number`){i=e[s];let n={instancePath:t+`/options`,schemaPath:`#/$defs/options/uniqueItems`,keyword:`uniqueItems`,params:{i:r,j:i},message:`must NOT have duplicate items (items ## `+i+` and `+r+` are identical)`};a===null?a=[n]:a.push(n),o++;break}e[s]=r}}}}else{let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/type`,keyword:`type`,params:{type:`array`},message:`must be array`};a===null?a=[e]:a.push(e),o++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return w.errors=a,o===0}function T(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),o++}if(e.options===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`options`},message:`must have required property 'options'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!==`binding`&&n!=="default"&&n!==`options`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`checkboxGroup`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`checkboxGroup`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.default!==void 0){let n=e.default;if(Array.isArray(n)){let e=n.length;for(let r=0;r1){let e={};for(;r--;){let s=n[r];if(typeof s==`string`){if(typeof e[s]==`number`){i=e[s];let n={instancePath:t+`/default`,schemaPath:`#/properties/default/uniqueItems`,keyword:`uniqueItems`,params:{i:r,j:i},message:`must NOT have duplicate items (items ## `+i+` and `+r+` are identical)`};a===null?a=[n]:a.push(n),o++;break}e[s]=r}}}}else{let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`array`},message:`must be array`};a===null?a=[e]:a.push(e),o++}}if(e.options!==void 0){let n=e.options;if(Array.isArray(n)){if(n.length>100){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(e)<1){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}let r=n.length,i;if(r>1){let e={};for(;r--;){let s=n[r];if(typeof s==`string`){if(typeof e[s]==`number`){i=e[s];let n={instancePath:t+`/options`,schemaPath:`#/$defs/options/uniqueItems`,keyword:`uniqueItems`,params:{i:r,j:i},message:`must NOT have duplicate items (items ## `+i+` and `+r+` are identical)`};a===null?a=[n]:a.push(n),o++;break}e[s]=r}}}}else{let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/type`,keyword:`type`,params:{type:`array`},message:`must be array`};a===null?a=[e]:a.push(e),o++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return T.errors=a,o===0}var E={type:`object`,additionalProperties:!1,required:[`id`,`label`,`type`,`default`],properties:{id:{$ref:`#/$defs/id`},label:{$ref:`#/$defs/label`},type:{enum:[`text`,`textarea`]},default:{type:`string`},binding:{$ref:`#/$defs/binding`},minLength:{type:`integer`,minimum:0},maxLength:{type:`integer`,minimum:0},group:{$ref:`#/$defs/id`},when:{$ref:`#/$defs/condition`}}};function D(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),l++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),l++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),l++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),l++}for(let n in e)if(!o.call(E.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),l++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),l++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.type!==void 0){let n=e.type;if(n!==`text`&&n!==`textarea`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/enum`,keyword:`enum`,params:{allowedValues:E.properties.type.enum},message:`must be equal to one of the allowed values`};a===null?a=[e]:a.push(e),l++}}if(e.default!==void 0&&typeof e.default!=`string`){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),l=a.length)),e.minLength!==void 0){let n=e.minLength;if(typeof n!=`number`||n%1||isNaN(n)||!isFinite(n)){let e={instancePath:t+`/minLength`,schemaPath:`#/properties/minLength/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};a===null?a=[e]:a.push(e),l++}if(typeof n==`number`&&isFinite(n)&&(n<0||isNaN(n))){let e={instancePath:t+`/minLength`,schemaPath:`#/properties/minLength/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:0},message:`must be >= 0`};a===null?a=[e]:a.push(e),l++}}if(e.maxLength!==void 0){let n=e.maxLength;if(typeof n!=`number`||n%1||isNaN(n)||!isFinite(n)){let e={instancePath:t+`/maxLength`,schemaPath:`#/properties/maxLength/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};a===null?a=[e]:a.push(e),l++}if(typeof n==`number`&&isFinite(n)&&(n<0||isNaN(n))){let e={instancePath:t+`/maxLength`,schemaPath:`#/properties/maxLength/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:0},message:`must be >= 0`};a===null?a=[e]:a.push(e),l++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),l=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),l++}return D.errors=a,l===0}var O=RegExp(`^#[0-9a-fA-F]{6}$`,`u`);function k(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!=="default"&&n!==`binding`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`color`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`color`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.default!==void 0){let n=e.default;if(typeof n==`string`){if(!O.test(n)){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/pattern`,keyword:`pattern`,params:{pattern:`^#[0-9a-fA-F]{6}$`},message:`must match pattern "^#[0-9a-fA-F]{6}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return k.errors=a,o===0}function A(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!==`binding`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`button`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`button`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return A.errors=a,o===0}function j(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let l=null,u=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.version===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`version`},message:`must have required property 'version'`};l===null?l=[e]:l.push(e),u++}if(e.scope===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`scope`},message:`must have required property 'scope'`};l===null?l=[e]:l.push(e),u++}if(e.controls===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`controls`},message:`must have required property 'controls'`};l===null?l=[e]:l.push(e),u++}for(let n in e)if(!o.call(a.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};l===null?l=[e]:l.push(e),u++}if(e.$schema!==void 0&&typeof e.$schema!=`string`){let e={instancePath:t+`/$schema`,schemaPath:`#/properties/%24schema/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}if(e.version!==void 0&&e.version!==1){let e={instancePath:t+`/version`,schemaPath:`#/properties/version/const`,keyword:`const`,params:{allowedValue:1},message:`must be equal to constant`};l===null?l=[e]:l.push(e),u++}if(e.scope!==void 0){let n=e.scope;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/scope`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};l===null?l=[e]:l.push(e),u++}}else{let e={instancePath:t+`/scope`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};l===null?l=[e]:l.push(e),u++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};l===null?l=[e]:l.push(e),u++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}}if(e.role!==void 0){let n=e.role;if(n!==`shared`&&n!==`page`){let e={instancePath:t+`/role`,schemaPath:`#/properties/role/enum`,keyword:`enum`,params:{allowedValues:a.properties.role.enum},message:`must be equal to one of the allowed values`};l===null?l=[e]:l.push(e),u++}}if(e.container!==void 0){let n=e.container;if(typeof n==`string`){if(s(n)>512){let e={instancePath:t+`/container`,schemaPath:`#/$defs/selector/maxLength`,keyword:`maxLength`,params:{limit:512},message:`must NOT have more than 512 characters`};l===null?l=[e]:l.push(e),u++}if(s(n)<1){let e={instancePath:t+`/container`,schemaPath:`#/$defs/selector/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};l===null?l=[e]:l.push(e),u++}}else{let e={instancePath:t+`/container`,schemaPath:`#/$defs/selector/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}}if(e.panel!==void 0){let n=e.panel;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.width===void 0){let e={instancePath:t+`/panel`,schemaPath:`#/properties/panel/required`,keyword:`required`,params:{missingProperty:`width`},message:`must have required property 'width'`};l===null?l=[e]:l.push(e),u++}for(let e in n)if(e!==`width`){let n={instancePath:t+`/panel`,schemaPath:`#/properties/panel/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};l===null?l=[n]:l.push(n),u++}if(n.width!==void 0){let e=n.width;if(typeof e!=`number`||e%1||isNaN(e)||!isFinite(e)){let e={instancePath:t+`/panel/width`,schemaPath:`#/properties/panel/properties/width/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};l===null?l=[e]:l.push(e),u++}if(typeof e==`number`&&isFinite(e)){if(e>4096||isNaN(e)){let e={instancePath:t+`/panel/width`,schemaPath:`#/properties/panel/properties/width/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:4096},message:`must be <= 4096`};l===null?l=[e]:l.push(e),u++}if(e<160||isNaN(e)){let e={instancePath:t+`/panel/width`,schemaPath:`#/properties/panel/properties/width/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:160},message:`must be >= 160`};l===null?l=[e]:l.push(e),u++}}}}else{let e={instancePath:t+`/panel`,schemaPath:`#/properties/panel/type`,keyword:`type`,params:{type:`object`},message:`must be object`};l===null?l=[e]:l.push(e),u++}}if(e.groups!==void 0){let n=e.groups;if(Array.isArray(n)){if(n.length>100){let e={instancePath:t+`/groups`,schemaPath:`#/properties/groups/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};l===null?l=[e]:l.push(e),u++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/groups/`+r+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};l===null?l=[e]:l.push(e),u++}if(s(n)<1){let e={instancePath:t+`/groups/`+r+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};l===null?l=[e]:l.push(e),u++}}else{let e={instancePath:t+`/groups/`+r+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/groups/`+r+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(l=l===null?f.errors:l.concat(f.errors),u=l.length))}else{let e={instancePath:t+`/groups/`+r,schemaPath:`#/properties/groups/items/type`,keyword:`type`,params:{type:`object`},message:`must be object`};l===null?l=[e]:l.push(e),u++}}}else{let e={instancePath:t+`/groups`,schemaPath:`#/properties/groups/type`,keyword:`type`,params:{type:`array`},message:`must be array`};l===null?l=[e]:l.push(e),u++}}if(e.controls!==void 0){let n=e.controls;if(Array.isArray(n)){if(n.length>500){let e={instancePath:t+`/controls`,schemaPath:`#/properties/controls/maxItems`,keyword:`maxItems`,params:{limit:500},message:`must NOT have more than 500 items`};l===null?l=[e]:l.push(e),u++}let e=n.length;for(let r=0;r100){let e={instancePath:t+`/sets`,schemaPath:`#/properties/sets/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/sets`,schemaPath:`#/properties/sets/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};l===null?l=[e]:l.push(e),u++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};l===null?l=[e]:l.push(e),u++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}}if(e.role!==void 0){let n=e.role;if(n!==`shared`&&n!==`page`){let e={instancePath:t+`/role`,schemaPath:`#/properties/role/enum`,keyword:`enum`,params:{allowedValues:a.properties.role.enum},message:`must be equal to one of the allowed values`};l===null?l=[e]:l.push(e),u++}}if(e.container!==void 0){let n=e.container;if(typeof n==`string`){if(s(n)>512){let e={instancePath:t+`/container`,schemaPath:`#/$defs/selector/maxLength`,keyword:`maxLength`,params:{limit:512},message:`must NOT have more than 512 characters`};l===null?l=[e]:l.push(e),u++}if(s(n)<1){let e={instancePath:t+`/container`,schemaPath:`#/$defs/selector/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};l===null?l=[e]:l.push(e),u++}}else{let e={instancePath:t+`/container`,schemaPath:`#/$defs/selector/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}}if(e.panel!==void 0){let n=e.panel;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.width===void 0){let e={instancePath:t+`/panel`,schemaPath:`#/properties/panel/required`,keyword:`required`,params:{missingProperty:`width`},message:`must have required property 'width'`};l===null?l=[e]:l.push(e),u++}for(let e in n)if(e!==`width`){let n={instancePath:t+`/panel`,schemaPath:`#/properties/panel/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};l===null?l=[n]:l.push(n),u++}if(n.width!==void 0){let e=n.width;if(typeof e!=`number`||e%1||isNaN(e)||!isFinite(e)){let e={instancePath:t+`/panel/width`,schemaPath:`#/properties/panel/properties/width/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};l===null?l=[e]:l.push(e),u++}if(typeof e==`number`&&isFinite(e)){if(e>4096||isNaN(e)){let e={instancePath:t+`/panel/width`,schemaPath:`#/properties/panel/properties/width/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:4096},message:`must be <= 4096`};l===null?l=[e]:l.push(e),u++}if(e<160||isNaN(e)){let e={instancePath:t+`/panel/width`,schemaPath:`#/properties/panel/properties/width/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:160},message:`must be >= 160`};l===null?l=[e]:l.push(e),u++}}}}else{let e={instancePath:t+`/panel`,schemaPath:`#/properties/panel/type`,keyword:`type`,params:{type:`object`},message:`must be object`};l===null?l=[e]:l.push(e),u++}}if(e.groups!==void 0){let n=e.groups;if(Array.isArray(n)){if(n.length>100){let e={instancePath:t+`/groups`,schemaPath:`#/properties/groups/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};l===null?l=[e]:l.push(e),u++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/groups/`+r+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};l===null?l=[e]:l.push(e),u++}if(s(n)<1){let e={instancePath:t+`/groups/`+r+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};l===null?l=[e]:l.push(e),u++}}else{let e={instancePath:t+`/groups/`+r+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};l===null?l=[e]:l.push(e),u++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/groups/`+r+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(l=l===null?f.errors:l.concat(f.errors),u=l.length))}else{let e={instancePath:t+`/groups/`+r,schemaPath:`#/properties/groups/items/type`,keyword:`type`,params:{type:`object`},message:`must be object`};l===null?l=[e]:l.push(e),u++}}}else{let e={instancePath:t+`/groups`,schemaPath:`#/properties/groups/type`,keyword:`type`,params:{type:`array`},message:`must be array`};l===null?l=[e]:l.push(e),u++}}if(e.controls!==void 0){let n=e.controls;if(Array.isArray(n)){if(n.length>500){let e={instancePath:t+`/controls`,schemaPath:`#/properties/controls/maxItems`,keyword:`maxItems`,params:{limit:500},message:`must NOT have more than 500 items`};l===null?l=[e]:l.push(e),u++}let e=n.length;for(let r=0;r100){let e={instancePath:t+`/sets`,schemaPath:`#/properties/sets/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/sets`,schemaPath:`#/properties/sets/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`boolean`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`boolean`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.default!==void 0&&typeof e.default!=`boolean`){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return L.errors=a,o===0}e.number=R;function R(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),l++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),l++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),l++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),l++}if(e.min===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`min`},message:`must have required property 'min'`};a===null?a=[e]:a.push(e),l++}if(e.max===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`max`},message:`must have required property 'max'`};a===null?a=[e]:a.push(e),l++}for(let n in e)if(!o.call(y.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),l++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),l++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.type!==void 0&&e.type!==`number`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`number`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),l++}if(e.default!==void 0){let n=e.default;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),l=a.length)),e.min!==void 0){let n=e.min;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/min`,schemaPath:`#/properties/min/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.max!==void 0){let n=e.max;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/max`,schemaPath:`#/properties/max/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.step!==void 0){let n=e.step;if(typeof n==`number`&&isFinite(n)){if(n<=0||isNaN(n)){let e={instancePath:t+`/step`,schemaPath:`#/properties/step/exclusiveMinimum`,keyword:`exclusiveMinimum`,params:{comparison:`>`,limit:0},message:`must be > 0`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/step`,schemaPath:`#/properties/step/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),l=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),l++}return R.errors=a,l===0}e.slider=ee;function ee(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),l++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),l++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),l++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),l++}if(e.min===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`min`},message:`must have required property 'min'`};a===null?a=[e]:a.push(e),l++}if(e.max===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`max`},message:`must have required property 'max'`};a===null?a=[e]:a.push(e),l++}for(let n in e)if(!o.call(x.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),l++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),l++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.type!==void 0&&e.type!==`slider`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`slider`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),l++}if(e.default!==void 0){let n=e.default;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),l=a.length)),e.min!==void 0){let n=e.min;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/min`,schemaPath:`#/properties/min/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.max!==void 0){let n=e.max;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/max`,schemaPath:`#/properties/max/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.step!==void 0){let n=e.step;if(typeof n==`number`&&isFinite(n)){if(n<=0||isNaN(n)){let e={instancePath:t+`/step`,schemaPath:`#/properties/step/exclusiveMinimum`,keyword:`exclusiveMinimum`,params:{comparison:`>`,limit:0},message:`must be > 0`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/step`,schemaPath:`#/properties/step/type`,keyword:`type`,params:{type:`number`},message:`must be number`};a===null?a=[e]:a.push(e),l++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),l=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),l++}return ee.errors=a,l===0}e.choice=te;function te(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),o++}if(e.options===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`options`},message:`must have required property 'options'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!=="default"&&n!==`binding`&&n!==`options`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0){let n=e.type;if(n!==`select`&&n!==`radio`&&n!==`segmented`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/enum`,keyword:`enum`,params:{allowedValues:C.properties.type.enum},message:`must be equal to one of the allowed values`};a===null?a=[e]:a.push(e),o++}}if(e.default!==void 0&&typeof e.default!=`string`){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.options!==void 0){let n=e.options;if(Array.isArray(n)){if(n.length>100){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(e)<1){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}let r=n.length,i;if(r>1){let e={};for(;r--;){let s=n[r];if(typeof s==`string`){if(typeof e[s]==`number`){i=e[s];let n={instancePath:t+`/options`,schemaPath:`#/$defs/options/uniqueItems`,keyword:`uniqueItems`,params:{i:r,j:i},message:`must NOT have duplicate items (items ## `+i+` and `+r+` are identical)`};a===null?a=[n]:a.push(n),o++;break}e[s]=r}}}}else{let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/type`,keyword:`type`,params:{type:`array`},message:`must be array`};a===null?a=[e]:a.push(e),o++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return te.errors=a,o===0}e.checkboxGroup=ne;function ne(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),o++}if(e.options===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`options`},message:`must have required property 'options'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!==`binding`&&n!=="default"&&n!==`options`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`checkboxGroup`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`checkboxGroup`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.default!==void 0){let n=e.default;if(Array.isArray(n)){let e=n.length;for(let r=0;r1){let e={};for(;r--;){let s=n[r];if(typeof s==`string`){if(typeof e[s]==`number`){i=e[s];let n={instancePath:t+`/default`,schemaPath:`#/properties/default/uniqueItems`,keyword:`uniqueItems`,params:{i:r,j:i},message:`must NOT have duplicate items (items ## `+i+` and `+r+` are identical)`};a===null?a=[n]:a.push(n),o++;break}e[s]=r}}}}else{let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`array`},message:`must be array`};a===null?a=[e]:a.push(e),o++}}if(e.options!==void 0){let n=e.options;if(Array.isArray(n)){if(n.length>100){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/maxItems`,keyword:`maxItems`,params:{limit:100},message:`must NOT have more than 100 items`};a===null?a=[e]:a.push(e),o++}if(n.length<1){let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/minItems`,keyword:`minItems`,params:{limit:1},message:`must NOT have fewer than 1 items`};a===null?a=[e]:a.push(e),o++}let e=n.length;for(let r=0;r200){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(e)<1){let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/options/`+r,schemaPath:`#/$defs/options/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}let r=n.length,i;if(r>1){let e={};for(;r--;){let s=n[r];if(typeof s==`string`){if(typeof e[s]==`number`){i=e[s];let n={instancePath:t+`/options`,schemaPath:`#/$defs/options/uniqueItems`,keyword:`uniqueItems`,params:{i:r,j:i},message:`must NOT have duplicate items (items ## `+i+` and `+r+` are identical)`};a===null?a=[n]:a.push(n),o++;break}e[s]=r}}}}else{let e={instancePath:t+`/options`,schemaPath:`#/$defs/options/type`,keyword:`type`,params:{type:`array`},message:`must be array`};a===null?a=[e]:a.push(e),o++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return ne.errors=a,o===0}e.text=re;function re(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,l=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),l++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),l++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),l++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),l++}for(let n in e)if(!o.call(E.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),l++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),l++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}if(e.type!==void 0){let n=e.type;if(n!==`text`&&n!==`textarea`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/enum`,keyword:`enum`,params:{allowedValues:E.properties.type.enum},message:`must be equal to one of the allowed values`};a===null?a=[e]:a.push(e),l++}}if(e.default!==void 0&&typeof e.default!=`string`){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),l=a.length)),e.minLength!==void 0){let n=e.minLength;if(typeof n!=`number`||n%1||isNaN(n)||!isFinite(n)){let e={instancePath:t+`/minLength`,schemaPath:`#/properties/minLength/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};a===null?a=[e]:a.push(e),l++}if(typeof n==`number`&&isFinite(n)&&(n<0||isNaN(n))){let e={instancePath:t+`/minLength`,schemaPath:`#/properties/minLength/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:0},message:`must be >= 0`};a===null?a=[e]:a.push(e),l++}}if(e.maxLength!==void 0){let n=e.maxLength;if(typeof n!=`number`||n%1||isNaN(n)||!isFinite(n)){let e={instancePath:t+`/maxLength`,schemaPath:`#/properties/maxLength/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};a===null?a=[e]:a.push(e),l++}if(typeof n==`number`&&isFinite(n)&&(n<0||isNaN(n))){let e={instancePath:t+`/maxLength`,schemaPath:`#/properties/maxLength/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:0},message:`must be >= 0`};a===null?a=[e]:a.push(e),l++}}if(e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),l++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),l++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),l=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),l++}return re.errors=a,l===0}e.color=z;function z(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}if(e.default===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`default`},message:`must have required property 'default'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!=="default"&&n!==`binding`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`color`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`color`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.default!==void 0){let n=e.default;if(typeof n==`string`){if(!O.test(n)){let e={instancePath:t+`/default`,schemaPath:`#/properties/default/pattern`,keyword:`pattern`,params:{pattern:`^#[0-9a-fA-F]{6}$`},message:`must match pattern "^#[0-9a-fA-F]{6}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/default`,schemaPath:`#/properties/default/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return z.errors=a,o===0}e.button=ie;function ie(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e}={}){let a=null,o=0;if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};a===null?a=[e]:a.push(e),o++}if(e.label===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`label`},message:`must have required property 'label'`};a===null?a=[e]:a.push(e),o++}if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};a===null?a=[e]:a.push(e),o++}for(let n in e)if(n!==`id`&&n!==`label`&&n!==`type`&&n!==`binding`&&n!==`group`&&n!==`when`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};a===null?a=[e]:a.push(e),o++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/id`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.label!==void 0){let n=e.label;if(typeof n==`string`){if(s(n)>200){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/maxLength`,keyword:`maxLength`,params:{limit:200},message:`must NOT have more than 200 characters`};a===null?a=[e]:a.push(e),o++}if(s(n)<1){let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/label`,schemaPath:`#/$defs/label/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}if(e.type!==void 0&&e.type!==`button`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`button`},message:`must be equal to constant`};a===null?a=[e]:a.push(e),o++}if(e.binding!==void 0&&(_(e.binding,{instancePath:t+`/binding`,parentData:e,parentDataProperty:`binding`,rootData:i})||(a=a===null?_.errors:a.concat(_.errors),o=a.length)),e.group!==void 0){let n=e.group;if(typeof n==`string`){if(!c.test(n)){let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`},message:`must match pattern "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"`};a===null?a=[e]:a.push(e),o++}}else{let e={instancePath:t+`/group`,schemaPath:`#/$defs/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};a===null?a=[e]:a.push(e),o++}}e.when!==void 0&&(f(e.when,{instancePath:t+`/when`,parentData:e,parentDataProperty:`when`,rootData:i})||(a=a===null?f.errors:a.concat(f.errors),o=a.length))}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};a===null?a=[e]:a.push(e),o++}return ie.errors=a,o===0}})))(),1);function l(e){if(e&&typeof e==`object`){for(let t of Object.values(e))l(t);Object.freeze(e)}return e}function u(e){return Array.isArray(e)?`[${e.map(u).join(`,`)}]`:e&&typeof e==`object`?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${u(e[t])}`).join(`,`)}}`:JSON.stringify(e)}function d(e,t){if(!e)return!0;if(e.all)return e.all.every(e=>d(e,t));if(e.any)return e.any.some(e=>d(e,t));let n=t[e.control];return`equals`in e?n===e.equals:`in`in e?e.in.includes(n):Array.isArray(n)&&n.includes(e.includes)}var{validateDocumentShape:f,validateDeclaration:p}=c.default,m={boolean:`boolean`,number:`number`,slider:`slider`,select:`choice`,radio:`choice`,segmented:`choice`,checkboxGroup:`checkboxGroup`,text:`text`,textarea:`text`,color:`color`,button:`button`};function h(e){let t=[...p.errors].filter(e=>!/^\/controls\/\d+(?:\/|$)/.test(e.instancePath)).map(e=>({...e}));return Array.isArray(e?.controls)&&e.controls.forEach((e,n)=>{let r=Object.hasOwn(m,e?.type)?m[e.type]:void 0,i=r&&c.default[r];i?i(e)||t.push(...i.errors.map(e=>({...e,instancePath:`/controls/${n}${e.instancePath}`}))):t.push({instancePath:`/controls/${n}/type`,message:`must name a supported control type`})}),t.map(e=>({path:e.instancePath,message:e.keyword===`additionalProperties`?`${e.message}: "${e.params.additionalProperty}"`:e.message,keyword:e.keyword,params:e.params}))}var g=class extends Error{constructor(e){super(`Invalid controls.replica.json:\n${e.map(e=>` ${e.path||`/`}: ${e.message}`).join(` `)}`),this.name=`ControlsValidationError`,this.issues=e}};function _(e,t){switch(e.type){case`boolean`:return typeof t==`boolean`?null:`must be a boolean`;case`number`:case`slider`:{if(typeof t!=`number`||!Number.isFinite(t))return`must be a finite number`;if(e.min!==void 0&&t= min`;if(e.max!==void 0&&t>e.max)return`must be <= max`;let n=(t-e.min)/(e.step??1);return!Number.isFinite(n)||Math.abs(n-Math.round(n))>1e-8?`must align with step (anchored at min)`:null}case`select`:case`radio`:case`segmented`:return e.options.includes(t)?null:`must be a declared option`;case`checkboxGroup`:return Array.isArray(t)&&new Set(t).size===t.length&&t.every(t=>e.options.includes(t))?null:`must be unique declared options`;case`text`:case`textarea`:return typeof t==`string`?e.minLength!==void 0&&[...t].lengthe.maxLength?`longer than maxLength`:null:`must be a string`;case`color`:return typeof t==`string`&&/^#[0-9a-fA-F]{6}$/.test(t)?null:`must be a six-digit hex color`;default:return`button controls have no value`}}function v(e){return e?e.control?[e.control]:(e.all??e.any).flatMap(v):[]}function y(e){let t=new Map((e.groups??[]).map(e=>[e.id,e])),n=new Map(e.controls.map(e=>[e.id,e])),r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=[];function o(e){if(r.has(e))return;if(i.has(e))throw new g([{path:`/controls/${e}/when`,message:`conditional dependency cycle (including groups)`}]);i.add(e);let s=n.get(e);for(let e of[...v(s.when),...v(t.get(s.group)?.when)])o(e);i.delete(e),r.add(e),a.push(e)}for(let e of n.keys())o(e);return a}function b(e){let t=/* @__PURE__ */ new Set;function n(e,r=0){if(r>24)throw new g([{path:`/`,message:`document nesting exceeds 24`}]);if(typeof e==`number`&&!Number.isFinite(e))throw new g([{path:`/`,message:`numbers must be finite`}]);if(![`string`,`number`,`boolean`,`object`].includes(typeof e))throw new g([{path:`/`,message:`must contain only JSON values`}]);if(e&&typeof e==`object`){if(!Array.isArray(e)&&Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw new g([{path:`/`,message:`must contain only JSON objects`}]);if(t.has(e))throw new g([{path:`/`,message:`must be an acyclic JSON document`}]);t.add(e);for(let t of Object.values(e))n(t,r+1);t.delete(e)}}n(e)}function x(e){b(e);let t=e&&typeof e==`object`&&Object.hasOwn(e,`sets`)?e.sets:[e];if(!e||typeof e!=`object`||!Object.hasOwn(e,`sets`))return C(e),S(e),e;if(!f(e))throw new g(f.errors.map(e=>({path:e.instancePath,message:e.keyword===`additionalProperties`?`${e.message}: "${e.params.additionalProperty}"`:e.message,keyword:e.keyword,params:e.params})));let n=/* @__PURE__ */ new Set;return t.forEach((e,t)=>{try{C(e),S(e)}catch(e){throw e instanceof g?new g(e.issues.map(e=>({...e,path:`/sets/${t}${e.path}`}))):e}if(n.has(e.scope))throw new g([{path:`/sets/${t}/scope`,message:`duplicate scope ${e.scope}`}]);n.add(e.scope)}),e}function S(e){let t=[];for(let[n,r]of e.controls.entries()){let e=r.binding,i=`/controls/${n}/binding`;e?((r.type===`button`&&![`button`,`api`].includes(e.type)||r.type!==`button`&&e.type===`button`)&&t.push({path:i,message:`binding does not match the control type`}),e.type===`query`&&(e.key===`rc`||e.key.startsWith(`rc.`))&&t.push({path:i,message:`rc and rc.* are reserved for control settings`}),e.type===`api`&&(([`window`,`globalThis`,`self`,`parent`,`top`,`document`,`location`,`history`,`navigator`].includes(e.object.split(`.`)[0])||[e.read,e.write,e.action,e.subscribe].some(e=>[`eval`,`Function`].includes(e)))&&t.push({path:i,message:`API bindings must name an app-owned object and ordinary methods`}),e.object.split(`.`).some(e=>[`constructor`,`prototype`,`__proto__`].includes(e))&&t.push({path:i,message:`API object must name the app's own exposed object`}),r.type===`button`?(!e.action||e.read||e.write||e.subscribe||e.pollMs)&&t.push({path:i,message:`API buttons require only object and action`}):(!e.read||!e.write||e.action||!!e.subscribe==!!e.pollMs)&&t.push({path:i,message:`API values require read, write, and either subscribe or pollMs`}))):t.push({path:i,message:`each control requires a binding`})}if(t.length)throw new g(t)}function C(e){if(b(e),!p(e))throw new g(h(e));let t=[];function n(e,n){t.push({path:e,message:n})}let r=/* @__PURE__ */ new Set,i=new Map((e.groups??[]).map(e=>[e.id,e])),a=new Map(e.controls.map(e=>[e.id,e]));for(let[t,i]of[[`groups`,e.groups??[]],[`controls`,e.controls]])i.forEach((e,i)=>{r.has(e.id)&&n(`/${t}/${i}/id`,`duplicate ID ${e.id}`),r.add(e.id)});function o(e,t,r=0){if(!e)return;if(r>4){n(t,`conditions support at most five levels`);return}if(e.all||e.any){let n=e.all?`all`:`any`;e[n].forEach((e,i)=>o(e,`${t}/${n}/${i}`,r+1));return}let i=a.get(e.control);if(!i||i.type===`button`)n(t,`condition must reference a value control`);else if(`includes`in e)(i.type!==`checkboxGroup`||!i.options.includes(e.includes))&&n(t,`includes requires a declared checkboxGroup option`);else if(i.type===`checkboxGroup`)n(t,`checkboxGroup conditions must use includes`);else for(let r of`in`in e?e.in:[e.equals]){let e=_(i,r);e&&n(t,`invalid condition for ${i.id}: ${e}`)}}if(e.controls.forEach((e,t)=>{let r=`/controls/${t}`;if(e.group&&!i.has(e.group)&&n(`${r}/group`,`unknown group`),e.min!==void 0&&e.max!==void 0&&e.min>e.max&&n(r,`min must not exceed max`),e.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength&&n(r,`minLength must not exceed maxLength`),e.type===`segmented`&&e.options.length>3&&n(`${r}/options`,`segmented supports at most three options`),e.type!==`button`){let t=_(e,e.default);t&&n(`${r}/default`,t)}o(e.when,`${r}/when`)}),(e.groups??[]).forEach((e,t)=>o(e.when,`/groups/${t}/when`)),t.length)throw new g(t);return y(e),e}var w=Symbol.for(`replica.controls.injected.runtime`),T=/* @__PURE__ */ new WeakMap;function E(){let e=globalThis[w];if(e&&e.version!==2)throw Error(`Replica controls runtime version mismatch; reload the page`);if(!e){let e=/* @__PURE__ */ new Map,t=/* @__PURE__ */ new Set,n=Object.freeze({version:2,create:e=>D(e),list:()=>Object.freeze([...e.values()].map(e=>e.controller)),subscribe(e){return t.add(e),()=>t.delete(e)}});T.set(n,{scopes:e,notify:()=>{for(let e of[...t])e()}}),globalThis[w]=n}return globalThis[w]}function D(e){C(e);let t=l(structuredClone(e)),n=u(t),r=E(),i=r.list().find(e=>e.declaration.scope===t.scope);if(i){if(u(i.declaration)!==n)throw Error(`Conflicting controls declaration for scope "${t.scope}"; reload after schema changes`);return i}let a=T.get(r);if(!a)return r.create(e);let o=new Map(t.controls.map(e=>[e.id,e])),s=new Map((t.groups??[]).map(e=>[e.id,e])),c=y(t),f=/* @__PURE__ */ new Set,p=/* @__PURE__ */ new Map,m=/* @__PURE__ */ new Set,h={},g=0,v=!1,b=!1,x;function S(e){for(let t of[...p.values()].reverse()){let n=t();if(Object.hasOwn(n,e)&&typeof n[e]==`function`)return n}}function w(e){let n={};for(let t of c){let r=o.get(t);n[t]=d(r.when,e)&&d(s.get(r.group)?.when,e),!n[t]&&r.type!==`button`&&(e[t]=structuredClone(r.default))}return l({values:e,visible:n,groups:Object.fromEntries([...s].map(([t,n])=>[t,d(n.when,e)])),actions:Object.fromEntries(t.controls.filter(e=>e.type===`button`).map(e=>[e.id,{available:!!S(e.id)&&!h[e.id]?.error,busy:m.has(e.id)}])),...Object.keys(h).length?{bindings:structuredClone(h)}:{}})}function D(){return Object.fromEntries(t.controls.filter(e=>e.type!==`button`).map(e=>[e.id,structuredClone(e.default)]))}x=l({...w(D()),revision:g});function O(e){let t=w(e),n={values:x.values,visible:x.visible,groups:x.groups,actions:x.actions,...x.bindings?{bindings:x.bindings}:{}};if(u(t)!==u(n)&&(x=l({...t,revision:++g}),b=!0,!v)){v=!0;try{for(;b;){b=!1;for(let e of[...f])e();a.notify()}}finally{v=!1}}}function k(e){let t=o.get(e);if(!t)throw Error(`Unknown control "${e}"`);if(!x.visible[e])throw Error(`Control "${e}" is hidden`);return t}let A=Object.freeze({declaration:t,getSnapshot:()=>x,subscribe(e){return f.add(e),()=>f.delete(e)},update(e,t){let n=_(k(e),t);if(n)throw Error(`Control "${e}": ${n}`);O({...x.values,[e]:structuredClone(t)})},restore(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Controls restore requires an object`);let t={...x.values};for(let[n,r]of Object.entries(e)){let e=o.get(n);if(!e)throw Error(`Unknown control "${n}"`);let i=_(e,r);if(i)throw Error(`Control "${n}": ${i}`);t[n]=structuredClone(r)}O(t)},refreshActions(){O({...x.values})},bindingStatus(e,t,n=!1,r=!t){if(!o.has(e))throw Error(`Unknown control "${e}"`);h[e]={error:t.slice(0,500),busy:n,available:r},O({...x.values})},reset(e){if(e===void 0)return O(D());let t=k(e);if(t.type===`button`)throw Error(`Buttons cannot be reset`);O({...x.values,[e]:structuredClone(t.default)})},async action(e){if(k(e).type!==`button`)throw Error(`Control "${e}" is not a button`);let t=S(e);if(!t)throw Error(`No mounted action handler for "${e}"`);if(m.has(e))throw Error(`Action "${e}" is busy`);m.add(e),O({...x.values});try{return await t[e]()}finally{m.delete(e),O({...x.values})}},mount(e=()=>({})){let t=Symbol();p.set(t,e);try{O({...x.values}),a.notify()}catch(e){throw p.delete(t),O({...x.values}),a.notify(),e}let n=!0;return()=>{n&&(n=!1,p.delete(t),O({...x.values}),a.notify())}},get mountedCount(){return p.size}});return a.scopes.set(t.scope,Object.freeze({canonical:n,controller:A})),a.notify(),A}function O(e,t=!1){if(!(e instanceof HTMLElement)||!e.isConnected)return`The binding target is missing or stale.`;let n=e.getBoundingClientRect();for(let t=e;t;t=t.parentElement){let e=window.getComputedStyle(t);if(t.hasAttribute(`hidden`)||t.hasAttribute(`inert`)||t.getAttribute(`aria-hidden`)===`true`||t.getAttribute(`aria-disabled`)===`true`||e.visibility===`hidden`||e.visibility===`collapse`||e.display===`none`||Number(e.opacity||1)===0)return`The binding target is hidden or disabled.`}if(e.hasAttribute(`data-replica-canvas-bridge`)||e.matches(`:disabled`)||!n.width||!n.height)return`The binding target is hidden or disabled.`;if(!t)return``;let r=document.elementFromPoint(n.left+n.width/2,n.top+n.height/2);if(!r||r!==e&&!e.contains(r))return`The binding target is blocked by another element.`;let i=e.closest(`button, input, select, textarea, [role="button"], [role="link"], a`),a=e.closest(`form`)||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement?e.form:null);if(i!==e||a)return`The binding target is not a safe standalone control.`;let o=e.closest(`a`);if(o){let e=o.getAttribute(`href`),t;try{t=new URL(e||``,window.location.href)}catch{return`The binding target has an invalid link URL.`}if(!e||![`http:`,`https:`].includes(t.protocol)||t.origin!==window.location.origin||t.username||t.password||o.hasAttribute(`download`)||o.hasAttribute(`target`)&&o.getAttribute(`target`)!==`_self`)return`The binding target leaves the prototype or downloads a file.`}return``}function k(e,t){return JSON.stringify(e)===JSON.stringify(t)}function A(){let e=new URL(window.location.href);for(let t of[...e.searchParams.keys()])(t===`rc`||t.startsWith(`rc.`))&&e.searchParams.delete(t);return e.href}function j(e){let t=document.querySelectorAll(e);if(t.length!==1)throw Error(t.length?`The binding target is ambiguous.`:`The binding target is missing.`);return t[0]}function M(e){let t=window;for(let n of e.split(`.`)){if(!t||!Object.hasOwn(t,n))throw Error(`The app API "${e}" is unavailable.`);t=t[n]}if(!t||typeof t!=`object`&&typeof t!=`function`)throw Error(`The app API "${e}" is not an object.`);if([window,window.document,window.location,window.history,window.navigator].includes(t))throw Error(`API bindings must use an app-owned object, not a browser API.`);return t}function N(e){let t=e.binding;if(t.type===`api`){let e=M(t.object);for(let n of[t.read,t.write,t.action,t.subscribe].filter(Boolean))if(!Object.hasOwn(e,n)||typeof e[n]!=`function`)throw Error(`The app API method "${n}" is unavailable.`);return e}if(t.type===`query`||t.type===`hash`)return window;let n=j(t.selector),r=O(n,t.type===`button`);if(r)throw Error(r);if(t.type===`field`){if(!(n instanceof HTMLInputElement||n instanceof HTMLSelectElement||n instanceof HTMLTextAreaElement)||n instanceof HTMLInputElement&&[`button`,`submit`,`reset`,`image`,`file`,`password`,`hidden`].includes(n.type))throw Error(`The binding requires a supported native form field.`);if(e.type===`boolean`&&!(n instanceof HTMLInputElement&&n.type===`checkbox`))throw Error(`A boolean field binding requires a checkbox.`);if(e.type===`checkboxGroup`&&!(n instanceof HTMLSelectElement&&n.multiple))throw Error(`A checkboxGroup field binding requires a multiple select.`);if(n.readOnly)throw Error(`The binding target is read-only.`)}if(t.type===`style`&&e.type===`checkboxGroup`)throw Error(`Style bindings require a scalar control.`);return n}function P(e,t){if(e.type===`boolean`)return t===`true`||t!==`false`&&t;if(e.type===`number`||e.type===`slider`)return t.trim()===``?NaN:Number(t);if(e.type===`checkboxGroup`)return JSON.parse(t);if(e.type===`color`&&/^rgb\(/.test(t)){let e=t.match(/\d+/g);if(e?.length===3)return`#${e.map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}`}return t}function F(e){return Array.isArray(e)?JSON.stringify(e):String(e)}function I(e,t){let n=e.binding;if(n.type===`api`)return t[n.read]();if(n.type===`field`)return e.type===`boolean`?t.checked:e.type===`checkboxGroup`?[...t.selectedOptions].map(e=>e.value):P(e,t.value);if(n.type===`style`)return P(e,window.getComputedStyle(t).getPropertyValue(n.property).trim());let r=new URL(window.location.href),i=n.type===`query`?r.searchParams.get(n.key):decodeURIComponent(r.hash.slice(1));return i===null?structuredClone(e.default):P(e,i)}function L(e){let t=typeof e==`string`?e:e?.message;return Error(typeof t==`string`&&t?t:`The app binding failed without an error message.`)}async function R(e,t=5e3){let n;try{return await Promise.race([Promise.resolve().then(e),new Promise((e,r)=>{n=window.setTimeout(()=>r(/* @__PURE__ */ Error(`The app API timed out. Its outcome is unknown.`)),t)})])}catch(e){throw L(e)}finally{window.clearTimeout(n)}}function ee(e,t,n){let r=e instanceof HTMLInputElement?HTMLInputElement.prototype:e instanceof HTMLSelectElement?HTMLSelectElement.prototype:HTMLTextAreaElement.prototype;Object.getOwnPropertyDescriptor(r,t).set.call(e,n)}async function te(e,t,n){let r=e.binding;if(r.type===`api`){await R(()=>t[r.write](structuredClone(n)));return}if(r.type===`field`){if(t instanceof HTMLSelectElement)for(let e of Array.isArray(n)?n:[F(n)]){let n=[...t.options].filter(t=>t.value===e);if(n.length!==1||n[0].disabled||n[0].closest(`optgroup[disabled], [hidden], [inert]`))throw Error(`The native option is missing, ambiguous, hidden or disabled.`)}if(e.type===`checkboxGroup`)for(let e of t.options)e.selected=n.includes(e.value);else e.type===`boolean`?t.checked!==n&&t.click():ee(t,`value`,F(n));t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0}));return}if(r.type===`style`){t.style.setProperty(r.property,F(n));return}let i=new URL(window.location.href);if(r.type===`query`?i.searchParams.set(r.key,F(n)):i.hash=`#${F(n).replace(/%/g,`%25`)}`,i.href===window.location.href)return;if(i.origin!==window.location.origin)throw Error(`URL bindings cannot leave the prototype.`);if(r.mode===`navigate`)return i;window.history.replaceState(window.history.state,``,i);let a=new Event(r.type===`hash`?`hashchange`:`popstate`);Object.defineProperty(a,"replicaControlsBinding",{value:!0}),window.dispatchEvent(a)}function ne(e){x(e);let t=(e.sets??[e]).map(e=>({controller:D(e),release:void 0,records:new Map(e.controls.map(e=>[e.id,{control:e,object:void 0,cleanup:void 0,initialized:!1,lastRead:0,reading:!1}]))})),n=!1,r=0,i=Promise.resolve(),a=Promise.resolve(),o=!1,s=!1,c,l=/* @__PURE__ */ new Set,u=``;function d(){let e=JSON.stringify(t.map(({controller:e})=>[e.declaration.scope,e.mountedCount,e.getSnapshot().revision]));if(e!==u){u=e;for(let e of l)e()}}let f=E().subscribe(()=>{!s&&!r&&d()});function p(e){if(!e.controller.declaration.container)return!0;let t=document.querySelectorAll(e.controller.declaration.container);if(t.length>1)throw Error(`The page container is ambiguous.`);return t.length===1&&!O(t[0])}function m(e,t){let n=t.cleanup;t.cleanup=void 0,t.object=void 0,t.initialized=!1;try{n?.()}catch(n){let r=/* @__PURE__ */ Error(`API cleanup failed: ${L(n).message}`);return e.controller.bindingStatus(t.control.id,r.message),r}}function h(e){let n=e.binding;if(n.type===`query`||n.type===`hash`){let e=/* @__PURE__ */ new Set;for(let r of t){let t;try{t=p(r)}catch{continue}if(t)for(let t of r.records.values()){let i=t.control.binding;i.type===n.type&&(n.type===`hash`||i.key===n.key)&&e.add(F(r.controller.getSnapshot().values[t.control.id]))}}if(e.size>1)throw Error(`This URL setting has conflicting active Controls bindings.`)}return N(e)}function g(e,t,r,i){let a=t.control.binding.type===`api`?new URL(A()).origin!==new URL(i).origin:A()!==i;if(n||!p(e)||a||h(t.control)!==r)throw Error(`The binding target or prototype route changed. The outcome is unknown.`)}async function v(e,t,n,r){let i=await R(()=>I(t.control,n));g(e,t,n,r);let a=_(t.control,i);if(a)throw Error(`The app value ${a}.`);return e.controller.restore({[t.control.id]:i}),t.lastRead=Date.now(),i}async function b(e,t,n){let{control:r}=t,i=e.controller.getSnapshot().values[r.id],a=A(),o;e.controller.bindingStatus(r.id,``,!0);try{o=h(r);let i=await te(r,o,n);if(i){let t=new URL(c?.href??window.location.href);return r.binding.type===`query`?t.searchParams.set(r.binding.key,i.searchParams.get(r.binding.key)):t.hash=i.hash,c=t,e.controller.restore({[r.id]:n}),e.controller.bindingStatus(r.id,``),n}await new Promise(e=>{let t=window.setTimeout(()=>{window.cancelAnimationFrame(n),e()},100),n=window.requestAnimationFrame(()=>{window.clearTimeout(t),e()})});let s=[`query`,`hash`].includes(r.binding.type),l=await v(e,t,o,s?A():a);if(!k(l,n))throw t.rejection=`The app rejected or adjusted this value. Its actual value is shown.`,t.rejectedValue=l,Error(`The app rejected or adjusted this value. Its actual value is shown.`);return t.rejection=``,e.controller.bindingStatus(r.id,``),l}catch(s){let c=L(s),l=!1;if(o)try{let n=await v(e,t,o,a);t.rejection=c.message,t.rejectedValue=n,l=!0}catch(e){c=/* @__PURE__ */ Error(`${c.message} ${L(e).message}`)}throw!l&&k(e.controller.getSnapshot().values[r.id],n)&&e.controller.restore({[r.id]:i}),e.controller.bindingStatus(r.id,c.message,!1,l),c}}async function S(e,t){let{control:n}=t;if(!t.reading){t.reading=!0;try{let r=h(n);if(t.object!==r){let i=m(e,t);if(i)throw i;if(t.object=r,n.binding.type===`api`&&n.binding.subscribe){let e=r[n.binding.subscribe](()=>{t.lastRead=0,C()});if(typeof e!=`function`)throw Error(`The API notification method must return a cleanup function.`);t.cleanup=e}}if(n.type===`button`){e.controller.bindingStatus(n.id,t.rejection||``,!1,!0);return}if(!t.initialized)t.initialized=!0,await b(e,t,e.controller.getSnapshot().values[n.id]);else{let i=n.binding.type===`api`?n.binding.pollMs:250;if(t.lastRead===0||i&&Date.now()-t.lastRead>=i){if(!e.controller.getSnapshot().visible[n.id]&&!k(await R(()=>I(n,r)),n.default))await b(e,t,n.default);else{let n=await v(e,t,r,A());t.rejection&&!k(n,t.rejectedValue)&&(t.rejection=``)}e.controller.bindingStatus(n.id,t.rejection||``,!1,!0)}}}catch(t){e.controller.bindingStatus(n.id,L(t).message)}finally{t.reading=!1}}}function C(){return o||(o=!0,a=a.then(async()=>{if(!(n||r)){s=!0;try{await Promise.all(t.map(async e=>{let t,n=!1;try{t=p(e)}catch(r){t=!0,n=!0;for(let t of e.records.values())e.controller.bindingStatus(t.control.id,`Invalid page container: ${r.message}`)}if(t){if(!e.release){let t=Object.fromEntries([...e.records.values()].filter(e=>e.control.type===`button`).map(t=>[t.control.id,async()=>{let n=h(t.control),r=A();t.control.binding.type===`api`?await R(()=>n[t.control.binding.action](),3e4):n.click(),g(e,t,n,r)}]));e.release=e.controller.mount(()=>t)}n||await Promise.all([...e.records.values()].map(t=>S(e,t)))}else{e.release?.(),e.release=void 0;for(let t of e.records.values())m(e,t)}}))}finally{s=!1,d()}}}).finally(()=>{o=!1})),a}function w(e,t){let n=i.then(async()=>{await a,t?.(),c=void 0,r++;try{return await e()}catch(e){throw c=void 0,e}finally{r--,d()}});return i=n.catch(()=>{}),n}function T(e){let n=t.find(t=>t.controller===e);if(!n)throw Error(`Unknown controls set.`);return n}async function j(e,t,n){let r=T(e),i=e.getSnapshot();n?.(),e.restore(t);let a=[];for(let o of y(e.declaration)){n?.();let s=r.records.get(o);if(s.control.type===`button`)continue;let c=e.getSnapshot().values[o];if(Object.hasOwn(t,o)||!k(c,i.values[o])||[`query`,`hash`].includes(s.control.binding.type)&&s.control.binding.mode===`navigate`)try{await b(r,s,c)}catch(t){e.getSnapshot().bindings[o]?.available!==!0&&k(e.getSnapshot().values[o],c)&&e.restore({[o]:i.values[o]}),a.push(`${s.control.label}: ${t.message}`)}}if(n?.(),a.length)throw Error(a.join(` `).slice(0,1e3))}let M=window.setInterval(()=>{C()},250);function P(e){for(let n of t)for(let t of n.records.values())if(t.control.binding.type!==`api`&&t.control.type!==`button`){if(e.type===`input`||e.type===`change`){if(e.target!==t.object)continue;try{let e=I(t.control,t.object),r=_(t.control,e);if(r)throw Error(`The app value ${r}.`);n.controller.restore({[t.control.id]:e})}catch(e){n.controller.bindingStatus(t.control.id,e.message)}}t.lastRead=0}C()}for(let e of[`input`,`change`,`popstate`,`hashchange`])window.addEventListener(e,P);return C(),{runtime:E(),pending:()=>r>0||s,subscribe(e){return l.add(e),()=>l.delete(e)},settled:()=>a,restore:(e,t,n)=>w(()=>j(e,t,n),n),update:(e,t,n,r)=>w(()=>{let i=e.declaration.controls.find(e=>e.id===t),a=i?_(i,n):`Unknown control.`;if(a)throw Error(a);if(!e.getSnapshot().visible[t])throw Error(`This control is hidden.`);return j(e,{[t]:n},r)},r),takeNavigation(){if(!c)return;let e=c;c=void 0;for(let t of[...e.searchParams.keys()])(t===`rc`||t.startsWith(`rc.`))&&e.searchParams.delete(t);for(let[t,n]of new URL(window.location.href).searchParams)(t===`rc`||t.startsWith(`rc.`))&&e.searchParams.append(t,n);return e.href},navigate(){let e=this.takeNavigation();e&&window.location.assign(e)},reset:(e,n)=>w(async()=>{let r=e?[T(e)]:t,i=[];for(let e of r){let t=Object.fromEntries(e.controller.declaration.controls.filter(e=>e.type!==`button`).map(e=>[e.id,e.default]));if(!e.release)e.controller.reset();else try{await j(e.controller,t,n)}catch(e){i.push(e.message)}}if(i.length)throw Error(i.join(` -`).slice(0,1e3))},n),dispose(){n=!0,f(),window.clearInterval(M);for(let e of[`input`,`change`,`popstate`,`hashchange`])window.removeEventListener(e,P);for(let e of t){e.release?.();for(let t of e.records.values())m(e,t)}}}}async function re(){let e=await fetch(`/controls.replica.json`,{credentials:`same-origin`,redirect:`error`});if(e.status===404||e.status===410)return;if(!e.ok)throw Error(`controls.replica.json returned HTTP ${e.status}.`);let t=``,n=e.body?.getReader();if(n){let e=new TextDecoder,r=0;for(;;){let{done:i,value:a}=await n.read();if(i)break;if(r+=a.byteLength,r>256e3)throw await n.cancel(),Error(`controls.replica.json exceeds the 256,000-byte limit.`);t+=e.decode(a,{stream:!0})}t+=e.decode()}else t=await e.text();if(new TextEncoder().encode(t).length>256e3)throw Error(`controls.replica.json exceeds the 256,000-byte limit.`);if(!(e.headers.get(`content-type`)?.startsWith(`text/html`)&&/^\s*<(?:!doctype html|html)/i.test(t)))return ne(JSON.parse(t))}function z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.entries(e).every(([e,t])=>/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(e)&&(typeof t==`string`||typeof t==`boolean`||typeof t==`number`&&Number.isFinite(t)||Array.isArray(t)&&t.length<=100&&t.every(e=>typeof e==`string`)))}var ie=`replica:controls`;function ae(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;try{let n=JSON.stringify(e);if(!(typeof n==`string`&&new Blob([n]).size<=512e3&&Object.keys(e).every(e=>[`protocol`,`version`,`epoch`,`requestId`,`type`,`sequence`,`state`,`error`,`command`,`controlQuery`,`fromFrameUrl`].includes(e))&&(t.error===void 0||typeof t.error==`string`&&t.error.length<=1e3)&&(t.controlQuery===void 0||[`hello`,`snapshot`,`reply`].includes(t.type)&&typeof t.controlQuery==`string`&&new Blob([t.controlQuery]).size<=8192)&&(t.fromFrameUrl===void 0||t.type===`hello`&&typeof t.fromFrameUrl==`boolean`)&&t.protocol===`replica:controls`&&t.version===1&&typeof t.epoch==`string`&&/^[a-zA-Z0-9-]{1,100}$/.test(t.epoch)&&typeof t.requestId==`string`&&/^[a-zA-Z0-9-]{1,100}$/.test(t.requestId)&&[`hello`,`snapshot`,`command`,`reply`].includes(t.type)))return!1;if(t.type!==`command`)return t.command===void 0;let r=t.command;if(!r||typeof r!=`object`||Array.isArray(r))return!1;if(r.operation===`url`)return Object.keys(r).every(e=>[`operation`,`query`,`scope`].includes(e))&&(r.scope===void 0||typeof r.scope==`string`&&/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(r.scope))&&typeof r.query==`string`&&new Blob([r.query]).size<=8192&&[...new URLSearchParams(r.query).keys()].every(e=>/^rc\.[a-zA-Z][a-zA-Z0-9_-]{0,63}\.[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(e));if(r.operation===`reset-all`)return Object.keys(r).every(e=>[`operation`,`contexts`].includes(e))&&Array.isArray(r.contexts)&&r.contexts.length<=100&&new Set(r.contexts.map(e=>e?.scope)).size===r.contexts.length&&r.contexts.every(e=>typeof e==`object`&&!!e&&Object.keys(e).length===3&&typeof e.scope==`string`&&/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(e.scope)&&typeof e.fingerprint==`string`&&Number.isSafeInteger(e.revision)&&e.revision>=0);let i=[`operation`,`scope`,`fingerprint`,`revision`];return typeof r.scope!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(r.scope)||typeof r.fingerprint!=`string`||!Number.isSafeInteger(r.revision)||r.revision===void 0||r.revision<0?!1:r.operation===`restore`?Object.keys(r).every(e=>[...i,`values`].includes(e))&&z(r.values):r.operation===`reset`?Object.keys(r).every(e=>i.includes(e)):r.operation!==`action`&&r.operation!==`update`||typeof r.id!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(r.id)?!1:Object.keys(r).every(e=>[...i,`id`,...r.operation===`update`?[`value`]:[]].includes(e))&&(r.operation===`action`||z({[r.id]:r.value}))}catch{return!1}}function oe(e){return C(e.declaration),JSON.parse(JSON.stringify({declaration:e.declaration,fingerprint:JSON.stringify(e.declaration),snapshot:e.getSnapshot()}))}var se=/^rc\.([a-zA-Z][a-zA-Z0-9_-]{0,63})\.([a-zA-Z][a-zA-Z0-9_-]{0,63})$/;function B(e){let t=new URLSearchParams;for(let n of Object.keys(e).sort()){let r=e[n];if(!z(r))throw Error(`Invalid control settings.`);for(let e of Object.keys(r).sort()){let i=`rc.${n}.${e}`;if(!se.test(i))throw Error(`Invalid control settings identifier.`);t.set(i,JSON.stringify(r[e]))}}let n=t.toString();if(new Blob([n]).size>8192)throw Error(`Control settings exceed the 8 KB URL limit. Reduce the settings before sharing.`);return n}function ce(e){let t=new URLSearchParams(e),n=[...t].filter(([e])=>e.startsWith(`rc.`));if(new Blob([new URLSearchParams(n).toString()]).size>8192)return{scopes:{},notice:`Control settings in this URL exceed 8 KB. Defaults were used.`};let r=/* @__PURE__ */ new Map,i=!1;for(let[e,a]of n){let n=se.exec(e);if(!n||t.getAll(e).length!==1){i=!0;continue}let o=n[1],s=n[2],c;try{c=JSON.parse(a)}catch{c=a}if(!z({[s]:c})){i=!0;continue}let l=r.get(o)??/* @__PURE__ */ new Map;l.set(s,c),r.set(o,l)}let a=Object.fromEntries([...r].map(([e,t])=>[e,Object.fromEntries(t)]));try{B(a)}catch{return{scopes:{},notice:`Control settings in this URL exceed 8 KB. Defaults were used.`}}return{scopes:a,notice:i?`Some URL control settings were invalid. Defaults were used instead.`:``}}function le(e,t){let n=new URL(e,window.location.href),r=ce(t);if(r.notice)throw Error(r.notice);for(let e of[...n.searchParams.keys()])e.startsWith(`rc.`)&&n.searchParams.delete(e);for(let[e,t]of new URLSearchParams(B(r.scopes)))n.searchParams.set(e,t);return n.toString()}function ue(e,t,n){let r=window.history.pushState.bind(window.history),i=window.history.replaceState.bind(window.history),a=!1,o=document.readyState===`complete`||(performance.getEntriesByType?.(`navigation`)??[]).some(e=>`domContentLoadedEventStart`in e&&typeof e.domContentLoadedEventStart==`number`&&e.domContentLoadedEventStart>0),s=new URLSearchParams([...new URLSearchParams(window.location.search)].filter(([e])=>e.startsWith(`rc.`))).toString();function c(){try{let e=B({...ce(s).scopes,...t()});return n(``),e}catch(e){return n(e instanceof Error?e.message:`Controls could not be saved in the URL.`),s}}function l(e){if(!a||!o)return new URL(String(e??window.location.href),window.location.href).toString();let t=new URL(le(String(e??window.location.href),c()));return t.searchParams.set(`rc`,`1`),t.toString()}function u(e,t,n){r(e,t,l(n))}function d(e,t,n){i(e,t,l(n))}window.history.pushState=u,window.history.replaceState=d;function f(t){`replicaControlsBinding`in t&&t.replicaControlsBinding===!0||(s=new URLSearchParams([...new URLSearchParams(window.location.search)].filter(([e])=>e.startsWith(`rc.`))).toString(),e(s))}function p(e){if(!a||!o||e.defaultPrevented||!(e.target instanceof Element))return;let t=e.target.closest(`a[href]`);if(!(t instanceof HTMLAnchorElement)||t.hasAttribute(`download`)||t.target&&t.target!==`_self`)return;let n=new URL(t.href);n.origin===window.location.origin&&(t.href=l(n))}window.addEventListener(`popstate`,f),window.addEventListener(`click`,p,!0);function m(){if(!a||!o)return;s=c();let e=l(window.location.href);e!==window.location.href&&i(window.history.state,``,e)}function h(){o=!0,m()}return document.addEventListener(`DOMContentLoaded`,h,{once:!0}),{set(e){let t=ce(e);if(t.notice)throw Error(t.notice);s=B(t.scopes),a=!0,m()},refresh:m,current(){return new URLSearchParams([...new URLSearchParams(window.location.search)].filter(([e])=>e.startsWith(`rc.`))).toString()},managed(){return new URLSearchParams(window.location.search).get(`rc`)===`1`},dispose(){window.history.pushState===u&&(window.history.pushState=r),window.history.replaceState===d&&(window.history.replaceState=i),window.removeEventListener(`popstate`,f),window.removeEventListener(`click`,p,!0),document.removeEventListener(`DOMContentLoaded`,h)}}}function de(e){return Object.fromEntries(e.declaration.controls.filter(t=>t.type!==`button`&&e.snapshot.visible[t.id]&&JSON.stringify(e.snapshot.values[t.id])!==JSON.stringify(t.default)).map(t=>[t.id,e.snapshot.values[t.id]]))}var fe={mentionSuggestions:`Mention suggestions`,mentionSuggestionsError:`Mention suggestions are unavailable. Try again.`,mentionSuggestionsLoading:`Loading people...`,mentionSuggestionsEmpty:`No matching people. You can type a GitHub login to check it when sending.`,mentionLimit:`Each message can mention at most 10 distinct people.`,controls:`Controls`,controlsMove:`Move controls`,controlsMoveHint:`Drag to move. Use arrow keys, or Shift and arrow keys for smaller steps.`,controlsCollapse:`Collapse controls`,controlsExpand:`Expand controls`,controlsCollapseGroup:e=>`Collapse ${e}`,controlsExpandGroup:e=>`Expand ${e}`,controlsDescription:`Settings stay in this prototype's URL. The app may paint before Controls apply declared defaults.`,controlsConnecting:`Connecting controls...`,controlsEmpty:`No active controls. This prototype may have no declaration or this route may not mount controls.`,controlsMissingRuntime:`No supported controls runtime found.`,controlsLocalMissingRuntime:`Local controls couldn't connect.`,controlsLocalConnectionFailed:`The preview has not responded to controls. Retry the connection or ask Copilot to diagnose the cause.`,controlsLocalStorageFailed:`Controls could not be saved in the prototype URL. Changes remain in memory.`,controlsDiagnose:`Diagnose with Copilot`,controlsFix:`Fix with Copilot`,controlsDiagnostics:`Technical details`,controlsUnavailable:e=>`${e} is unavailable`,controlsNotApplied:e=>`${e} could not be applied`,controlsDiagnosisRequested:`Requested in chat`,controlsDiagnosisFailed:`Could not request a diagnosis. Try again.`,controlsUnsupportedRuntime:`This controls runtime version is unsupported. Upgrade only after an approved release.`,controlsInvalid:`The Controls definitions are invalid. Fix controls.replica.json and reload.`,controlsScopeError:(e,t)=>`Controls scope "${e}" did not connect. ${t}`,controlsRetry:`Retry connection`,controlsRetryStorage:`Retry saving`,controlsResetAll:`Reset all controls`,controlsRegion:`Prototype controls`,controlsActionBusy:` - Working...`,controlsActionUnavailable:`No mounted action handler.`,controlsValueNotApplied:`This value was not applied.`,browserNavigation:`Prototype navigation`,browserBack:`Back`,browserForward:`Forward`,browserReload:`Reload preview`,browserAddress:`Prototype address`,browserAddressInvalid:`Enter a valid URL or route.`,browserAddressOrigin:`The address must stay on this prototype's origin.`,browserOpenTab:`Open preview in browser`,browserAppearance:`Preview appearance`,browserLight:`Light appearance`,browserDark:`Dark appearance`,commentingUnavailable:`Commenting needs attention`,commentingDescription:`The canvas could not connect to the preview's commenting bridge.`,closeCommentingDialog:`Close commenting dialog`,commentingFix:`Fix with Copilot`,commentingFixRequested:`Requested in chat`,commentingDismiss:`Dismiss`,commentingMissing:`The preview has not responded through its local proxy. Check that the selected server is running, then reopen the canvas. Script or framing policies, certificate errors, and origin-dependent apps can prevent connection. A Vite plugin or server restart is not required to connect.`,commentingIncompatible:`The preview responded with an incompatible commenting protocol. Update the installed Replica extension and reopen the canvas, or use Fix with Copilot to check the preview connection.`,connectToHub:`Connect to the Hub`,closeConnectionDialog:`Close connection dialog`,connectionDescription:`Connecting to the hub lets you share the prototype with others and enables commenting.`,connectionBeforePublishing:`Connect to the hub before publishing this prototype.`,connectionRepositoryRequired:`Open a repository with a GitHub origin before connecting.`,connectionHubRequired:`Enter and save a Hub URL before connecting.`,connectionOpeningBrowser:`Opening browser...`,connectionApproval:`Browser approval`,connectionWaiting:`Make sure your browser shows the same code`,connectionApprovalExpired:`The approval expired or was declined. Connect again to retry.`,connectionBrowserFailed:e=>`Could not open your browser. Open or copy the approval link below. ${e}`,hubUrl:`Hub URL`,editHubUrl:`Edit Hub URL`,saveHub:`Save Hub`,disconnectFailed:(e,t)=>`Could not disconnect from ${e}: ${t} The previous connection may still be active. Save another Hub URL to switch this canvas locally, or retry Disconnect Hub.`,resetHubUrl:`Reset to repository Hub URL`,resetHubUnavailable:`No repository Hub URL is available. Enter a URL manually or retry reset.`,hubHttpsHint:`Remote Hubs require HTTPS`,copyApprovalLink:`Copy Hub approval link`,approvalLinkCopied:`Approval link copied`,approvalCopyFailed:`Could not copy the link. Copy the Connect to the hub link manually.`,invalidResponse:`The extension returned an invalid response.`,startPage:`Start page`,prototypeFrameTitle:e=>`${e} prototype`,startPageOrigin:`Hub returned a start page outside the prototype.`,hubStatusUnavailable:e=>`Hub status unavailable: ${e}`,hubBuildImported:`Hub imported this Build.`,hubBuildMissing:`Hub has not imported a successful registered Build.`,hubPublicationUnavailable:`Connect to Hub to verify publication.`,editDetails:`Edit details`,startPageHint:`Paste a prototype URL or route. Leave blank to start at /.`,requestFailed:`The request failed.`,statusUnavailable:`Publish status unavailable.`,publishRequestPending:`Waiting for the current commit to run through the publish workflow.`,waitingForHubImport:`The workflow completed. Waiting for Hub to import this Build.`,workingTreeChanged:`Uncommitted changes`,workingTreeClean:`Working tree clean`,buildDetails:`Build details`,latestBuild:`Latest Build`,buildTitle:e=>`Build #${e}`,buildCommit:`Commit`,unknownCommitAuthor:`Unknown`,showBuildHistory:`Show build history`,closeBuildDetails:`Close build details`,branch:`Branch`,sessionId:`Session ID`,comparison:`Branch comparison`,comparisonNeedsRefresh:`Branch comparison unavailable until Git stats refresh.`,upToDate:`Up to date`,commitsBehind:e=>`${e} ${e===1?`commit`:`commits`} behind`,copyBranch:`Copy branch`,copySessionId:`Copy session ID`,branchCopied:`Branch copied`,sessionIdCopied:`Session ID copied`,buildDetailsCopyFailed:e=>`${e} could not be copied. Select it and copy it manually.`,unavailable:`Unavailable`,publishLabels:{succeeded:`Awaiting Hub`,failed:`Retry`,in_progress:`Publishing`,not_published:`Publish`,published:`Published`,requested:`Requested`,unavailable:`Publish`}};function pe(e,t){let n=e.snapshot.bindings?.[t.id],r=e.snapshot.actions[t.id];return{scope:e.declaration.scope,id:t.id,visible:e.snapshot.visible[t.id]===!0,available:(t.type!==`button`||r?.available===!0)&&(!n?.error||n.available===!0),busy:n?.busy===!0||r?.busy===!0,error:n?.error||(t.type===`button`&&!r?.available?fe.controlsActionUnavailable:``)}}function me(e,t,n){return{status:t?`pending`:e.status,url:n,error:t?``:e.error??``,controls:t?[]:e.scopes.flatMap(e=>e.declaration.controls.map(t=>pe(e,t)))}}function he(e){let t=``,n,r,i=``,a=!1,o=/* @__PURE__ */ new Set,s=!1,c=0,l,u,d=!1,f,p=/* @__PURE__ */ new Set,m=/* @__PURE__ */ new Set,h=``,g=ue(e=>{m.clear(),x(`snapshot`,`event`,void 0,e)},()=>Object.fromEntries((n?.list()??[]).filter(e=>m.has(e.declaration.scope)).map(e=>[e.declaration.scope,de(oe(e))])),e=>{h!==e&&(h=e,x(`snapshot`,`event`))});async function _(){try{if(u=await re(),a){u?.dispose();return}n=u?.runtime,r=u?.subscribe(S),await u?.settled();let e=u;e&&v()&&await new Promise(t=>{function n(){clearTimeout(i),a(),f=void 0,t()}function r(){v()||n()}let i=setTimeout(n,500),a=e.subscribe(r);f=n,r()})}catch(e){l={status:`invalid-config`,error:e instanceof Error?e.message.slice(0,1e3):`Controls definitions could not be read.`}}finally{d=!0}S()}function v(){return n?.list().some(e=>Object.values(e.getSnapshot().bindings??{}).some(e=>e.error))}function y(){let e=!!n;if(l)return{runtimeAvailable:e,scopes:[],...l};if(!n)return{runtimeAvailable:!1,status:d?`no-controls`:`missing-runtime`,scopes:[]};try{let e=n.list().filter(e=>e.mountedCount>0).map(oe);return e.length>100?{runtimeAvailable:!0,status:`invalid-config`,scopes:[],error:`Too many active controls scopes.`}:{runtimeAvailable:!0,status:e.length?`ready`:`no-controls`,scopes:e}}catch{return{runtimeAvailable:!0,status:`invalid-config`,scopes:[],error:`The Controls definitions are invalid.`}}}function b(){return{...y(),scopeErrors:[],reconnectRequired:s,...s?{error:`Reconnect controls before sending more commands.`}:{},...h?{error:`${h} Changes remain in memory and are not in the URL.`}:{}}}function x(n,r,i,o){if(a||!t)return;let s={protocol:ie,version:1,type:n,epoch:t,requestId:r,sequence:++c,state:b(),...i?{error:i}:{},...o===void 0?{}:{controlQuery:o}};window.parent.postMessage(ae(s)?s:{...s,state:{runtimeAvailable:!0,status:`invalid-config`,scopes:[],error:`Controls exceed the transport size limit.`},error:`Controls exceed the transport size limit.`},e)}function S(){for(let e of p)e();if(!d||u?.pending())return;g?.refresh();let e=JSON.stringify(b());e!==i&&(i=e,x(`snapshot`,`event`))}async function C(r){if(r.source===window.parent&&r.origin===e&&r.data&&typeof r.data==`object`&&`type`in r.data&&r.data.type===`replica:controls:status`&&`nonce`in r.data&&typeof r.data.nonce==`string`&&r.data.nonce.length<=100&&`timeoutMs`in r.data&&Number.isInteger(r.data.timeoutMs)&&typeof r.data.timeoutMs==`number`&&r.data.timeoutMs>=0&&r.data.timeoutMs<=1e4){let{nonce:t,timeoutMs:n}=r.data;function i(){return!d||u?.pending()===!0&&!b().scopes.some(({snapshot:e})=>[...Object.values(e.actions),...Object.values(e.bindings??{})].some(e=>e.busy))}i()&&n>0&&await new Promise(e=>{function t(){clearTimeout(o),p.delete(r),e()}function r(){(a||!i())&&t()}let o=setTimeout(t,n);p.add(r),r()}),a||window.parent.postMessage({type:`replica:controls:status-result`,nonce:t,value:me(b(),i(),window.location.href)},e);return}if(r.source!==window.parent||r.origin!==e||!ae(r.data))return;let i=r.data;if(i.type===`hello`){t=i.epoch,o.clear(),s=!1,m.clear();let e=i.fromFrameUrl&&g?.managed();g?.set(e?g.current():i.controlQuery??``),d||await w,x(`reply`,i.requestId,void 0,e?g?.current():void 0);return}if(i.type!==`command`||i.epoch!==t||o.has(i.requestId))return;if(o.size>=2e3){s=!0,x(`reply`,i.requestId,`Reconnect controls before sending more commands.`);return}o.add(i.requestId);let c=i.command;function l(){if(a||t!==i.epoch)throw Error(`The preview reconnected. The command outcome is unknown.`)}try{if(c?.operation===`url`){g.set(c.query??``),c.scope&&n?.list().some(e=>e.declaration.scope===c.scope&&e.mountedCount>0)&&(m.add(c.scope),g.refresh()),x(`reply`,i.requestId);return}if(!c||!n||![`ready`,`no-controls`].includes(b().status))throw Error(`Controls runtime is unavailable.`);if(c.operation===`reset-all`){if(n.list().some(e=>Object.values(e.getSnapshot().actions).some(e=>e.busy)))throw Error(`Wait for pending actions before resetting controls.`);let e=n.list().filter(e=>e.mountedCount>0);if(!Array.isArray(c.contexts)||c.contexts.length!==e.length||e.some(e=>!c.contexts?.some(t=>t.scope===e.declaration.scope&&t.fingerprint===JSON.stringify(e.declaration)&&t.revision===e.getSnapshot().revision)))throw Error(`Controls changed. The stale reset was not applied.`);m.clear(),await u?.reset(void 0,l)}else{let e=n.list().find(e=>e.declaration.scope===c.scope&&e.mountedCount>0);if(!e)throw Error(`This controls scope is no longer active.`);if(c.fingerprint!==JSON.stringify(e.declaration)||c.revision!==e.getSnapshot().revision)throw Error(`Controls changed. The stale command was not applied.`);if(c.operation===`restore`){if(!z(c.values))throw Error(`Invalid saved controls.`);await u?.restore(e,c.values,l),m.add(e.declaration.scope),g?.refresh()}else if(c.operation===`reset`)m.add(e.declaration.scope),await u?.reset(e,l);else{let t=e.declaration.controls.find(e=>e.id===c.id);if(!t||!e.getSnapshot().visible[t.id])throw Error(`This control is unknown or hidden.`);if(m.add(e.declaration.scope),c.operation===`update`){let n={[t.id]:c.value};if(!z(n))throw Error(`Invalid control value.`);let r=n[t.id];if(r===void 0)throw Error(`Missing control value.`);await u?.update(e,t.id,r,l)}else if(c.operation===`action`)await e.action(t.id);else throw Error(`Unknown controls command.`)}S()}t===i.epoch&&(x(`reply`,i.requestId),u?.navigate())}catch(e){t===i.epoch&&x(`reply`,i.requestId,e instanceof Error?e.message.slice(0,300):`The controls command failed.`)}}let w=_();function T(e){C(e)}return window.addEventListener(`message`,T),()=>{a=!0,f?.();for(let e of p)e();r?.(),u?.dispose(),window.removeEventListener(`message`,T),g?.dispose()}}var V=`data-replica-canvas-bridge`,ge=new TextEncoder,_e=null,H=null,U=null,W=null,ve=`light-dark(#0969da, #58a6ff)`,G=null,ye=``,be=``,K=/* @__PURE__ */ new Map;function xe(){let e=J();return e.pathname+e.search+e.hash}for(let e of[`popstate`,`hashchange`])window.addEventListener(e,e=>{be=`replicaControlsBinding`in e&&e.replicaControlsBinding?xe():``});function q(e){return e.replace(/\s+/g,` `).trim()}function Se(e,t){let n=``,r=0;for(let i of e){let e=ge.encode(i).length;if(r+e>t)break;n+=i,r+=e}return n}function J(){let e=window.location.search.slice(1).split(`&`).filter(e=>{let t=new URLSearchParams(e).keys().next().value;return t!==`rc`&&!t?.startsWith(`rc.`)}).join(`&`);return{pathname:window.location.pathname,search:e?`?${e}`:``,hash:window.location.hash}}function Ce(){return{width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX,scrollY:window.scrollY}}function we(e){return{x:e.left+window.scrollX,y:e.top+window.scrollY,width:e.width,height:e.height}}function Te(e){let t=e.getAttribute(`aria-labelledby`),n=t?t.split(/\s+/).map(e=>document.getElementById(e)?.textContent||``).join(` `):``,r=`labels`in e&&e.labels?Array.from(e.labels).map(e=>e.textContent||``).join(` `):``;return Se(q(e.getAttribute(`aria-label`)||n||r||e.getAttribute(`alt`)||e.getAttribute(`title`)||``),1e3)}function Ee(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,e=>`\\${e}`)}function De(e){if(e.id){let t=`#${Ee(e.id)}`;if(document.querySelectorAll(t).length===1)return t}for(let t of[`data-testid`,`data-test-id`]){let n=e.getAttribute(t);if(!n)continue;let r=`[${t}="${Ee(n)}"]`;if(document.querySelectorAll(r).length===1)return r}let t=[],n=e;for(;n&&n!==document.documentElement;){let e=n.tagName.toLowerCase(),r=n.parentElement?Array.from(n.parentElement.children).filter(e=>e.tagName===n?.tagName):[],i=r.length>1?`${e}:nth-of-type(${r.indexOf(n)+1})`:e;t.unshift(i);let a=t.join(` > `);if(document.querySelectorAll(a).length===1)return a;n=n.parentElement}return t.join(` > `)}function Oe(e,t){return e.tagName.toLowerCase()!==t.tagName||t.accessibleName&&Te(e)!==t.accessibleName?!1:!t.selectedText||q(e.textContent||``).includes(t.selectedText)}function ke(e){let t=null;try{t=document.querySelector(e.selector)}catch{}if(t&&Oe(t,e))return t;if(!e.accessibleName&&!e.selectedText)return null;let n=null;for(let r of document.getElementsByTagName(e.tagName))if(r!==t&&Oe(r,e)){if(n)return null;n=r}return n}function Ae(){let e=document.createElement(`div`);return e.setAttribute(V,``),Object.assign(e.style,{position:`fixed`,colorScheme:`light dark`,zIndex:`2147483647`,pointerEvents:`none`,border:`2px solid var(--replica-selection-accent)`,borderRadius:`4px`,background:`color-mix(in srgb, var(--replica-selection-accent) 12%, transparent)`,boxSizing:`border-box`}),e.style.setProperty(`--replica-selection-accent`,ve),document.documentElement.append(e),e}function Y(e,t){let n=e.style.position===`absolute`,r=`left`in t?t.left:t.x-window.scrollX,i=`top`in t?t.top:t.y-window.scrollY;Object.assign(e.style,{left:`${r+(n?window.scrollX:0)}px`,top:`${i+(n?window.scrollY:0)}px`,width:`${t.width}px`,height:`${t.height}px`})}function je(e,t=null){U?.remove(),U=e,W=t,U.style.pointerEvents=`none`}function X(e,t){window.parent.postMessage(t,e)}function Z(){H?.(),H=null}function Me(e,t,n){Z(),X(e,{type:`replica:canvas:selection-failed`,nonce:t,reason:n})}function Ne(e,t,n){let r=e.getBoundingClientRect(),i=De(e);if(!r.width||!r.height||!i)return null;let a=Se(q(window.getSelection()?.toString()||``),2e3);return{schemaVersion:1,kind:`element`,route:J(),selector:i,accessibleName:Te(e),tagName:e.tagName.toLowerCase(),selectedText:e.contains(window.getSelection()?.anchorNode||null)?a:``,rect:we(r),viewport:Ce(),elementOffset:{x:Math.min(1,Math.max(0,(t-r.left)/r.width)),y:Math.min(1,Math.max(0,(n-r.top)/r.height))}}}function Pe(e,t){Z();let n=null,r=Ae(),i=document.documentElement.style.cursor;document.documentElement.style.cursor=`crosshair`;function a(e){let t=e.target instanceof Element?e.target.closest(`:not([${V}])`):null;!t||t===document.documentElement||t===document.body?(n=null,r.style.display=`none`):(n=t,r.style.display=`block`,Y(r,t.getBoundingClientRect()))}function o(i){if(!n)return;i.preventDefault(),i.stopImmediatePropagation();let a=Ne(n,i.clientX,i.clientY);a?(r.style.position=Le(n)?`fixed`:`absolute`,Y(r,n.getBoundingClientRect()),je(r,n),Z(),X(e,{type:`replica:canvas:selected`,nonce:t,anchor:a})):(r.remove(),Me(e,t,`element-unavailable`))}function s(n){n.key===`Escape`&&(n.preventDefault(),Z(),X(e,{type:`replica:canvas:selection-cancelled`,nonce:t}))}document.addEventListener(`pointermove`,a,!0),document.addEventListener(`click`,o,!0),document.addEventListener(`keydown`,s,!0),H=()=>{document.removeEventListener(`pointermove`,a,!0),document.removeEventListener(`click`,o,!0),document.removeEventListener(`keydown`,s,!0),document.documentElement.style.cursor=i,U!==r&&r.remove()}}function Fe(e){let t=[[e.left+e.width/2,e.top+e.height/2],[e.left+1,e.top+1],[e.right-1,e.top+1],[e.right-1,e.bottom-1],[e.left+1,e.bottom-1]],n=/* @__PURE__ */ new Set;for(let[e,r]of t){for(let t of document.elementsFromPoint(e,r))if(t.hasAttribute(V)||n.add(t),n.size>=8)break;if(n.size>=8)break}return Array.from(n).flatMap(e=>{let t=De(e),n=e.getBoundingClientRect();return!t||!n.width||!n.height?[]:[{selector:t,accessibleName:Te(e),tagName:e.tagName.toLowerCase(),role:Se(e.getAttribute(`role`)||``,64),textExcerpt:Se(q(e.textContent||``),500),rect:we(n)}]})}function Ie(e,t){Z();let n=document.createElement(`div`);n.setAttribute(V,``),Object.assign(n.style,{position:`fixed`,inset:`0`,zIndex:`2147483646`,cursor:`crosshair`,touchAction:`none`});let r=Ae();r.style.display=`none`,document.body.append(n);let i=null;function a(e,t){if(!i)return;let n=Math.min(i.x,e),a=Math.min(i.y,t),o=Math.abs(e-i.x),s=Math.abs(t-i.y);r.style.display=`block`,Y(r,new DOMRect(n,a,o,s))}function o(e){e.preventDefault(),i={x:e.clientX,y:e.clientY},n.setPointerCapture(e.pointerId),a(e.clientX,e.clientY)}function s(e){i&&(e.preventDefault(),a(e.clientX,e.clientY))}function c(a){if(!i)return;a.preventDefault();let o=new DOMRect(Math.min(i.x,a.clientX),Math.min(i.y,a.clientY),Math.abs(a.clientX-i.x),Math.abs(a.clientY-i.y));if(Math.hypot(o.width,o.height)<8){n.remove(),r.remove(),Me(e,t,`area-too-small`);return}let s={schemaVersion:1,kind:`area`,route:J(),path:[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1},{x:0,y:0}],rect:we(o),viewport:Ce(),elements:Fe(o)};n.remove(),r.style.position=`absolute`,Y(r,o),je(r),Z(),X(e,{type:`replica:canvas:selected`,nonce:t,anchor:s})}function l(n){n.key===`Escape`&&(n.preventDefault(),Z(),X(e,{type:`replica:canvas:selection-cancelled`,nonce:t}))}n.addEventListener(`pointerdown`,o),n.addEventListener(`pointermove`,s),n.addEventListener(`pointerup`,c),document.addEventListener(`keydown`,l,!0),H=()=>{n.removeEventListener(`pointerdown`,o),n.removeEventListener(`pointermove`,s),n.removeEventListener(`pointerup`,c),document.removeEventListener(`keydown`,l,!0),n.remove(),U!==r&&r.remove()}}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Le(e){for(let t=e;t;t=t.parentElement){let e=window.getComputedStyle(t).position;if(e===`fixed`||e===`sticky`)return!0}return!1}function Re(e){let t=J();if(!Q(e)||!Q(e.route)||e.route.pathname!==t.pathname||e.route.search!==t.search||e.route.hash!==t.hash)return null;if(e.kind===`area`){if(!Q(e.rect)||typeof e.rect.x!=`number`||typeof e.rect.y!=`number`||typeof e.rect.width!=`number`||typeof e.rect.height!=`number`||!Object.values(e.rect).every(Number.isFinite))return null;let t={x:e.rect.x-window.scrollX,y:e.rect.y-window.scrollY,width:e.rect.width,height:e.rect.height};return{x:t.x+t.width,y:t.y,rect:t,viewportAnchored:!1}}if(e.kind!==`element`||typeof e.selector!=`string`||typeof e.accessibleName!=`string`||typeof e.tagName!=`string`||e.selectedText!==void 0&&typeof e.selectedText!=`string`||!Q(e.elementOffset)||typeof e.elementOffset.x!=`number`||typeof e.elementOffset.y!=`number`||!Number.isFinite(e.elementOffset.x)||!Number.isFinite(e.elementOffset.y))return null;let n=ke({selector:e.selector,accessibleName:e.accessibleName,tagName:e.tagName,selectedText:e.selectedText});if(!n)return null;let r=n.getBoundingClientRect();return!r.width||!r.height?null:{x:r.left+r.width*e.elementOffset.x,y:r.top+r.height*e.elementOffset.y,viewportAnchored:Le(n)}}function $(e=!1){if(!G||!_e)return;let t=J(),n=JSON.stringify(t);e&&=n===ye,ye=n;let r=[];for(let t of G.anchors){let n=K.get(t.id),i;if(e&&n&&!n.viewportAnchored){let e=n.scrollX-window.scrollX,t=n.scrollY-window.scrollY;i={x:n.x+e,y:n.y+t,...n.rect?{rect:{...n.rect,x:n.rect.x+e,y:n.rect.y+t}}:{}}}else{let e=Re(t.anchor);if(!e){K.delete(t.id);continue}K.set(t.id,{...e,scrollX:window.scrollX,scrollY:window.scrollY}),i={x:e.x,y:e.y,...`rect`in e?{rect:e.rect}:{}}}r.push({id:t.id,...i})}X(_e,{type:`replica:canvas:resolved`,protocolVersion:1,nonce:G.nonce,route:t,...be===xe()?{replaceRoute:!0}:{},results:r})}function ze(e){let t=e.data;if(document.querySelector(`script[src="/__replica/bridge/v1.js"]`)||e.source!==window.parent||e.origin!==_e||!Q(t)||typeof t.nonce!=`string`||t.nonce.length>100)return;if(t.type===`replica:canvas:request-ready`){X(e.origin,{type:`replica:canvas:ready`,protocolVersion:1,nonce:t.nonce,route:J(),...be===xe()?{replaceRoute:!0}:{}});return}if(t.type===`replica:canvas:theme`){if(typeof t.accent!=`string`||t.accent.length>200||!CSS.supports(`color`,t.accent))return;ve=t.accent;for(let e of document.querySelectorAll(`[${V}]`))e.style.setProperty(`--replica-selection-accent`,ve);return}if(t.type===`replica:canvas:click`){let{selector:n,expectedLabel:r,route:i}=t,a=J(),o=`The click target is unavailable or ambiguous.`,s=null;if(typeof n==`string`&&n.length>0&&n.length<=512&&typeof r==`string`&&r.length>0&&r.length<=200&&Q(i)&&typeof i.pathname==`string`&&i.pathname===a.pathname&&i.search===a.search&&i.hash===a.hash)try{let e=document.querySelectorAll(n);e.length===1&&(s=e.item(0))}catch{o=`The click selector is invalid.`}else o=`The prototype route changed or the click input is invalid.`;if(s){let n=s;if(O(n,!0)||(Te(n)||q(n.textContent||``).slice(0,200))!==r)o=`The target is hidden, blocked, disabled, unsafe, or its accessible name changed.`;else{n.click(),X(e.origin,{type:`replica:canvas:click-result`,nonce:t.nonce,clicked:!0});return}}X(e.origin,{type:`replica:canvas:click-result`,nonce:t.nonce,clicked:!1,error:o});return}if(t.type===`replica:canvas:select`){t.mode===`element`?Pe(e.origin,t.nonce):t.mode===`area`&&Ie(e.origin,t.nonce);return}if(t.type===`replica:canvas:cancel-selection`){Z(),X(e.origin,{type:`replica:canvas:selection-cancelled`,nonce:t.nonce});return}if(t.type===`replica:canvas:clear-selection`){U?.remove(),U=null,W=null;return}if(t.type!==`replica:canvas:resolve`||!Array.isArray(t.anchors)||t.anchors.length>200)return;let n=[],r=t.anchors;for(let e of r)Q(e)&&typeof e.id==`number`&&Number.isSafeInteger(e.id)&&n.push({id:e.id,anchor:e.anchor});G={nonce:t.nonce,anchors:n},K.clear(),$()}var Be=Symbol.for(`replica.canvas.bridge.v1`),Ve=window;function He(e){if(!/^http:\/\/127\.0\.0\.1:\d+$/.test(e))throw Error(`Invalid Replica canvas parent.`);let t=Ve[Be];if(t===!0)throw Error(`Remove the old source bridge before using the extension-owned bridge.`);typeof t==`function`&&t(),ve=`light-dark(#0969da, #58a6ff)`,_e=e,G=null,ye=``,K.clear();let n=he(e),r=null;function i(){r!==null&&window.cancelAnimationFrame(r),r=null,U&&W&&(U.style.position=Le(W)?`fixed`:`absolute`,Y(U,W.getBoundingClientRect())),$()}function a(){r===null&&G&&(r=window.requestAnimationFrame(i))}function o(e){U&&W&&(e.target!==document&&e.target!==window||Le(W))&&Y(U,W.getBoundingClientRect()),r===null?$(e.target===document||e.target===window):i()}function s(){$()}function c(t){if(t.key!==`Escape`||t.defaultPrevented||t.isComposing||H||!G||t.target instanceof Element&&t.target.closest(`[role="dialog"], dialog, [role="menu"]`))return;let n=G;window.setTimeout(()=>{t.defaultPrevented||H||G!==n||X(e,{type:`replica:canvas:conversation-dismiss-requested`,nonce:n.nonce})},0)}window.addEventListener(`message`,ze),window.addEventListener(`scroll`,o,{capture:!0,passive:!0}),window.addEventListener(`resize`,s),window.addEventListener(`keydown`,c);let l=new MutationObserver(e=>{e.some(e=>!(e.target instanceof Element&&e.target.closest(`[${V}], [data-replica-controls-bridge]`)))&&a()});l.observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0});let u=typeof ResizeObserver==`function`?new ResizeObserver(a):null;u?.observe(document.documentElement),Ve[Be]=()=>{window.removeEventListener(`message`,ze),window.removeEventListener(`scroll`,o,!0),window.removeEventListener(`resize`,s),window.removeEventListener(`keydown`,c),l.disconnect(),u?.disconnect(),r!==null&&window.cancelAnimationFrame(r),G=null,ye=``,K.clear(),n(),Z(),U?.remove(),U=null,W=null}}export{He as installBridge}; \ No newline at end of file +`).slice(0,1e3))},n),dispose(){n=!0,f(),window.clearInterval(M);for(let e of[`input`,`change`,`popstate`,`hashchange`])window.removeEventListener(e,P);for(let e of t){e.release?.();for(let t of e.records.values())m(e,t)}}}}async function re(){let e=await fetch(`/controls.replica.json`,{credentials:`same-origin`,redirect:`error`});if(e.status===404||e.status===410)return;if(!e.ok)throw Error(`controls.replica.json returned HTTP ${e.status}.`);let t=``,n=e.body?.getReader();if(n){let e=new TextDecoder,r=0;for(;;){let{done:i,value:a}=await n.read();if(i)break;if(r+=a.byteLength,r>256e3)throw await n.cancel(),Error(`controls.replica.json exceeds the 256,000-byte limit.`);t+=e.decode(a,{stream:!0})}t+=e.decode()}else t=await e.text();if(new TextEncoder().encode(t).length>256e3)throw Error(`controls.replica.json exceeds the 256,000-byte limit.`);if(!(e.headers.get(`content-type`)?.startsWith(`text/html`)&&/^\s*<(?:!doctype html|html)/i.test(t)))return ne(JSON.parse(t))}function z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.entries(e).every(([e,t])=>/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(e)&&(typeof t==`string`||typeof t==`boolean`||typeof t==`number`&&Number.isFinite(t)||Array.isArray(t)&&t.length<=100&&t.every(e=>typeof e==`string`)))}var ie=`replica:controls`;function ae(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;try{let n=JSON.stringify(e);if(!(typeof n==`string`&&new Blob([n]).size<=512e3&&Object.keys(e).every(e=>[`protocol`,`version`,`epoch`,`requestId`,`type`,`sequence`,`state`,`error`,`command`,`controlQuery`,`fromFrameUrl`].includes(e))&&(t.error===void 0||typeof t.error==`string`&&t.error.length<=1e3)&&(t.controlQuery===void 0||[`hello`,`snapshot`,`reply`].includes(t.type)&&typeof t.controlQuery==`string`&&new Blob([t.controlQuery]).size<=8192)&&(t.fromFrameUrl===void 0||t.type===`hello`&&typeof t.fromFrameUrl==`boolean`)&&t.protocol===`replica:controls`&&t.version===1&&typeof t.epoch==`string`&&/^[a-zA-Z0-9-]{1,100}$/.test(t.epoch)&&typeof t.requestId==`string`&&/^[a-zA-Z0-9-]{1,100}$/.test(t.requestId)&&[`hello`,`snapshot`,`command`,`reply`].includes(t.type)))return!1;if(t.type!==`command`)return t.command===void 0;let r=t.command;if(!r||typeof r!=`object`||Array.isArray(r))return!1;if(r.operation===`url`)return Object.keys(r).every(e=>[`operation`,`query`,`scope`].includes(e))&&(r.scope===void 0||typeof r.scope==`string`&&/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(r.scope))&&typeof r.query==`string`&&new Blob([r.query]).size<=8192&&[...new URLSearchParams(r.query).keys()].every(e=>/^rc\.[a-zA-Z][a-zA-Z0-9_-]{0,63}\.[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(e));if(r.operation===`reset-all`)return Object.keys(r).every(e=>[`operation`,`contexts`].includes(e))&&Array.isArray(r.contexts)&&r.contexts.length<=100&&new Set(r.contexts.map(e=>e?.scope)).size===r.contexts.length&&r.contexts.every(e=>typeof e==`object`&&!!e&&Object.keys(e).length===3&&typeof e.scope==`string`&&/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(e.scope)&&typeof e.fingerprint==`string`&&Number.isSafeInteger(e.revision)&&e.revision>=0);let i=[`operation`,`scope`,`fingerprint`,`revision`];return typeof r.scope!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(r.scope)||typeof r.fingerprint!=`string`||!Number.isSafeInteger(r.revision)||r.revision===void 0||r.revision<0?!1:r.operation===`restore`?Object.keys(r).every(e=>[...i,`values`].includes(e))&&z(r.values):r.operation===`reset`?Object.keys(r).every(e=>i.includes(e)):r.operation!==`action`&&r.operation!==`update`||typeof r.id!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(r.id)?!1:Object.keys(r).every(e=>[...i,`id`,...r.operation===`update`?[`value`]:[]].includes(e))&&(r.operation===`action`||z({[r.id]:r.value}))}catch{return!1}}function oe(e){return C(e.declaration),JSON.parse(JSON.stringify({declaration:e.declaration,fingerprint:JSON.stringify(e.declaration),snapshot:e.getSnapshot()}))}var se=/^rc\.([a-zA-Z][a-zA-Z0-9_-]{0,63})\.([a-zA-Z][a-zA-Z0-9_-]{0,63})$/;function ce(e){let t=new URLSearchParams;for(let n of Object.keys(e).sort()){let r=e[n];if(!z(r))throw Error(`Invalid control settings.`);for(let e of Object.keys(r).sort()){let i=`rc.${n}.${e}`;if(!se.test(i))throw Error(`Invalid control settings identifier.`);t.set(i,JSON.stringify(r[e]))}}let n=t.toString();if(new Blob([n]).size>8192)throw Error(`Control settings exceed the 8 KB URL limit. Reduce the settings before sharing.`);return n}function le(e){let t=new URLSearchParams(e),n=[...t].filter(([e])=>e.startsWith(`rc.`));if(new Blob([new URLSearchParams(n).toString()]).size>8192)return{scopes:{},notice:`Control settings in this URL exceed 8 KB. Defaults were used.`};let r=/* @__PURE__ */ new Map,i=!1;for(let[e,a]of n){let n=se.exec(e);if(!n||t.getAll(e).length!==1){i=!0;continue}let o=n[1],s=n[2],c;try{c=JSON.parse(a)}catch{c=a}if(!z({[s]:c})){i=!0;continue}let l=r.get(o)??/* @__PURE__ */ new Map;l.set(s,c),r.set(o,l)}let a=Object.fromEntries([...r].map(([e,t])=>[e,Object.fromEntries(t)]));try{ce(a)}catch{return{scopes:{},notice:`Control settings in this URL exceed 8 KB. Defaults were used.`}}return{scopes:a,notice:i?`Some URL control settings were invalid. Defaults were used instead.`:``}}function ue(e,t){let n=new URL(e,window.location.href),r=le(t);if(r.notice)throw Error(r.notice);for(let e of[...n.searchParams.keys()])e.startsWith(`rc.`)&&n.searchParams.delete(e);for(let[e,t]of new URLSearchParams(ce(r.scopes)))n.searchParams.set(e,t);return n.toString()}function de(e,t,n){let r=window.history.pushState.bind(window.history),i=window.history.replaceState.bind(window.history),a=!1,o=document.readyState===`complete`||(performance.getEntriesByType?.(`navigation`)??[]).some(e=>`domContentLoadedEventStart`in e&&typeof e.domContentLoadedEventStart==`number`&&e.domContentLoadedEventStart>0),s=new URLSearchParams([...new URLSearchParams(window.location.search)].filter(([e])=>e.startsWith(`rc.`))).toString();function c(){try{let e=ce({...le(s).scopes,...t()});return n(``),e}catch(e){return n(e instanceof Error?e.message:`Controls could not be saved in the URL.`),s}}function l(e){if(!a||!o)return new URL(String(e??window.location.href),window.location.href).toString();let t=new URL(ue(String(e??window.location.href),c()));return t.searchParams.set(`rc`,`1`),t.toString()}function u(e,t,n){r(e,t,l(n))}function d(e,t,n){i(e,t,l(n))}window.history.pushState=u,window.history.replaceState=d;function f(t){`replicaControlsBinding`in t&&t.replicaControlsBinding===!0||(s=new URLSearchParams([...new URLSearchParams(window.location.search)].filter(([e])=>e.startsWith(`rc.`))).toString(),e(s))}function p(e){if(!a||!o||e.defaultPrevented||!(e.target instanceof Element))return;let t=e.target.closest(`a[href]`);if(!(t instanceof HTMLAnchorElement)||t.hasAttribute(`download`)||t.target&&t.target!==`_self`)return;let n=new URL(t.href);n.origin===window.location.origin&&(t.href=l(n))}window.addEventListener(`popstate`,f),window.addEventListener(`click`,p,!0);function m(){if(!a||!o)return;s=c();let e=l(window.location.href);e!==window.location.href&&i(window.history.state,``,e)}function h(){o=!0,m()}return document.addEventListener(`DOMContentLoaded`,h,{once:!0}),{set(e){let t=le(e);if(t.notice)throw Error(t.notice);s=ce(t.scopes),a=!0,m()},refresh:m,current(){return new URLSearchParams([...new URLSearchParams(window.location.search)].filter(([e])=>e.startsWith(`rc.`))).toString()},managed(){return new URLSearchParams(window.location.search).get(`rc`)===`1`},dispose(){window.history.pushState===u&&(window.history.pushState=r),window.history.replaceState===d&&(window.history.replaceState=i),window.removeEventListener(`popstate`,f),window.removeEventListener(`click`,p,!0),document.removeEventListener(`DOMContentLoaded`,h)}}}function fe(e){return Object.fromEntries(e.declaration.controls.filter(t=>t.type!==`button`&&e.snapshot.visible[t.id]&&JSON.stringify(e.snapshot.values[t.id])!==JSON.stringify(t.default)).map(t=>[t.id,e.snapshot.values[t.id]]))}var pe={improvementNotesLoading:`Loading improvement notes demo...`,mentionSuggestions:`Mention suggestions`,mentionSuggestionsError:`Mention suggestions are unavailable. Try again.`,mentionSuggestionsLoading:`Loading people...`,mentionSuggestionsEmpty:`No matching people. You can type a GitHub login to check it when sending.`,mentionLimit:`Each message can mention at most 10 distinct people.`,controls:`Controls`,controlsMove:`Move controls`,controlsMoveHint:`Drag to move. Use arrow keys, or Shift and arrow keys for smaller steps.`,controlsCollapse:`Collapse controls`,controlsExpand:`Expand controls`,controlsCollapseGroup:e=>`Collapse ${e}`,controlsExpandGroup:e=>`Expand ${e}`,controlsDescription:`Settings stay in this prototype's URL. The app may paint before Controls apply declared defaults.`,controlsConnecting:`Connecting controls...`,controlsEmpty:`No active controls. This prototype may have no declaration or this route may not mount controls.`,controlsLearnMore:`Learn more`,controlsMissingRuntime:`No supported controls runtime found.`,controlsLocalMissingRuntime:`Local controls couldn't connect.`,controlsLocalConnectionFailed:`The preview has not responded to controls. Retry the connection or ask Copilot to diagnose the cause.`,controlsLocalStorageFailed:`Controls could not be saved in the prototype URL. Changes remain in memory.`,controlsDiagnose:`Diagnose with Copilot`,controlsFix:`Fix with Copilot`,controlsDiagnostics:`Technical details`,controlsUnavailable:e=>`${e} is unavailable`,controlsNotApplied:e=>`${e} could not be applied`,controlsDiagnosisRequested:`Requested in chat`,controlsDiagnosisFailed:`Could not request a diagnosis. Try again.`,controlsUnsupportedRuntime:`This controls runtime version is unsupported. Upgrade only after an approved release.`,controlsInvalid:`The Controls definitions are invalid. Fix controls.replica.json and reload.`,controlsScopeError:(e,t)=>`Controls scope "${e}" did not connect. ${t}`,controlsRetry:`Retry connection`,controlsRetryStorage:`Retry saving`,controlsResetAll:`Reset all controls`,controlsRegion:`Prototype controls`,controlsActionBusy:` - Working...`,controlsActionUnavailable:`No mounted action handler.`,controlsValueNotApplied:`This value was not applied.`,browserNavigation:`Prototype navigation`,browserBack:`Back`,browserForward:`Forward`,browserReload:`Reload preview`,browserAddress:`Prototype address`,browserAddressInvalid:`Enter a valid URL or route.`,browserAddressOrigin:`The address must stay on this prototype's origin.`,browserOpenTab:`Open preview in browser`,browserAppearance:`Preview appearance`,browserLight:`Light appearance`,browserDark:`Dark appearance`,commentingUnavailable:`Commenting needs attention`,commentingDescription:`The canvas could not connect to the preview's commenting bridge.`,closeCommentingDialog:`Close commenting dialog`,commentingFix:`Fix with Copilot`,commentingFixRequested:`Requested in chat`,commentingDismiss:`Dismiss`,commentingMissing:`The preview has not responded through its local proxy. Check that the selected server is running, then reopen the canvas. Script or framing policies, certificate errors, and origin-dependent apps can prevent connection. A Vite plugin or server restart is not required to connect.`,commentingIncompatible:`The preview responded with an incompatible commenting protocol. Update the installed Replica extension and reopen the canvas, or use Fix with Copilot to check the preview connection.`,connectToHub:`Connect to the Hub`,closeConnectionDialog:`Close connection dialog`,connectionDescription:`Connecting to the hub lets you share the prototype with others and enables commenting.`,connectionBeforePublishing:`Connect to the hub before publishing this prototype.`,connectionRepositoryRequired:`Open a repository with a GitHub origin before connecting.`,connectionHubRequired:`Enter and save a Hub URL before connecting.`,connectionOpeningBrowser:`Opening browser...`,connectionApproval:`Browser approval`,connectionWaiting:`Make sure your browser shows the same code`,connectionApprovalExpired:`The approval expired or was declined. Connect again to retry.`,connectionBrowserFailed:e=>`Could not open your browser. Open or copy the approval link below. ${e}`,hubUrl:`Hub URL`,editHubUrl:`Edit Hub URL`,saveHub:`Save Hub`,disconnectFailed:(e,t)=>`Could not disconnect from ${e}: ${t} The previous connection may still be active. Save another Hub URL to switch this canvas locally, or retry Disconnect Hub.`,resetHubUrl:`Reset to repository Hub URL`,resetHubUnavailable:`No repository Hub URL is available. Enter a URL manually or retry reset.`,hubHttpsHint:`Remote Hubs require HTTPS`,copyApprovalLink:`Copy Hub approval link`,approvalLinkCopied:`Approval link copied`,approvalCopyFailed:`Could not copy the link. Copy the Connect to the hub link manually.`,invalidResponse:`The extension returned an invalid response.`,startPage:`Start page`,prototypeFrameTitle:e=>`${e} prototype`,startPageOrigin:`Hub returned a start page outside the prototype.`,hubStatusUnavailable:e=>`Hub status unavailable: ${e}`,hubBuildImported:`Hub imported this Build.`,hubBuildMissing:`Hub has not imported a successful registered Build.`,hubPublicationUnavailable:`Connect to Hub to verify publication.`,editDetails:`Edit details`,startPageHint:`Paste a prototype URL or route. Leave blank to start at /.`,requestFailed:`The request failed.`,statusUnavailable:`Publish status unavailable.`,publishRequestPending:`Waiting for the current commit to run through the publish workflow.`,waitingForHubImport:`The workflow completed. Waiting for Hub to import this Build.`,workingTreeChanged:`Uncommitted changes`,workingTreeClean:`Working tree clean`,buildDetails:`Build details`,latestBuild:`Latest Build`,buildTitle:e=>`Build #${e}`,buildCommit:`Commit`,unknownCommitAuthor:`Unknown`,showBuildHistory:`Show build history`,closeBuildDetails:`Close build details`,branch:`Branch`,sessionId:`Session ID`,comparison:`Branch comparison`,comparisonNeedsRefresh:`Branch comparison unavailable until Git stats refresh.`,upToDate:`Up to date`,commitsBehind:e=>`${e} ${e===1?`commit`:`commits`} behind`,copyBranch:`Copy branch`,copySessionId:`Copy session ID`,branchCopied:`Branch copied`,sessionIdCopied:`Session ID copied`,buildDetailsCopyFailed:e=>`${e} could not be copied. Select it and copy it manually.`,unavailable:`Unavailable`,publishLabels:{succeeded:`Awaiting Hub`,failed:`Retry`,in_progress:`Publishing`,not_published:`Publish`,published:`Published`,requested:`Requested`,unavailable:`Publish`}};function me(e,t){let n=e.snapshot.bindings?.[t.id],r=e.snapshot.actions[t.id];return{scope:e.declaration.scope,id:t.id,visible:e.snapshot.visible[t.id]===!0,available:(t.type!==`button`||r?.available===!0)&&(!n?.error||n.available===!0),busy:n?.busy===!0||r?.busy===!0,error:n?.error||(t.type===`button`&&!r?.available?pe.controlsActionUnavailable:``)}}function he(e,t,n){return{status:t?`pending`:e.status,url:n,error:t?``:e.error??``,controls:t?[]:e.scopes.flatMap(e=>e.declaration.controls.map(t=>me(e,t)))}}function ge(e){let t=``,n,r,i=``,a=!1,o=/* @__PURE__ */ new Set,s=!1,c=0,l,u,d=!1,f,p=/* @__PURE__ */ new Set,m=/* @__PURE__ */ new Set,h=``,g=de(e=>{m.clear(),x(`snapshot`,`event`,void 0,e)},()=>Object.fromEntries((n?.list()??[]).filter(e=>m.has(e.declaration.scope)).map(e=>[e.declaration.scope,fe(oe(e))])),e=>{h!==e&&(h=e,x(`snapshot`,`event`))});async function _(){try{if(u=await re(),a){u?.dispose();return}n=u?.runtime,r=u?.subscribe(S),await u?.settled();let e=u;e&&v()&&await new Promise(t=>{function n(){clearTimeout(i),a(),f=void 0,t()}function r(){v()||n()}let i=setTimeout(n,500),a=e.subscribe(r);f=n,r()})}catch(e){l={status:`invalid-config`,error:e instanceof Error?e.message.slice(0,1e3):`Controls definitions could not be read.`}}finally{d=!0}S()}function v(){return n?.list().some(e=>Object.values(e.getSnapshot().bindings??{}).some(e=>e.error))}function y(){let e=!!n;if(l)return{runtimeAvailable:e,scopes:[],...l};if(!n)return{runtimeAvailable:!1,status:d?`no-controls`:`missing-runtime`,scopes:[]};try{let e=n.list().filter(e=>e.mountedCount>0).map(oe);return e.length>100?{runtimeAvailable:!0,status:`invalid-config`,scopes:[],error:`Too many active controls scopes.`}:{runtimeAvailable:!0,status:e.length?`ready`:`no-controls`,scopes:e}}catch{return{runtimeAvailable:!0,status:`invalid-config`,scopes:[],error:`The Controls definitions are invalid.`}}}function b(){return{...y(),scopeErrors:[],reconnectRequired:s,...s?{error:`Reconnect controls before sending more commands.`}:{},...h?{error:`${h} Changes remain in memory and are not in the URL.`}:{}}}function x(n,r,i,o){if(a||!t)return;let s={protocol:ie,version:1,type:n,epoch:t,requestId:r,sequence:++c,state:b(),...i?{error:i}:{},...o===void 0?{}:{controlQuery:o}};window.parent.postMessage(ae(s)?s:{...s,state:{runtimeAvailable:!0,status:`invalid-config`,scopes:[],error:`Controls exceed the transport size limit.`},error:`Controls exceed the transport size limit.`},e)}function S(){for(let e of p)e();if(!d||u?.pending())return;g?.refresh();let e=JSON.stringify(b());e!==i&&(i=e,x(`snapshot`,`event`))}async function C(r){if(r.source===window.parent&&r.origin===e&&r.data&&typeof r.data==`object`&&`type`in r.data&&r.data.type===`replica:controls:status`&&`nonce`in r.data&&typeof r.data.nonce==`string`&&r.data.nonce.length<=100&&`timeoutMs`in r.data&&Number.isInteger(r.data.timeoutMs)&&typeof r.data.timeoutMs==`number`&&r.data.timeoutMs>=0&&r.data.timeoutMs<=1e4){let{nonce:t,timeoutMs:n}=r.data;function i(){return!d||u?.pending()===!0&&!b().scopes.some(({snapshot:e})=>[...Object.values(e.actions),...Object.values(e.bindings??{})].some(e=>e.busy))}i()&&n>0&&await new Promise(e=>{function t(){clearTimeout(o),p.delete(r),e()}function r(){(a||!i())&&t()}let o=setTimeout(t,n);p.add(r),r()}),a||window.parent.postMessage({type:`replica:controls:status-result`,nonce:t,value:he(b(),i(),window.location.href)},e);return}if(r.source!==window.parent||r.origin!==e||!ae(r.data))return;let i=r.data;if(i.type===`hello`){t=i.epoch,o.clear(),s=!1,m.clear();let e=i.fromFrameUrl&&g?.managed();g?.set(e?g.current():i.controlQuery??``),d||await w,x(`reply`,i.requestId,void 0,e?g?.current():void 0);return}if(i.type!==`command`||i.epoch!==t||o.has(i.requestId))return;if(o.size>=2e3){s=!0,x(`reply`,i.requestId,`Reconnect controls before sending more commands.`);return}o.add(i.requestId);let c=i.command;function l(){if(a||t!==i.epoch)throw Error(`The preview reconnected. The command outcome is unknown.`)}try{if(c?.operation===`url`){g.set(c.query??``),c.scope&&n?.list().some(e=>e.declaration.scope===c.scope&&e.mountedCount>0)&&(m.add(c.scope),g.refresh()),x(`reply`,i.requestId);return}if(!c||!n||![`ready`,`no-controls`].includes(b().status))throw Error(`Controls runtime is unavailable.`);if(c.operation===`reset-all`){if(n.list().some(e=>Object.values(e.getSnapshot().actions).some(e=>e.busy)))throw Error(`Wait for pending actions before resetting controls.`);let e=n.list().filter(e=>e.mountedCount>0);if(!Array.isArray(c.contexts)||c.contexts.length!==e.length||e.some(e=>!c.contexts?.some(t=>t.scope===e.declaration.scope&&t.fingerprint===JSON.stringify(e.declaration)&&t.revision===e.getSnapshot().revision)))throw Error(`Controls changed. The stale reset was not applied.`);m.clear(),await u?.reset(void 0,l)}else{let e=n.list().find(e=>e.declaration.scope===c.scope&&e.mountedCount>0);if(!e)throw Error(`This controls scope is no longer active.`);if(c.fingerprint!==JSON.stringify(e.declaration)||c.revision!==e.getSnapshot().revision)throw Error(`Controls changed. The stale command was not applied.`);if(c.operation===`restore`){if(!z(c.values))throw Error(`Invalid saved controls.`);await u?.restore(e,c.values,l),m.add(e.declaration.scope),g?.refresh()}else if(c.operation===`reset`)m.add(e.declaration.scope),await u?.reset(e,l);else{let t=e.declaration.controls.find(e=>e.id===c.id);if(!t||!e.getSnapshot().visible[t.id])throw Error(`This control is unknown or hidden.`);if(m.add(e.declaration.scope),c.operation===`update`){let n={[t.id]:c.value};if(!z(n))throw Error(`Invalid control value.`);let r=n[t.id];if(r===void 0)throw Error(`Missing control value.`);await u?.update(e,t.id,r,l)}else if(c.operation===`action`)await e.action(t.id);else throw Error(`Unknown controls command.`)}S()}t===i.epoch&&(x(`reply`,i.requestId),u?.navigate())}catch(e){t===i.epoch&&x(`reply`,i.requestId,e instanceof Error?e.message.slice(0,300):`The controls command failed.`)}}let w=_();function T(e){C(e)}return window.addEventListener(`message`,T),()=>{a=!0,f?.();for(let e of p)e();r?.(),u?.dispose(),window.removeEventListener(`message`,T),g?.dispose()}}var B=`data-replica-canvas-bridge`,_e=new TextEncoder,ve=null,V=null,H=null,U=null,ye=`light-dark(#0969da, #58a6ff)`,W=null,be=``,xe=``,G=/* @__PURE__ */ new Map;function Se(){let e=q();return e.pathname+e.search+e.hash}for(let e of[`popstate`,`hashchange`])window.addEventListener(e,e=>{xe=`replicaControlsBinding`in e&&e.replicaControlsBinding?Se():``});function K(e){return e.replace(/\s+/g,` `).trim()}function Ce(e,t){let n=``,r=0;for(let i of e){let e=_e.encode(i).length;if(r+e>t)break;n+=i,r+=e}return n}function q(){let e=window.location.search.slice(1).split(`&`).filter(e=>{let t=new URLSearchParams(e).keys().next().value;return t!==`rc`&&!t?.startsWith(`rc.`)}).join(`&`);return{pathname:window.location.pathname,search:e?`?${e}`:``,hash:window.location.hash}}function we(){return{width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX,scrollY:window.scrollY}}function Te(e){return{x:e.left+window.scrollX,y:e.top+window.scrollY,width:e.width,height:e.height}}function Ee(e){let t=e.getAttribute(`aria-labelledby`),n=t?t.split(/\s+/).map(e=>document.getElementById(e)?.textContent||``).join(` `):``,r=`labels`in e&&e.labels?Array.from(e.labels).map(e=>e.textContent||``).join(` `):``;return Ce(K(e.getAttribute(`aria-label`)||n||r||e.getAttribute(`alt`)||e.getAttribute(`title`)||``),1e3)}function De(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,e=>`\\${e}`)}function Oe(e){if(e.id){let t=`#${De(e.id)}`;if(document.querySelectorAll(t).length===1)return t}for(let t of[`data-testid`,`data-test-id`]){let n=e.getAttribute(t);if(!n)continue;let r=`[${t}="${De(n)}"]`;if(document.querySelectorAll(r).length===1)return r}let t=[],n=e;for(;n&&n!==document.documentElement;){let e=n.tagName.toLowerCase(),r=n.parentElement?Array.from(n.parentElement.children).filter(e=>e.tagName===n?.tagName):[],i=r.length>1?`${e}:nth-of-type(${r.indexOf(n)+1})`:e;t.unshift(i);let a=t.join(` > `);if(document.querySelectorAll(a).length===1)return a;n=n.parentElement}return t.join(` > `)}function ke(e,t){return e.tagName.toLowerCase()!==t.tagName||t.accessibleName&&Ee(e)!==t.accessibleName?!1:!t.selectedText||K(e.textContent||``).includes(t.selectedText)}function Ae(e){let t=null;try{t=document.querySelector(e.selector)}catch{}if(t&&ke(t,e))return t;if(!e.accessibleName&&!e.selectedText)return null;let n=null;for(let r of document.getElementsByTagName(e.tagName))if(r!==t&&ke(r,e)){if(n)return null;n=r}return n}function je(){let e=document.createElement(`div`);return e.setAttribute(B,``),Object.assign(e.style,{position:`fixed`,colorScheme:`light dark`,zIndex:`2147483647`,pointerEvents:`none`,border:`2px solid var(--replica-selection-accent)`,borderRadius:`4px`,background:`color-mix(in srgb, var(--replica-selection-accent) 12%, transparent)`,boxSizing:`border-box`}),e.style.setProperty(`--replica-selection-accent`,ye),document.documentElement.append(e),e}function J(e,t){let n=e.style.position===`absolute`,r=`left`in t?t.left:t.x-window.scrollX,i=`top`in t?t.top:t.y-window.scrollY;Object.assign(e.style,{left:`${r+(n?window.scrollX:0)}px`,top:`${i+(n?window.scrollY:0)}px`,width:`${t.width}px`,height:`${t.height}px`})}function Me(e,t=null){H?.remove(),H=e,U=t,H.style.pointerEvents=`none`}function Y(e,t){window.parent.postMessage(t,e)}function X(){V?.(),V=null}function Z(e,t,n){X(),Y(e,{type:`replica:canvas:selection-failed`,nonce:t,reason:n})}function Ne(e,t,n){let r=e.getBoundingClientRect(),i=Oe(e);if(!r.width||!r.height||!i)return null;let a=Ce(K(window.getSelection()?.toString()||``),2e3);return{schemaVersion:1,kind:`element`,route:q(),selector:i,accessibleName:Ee(e),tagName:e.tagName.toLowerCase(),selectedText:e.contains(window.getSelection()?.anchorNode||null)?a:``,rect:Te(r),viewport:we(),elementOffset:{x:Math.min(1,Math.max(0,(t-r.left)/r.width)),y:Math.min(1,Math.max(0,(n-r.top)/r.height))}}}function Pe(e,t){X();let n=null,r=je(),i=document.documentElement.style.cursor;document.documentElement.style.cursor=`crosshair`;function a(e){let t=e.target instanceof Element?e.target.closest(`:not([${B}])`):null;!t||t===document.documentElement||t===document.body?(n=null,r.style.display=`none`):(n=t,r.style.display=`block`,J(r,t.getBoundingClientRect()))}function o(i){if(!n)return;i.preventDefault(),i.stopImmediatePropagation();let a=Ne(n,i.clientX,i.clientY);a?(r.style.position=$(n)?`fixed`:`absolute`,J(r,n.getBoundingClientRect()),Me(r,n),X(),Y(e,{type:`replica:canvas:selected`,nonce:t,anchor:a})):(r.remove(),Z(e,t,`element-unavailable`))}function s(n){n.key===`Escape`&&(n.preventDefault(),X(),Y(e,{type:`replica:canvas:selection-cancelled`,nonce:t}))}document.addEventListener(`pointermove`,a,!0),document.addEventListener(`click`,o,!0),document.addEventListener(`keydown`,s,!0),V=()=>{document.removeEventListener(`pointermove`,a,!0),document.removeEventListener(`click`,o,!0),document.removeEventListener(`keydown`,s,!0),document.documentElement.style.cursor=i,H!==r&&r.remove()}}function Fe(e){let t=[[e.left+e.width/2,e.top+e.height/2],[e.left+1,e.top+1],[e.right-1,e.top+1],[e.right-1,e.bottom-1],[e.left+1,e.bottom-1]],n=/* @__PURE__ */ new Set;for(let[e,r]of t){for(let t of document.elementsFromPoint(e,r))if(t.hasAttribute(B)||n.add(t),n.size>=8)break;if(n.size>=8)break}return Array.from(n).flatMap(e=>{let t=Oe(e),n=e.getBoundingClientRect();return!t||!n.width||!n.height?[]:[{selector:t,accessibleName:Ee(e),tagName:e.tagName.toLowerCase(),role:Ce(e.getAttribute(`role`)||``,64),textExcerpt:Ce(K(e.textContent||``),500),rect:Te(n)}]})}function Ie(e){return{schemaVersion:1,kind:`area`,route:q(),path:[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1},{x:0,y:0}],rect:Te(e),viewport:we(),elements:Fe(e)}}function Le(e,t,n=!1){X();let r=document.createElement(`div`);r.setAttribute(B,``),Object.assign(r.style,{position:`fixed`,inset:`0`,zIndex:`2147483646`,cursor:`crosshair`,touchAction:`none`});let i=je();i.style.display=`none`,document.body.append(r);let a=null,o=null,s=null,c=null;function l(e,t){r.style.pointerEvents=`none`;let n=document.elementFromPoint(e,t);return r.style.pointerEvents=``,n===document.body||n===document.documentElement?null:n}function u(n,r,a){i.style.position=a&&$(a)?`fixed`:`absolute`,J(i,r),Me(i,a),X(),Y(e,{type:`replica:canvas:selected`,nonce:t,anchor:n})}function d(e,t){if(!a)return;let n=Math.min(a.x,e),r=Math.min(a.y,t),o=Math.abs(e-a.x),s=Math.abs(t-a.y);i.style.display=`block`,J(i,new DOMRect(n,r,o,s))}function f(e){e.button!==0||a||(e.preventDefault(),a={x:e.clientX,y:e.clientY},s=e.pointerId,o=n?l(e.clientX,e.clientY):null,r.setPointerCapture(e.pointerId),d(e.clientX,e.clientY))}function p(e){if(a)e.pointerId===s&&(e.preventDefault(),d(e.clientX,e.clientY));else{if(!n)return;let t=l(e.clientX,e.clientY);i.style.display=t?`block`:`none`,t&&J(i,t.getBoundingClientRect())}}function m(r){if(!a||r.pointerId!==s)return;r.preventDefault();let i=Math.max(0,Math.min(window.innerWidth,r.clientX)),c=Math.max(0,Math.min(window.innerHeight,r.clientY)),l=new DOMRect(Math.min(a.x,i),Math.min(a.y,c),Math.abs(i-a.x),Math.abs(c-a.y));if(n&&Math.hypot(l.width,l.height)<8){let n=o?Ne(o,a.x,a.y):null;if(!n||!o){Z(e,t,`element-unavailable`);return}u(n,o.getBoundingClientRect(),o)}else(n?l.width<8||l.height<8:Math.hypot(l.width,l.height)<8)?Z(e,t,`area-too-small`):u(Ie(l),l)}function h(r){if(!n||r.detail!==0||!(r.target instanceof Element)||r.target.hasAttribute(B))return;r.preventDefault(),r.stopImmediatePropagation();let i=r.target,a=i.getBoundingClientRect(),o=Ne(i,a.left+a.width/2,a.top+a.height/2);o?u(o,a,i):Z(e,t,`element-unavailable`)}function g(n){X(),Y(e,{type:`replica:canvas:selection-cancelled`,nonce:t,reason:n?`interrupted`:`escape`})}function _(r){if(n&&r.shiftKey&&r.key===`Enter`)r.preventDefault(),c={x:window.innerWidth/2,y:window.innerHeight/2},a=null,i.style.display=`block`,J(i,new DOMRect(c.x,c.y,4,4));else if(c&&[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Enter`,` `].includes(r.key)){if(r.preventDefault(),r.key===`Enter`||r.key===` `){if(!a)a={...c};else{let n=new DOMRect(Math.min(a.x,c.x),Math.min(a.y,c.y),Math.abs(a.x-c.x),Math.abs(a.y-c.y));if(n.width<8||n.height<8){Z(e,t,`area-too-small`);return}u(Ie(n),n)}}else c={x:Math.max(0,Math.min(window.innerWidth,c.x+(r.key===`ArrowRight`?10:r.key===`ArrowLeft`?-10:0))),y:Math.max(0,Math.min(window.innerHeight,c.y+(r.key===`ArrowDown`?10:r.key===`ArrowUp`?-10:0)))},a?d(c.x,c.y):J(i,new DOMRect(c.x,c.y,4,4))}else r.key===`Escape`&&(r.preventDefault(),g())}r.addEventListener(`pointerdown`,f),r.addEventListener(`pointermove`,p),r.addEventListener(`pointerup`,m),r.addEventListener(`pointercancel`,g),r.addEventListener(`lostpointercapture`,g),n&&document.addEventListener(`click`,h,!0),document.addEventListener(`keydown`,_,!0),V=()=>{r.removeEventListener(`pointerdown`,f),r.removeEventListener(`pointermove`,p),r.removeEventListener(`pointerup`,m),r.removeEventListener(`pointercancel`,g),r.removeEventListener(`lostpointercapture`,g),n&&document.removeEventListener(`click`,h,!0),document.removeEventListener(`keydown`,_,!0),r.remove(),H!==i&&i.remove()}}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){for(let t=e;t;t=t.parentElement){let e=window.getComputedStyle(t).position;if(e===`fixed`||e===`sticky`)return!0}return!1}function Re(e){let t=q();if(!Q(e)||!Q(e.route)||e.route.pathname!==t.pathname||e.route.search!==t.search||e.route.hash!==t.hash)return null;if(e.kind===`area`){if(!Q(e.rect)||typeof e.rect.x!=`number`||typeof e.rect.y!=`number`||typeof e.rect.width!=`number`||typeof e.rect.height!=`number`||!Object.values(e.rect).every(Number.isFinite))return null;let t={x:e.rect.x-window.scrollX,y:e.rect.y-window.scrollY,width:e.rect.width,height:e.rect.height};return{x:t.x+t.width,y:t.y,rect:t,viewportAnchored:!1}}if(e.kind!==`element`||typeof e.selector!=`string`||typeof e.accessibleName!=`string`||typeof e.tagName!=`string`||e.selectedText!==void 0&&typeof e.selectedText!=`string`||!Q(e.elementOffset)||typeof e.elementOffset.x!=`number`||typeof e.elementOffset.y!=`number`||!Number.isFinite(e.elementOffset.x)||!Number.isFinite(e.elementOffset.y))return null;let n=Ae({selector:e.selector,accessibleName:e.accessibleName,tagName:e.tagName,selectedText:e.selectedText});if(!n)return null;let r=n.getBoundingClientRect();return!r.width||!r.height?null:{x:r.left+r.width*e.elementOffset.x,y:r.top+r.height*e.elementOffset.y,viewportAnchored:$(n)}}function ze(e=!1){if(!W||!ve)return;let t=q(),n=JSON.stringify(t);e&&=n===be,be=n;let r=[];for(let t of W.anchors){let n=G.get(t.id),i;if(e&&n&&!n.viewportAnchored){let e=n.scrollX-window.scrollX,t=n.scrollY-window.scrollY;i={x:n.x+e,y:n.y+t,...n.rect?{rect:{...n.rect,x:n.rect.x+e,y:n.rect.y+t}}:{}}}else{let e=Re(t.anchor);if(!e){G.delete(t.id);continue}G.set(t.id,{...e,scrollX:window.scrollX,scrollY:window.scrollY}),i={x:e.x,y:e.y,...`rect`in e?{rect:e.rect}:{}}}r.push({id:t.id,...i})}Y(ve,{type:`replica:canvas:resolved`,protocolVersion:1,nonce:W.nonce,route:t,...xe===Se()?{replaceRoute:!0}:{},results:r})}function Be(e){let t=e.data;if(document.querySelector(`script[src="/__replica/bridge/v1.js"]`)||e.source!==window.parent||e.origin!==ve||!Q(t)||typeof t.nonce!=`string`||t.nonce.length>100)return;if(t.type===`replica:canvas:request-ready`){Y(e.origin,{type:`replica:canvas:ready`,protocolVersion:1,improvementSelection:!0,nonce:t.nonce,route:q(),...xe===Se()?{replaceRoute:!0}:{}});return}if(t.type===`replica:canvas:theme`){if(typeof t.accent!=`string`||t.accent.length>200||!CSS.supports(`color`,t.accent))return;ye=t.accent;for(let e of document.querySelectorAll(`[${B}]`))e.style.setProperty(`--replica-selection-accent`,ye);return}if(t.type===`replica:canvas:click`){let{selector:n,expectedLabel:r,route:i}=t,a=q(),o=`The click target is unavailable or ambiguous.`,s=null;if(typeof n==`string`&&n.length>0&&n.length<=512&&typeof r==`string`&&r.length>0&&r.length<=200&&Q(i)&&typeof i.pathname==`string`&&i.pathname===a.pathname&&i.search===a.search&&i.hash===a.hash)try{let e=document.querySelectorAll(n);e.length===1&&(s=e.item(0))}catch{o=`The click selector is invalid.`}else o=`The prototype route changed or the click input is invalid.`;if(s){let n=s;if(O(n,!0)||(Ee(n)||K(n.textContent||``).slice(0,200))!==r)o=`The target is hidden, blocked, disabled, unsafe, or its accessible name changed.`;else{n.click(),Y(e.origin,{type:`replica:canvas:click-result`,nonce:t.nonce,clicked:!0});return}}Y(e.origin,{type:`replica:canvas:click-result`,nonce:t.nonce,clicked:!1,error:o});return}if(t.type===`replica:canvas:select`){t.mode===`element`?Pe(e.origin,t.nonce):t.mode===`area`?Le(e.origin,t.nonce):t.mode===`improvement`&&Le(e.origin,t.nonce,!0);return}if(t.type===`replica:canvas:cancel-selection`){X(),Y(e.origin,{type:`replica:canvas:selection-cancelled`,nonce:t.nonce,reason:`command`});return}if(t.type===`replica:canvas:clear-selection`){H?.remove(),H=null,U=null;return}if(t.type!==`replica:canvas:resolve`||!Array.isArray(t.anchors)||t.anchors.length>200)return;let n=[],r=t.anchors;for(let e of r)Q(e)&&typeof e.id==`number`&&Number.isSafeInteger(e.id)&&n.push({id:e.id,anchor:e.anchor});W={nonce:t.nonce,anchors:n},G.clear(),ze()}var Ve=Symbol.for(`replica.canvas.bridge.v1`),He=window;function Ue(e){if(!/^http:\/\/127\.0\.0\.1:\d+$/.test(e))throw Error(`Invalid Replica canvas parent.`);let t=He[Ve];if(t===!0)throw Error(`Remove the old source bridge before using the extension-owned bridge.`);typeof t==`function`&&t(),ye=`light-dark(#0969da, #58a6ff)`,ve=e,W=null,be=``,G.clear();let n=ge(e),r=null;function i(){r!==null&&window.cancelAnimationFrame(r),r=null,H&&U&&(H.style.position=$(U)?`fixed`:`absolute`,J(H,U.getBoundingClientRect())),ze()}function a(){r===null&&W&&(r=window.requestAnimationFrame(i))}function o(e){H&&U&&(e.target!==document&&e.target!==window||$(U))&&J(H,U.getBoundingClientRect()),r===null?ze(e.target===document||e.target===window):i()}function s(){ze()}function c(t){if(t.key!==`Escape`||t.defaultPrevented||t.isComposing||V||!W||t.target instanceof Element&&t.target.closest(`[role="dialog"], dialog, [role="menu"]`))return;let n=W;window.setTimeout(()=>{t.defaultPrevented||V||W!==n||Y(e,{type:`replica:canvas:conversation-dismiss-requested`,nonce:n.nonce})},0)}window.addEventListener(`message`,Be),window.addEventListener(`scroll`,o,{capture:!0,passive:!0}),window.addEventListener(`resize`,s),window.addEventListener(`keydown`,c);let l=new MutationObserver(e=>{e.some(e=>!(e.target instanceof Element&&e.target.closest(`[${B}], [data-replica-controls-bridge]`)))&&a()});l.observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0});let u=typeof ResizeObserver==`function`?new ResizeObserver(a):null;u?.observe(document.documentElement),He[Ve]=()=>{window.removeEventListener(`message`,Be),window.removeEventListener(`scroll`,o,!0),window.removeEventListener(`resize`,s),window.removeEventListener(`keydown`,c),l.disconnect(),u?.disconnect(),r!==null&&window.cancelAnimationFrame(r),W=null,be=``,G.clear(),n(),X(),H?.remove(),H=null,U=null}}export{Ue as installBridge}; \ No newline at end of file diff --git a/.github/extensions/replica-prototype/assets/renderer-improvement-notes-prototype.js b/.github/extensions/replica-prototype/assets/renderer-improvement-notes-prototype.js new file mode 100644 index 0000000..39ade20 --- /dev/null +++ b/.github/extensions/replica-prototype/assets/renderer-improvement-notes-prototype.js @@ -0,0 +1 @@ +import{n as e,r as t}from"./renderer-rolldown-runtime.js";import{E as n,K as r,L as i,M as a,X as o,Y as s,f as c,g as l,q as u,x as d,z as f}from"./renderer-vendor.js";import{a as p,c as m,f as h,m as g,o as ee,p as te,s as _}from"./renderer.js";import{t as v}from"./renderer-improvement-notes-vendor.js";import{t as ne}from"./renderer-prototype-canvas-improvement-threads.js";var y=t(o(),1),re=s(),b=r(),ie=v(),x={title:`Pick & polish`,localAuthor:`Local author`,branch:`prototype/welcome`,demo:`UI prototype`,demoNotice:`Sample preview. Notes reset on reload. No Hub API calls or agent work.`,canvasDemoNotice:`UI-only notes over the live preview. Notes reset on canvas reload. Captures, Hub sync and agent results are simulated.`,canvasBatchSource:`Live preview · UI-only batch`,sampleBatchSource:`Local, uncommitted sample`,bridgeUnavailable:`Annotation needs the updated Replica preview bridge. Reconnect or reload the preview after updating the canvas.`,capturePlaceholder:`UI-only capture placeholder`,annotate:`Pick & polish`,fix:`Fix all`,openNotes:e=>`Open improvement notes (${e})`,fixAll:e=>`Fix all (${e})`,notes:`Pick & polish`,closeNotes:`Close pick & polish`,owner:`Only your notes appear here. Authorized API callers can request other authors' notes.`,selectHint:`Click an element or drag a rectangle. For a keyboard region, focus the preview, press Shift+Enter, then use arrows and Enter to choose two corners. Escape exits annotation mode.`,keyboardHint:`Click an element or drag a rectangle. Focus the preview and press Shift+Enter for keyboard region selection; arrows move the corner and Enter selects it.`,regionHint:`Choose two corners in the preview. Use arrow keys to move the corner, then Enter.`,firstCorner:`First corner selected. Choose the second corner.`,regionSmall:`Choose a larger region, at least 8 preview pixels wide and high.`,add:`Add improvement note`,edit:`Edit improvement note`,label:`What should change?`,placeholder:`Describe the improvement you want Copilot to make...`,save:`Save note`,saveEdit:`Save changes`,cancel:`Cancel`,discard:`Discard draft`,keep:`Keep writing`,discardTitle:`Discard your unsaved note?`,discardBody:`Your saved notes will stay unchanged.`,capture:`Captured target`,empty:`A little feedback goes a long way`,emptyBody:`Select an element or draw around an area. Collect notes across screens, then fix them together.`,emptyFilter:`No notes in this view.`,allActive:`Active notes`,readyFilter:`Ready to review`,resolvedFilter:`Resolved`,filter:`Filter improvement notes`,viewTarget:`View target`,noteActions:e=>`Note actions: ${e}`,editAction:`Edit`,deleteAction:`Delete`,deleteTitle:`Delete this improvement note?`,deleteBody:`This removes the note. It does not change the prototype.`,resolve:`Confirm resolved`,solution:`Solution`,solutionUnavailable:`The solution summary is not available in this canvas.`,readyReadOnly:`Ready notes are read-only. Add a new note to request further changes.`,reopen:`Reopen`,retryFix:`Retry fix`,noteSent:`Sent in the simulated batch. No real agent has started.`,noteReady:`Simulated change is ready. Review the target before resolving.`,noteBlocked:`Simulated agent could not safely identify the change. Edit the note or retry.`,handoff:`Demo handoff to Copilot`,handoffNotice:`This is the captured batch, not a live agent request. New notes stay out of this batch.`,complete:`Simulate ready to review`,block:`Simulate blocked`,closeHandoff:`Continue annotating`,sent:`Demo batch captured. No code was changed.`,finished:`Simulated result received. Review each note before resolving.`,fixBusy:`Finish or close the current simulated batch before sending another.`,syncControls:`Demo connection`,offline:`Offline`,connected:`Connected`,syncFailure:`Sync failure`,syncRetry:`Retry demo sync`,syncFailed:`Demo sync failed. Your note remains in this demo; retry when connected.`,syncSuccess:`Demo sync completed.`,targetMissing:`This sample target is no longer available. The saved capture is still shown.`,previewUnavailable:`The demo preview is unavailable. Try selecting the target again.`,saved:`Note added.`,savedLocally:`Notes are saved locally.`,storageLoading:`Loading your notes...`,productionSent:`Notes sent to Copilot. Review the changes before confirming resolution.`,productionBusy:`Copilot is working on the captured batch.`,branchChanged:`The prototype branch changed. Close this draft and select the target again.`,workChanged:`The open improvements changed while syncing. Review them and select Fix all again.`,returnToActive:`Return to active`,regionTarget:`Selected region`,closeComposer:`Close note composer`,closeDiscard:`Close discard confirmation`,closeDelete:`Close delete confirmation`,closeBatch:`Close demo handoff`,exit:`Exit annotation mode`,sampleScreens:`Sample prototype screens`,sampleWorkspace:`Octocat's workspace`,projects:`Projects`,settings:`Settings`,navigationHint:`Navigate between screens. Your notes stay together.`,authorContext:`Across this prototype · Demo author: octocat`,batchHint:`Fix only this batch. Do not commit, push, or publish. Report per-note results for the author to review.`,perNoteResult:`Simulate a result for this note`,batchLabel:e=>`View demo batch (${e})`,statuses:{open:`Open`,sent:`Sent to Copilot`,ready:`Ready to review`,resolved:`Resolved`,blocked:`Needs attention`},sync:{local:`Demo: local only`,synced:`Demo: synced`,failed:`Demo: sync failed`}};function ae(e,t){let n=[e.thread?.originalStatus??e.status,...e.thread?.messages.filter(e=>e.role===`author`).map(e=>e.status)??[]];return{id:e.id,revision:e.revision,body:e.body,capture:e.capture,author:e.thread?.originalAuthor?`@${e.thread.originalAuthor.login}`:e.author===`local`?x.localAuthor:`@${e.author}`,avatarUrl:(e.thread?.originalAuthor??e.authorProfile)?.avatarUrl,target:e.target,path:e.route,status:e.status,originalPending:(e.thread?.originalStatus??e.status)===`open`,...n.includes(`sent`)?{retryStatus:`sent`}:n.includes(`blocked`)?{retryStatus:`blocked`}:{},messages:e.thread?.messages.map(e=>({...e,...e.role===`author`&&e.author?{author:`@${e.author.login}`,avatarUrl:e.author.avatarUrl}:{author:void 0},pending:e.role===`author`&&e.status===`open`}))??(e.result?[{id:`legacy-result`,role:`copilot`,body:e.result,status:e.status===`blocked`?`blocked`:`ready`}]:[]),...t&&(t.status===`resolved`||t.status===`moved`)?{point:t.point}:{}}}function oe(e,t){let n=e.cloneNode(!0);if(!(n instanceof SVGSVGElement))throw Error(`The demo preview could not be captured.`);return n.setAttribute(`viewBox`,`${t.x} ${t.y} ${t.width} ${t.height}`),n.setAttribute(`width`,String(t.width)),n.setAttribute(`height`,String(t.height)),n.removeAttribute(`class`),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(n))}`}var se=[{id:`projects-heading`,label:`Projects heading`,route:`/projects`,rect:{x:40,y:35,width:640,height:78}},{id:`new-project`,label:`New project button`,route:`/projects`,rect:{x:764,y:42,width:156,height:42}},{id:`activity`,label:`Activity summary`,route:`/projects`,rect:{x:40,y:144,width:880,height:100}},{id:`welcome-card`,label:`Welcome project card`,route:`/projects`,rect:{x:40,y:285,width:420,height:230}},{id:`onboarding-card`,label:`Onboarding project card`,route:`/projects`,rect:{x:500,y:285,width:420,height:230}},{id:`settings-heading`,label:`Settings heading`,route:`/settings`,rect:{x:40,y:35,width:700,height:78}},{id:`workspace-name`,label:`Workspace name field`,route:`/settings`,rect:{x:40,y:152,width:880,height:138}},{id:`notifications`,label:`Notifications settings`,route:`/settings`,rect:{x:40,y:318,width:880,height:130}},{id:`save-settings`,label:`Save settings button`,route:`/settings`,rect:{x:40,y:478,width:166,height:42}}],ce=[{id:1,kind:`improvement_note`,author:`octocat`,body:`Make the primary action more prominent and shorten the label to 'New project'.`,route:`/projects`,target:`New project button`,selector:`[data-improvement-target="new-project"]`,rect:{x:764,y:42,width:156,height:42},capture:``,status:`open`,sync:`local`,revision:1},{id:2,kind:`improvement_note`,author:`octocat`,body:`Give the two cards a little more breathing room and align their metadata.`,route:`/projects`,target:`Selected region`,selector:null,rect:{x:28,y:273,width:904,height:250},capture:``,status:`open`,sync:`local`,revision:1},{id:3,kind:`improvement_note`,author:`octocat`,body:`Explain what notifications this switch controls before asking me to enable it.`,route:`/settings`,target:`Notifications settings`,selector:`[data-improvement-target="notifications"]`,rect:{x:40,y:318,width:880,height:130},capture:``,status:`ready`,sync:`synced`,revision:1}],S=u();function le({route:e}){return(0,S.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 960 560`,className:`improvement-demo__scene`,role:`group`,"aria-label":`Sample prototype ${e}`,fontFamily:`system-ui, sans-serif`,children:[(0,S.jsx)(`rect`,{width:`960`,height:`560`,fill:`#f8fafc`}),se.filter(t=>t.route===e).map(t=>(0,S.jsxs)(`g`,{"data-improvement-target":t.id,children:[(0,S.jsx)(`rect`,{...t.rect,rx:`10`,fill:t.id.includes(`heading`)?`#f8fafc`:t.id===`new-project`||t.id===`save-settings`?`#155d3d`:`#ffffff`,stroke:t.id.includes(`heading`)?`none`:`#dce3e9`}),t.id.includes(`heading`)?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`text`,{x:`40`,y:`67`,fill:`#172b24`,fontSize:`28`,fontWeight:`650`,children:e===`/projects`?`Your projects`:`Workspace settings`}),(0,S.jsx)(`text`,{x:`40`,y:`99`,fill:`#596b65`,fontSize:`15`,children:e===`/projects`?`A home for your team's next great idea.`:`Make this space work for your team.`})]}):t.id===`new-project`||t.id===`save-settings`?(0,S.jsx)(`text`,{x:t.rect.x+t.rect.width/2,y:t.rect.y+26,textAnchor:`middle`,fill:`#ffffff`,fontSize:`14`,fontWeight:`600`,children:t.id===`new-project`?`+ Create project`:`Save settings`}):t.id===`activity`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`text`,{x:`64`,y:`179`,fill:`#596b65`,fontSize:`13`,children:`THIS WEEK`}),(0,S.jsx)(`text`,{x:`64`,y:`214`,fill:`#172b24`,fontSize:`23`,fontWeight:`600`,children:`12 prototypes`}),(0,S.jsx)(`text`,{x:`348`,y:`179`,fill:`#596b65`,fontSize:`13`,children:`IN REVIEW`}),(0,S.jsx)(`text`,{x:`348`,y:`214`,fill:`#172b24`,fontSize:`23`,fontWeight:`600`,children:`4 conversations`}),(0,S.jsx)(`text`,{x:`642`,y:`179`,fill:`#596b65`,fontSize:`13`,children:`YOUR TEAM`}),(0,S.jsx)(`text`,{x:`642`,y:`214`,fill:`#172b24`,fontSize:`23`,fontWeight:`600`,children:`Making things happen`})]}):t.id.includes(`card`)?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`rect`,{x:t.rect.x+16,y:`301`,width:`388`,height:`100`,rx:`6`,fill:t.id===`welcome-card`?`#e3efe9`:`#eee9f7`}),(0,S.jsx)(`rect`,{x:t.rect.x+40,y:`323`,width:`100`,height:`10`,rx:`4`,fill:`#ffffff`}),(0,S.jsx)(`rect`,{x:t.rect.x+40,y:`345`,width:`196`,height:`6`,rx:`3`,fill:`#ffffff`}),(0,S.jsx)(`rect`,{x:t.rect.x+40,y:`363`,width:`156`,height:`6`,rx:`3`,fill:`#ffffff`}),(0,S.jsx)(`text`,{x:t.rect.x+24,y:`437`,fill:`#172b24`,fontSize:`18`,fontWeight:`600`,children:t.id===`welcome-card`?`Welcome experience`:`A better onboarding`}),(0,S.jsx)(`text`,{x:t.rect.x+24,y:`463`,fill:`#596b65`,fontSize:`13`,children:t.id===`welcome-card`?`prototype/welcome`:`prototype/onboarding`}),(0,S.jsx)(`circle`,{cx:t.rect.x+30,cy:`490`,r:`5`,fill:`#2a7954`}),(0,S.jsx)(`text`,{x:t.rect.x+44,y:`495`,fill:`#596b65`,fontSize:`12`,children:`Updated today · The Octocat`})]}):t.id===`workspace-name`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`text`,{x:`64`,y:`184`,fill:`#172b24`,fontSize:`17`,fontWeight:`600`,children:`Workspace name`}),(0,S.jsx)(`text`,{x:`64`,y:`209`,fill:`#596b65`,fontSize:`13`,children:`This is how your workspace appears to your team.`}),(0,S.jsx)(`rect`,{x:`64`,y:`230`,width:`600`,height:`38`,rx:`6`,fill:`#f8fafc`,stroke:`#dce3e9`}),(0,S.jsx)(`text`,{x:`78`,y:`255`,fill:`#172b24`,fontSize:`14`,children:`Octocat's workspace`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`text`,{x:`64`,y:`351`,fill:`#172b24`,fontSize:`17`,fontWeight:`600`,children:`Notifications`}),(0,S.jsx)(`text`,{x:`64`,y:`385`,fill:`#596b65`,fontSize:`14`,children:`Keep me in the loop`}),(0,S.jsx)(`rect`,{x:`824`,y:`366`,width:`48`,height:`26`,rx:`13`,fill:`#155d3d`}),(0,S.jsx)(`circle`,{cx:`857`,cy:`379`,r:`9`,fill:`#ffffff`})]})]},t.id))]})}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ue({frameRef:e,prototypeUrl:t,previewUrl:n,notes:r,annotating:i,composing:a,onSelect:o,onRoute:s,onCancel:c,onProblem:l}){let u=n??t,[d,f]=(0,y.useState)(null),[p,h]=(0,y.useState)(new Map),g=JSON.stringify(r.filter(e=>e.anchor).slice(0,200).map(e=>({id:e.id,anchor:e.anchor}))),te=(0,y.useEffectEvent)(e=>{if(!i||a)return;let t=_.safeParse(e);t.success?o(t.data):(c(),l(x.previewUnavailable))}),v=(0,y.useCallback)((t,n={})=>{u&&d&&e?.current?.contentWindow&&e.current.contentWindow.postMessage({type:t,nonce:d.nonce,...n},new URL(u).origin)},[d,e,u]);return(0,y.useEffect)(()=>{let t=e?.current;if(!t||!u)return;let n=new URL(u).origin,r=crypto.randomUUID(),i=Date.now(),a=JSON.parse(g);function o(){t?.contentWindow?.postMessage({type:`replica:canvas:request-ready`,nonce:r},n),t?.contentWindow?.postMessage({type:`replica:canvas:resolve`,nonce:r,anchors:a},n)}function d(){r=crypto.randomUUID(),i=Date.now(),f({nonce:r,ready:!1}),h(new Map),c(),o()}function p(e){let a=e.data;if(e.source===t?.contentWindow&&e.origin===n&&C(a)&&a.nonce===r){if(a.type===`replica:canvas:ready`){let e=m.safeParse(a.route);if(a.protocolVersion!==1||a.improvementSelection!==!0||!e.success){f({nonce:r,ready:!1}),l(x.bridgeUnavailable);return}i=Date.now(),f(e=>e?.nonce===r&&e.ready?e:{nonce:r,ready:!0}),s(e.data.pathname+e.data.search+e.data.hash)}else if(a.type===`replica:canvas:selected`)te(a.anchor);else if(a.type===`replica:canvas:resolved`&&Array.isArray(a.results)){let e=new Map;for(let t of a.results){if(!C(t))continue;let n=ee.safeParse({commentId:t.id,status:`resolved`,point:{x:t.x,y:t.y},rect:t.rect??{x:t.x,y:t.y,width:1,height:1}});n.success&&e.set(n.data.commentId,n.data)}h(e)}else a.type===`replica:canvas:selection-failed`||a.type===`replica:canvas:bridge-error`?(c(),l(a.reason===`area-too-small`?x.regionSmall:x.bridgeUnavailable)):a.type===`replica:canvas:selection-cancelled`&&a.reason!==`command`&&c()}}t.addEventListener(`load`,d),window.addEventListener(`message`,p),f({nonce:r,ready:!1}),o();let _=window.setInterval(()=>{Date.now()-i>2e4&&(f({nonce:r,ready:!1}),h(new Map),c(),l(x.bridgeUnavailable)),o()},2e3);return()=>{t.removeEventListener(`load`,d),window.removeEventListener(`message`,p),window.clearInterval(_),t.contentWindow?.postMessage({type:`replica:canvas:cancel-selection`,nonce:r},n),t.contentWindow?.postMessage({type:`replica:canvas:clear-selection`,nonce:r},n)}},[g,e,u,c,l,s]),(0,y.useEffect)(()=>{d?.ready&&(i&&!a?v(`replica:canvas:select`,{mode:`improvement`}):v(`replica:canvas:cancel-selection`),a||v(`replica:canvas:clear-selection`))},[i,a,d?.ready,v]),{ready:d?.ready===!0,resolutions:p}}function de(e){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(!1),l=(0,y.useRef)(null),u=(0,y.useRef)(!1),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),m=(0,y.useRef)(0);function h(e){f.current&&(l.current=e,n(e))}(0,y.useEffect)(()=>{if(!e)return;f.current=!0;let t=!1,r=!1,a=0;async function s(){if(u.current||r)return;r=!0;let s=m.current;try{let n=await p(`/api/improvement-notes`,e);if(u.current||s!==m.current||t)return;if(h(n),Date.now()-a>15e3){a=Date.now();let r=p(`/api/improvement-notes/sync`,e,{method:`POST`,body:JSON.stringify({identity:n.identity,revision:n.revision})}).then(e=>{t||h(e)});d.current=r;try{await r}finally{d.current===r&&(d.current=null)}}t||o(``)}catch(e){t||(e instanceof Error&&`statusCode`in e&&e.statusCode===403&&(l.current=null,n(null),i(``)),o(e instanceof Error?e.message:String(e)))}finally{r=!1}}s();let c=window.setInterval(()=>void s(),3e3);return()=>{f.current=!1,t=!0,window.clearInterval(c)}},[e]);async function g(t,n={}){if(!e||!l.current||u.current)return!1;let r=l.current.identity,a=l.current.notes.filter(e=>e.status===`open`).map(e=>`${e.id}:${e.revision}`).sort().join(`,`);u.current=!0,m.current++,c(!0),i(``);try{if(await d.current,!f.current)return!1;if(!l.current||l.current.identity!==r)throw Error(x.branchChanged);if(t===`fix`&&l.current.notes.filter(e=>e.status===`open`).map(e=>`${e.id}:${e.revision}`).sort().join(`,`)!==a)throw Error(x.workChanged);return h(await p(t===`fix`?`/api/improvement-notes/fix`:`/api/improvement-notes`,e,{method:`POST`,body:JSON.stringify({identity:l.current.identity,revision:l.current.revision,operation:t,...n})})),!0}catch(e){return f.current&&i(e instanceof Error?e.message:String(e)),!1}finally{u.current=!1,f.current&&c(!1)}}return{state:t,error:r||a,busy:s,change:g}}var w=e({ImprovementNotesPrototype:()=>T});function T({initial:e=`empty`,canvas:t}){let[r,o]=(0,y.useState)(()=>ce.slice(0,e===`empty`?0:e===`single`?1:3).map(e=>{let t=new DOMParser().parseFromString((0,ie.renderToStaticMarkup)((0,S.jsx)(le,{route:e.route})),`image/svg+xml`).documentElement;if(!(t instanceof SVGSVGElement))throw Error(`The sample preview could not be captured.`);return{...e,capture:oe(t,e.rect)}})),s=de(t?.token),u=s.state?.syncError===`Notes are saved locally until Hub discovers this branch.`?null:s.state?.syncError,p=t?.token?s.state?.notes??[]:r,[m,ee]=(0,y.useState)(`/projects`),[_,v]=(0,y.useState)(!1),[C,w]=(0,y.useState)(!0),[T,E]=(0,y.useState)(null),[D,O]=(0,y.useState)(null),[k,A]=(0,y.useState)(``),[fe,pe]=(0,y.useState)(!1),[j,me]=(0,y.useState)(null),[M,he]=(0,y.useState)(`active`),[N,ge]=(0,y.useState)(`offline`),[P,_e]=(0,y.useState)([]),[ve,F]=(0,y.useState)(!1),[ye,I]=(0,y.useState)(``),[be,L]=(0,y.useState)(null),[R,z]=(0,y.useState)(!1),[B,xe]=(0,y.useState)({x:160,y:160}),[V,H]=(0,y.useState)(null),[Se,Ce]=(0,y.useState)(null),[U,W]=(0,y.useState)(null),G=(0,y.useRef)(null),we=(0,y.useRef)(null),K=(0,y.useRef)(null),Te=(0,y.useRef)(null),q=(0,y.useRef)(null),Ee=(0,y.useRef)(e===`empty`?1:e===`single`?2:4),J=p.filter(e=>e.status===`open`),Y=!t?.token||s.state!==null,De=T!==null&&!fe&&Y;(0,y.useLayoutEffect)(()=>{De&&Te.current?.focus()},[De]);let Oe=!!t?.token&&T!==null&&T.identity!==s.state?.identity,ke=D!==null&&p.some(e=>e.id===D&&e.status===`ready`),Ae=p.filter(e=>e.status!==`resolved`).length,je=M===`ready`?x.readyFilter:M===`resolved`?x.resolvedFilter:x.allActive,Me=p.filter(e=>M===`resolved`?e.status===`resolved`:M===`ready`?e.status===`ready`:e.status!==`resolved`),Ne=!!s.state?.activeBatch||P.some(e=>p.some(t=>t.id===e.id&&t.revision===e.revision&&t.status===`sent`)),Pe=p.filter(e=>e.route===m&&e.status!==`resolved`),X=p.find(e=>e.id===be&&e.route===m),Fe=(0,y.useCallback)(e=>{let t=e.kind===`element`?e.accessibleName||e.tagName:x.regionTarget;E({identity:s.state?.identity,anchor:e,route:e.route.pathname+e.route.search+e.route.hash,target:t,selector:e.kind===`element`?e.selector:null,rect:e.rect,capture:``,capturePlaceholder:!0}),O(null),A(``)},[s.state?.identity]),Ie=(0,y.useCallback)(()=>{K.current?.getAttribute(`aria-pressed`)===`true`&&K.current.focus(),v(!1)},[]),Le=t?.frameRef,Z=ue({frameRef:Le,prototypeUrl:t?.prototypeUrl,previewUrl:t?.previewUrl,notes:p,annotating:_,composing:T!==null,onSelect:Fe,onRoute:ee,onCancel:Ie,onProblem:I}),Q=!!t;(0,y.useLayoutEffect)(()=>{Le&&Ce(Le.current?.closest(`.canvas-shell`)?.querySelector(`#canvas-improvement-controls`)??null)},[Le]);function Re(){w(!0),t?.onOpenNotes()}function ze(e,t){let n=we.current?.querySelector(`svg`);n?(E({route:m,target:t?.label??x.regionTarget,selector:t?`[data-improvement-target="${t.id}"]`:null,rect:e,capture:oe(n,e)}),A(``),O(null),W(null),H(null),z(!1)):I(x.previewUnavailable)}function Be(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function Ve(e){let t=we.current?.getBoundingClientRect();return!t?.width||!t.height?(I(x.previewUnavailable),null):{x:Math.max(0,Math.min(960,(e.clientX-t.left)/t.width*960)),y:Math.max(0,Math.min(560,(e.clientY-t.top)/t.height*560))}}function He(e,t){let n=Be(e,t);W(null),H(null),n.width<8||n.height<8?I(x.regionSmall):ze(n)}function Ue(){let e=T?.originalBody??``;k===e?(E(null),O(null)):pe(!0)}async function We(){if(ke){I(x.readyReadOnly);return}if(!T||!k.trim()||s.busy||Oe)return;if(t?.token){if(!await s.change(D===null?`create`:`edit`,{id:D,identity:T.identity,expectedNoteRevision:T.noteRevision,body:k.trim(),anchor:T.anchor,capture:T.capturePlaceholder?``:T.capture}))return;he(`active`),Re(),E(null),O(null),I(x.saved);return}let e=N===`connected`?`synced`:N===`failed`?`failed`:`local`;if(D!==null)o(t=>t.map(t=>t.id===D?{...t,body:k.trim(),revision:t.revision+1,status:`open`,sync:e}:t));else{let t={...T,id:Ee.current++,body:k.trim(),kind:`improvement_note`,author:`octocat`,status:`open`,sync:e,revision:1};o(e=>[...e,t]),L(t.id)}he(`active`),Re(),E(null),O(null),I(N===`failed`?x.syncFailed:x.saved)}async function Ge(){J.length&&!Ne&&(t?.token?await s.change(`fix`)&&I(x.productionSent):(_e(J.map(e=>({...e}))),o(e=>e.map(e=>e.status===`open`?{...e,status:`sent`}:e)),F(!0),I(x.sent)))}function Ke(e){o(t=>t.map(t=>P.some(e=>e.id===t.id&&e.revision===t.revision)&&t.status===`sent`?{...t,status:e}:t)),F(!1),w(!0),I(x.finished)}async function $(e,n){t?.token?await s.change(`status`,{id:e.id,status:n,identity:s.state?.identity,expectedNoteRevision:e.revision})&&q.current?.focus():(o(t=>t.map(t=>t.id===e.id?{...t,status:n,sync:N===`connected`?`synced`:N===`failed`?`failed`:`local`}:t)),q.current?.focus())}let qe=(0,S.jsx)(`div`,{className:`improvement-demo__actions`,children:(0,S.jsxs)(`div`,{role:`group`,"aria-label":x.title,className:`improvement-demo__split`,children:[(0,S.jsx)(b.Button,{ref:K,size:`small`,variant:`secondary`,className:`canvas-toolbar-compact-button`,"aria-label":x.annotate,title:x.annotate,leadingVisual:(0,S.jsx)(a,{}),"aria-pressed":_,disabled:Q&&(!Z.ready||!!t?.token&&!s.state),onClick:()=>{v(!_),_||(w(!1),I(x.selectHint)),z(!1),H(null),W(null)},children:(0,S.jsx)(`span`,{className:`canvas-toolbar-button-label`,children:x.annotate})}),(0,S.jsx)(b.Button,{ref:q,size:`small`,variant:`secondary`,"aria-label":x.openNotes(Ae),"aria-expanded":C&&!t?.hubOpen,onClick:Re,children:(0,S.jsx)(te,{children:Ae})})]})});return(0,S.jsxs)(`section`,{"aria-label":x.title,className:`improvement-demo${Q?` improvement-demo--embedded`:``}`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||T||j!==null||ve||(v(!1),z(!1),H(null),W(null),G.current=null,_&&K.current?.focus())},children:[Q?null:(0,S.jsxs)(`header`,{className:`improvement-demo__browser`,children:[(0,S.jsx)(`span`,{className:`improvement-demo__browser-dot`}),(0,S.jsxs)(`code`,{children:[`localhost:5173`,m]}),(0,S.jsx)(`span`,{className:`improvement-demo__badge`,children:x.demo})]}),Q?Se&&(0,re.createPortal)(qe,Se):(0,S.jsxs)(`header`,{className:`improvement-demo__toolbar`,children:[(0,S.jsxs)(`div`,{className:`improvement-demo__identity`,children:[(0,S.jsx)(`strong`,{children:x.branch}),(0,S.jsx)(`span`,{children:x.title})]}),qe]}),Q?null:(0,S.jsx)(`div`,{className:`improvement-demo__disclaimer`,children:x.demoNotice}),(0,S.jsxs)(`div`,{className:`improvement-demo__workspace`,children:[Q?null:(0,S.jsxs)(`section`,{className:`improvement-demo__preview`,"aria-label":`Prototype preview`,children:[(0,S.jsxs)(`nav`,{className:`improvement-demo__pages`,"aria-label":x.sampleScreens,children:[(0,S.jsx)(`span`,{className:`improvement-demo__app-name`,children:x.sampleWorkspace}),[`/projects`,`/settings`].map(e=>(0,S.jsx)(`button`,{type:`button`,"aria-current":m===e?`page`:void 0,onClick:()=>{ee(e),L(null),H(null),W(null)},children:e===`/projects`?x.projects:x.settings},e))]}),(0,S.jsxs)(`div`,{ref:we,className:`improvement-demo__stage${_?` improvement-demo__stage--selecting`:``}`,role:R?`button`:`group`,tabIndex:_?0:-1,"aria-describedby":`improvement-selection-hint`,"aria-label":R?`Choose region corners`:`Selectable preview`,onKeyDown:e=>{if(e.key===`Escape`)e.preventDefault(),v(!1),z(!1),H(null),W(null),G.current=null,K.current?.focus();else if(_&&e.shiftKey&&e.key===`Enter`)e.preventDefault(),z(!R),H(null),W(null),I(R?x.selectHint:x.regionHint);else if(R&&[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Enter`,` `].includes(e.key)){if(e.preventDefault(),e.key===`Enter`||e.key===` `)V?He(V,B):(H(B),I(x.firstCorner));else{let t={x:Math.max(0,Math.min(960,B.x+(e.key===`ArrowRight`?10:e.key===`ArrowLeft`?-10:0))),y:Math.max(0,Math.min(560,B.y+(e.key===`ArrowDown`?10:e.key===`ArrowUp`?-10:0)))};xe(t),V&&W(Be(V,t))}}},onPointerDown:e=>{if(!_||e.button!==0||e.target instanceof Element&&e.target.closest(`[data-note-pin]`))return;e.preventDefault();let t=Ve(e);if(!t)return;if(R){xe(t),G.current={start:t,target:void 0,pointerId:e.pointerId},e.currentTarget.setPointerCapture(e.pointerId);return}let n=e.target instanceof Element?e.target.closest(`[data-improvement-target]`):null;G.current={start:t,target:se.find(e=>e.id===n?.getAttribute(`data-improvement-target`)),pointerId:e.pointerId},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{if(!G.current||G.current.pointerId!==e.pointerId)return;let t=Ve(e);if(!t)return;if(R){xe(t),V&&W(Be(V,t));return}let n=Be(G.current.start,t);Math.hypot(n.width,n.height)>=8&&W(n)},onPointerUp:e=>{let t=G.current;if(!t||t.pointerId!==e.pointerId)return;G.current=null,e.currentTarget.releasePointerCapture(e.pointerId);let n=Ve(e);if(!n)return;if(R){xe(n),V?He(V,n):(H(n),I(x.firstCorner));return}let r=Be(t.start,n);Math.hypot(r.width,r.height)>=8?He(t.start,n):t.target&&ze(t.target.rect,t.target),W(null)},onPointerCancel:()=>{G.current=null,W(null)},onLostPointerCapture:()=>{G.current=null,W(null)},children:[(0,S.jsx)(le,{route:m}),_&&!R?se.filter(e=>e.route===m).map(e=>(0,S.jsx)(`button`,{type:`button`,"data-improvement-target":e.id,className:`improvement-demo__element-target`,"aria-label":e.label,style:{left:`${e.rect.x/960*100}%`,top:`${e.rect.y/560*100}%`,width:`${e.rect.width/960*100}%`,height:`${e.rect.height/560*100}%`},onClick:()=>{T||ze(e.rect,e)}},e.id)):null,U?(0,S.jsx)(`div`,{className:`improvement-demo__outline`,style:{left:`${U.x/960*100}%`,top:`${U.y/560*100}%`,width:`${U.width/960*100}%`,height:`${U.height/560*100}%`}}):null,R?(0,S.jsx)(`span`,{className:`improvement-demo__corner`,style:{left:`${B.x/960*100}%`,top:`${B.y/560*100}%`}}):null,Pe.map(e=>(0,S.jsx)(`button`,{"data-note-pin":!0,type:`button`,className:`improvement-demo__pin${be===e.id?` improvement-demo__pin--selected`:``}`,style:{left:`${Math.min(e.rect.x+e.rect.width,930)/960*100}%`,top:`${e.rect.y/560*100}%`},"aria-label":`Open improvement note ${e.id}: ${e.target}`,onClick:()=>{L(e.id),w(!0),he(`active`)},children:e.id},e.id)),X?(0,S.jsx)(`div`,{className:`improvement-demo__outline improvement-demo__outline--saved`,style:{left:`${X.rect.x/960*100}%`,top:`${X.rect.y/560*100}%`,width:`${X.rect.width/960*100}%`,height:`${X.rect.height/560*100}%`}}):null]}),(0,S.jsxs)(`footer`,{className:`improvement-demo__preview-footer`,children:[(0,S.jsx)(`span`,{id:`improvement-selection-hint`,children:_?x.keyboardHint:x.navigationHint}),(0,S.jsx)(`span`,{children:`960 × 560`})]})]}),Q&&!t?.token?(0,S.jsx)(`div`,{className:`canvas-improvement-markers`,children:Pe.map(e=>{let t=Z.resolutions.get(e.id);return!t||t.status!==`resolved`&&t.status!==`moved`?null:(0,S.jsx)(`button`,{type:`button`,className:`improvement-demo__pin`,style:{left:t.point.x,top:t.point.y},"aria-label":`Open improvement note ${e.id}: ${e.target}`,onClick:()=>{L(e.id),he(e.status===`ready`?`ready`:`active`),Re()},children:e.id},e.id)})}):null,t?.token?(0,S.jsx)(ne,{identity:s.state?.identity??``,controls:!1,returnFocusRef:q,open:C&&!t.hubOpen&&!T,active:(C||_)&&!t.hubOpen&&!T,onOpen:Re,onClose:()=>{w(!1),q.current?.focus()},threads:p.map(e=>ae(e,Z.resolutions.get(e.id))),busy:s.busy||!s.state,activeBatch:!!s.state?.activeBatch,error:s.error||u||s.state?.profileError||(s.state?Z.ready?``:x.bridgeUnavailable:x.storageLoading),onSelect:e=>{let n=p.find(t=>t.id===e);n&&n.route!==m&&t.onNavigate(new URL(n.route,t.prototypeUrl).href)},onFollowUp:(e,t)=>s.change(`follow-up`,{id:e.id,expectedNoteRevision:e.revision,body:t}),onResolve:e=>s.change(`status`,{id:e.id,expectedNoteRevision:e.revision,status:`resolved`}),onDelete:e=>s.change(`delete`,{id:e.id,expectedNoteRevision:e.revision}),onFix:()=>s.change(`fix`),onRetry:e=>s.change(`status`,{id:e.id,expectedNoteRevision:e.revision,status:`open`})}):(0,S.jsxs)(h,{className:`improvement-notes-sidebar`,contentClassName:`improvement-demo__panel`,title:x.notes,open:C&&!t?.hubOpen,closeLabel:x.closeNotes,onClose:()=>{w(!1),q.current?.focus()},children:[s.error&&(!T||!Y)?(0,S.jsx)(`p`,{role:`alert`,children:s.error}):null,u?(0,S.jsx)(`p`,{role:`status`,children:u}):null,t?.token&&!s.state?(0,S.jsx)(`p`,{role:`status`,children:x.storageLoading}):null,Q&&!Z.ready?(0,S.jsx)(`p`,{role:`status`,children:x.bridgeUnavailable}):null,(0,S.jsxs)(`div`,{className:`improvement-demo__filters`,children:[(0,S.jsxs)(b.ActionMenu,{size:`small`,selectionVariant:`single`,menuAlignment:`start`,onSelect:he,children:[(0,S.jsx)(b.ActionMenu.Button,{size:`small`,variant:`secondary`,"aria-label":`${x.filter}: ${je}`,children:je}),(0,S.jsx)(b.ActionMenu.Overlay,{"aria-label":x.filter,children:[{value:`active`,label:x.allActive},{value:`ready`,label:x.readyFilter},{value:`resolved`,label:x.resolvedFilter}].map(e=>(0,S.jsx)(b.ActionMenu.Item,{value:e.value,selected:M===e.value,role:`menuitemradio`,onKeyDownCapture:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.click())},children:e.label},e.value))})]}),M===`active`?(0,S.jsx)(b.Button,{size:`small`,variant:`primary`,className:`improvement-demo__fix-all`,leadingVisual:(0,S.jsx)(l,{}),"aria-label":x.fixAll(J.length),disabled:!J.length||Ne||s.busy,title:Ne?Q?x.productionBusy:x.fixBusy:void 0,onClick:()=>void Ge(),children:(0,S.jsxs)(`span`,{className:`improvement-demo__fix-label`,children:[x.fix,(0,S.jsx)(te,{children:J.length})]})}):null]}),(0,S.jsxs)(`div`,{className:`improvement-demo__note-list`,children:[Me.length?null:(0,S.jsxs)(`div`,{className:`improvement-demo__empty`,children:[(0,S.jsx)(d,{size:28}),(0,S.jsx)(`h2`,{children:p.length?x.emptyFilter:x.empty}),p.length?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{children:x.emptyBody}),(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,leadingVisual:(0,S.jsx)(a,{}),disabled:Q&&(!Z.ready||!Y),onClick:()=>{v(!0),w(!1),K.current?.focus()},children:x.annotate})]})]}),Me.map(e=>(0,S.jsxs)(`article`,{"aria-label":`Improvement note ${e.id}`,className:`improvement-demo__note${be===e.id?` improvement-demo__note--focused`:``}`,children:[(0,S.jsxs)(`div`,{className:`improvement-demo__note-header`,children:[e.status===`ready`?(0,S.jsx)(`span`,{className:`improvement-demo__status improvement-demo__status--ready`,children:x.statuses.ready}):null,(0,S.jsx)(`p`,{className:`improvement-demo__body`,children:e.body}),(0,S.jsx)(`div`,{className:`improvement-demo__note-menu`,children:(0,S.jsxs)(b.ActionMenu,{selectionVariant:`none`,size:`small`,menuAlignment:`end`,children:[(0,S.jsx)(b.ActionMenu.Button,{className:`improvement-demo__menu-trigger`,variant:`subtle`,"aria-label":x.noteActions(e.target),leadingVisual:(0,S.jsx)(n,{size:16}),children:``}),(0,S.jsxs)(b.ActionMenu.Overlay,{"aria-label":x.noteActions(e.target),children:[(0,S.jsx)(b.ActionMenu.Item,{value:`edit`,className:`improvement-demo__menu-item`,leadingVisual:(0,S.jsx)(d,{size:16}),disabled:e.status===`ready`,title:e.status===`ready`?x.readyReadOnly:void 0,onClick:()=>{e.status===`ready`?I(x.readyReadOnly):(E({...e,identity:s.state?.identity,noteRevision:e.revision,originalBody:e.body}),O(e.id),A(e.body))},onKeyDownCapture:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.click())},children:x.editAction}),(0,S.jsx)(b.ActionMenu.Item,{value:`delete`,className:`improvement-demo__menu-item improvement-demo__delete-item`,leadingVisual:(0,S.jsx)(c,{size:16}),onClick:()=>me({id:e.id,revision:e.revision,body:e.body,identity:s.state?.identity}),onKeyDownCapture:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.click())},children:x.deleteAction})]})]})})]}),(0,S.jsxs)(`div`,{className:`improvement-demo__note-meta`,children:[(0,S.jsx)(`span`,{children:e.target}),(0,S.jsx)(`span`,{className:`improvement-demo__note-separator`,"aria-hidden":`true`}),(0,S.jsx)(`button`,{className:`improvement-demo__note-route`,type:`button`,"aria-label":`${x.viewTarget}: ${e.target} (${e.route})`,onClick:()=>{if(t&&e.anchor){let n=new URL(t.prototypeUrl);n.pathname=e.anchor.route.pathname,n.search=e.anchor.route.search,n.hash=e.anchor.route.hash,t.onNavigate(n.href)}else ee(e.route);L(e.id)},children:(0,S.jsx)(`code`,{children:e.route})})]}),e.status!==`open`&&e.status!==`ready`?(0,S.jsx)(`span`,{className:`improvement-demo__status improvement-demo__status--${e.status}`,children:x.statuses[e.status]}):null,e.status===`ready`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`details`,{className:`improvement-demo__solution`,children:[(0,S.jsxs)(`summary`,{children:[(0,S.jsx)(i,{size:14,"aria-hidden":`true`}),x.solution]}),(0,S.jsx)(`p`,{children:e.result||(Q?x.solutionUnavailable:x.noteReady)})]}),(0,S.jsx)(`p`,{className:`improvement-demo__read-only`,children:x.readyReadOnly})]}):e.result?(0,S.jsx)(`p`,{className:`improvement-demo__result`,children:e.result}):null,e.capture&&!e.capturePlaceholder?(0,S.jsx)(`img`,{className:`improvement-demo__thumbnail`,src:e.capture,alt:`${e.capturePlaceholder?x.capturePlaceholder:x.capture}: ${e.target}`}):null,!Q&&(e.status===`sent`||e.status===`blocked`)?(0,S.jsx)(`p`,{className:`improvement-demo__result`,children:e.status===`sent`?x.noteSent:x.noteBlocked}):null,(0,S.jsxs)(`div`,{className:`improvement-demo__note-actions`,children:[Q&&e.status===`sent`?(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>void $(e,`open`),children:x.returnToActive}):null,e.status===`ready`?(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,leadingVisual:(0,S.jsx)(f,{}),onClick:()=>$(e,`resolved`),children:x.resolve}):null,e.status===`resolved`?(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>$(e,`open`),children:x.reopen}):null,e.status===`blocked`?(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>$(e,`open`),children:x.retryFix}):null]}),!Q&&e.status===`sent`?(0,S.jsxs)(`details`,{className:`improvement-demo__simulation`,children:[(0,S.jsx)(`summary`,{children:x.perNoteResult}),(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>$(e,`ready`),children:x.complete}),(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>$(e,`blocked`),children:x.block})]}):null,Q?null:(0,S.jsx)(`small`,{className:e.sync===`failed`?`improvement-demo__sync-error`:``,children:x.sync[e.sync]})]},e.id))]}),!Q&&Ne?(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>F(!0),children:x.batchLabel(P.length)}):null,Q?null:(0,S.jsxs)(`footer`,{className:`improvement-demo__connection`,children:[(0,S.jsxs)(`label`,{children:[x.syncControls,(0,S.jsxs)(`select`,{value:N,onChange:e=>{let t=e.target.value;(t===`offline`||t===`connected`||t===`failed`)&&(ge(t),t!==`offline`&&o(e=>e.map(e=>({...e,sync:t===`connected`?`synced`:`failed`}))))},children:[(0,S.jsx)(`option`,{value:`offline`,children:x.offline}),(0,S.jsx)(`option`,{value:`connected`,children:x.connected}),(0,S.jsx)(`option`,{value:`failed`,children:x.syncFailure})]})]}),p.some(e=>e.sync===`failed`)?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{children:x.syncFailed}),(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>{ge(`connected`),o(e=>e.map(e=>({...e,sync:`synced`}))),I(x.syncSuccess)},children:x.syncRetry})]}):null]})]})]}),(0,S.jsx)(`p`,{className:`improvement-demo__announcement${Q?` visually-hidden`:``}`,role:`status`,children:ye}),De?(0,S.jsxs)(g,{title:D===null?x.add:x.edit,closeLabel:x.closeComposer,returnFocusRef:K,onClose:Ue,className:`improvement-demo__composer`,children:[s.error?(0,S.jsx)(`p`,{role:`alert`,children:s.error}):null,Oe?(0,S.jsx)(`p`,{role:`alert`,children:x.branchChanged}):null,ke?(0,S.jsx)(`p`,{role:`alert`,children:x.readyReadOnly}):null,(0,S.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),We()},children:[(0,S.jsxs)(b.FormControl,{fullWidth:!0,children:[(0,S.jsx)(b.FormControl.Label,{children:x.label}),(0,S.jsx)(b.Textarea,{ref:Te,value:k,maxLength:1e4,rows:4,placeholder:x.placeholder,readOnly:ke,onChange:e=>A(e.target.value),required:!0})]}),(0,S.jsx)(`div`,{className:`improvement-demo__dialog-actions`,children:(0,S.jsx)(b.Button,{type:`submit`,size:`small`,variant:`primary`,disabled:!k.trim()||s.busy||Oe||ke,children:D===null?x.save:x.saveEdit})})]})]}):null,fe&&Y?(0,S.jsxs)(g,{title:x.discardTitle,closeLabel:x.closeDiscard,returnFocusRef:K,onClose:()=>pe(!1),children:[(0,S.jsx)(`p`,{children:x.discardBody}),(0,S.jsxs)(`div`,{className:`improvement-demo__dialog-actions`,children:[(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>pe(!1),children:x.keep}),(0,S.jsx)(b.Button,{size:`small`,variant:`primary`,onClick:()=>{pe(!1),E(null),O(null),A(``)},children:x.discard})]})]}):null,j!==null&&Y?(0,S.jsxs)(g,{title:x.deleteTitle,closeLabel:x.closeDelete,returnFocusRef:q,onClose:()=>me(null),children:[(0,S.jsx)(`p`,{children:x.deleteBody}),(0,S.jsx)(`blockquote`,{className:`improvement-demo__delete-preview`,children:j.body}),(0,S.jsxs)(`div`,{className:`improvement-demo__dialog-actions`,children:[(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>me(null),children:x.cancel}),(0,S.jsx)(b.Button,{size:`small`,variant:`primary`,className:`improvement-demo__delete-confirm`,onClick:async()=>{(!t?.token||await s.change(`delete`,{id:j.id,identity:j.identity,expectedNoteRevision:j.revision}))&&(o(e=>e.filter(e=>e.id!==j.id)),me(null),L(null))},children:x.deleteAction})]})]}):null,ve?(0,S.jsxs)(g,{title:x.handoff,closeLabel:x.closeBatch,returnFocusRef:q,onClose:()=>F(!1),className:`improvement-demo__handoff`,children:[(0,S.jsx)(`p`,{children:x.handoffNotice}),(0,S.jsxs)(`div`,{className:`improvement-demo__batch-context`,children:[(0,S.jsx)(`code`,{children:t?.branch??x.branch}),(0,S.jsxs)(`span`,{children:[Q?x.canvasBatchSource:x.sampleBatchSource,` · `,P.length,` notes`]})]}),(0,S.jsx)(`ol`,{children:P.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsxs)(`strong`,{children:[`#`,e.id,` · `,e.target]}),(0,S.jsxs)(`code`,{children:[e.route,` · revision `,e.revision]}),(0,S.jsx)(`p`,{children:e.body}),(0,S.jsx)(`img`,{className:`improvement-demo__thumbnail`,src:e.capture,alt:`${e.capturePlaceholder?x.capturePlaceholder:x.capture}: ${e.target}`}),(0,S.jsx)(`code`,{children:e.selector??`Region: ${e.rect.x}, ${e.rect.y}, ${e.rect.width} × ${e.rect.height}`})]},`${e.id}-${e.revision}`))}),(0,S.jsx)(`p`,{className:`improvement-demo__form-hint`,children:x.batchHint}),(0,S.jsxs)(`div`,{className:`improvement-demo__dialog-actions`,children:[(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>F(!1),children:x.closeHandoff}),(0,S.jsx)(b.Button,{size:`small`,variant:`secondary`,onClick:()=>Ke(`blocked`),children:x.block}),(0,S.jsx)(b.Button,{size:`small`,variant:`primary`,onClick:()=>Ke(`ready`),children:x.complete})]})]}):null]})}export{w as t}; \ No newline at end of file diff --git a/.github/extensions/replica-prototype/assets/renderer-improvement-notes-vendor.js b/.github/extensions/replica-prototype/assets/renderer-improvement-notes-vendor.js new file mode 100644 index 0000000..1219d30 --- /dev/null +++ b/.github/extensions/replica-prototype/assets/renderer-improvement-notes-vendor.js @@ -0,0 +1,64 @@ +import{t as e}from"./renderer-rolldown-runtime.js";import{X as t,Y as n}from"./renderer-vendor.js";var r=e((e=>{var r=t(),i=n();function a(e){var t=`https://react.dev/errors/`+e;if(1>>16)&65535)<<16)|0,a=a<<15|a>>>17,a=461845907*(a&65535)+((461845907*(a>>>16)&65535)<<16)|0,i^=a,i=i<<13|i>>>19,i=5*(i&65535)+((5*(i>>>16)&65535)<<16)|0,i=(i&65535)+27492+(((i>>>16)+58964&65535)<<16)}switch(a=0,n){case 3:a^=(e.charCodeAt(t+2)&255)<<16;case 2:a^=(e.charCodeAt(t+1)&255)<<8;case 1:a^=e.charCodeAt(t)&255,a=3432918353*(a&65535)+((3432918353*(a>>>16)&65535)<<16)|0,a=a<<15|a>>>17,i^=461845907*(a&65535)+((461845907*(a>>>16)&65535)<<16)|0}return i^=e.length,i^=i>>>16,i=2246822507*(i&65535)+((2246822507*(i>>>16)&65535)<<16)|0,i^=i>>>13,i=3266489909*(i&65535)+((3266489909*(i>>>16)&65535)<<16)|0,(i^i>>>16)>>>0}var D=Object.assign,O=Object.prototype.hasOwnProperty,k=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),A={},j={};function ne(e){return O.call(j,e)?!0:O.call(A,e)?!1:k.test(e)?j[e]=!0:(A[e]=!0,!1)}var re=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `)),M=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),N=/["'&<>]/;function P(e){if(typeof e==`boolean`||typeof e==`number`||typeof e==`bigint`)return``+e;e=``+e;var t=N.exec(e);if(t){var n=``,r,i=0;for(r=t.index;re.insertionMode)return z(3,null,r,null);break;case`html`:if(e.insertionMode===0)return z(1,null,r,null)}return 6<=e.insertionMode||2>e.insertionMode?z(2,null,r,null):e.viewTransition!==null||e.tagScope!==r?z(e.insertionMode,e.selectedValue,r,null):e}function B(e){return e===null?null:{update:e.update,enter:`none`,exit:`none`,share:e.update,parentEnter:`none`,parentExit:`none`,name:e.autoName,autoName:e.autoName,nameIdx:0}}function me(e,t){return t.tagScope&32&&(e.instructions|=128),z(t.insertionMode,t.selectedValue,t.tagScope|12,B(t.viewTransition))}function he(e,t){e=B(t.viewTransition);var n=t.tagScope|16;return e!==null&&e.share!==`none`&&(n|=64),z(t.insertionMode,t.selectedValue,n,e)}function ge(e,t,n){return e=`_`+e.idPrefix+`R_`+t,0`)}function Ce(e){if(typeof e!=`string`)throw Error(a(480))}function we(e,t){if(typeof t.$$FORM_ACTION==`function`){var n=e.nextFormID++;e=e.idPrefix+n;try{var r=t.$$FORM_ACTION(e);return r&&r.data?.forEach(Ce),r}catch(e){if(typeof e==`object`&&e&&typeof e.then==`function`)throw e}}return null}function Te(e,t,n,r,i,a,o,s){var c=null;if(typeof r==`function`){var l=we(t,r);l===null?(e.push(` `,`formAction`,`="`,xe,`"`),o=a=i=r=s=null,De(t,n)):(s=l.name,r=l.action||``,i=l.encType,a=l.method,o=l.target,c=l.data)}return s!=null&&H(e,`name`,s),r!=null&&H(e,`formAction`,r),i!=null&&H(e,`formEncType`,i),a!=null&&H(e,`formMethod`,a),o!=null&&H(e,`formTarget`,o),c}function H(e,t,n){switch(t){case`className`:V(e,`class`,n);break;case`tabIndex`:V(e,`tabindex`,n);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:V(e,t,n);break;case`style`:ye(e,n);break;case`src`:case`href`:if(n===``)break;case`action`:case`formAction`:if(n==null||typeof n==`function`||typeof n==`symbol`||typeof n==`boolean`)break;n=I(``+n),e.push(` `,t,`="`,P(n),`"`);break;case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`ref`:break;case`autoFocus`:case`multiple`:case`muted`:be(e,t.toLowerCase(),n);break;case`xlinkHref`:if(typeof n==`function`||typeof n==`symbol`||typeof n==`boolean`)break;n=I(``+n),e.push(` `,`xlink:href`,`="`,P(n),`"`);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`="`,P(n),`"`);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`=""`);break;case`capture`:case`download`:!0===n?e.push(` `,t,`=""`):!1!==n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`="`,P(n),`"`);break;case`cols`:case`rows`:case`size`:case`span`:typeof n!=`function`&&typeof n!=`symbol`&&!isNaN(n)&&1<=n&&e.push(` `,t,`="`,P(n),`"`);break;case`rowSpan`:case`start`:typeof n==`function`||typeof n==`symbol`||isNaN(n)||e.push(` `,t,`="`,P(n),`"`);break;case`xlinkActuate`:V(e,`xlink:actuate`,n);break;case`xlinkArcrole`:V(e,`xlink:arcrole`,n);break;case`xlinkRole`:V(e,`xlink:role`,n);break;case`xlinkShow`:V(e,`xlink:show`,n);break;case`xlinkTitle`:V(e,`xlink:title`,n);break;case`xlinkType`:V(e,`xlink:type`,n);break;case`xmlBase`:V(e,`xml:base`,n);break;case`xmlLang`:V(e,`xml:lang`,n);break;case`xmlSpace`:V(e,`xml:space`,n);break;default:if((!(2`,`addEventListener("submit",function(a){if(!a.defaultPrevented){var b=a.target,d=a.submitter,c=b.action,e=d;if(d){var f=d.getAttribute("formAction");null!=f&&(c=f,e=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===c&&(a.preventDefault(),a=new FormData(b,e),c=b.ownerDocument||b,(c.$$reactFormReplay=c.$$reactFormReplay||[]).push(b,d,a))}});`,`<\/script>`)):r.unshift(t.startInlineScript,`>`,`addEventListener("submit",function(a){if(!a.defaultPrevented){var b=a.target,d=a.submitter,c=b.action,e=d;if(d){var f=d.getAttribute("formAction");null!=f&&(c=f,e=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===c&&(a.preventDefault(),a=new FormData(b,e),c=b.ownerDocument||b,(c.$$reactFormReplay=c.$$reactFormReplay||[]).push(b,d,a))}});`,`<\/script>`)}}function Oe(e,t){for(var n in e.push(Re(`link`)),t)if(O.call(t,n)){var r=t[n];if(r!=null)switch(n){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(399,`link`));default:H(e,n,r)}}return e.push(`/>`),null}var ke=/(<\/|<)(s)(tyle)/gi;function Ae(e,t,n,r){return``+t+(n===`s`?`\\73 `:`\\53 `)+r}function je(e,t,n,r){for(var i in e.push(Re(n)),t)if(O.call(t,i)){var o=t[i];if(o!=null)switch(i){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(399,n));default:H(e,i,o)}}return _e(e,r),e.push(`/>`),null}function Me(e,t){e.push(Re(`title`));var n=null,r=null,i;for(i in t)if(O.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:H(e,i,a)}}return e.push(`>`),t=Array.isArray(n)?2>n.length?n[0]:null:n,typeof t!=`function`&&typeof t!=`symbol`&&t!=null&&e.push(P(``+t)),U(e,r,n),e.push(Ve(`title`)),null}function Ne(e,t){e.push(Re(`script`));var n=null,r=null,i;for(i in t)if(O.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:H(e,i,a)}}return e.push(`>`),U(e,r,n),typeof n==`string`&&e.push((``+n).replace(ue,de)),e.push(Ve(`script`)),null}function Pe(e,t,n,r){e.push(Re(n));var i=n=null,a;for(a in t)if(O.call(t,a)){var o=t[a];if(o!=null)switch(a){case`children`:n=o;break;case`dangerouslySetInnerHTML`:i=o;break;default:H(e,a,o)}}return _e(e,r),e.push(`>`),U(e,i,n),n}function Fe(e,t,n,r){e.push(Re(n));var i=n=null,a;for(a in t)if(O.call(t,a)){var o=t[a];if(o!=null)switch(a){case`children`:n=o;break;case`dangerouslySetInnerHTML`:i=o;break;default:H(e,a,o)}}return _e(e,r),e.push(`>`),U(e,i,n),typeof n==`string`?(e.push(P(n)),null):n}var Ie=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Le=new Map;function Re(e){var t=Le.get(e);if(t===void 0){if(!Ie.test(e))throw Error(a(65,e));t=`<`+e,Le.set(e,t)}return t}function ze(e,t,n,r,i,o,s,c,l){switch(t){case`div`:case`span`:case`svg`:case`path`:break;case`a`:e.push(Re(`a`));var u=null,d=null,f;for(f in n)if(O.call(n,f)){var p=n[f];if(p!=null)switch(f){case`children`:u=p;break;case`dangerouslySetInnerHTML`:d=p;break;case`href`:p===``?V(e,`href`,``):H(e,f,p);break;default:H(e,f,p)}}if(_e(e,c),e.push(`>`),U(e,d,u),typeof u==`string`){e.push(P(u));var m=null}else m=u;return m;case`g`:case`p`:case`li`:break;case`select`:e.push(Re(`select`));var h=null,g=null,_;for(_ in n)if(O.call(n,_)){var v=n[_];if(v!=null)switch(_){case`children`:h=v;break;case`dangerouslySetInnerHTML`:g=v;break;case`defaultValue`:case`value`:break;default:H(e,_,v)}}return _e(e,c),e.push(`>`),U(e,g,h),h;case`option`:var y=c.selectedValue;e.push(Re(`option`));var b=null,x=null,S=null,ee=null,C;for(C in n)if(O.call(n,C)){var w=n[C];if(w!=null)switch(C){case`children`:b=w;break;case`selected`:S=w;break;case`dangerouslySetInnerHTML`:ee=w;break;case`value`:x=w;default:H(e,C,w)}}if(y!=null){var te=x===null?Ee(b):``+x;if(T(y)){for(var E=0;E`),U(e,ee,b),b;case`textarea`:e.push(Re(`textarea`));var k=null,A=null,j=null,re;for(re in n)if(O.call(n,re)){var M=n[re];if(M!=null)switch(re){case`children`:j=M;break;case`value`:k=M;break;case`defaultValue`:A=M;break;case`dangerouslySetInnerHTML`:throw Error(a(91));default:H(e,re,M)}}if(k===null&&A!==null&&(k=A),_e(e,c),e.push(`>`),j!=null){if(k!=null)throw Error(a(92));if(T(j)){if(1`),fe?.forEach(Se,e),null;case`button`:e.push(Re(`button`));var z=null,pe=null,B=null,me=null,he=null,ge=null,ve=null,Ce;for(Ce in n)if(O.call(n,Ce)){var Ie=n[Ce];if(Ie!=null)switch(Ce){case`children`:z=Ie;break;case`dangerouslySetInnerHTML`:pe=Ie;break;case`name`:B=Ie;break;case`formAction`:me=Ie;break;case`formEncType`:he=Ie;break;case`formMethod`:ge=Ie;break;case`formTarget`:ve=Ie;break;default:H(e,Ce,Ie)}}var Le=Te(e,r,i,me,he,ge,ve,B);if(_e(e,c),e.push(`>`),Le?.forEach(Se,e),U(e,pe,z),typeof z==`string`){e.push(P(z));var ze=null}else ze=z;return ze;case`form`:e.push(Re(`form`));var Be=null,He=null,Ue=null,We=null,Ge=null,Ke=null,qe;for(qe in n)if(O.call(n,qe)){var Je=n[qe];if(Je!=null)switch(qe){case`children`:Be=Je;break;case`dangerouslySetInnerHTML`:He=Je;break;case`action`:Ue=Je;break;case`encType`:We=Je;break;case`method`:Ge=Je;break;case`target`:Ke=Je;break;default:H(e,qe,Je)}}var Ye=null,Xe=null;if(typeof Ue==`function`){var W=we(r,Ue);W===null?(e.push(` `,`action`,`="`,xe,`"`),Ke=Ge=We=Ue=null,De(r,i)):(Ue=W.action||``,We=W.encType,Ge=W.method,Ke=W.target,Ye=W.data,Xe=W.name)}if(Ue!=null&&H(e,`action`,Ue),We!=null&&H(e,`encType`,We),Ge!=null&&H(e,`method`,Ge),Ke!=null&&H(e,`target`,Ke),_e(e,c),e.push(`>`),Xe!==null&&(e.push(``),Ye?.forEach(Se,e)),U(e,He,Be),typeof Be==`string`){e.push(P(Be));var G=null}else G=Be;return G;case`menuitem`:for(var K in e.push(Re(`menuitem`)),n)if(O.call(n,K)){var q=n[K];if(q!=null)switch(K){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(400));default:H(e,K,q)}}return _e(e,c),e.push(`>`),null;case`object`:e.push(Re(`object`));var Ze=null,Qe=null,J;for(J in n)if(O.call(n,J)){var $e=n[J];if($e!=null)switch(J){case`children`:Ze=$e;break;case`dangerouslySetInnerHTML`:Qe=$e;break;case`data`:var et=I(``+$e);if(et===``)break;e.push(` `,`data`,`="`,P(et),`"`);break;default:H(e,J,$e)}}if(_e(e,c),e.push(`>`),U(e,Qe,Ze),typeof Ze==`string`){e.push(P(Ze));var tt=null}else tt=Ze;return tt;case`title`:var nt=c.tagScope&1,rt=c.tagScope&4;if(c.insertionMode===4||nt||n.itemProp!=null)var Y=Me(e,n);else rt?Y=null:(Me(i.hoistableChunks,n),Y=void 0);return Y;case`link`:var X=c.tagScope&1,Z=c.tagScope&4,it=n.rel,at=n.href,ot=n.precedence;if(c.insertionMode===4||X||n.itemProp!=null||typeof it!=`string`||typeof at!=`string`||at===``){Oe(e,n);var st=null}else if(n.rel===`stylesheet`){if(typeof ot!=`string`||n.disabled!=null||n.onLoad||n.onError)st=Oe(e,n);else{var ct=i.styles.get(ot),lt=r.styleResources.hasOwnProperty(at)?r.styleResources[at]:void 0;if(lt!==null){r.styleResources[at]=null,ct||(ct={precedence:P(ot),rules:[],hrefs:[],sheets:new Map},i.styles.set(ot,ct));var ut={state:0,props:D({},n,{"data-precedence":n.precedence,precedence:null})};if(lt){lt.length===2&&dt(ut.props,lt);var pt=i.preloads.stylesheets.get(at);pt&&0`),st=null}}else n.onLoad||n.onError?st=Oe(e,n):(l&&e.push(``),st=Z?null:Oe(i.hoistableChunks,n));return st;case`script`:var ht=c.tagScope&1,gt=n.async;if(typeof n.src!=`string`||!n.src||!gt||typeof gt==`function`||typeof gt==`symbol`||n.onLoad||n.onError||c.insertionMode===4||ht||n.itemProp!=null)var _t=Ne(e,n);else{var vt=n.src;if(n.type===`module`)var yt=r.moduleScriptResources,bt=i.preloads.moduleScripts;else yt=r.scriptResources,bt=i.preloads.scripts;var xt=yt.hasOwnProperty(vt)?yt[vt]:void 0;if(xt!==null){yt[vt]=null;var St=n;if(xt){xt.length===2&&(St=D({},n),dt(St,xt));var Ct=bt.get(vt);Ct&&(Ct.length=0)}var wt=[];i.scripts.add(wt),Ne(wt,St)}l&&e.push(``),_t=null}return _t;case`style`:var Tt=c.tagScope&1,Et=n.precedence,Dt=n.href,Ot=n.nonce;if(c.insertionMode===4||Tt||n.itemProp!=null||typeof Et!=`string`||typeof Dt!=`string`||Dt===``){e.push(Re(`style`));var kt=null,At=null,jt;for(jt in n)if(O.call(n,jt)){var Mt=n[jt];if(Mt!=null)switch(jt){case`children`:kt=Mt;break;case`dangerouslySetInnerHTML`:At=Mt;break;default:H(e,jt,Mt)}}e.push(`>`);var Nt=Array.isArray(kt)?2>kt.length?kt[0]:null:kt;typeof Nt!=`function`&&typeof Nt!=`symbol`&&Nt!=null&&e.push((``+Nt).replace(ke,Ae)),U(e,At,kt),e.push(Ve(`style`));var Pt=null}else{var Ft=i.styles.get(Et);if((r.styleResources.hasOwnProperty(Dt)?r.styleResources[Dt]:void 0)!==null){r.styleResources[Dt]=null,Ft||(Ft={precedence:P(Et),rules:[],hrefs:[],sheets:new Map},i.styles.set(Et,Ft));var It=i.nonce.style;if(!It||It===Ot){Ft.hrefs.push(P(Dt));var Lt=Ft.rules,Rt=null,zt=null,Bt;for(Bt in n)if(O.call(n,Bt)){var Vt=n[Bt];if(Vt!=null)switch(Bt){case`children`:Rt=Vt;break;case`dangerouslySetInnerHTML`:zt=Vt}}var Ht=Array.isArray(Rt)?2>Rt.length?Rt[0]:null:Rt;typeof Ht!=`function`&&typeof Ht!=`symbol`&&Ht!=null&&Lt.push((``+Ht).replace(ke,Ae)),U(Lt,zt,Rt)}}Ft&&s&&s.styles.add(Ft),l&&e.push(``),Pt=void 0}return Pt;case`meta`:var Ut=c.tagScope&1,Wt=c.tagScope&4;if(c.insertionMode===4||Ut||n.itemProp!=null)var Gt=je(e,n,`meta`,c);else l&&e.push(``),Gt=Wt?null:typeof n.charSet==`string`?je(i.charsetChunks,n,`meta`,c):n.name===`viewport`?je(i.viewportChunks,n,`meta`,c):je(i.hoistableChunks,n,`meta`,c);return Gt;case`listing`:case`pre`:e.push(Re(t));var Kt=null,qt=null,Jt;for(Jt in n)if(O.call(n,Jt)){var Yt=n[Jt];if(Yt!=null)switch(Jt){case`children`:Kt=Yt;break;case`dangerouslySetInnerHTML`:qt=Yt;break;default:H(e,Jt,Yt)}}if(_e(e,c),e.push(`>`),qt!=null){if(Kt!=null)throw Error(a(60));if(typeof qt!=`object`||!(`__html`in qt))throw Error(a(61));var Xt=qt.__html;Xt!=null&&(typeof Xt==`string`&&0i.highImagePreloads.size)&&(tn.delete(en),i.highImagePreloads.add(nn));else if(!r.imageResources.hasOwnProperty(en)){r.imageResources[en]=ce;var rn=n.crossOrigin,an=typeof rn==`string`?rn===`use-credentials`?rn:``:void 0,on=i.headers,sn;on&&0on.highImagePreloads.length)&&(sn=ft(Qt,`image`,{imageSrcSet:n.srcSet,imageSizes:n.sizes,crossOrigin:an,integrity:n.integrity,nonce:n.nonce,type:n.type,fetchPriority:n.fetchPriority,referrerPolicy:n.referrerPolicy}),0<=(on.remainingCapacity-=sn.length+2))?(i.resets.image[en]=ce,on.highImagePreloads&&(on.highImagePreloads+=`, `),on.highImagePreloads+=sn):(nn=[],Oe(nn,{rel:`preload`,as:`image`,href:$t?void 0:Qt,imageSrcSet:$t,imageSizes:Q,crossOrigin:an,integrity:n.integrity,type:n.type,fetchPriority:n.fetchPriority,referrerPolicy:n.referrerPolicy}),n.fetchPriority===`high`||10>i.highImagePreloads.size?i.highImagePreloads.add(nn):(i.bulkPreloads.add(nn),tn.set(en,nn)))}}return je(e,n,`img`,c);case`base`:case`area`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`param`:case`source`:case`track`:case`wbr`:return je(e,n,t,c);case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:break;case`head`:if(2>c.insertionMode){var cn=o||i.preamble;if(cn.headChunks)throw Error(a(545,"``"));o!==null&&e.push(``),cn.headChunks=[];var ln=Pe(cn.headChunks,n,`head`,c)}else ln=Fe(e,n,`head`,c);return ln;case`body`:if(2>c.insertionMode){var un=o||i.preamble;if(un.bodyChunks)throw Error(a(545,"``"));o!==null&&e.push(``),un.bodyChunks=[];var dn=Pe(un.bodyChunks,n,`body`,c)}else dn=Fe(e,n,`body`,c);return dn;case`html`:if(c.insertionMode===0){var fn=o||i.preamble;if(fn.htmlChunks)throw Error(a(545,"``"));o!==null&&e.push(``),fn.htmlChunks=[``];var pn=Pe(fn.htmlChunks,n,`html`,c)}else pn=Fe(e,n,`html`,c);return pn;default:if(t.indexOf(`-`)!==-1){e.push(Re(t));var mn=null,hn=null,gn;for(gn in n)if(O.call(n,gn)){var _n=n[gn];if(_n!=null){var vn=gn;switch(gn){case`children`:mn=_n;break;case`dangerouslySetInnerHTML`:hn=_n;break;case`style`:ye(e,_n);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`ref`:break;case`className`:vn=`class`;default:if(ne(gn)&&typeof _n!=`function`&&typeof _n!=`symbol`&&!1!==_n){if(!0===_n)_n=``;else if(typeof _n==`object`)continue;e.push(` `,vn,`="`,P(_n),`"`)}}}}return _e(e,c),e.push(`>`),U(e,hn,mn),mn}}return Fe(e,n,t,c)}var Be=new Map;function Ve(e){var t=Be.get(e);return t===void 0&&(t=``,Be.set(e,t)),t}function He(e,t){e=e.preamble,e.htmlChunks===null&&t.htmlChunks&&(e.htmlChunks=t.htmlChunks),e.headChunks===null&&t.headChunks&&(e.headChunks=t.headChunks),e.bodyChunks===null&&t.bodyChunks&&(e.bodyChunks=t.bodyChunks)}function Ue(e,t){t=t.bootstrapChunks;for(var n=0;n`)}function Ge(e,t,n,r){switch(n.insertionMode){case 0:case 1:case 3:case 2:return e.push(`