@tempots/beatui 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/{auth-divider-MMhfmLBu.cjs → auth-divider-3t_-R0sL.cjs} +1 -1
- package/dist/{auth-divider-CbME_yVQ.js → auth-divider-Cp3xGpHr.js} +2 -2
- package/dist/beatui.css +32 -7
- package/dist/beatui.tailwind.css +32 -7
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +3 -3
- package/dist/{deep-merge-EkjEgK0N.cjs → deep-merge-Bz9HHpRt.cjs} +1 -1
- package/dist/{deep-merge-BzIheQtH.js → deep-merge-Da602mAN.js} +1 -1
- package/dist/{duration-input-DGzmIImj.js → duration-input-HM1i6RRY.js} +2 -2
- package/dist/{duration-input-ClgYjeBa.cjs → duration-input-g-cQ3cs1.cjs} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +5394 -5251
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +5 -5
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +3 -3
- package/dist/notice-BNghd0oS.cjs +1 -0
- package/dist/notice-Dtz7ADVH.js +211 -0
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/text-input-DL9FvpTZ.cjs +1 -0
- package/dist/text-input-dDUEUmlC.js +57 -0
- package/dist/types/components/data/data-table-context.d.ts +4 -3
- package/dist/types/components/data/data-table-types.d.ts +31 -17
- package/dist/types/components/data/data-table.d.ts +3 -3
- package/dist/types/components/data/sortable-header.d.ts +4 -2
- package/dist/types/components/form/input/color-input.d.ts +3 -1
- package/dist/types/components/form/input/input-options.d.ts +3 -1
- package/dist/types/components/form/input/nullable-plain-date-input.d.ts +1 -0
- package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +1 -0
- package/dist/types/components/form/input/nullable-plain-time-input.d.ts +1 -0
- package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +1 -0
- package/dist/types/components/form/input/plain-date-input.d.ts +1 -0
- package/dist/types/components/form/input/plain-date-time-input.d.ts +1 -0
- package/dist/types/components/form/input/plain-time-input.d.ts +1 -0
- package/dist/types/components/form/input/plain-year-month-input.d.ts +1 -0
- package/dist/types/components/form/input/slider-input.d.ts +24 -6
- package/dist/types/components/form/input/switch.d.ts +3 -1
- package/dist/types/components/overlay/dialogs.d.ts +10 -2
- package/dist/widget-customization-DOWmUuPU.cjs +1 -0
- package/dist/{widget-customization-DEiQ_31d.js → widget-customization-YhVcA-KM.js} +210 -207
- package/package.json +1 -1
- package/dist/notice-B5wTXoTq.cjs +0 -1
- package/dist/notice-BKcyJD5w.js +0 -209
- package/dist/text-input-DfqXolVe.js +0 -55
- package/dist/text-input-X_q01NsY.cjs +0 -1
- package/dist/widget-customization-B49MeU4E.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),D=require("@tempots/std"),f=require("../use-form-CaW192gw.cjs"),b=require("../deep-merge-EkjEgK0N.cjs"),Ze=require("../text-input-X_q01NsY.cjs"),j=require("../duration-input-ClgYjeBa.cjs"),B=require("../input-container-Di1YvVB_.cjs"),N=require("../stack-dwLevGa2.cjs");function pe(e){return e==="int64"||e==="int128"||e==="uint64"||e==="uint128"}function k(e){return e==="int8"||e==="int16"||e==="int32"||e==="int64"||e==="int128"||e==="uint8"||e==="uint16"||e==="uint32"||e==="uint64"||e==="uint128"}function _(e){return e==="float"||e==="double"||e==="decimal"}function de(e){return k(e)||_(e)}function z(e){return e==="date"||e==="datetime"||e==="time"||e==="duration"}function fe(e){return e==="string"||e==="boolean"||e==="null"||de(e)||z(e)||e==="uuid"||e==="uri"||e==="binary"}function He(e){return e==="object"||e==="array"||e==="set"||e==="map"||e==="tuple"||e==="choice"||e==="any"}function O(e){return typeof e=="object"&&e!==null&&"$ref"in e}function me(e){return typeof e=="object"&&e!==null&&!("type"in e)&&!("$ref"in e)&&!("enum"in e)&&!("const"in e)}function ye(e){return typeof e=="object"&&e!==null&&("type"in e||"$ref"in e||"enum"in e||"const"in e)}function R(e){return e.type==="object"&&"properties"in e}function X(e){return e.type==="array"&&"items"in e}function Y(e){return e.type==="set"&&"items"in e}function Q(e){return e.type==="map"&&"values"in e}function ee(e){return e.type==="tuple"&&"tuple"in e}function te(e){return e.type==="choice"&&"choices"in e}function ge(e){return"enum"in e&&Array.isArray(e.enum)}function he(e){return"const"in e}function Z(e){return e===void 0?null:typeof e=="string"||Array.isArray(e)?e:(O(e),null)}function be(e){return e===void 0?!1:e==="null"?!0:Array.isArray(e)?e.includes("null"):!1}function G(e){return typeof e=="string"?e==="null"?[]:[e]:Array.isArray(e)?e.filter(t=>t!=="null"):[]}const V={int8:{min:-128n,max:127n},int16:{min:-32768n,max:32767n},int32:{min:-2147483648n,max:2147483647n},int64:{min:-9223372036854775808n,max:9223372036854775807n},int128:{min:-170141183460469231731687303715884105728n,max:170141183460469231731687303715884105727n},uint8:{min:0n,max:255n},uint16:{min:0n,max:65535n},uint32:{min:0n,max:4294967295n},uint64:{min:0n,max:18446744073709551615n},uint128:{min:0n,max:340282366920938463463374607431768211455n}};function ve(e){return e.startsWith("#/")?e.slice(2).split("/"):e.includes("/")?e.split("/"):["definitions",e]}function Xe(e,t){let n=e;for(const r of t){if(n==null||typeof n!="object")return;n=n[r]}return n}function A(e,t){const n=ve(e),r=Xe(t,n);if(r==null){console.warn(`Failed to resolve $ref: ${e}`);return}if(ye(r))return r;if(me(r)){console.warn(`$ref "${e}" points to a namespace, not a type definition`);return}}function Ye(e,t){return A(e.$ref,t)}class xe{schema;visited=new Set;constructor(t){this.schema=t}resolve(t){if(this.visited.has(t)){console.warn(`Circular reference detected: ${t}`);return}this.visited.add(t);try{const n=A(t,this.schema);if(n?.type&&O(n.type)){const r=this.resolve(n.type.$ref);if(r){const{type:s,...a}=n;return{...r,...a}}}return n}finally{this.visited.delete(t)}}resolveDefinition(t){if(t.type&&O(t.type)){const n=this.resolve(t.type.$ref);if(n){const{type:r,...s}=t;return{...n,...s}}}return t}reset(){this.visited.clear()}}function J(e){return new xe(e)}class K{schema;definition;path;readOnly;locale;widgetRegistry;isPropertyRequired;suppressLabel;refResolver;constructor(t){this.schema=t.schema,this.definition=t.definition,this.path=t.path,this.readOnly=t.readOnly??!1,this.locale=t.locale,this.widgetRegistry=t.widgetRegistry,this.isPropertyRequired=t.isPropertyRequired??!1,this.suppressLabel=t.suppressLabel??!1,this.refResolver=t.refResolver??J(t.schema)}with(t){return new K({schema:this.schema,definition:t.definition??this.definition,path:t.path??this.path,readOnly:t.readOnly??this.readOnly,locale:t.locale??this.locale,widgetRegistry:t.widgetRegistry??this.widgetRegistry,isPropertyRequired:t.isPropertyRequired??this.isPropertyRequired,suppressLabel:t.suppressLabel??this.suppressLabel,refResolver:this.refResolver})}append(t){return this.with({path:[...this.path,t]})}get isRoot(){return this.path.length===0}get name(){const t=this.path[this.path.length-1];return typeof t=="string"?t:void 0}get widgetName(){return this.path.map(String).join(".")}get resolvedType(){const t=this.definition.type;if(!t)return null;if(O(t)){const n=this.refResolver.resolve(t.$ref);return n?.type?Z(n.type):null}return Z(t)}get primaryType(){const t=this.resolvedType;return t?typeof t=="string"?t==="null"?null:t:G(t)[0]??null:null}get isNullable(){return be(this.definition.type)}get isRequired(){return this.isPropertyRequired}get isOptional(){return!this.isPropertyRequired}get isDeprecated(){return this.definition.deprecated===!0}get isAbstract(){return this.definition.abstract===!0}get isPrimitive(){const t=this.primaryType;return t!=null&&fe(t)}get description(){return this.definition.description}get examples(){return this.definition.examples}get defaultValue(){return this.definition.default}get unit(){return this.definition.unit}get currency(){return this.definition.currency}get label(){if(this.locale&&this.definition.altnames){const n=`lang:${this.locale}`,r=this.definition.altnames[n];if(r)return r}if(this.definition.name)return this.definition.name;const t=this.name;return t?D.upperCaseFirst(D.humanize(t)):""}get altnames(){return this.definition.altnames}get jsonPath(){return this.path.length===0?"":"/"+this.path.map(String).join("/")}resolveRef(t){return this.refResolver.resolve(t)}get hasEnum(){return"enum"in this.definition&&Array.isArray(this.definition.enum)}get enumValues(){if("enum"in this.definition)return this.definition.enum}get hasConst(){return"const"in this.definition}get constValue(){if("const"in this.definition)return this.definition.const}get format(){if("format"in this.definition)return this.definition.format}}function Te(e,t){let n;const r=J(e);if(e.$root){const s=r.resolve(e.$root);s?n=s:(console.warn(`Failed to resolve $root: ${e.$root}`),n=e)}else e.type||e.properties?n=e:n={type:"any"};return new K({schema:e,definition:n,path:[],readOnly:t?.readOnly,locale:t?.locale,widgetRegistry:t?.widgetRegistry,refResolver:r})}function ne(e,t,n){const r=[],s=[];if(!e.$extends)return{merged:e,inheritanceChain:r,errors:s};const a=Array.isArray(e.$extends)?e.$extends:[e.$extends],o=new Set,i=(p,y=0)=>{if(y>100)return s.push({path:p.join(" -> "),message:"Maximum inheritance depth exceeded"}),[];const g=[];for(const d of p){if(o.has(d)){s.push({path:d,message:`Circular inheritance detected: ${d}`});continue}o.add(d),r.push(d);const h=A(d,t);if(!h){s.push({path:d,message:`Failed to resolve base type: ${d}`});continue}if(h.$extends){const m=Array.isArray(h.$extends)?h.$extends:[h.$extends],x=i(m,y+1);g.push(...x)}g.push(h),o.delete(d)}return g},u=i(a);return{merged:Qe(u,e),inheritanceChain:r,errors:s}}function Qe(e,t){if(e.length===0)return t;let n={...e[0]};for(let a=1;a<e.length;a++)n=ae(n,e[a]);n=ae(n,t);const{$extends:r,...s}=n;return s}function ae(e,t){return R(e)&&R(t)?et(e,t):{...e,...t}}function et(e,t){const n={...e.properties??{},...t.properties??{}},r=oe(e.required),s=oe(t.required),a=tt([...r,...s]),o={...e,...t,type:"object",properties:n};return a.length>0&&(o.required=a),o}function oe(e){return e?e.length===0?[]:Array.isArray(e[0])?e.flat():e:[]}function tt(e){return[...new Set(e)]}function nt(e){const t=J(e);return{resolve:n=>(t.reset(),ne(n,e))}}function rt(){return l.html.span(l.attr.class("bc-json-structure-deprecated-badge"),l.attr.style("font-size: var(--font-size-xs); color: var(--color-warning-500, #d97706); background: var(--color-warning-100, #fef3c7); padding: 0.125em 0.5em; border-radius: var(--radius-sm); margin-inline-start: 0.5em; font-weight: normal;"),"(deprecated)")}function w(e,t){return!e||!t?e??"":l.html.span(e,rt())}function it(e){const t=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:t}}function $e({ctx:e,controller:t}){const n=it(e);return f.Control(Ze.TextInput,{...n,controller:b.transformEmptyStringToUndefined(t)})}function st(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Ce({ctx:e,controller:t}){const n=st(e),r=f.Control(f.CheckboxInput,{...n,controller:t});return e.isNullable?f.Control(f.CheckboxInput,{...n,controller:t,after:b.NullableResetAfter(t.signal,t.disabled,s=>t.change(s))}):r}function at(e,t){const n=V[t],r=Ie(e,n.min),s=Se(e,n.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof r=="bigint"?Number(r):r,max:typeof s=="bigint"?Number(s):s,step:1,placeholder:a}}function ot(e,t){const n=V[t],r=Ie(e,n.min),s=Se(e,n.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof r=="number"?BigInt(r):r,max:typeof s=="number"?BigInt(s):s,placeholder:a}}function Ie(e,t){const n=e.definition;if(n.minimum!==void 0){const r=typeof n.minimum=="string"?BigInt(n.minimum):n.minimum;return typeof r=="bigint"?r>t?r:t:BigInt(r)>t?r:Number(t)}if(n.exclusiveMinimum!==void 0){const r=typeof n.exclusiveMinimum=="string"?BigInt(n.exclusiveMinimum):n.exclusiveMinimum,s=typeof r=="bigint"?r+1n:r+1;return typeof s=="bigint"?s>t?s:t:BigInt(s)>t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Se(e,t){const n=e.definition;if(n.maximum!==void 0){const r=typeof n.maximum=="string"?BigInt(n.maximum):n.maximum;return typeof r=="bigint"?r<t?r:t:BigInt(r)<t?r:Number(t)}if(n.exclusiveMaximum!==void 0){const r=typeof n.exclusiveMaximum=="string"?BigInt(n.exclusiveMaximum):n.exclusiveMaximum,s=typeof r=="bigint"?r-1n:r-1;return typeof s=="bigint"?s<t?s:t:BigInt(s)<t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function we({ctx:e,controller:t,intType:n}){if(pe(n)){const s=ot(e,n);return e.isNullable?f.Control(j.NullableBigintInput,{...s,controller:t}):f.Control(j.BigintInput,{...s,controller:t})}const r=at(e,n);return e.isNullable?f.Control(b.NullableNumberInput,{...r,controller:t}):f.Control(b.NumberInput,{...r,controller:t})}function ut(e,t){const n=e.definition;let r;n.multipleOf!==void 0?r=n.multipleOf:t==="decimal"&&n.scale!==void 0&&(r=Math.pow(10,-n.scale));const s=n.minimum!==void 0?typeof n.minimum=="string"?parseFloat(n.minimum):n.minimum:void 0,a=n.maximum!==void 0?typeof n.maximum=="string"?parseFloat(n.maximum):n.maximum:void 0,o=n.exclusiveMinimum!==void 0?typeof n.exclusiveMinimum=="string"?parseFloat(n.exclusiveMinimum):n.exclusiveMinimum:void 0,i=n.exclusiveMaximum!==void 0?typeof n.exclusiveMaximum=="string"?parseFloat(n.exclusiveMaximum):n.exclusiveMaximum:void 0;let u=e.description;if(o!==void 0||i!==void 0){const p=[];o!==void 0&&p.push(`> ${o}`),i!==void 0&&p.push(`< ${i}`);const y=`Valid range: ${p.join(" and ")}`;u=u?`${u} (${y})`:y}const c=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:u,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:s??o,max:a??i,step:r,placeholder:c}}function je({ctx:e,controller:t,floatType:n}){const r=ut(e,n);return e.isNullable?f.Control(b.NullableNumberInput,{...r,controller:t}):f.Control(b.NumberInput,{...r,controller:t})}function lt(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}function Me({ctx:e,controller:t}){const n=lt(e);return f.Control(b.UuidInput,{...n,controller:b.transformEmptyStringToUndefined(t)})}function ct(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Oe({ctx:e,controller:t,temporalType:n}){const r=ct(e);switch(n){case"date":return e.isNullable?f.Control(j.NullablePlainDateInput,{...r,controller:t}):f.Control(j.PlainDateInput,{...r,controller:t});case"datetime":return e.isNullable?f.Control(j.NullablePlainDateTimeInput,{...r,controller:t}):f.Control(j.PlainDateTimeInput,{...r,controller:t});case"time":return e.isNullable?f.Control(j.NullablePlainTimeInput,{...r,controller:t}):f.Control(j.PlainTimeInput,{...r,controller:t});case"duration":return e.isNullable?f.Control(b.NullableDurationInput,{...r,controller:t}):f.Control(j.DurationInput,{...r,controller:t});default:return console.warn(`Unknown temporal type: ${n}`),l.Empty}}function pt(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"https://example.com"}}function De({ctx:e,controller:t}){const n=pt(e);return f.Control(b.UrlInput,{...n,controller:b.transformEmptyStringToUndefined(t)})}function dt(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Re({ctx:e,controller:t}){const n=dt(e);return f.Control(j.FileInput,{...n,controller:t})}function ft(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"Enter JSON value"}}function mt(e){return e.transform(t=>t===void 0?void 0:JSON.stringify(t,null,2),t=>{if(!(t===void 0||t.trim()===""))try{return JSON.parse(t)}catch{return t}})}function H({ctx:e,controller:t}){const n=ft(e);return f.Control(b.TextArea,{...n,controller:mt(t)})}function E(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function F(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function yt(e,t){return!t||t.length===0?!1:typeof t[0]=="string"?t.includes(e):Array.isArray(t[0])?t.some(n=>n.includes(e)):!1}function gt(e,t="property"){if(!e.has(t))return t;let n=1;for(;e.has(`${t}${n}`);)n++;return`${t}${n}`}function Ae({ctx:e,controller:t}){const n=e.definition;if(n.type!=="object"||!("properties"in n))return console.warn("StructureObjectControl requires an ObjectTypeDefinition"),l.html.div("Invalid object definition");const r=n.properties,s=n.required,a=n.additionalProperties,o=a!==!1,i=typeof a=="object"&&a!==null?a:{type:"any"},u=n.minProperties??0,c=n.maxProperties??1/0,p=D.objectEntries(r),y=new Set(p.map(([v])=>v)),g=p.map(([v,$])=>{const T=v,I=t.field(T),C=yt(T,s);return S({ctx:e.with({definition:$,isPropertyRequired:C,suppressLabel:!1}).append(T),controller:I})}),d=l.MapSignal(t.signal,v=>{const $=Object.keys(v??{}),T=$.filter(C=>!y.has(C));if(T.length===0)return l.Empty;const I=$.length>u&&!e.readOnly;return l.Fragment(...T.map(C=>{const P=t.field(C);return l.html.div(l.attr.class("bc-json-structure-additional-property"),l.html.div(l.attr.class("bc-json-structure-additional-property-header"),l.html.strong(`${C}:`),B.Button({variant:"text",size:"xs",onClick:()=>{const W={...l.Value.get(t.signal)??{}};delete W[C],t.change(W)},disabled:!I},"Remove")),l.html.div(l.attr.class("bc-json-structure-additional-property-value"),S({ctx:e.with({definition:i,isPropertyRequired:!1,suppressLabel:!0}).append(C),controller:P})))}))}),h=o&&!e.readOnly?B.Button({variant:"outline",size:"sm",disabled:l.Value.map(t.signal,v=>Object.keys(v??{}).length>=c),onClick:()=>{const v=l.Value.get(t.signal)??{},$=new Set(Object.keys(v)),T=gt($),I=F(i);t.change({...v,[T]:I})}},"Add Property"):null,m=l.html.div(l.attr.class("bc-json-structure-object-fields"),...g,d,h),x=l.html.div(l.attr.class("bc-json-structure-object"),m);return!e.suppressLabel&&e.name?f.InputWrapper({...E(e),content:x}):x}function Ne({ctx:e,controller:t}){const n=e.definition;if(n.type!=="array"||!("items"in n))return console.warn("StructureArrayControl requires an ArrayTypeDefinition"),l.html.div("Invalid array definition");const r=n.items,s=n.minItems??0,a=n.maxItems??1/0,o=l.computedOf(t.signal)(u=>(u?.length??0)<a),i=l.computedOf(t.signal)(u=>(u?.length??0)>s);return b.ListControl({...E(e),controller:t,createItem:()=>F(r),showAdd:!0,addDisabled:l.computedOf(o)(u=>!u||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(u=>!u||e.readOnly),element:u=>{const c=u.position.index,p=u.item;return S({ctx:e.with({definition:r,suppressLabel:!0}).append(c),controller:p})}})}function ke({ctx:e,controller:t}){const n=e.definition;if(n.type!=="set"||!("items"in n))return console.warn("StructureSetControl requires a SetTypeDefinition"),l.html.div("Invalid set definition");const r=n.items,s=n.minItems??0,a=n.maxItems??1/0,o=l.computedOf(t.signal)(c=>(c?.length??0)<a),i=l.computedOf(t.signal)(c=>(c?.length??0)>s),u=l.computedOf(t.signal)(c=>{if(!c||c.length===0)return new Set;const p=new Map,y=new Set;for(let g=0;g<c.length;g++){const d=JSON.stringify(c[g]);p.has(d)?(y.add(p.get(d)),y.add(g)):p.set(d,g)}return y});return b.ListControl({...E(e),controller:t,createItem:()=>F(r),showAdd:!0,addDisabled:l.computedOf(o)(c=>!c||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(c=>!c||e.readOnly),element:c=>{const p=c.position.index,y=c.item,g=u.map(h=>h.has(p)),d=S({ctx:e.with({definition:r,suppressLabel:!0}).append(p),controller:y});return l.Fragment(d,l.When(g,()=>N.Label(l.attr.class("bc-json-structure-set-error"),"Duplicate value - sets must contain unique items")))}})}function ht(e,t="key"){if(!e.has(t))return t;let n=1;for(;e.has(`${t}${n}`);)n++;return`${t}${n}`}function Fe({ctx:e,controller:t}){const n=e.definition;if(n.type!=="map"||!("values"in n))return console.warn("StructureMapControl requires a MapTypeDefinition"),l.html.div("Invalid map definition");const r=n.values,s=n.minProperties??0,a=n.maxProperties??1/0,o=l.MapSignal(t.signal,p=>{const y=Object.keys(p??{});if(y.length===0)return l.Empty;const g=y.length>s&&!e.readOnly;return l.Fragment(...y.map(d=>{const h=t.field(d);return l.html.div(l.attr.class("bc-json-structure-map-entry"),l.html.div(l.attr.class("bc-json-structure-map-entry-header"),l.html.strong(l.attr.class("bc-json-structure-map-entry-key"),`${d}:`),B.Button({variant:"text",size:"xs",onClick:()=>{const m={...l.Value.get(t.signal)??{}};delete m[d],t.change(m)},disabled:!g},"Remove")),l.html.div(l.attr.class("bc-json-structure-map-entry-value"),S({ctx:e.with({definition:r,suppressLabel:!0}).append(d),controller:h})))}))}),i=e.readOnly?null:B.Button({variant:"outline",size:"sm",disabled:l.Value.map(t.signal,p=>Object.keys(p??{}).length>=a),onClick:()=>{const p=l.Value.get(t.signal)??{},y=new Set(Object.keys(p)),g=ht(y),d=F(r);t.change({...p,[g]:d})}},"Add Entry"),u=l.html.div(l.attr.class("bc-json-structure-map-entries"),o,i),c=l.html.div(l.attr.class("bc-json-structure-map"),u);return!e.suppressLabel&&e.name?f.InputWrapper({...E(e),content:c}):c}function qe({ctx:e,controller:t}){const n=e.definition;if(n.type!=="tuple"||!("tuple"in n)||!("properties"in n))return console.warn("StructureTupleControl requires a TupleTypeDefinition"),l.html.div("Invalid tuple definition");const r=n.tuple,s=n.properties,a=t.signal.value;if(!Array.isArray(a)||a.length!==r.length){const i=r.map(u=>{const c=s[u];return c?F(c):void 0});t.change(i)}const o=E(e);return l.html.div(l.attr.class("bc-json-structure-tuple"),o.label?l.html.label(l.attr.class("bc-json-structure-tuple-label"),o.label,o.required?l.html.span(l.attr.class("bc-required-indicator"),"*"):null):null,o.description?l.html.div(l.attr.class("bc-json-structure-tuple-description"),o.description):null,l.html.div(l.attr.class("bc-json-structure-tuple-elements"),...r.map((i,u)=>{const c=s[i];if(!c)return console.warn(`Tuple element "${i}" at index ${u} not found in properties`),l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.span(`Missing definition for "${i}"`));const p=t.item(u),y=c.name||i;return l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.div(l.attr.class("bc-json-structure-tuple-element-header"),l.html.span(l.attr.class("bc-json-structure-tuple-position"),`[${u}]`),l.html.span(l.attr.class("bc-json-structure-tuple-element-name"),y)),l.html.div(l.attr.class("bc-json-structure-tuple-element-control"),S({ctx:e.with({definition:c,suppressLabel:!0}).append(u),controller:p})))})))}function bt({options:e,selected:t,onChange:n,disabled:r}){return b.NativeSelect({options:e.map(s=>({type:"value",value:s.value,label:s.label})),value:t,onChange:n,disabled:r})}function vt({ctx:e,selector:t,inner:n}){const r=N.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),t,n);return e.isRoot?r:f.InputWrapper({label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,content:r})}function xt(e,t,n){if(!e||typeof e!="object")return null;const r=e;if(n&&n in r){const a=r[n];if(typeof a=="string"&&a in t)return a}const s=Object.keys(r);if(s.length===1){const a=s[0];if(a in t)return a}return null}function Tt(e,t,n){if(!e||typeof e!="object")return;const r=e;if(n&&n in r){const{[n]:s,...a}=r;return a}if(t in r)return r[t]}function ue(e,t,n){return n?e&&typeof e=="object"?{[n]:t,...e}:{[n]:t}:{[t]:e}}function Pe({ctx:e,controller:t}){const n=e.definition;if(!n.choices||typeof n.choices!="object")return console.warn("StructureChoiceControl requires choices property"),l.html.div(l.attr.class("bc-json-structure-error"),"Invalid choice definition: missing choices");const r=n.choices,s=n.selector,a=Object.keys(r);if(a.length===0)return l.html.div(l.attr.class("bc-json-structure-error"),"Choice type has no variants defined");const o=a.map(m=>{const v=r[m].name||m;return{value:m,label:v}}),i=l.computedOf(t.signal)(m=>xt(m,r,s)),u=l.Value.get(i)||a[0],c=l.prop(u);t.onDispose(()=>c.dispose());let p=!1;const y=i.on(m=>{!p&&m!==null&&c.set(m)});t.onDispose(y);const d=bt({options:o,selected:c,onChange:m=>{p=!0,c.set(m);const x=r[m];if(x){const v=F(x),$=ue(v,m,s);t.change($)}},disabled:e.readOnly||e.isDeprecated}),h=l.MapSignal(c,m=>{const x=r[l.Value.get(m)];if(!x)return l.html.div(l.attr.class("bc-json-structure-error"),`Choice variant not found: ${l.Value.get(m)}`);const v=l.computedOf(t.signal)(I=>Tt(I,l.Value.get(m),s)),$=I=>{const C=ue(I,l.Value.get(m),s);t.change(C)},T=new f.Controller([...t.path,l.Value.get(m)],$,v,t.status,{disabled:t.disabled},void 0);return t.onDispose(()=>T.dispose()),S({ctx:e.with({definition:x,suppressLabel:!0}).append(l.Value.get(m)),controller:T})});return vt({ctx:e,selector:d,inner:h})}function $t(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Ve({ctx:e,controller:t}){const n=$t(e);return b.NativeSelectControl({...n,options:(e.enumValues??[]).map(r=>({type:"value",value:r,label:String(r)})),controller:t})}function Ee({ctx:e,controller:t}){return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==e.constValue&&t.change(e.constValue)}),b.Group(N.MutedLabel(e.label,": "),N.Label(String(e.constValue))))}function Ct(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function It(e,t){if(e===null)return t.includes("null")?"null":null;if(e===void 0)return t.includes("string")?"string":t[0]??null;switch(typeof e){case"string":return t.includes("uuid")?"uuid":t.includes("uri")?"uri":t.includes("date")?"date":t.includes("datetime")?"datetime":t.includes("time")?"time":t.includes("duration")?"duration":t.includes("string")?"string":null;case"number":{if(Number.isInteger(e)){if(t.includes("int32"))return"int32";if(t.includes("int64"))return"int64";if(t.includes("uint32"))return"uint32";if(t.includes("uint64"))return"uint64";if(t.includes("int16"))return"int16";if(t.includes("int8"))return"int8";if(t.includes("uint16"))return"uint16";if(t.includes("uint8"))return"uint8"}return t.includes("double")?"double":t.includes("float")?"float":t.includes("decimal")?"decimal":null}case"bigint":return t.includes("int128")?"int128":t.includes("int64")?"int64":t.includes("uint128")?"uint128":t.includes("uint64")?"uint64":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return e instanceof File||e instanceof Blob?t.includes("binary")?"binary":null:Array.isArray(e)?t.includes("array")?"array":t.includes("set")?"set":t.includes("tuple")?"tuple":null:t.includes("object")?"object":t.includes("map")?"map":null;default:return null}}function St(e,t){try{switch(t){case"string":case"uuid":case"uri":case"date":case"datetime":case"time":case"duration":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"int8":case"int16":case"int32":case"uint8":case"uint16":case"uint32":return typeof e=="number"&&Number.isInteger(e)?{ok:!0,value:e}:typeof e=="string"?/^[-+]?\d+$/.test(e.trim())?{ok:!0,value:parseInt(e,10)}:{ok:!1}:typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1};case"int64":case"int128":case"uint64":case"uint128":{if(typeof e=="bigint")return{ok:!0,value:e};if(typeof e=="number"&&Number.isInteger(e))return{ok:!0,value:BigInt(e)};if(typeof e=="string")try{return{ok:!0,value:BigInt(e.trim())}}catch{return{ok:!1}}return{ok:!1}}case"float":case"double":case"decimal":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const n=Number(e);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1}}return typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1}}case"boolean":{if(typeof e=="boolean")return{ok:!0,value:e};if(typeof e=="string"){const n=e.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"?{ok:!0,value:!0}:n==="false"||n==="0"||n==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":case"set":case"tuple":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":case"map":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"binary":return e instanceof File||e instanceof Blob?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null};case"any":case"choice":return{ok:!0,value:e};default:return{ok:!1}}}catch{return{ok:!1}}}function wt(e){switch(e){case"null":return null;case"array":case"set":case"tuple":return[];case"object":case"map":return{};case"binary":return;default:return}}function jt(e){return e.map(t=>({key:t,label:D.upperCaseFirst(t),detect:n=>It(n,[t])===t,convert:n=>St(n,t),defaultValue:()=>wt(t)}))}function Mt({options:e,selected:t,onChange:n}){if((e.length<=3?"segmented":"select")==="segmented"){const a=Object.fromEntries(e.map(o=>[o.value,o.label]));return b.SegmentedInput({options:a,value:t,onChange:o=>n(o),size:"sm"})}return b.NativeSelect({options:e.map(a=>({type:"value",value:a.value,label:a.label})),value:t,onChange:n})}function Ot({ctx:e,showSelector:t,selector:n,inner:r}){return e.isRoot?t?N.Stack(l.attr.class("bc-stack--gap-2"),n,r):r:f.InputWrapper({...Ct(e),content:t?N.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),n,r):r})}function Dt({ctx:e,controller:t}){const n=e.definition,r=n.type;let s;if(Array.isArray(r))s=r;else return console.warn("StructureUnionControl called with non-array type"),S({ctx:e,controller:t});const a=s.includes("null"),o=G(r),i=a&&o.length>0?o:s,u=jt(i),c=new b.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},u);t.onDispose(()=>c.dispose());const p=d=>Mt({options:i.map(h=>({value:h,label:D.upperCaseFirst(h)})),selected:c.activeBranch,onChange:d}),y=d=>{c.switchToBranch(d,!1)},g=l.MapSignal(c.activeBranch,d=>{const h=l.Value.get(d),m=c.getBranchController(h),x=e.with({definition:{...n,type:h},suppressLabel:!e.isRoot});return S({ctx:x,controller:m})});return Ot({ctx:e,showSelector:i.length>1,selector:p(y),inner:g})}function S({ctx:e,controller:t}){let n=e;const r=e.definition;if(r.type&&O(r.type)){const i=e.resolveRef(r.type.$ref);if(i){const{type:u,...c}=r,p={...i,...c};n=e.with({definition:p})}}if(n.definition.$extends){const{merged:i}=ne(n.definition,e.schema);n=n.with({definition:i})}const s=n.widgetRegistry;if(s){const i=s.findBestWidget(n);if(i)return i.registration.factory({controller:t,ctx:n})}if(ge(n.definition))return Ve({ctx:n,controller:t});if(he(n.definition))return Ee({ctx:n,controller:t});const a=n.resolvedType;if(Array.isArray(a)&&G(a).length>1)return Dt({ctx:n,controller:t});const o=n.primaryType;if(!o)return H({ctx:n,controller:t});if(R(n.definition)){const i=t instanceof f.ObjectController?t:t.object();return Ae({ctx:n,controller:i})}if(X(n.definition)){const i=t instanceof f.ArrayController?t:t.array();return Ne({ctx:n,controller:i})}if(Y(n.definition)){const i=t instanceof f.ArrayController?t:t.array();return ke({ctx:n,controller:i})}if(Q(n.definition)){const i=t instanceof f.ObjectController?t:t.object();return Fe({ctx:n,controller:i})}if(ee(n.definition)){const i=t instanceof f.ArrayController?t:t.array();return qe({ctx:n,controller:i})}if(te(n.definition))return Pe({ctx:n,controller:t});switch(o){case"string":return $e({ctx:n,controller:t});case"boolean":return Ce({ctx:n,controller:t});case"uuid":return Me({ctx:n,controller:t});case"uri":return De({ctx:n,controller:t});case"binary":return Re({ctx:n,controller:t});case"null":return Rt(n);case"any":return H({ctx:n,controller:t});default:return k(o)?we({ctx:n,controller:t,intType:o}):_(o)?je({ctx:n,controller:t,floatType:o}):z(o)?Oe({ctx:n,controller:t,temporalType:o}):(console.warn(`Unknown type: ${o}`),At(n,o))}}function Le({schema:e,controller:t,widgetRegistry:n,readOnly:r,locale:s}){const a=Te(e,{widgetRegistry:n,readOnly:r,locale:s});return S({ctx:a,controller:t})}function Rt(e){return l.html.div(l.attr.class("bc-json-structure-placeholder"),l.html.span(`[Null: ${e.label}]`),l.html.em("null"))}function At(e,t){return l.html.div(l.attr.class("bc-json-structure-unknown"),l.html.span(`Unknown type: ${t}`),l.html.em(`at path: ${e.jsonPath}`))}function re(e,t){return new Nt(e,t)}class Nt{schema;options;constructor(t,n){this.schema=t,this.options=n??{}}validate(t){const n=[];return this.validateValue(t,this.schema,"",n),{isValid:n.length===0,errors:n}}validateAt(t,n){return this.validate(t)}validateValue(t,n,r,s){if(this.options.stopOnFirstError&&s.length>0)return;if(t===null){const c=n.type;if(c==="null"||Array.isArray(c)&&c.includes("null"))return;s.push({path:r,type:"type",expected:c,actual:"null"});return}if("enum"in n&&Array.isArray(n.enum)){n.enum.includes(t)||s.push({path:r,type:"enum",expected:n.enum,actual:t});return}if("const"in n){t!==n.const&&s.push({path:r,type:"const",expected:n.const,actual:t});return}const a=n.type;if(!a)return;const i=(Array.isArray(a)?a:[a]).filter(c=>typeof c=="string");!i.some(c=>this.checkType(t,c,n,r,s))&&i.length>0&&s.push({path:r,type:"type",expected:a,actual:typeof t})}checkType(t,n,r,s,a){switch(n){case"string":return this.validateString(t,r,s,a);case"boolean":return typeof t=="boolean";case"null":return t===null;case"object":return this.validateObject(t,r,s,a);case"array":return this.validateArray(t,r,s,a);case"set":return this.validateSet(t,r,s,a);case"map":return this.validateMap(t,r,s,a);case"tuple":return this.validateTuple(t,r,s,a);case"choice":return this.validateChoice(t,r,s,a);case"any":return!0;default:return k(n)?this.validateInteger(t,n,r,s,a):_(n)?this.validateFloat(t,r,s,a):z(n)?this.validateTemporal(t,n,s,a):n==="uuid"?this.validateUuid(t,s,a):n==="uri"?this.validateUri(t,s,a):n==="binary"?this.validateBinary(t,s,a):!1}}validateString(t,n,r,s){if(typeof t!="string")return!1;const a=n;if(a.minLength!==void 0&&t.length<a.minLength&&s.push({path:r,type:"minLength",expected:a.minLength,actual:t.length}),a.maxLength!==void 0&&t.length>a.maxLength&&s.push({path:r,type:"maxLength",expected:a.maxLength,actual:t.length}),a.pattern!==void 0)try{new RegExp(a.pattern).test(t)||s.push({path:r,type:"pattern",expected:a.pattern,actual:t})}catch{}return!0}validateInteger(t,n,r,s,a){if(typeof t!="number"&&typeof t!="bigint")return!1;if(typeof t=="number"&&!Number.isInteger(t))return a.push({path:s,type:"type",expected:n,actual:"float"}),!1;if(k(n)){const o=V[n],i=typeof t=="bigint"?t:BigInt(Math.round(t));(i<o.min||i>o.max)&&a.push({path:s,type:"integer_bounds",expected:{min:o.min.toString(),max:o.max.toString()},actual:i.toString(),context:{type:n}})}return this.validateNumericConstraints(t,r,s,a),!0}validateFloat(t,n,r,s){return typeof t!="number"?!1:(this.validateNumericConstraints(t,n,r,s),!0)}validateNumericConstraints(t,n,r,s){const a=n,o=typeof t=="bigint"?Number(t):t;if(a.minimum!==void 0){const i=typeof a.minimum=="string"?Number(a.minimum):a.minimum;o<i&&s.push({path:r,type:"minimum",expected:i,actual:o})}if(a.maximum!==void 0){const i=typeof a.maximum=="string"?Number(a.maximum):a.maximum;o>i&&s.push({path:r,type:"maximum",expected:i,actual:o})}if(a.exclusiveMinimum!==void 0){const i=typeof a.exclusiveMinimum=="string"?Number(a.exclusiveMinimum):a.exclusiveMinimum;o<=i&&s.push({path:r,type:"exclusiveMinimum",expected:i,actual:o})}if(a.exclusiveMaximum!==void 0){const i=typeof a.exclusiveMaximum=="string"?Number(a.exclusiveMaximum):a.exclusiveMaximum;o>=i&&s.push({path:r,type:"exclusiveMaximum",expected:i,actual:o})}a.multipleOf!==void 0&&typeof t=="number"&&t%a.multipleOf!==0&&s.push({path:r,type:"multipleOf",expected:a.multipleOf,actual:t})}validateTemporal(t,n,r,s){if(typeof t!="string")return!1;const o={date:/^\d{4}-\d{2}-\d{2}$/,datetime:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/,time:/^\d{2}:\d{2}:\d{2}(\.\d+)?$/,duration:/^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/}[n];return o&&!o.test(t)?(s.push({path:r,type:"format",expected:n,actual:t}),!1):!0}validateUuid(t,n,r){return typeof t!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?!0:(r.push({path:n,type:"format",expected:"uuid",actual:t}),!1)}validateUri(t,n,r){if(typeof t!="string")return!1;try{return new URL(t),!0}catch{return r.push({path:n,type:"format",expected:"uri",actual:t}),!1}}validateBinary(t,n,r){return t instanceof Uint8Array?!0:typeof t!="string"?!1:/^[A-Za-z0-9+/]*={0,2}$/.test(t)?!0:(r.push({path:n,type:"format",expected:"binary",actual:t}),!1)}validateObject(t,n,r,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!R(n))return!0;const a=t,o=n.required;if(o){const i=Array.isArray(o[0])?o.flat():o;for(const u of i)u in a||s.push({path:r?`${r}/${u}`:`/${u}`,type:"required",expected:u})}for(const[i,u]of Object.entries(a)){const c=n.properties?.[i];if(c){const p=r?`${r}/${i}`:`/${i}`;this.validateValue(u,c,p,s)}else if(n.additionalProperties===!1)s.push({path:r?`${r}/${i}`:`/${i}`,type:"additionalProperties",actual:i});else if(typeof n.additionalProperties=="object"){const p=r?`${r}/${i}`:`/${i}`;this.validateValue(u,n.additionalProperties,p,s)}}return!0}validateArray(t,n,r,s){if(!Array.isArray(t))return!1;if(!X(n))return!0;const a=n;a.minItems!==void 0&&t.length<a.minItems&&s.push({path:r,type:"minItems",expected:a.minItems,actual:t.length}),a.maxItems!==void 0&&t.length>a.maxItems&&s.push({path:r,type:"maxItems",expected:a.maxItems,actual:t.length});for(let o=0;o<t.length;o++){const i=`${r}/${o}`;this.validateValue(t[o],n.items,i,s)}return!0}validateSet(t,n,r,s){if(!Array.isArray(t))return!1;if(!Y(n))return!0;const a=new Set;for(let o=0;o<t.length;o++){const i=JSON.stringify(t[o]);a.has(i)&&s.push({path:`${r}/${o}`,type:"uniqueItems",actual:t[o]}),a.add(i)}return this.validateArray(t,n,r,s)}validateMap(t,n,r,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!Q(n))return!0;const a=t;for(const[o,i]of Object.entries(a)){const u=`${r}/${o}`;this.validateValue(i,n.values,u,s)}return!0}validateTuple(t,n,r,s){if(!Array.isArray(t))return!1;if(!ee(n))return!0;const a=n.tuple.length;t.length!==a&&s.push({path:r,type:"tuple_length",expected:a,actual:t.length});for(let o=0;o<n.tuple.length;o++){const i=n.tuple[o],u=n.properties?.[i];u&&o<t.length&&this.validateValue(t[o],u,`${r}/${o}`,s)}return!0}validateChoice(t,n,r,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!te(n))return!0;const a=t,o=Object.keys(n.choices),i=Object.keys(a).find(c=>o.includes(c));if(!i)return s.push({path:r,type:"choice",expected:o,actual:Object.keys(a)}),!1;const u=n.choices[i];return u&&this.validateValue(a[i],u,`${r}/${i}`,s),!0}}function kt(e,t,n){return re(e,n).validate(t)}function We(e,t){const n=Ft(e,t);return{path:e.path,message:n,code:e.type}}function ie(e,t){return e.map(n=>{const r=t?.get(n.path);return We(n,r)})}function Ft(e,t){switch(e.type){case"type":return`Expected ${le(e.expected)}, got ${qt(e.actual)}`;case"type_mismatch":return`Value must be of type ${le(e.expected)}`;case"minLength":return`Must be at least ${e.expected} characters`;case"maxLength":return`Must be no more than ${e.expected} characters`;case"pattern":return Pt(e,t);case"format":return Vt(e);case"minimum":return`Must be at least ${e.expected}`;case"maximum":return`Must be at most ${e.expected}`;case"exclusiveMinimum":return`Must be greater than ${e.expected}`;case"exclusiveMaximum":return`Must be less than ${e.expected}`;case"multipleOf":return`Must be a multiple of ${e.expected}`;case"integer_bounds":return Et(e);case"minItems":return`Must have at least ${e.expected} items`;case"maxItems":return`Must have no more than ${e.expected} items`;case"uniqueItems":return"All items must be unique";case"contains":return"Must contain at least one matching item";case"minContains":return`Must contain at least ${e.expected} matching items`;case"maxContains":return`Must contain no more than ${e.expected} matching items`;case"required":return"This field is required";case"minProperties":return`Must have at least ${e.expected} properties`;case"maxProperties":return`Must have no more than ${e.expected} properties`;case"additionalProperties":return`Unknown property: ${e.actual}`;case"dependentRequired":return Lt(e);case"enum":return Wt(e);case"const":return`Must be exactly ${JSON.stringify(e.expected)}`;case"ref_not_found":return`Invalid reference: ${e.expected}`;case"circular_ref":return"Circular reference detected";case"invalid":return"Invalid value";default:return e.context?.message??`Validation error: ${e.type}`}}function le(e){return typeof e=="string"?ce(e):Array.isArray(e)?e.map(ce).join(" or "):String(e)}function qt(e){return e===null?"null":e===void 0?"undefined":typeof e}function ce(e){return{string:"text",boolean:"true/false",int8:"integer (-128 to 127)",int16:"integer (-32768 to 32767)",int32:"integer",int64:"large integer",int128:"very large integer",uint8:"positive integer (0 to 255)",uint16:"positive integer (0 to 65535)",uint32:"positive integer",uint64:"large positive integer",uint128:"very large positive integer",float:"decimal number",double:"decimal number",decimal:"decimal number",date:"date",datetime:"date and time",time:"time",duration:"duration",uuid:"UUID",uri:"URL",binary:"binary data",object:"object",array:"list",set:"unique list",map:"key-value pairs",tuple:"ordered list",choice:"one of multiple options",any:"any value",null:"empty"}[e]??e}function Pt(e,t){const n=t?.description;if(n&&e.type==="pattern")return`Does not match required format: ${n}`;const r=e.expected;if(r){const a={"^[a-zA-Z]+$":"letters only","^[0-9]+$":"numbers only","^[a-zA-Z0-9]+$":"letters and numbers only","^\\S+$":"no spaces allowed","^[a-z]+$":"lowercase letters only","^[A-Z]+$":"uppercase letters only"}[r];if(a)return`Must be ${a}`}return"Does not match required format"}function Vt(e){const t=e.expected;return{email:"Must be a valid email address","date-time":"Must be a valid date and time",date:"Must be a valid date",time:"Must be a valid time",uri:"Must be a valid URL","uri-reference":"Must be a valid URL or relative path",uuid:"Must be a valid UUID",hostname:"Must be a valid hostname",ipv4:"Must be a valid IPv4 address",ipv6:"Must be a valid IPv6 address",regex:"Must be a valid regular expression","json-pointer":"Must be a valid JSON pointer"}[t]??`Must be a valid ${t}`}function Et(e){const t=e.context?.type;if(t&&k(t)){const n=V[t];return`Must be between ${n.min} and ${n.max}`}return"Value is out of range for this integer type"}function Lt(e){const t=e.context?.dependent,n=e.context?.required;return t&&n?.length?`When "${t}" is present, "${n.join('", "')}" must also be provided`:"Missing required dependent fields"}function Wt(e){const t=e.expected;return t&&t.length<=5?`Must be one of: ${t.map(r=>JSON.stringify(r)).join(", ")}`:"Invalid value"}function Ut(e){const t=new Map;for(const n of e){const r=t.get(n.path)??[];r.push(n),t.set(n.path,r)}return t}function Bt(e,t){return e.filter(n=>n.path===t)}function _t(e,t){return e.some(n=>n.path===t)}function zt(e,t){const n=t===""?"/":`${t}/`;return e.filter(r=>r.path.startsWith(n))}class L{registrations=new Map;parent;constructor(t){this.parent=t??null}register(t,n){this.registrations.set(t,n)}unregister(t){this.registrations.delete(t)}get(t){return this.registrations.get(t)??this.parent?.get(t)}has(t){return this.registrations.has(t)||(this.parent?.has(t)??!1)}names(){const t=this.parent?.names()??[],n=Array.from(this.registrations.keys());return[...new Set([...t,...n])]}getForType(t){const n=[];this.parent&&n.push(...this.parent.getForType(t));for(const r of this.registrations.values())r.supportedTypes?.includes(t)&&n.push(r);return n}getForFormat(t){const n=[];this.parent&&n.push(...this.parent.getForFormat(t));for(const r of this.registrations.values())r.supportedFormats?.includes(t)&&n.push(r);return n}findBestWidget(t){const n=[];for(const s of this.names()){const a=this.get(s);if(!a)continue;const o=this.scoreWidget(a,t);o>0&&n.push({name:s,registration:a,score:o})}if(n.length===0)return null;n.sort((s,a)=>a.score!==s.score?a.score-s.score:(a.registration.priority??0)-(s.registration.priority??0));const r=n[0];return{name:r.name,registration:r.registration}}scoreWidget(t,n){let r=0;if(t.matcher)if(t.matcher(n))r+=100;else return 0;const s=n.primaryType;s&&t.supportedTypes?.includes(s)&&(r+=50);const a=n.format;return a&&t.supportedFormats?.includes(a)&&(r+=30),r+=t.priority??0,r}createChild(){return new L(this)}}let U=null;function q(){return U||(U=new L),U}function Gt(e){U=e}function Jt(e){return new L(e)}function Kt(e,t,n){return{name:`type:${e}`,registration:{factory:t,displayName:n?.displayName??`${e} widget`,description:n?.description,supportedTypes:[e],priority:n?.priority??0,canFallback:n?.canFallback??!1}}}function Zt(e,t,n){return{name:`format:${e}`,registration:{factory:t,displayName:n?.displayName??`${e} widget`,description:n?.description,supportedFormats:[e],priority:n?.priority??10,canFallback:n?.canFallback??!1}}}function Ht(e,t,n,r){return{name:`type:${e}:format:${t}`,registration:{factory:n,displayName:r?.displayName??`${e}/${t} widget`,description:r?.description,supportedTypes:[e],supportedFormats:[t],priority:r?.priority??20,canFallback:r?.canFallback??!1}}}function Xt(e,t,n,r){return{name:e,registration:{factory:n,displayName:r?.displayName??e,description:r?.description,matcher:t,priority:r?.priority??50,canFallback:r?.canFallback??!1}}}function Ue(e,t){if(t){const r=t.findBestWidget(e);if(r)return r}return q().findBestWidget(e)}function Yt(e){const t=e.definition,n={};if(typeof t=="object"&&"x:ui"in t){const r=t["x:ui"];r.widget&&typeof r.widget=="object"&&(n.options=r.widget),typeof r.priority=="number"&&(n.priority=r.priority)}if(typeof t=="object"&&"widget"in t){const r=t.widget;typeof r=="object"&&r!==null&&(n.options={...n.options??{},...r})}return Object.keys(n).length>0?n:void 0}function se(e){const t=e.definition;if(typeof t=="object"&&"x:ui"in t){const n=t["x:ui"];if(typeof n.widget=="string")return n.widget}if(typeof t=="object"&&"widget"in t){const n=t.widget;if(n&&typeof n.type=="string")return n.type}}function Qt(e){return se(e)!==void 0}function en(e,t){const n=se(e);if(n){if(t){const a=t.get(n);if(a)return{name:n,registration:a}}const s=q().get(n);if(s)return{name:n,registration:s};console.warn(`Widget "${n}" specified in definition but not found in registry`,{path:e.jsonPath})}return Ue(e,t)}function tn(e,t,n){return{...e,...t,...n}}function Be(e=q()){e.register("string",{factory:({controller:i,ctx:u})=>$e({ctx:u,controller:i}),displayName:"String",description:"Text input for string values",supportedTypes:["string"],priority:0,canFallback:!0}),e.register("boolean",{factory:({controller:i,ctx:u})=>Ce({ctx:u,controller:i}),displayName:"Boolean",description:"Checkbox for boolean values",supportedTypes:["boolean"],priority:0,canFallback:!0}),e.register("uuid",{factory:({controller:i,ctx:u})=>Me({ctx:u,controller:i}),displayName:"UUID",description:"Input for UUID values",supportedTypes:["uuid"],priority:0,canFallback:!0}),e.register("uri",{factory:({controller:i,ctx:u})=>De({ctx:u,controller:i}),displayName:"URI",description:"Input for URI/URL values",supportedTypes:["uri"],priority:0,canFallback:!0}),e.register("binary",{factory:({controller:i,ctx:u})=>Re({ctx:u,controller:i}),displayName:"Binary",description:"File upload for binary data",supportedTypes:["binary"],priority:0,canFallback:!0}),e.register("any",{factory:({controller:i,ctx:u})=>H({ctx:u,controller:i}),displayName:"Any",description:"Generic control for any type",supportedTypes:["any"],priority:0,canFallback:!0});const t=["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"],n=({controller:i,ctx:u})=>we({ctx:u,controller:i,intType:u.primaryType});for(const i of t)e.register(i,{factory:n,displayName:i.toUpperCase(),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const r=["float","double","decimal"],s=({controller:i,ctx:u})=>je({ctx:u,controller:i,floatType:u.primaryType});for(const i of r)e.register(i,{factory:s,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const a=["date","datetime","time","duration"],o=({controller:i,ctx:u})=>Oe({ctx:u,controller:i,temporalType:u.primaryType});for(const i of a)e.register(i,{factory:o,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});e.register("object",{factory:({controller:i,ctx:u})=>Ae({ctx:u,controller:i}),displayName:"Object",description:"Form for object values",supportedTypes:["object"],priority:0,canFallback:!0}),e.register("array",{factory:({controller:i,ctx:u})=>Ne({ctx:u,controller:i}),displayName:"Array",description:"List control for array values",supportedTypes:["array"],priority:0,canFallback:!0}),e.register("set",{factory:({controller:i,ctx:u})=>ke({ctx:u,controller:i}),displayName:"Set",description:"Set control for unique values",supportedTypes:["set"],priority:0,canFallback:!0}),e.register("map",{factory:({controller:i,ctx:u})=>Fe({ctx:u,controller:i}),displayName:"Map",description:"Map control for key-value pairs",supportedTypes:["map"],priority:0,canFallback:!0}),e.register("tuple",{factory:({controller:i,ctx:u})=>qe({ctx:u,controller:i}),displayName:"Tuple",description:"Tuple control for fixed-length arrays",supportedTypes:["tuple"],priority:0,canFallback:!0}),e.register("choice",{factory:({controller:i,ctx:u})=>Pe({ctx:u,controller:i}),displayName:"Choice",description:"Choice control for union types",supportedTypes:["choice"],priority:0,canFallback:!0}),e.register("enum",{factory:({controller:i,ctx:u})=>Ve({ctx:u,controller:i}),displayName:"Enum",description:"Dropdown for enumerated values",priority:10,canFallback:!1,matcher:i=>i.hasEnum}),e.register("const",{factory:({controller:i,ctx:u})=>Ee({ctx:u,controller:i}),displayName:"Const",description:"Display for constant values",priority:20,canFallback:!1,matcher:i=>i.hasConst})}function _e(e=q()){return e.has("string")&&e.has("object")&&e.has("array")}function nn(e=q()){_e(e)||Be(e)}function ze(e){let t=e;if(e.$root){const n=A(e.$root,e);n&&(t=n)}return M(t,e,new Set)}function M(e,t,n){if(e.type&&O(e.type)){const r=e.type.$ref;if(n.has(r))return;n.add(r);try{const s=A(r,t);if(s){const a={...s,...e,type:s.type};return M(a,t,n)}return}finally{n.delete(r)}}return e.default!==void 0?e.default:Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:"const"in e&&e.const!==void 0?e.const:"enum"in e&&Array.isArray(e.enum)&&e.enum.length>0?e.enum[0]:yn(e)?null:rn(e,t,n)}function rn(e,t,n){const r=Ge(e);if(R(e))return an(e,t,n);if(r==="choice"&&"choices"in e)return on(e,t,n);if(r==="tuple"&&"tuple"in e&&"properties"in e)return un(e,t,n);if(r==="array")return ln(e,t,n);if(r==="set")return cn(e,t,n);if(r==="map")return{};if(r==="string")return pn(e);if(gn(r))return dn(e);if(hn(r))return fn(e);if(r==="boolean")return!1;if(r==="null")return null;if(bn(r))return mn(r);if(r==="uuid"||r==="uri"||r==="uri-reference"||r==="binary"||r==="bytes")return""}function sn(e){if(!e||e.length===0)return new Set;if(Array.isArray(e[0])){const t=e.flat();return new Set(t)}return new Set(e)}function an(e,t,n){if(!R(e))return{};const r=sn(e.required),s={};for(const[a,o]of Object.entries(e.properties))if(r.has(a))if(o.type&&O(o.type)){const i=o.type.$ref;if(n.has(i))continue;n.add(i);try{const u=A(i,t);if(u){const c={...u,...o,type:u.type},p=M(c,t,n);p!==void 0&&(s[a]=p)}}finally{n.delete(i)}}else{const i=M(o,t,n);i!==void 0&&(s[a]=i)}return s}function on(e,t,n){if(!("choices"in e))return;const r=e.choices,s=Object.keys(r);if(s.length===0)return;const a=s[0],o=r[a];if("selector"in e&&e.selector){const u=e.selector,c=M(o,t,n);return typeof c=="object"&&c!==null?{[u]:a,...c}:{[u]:a}}const i=M(o,t,n);return{[a]:i}}function un(e,t,n){if(!("tuple"in e)||!("properties"in e))return{};const r=e.tuple,s=e.properties,a=new Set(e.required??r),o={};for(const i of r){if(!a.has(i))continue;const u=s[i];if(u){const c=M(u,t,n);c!==void 0&&(o[i]=c)}}return o}function ln(e,t,n){const r=("minItems"in e?e.minItems:0)??0;if(r===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(r).fill(null);const a=M(s,t,n);return Array(r).fill(a??null)}function cn(e,t,n){const r=("minItems"in e?e.minItems:0)??0;if(r===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(r).fill(null);const a=M(s,t,n);return Array(r).fill(a??null)}function pn(e){switch("format"in e?e.format:void 0){case"date":return Je();case"date-time":return Ke();case"time":return"00:00:00";default:return""}}function dn(e){const t=Ge(e),n=t==="int64"||t==="uint64"||t==="int128"||t==="uint128";let r="minimum"in e?e.minimum:void 0,s="maximum"in e?e.maximum:void 0;const a="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,o="exclusiveMaximum"in e?e.exclusiveMaximum:void 0;a!==void 0&&(r=a+1),o!==void 0&&(s=o-1);let i;r!==void 0&&s!==void 0?i=Math.round((r+s)/2):r!==void 0?i=r:s!==void 0?i=0<=s?0:s:i=0;const u="multipleOf"in e?e.multipleOf:void 0;return u!==void 0&&u>0&&(i=Math.round(i/u)*u,r!==void 0&&i<r&&(i=Math.ceil(r/u)*u),s!==void 0&&i>s&&(i=Math.floor(s/u)*u)),n?BigInt(Math.round(i)):Math.round(i)}function fn(e){let t="minimum"in e?e.minimum:void 0,n="maximum"in e?e.maximum:void 0;const r="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,s="exclusiveMaximum"in e?e.exclusiveMaximum:void 0,a="multipleOf"in e?e.multipleOf:.001;r!==void 0&&(t=r+a),s!==void 0&&(n=s-a);let o;t!==void 0&&n!==void 0?o=(t+n)/2:t!==void 0?o=t:n!==void 0?o=0<=n?0:n:o=0;const i="multipleOf"in e?e.multipleOf:void 0;return i!==void 0&&i>0&&(o=Math.round(o/i)*i,t!==void 0&&o<t&&(o=Math.ceil(t/i)*i),n!==void 0&&o>n&&(o=Math.floor(n/i)*i)),o}function mn(e){switch(e){case"date":return Je();case"time":return"00:00:00";case"datetime":return Ke();case"duration":return"PT0S";default:return""}}function yn(e){return Array.isArray(e.type)?e.type.some(t=>typeof t=="string"?t==="null":!1):!1}function Ge(e){const t=e.type;if(typeof t=="string")return t;if(Array.isArray(t)){for(const n of t)if(typeof n=="string"&&n!=="null")return n}}function gn(e){return e?["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"].includes(e):!1}function hn(e){return e?["float","double","decimal"].includes(e):!1}function bn(e){return e?["date","time","datetime","duration"].includes(e):!1}function Je(){return new Date().toISOString().split("T")[0]}function Ke(){return new Date().toISOString()}function vn(e){if(e.isValid)return D.Validation.valid;const t=ie(e.errors),n=new Map;for(const o of t){const i=n.get(o.path)||[];i.push(o),n.set(o.path,i)}const r=(o,i)=>{if(o.length===0)return{message:i.map(y=>y.message).join("; ")};const[u,...c]=o,p=r(c,i);return{dependencies:{[u]:p}}},s={},a={};for(const[o,i]of n.entries())if(o===""||o==="/")s.message=i.map(u=>u.message).join("; ");else{const u=o.split("/").filter(c=>c!=="");if(u.length===1)a[u[0]]={message:i.map(c=>c.message).join("; ")};else{const[c,...p]=u;a[c]=r(p,i)}}return Object.keys(a).length>0&&(s.dependencies=a),D.Validation.invalid(s)}function xn({schema:e,initialValue:t,validationMode:n,validateDebounceMs:r,widgetRegistry:s,readOnly:a,locale:o,onChange:i,onValidate:u,applySchemaDefaults:c=!0},p){const y=t!==void 0?l.Value.get(t):void 0,g=ze(e);let d;t===void 0?d=g??{}:c?d=b.deepMergeDefaults(g,y):d=y;const h=re(e),m=n??"onTouched",x=C=>{const P=h.validate(C);if(u&&!P.isValid){const W=ie(P.errors);u(W)}return vn(P)},{controller:v,setStatus:$}=f.useController({initialValue:d,validationMode:m,validateDebounceMs:r,validate:m==="onSubmit"?void 0:x,onChange:i}),T=()=>{v.dispose()},I=l.Fragment(l.OnDispose(T),Le({schema:e,controller:v,widgetRegistry:s,readOnly:a,locale:o}));return p({Form:I,controller:v,setStatus:$})}exports.DefaultWidgetRegistry=L;exports.INTEGER_BOUNDS=V;exports.JSONStructureForm=xn;exports.RefResolver=xe;exports.StructureContext=K;exports.StructureControl=Le;exports.StructureGenericControl=S;exports.createExtendsResolver=nt;exports.createRefResolver=J;exports.createStructureContext=Te;exports.createValidator=re;exports.createWidgetRegistry=Jt;exports.ensureDefaultWidgets=nn;exports.extractStructureDefaults=ze;exports.forFormat=Zt;exports.forMatcher=Xt;exports.forType=Kt;exports.forTypeAndFormat=Ht;exports.formatValidationError=We;exports.formatValidationErrors=ie;exports.getChildErrors=zt;exports.getErrorsForPath=Bt;exports.getExplicitWidgetName=se;exports.getGlobalWidgetRegistry=q;exports.getNonNullTypes=G;exports.getResolvedType=Z;exports.getWidgetOptions=Yt;exports.groupErrorsByPath=Ut;exports.hasConstValue=he;exports.hasCustomWidget=Qt;exports.hasDefaultWidgets=_e;exports.hasEnumValue=ge;exports.hasErrorsAtPath=_t;exports.isArrayTypeDefinition=X;exports.isBigIntType=pe;exports.isChoiceTypeDefinition=te;exports.isCompoundType=He;exports.isFloatType=_;exports.isIntegerType=k;exports.isMapTypeDefinition=Q;exports.isNamespace=me;exports.isNullableType=be;exports.isNumericType=de;exports.isObjectTypeDefinition=R;exports.isPrimitiveType=fe;exports.isSetTypeDefinition=Y;exports.isTemporalType=z;exports.isTupleTypeDefinition=ee;exports.isTypeDefinition=ye;exports.isTypeReference=O;exports.mergeWidgetOptions=tn;exports.parseRefPath=ve;exports.registerDefaultWidgets=Be;exports.resolveExtends=ne;exports.resolveRef=A;exports.resolveTypeReference=Ye;exports.resolveWidget=Ue;exports.resolveWidgetWithOverride=en;exports.setGlobalWidgetRegistry=Gt;exports.validate=kt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),D=require("@tempots/std"),f=require("../use-form-CaW192gw.cjs"),b=require("../deep-merge-Bz9HHpRt.cjs"),Ze=require("../text-input-DL9FvpTZ.cjs"),j=require("../duration-input-g-cQ3cs1.cjs"),B=require("../input-container-Di1YvVB_.cjs"),N=require("../stack-dwLevGa2.cjs");function pe(e){return e==="int64"||e==="int128"||e==="uint64"||e==="uint128"}function k(e){return e==="int8"||e==="int16"||e==="int32"||e==="int64"||e==="int128"||e==="uint8"||e==="uint16"||e==="uint32"||e==="uint64"||e==="uint128"}function _(e){return e==="float"||e==="double"||e==="decimal"}function de(e){return k(e)||_(e)}function z(e){return e==="date"||e==="datetime"||e==="time"||e==="duration"}function fe(e){return e==="string"||e==="boolean"||e==="null"||de(e)||z(e)||e==="uuid"||e==="uri"||e==="binary"}function He(e){return e==="object"||e==="array"||e==="set"||e==="map"||e==="tuple"||e==="choice"||e==="any"}function O(e){return typeof e=="object"&&e!==null&&"$ref"in e}function me(e){return typeof e=="object"&&e!==null&&!("type"in e)&&!("$ref"in e)&&!("enum"in e)&&!("const"in e)}function ye(e){return typeof e=="object"&&e!==null&&("type"in e||"$ref"in e||"enum"in e||"const"in e)}function R(e){return e.type==="object"&&"properties"in e}function X(e){return e.type==="array"&&"items"in e}function Y(e){return e.type==="set"&&"items"in e}function Q(e){return e.type==="map"&&"values"in e}function ee(e){return e.type==="tuple"&&"tuple"in e}function te(e){return e.type==="choice"&&"choices"in e}function ge(e){return"enum"in e&&Array.isArray(e.enum)}function he(e){return"const"in e}function Z(e){return e===void 0?null:typeof e=="string"||Array.isArray(e)?e:(O(e),null)}function be(e){return e===void 0?!1:e==="null"?!0:Array.isArray(e)?e.includes("null"):!1}function G(e){return typeof e=="string"?e==="null"?[]:[e]:Array.isArray(e)?e.filter(t=>t!=="null"):[]}const V={int8:{min:-128n,max:127n},int16:{min:-32768n,max:32767n},int32:{min:-2147483648n,max:2147483647n},int64:{min:-9223372036854775808n,max:9223372036854775807n},int128:{min:-170141183460469231731687303715884105728n,max:170141183460469231731687303715884105727n},uint8:{min:0n,max:255n},uint16:{min:0n,max:65535n},uint32:{min:0n,max:4294967295n},uint64:{min:0n,max:18446744073709551615n},uint128:{min:0n,max:340282366920938463463374607431768211455n}};function ve(e){return e.startsWith("#/")?e.slice(2).split("/"):e.includes("/")?e.split("/"):["definitions",e]}function Xe(e,t){let n=e;for(const r of t){if(n==null||typeof n!="object")return;n=n[r]}return n}function A(e,t){const n=ve(e),r=Xe(t,n);if(r==null){console.warn(`Failed to resolve $ref: ${e}`);return}if(ye(r))return r;if(me(r)){console.warn(`$ref "${e}" points to a namespace, not a type definition`);return}}function Ye(e,t){return A(e.$ref,t)}class xe{schema;visited=new Set;constructor(t){this.schema=t}resolve(t){if(this.visited.has(t)){console.warn(`Circular reference detected: ${t}`);return}this.visited.add(t);try{const n=A(t,this.schema);if(n?.type&&O(n.type)){const r=this.resolve(n.type.$ref);if(r){const{type:s,...a}=n;return{...r,...a}}}return n}finally{this.visited.delete(t)}}resolveDefinition(t){if(t.type&&O(t.type)){const n=this.resolve(t.type.$ref);if(n){const{type:r,...s}=t;return{...n,...s}}}return t}reset(){this.visited.clear()}}function J(e){return new xe(e)}class K{schema;definition;path;readOnly;locale;widgetRegistry;isPropertyRequired;suppressLabel;refResolver;constructor(t){this.schema=t.schema,this.definition=t.definition,this.path=t.path,this.readOnly=t.readOnly??!1,this.locale=t.locale,this.widgetRegistry=t.widgetRegistry,this.isPropertyRequired=t.isPropertyRequired??!1,this.suppressLabel=t.suppressLabel??!1,this.refResolver=t.refResolver??J(t.schema)}with(t){return new K({schema:this.schema,definition:t.definition??this.definition,path:t.path??this.path,readOnly:t.readOnly??this.readOnly,locale:t.locale??this.locale,widgetRegistry:t.widgetRegistry??this.widgetRegistry,isPropertyRequired:t.isPropertyRequired??this.isPropertyRequired,suppressLabel:t.suppressLabel??this.suppressLabel,refResolver:this.refResolver})}append(t){return this.with({path:[...this.path,t]})}get isRoot(){return this.path.length===0}get name(){const t=this.path[this.path.length-1];return typeof t=="string"?t:void 0}get widgetName(){return this.path.map(String).join(".")}get resolvedType(){const t=this.definition.type;if(!t)return null;if(O(t)){const n=this.refResolver.resolve(t.$ref);return n?.type?Z(n.type):null}return Z(t)}get primaryType(){const t=this.resolvedType;return t?typeof t=="string"?t==="null"?null:t:G(t)[0]??null:null}get isNullable(){return be(this.definition.type)}get isRequired(){return this.isPropertyRequired}get isOptional(){return!this.isPropertyRequired}get isDeprecated(){return this.definition.deprecated===!0}get isAbstract(){return this.definition.abstract===!0}get isPrimitive(){const t=this.primaryType;return t!=null&&fe(t)}get description(){return this.definition.description}get examples(){return this.definition.examples}get defaultValue(){return this.definition.default}get unit(){return this.definition.unit}get currency(){return this.definition.currency}get label(){if(this.locale&&this.definition.altnames){const n=`lang:${this.locale}`,r=this.definition.altnames[n];if(r)return r}if(this.definition.name)return this.definition.name;const t=this.name;return t?D.upperCaseFirst(D.humanize(t)):""}get altnames(){return this.definition.altnames}get jsonPath(){return this.path.length===0?"":"/"+this.path.map(String).join("/")}resolveRef(t){return this.refResolver.resolve(t)}get hasEnum(){return"enum"in this.definition&&Array.isArray(this.definition.enum)}get enumValues(){if("enum"in this.definition)return this.definition.enum}get hasConst(){return"const"in this.definition}get constValue(){if("const"in this.definition)return this.definition.const}get format(){if("format"in this.definition)return this.definition.format}}function Te(e,t){let n;const r=J(e);if(e.$root){const s=r.resolve(e.$root);s?n=s:(console.warn(`Failed to resolve $root: ${e.$root}`),n=e)}else e.type||e.properties?n=e:n={type:"any"};return new K({schema:e,definition:n,path:[],readOnly:t?.readOnly,locale:t?.locale,widgetRegistry:t?.widgetRegistry,refResolver:r})}function ne(e,t,n){const r=[],s=[];if(!e.$extends)return{merged:e,inheritanceChain:r,errors:s};const a=Array.isArray(e.$extends)?e.$extends:[e.$extends],o=new Set,i=(p,y=0)=>{if(y>100)return s.push({path:p.join(" -> "),message:"Maximum inheritance depth exceeded"}),[];const g=[];for(const d of p){if(o.has(d)){s.push({path:d,message:`Circular inheritance detected: ${d}`});continue}o.add(d),r.push(d);const h=A(d,t);if(!h){s.push({path:d,message:`Failed to resolve base type: ${d}`});continue}if(h.$extends){const m=Array.isArray(h.$extends)?h.$extends:[h.$extends],x=i(m,y+1);g.push(...x)}g.push(h),o.delete(d)}return g},u=i(a);return{merged:Qe(u,e),inheritanceChain:r,errors:s}}function Qe(e,t){if(e.length===0)return t;let n={...e[0]};for(let a=1;a<e.length;a++)n=ae(n,e[a]);n=ae(n,t);const{$extends:r,...s}=n;return s}function ae(e,t){return R(e)&&R(t)?et(e,t):{...e,...t}}function et(e,t){const n={...e.properties??{},...t.properties??{}},r=oe(e.required),s=oe(t.required),a=tt([...r,...s]),o={...e,...t,type:"object",properties:n};return a.length>0&&(o.required=a),o}function oe(e){return e?e.length===0?[]:Array.isArray(e[0])?e.flat():e:[]}function tt(e){return[...new Set(e)]}function nt(e){const t=J(e);return{resolve:n=>(t.reset(),ne(n,e))}}function rt(){return l.html.span(l.attr.class("bc-json-structure-deprecated-badge"),l.attr.style("font-size: var(--font-size-xs); color: var(--color-warning-500, #d97706); background: var(--color-warning-100, #fef3c7); padding: 0.125em 0.5em; border-radius: var(--radius-sm); margin-inline-start: 0.5em; font-weight: normal;"),"(deprecated)")}function w(e,t){return!e||!t?e??"":l.html.span(e,rt())}function it(e){const t=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:t}}function $e({ctx:e,controller:t}){const n=it(e);return f.Control(Ze.TextInput,{...n,controller:b.transformEmptyStringToUndefined(t)})}function st(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Ce({ctx:e,controller:t}){const n=st(e),r=f.Control(f.CheckboxInput,{...n,controller:t});return e.isNullable?f.Control(f.CheckboxInput,{...n,controller:t,after:b.NullableResetAfter(t.signal,t.disabled,s=>t.change(s))}):r}function at(e,t){const n=V[t],r=Ie(e,n.min),s=Se(e,n.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof r=="bigint"?Number(r):r,max:typeof s=="bigint"?Number(s):s,step:1,placeholder:a}}function ot(e,t){const n=V[t],r=Ie(e,n.min),s=Se(e,n.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof r=="number"?BigInt(r):r,max:typeof s=="number"?BigInt(s):s,placeholder:a}}function Ie(e,t){const n=e.definition;if(n.minimum!==void 0){const r=typeof n.minimum=="string"?BigInt(n.minimum):n.minimum;return typeof r=="bigint"?r>t?r:t:BigInt(r)>t?r:Number(t)}if(n.exclusiveMinimum!==void 0){const r=typeof n.exclusiveMinimum=="string"?BigInt(n.exclusiveMinimum):n.exclusiveMinimum,s=typeof r=="bigint"?r+1n:r+1;return typeof s=="bigint"?s>t?s:t:BigInt(s)>t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Se(e,t){const n=e.definition;if(n.maximum!==void 0){const r=typeof n.maximum=="string"?BigInt(n.maximum):n.maximum;return typeof r=="bigint"?r<t?r:t:BigInt(r)<t?r:Number(t)}if(n.exclusiveMaximum!==void 0){const r=typeof n.exclusiveMaximum=="string"?BigInt(n.exclusiveMaximum):n.exclusiveMaximum,s=typeof r=="bigint"?r-1n:r-1;return typeof s=="bigint"?s<t?s:t:BigInt(s)<t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function we({ctx:e,controller:t,intType:n}){if(pe(n)){const s=ot(e,n);return e.isNullable?f.Control(j.NullableBigintInput,{...s,controller:t}):f.Control(j.BigintInput,{...s,controller:t})}const r=at(e,n);return e.isNullable?f.Control(b.NullableNumberInput,{...r,controller:t}):f.Control(b.NumberInput,{...r,controller:t})}function ut(e,t){const n=e.definition;let r;n.multipleOf!==void 0?r=n.multipleOf:t==="decimal"&&n.scale!==void 0&&(r=Math.pow(10,-n.scale));const s=n.minimum!==void 0?typeof n.minimum=="string"?parseFloat(n.minimum):n.minimum:void 0,a=n.maximum!==void 0?typeof n.maximum=="string"?parseFloat(n.maximum):n.maximum:void 0,o=n.exclusiveMinimum!==void 0?typeof n.exclusiveMinimum=="string"?parseFloat(n.exclusiveMinimum):n.exclusiveMinimum:void 0,i=n.exclusiveMaximum!==void 0?typeof n.exclusiveMaximum=="string"?parseFloat(n.exclusiveMaximum):n.exclusiveMaximum:void 0;let u=e.description;if(o!==void 0||i!==void 0){const p=[];o!==void 0&&p.push(`> ${o}`),i!==void 0&&p.push(`< ${i}`);const y=`Valid range: ${p.join(" and ")}`;u=u?`${u} (${y})`:y}const c=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:u,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:s??o,max:a??i,step:r,placeholder:c}}function je({ctx:e,controller:t,floatType:n}){const r=ut(e,n);return e.isNullable?f.Control(b.NullableNumberInput,{...r,controller:t}):f.Control(b.NumberInput,{...r,controller:t})}function lt(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}function Me({ctx:e,controller:t}){const n=lt(e);return f.Control(b.UuidInput,{...n,controller:b.transformEmptyStringToUndefined(t)})}function ct(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Oe({ctx:e,controller:t,temporalType:n}){const r=ct(e);switch(n){case"date":return e.isNullable?f.Control(j.NullablePlainDateInput,{...r,controller:t}):f.Control(j.PlainDateInput,{...r,controller:t});case"datetime":return e.isNullable?f.Control(j.NullablePlainDateTimeInput,{...r,controller:t}):f.Control(j.PlainDateTimeInput,{...r,controller:t});case"time":return e.isNullable?f.Control(j.NullablePlainTimeInput,{...r,controller:t}):f.Control(j.PlainTimeInput,{...r,controller:t});case"duration":return e.isNullable?f.Control(b.NullableDurationInput,{...r,controller:t}):f.Control(j.DurationInput,{...r,controller:t});default:return console.warn(`Unknown temporal type: ${n}`),l.Empty}}function pt(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"https://example.com"}}function De({ctx:e,controller:t}){const n=pt(e);return f.Control(b.UrlInput,{...n,controller:b.transformEmptyStringToUndefined(t)})}function dt(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Re({ctx:e,controller:t}){const n=dt(e);return f.Control(j.FileInput,{...n,controller:t})}function ft(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"Enter JSON value"}}function mt(e){return e.transform(t=>t===void 0?void 0:JSON.stringify(t,null,2),t=>{if(!(t===void 0||t.trim()===""))try{return JSON.parse(t)}catch{return t}})}function H({ctx:e,controller:t}){const n=ft(e);return f.Control(b.TextArea,{...n,controller:mt(t)})}function E(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function F(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function yt(e,t){return!t||t.length===0?!1:typeof t[0]=="string"?t.includes(e):Array.isArray(t[0])?t.some(n=>n.includes(e)):!1}function gt(e,t="property"){if(!e.has(t))return t;let n=1;for(;e.has(`${t}${n}`);)n++;return`${t}${n}`}function Ae({ctx:e,controller:t}){const n=e.definition;if(n.type!=="object"||!("properties"in n))return console.warn("StructureObjectControl requires an ObjectTypeDefinition"),l.html.div("Invalid object definition");const r=n.properties,s=n.required,a=n.additionalProperties,o=a!==!1,i=typeof a=="object"&&a!==null?a:{type:"any"},u=n.minProperties??0,c=n.maxProperties??1/0,p=D.objectEntries(r),y=new Set(p.map(([v])=>v)),g=p.map(([v,$])=>{const T=v,I=t.field(T),C=yt(T,s);return S({ctx:e.with({definition:$,isPropertyRequired:C,suppressLabel:!1}).append(T),controller:I})}),d=l.MapSignal(t.signal,v=>{const $=Object.keys(v??{}),T=$.filter(C=>!y.has(C));if(T.length===0)return l.Empty;const I=$.length>u&&!e.readOnly;return l.Fragment(...T.map(C=>{const P=t.field(C);return l.html.div(l.attr.class("bc-json-structure-additional-property"),l.html.div(l.attr.class("bc-json-structure-additional-property-header"),l.html.strong(`${C}:`),B.Button({variant:"text",size:"xs",onClick:()=>{const W={...l.Value.get(t.signal)??{}};delete W[C],t.change(W)},disabled:!I},"Remove")),l.html.div(l.attr.class("bc-json-structure-additional-property-value"),S({ctx:e.with({definition:i,isPropertyRequired:!1,suppressLabel:!0}).append(C),controller:P})))}))}),h=o&&!e.readOnly?B.Button({variant:"outline",size:"sm",disabled:l.Value.map(t.signal,v=>Object.keys(v??{}).length>=c),onClick:()=>{const v=l.Value.get(t.signal)??{},$=new Set(Object.keys(v)),T=gt($),I=F(i);t.change({...v,[T]:I})}},"Add Property"):null,m=l.html.div(l.attr.class("bc-json-structure-object-fields"),...g,d,h),x=l.html.div(l.attr.class("bc-json-structure-object"),m);return!e.suppressLabel&&e.name?f.InputWrapper({...E(e),content:x}):x}function Ne({ctx:e,controller:t}){const n=e.definition;if(n.type!=="array"||!("items"in n))return console.warn("StructureArrayControl requires an ArrayTypeDefinition"),l.html.div("Invalid array definition");const r=n.items,s=n.minItems??0,a=n.maxItems??1/0,o=l.computedOf(t.signal)(u=>(u?.length??0)<a),i=l.computedOf(t.signal)(u=>(u?.length??0)>s);return b.ListControl({...E(e),controller:t,createItem:()=>F(r),showAdd:!0,addDisabled:l.computedOf(o)(u=>!u||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(u=>!u||e.readOnly),element:u=>{const c=u.position.index,p=u.item;return S({ctx:e.with({definition:r,suppressLabel:!0}).append(c),controller:p})}})}function ke({ctx:e,controller:t}){const n=e.definition;if(n.type!=="set"||!("items"in n))return console.warn("StructureSetControl requires a SetTypeDefinition"),l.html.div("Invalid set definition");const r=n.items,s=n.minItems??0,a=n.maxItems??1/0,o=l.computedOf(t.signal)(c=>(c?.length??0)<a),i=l.computedOf(t.signal)(c=>(c?.length??0)>s),u=l.computedOf(t.signal)(c=>{if(!c||c.length===0)return new Set;const p=new Map,y=new Set;for(let g=0;g<c.length;g++){const d=JSON.stringify(c[g]);p.has(d)?(y.add(p.get(d)),y.add(g)):p.set(d,g)}return y});return b.ListControl({...E(e),controller:t,createItem:()=>F(r),showAdd:!0,addDisabled:l.computedOf(o)(c=>!c||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(c=>!c||e.readOnly),element:c=>{const p=c.position.index,y=c.item,g=u.map(h=>h.has(p)),d=S({ctx:e.with({definition:r,suppressLabel:!0}).append(p),controller:y});return l.Fragment(d,l.When(g,()=>N.Label(l.attr.class("bc-json-structure-set-error"),"Duplicate value - sets must contain unique items")))}})}function ht(e,t="key"){if(!e.has(t))return t;let n=1;for(;e.has(`${t}${n}`);)n++;return`${t}${n}`}function Fe({ctx:e,controller:t}){const n=e.definition;if(n.type!=="map"||!("values"in n))return console.warn("StructureMapControl requires a MapTypeDefinition"),l.html.div("Invalid map definition");const r=n.values,s=n.minProperties??0,a=n.maxProperties??1/0,o=l.MapSignal(t.signal,p=>{const y=Object.keys(p??{});if(y.length===0)return l.Empty;const g=y.length>s&&!e.readOnly;return l.Fragment(...y.map(d=>{const h=t.field(d);return l.html.div(l.attr.class("bc-json-structure-map-entry"),l.html.div(l.attr.class("bc-json-structure-map-entry-header"),l.html.strong(l.attr.class("bc-json-structure-map-entry-key"),`${d}:`),B.Button({variant:"text",size:"xs",onClick:()=>{const m={...l.Value.get(t.signal)??{}};delete m[d],t.change(m)},disabled:!g},"Remove")),l.html.div(l.attr.class("bc-json-structure-map-entry-value"),S({ctx:e.with({definition:r,suppressLabel:!0}).append(d),controller:h})))}))}),i=e.readOnly?null:B.Button({variant:"outline",size:"sm",disabled:l.Value.map(t.signal,p=>Object.keys(p??{}).length>=a),onClick:()=>{const p=l.Value.get(t.signal)??{},y=new Set(Object.keys(p)),g=ht(y),d=F(r);t.change({...p,[g]:d})}},"Add Entry"),u=l.html.div(l.attr.class("bc-json-structure-map-entries"),o,i),c=l.html.div(l.attr.class("bc-json-structure-map"),u);return!e.suppressLabel&&e.name?f.InputWrapper({...E(e),content:c}):c}function qe({ctx:e,controller:t}){const n=e.definition;if(n.type!=="tuple"||!("tuple"in n)||!("properties"in n))return console.warn("StructureTupleControl requires a TupleTypeDefinition"),l.html.div("Invalid tuple definition");const r=n.tuple,s=n.properties,a=t.signal.value;if(!Array.isArray(a)||a.length!==r.length){const i=r.map(u=>{const c=s[u];return c?F(c):void 0});t.change(i)}const o=E(e);return l.html.div(l.attr.class("bc-json-structure-tuple"),o.label?l.html.label(l.attr.class("bc-json-structure-tuple-label"),o.label,o.required?l.html.span(l.attr.class("bc-required-indicator"),"*"):null):null,o.description?l.html.div(l.attr.class("bc-json-structure-tuple-description"),o.description):null,l.html.div(l.attr.class("bc-json-structure-tuple-elements"),...r.map((i,u)=>{const c=s[i];if(!c)return console.warn(`Tuple element "${i}" at index ${u} not found in properties`),l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.span(`Missing definition for "${i}"`));const p=t.item(u),y=c.name||i;return l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.div(l.attr.class("bc-json-structure-tuple-element-header"),l.html.span(l.attr.class("bc-json-structure-tuple-position"),`[${u}]`),l.html.span(l.attr.class("bc-json-structure-tuple-element-name"),y)),l.html.div(l.attr.class("bc-json-structure-tuple-element-control"),S({ctx:e.with({definition:c,suppressLabel:!0}).append(u),controller:p})))})))}function bt({options:e,selected:t,onChange:n,disabled:r}){return b.NativeSelect({options:e.map(s=>({type:"value",value:s.value,label:s.label})),value:t,onChange:n,disabled:r})}function vt({ctx:e,selector:t,inner:n}){const r=N.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),t,n);return e.isRoot?r:f.InputWrapper({label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,content:r})}function xt(e,t,n){if(!e||typeof e!="object")return null;const r=e;if(n&&n in r){const a=r[n];if(typeof a=="string"&&a in t)return a}const s=Object.keys(r);if(s.length===1){const a=s[0];if(a in t)return a}return null}function Tt(e,t,n){if(!e||typeof e!="object")return;const r=e;if(n&&n in r){const{[n]:s,...a}=r;return a}if(t in r)return r[t]}function ue(e,t,n){return n?e&&typeof e=="object"?{[n]:t,...e}:{[n]:t}:{[t]:e}}function Pe({ctx:e,controller:t}){const n=e.definition;if(!n.choices||typeof n.choices!="object")return console.warn("StructureChoiceControl requires choices property"),l.html.div(l.attr.class("bc-json-structure-error"),"Invalid choice definition: missing choices");const r=n.choices,s=n.selector,a=Object.keys(r);if(a.length===0)return l.html.div(l.attr.class("bc-json-structure-error"),"Choice type has no variants defined");const o=a.map(m=>{const v=r[m].name||m;return{value:m,label:v}}),i=l.computedOf(t.signal)(m=>xt(m,r,s)),u=l.Value.get(i)||a[0],c=l.prop(u);t.onDispose(()=>c.dispose());let p=!1;const y=i.on(m=>{!p&&m!==null&&c.set(m)});t.onDispose(y);const d=bt({options:o,selected:c,onChange:m=>{p=!0,c.set(m);const x=r[m];if(x){const v=F(x),$=ue(v,m,s);t.change($)}},disabled:e.readOnly||e.isDeprecated}),h=l.MapSignal(c,m=>{const x=r[l.Value.get(m)];if(!x)return l.html.div(l.attr.class("bc-json-structure-error"),`Choice variant not found: ${l.Value.get(m)}`);const v=l.computedOf(t.signal)(I=>Tt(I,l.Value.get(m),s)),$=I=>{const C=ue(I,l.Value.get(m),s);t.change(C)},T=new f.Controller([...t.path,l.Value.get(m)],$,v,t.status,{disabled:t.disabled},void 0);return t.onDispose(()=>T.dispose()),S({ctx:e.with({definition:x,suppressLabel:!0}).append(l.Value.get(m)),controller:T})});return vt({ctx:e,selector:d,inner:h})}function $t(e){return{label:e.suppressLabel?void 0:w(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Ve({ctx:e,controller:t}){const n=$t(e);return b.NativeSelectControl({...n,options:(e.enumValues??[]).map(r=>({type:"value",value:r,label:String(r)})),controller:t})}function Ee({ctx:e,controller:t}){return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==e.constValue&&t.change(e.constValue)}),b.Group(N.MutedLabel(e.label,": "),N.Label(String(e.constValue))))}function Ct(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function It(e,t){if(e===null)return t.includes("null")?"null":null;if(e===void 0)return t.includes("string")?"string":t[0]??null;switch(typeof e){case"string":return t.includes("uuid")?"uuid":t.includes("uri")?"uri":t.includes("date")?"date":t.includes("datetime")?"datetime":t.includes("time")?"time":t.includes("duration")?"duration":t.includes("string")?"string":null;case"number":{if(Number.isInteger(e)){if(t.includes("int32"))return"int32";if(t.includes("int64"))return"int64";if(t.includes("uint32"))return"uint32";if(t.includes("uint64"))return"uint64";if(t.includes("int16"))return"int16";if(t.includes("int8"))return"int8";if(t.includes("uint16"))return"uint16";if(t.includes("uint8"))return"uint8"}return t.includes("double")?"double":t.includes("float")?"float":t.includes("decimal")?"decimal":null}case"bigint":return t.includes("int128")?"int128":t.includes("int64")?"int64":t.includes("uint128")?"uint128":t.includes("uint64")?"uint64":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return e instanceof File||e instanceof Blob?t.includes("binary")?"binary":null:Array.isArray(e)?t.includes("array")?"array":t.includes("set")?"set":t.includes("tuple")?"tuple":null:t.includes("object")?"object":t.includes("map")?"map":null;default:return null}}function St(e,t){try{switch(t){case"string":case"uuid":case"uri":case"date":case"datetime":case"time":case"duration":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"int8":case"int16":case"int32":case"uint8":case"uint16":case"uint32":return typeof e=="number"&&Number.isInteger(e)?{ok:!0,value:e}:typeof e=="string"?/^[-+]?\d+$/.test(e.trim())?{ok:!0,value:parseInt(e,10)}:{ok:!1}:typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1};case"int64":case"int128":case"uint64":case"uint128":{if(typeof e=="bigint")return{ok:!0,value:e};if(typeof e=="number"&&Number.isInteger(e))return{ok:!0,value:BigInt(e)};if(typeof e=="string")try{return{ok:!0,value:BigInt(e.trim())}}catch{return{ok:!1}}return{ok:!1}}case"float":case"double":case"decimal":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const n=Number(e);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1}}return typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1}}case"boolean":{if(typeof e=="boolean")return{ok:!0,value:e};if(typeof e=="string"){const n=e.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"?{ok:!0,value:!0}:n==="false"||n==="0"||n==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":case"set":case"tuple":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":case"map":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"binary":return e instanceof File||e instanceof Blob?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null};case"any":case"choice":return{ok:!0,value:e};default:return{ok:!1}}}catch{return{ok:!1}}}function wt(e){switch(e){case"null":return null;case"array":case"set":case"tuple":return[];case"object":case"map":return{};case"binary":return;default:return}}function jt(e){return e.map(t=>({key:t,label:D.upperCaseFirst(t),detect:n=>It(n,[t])===t,convert:n=>St(n,t),defaultValue:()=>wt(t)}))}function Mt({options:e,selected:t,onChange:n}){if((e.length<=3?"segmented":"select")==="segmented"){const a=Object.fromEntries(e.map(o=>[o.value,o.label]));return b.SegmentedInput({options:a,value:t,onChange:o=>n(o),size:"sm"})}return b.NativeSelect({options:e.map(a=>({type:"value",value:a.value,label:a.label})),value:t,onChange:n})}function Ot({ctx:e,showSelector:t,selector:n,inner:r}){return e.isRoot?t?N.Stack(l.attr.class("bc-stack--gap-2"),n,r):r:f.InputWrapper({...Ct(e),content:t?N.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),n,r):r})}function Dt({ctx:e,controller:t}){const n=e.definition,r=n.type;let s;if(Array.isArray(r))s=r;else return console.warn("StructureUnionControl called with non-array type"),S({ctx:e,controller:t});const a=s.includes("null"),o=G(r),i=a&&o.length>0?o:s,u=jt(i),c=new b.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},u);t.onDispose(()=>c.dispose());const p=d=>Mt({options:i.map(h=>({value:h,label:D.upperCaseFirst(h)})),selected:c.activeBranch,onChange:d}),y=d=>{c.switchToBranch(d,!1)},g=l.MapSignal(c.activeBranch,d=>{const h=l.Value.get(d),m=c.getBranchController(h),x=e.with({definition:{...n,type:h},suppressLabel:!e.isRoot});return S({ctx:x,controller:m})});return Ot({ctx:e,showSelector:i.length>1,selector:p(y),inner:g})}function S({ctx:e,controller:t}){let n=e;const r=e.definition;if(r.type&&O(r.type)){const i=e.resolveRef(r.type.$ref);if(i){const{type:u,...c}=r,p={...i,...c};n=e.with({definition:p})}}if(n.definition.$extends){const{merged:i}=ne(n.definition,e.schema);n=n.with({definition:i})}const s=n.widgetRegistry;if(s){const i=s.findBestWidget(n);if(i)return i.registration.factory({controller:t,ctx:n})}if(ge(n.definition))return Ve({ctx:n,controller:t});if(he(n.definition))return Ee({ctx:n,controller:t});const a=n.resolvedType;if(Array.isArray(a)&&G(a).length>1)return Dt({ctx:n,controller:t});const o=n.primaryType;if(!o)return H({ctx:n,controller:t});if(R(n.definition)){const i=t instanceof f.ObjectController?t:t.object();return Ae({ctx:n,controller:i})}if(X(n.definition)){const i=t instanceof f.ArrayController?t:t.array();return Ne({ctx:n,controller:i})}if(Y(n.definition)){const i=t instanceof f.ArrayController?t:t.array();return ke({ctx:n,controller:i})}if(Q(n.definition)){const i=t instanceof f.ObjectController?t:t.object();return Fe({ctx:n,controller:i})}if(ee(n.definition)){const i=t instanceof f.ArrayController?t:t.array();return qe({ctx:n,controller:i})}if(te(n.definition))return Pe({ctx:n,controller:t});switch(o){case"string":return $e({ctx:n,controller:t});case"boolean":return Ce({ctx:n,controller:t});case"uuid":return Me({ctx:n,controller:t});case"uri":return De({ctx:n,controller:t});case"binary":return Re({ctx:n,controller:t});case"null":return Rt(n);case"any":return H({ctx:n,controller:t});default:return k(o)?we({ctx:n,controller:t,intType:o}):_(o)?je({ctx:n,controller:t,floatType:o}):z(o)?Oe({ctx:n,controller:t,temporalType:o}):(console.warn(`Unknown type: ${o}`),At(n,o))}}function Le({schema:e,controller:t,widgetRegistry:n,readOnly:r,locale:s}){const a=Te(e,{widgetRegistry:n,readOnly:r,locale:s});return S({ctx:a,controller:t})}function Rt(e){return l.html.div(l.attr.class("bc-json-structure-placeholder"),l.html.span(`[Null: ${e.label}]`),l.html.em("null"))}function At(e,t){return l.html.div(l.attr.class("bc-json-structure-unknown"),l.html.span(`Unknown type: ${t}`),l.html.em(`at path: ${e.jsonPath}`))}function re(e,t){return new Nt(e,t)}class Nt{schema;options;constructor(t,n){this.schema=t,this.options=n??{}}validate(t){const n=[];return this.validateValue(t,this.schema,"",n),{isValid:n.length===0,errors:n}}validateAt(t,n){return this.validate(t)}validateValue(t,n,r,s){if(this.options.stopOnFirstError&&s.length>0)return;if(t===null){const c=n.type;if(c==="null"||Array.isArray(c)&&c.includes("null"))return;s.push({path:r,type:"type",expected:c,actual:"null"});return}if("enum"in n&&Array.isArray(n.enum)){n.enum.includes(t)||s.push({path:r,type:"enum",expected:n.enum,actual:t});return}if("const"in n){t!==n.const&&s.push({path:r,type:"const",expected:n.const,actual:t});return}const a=n.type;if(!a)return;const i=(Array.isArray(a)?a:[a]).filter(c=>typeof c=="string");!i.some(c=>this.checkType(t,c,n,r,s))&&i.length>0&&s.push({path:r,type:"type",expected:a,actual:typeof t})}checkType(t,n,r,s,a){switch(n){case"string":return this.validateString(t,r,s,a);case"boolean":return typeof t=="boolean";case"null":return t===null;case"object":return this.validateObject(t,r,s,a);case"array":return this.validateArray(t,r,s,a);case"set":return this.validateSet(t,r,s,a);case"map":return this.validateMap(t,r,s,a);case"tuple":return this.validateTuple(t,r,s,a);case"choice":return this.validateChoice(t,r,s,a);case"any":return!0;default:return k(n)?this.validateInteger(t,n,r,s,a):_(n)?this.validateFloat(t,r,s,a):z(n)?this.validateTemporal(t,n,s,a):n==="uuid"?this.validateUuid(t,s,a):n==="uri"?this.validateUri(t,s,a):n==="binary"?this.validateBinary(t,s,a):!1}}validateString(t,n,r,s){if(typeof t!="string")return!1;const a=n;if(a.minLength!==void 0&&t.length<a.minLength&&s.push({path:r,type:"minLength",expected:a.minLength,actual:t.length}),a.maxLength!==void 0&&t.length>a.maxLength&&s.push({path:r,type:"maxLength",expected:a.maxLength,actual:t.length}),a.pattern!==void 0)try{new RegExp(a.pattern).test(t)||s.push({path:r,type:"pattern",expected:a.pattern,actual:t})}catch{}return!0}validateInteger(t,n,r,s,a){if(typeof t!="number"&&typeof t!="bigint")return!1;if(typeof t=="number"&&!Number.isInteger(t))return a.push({path:s,type:"type",expected:n,actual:"float"}),!1;if(k(n)){const o=V[n],i=typeof t=="bigint"?t:BigInt(Math.round(t));(i<o.min||i>o.max)&&a.push({path:s,type:"integer_bounds",expected:{min:o.min.toString(),max:o.max.toString()},actual:i.toString(),context:{type:n}})}return this.validateNumericConstraints(t,r,s,a),!0}validateFloat(t,n,r,s){return typeof t!="number"?!1:(this.validateNumericConstraints(t,n,r,s),!0)}validateNumericConstraints(t,n,r,s){const a=n,o=typeof t=="bigint"?Number(t):t;if(a.minimum!==void 0){const i=typeof a.minimum=="string"?Number(a.minimum):a.minimum;o<i&&s.push({path:r,type:"minimum",expected:i,actual:o})}if(a.maximum!==void 0){const i=typeof a.maximum=="string"?Number(a.maximum):a.maximum;o>i&&s.push({path:r,type:"maximum",expected:i,actual:o})}if(a.exclusiveMinimum!==void 0){const i=typeof a.exclusiveMinimum=="string"?Number(a.exclusiveMinimum):a.exclusiveMinimum;o<=i&&s.push({path:r,type:"exclusiveMinimum",expected:i,actual:o})}if(a.exclusiveMaximum!==void 0){const i=typeof a.exclusiveMaximum=="string"?Number(a.exclusiveMaximum):a.exclusiveMaximum;o>=i&&s.push({path:r,type:"exclusiveMaximum",expected:i,actual:o})}a.multipleOf!==void 0&&typeof t=="number"&&t%a.multipleOf!==0&&s.push({path:r,type:"multipleOf",expected:a.multipleOf,actual:t})}validateTemporal(t,n,r,s){if(typeof t!="string")return!1;const o={date:/^\d{4}-\d{2}-\d{2}$/,datetime:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/,time:/^\d{2}:\d{2}:\d{2}(\.\d+)?$/,duration:/^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/}[n];return o&&!o.test(t)?(s.push({path:r,type:"format",expected:n,actual:t}),!1):!0}validateUuid(t,n,r){return typeof t!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?!0:(r.push({path:n,type:"format",expected:"uuid",actual:t}),!1)}validateUri(t,n,r){if(typeof t!="string")return!1;try{return new URL(t),!0}catch{return r.push({path:n,type:"format",expected:"uri",actual:t}),!1}}validateBinary(t,n,r){return t instanceof Uint8Array?!0:typeof t!="string"?!1:/^[A-Za-z0-9+/]*={0,2}$/.test(t)?!0:(r.push({path:n,type:"format",expected:"binary",actual:t}),!1)}validateObject(t,n,r,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!R(n))return!0;const a=t,o=n.required;if(o){const i=Array.isArray(o[0])?o.flat():o;for(const u of i)u in a||s.push({path:r?`${r}/${u}`:`/${u}`,type:"required",expected:u})}for(const[i,u]of Object.entries(a)){const c=n.properties?.[i];if(c){const p=r?`${r}/${i}`:`/${i}`;this.validateValue(u,c,p,s)}else if(n.additionalProperties===!1)s.push({path:r?`${r}/${i}`:`/${i}`,type:"additionalProperties",actual:i});else if(typeof n.additionalProperties=="object"){const p=r?`${r}/${i}`:`/${i}`;this.validateValue(u,n.additionalProperties,p,s)}}return!0}validateArray(t,n,r,s){if(!Array.isArray(t))return!1;if(!X(n))return!0;const a=n;a.minItems!==void 0&&t.length<a.minItems&&s.push({path:r,type:"minItems",expected:a.minItems,actual:t.length}),a.maxItems!==void 0&&t.length>a.maxItems&&s.push({path:r,type:"maxItems",expected:a.maxItems,actual:t.length});for(let o=0;o<t.length;o++){const i=`${r}/${o}`;this.validateValue(t[o],n.items,i,s)}return!0}validateSet(t,n,r,s){if(!Array.isArray(t))return!1;if(!Y(n))return!0;const a=new Set;for(let o=0;o<t.length;o++){const i=JSON.stringify(t[o]);a.has(i)&&s.push({path:`${r}/${o}`,type:"uniqueItems",actual:t[o]}),a.add(i)}return this.validateArray(t,n,r,s)}validateMap(t,n,r,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!Q(n))return!0;const a=t;for(const[o,i]of Object.entries(a)){const u=`${r}/${o}`;this.validateValue(i,n.values,u,s)}return!0}validateTuple(t,n,r,s){if(!Array.isArray(t))return!1;if(!ee(n))return!0;const a=n.tuple.length;t.length!==a&&s.push({path:r,type:"tuple_length",expected:a,actual:t.length});for(let o=0;o<n.tuple.length;o++){const i=n.tuple[o],u=n.properties?.[i];u&&o<t.length&&this.validateValue(t[o],u,`${r}/${o}`,s)}return!0}validateChoice(t,n,r,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!te(n))return!0;const a=t,o=Object.keys(n.choices),i=Object.keys(a).find(c=>o.includes(c));if(!i)return s.push({path:r,type:"choice",expected:o,actual:Object.keys(a)}),!1;const u=n.choices[i];return u&&this.validateValue(a[i],u,`${r}/${i}`,s),!0}}function kt(e,t,n){return re(e,n).validate(t)}function We(e,t){const n=Ft(e,t);return{path:e.path,message:n,code:e.type}}function ie(e,t){return e.map(n=>{const r=t?.get(n.path);return We(n,r)})}function Ft(e,t){switch(e.type){case"type":return`Expected ${le(e.expected)}, got ${qt(e.actual)}`;case"type_mismatch":return`Value must be of type ${le(e.expected)}`;case"minLength":return`Must be at least ${e.expected} characters`;case"maxLength":return`Must be no more than ${e.expected} characters`;case"pattern":return Pt(e,t);case"format":return Vt(e);case"minimum":return`Must be at least ${e.expected}`;case"maximum":return`Must be at most ${e.expected}`;case"exclusiveMinimum":return`Must be greater than ${e.expected}`;case"exclusiveMaximum":return`Must be less than ${e.expected}`;case"multipleOf":return`Must be a multiple of ${e.expected}`;case"integer_bounds":return Et(e);case"minItems":return`Must have at least ${e.expected} items`;case"maxItems":return`Must have no more than ${e.expected} items`;case"uniqueItems":return"All items must be unique";case"contains":return"Must contain at least one matching item";case"minContains":return`Must contain at least ${e.expected} matching items`;case"maxContains":return`Must contain no more than ${e.expected} matching items`;case"required":return"This field is required";case"minProperties":return`Must have at least ${e.expected} properties`;case"maxProperties":return`Must have no more than ${e.expected} properties`;case"additionalProperties":return`Unknown property: ${e.actual}`;case"dependentRequired":return Lt(e);case"enum":return Wt(e);case"const":return`Must be exactly ${JSON.stringify(e.expected)}`;case"ref_not_found":return`Invalid reference: ${e.expected}`;case"circular_ref":return"Circular reference detected";case"invalid":return"Invalid value";default:return e.context?.message??`Validation error: ${e.type}`}}function le(e){return typeof e=="string"?ce(e):Array.isArray(e)?e.map(ce).join(" or "):String(e)}function qt(e){return e===null?"null":e===void 0?"undefined":typeof e}function ce(e){return{string:"text",boolean:"true/false",int8:"integer (-128 to 127)",int16:"integer (-32768 to 32767)",int32:"integer",int64:"large integer",int128:"very large integer",uint8:"positive integer (0 to 255)",uint16:"positive integer (0 to 65535)",uint32:"positive integer",uint64:"large positive integer",uint128:"very large positive integer",float:"decimal number",double:"decimal number",decimal:"decimal number",date:"date",datetime:"date and time",time:"time",duration:"duration",uuid:"UUID",uri:"URL",binary:"binary data",object:"object",array:"list",set:"unique list",map:"key-value pairs",tuple:"ordered list",choice:"one of multiple options",any:"any value",null:"empty"}[e]??e}function Pt(e,t){const n=t?.description;if(n&&e.type==="pattern")return`Does not match required format: ${n}`;const r=e.expected;if(r){const a={"^[a-zA-Z]+$":"letters only","^[0-9]+$":"numbers only","^[a-zA-Z0-9]+$":"letters and numbers only","^\\S+$":"no spaces allowed","^[a-z]+$":"lowercase letters only","^[A-Z]+$":"uppercase letters only"}[r];if(a)return`Must be ${a}`}return"Does not match required format"}function Vt(e){const t=e.expected;return{email:"Must be a valid email address","date-time":"Must be a valid date and time",date:"Must be a valid date",time:"Must be a valid time",uri:"Must be a valid URL","uri-reference":"Must be a valid URL or relative path",uuid:"Must be a valid UUID",hostname:"Must be a valid hostname",ipv4:"Must be a valid IPv4 address",ipv6:"Must be a valid IPv6 address",regex:"Must be a valid regular expression","json-pointer":"Must be a valid JSON pointer"}[t]??`Must be a valid ${t}`}function Et(e){const t=e.context?.type;if(t&&k(t)){const n=V[t];return`Must be between ${n.min} and ${n.max}`}return"Value is out of range for this integer type"}function Lt(e){const t=e.context?.dependent,n=e.context?.required;return t&&n?.length?`When "${t}" is present, "${n.join('", "')}" must also be provided`:"Missing required dependent fields"}function Wt(e){const t=e.expected;return t&&t.length<=5?`Must be one of: ${t.map(r=>JSON.stringify(r)).join(", ")}`:"Invalid value"}function Ut(e){const t=new Map;for(const n of e){const r=t.get(n.path)??[];r.push(n),t.set(n.path,r)}return t}function Bt(e,t){return e.filter(n=>n.path===t)}function _t(e,t){return e.some(n=>n.path===t)}function zt(e,t){const n=t===""?"/":`${t}/`;return e.filter(r=>r.path.startsWith(n))}class L{registrations=new Map;parent;constructor(t){this.parent=t??null}register(t,n){this.registrations.set(t,n)}unregister(t){this.registrations.delete(t)}get(t){return this.registrations.get(t)??this.parent?.get(t)}has(t){return this.registrations.has(t)||(this.parent?.has(t)??!1)}names(){const t=this.parent?.names()??[],n=Array.from(this.registrations.keys());return[...new Set([...t,...n])]}getForType(t){const n=[];this.parent&&n.push(...this.parent.getForType(t));for(const r of this.registrations.values())r.supportedTypes?.includes(t)&&n.push(r);return n}getForFormat(t){const n=[];this.parent&&n.push(...this.parent.getForFormat(t));for(const r of this.registrations.values())r.supportedFormats?.includes(t)&&n.push(r);return n}findBestWidget(t){const n=[];for(const s of this.names()){const a=this.get(s);if(!a)continue;const o=this.scoreWidget(a,t);o>0&&n.push({name:s,registration:a,score:o})}if(n.length===0)return null;n.sort((s,a)=>a.score!==s.score?a.score-s.score:(a.registration.priority??0)-(s.registration.priority??0));const r=n[0];return{name:r.name,registration:r.registration}}scoreWidget(t,n){let r=0;if(t.matcher)if(t.matcher(n))r+=100;else return 0;const s=n.primaryType;s&&t.supportedTypes?.includes(s)&&(r+=50);const a=n.format;return a&&t.supportedFormats?.includes(a)&&(r+=30),r+=t.priority??0,r}createChild(){return new L(this)}}let U=null;function q(){return U||(U=new L),U}function Gt(e){U=e}function Jt(e){return new L(e)}function Kt(e,t,n){return{name:`type:${e}`,registration:{factory:t,displayName:n?.displayName??`${e} widget`,description:n?.description,supportedTypes:[e],priority:n?.priority??0,canFallback:n?.canFallback??!1}}}function Zt(e,t,n){return{name:`format:${e}`,registration:{factory:t,displayName:n?.displayName??`${e} widget`,description:n?.description,supportedFormats:[e],priority:n?.priority??10,canFallback:n?.canFallback??!1}}}function Ht(e,t,n,r){return{name:`type:${e}:format:${t}`,registration:{factory:n,displayName:r?.displayName??`${e}/${t} widget`,description:r?.description,supportedTypes:[e],supportedFormats:[t],priority:r?.priority??20,canFallback:r?.canFallback??!1}}}function Xt(e,t,n,r){return{name:e,registration:{factory:n,displayName:r?.displayName??e,description:r?.description,matcher:t,priority:r?.priority??50,canFallback:r?.canFallback??!1}}}function Ue(e,t){if(t){const r=t.findBestWidget(e);if(r)return r}return q().findBestWidget(e)}function Yt(e){const t=e.definition,n={};if(typeof t=="object"&&"x:ui"in t){const r=t["x:ui"];r.widget&&typeof r.widget=="object"&&(n.options=r.widget),typeof r.priority=="number"&&(n.priority=r.priority)}if(typeof t=="object"&&"widget"in t){const r=t.widget;typeof r=="object"&&r!==null&&(n.options={...n.options??{},...r})}return Object.keys(n).length>0?n:void 0}function se(e){const t=e.definition;if(typeof t=="object"&&"x:ui"in t){const n=t["x:ui"];if(typeof n.widget=="string")return n.widget}if(typeof t=="object"&&"widget"in t){const n=t.widget;if(n&&typeof n.type=="string")return n.type}}function Qt(e){return se(e)!==void 0}function en(e,t){const n=se(e);if(n){if(t){const a=t.get(n);if(a)return{name:n,registration:a}}const s=q().get(n);if(s)return{name:n,registration:s};console.warn(`Widget "${n}" specified in definition but not found in registry`,{path:e.jsonPath})}return Ue(e,t)}function tn(e,t,n){return{...e,...t,...n}}function Be(e=q()){e.register("string",{factory:({controller:i,ctx:u})=>$e({ctx:u,controller:i}),displayName:"String",description:"Text input for string values",supportedTypes:["string"],priority:0,canFallback:!0}),e.register("boolean",{factory:({controller:i,ctx:u})=>Ce({ctx:u,controller:i}),displayName:"Boolean",description:"Checkbox for boolean values",supportedTypes:["boolean"],priority:0,canFallback:!0}),e.register("uuid",{factory:({controller:i,ctx:u})=>Me({ctx:u,controller:i}),displayName:"UUID",description:"Input for UUID values",supportedTypes:["uuid"],priority:0,canFallback:!0}),e.register("uri",{factory:({controller:i,ctx:u})=>De({ctx:u,controller:i}),displayName:"URI",description:"Input for URI/URL values",supportedTypes:["uri"],priority:0,canFallback:!0}),e.register("binary",{factory:({controller:i,ctx:u})=>Re({ctx:u,controller:i}),displayName:"Binary",description:"File upload for binary data",supportedTypes:["binary"],priority:0,canFallback:!0}),e.register("any",{factory:({controller:i,ctx:u})=>H({ctx:u,controller:i}),displayName:"Any",description:"Generic control for any type",supportedTypes:["any"],priority:0,canFallback:!0});const t=["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"],n=({controller:i,ctx:u})=>we({ctx:u,controller:i,intType:u.primaryType});for(const i of t)e.register(i,{factory:n,displayName:i.toUpperCase(),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const r=["float","double","decimal"],s=({controller:i,ctx:u})=>je({ctx:u,controller:i,floatType:u.primaryType});for(const i of r)e.register(i,{factory:s,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const a=["date","datetime","time","duration"],o=({controller:i,ctx:u})=>Oe({ctx:u,controller:i,temporalType:u.primaryType});for(const i of a)e.register(i,{factory:o,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});e.register("object",{factory:({controller:i,ctx:u})=>Ae({ctx:u,controller:i}),displayName:"Object",description:"Form for object values",supportedTypes:["object"],priority:0,canFallback:!0}),e.register("array",{factory:({controller:i,ctx:u})=>Ne({ctx:u,controller:i}),displayName:"Array",description:"List control for array values",supportedTypes:["array"],priority:0,canFallback:!0}),e.register("set",{factory:({controller:i,ctx:u})=>ke({ctx:u,controller:i}),displayName:"Set",description:"Set control for unique values",supportedTypes:["set"],priority:0,canFallback:!0}),e.register("map",{factory:({controller:i,ctx:u})=>Fe({ctx:u,controller:i}),displayName:"Map",description:"Map control for key-value pairs",supportedTypes:["map"],priority:0,canFallback:!0}),e.register("tuple",{factory:({controller:i,ctx:u})=>qe({ctx:u,controller:i}),displayName:"Tuple",description:"Tuple control for fixed-length arrays",supportedTypes:["tuple"],priority:0,canFallback:!0}),e.register("choice",{factory:({controller:i,ctx:u})=>Pe({ctx:u,controller:i}),displayName:"Choice",description:"Choice control for union types",supportedTypes:["choice"],priority:0,canFallback:!0}),e.register("enum",{factory:({controller:i,ctx:u})=>Ve({ctx:u,controller:i}),displayName:"Enum",description:"Dropdown for enumerated values",priority:10,canFallback:!1,matcher:i=>i.hasEnum}),e.register("const",{factory:({controller:i,ctx:u})=>Ee({ctx:u,controller:i}),displayName:"Const",description:"Display for constant values",priority:20,canFallback:!1,matcher:i=>i.hasConst})}function _e(e=q()){return e.has("string")&&e.has("object")&&e.has("array")}function nn(e=q()){_e(e)||Be(e)}function ze(e){let t=e;if(e.$root){const n=A(e.$root,e);n&&(t=n)}return M(t,e,new Set)}function M(e,t,n){if(e.type&&O(e.type)){const r=e.type.$ref;if(n.has(r))return;n.add(r);try{const s=A(r,t);if(s){const a={...s,...e,type:s.type};return M(a,t,n)}return}finally{n.delete(r)}}return e.default!==void 0?e.default:Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:"const"in e&&e.const!==void 0?e.const:"enum"in e&&Array.isArray(e.enum)&&e.enum.length>0?e.enum[0]:yn(e)?null:rn(e,t,n)}function rn(e,t,n){const r=Ge(e);if(R(e))return an(e,t,n);if(r==="choice"&&"choices"in e)return on(e,t,n);if(r==="tuple"&&"tuple"in e&&"properties"in e)return un(e,t,n);if(r==="array")return ln(e,t,n);if(r==="set")return cn(e,t,n);if(r==="map")return{};if(r==="string")return pn(e);if(gn(r))return dn(e);if(hn(r))return fn(e);if(r==="boolean")return!1;if(r==="null")return null;if(bn(r))return mn(r);if(r==="uuid"||r==="uri"||r==="uri-reference"||r==="binary"||r==="bytes")return""}function sn(e){if(!e||e.length===0)return new Set;if(Array.isArray(e[0])){const t=e.flat();return new Set(t)}return new Set(e)}function an(e,t,n){if(!R(e))return{};const r=sn(e.required),s={};for(const[a,o]of Object.entries(e.properties))if(r.has(a))if(o.type&&O(o.type)){const i=o.type.$ref;if(n.has(i))continue;n.add(i);try{const u=A(i,t);if(u){const c={...u,...o,type:u.type},p=M(c,t,n);p!==void 0&&(s[a]=p)}}finally{n.delete(i)}}else{const i=M(o,t,n);i!==void 0&&(s[a]=i)}return s}function on(e,t,n){if(!("choices"in e))return;const r=e.choices,s=Object.keys(r);if(s.length===0)return;const a=s[0],o=r[a];if("selector"in e&&e.selector){const u=e.selector,c=M(o,t,n);return typeof c=="object"&&c!==null?{[u]:a,...c}:{[u]:a}}const i=M(o,t,n);return{[a]:i}}function un(e,t,n){if(!("tuple"in e)||!("properties"in e))return{};const r=e.tuple,s=e.properties,a=new Set(e.required??r),o={};for(const i of r){if(!a.has(i))continue;const u=s[i];if(u){const c=M(u,t,n);c!==void 0&&(o[i]=c)}}return o}function ln(e,t,n){const r=("minItems"in e?e.minItems:0)??0;if(r===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(r).fill(null);const a=M(s,t,n);return Array(r).fill(a??null)}function cn(e,t,n){const r=("minItems"in e?e.minItems:0)??0;if(r===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(r).fill(null);const a=M(s,t,n);return Array(r).fill(a??null)}function pn(e){switch("format"in e?e.format:void 0){case"date":return Je();case"date-time":return Ke();case"time":return"00:00:00";default:return""}}function dn(e){const t=Ge(e),n=t==="int64"||t==="uint64"||t==="int128"||t==="uint128";let r="minimum"in e?e.minimum:void 0,s="maximum"in e?e.maximum:void 0;const a="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,o="exclusiveMaximum"in e?e.exclusiveMaximum:void 0;a!==void 0&&(r=a+1),o!==void 0&&(s=o-1);let i;r!==void 0&&s!==void 0?i=Math.round((r+s)/2):r!==void 0?i=r:s!==void 0?i=0<=s?0:s:i=0;const u="multipleOf"in e?e.multipleOf:void 0;return u!==void 0&&u>0&&(i=Math.round(i/u)*u,r!==void 0&&i<r&&(i=Math.ceil(r/u)*u),s!==void 0&&i>s&&(i=Math.floor(s/u)*u)),n?BigInt(Math.round(i)):Math.round(i)}function fn(e){let t="minimum"in e?e.minimum:void 0,n="maximum"in e?e.maximum:void 0;const r="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,s="exclusiveMaximum"in e?e.exclusiveMaximum:void 0,a="multipleOf"in e?e.multipleOf:.001;r!==void 0&&(t=r+a),s!==void 0&&(n=s-a);let o;t!==void 0&&n!==void 0?o=(t+n)/2:t!==void 0?o=t:n!==void 0?o=0<=n?0:n:o=0;const i="multipleOf"in e?e.multipleOf:void 0;return i!==void 0&&i>0&&(o=Math.round(o/i)*i,t!==void 0&&o<t&&(o=Math.ceil(t/i)*i),n!==void 0&&o>n&&(o=Math.floor(n/i)*i)),o}function mn(e){switch(e){case"date":return Je();case"time":return"00:00:00";case"datetime":return Ke();case"duration":return"PT0S";default:return""}}function yn(e){return Array.isArray(e.type)?e.type.some(t=>typeof t=="string"?t==="null":!1):!1}function Ge(e){const t=e.type;if(typeof t=="string")return t;if(Array.isArray(t)){for(const n of t)if(typeof n=="string"&&n!=="null")return n}}function gn(e){return e?["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"].includes(e):!1}function hn(e){return e?["float","double","decimal"].includes(e):!1}function bn(e){return e?["date","time","datetime","duration"].includes(e):!1}function Je(){return new Date().toISOString().split("T")[0]}function Ke(){return new Date().toISOString()}function vn(e){if(e.isValid)return D.Validation.valid;const t=ie(e.errors),n=new Map;for(const o of t){const i=n.get(o.path)||[];i.push(o),n.set(o.path,i)}const r=(o,i)=>{if(o.length===0)return{message:i.map(y=>y.message).join("; ")};const[u,...c]=o,p=r(c,i);return{dependencies:{[u]:p}}},s={},a={};for(const[o,i]of n.entries())if(o===""||o==="/")s.message=i.map(u=>u.message).join("; ");else{const u=o.split("/").filter(c=>c!=="");if(u.length===1)a[u[0]]={message:i.map(c=>c.message).join("; ")};else{const[c,...p]=u;a[c]=r(p,i)}}return Object.keys(a).length>0&&(s.dependencies=a),D.Validation.invalid(s)}function xn({schema:e,initialValue:t,validationMode:n,validateDebounceMs:r,widgetRegistry:s,readOnly:a,locale:o,onChange:i,onValidate:u,applySchemaDefaults:c=!0},p){const y=t!==void 0?l.Value.get(t):void 0,g=ze(e);let d;t===void 0?d=g??{}:c?d=b.deepMergeDefaults(g,y):d=y;const h=re(e),m=n??"onTouched",x=C=>{const P=h.validate(C);if(u&&!P.isValid){const W=ie(P.errors);u(W)}return vn(P)},{controller:v,setStatus:$}=f.useController({initialValue:d,validationMode:m,validateDebounceMs:r,validate:m==="onSubmit"?void 0:x,onChange:i}),T=()=>{v.dispose()},I=l.Fragment(l.OnDispose(T),Le({schema:e,controller:v,widgetRegistry:s,readOnly:a,locale:o}));return p({Form:I,controller:v,setStatus:$})}exports.DefaultWidgetRegistry=L;exports.INTEGER_BOUNDS=V;exports.JSONStructureForm=xn;exports.RefResolver=xe;exports.StructureContext=K;exports.StructureControl=Le;exports.StructureGenericControl=S;exports.createExtendsResolver=nt;exports.createRefResolver=J;exports.createStructureContext=Te;exports.createValidator=re;exports.createWidgetRegistry=Jt;exports.ensureDefaultWidgets=nn;exports.extractStructureDefaults=ze;exports.forFormat=Zt;exports.forMatcher=Xt;exports.forType=Kt;exports.forTypeAndFormat=Ht;exports.formatValidationError=We;exports.formatValidationErrors=ie;exports.getChildErrors=zt;exports.getErrorsForPath=Bt;exports.getExplicitWidgetName=se;exports.getGlobalWidgetRegistry=q;exports.getNonNullTypes=G;exports.getResolvedType=Z;exports.getWidgetOptions=Yt;exports.groupErrorsByPath=Ut;exports.hasConstValue=he;exports.hasCustomWidget=Qt;exports.hasDefaultWidgets=_e;exports.hasEnumValue=ge;exports.hasErrorsAtPath=_t;exports.isArrayTypeDefinition=X;exports.isBigIntType=pe;exports.isChoiceTypeDefinition=te;exports.isCompoundType=He;exports.isFloatType=_;exports.isIntegerType=k;exports.isMapTypeDefinition=Q;exports.isNamespace=me;exports.isNullableType=be;exports.isNumericType=de;exports.isObjectTypeDefinition=R;exports.isPrimitiveType=fe;exports.isSetTypeDefinition=Y;exports.isTemporalType=z;exports.isTupleTypeDefinition=ee;exports.isTypeDefinition=ye;exports.isTypeReference=O;exports.mergeWidgetOptions=tn;exports.parseRefPath=ve;exports.registerDefaultWidgets=Be;exports.resolveExtends=ne;exports.resolveRef=A;exports.resolveTypeReference=Ye;exports.resolveWidget=Ue;exports.resolveWidgetWithOverride=en;exports.setGlobalWidgetRegistry=Gt;exports.validate=kt;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { html as p, attr as f, Empty as Z, MapSignal as B, Fragment as P, Value as x, computedOf as M, When as Ke, prop as Je, WithElement as Ze, OnDispose as He } from "@tempots/dom";
|
|
2
2
|
import { upperCaseFirst as H, humanize as Xe, objectEntries as Ye, Validation as re } from "@tempots/std";
|
|
3
3
|
import { b, a as ie, I as W, d as Qe, O as se, A as G, f as et } from "../use-form-Dn6v2tEh.js";
|
|
4
|
-
import { e as X, N as tt, f as de, g as fe, U as nt, c as rt, a as it, T as st, L as me, b as ye, h as at, G as ut, i as ot, S as ct, j as lt } from "../deep-merge-
|
|
5
|
-
import { T as pt } from "../text-input-
|
|
6
|
-
import { N as dt, B as ft, D as mt, a as yt, P as gt, b as ht, c as bt, d as vt, e as xt, F as $t } from "../duration-input-
|
|
4
|
+
import { e as X, N as tt, f as de, g as fe, U as nt, c as rt, a as it, T as st, L as me, b as ye, h as at, G as ut, i as ot, S as ct, j as lt } from "../deep-merge-Da602mAN.js";
|
|
5
|
+
import { T as pt } from "../text-input-dDUEUmlC.js";
|
|
6
|
+
import { N as dt, B as ft, D as mt, a as yt, P as gt, b as ht, c as bt, d as vt, e as xt, F as $t } from "../duration-input-HM1i6RRY.js";
|
|
7
7
|
import { B as U } from "../input-container-BvEcp7FU.js";
|
|
8
8
|
import { L as ge, S as K, M as Tt } from "../stack-BLMteGTn.js";
|
|
9
9
|
function It(e) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const C=require("./text-input-DL9FvpTZ.cjs"),t=require("@tempots/dom"),v=require("./input-container-Di1YvVB_.cjs"),b=require("./translations-Dbx7L7Q1.cjs"),O=require("./use-form-CaW192gw.cjs"),B=o=>{const l={name:"email",autocomplete:"email",...o},{value:r,before:s,onBlur:a,onChange:u,onInput:c,placeholder:f}=l,p=s??v.InputIcon({icon:"line-md:email",size:o.size,color:"neutral"});return t.Use(b.BeatUII18n,m=>v.InputContainer({...o,before:p,input:t.input.email(C.CommonInputAttributes(l),t.attr.placeholder(t.coalesce(f,m.$.emailPlaceholderText)),t.attr.value(r),t.attr.class("bc-input"),a!=null?t.on.blur(t.emitValue(a)):t.Empty,u!=null?t.on.change(t.emitValue(u)):t.Empty,c!=null?t.on.input(t.emitValue(c)):t.Empty)}))},U=o=>{const{value:l,onBlur:r,onChange:s,onInput:a,before:u,after:c,hasError:f,disabled:p,autocomplete:m,placeholder:I,size:d,...w}=o,y={name:"password",disabled:p,...w},e=t.prop(!0),n=t.computedOf(e,m)((i,h)=>i?h??"current-password":"off");return t.Use(b.BeatUII18n,i=>{const h=t.computedOf(i.$.passwordPlaceholderText,e,I)((V,E,_)=>E?"•••••••••••••••":_??V),g=t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__password-toggle"),t.aria.label(i.$.togglePasswordVisibility),t.on.click(()=>e.update(V=>!V)),t.When(e,()=>b.Icon({icon:"line-md:watch"}),()=>b.Icon({icon:"line-md:watch-off"})));return v.InputContainer({before:u,disabled:p,hasError:f,size:d,input:t.html.input(C.CommonInputAttributes({...y,autocomplete:n,placeholder:h}),t.When(e,()=>t.attr.type("password"),()=>t.attr.type("text")),t.attr.class("bc-input"),t.attr.value(l),r!=null?t.on.blur(t.emitValue(r)):t.Empty,s!=null?t.on.change(t.emitValue(s)):t.Empty,a!=null?t.on.input(t.emitValue(a)):t.Empty),after:c!=null?t.Fragment(g,c):g})})};function P(o){switch(o){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";default:return"material-symbols:info-outline"}}function T(o){switch(o){case"success":return"success";case"warning":return"warning";case"danger":return"danger";default:return"info"}}function $(o,l,r,s){const a=["bc-notice",`bc-notice--${o}`,`bc-notice--tone-${l}`];return r&&a.push("bc-notice--dismissible"),s&&s.length>0&&a.push(s),a.join(" ")}function q({variant:o="info",tone:l="subtle",role:r,title:s,icon:a,closable:u=!1,onClose:c,class:f},...p){const m=t.prop(!0);return t.When(m,()=>{const I=t.Value.map(u,e=>!!e||c!=null),d=t.Value.map(o,e=>e??"info"),w=t.Value.map(l,e=>e??"subtle"),y=t.computedOf(r,d)((e,n)=>e??(n==="danger"?"alert":"status"));return t.Use(b.BeatUII18n,e=>t.html.div(t.attr.class(t.computedOf(d,w,I,f)((n,i,h,g)=>$(n,i,h,g))),t.attr.role(t.Value.map(y,n=>n)),t.Unless(t.Value.map(a,n=>n===!1),()=>t.html.div(t.attr.class("bc-notice__icon"),b.Icon({icon:t.computedOf(a,d)((n,i)=>n===void 0?P(i):String(n)),size:"md",color:t.Value.map(d,T)}))),t.html.div(t.attr.class("bc-notice__body"),t.Ensure(s,n=>t.html.div(t.attr.class("bc-notice__title"),n)),t.html.div(t.attr.class("bc-notice__content"),...p)),t.When(I,()=>O.CloseButton({size:"xs",label:e.$.closeModal,onClick:()=>{m.set(!1),c?.()}}))))})}exports.EmailInput=B;exports.Notice=q;exports.PasswordInput=U;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { C as x } from "./text-input-dDUEUmlC.js";
|
|
2
|
+
import { Use as E, input as j, attr as t, coalesce as A, Empty as g, on as p, emitValue as w, prop as O, computedOf as y, html as u, aria as D, When as B, Fragment as F, Value as h, Unless as M, Ensure as R } from "@tempots/dom";
|
|
3
|
+
import { a as S, I as k } from "./input-container-BvEcp7FU.js";
|
|
4
|
+
import { B as V, I as z } from "./translations-B1_yyDUK.js";
|
|
5
|
+
import { C as W } from "./use-form-Dn6v2tEh.js";
|
|
6
|
+
const Y = (o) => {
|
|
7
|
+
const l = {
|
|
8
|
+
name: "email",
|
|
9
|
+
autocomplete: "email",
|
|
10
|
+
...o
|
|
11
|
+
}, {
|
|
12
|
+
value: r,
|
|
13
|
+
before: a,
|
|
14
|
+
onBlur: s,
|
|
15
|
+
onChange: m,
|
|
16
|
+
onInput: c,
|
|
17
|
+
placeholder: I
|
|
18
|
+
} = l, d = a ?? S({
|
|
19
|
+
icon: "line-md:email",
|
|
20
|
+
size: o.size,
|
|
21
|
+
color: "neutral"
|
|
22
|
+
});
|
|
23
|
+
return E(
|
|
24
|
+
V,
|
|
25
|
+
(b) => k({
|
|
26
|
+
...o,
|
|
27
|
+
before: d,
|
|
28
|
+
input: j.email(
|
|
29
|
+
x(l),
|
|
30
|
+
t.placeholder(A(I, b.$.emailPlaceholderText)),
|
|
31
|
+
t.value(r),
|
|
32
|
+
t.class("bc-input"),
|
|
33
|
+
s != null ? p.blur(w(s)) : g,
|
|
34
|
+
m != null ? p.change(w(m)) : g,
|
|
35
|
+
c != null ? p.input(w(c)) : g
|
|
36
|
+
)
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
}, Z = (o) => {
|
|
40
|
+
const {
|
|
41
|
+
value: l,
|
|
42
|
+
onBlur: r,
|
|
43
|
+
onChange: a,
|
|
44
|
+
onInput: s,
|
|
45
|
+
before: m,
|
|
46
|
+
after: c,
|
|
47
|
+
hasError: I,
|
|
48
|
+
disabled: d,
|
|
49
|
+
autocomplete: b,
|
|
50
|
+
placeholder: _,
|
|
51
|
+
size: f,
|
|
52
|
+
...P
|
|
53
|
+
} = o, T = {
|
|
54
|
+
name: "password",
|
|
55
|
+
disabled: d,
|
|
56
|
+
...P
|
|
57
|
+
}, e = O(!0), n = y(
|
|
58
|
+
e,
|
|
59
|
+
b
|
|
60
|
+
)((i, v) => i ? v ?? "current-password" : "off");
|
|
61
|
+
return E(V, (i) => {
|
|
62
|
+
const v = y(
|
|
63
|
+
i.$.passwordPlaceholderText,
|
|
64
|
+
e,
|
|
65
|
+
_
|
|
66
|
+
)(($, N, U) => N ? "•••••••••••••••" : U ?? $), C = u.button(
|
|
67
|
+
t.type("button"),
|
|
68
|
+
t.class("bc-input-container__password-toggle"),
|
|
69
|
+
D.label(i.$.togglePasswordVisibility),
|
|
70
|
+
p.click(() => e.update(($) => !$)),
|
|
71
|
+
B(
|
|
72
|
+
e,
|
|
73
|
+
() => z({ icon: "line-md:watch" }),
|
|
74
|
+
() => z({ icon: "line-md:watch-off" })
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
return k({
|
|
78
|
+
before: m,
|
|
79
|
+
disabled: d,
|
|
80
|
+
hasError: I,
|
|
81
|
+
size: f,
|
|
82
|
+
input: u.input(
|
|
83
|
+
x({
|
|
84
|
+
...T,
|
|
85
|
+
autocomplete: n,
|
|
86
|
+
placeholder: v
|
|
87
|
+
}),
|
|
88
|
+
B(
|
|
89
|
+
e,
|
|
90
|
+
() => t.type("password"),
|
|
91
|
+
() => t.type("text")
|
|
92
|
+
),
|
|
93
|
+
t.class("bc-input"),
|
|
94
|
+
t.value(l),
|
|
95
|
+
r != null ? p.blur(w(r)) : g,
|
|
96
|
+
a != null ? p.change(w(a)) : g,
|
|
97
|
+
s != null ? p.input(w(s)) : g
|
|
98
|
+
),
|
|
99
|
+
after: c != null ? F(C, c) : C
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
function q(o) {
|
|
104
|
+
switch (o) {
|
|
105
|
+
case "success":
|
|
106
|
+
return "material-symbols:check-circle-outline";
|
|
107
|
+
case "warning":
|
|
108
|
+
return "material-symbols:warning-outline";
|
|
109
|
+
case "danger":
|
|
110
|
+
return "material-symbols:error-outline";
|
|
111
|
+
default:
|
|
112
|
+
return "material-symbols:info-outline";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function G(o) {
|
|
116
|
+
switch (o) {
|
|
117
|
+
case "success":
|
|
118
|
+
return "success";
|
|
119
|
+
case "warning":
|
|
120
|
+
return "warning";
|
|
121
|
+
case "danger":
|
|
122
|
+
return "danger";
|
|
123
|
+
default:
|
|
124
|
+
return "info";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function H(o, l, r, a) {
|
|
128
|
+
const s = [
|
|
129
|
+
"bc-notice",
|
|
130
|
+
`bc-notice--${o}`,
|
|
131
|
+
`bc-notice--tone-${l}`
|
|
132
|
+
];
|
|
133
|
+
return r && s.push("bc-notice--dismissible"), a && a.length > 0 && s.push(a), s.join(" ");
|
|
134
|
+
}
|
|
135
|
+
function ee({
|
|
136
|
+
variant: o = "info",
|
|
137
|
+
tone: l = "subtle",
|
|
138
|
+
role: r,
|
|
139
|
+
title: a,
|
|
140
|
+
icon: s,
|
|
141
|
+
closable: m = !1,
|
|
142
|
+
onClose: c,
|
|
143
|
+
class: I
|
|
144
|
+
}, ...d) {
|
|
145
|
+
const b = O(!0);
|
|
146
|
+
return B(b, () => {
|
|
147
|
+
const _ = h.map(
|
|
148
|
+
m,
|
|
149
|
+
(e) => !!e || c != null
|
|
150
|
+
), f = h.map(o, (e) => e ?? "info"), P = h.map(l, (e) => e ?? "subtle"), T = y(
|
|
151
|
+
r,
|
|
152
|
+
f
|
|
153
|
+
)(
|
|
154
|
+
(e, n) => e ?? (n === "danger" ? "alert" : "status")
|
|
155
|
+
);
|
|
156
|
+
return E(
|
|
157
|
+
V,
|
|
158
|
+
(e) => u.div(
|
|
159
|
+
t.class(
|
|
160
|
+
y(
|
|
161
|
+
f,
|
|
162
|
+
P,
|
|
163
|
+
_,
|
|
164
|
+
I
|
|
165
|
+
)((n, i, v, C) => H(n, i, v, C))
|
|
166
|
+
),
|
|
167
|
+
// Accessibility role mapping (always defined)
|
|
168
|
+
t.role(h.map(T, (n) => n)),
|
|
169
|
+
M(
|
|
170
|
+
h.map(s, (n) => n === !1),
|
|
171
|
+
() => u.div(
|
|
172
|
+
t.class("bc-notice__icon"),
|
|
173
|
+
z({
|
|
174
|
+
icon: y(
|
|
175
|
+
s,
|
|
176
|
+
f
|
|
177
|
+
)(
|
|
178
|
+
(n, i) => n === void 0 ? q(i) : String(n)
|
|
179
|
+
),
|
|
180
|
+
size: "md",
|
|
181
|
+
color: h.map(f, G)
|
|
182
|
+
})
|
|
183
|
+
)
|
|
184
|
+
),
|
|
185
|
+
u.div(
|
|
186
|
+
t.class("bc-notice__body"),
|
|
187
|
+
R(
|
|
188
|
+
a,
|
|
189
|
+
(n) => u.div(t.class("bc-notice__title"), n)
|
|
190
|
+
),
|
|
191
|
+
u.div(t.class("bc-notice__content"), ...d)
|
|
192
|
+
),
|
|
193
|
+
B(
|
|
194
|
+
_,
|
|
195
|
+
() => W({
|
|
196
|
+
size: "xs",
|
|
197
|
+
label: e.$.closeModal,
|
|
198
|
+
onClick: () => {
|
|
199
|
+
b.set(!1), c?.();
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
)
|
|
203
|
+
)
|
|
204
|
+
);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
export {
|
|
208
|
+
Y as E,
|
|
209
|
+
ee as N,
|
|
210
|
+
Z as P
|
|
211
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var ne=Object.create;var H=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var ce=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of se(t))!ie.call(e,l)&&l!==o&&H(e,l,{get:()=>t[l],enumerable:!(n=le(t,l))||n.enumerable});return e};var de=(e,t,o)=>(o=e!=null?ne(ae(e)):{},ce(t||!e||!e.__esModule?H(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),C=require("../toolbar-DoKdYXIL.cjs"),g=require("prosemirror-commands"),m=require("../editor-toolbar-group-mkL4QozO.cjs"),ue=require("../text-input-
|
|
1
|
+
"use strict";var ne=Object.create;var H=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var ce=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of se(t))!ie.call(e,l)&&l!==o&&H(e,l,{get:()=>t[l],enumerable:!(n=le(t,l))||n.enumerable});return e};var de=(e,t,o)=>(o=e!=null?ne(ae(e)):{},ce(t||!e||!e.__esModule?H(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),C=require("../toolbar-DoKdYXIL.cjs"),g=require("prosemirror-commands"),m=require("../editor-toolbar-group-mkL4QozO.cjs"),ue=require("../text-input-DL9FvpTZ.cjs"),pe=require("../translations-Dbx7L7Q1.cjs"),ke=require("../link-portal-_tiDFZqh.cjs"),R=require("prosemirror-state"),me=require("prosemirror-view"),fe=require("prosemirror-model"),he=require("prosemirror-schema-basic"),y=require("prosemirror-markdown"),be=require("markdown-it"),q=require("prosemirror-history"),I=require("prosemirror-keymap"),ge=require("@tempots/ui"),ye=require("../theme-DogY9oT1.cjs");function W(e,t){return K(e,t)!=null}function K(e,t){const{from:o,$from:n,to:l,empty:s}=e.selection;if(!t)return null;if(s){if(e.storedMarks){const k=e.storedMarks.find(M=>M.type.name===t.name);if(k!=null)return k}const r=n.marks().find(k=>k.type.name===t.name);if(r!=null)return r;const c=n.nodeAfter;if(c&&c.marks){const k=c.marks.find(M=>M.type.name===t.name);if(k!=null)return k}return null}let i=null;return e.doc.nodesBetween(o,l,d=>{if(i!=null)return!1;if(d.marks){const r=d.marks.find(c=>c.type.name===t.name);if(r!=null)return i=r,!1}}),i}function _(e,t,o){return e.map(()=>{const n=t.value,l=n.state.schema.marks[o];return W(n.state,l)})}function Me(e,t,o){const{$from:n}=e.selection;for(let s=n.depth;s>0;s--){const i=n.node(s);if(i.type.name===t.name)return o!=null?Object.keys(o).every(d=>i.attrs[d]===o[d]):!0}const l=e.doc.nodeAt(n.pos);return l&&l.type.name===t.name?o!=null?Object.keys(o).every(s=>l.attrs[s]===o[s]):!0:!1}function B(e,t,o,n){return e.map(()=>{const l=t.value,s=l.state.schema.nodes[o];return s?Me(l.state,s,n):!1})}function $e(e,t){const o=e.state.schema.marks.link;if(o==null)return;const{from:n,to:l}=e.state.selection,s=e.state.tr.addMark(n,l,o.create({href:t,title:null}));e.dispatch(s),e.focus()}function O(e){const{state:t}=e,{$from:o,$to:n}=t.selection;if(!U(t))return null;let l=o.pos,s=n.pos;const i=t.doc;for(;l>0&&i.resolve(l-1).nodeAfter?.marks?.some(c=>c.type.name==="link");)l--;for(;s<i.content.size&&i.resolve(s).nodeAfter?.marks?.some(c=>c.type.name==="link");)s++;return{start:l,end:s}}function Be(e,t){const o=e.state.schema.marks.link;if(o==null)return;const n=O(e);if(n==null)return;const{start:l,end:s}=n,i=e.state.tr.removeMark(l,s,o).addMark(l,s,o.create({href:t,title:null}));e.dispatch(i)}function Le(e){const t=e.state.schema.marks.link;if(t==null)return;const o=O(e);if(o==null)return;const{start:n,end:l}=o,s=e.state.tr.removeMark(n,l,t);e.dispatch(s),e.focus()}function U(e){return W(e,e.schema.marks.link)}function Te({stateUpdate:e,view:t,isReadOnly:o,label:n,linkUrlPlaceholder:l,size:s}){const i=a.prop(null);i.on(r=>{r!=null&&Be(t.value,r)});const d=e.on(()=>{const r=K(t.value.state,t.value.state.schema.marks.link);r!=null?i.set(r.attrs.href??""):i.set(null)});return a.Fragment(a.OnDispose(d),C.ToolbarGroup({},m.EditorToolbarButton({display:a.signal(!0),active:_(e,t,"link"),disabled:o,label:n,icon:"mdi:link-variant",size:s,onClick:()=>{const r=t.value.state;U(r)?(Le(t.value),i.set(null)):($e(t.value,""),i.set(""))}}),a.Ensure(i,r=>ue.TextInput({value:r,autofocus:!0,onInput:c=>i.set(c),placeholder:l,size:s}))),a.Ensure(i,r=>C.ToolbarButton({disabled:r.map(c=>c.trim()===""),variant:"text",onClick:()=>{const c=i.value;c&&window.open(c,"_blank")},size:s},"go")))}function w({view:e,stateUpdate:t,features:o,readOnly:n=a.signal(!1),size:l="sm"}){return a.Ensure(e,s=>a.Use(pe.BeatUII18n,i=>{const d=i.$.prosemirror,r=s;return C.Toolbar({},m.EditorToolbarGroup({display:[o.$.bold,o.$.italic,o.$.code]},m.EditorToolbarButton({active:_(t,r,"strong"),display:o.$.bold,onClick:()=>A(r.value,"strong"),disabled:n,label:d.$.bold,icon:"mdi:format-bold",size:l}),m.EditorToolbarButton({active:_(t,r,"em"),display:o.$.italic,onClick:()=>A(r.value,"em"),disabled:n,label:d.$.italic,icon:"mdi:format-italic",size:l}),m.EditorToolbarButton({active:_(t,r,"code"),display:o.$.code,onClick:()=>A(r.value,"code"),disabled:n,label:d.$.code,icon:"mdi:code-tags",size:l})),m.EditorToolbarGroup({display:[o.$.headings]},a.Repeat(o.$.headerLevels.map(c=>Math.min(Math.max(c,1),6)),({counter:c})=>m.EditorToolbarButton({active:B(t,r,"heading",{level:c}),display:o.$.headings,onClick:()=>Ee(r.value,c),disabled:n,label:d.map(k=>k.heading(c)),icon:`mdi:format-header-${c}`,size:l}))),m.EditorToolbarGroup({display:[o.$.bulletList,o.$.orderedList]},m.EditorToolbarButton({active:B(t,r,"bullet_list"),display:o.$.bulletList,onClick:()=>j(r.value,"bullet_list"),disabled:n,label:d.$.bulletList,icon:"mdi:format-list-bulleted",size:l}),m.EditorToolbarButton({active:B(t,r,"ordered_list"),display:o.$.orderedList,onClick:()=>j(r.value,"ordered_list"),disabled:n,label:d.$.orderedList,icon:"mdi:format-list-numbered",size:l})),m.EditorToolbarGroup({display:[o.$.blockquote,o.$.codeBlock,o.$.horizontalRule]},m.EditorToolbarButton({active:B(t,r,"blockquote"),display:o.$.blockquote,onClick:()=>qe(r.value),disabled:n,label:d.$.blockquote,icon:"mdi:format-quote-close",size:l}),m.EditorToolbarButton({active:B(t,r,"code_block"),display:o.$.codeBlock,onClick:()=>_e(r.value),disabled:n,label:d.$.codeBlock,icon:"mdi:code-braces",size:l}),m.EditorToolbarButton({active:a.signal(!1),display:o.$.horizontalRule,onClick:()=>Se(r.value),disabled:n,label:d.$.horizontalRule,icon:"mdi:minus",size:l})),a.When(o.$.links,()=>Te({stateUpdate:t,view:r,isReadOnly:n,label:d.$.link,linkUrlPlaceholder:d.$.linkUrlPlaceholder,size:l})))}))}function A(e,t){const o=e.state.schema.marks[t];o!=null&&(g.toggleMark(o)(e.state,e.dispatch),e.focus())}function Ee(e,t){const o=e.state.schema.nodes.heading;o!=null&&(g.setBlockType(o,{level:t})(e.state,e.dispatch),e.focus())}async function j(e,t){const{wrapInList:o,liftListItem:n}=await import("prosemirror-schema-list"),l=e.state.schema.nodes[t],s=e.state.schema.nodes.list_item;if(l==null||s==null)return;const{state:i}=e,{$from:d}=i.selection;let r=null;for(let c=d.depth;c>0;c--){const k=d.node(c);if(k.type.name==="bullet_list"||k.type.name==="ordered_list"){r=k.type.name;break}}r===t?n(s)(i,e.dispatch):r!=null?n(s)(e.state,e.dispatch)&&o(l)(e.state,e.dispatch):o(l)(i,e.dispatch),e.focus()}function qe(e){const t=e.state.schema.nodes.blockquote;if(t==null)return;const{state:o}=e,{$from:n}=o.selection;let l=!1;for(let s=n.depth;s>0;s--)if(n.node(s).type.name==="blockquote"){l=!0;break}l?g.lift(o,e.dispatch):g.wrapIn(t)(o,e.dispatch),e.focus()}function _e(e){const t=e.state.schema.nodes.code_block,o=e.state.schema.nodes.paragraph;if(t==null||o==null)return;const{state:n}=e,{$from:l}=n.selection;let s=!1;for(let i=l.depth;i>0;i--)if(l.node(i).type.name==="code_block"){s=!0;break}s?g.setBlockType(o)(n,e.dispatch):g.setBlockType(t)(n,e.dispatch),e.focus()}function Se(e){const t=e.state.schema.nodes.horizontal_rule;if(t!=null){const o=e.state.tr.replaceSelectionWith(t.create());e.dispatch(o),e.focus()}}const Pe=new y.MarkdownParser(y.defaultMarkdownParser.schema,be("commonmark",{breaks:!0}),y.defaultMarkdownParser.tokens);function Ve(e){return e.split(`
|
|
2
2
|
`).map((o,n,l)=>o.trim()===""&&n<l.length-1?" ":o).join(`
|
|
3
3
|
`)}function N(e,t){const o=t?Pe:y.defaultMarkdownParser;let n=e??"";return t&&(n=Ve(n)),o.parse(n)}const F={headings:!0,bold:!0,italic:!0,code:!0,links:!0,bulletList:!0,orderedList:!0,blockquote:!0,codeBlock:!0,horizontalRule:!0,hardBreak:!0,headerLevels:3};function ve(e){return new R.Plugin({view:()=>({update:()=>{e()}}),filterTransaction:()=>(e(),!0)})}const Ie=e=>{const{value:t,onChange:o,onInput:n,onBlur:l,class:s,id:i,name:d,hasError:r,disabled:c,autofocus:k=!1,readOnly:M=!1,placeholder:x,showToolbar:J=!1,features:Q,preserveLineBreaks:z=!1}=e,L=a.Value.toSignal(M),S=a.Value.toSignal(c??!1),X=a.Value.toSignal(J),D=a.computedOf(Q??F)(P=>({...F,...P})),T=a.prop(null),G=ge.ticker();return a.Use(ye.Theme,({appearance:P})=>a.html.div(a.OnDispose(()=>T.value?.destroy()),(e.cssInjection??"none")==="none"?null:a.Task(()=>Promise.resolve().then(()=>require("../styles-url-evUdl8tK.cjs")),({default:p})=>ke.LinkPortal({id:"beatui-prosemirror-css",href:p})),a.attr.class("bc-prosemirror-editor-container"),a.attr.class(s),a.attr.class(a.Value.map(r??!1,p=>p?"bc-input-container--error":"")),a.attr.id(i),a.attr.name(d),a.When(a.computedOf(X,T)((p,f)=>p&&f!=null),()=>w({view:T,stateUpdate:G,features:D,readOnly:L})),a.html.div(a.attr.class("bc-prosemirror-editor"),a.WithElement(p=>{const f=[];return(()=>{try{const $=a.Value.get(t)??"",V=a.Value.get(L)??!1,Y=a.Value.get(S)??!1,Z=a.Value.get(D),v=Ce(fe.Schema,he.schema,Z),ee=N($,z),te=Ae(v),oe=R.EditorState.create({doc:ee,schema:v,plugins:[q.history(),I.keymap({"Mod-z":q.undo,"Mod-y":q.redo,"Mod-Shift-z":q.redo}),I.keymap(te),I.keymap(g.baseKeymap),ve(G.tick)]}),h=new me.EditorView(p,{state:oe,editable:()=>!V&&!Y,dispatchTransaction(u){const b=h.state.apply(u);if(h.updateState(b),u.docChanged&&n!=null){const E=y.defaultMarkdownSerializer.serialize(b.doc);n(E)}}});if(T.set(h),a.Value.get(k)&&h.focus(),x!=null&&f.push(a.Value.on(x,u=>{u!=null&&u!==""?p.setAttribute("data-placeholder",u):p.removeAttribute("data-placeholder")})),f.push(a.Value.on(L,u=>{const b=a.Value.get(S);h.setProps({editable:()=>!u&&!b})})),f.push(a.Value.on(S,u=>{const b=a.Value.get(L);h.setProps({editable:()=>!b&&!u})})),f.push(a.Value.on(t,u=>{const b=y.defaultMarkdownSerializer.serialize(h.state.doc);if(u!==b){const E=N(u,z);if(E!=null){const re=R.EditorState.create({doc:E,schema:v,plugins:h.state.plugins});h.updateState(re)}}})),o!=null){const u=()=>{const b=y.defaultMarkdownSerializer.serialize(h.state.doc);o(b)};p.addEventListener("blur",u,!0),f.push(()=>p.removeEventListener("blur",u,!0))}if(l!=null){const u=()=>{l()};p.addEventListener("blur",u,!0),f.push(()=>p.removeEventListener("blur",u,!0))}f.push(P.on(u=>{u==="dark"?p.classList.add("bc-prosemirror-editor--dark"):p.classList.remove("bc-prosemirror-editor--dark")})),f.push(()=>h.destroy())}catch($){console.error("[BeatUI] Failed to initialize ProseMirror editor:",$);const V=p;V.textContent="Failed to load ProseMirror Editor. Please ensure prosemirror packages are installed."}})(),a.OnDispose(()=>{f.forEach($=>$())})}))))};function Ae(e){const t={},o=e.marks.strong;o!=null&&(t["Mod-b"]=(s,i)=>g.toggleMark(o)(s,i));const n=e.marks.em;n!=null&&(t["Mod-i"]=(s,i)=>g.toggleMark(n)(s,i));const l=e.marks.code;return l!=null&&(t["Mod-`"]=(s,i)=>g.toggleMark(l)(s,i)),t}function Ce(e,t,o){const n={},l={},s=t.spec.nodes.get("doc"),i=t.spec.nodes.get("text");if(s==null||i==null)throw new Error("Basic schema missing required doc or text nodes");n.doc={...s,content:"block+"},n.text=i;const d=t.spec.nodes.get("paragraph");if(d!=null&&(n.paragraph={...d,content:"inline*"}),o.headings){const r=t.spec.nodes.get("heading");r!=null&&(n.heading={...r,content:"inline*"})}if(o.bulletList){const r=t.spec.nodes.get("bullet_list"),c=t.spec.nodes.get("list_item");r!=null&&(n.bullet_list={...r,content:"list_item+"}),c!=null&&(n.list_item={...c,content:"paragraph block*"})}if(o.orderedList){const r=t.spec.nodes.get("ordered_list"),c=t.spec.nodes.get("list_item");r!=null&&(n.ordered_list={...r,content:"list_item+"}),c!=null&&!n.list_item&&(n.list_item={...c,content:"paragraph block*"})}if(o.blockquote){const r=t.spec.nodes.get("blockquote");r!=null&&(n.blockquote={...r,content:"block+"})}if(o.codeBlock){const r=t.spec.nodes.get("code_block");r!=null&&(n.code_block=r)}if(o.horizontalRule){const r=t.spec.nodes.get("horizontal_rule");r!=null&&(n.horizontal_rule=r)}if(o.hardBreak){const r=t.spec.nodes.get("hard_break");r!=null&&(n.hard_break=r)}if(o.bold){const r=t.spec.marks.get("strong");r!=null&&(l.strong=r)}if(o.italic){const r=t.spec.marks.get("em");r!=null&&(l.em=r)}if(o.code){const r=t.spec.marks.get("code");r!=null&&(l.code=r)}if(o.links){const r=t.spec.marks.get("link");r!=null&&(l.link=r)}return new e({nodes:n,marks:l})}exports.DEFAULT_FEATURES=F;exports.ProseMirrorMarkdownInput=Ie;exports.ProseMirrorToolbar=w;
|
|
@@ -2,7 +2,7 @@ import { prop as U, Fragment as pe, OnDispose as x, Ensure as F, signal as z, Us
|
|
|
2
2
|
import { a as be, T as ge, b as ye } from "../toolbar-DY0ax2Qd.js";
|
|
3
3
|
import { toggleMark as T, setBlockType as V, lift as $e, wrapIn as Me, baseKeymap as Le } from "prosemirror-commands";
|
|
4
4
|
import { E as b, a as S } from "../editor-toolbar-group-Crlu1QJw.js";
|
|
5
|
-
import { T as _e } from "../text-input-
|
|
5
|
+
import { T as _e } from "../text-input-dDUEUmlC.js";
|
|
6
6
|
import { B as Be } from "../translations-B1_yyDUK.js";
|
|
7
7
|
import { L as Se } from "../link-portal-Cr2l9f3k.js";
|
|
8
8
|
import { EditorState as J, Plugin as Te } from "prosemirror-state";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("@tempots/dom"),I=require("./input-container-Di1YvVB_.cjs");function d(n,a,u){const{value:l,onChange:e,onInput:r,...i}=n;return{...i,value:t.Value.map(l,a),onChange:e!=null?o=>e(u(o)):void 0,onInput:r!=null?o=>r(u(o)):void 0}}const m=({autocomplete:n,ariaLabel:a,autofocus:u,classes:l,disabled:e,name:r,placeholder:i,id:o,required:s,tabIndex:c,hasError:p})=>t.Fragment(t.attr.autocomplete(n),t.attr.autofocus(u),t.attr.class(l?.input),t.attr.disabled(e),t.attr.name(r??o),t.attr.placeholder(i),t.attr.id(o),t.aria.required(s),a!=null?t.aria.label(a):null,t.attr.tabindex(c),p!=null?t.aria.invalid(p??!1):null),v=n=>{const{value:a,onBlur:u,onChange:l,onInput:e,type:r}=n;return I.InputContainer({...n,input:t.html.input(t.attr.type(r??"text"),m(n),t.attr.value(a),t.attr.class("bc-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,l!=null?t.on.change(t.emitValue(l)):t.Empty,e!=null?t.on.input(t.emitValue(e)):t.Empty)})};exports.CommonInputAttributes=m;exports.TextInput=v;exports.mapInputOptions=d;
|