@ditojs/admin 3.2.2 → 3.2.3
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/dito-admin.es.js +1 -1
- package/dist/dito-admin.umd.js +1 -1
- package/package.json +2 -2
- package/src/DitoContext.js +3 -2
package/dist/dito-admin.es.js
CHANGED
|
@@ -304,7 +304,7 @@ var G = class e {
|
|
|
304
304
|
return W(this, "schema", null);
|
|
305
305
|
}
|
|
306
306
|
get value() {
|
|
307
|
-
return W(this, "value", () => this.nested ? je(this.rootItem, this.dataPath) : void 0);
|
|
307
|
+
return W(this, "value", () => this.nested ? je(this.rootItem, this.dataPath, () => void 0) : void 0);
|
|
308
308
|
}
|
|
309
309
|
get dataPath() {
|
|
310
310
|
return W(this, "dataPath", "");
|
package/dist/dito-admin.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t(require("vue"),require("vue-router"),require("@kyvg/vue3-notification"),require("@ditojs/utils"),require("tippy.js"),require("nanoid"),require("@vueuse/shared"),require("@vueuse/core"),require("focus-trap"),require("sortablejs"),require("codeflask"),require("vue-color"),require("@tiptap/vue-3"),require("@tiptap/extension-document"),require("@tiptap/extension-text"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-italic"),require("@tiptap/extension-link"),require("@tiptap/extension-strike"),require("@tiptap/extension-subscript"),require("@tiptap/extension-superscript"),require("@tiptap/extension-underline"),require("@tiptap/extension-blockquote"),require("@tiptap/extension-code-block"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-heading"),require("@tiptap/extension-paragraph"),require("@tiptap/extension-horizontal-rule"),require("@tiptap/extension-ordered-list"),require("@tiptap/extension-bullet-list"),require("@tiptap/extension-list-item"),require("tiptap-footnotes"),require("@tiptap/extension-history"),require("vue-multiselect"),require("vue-upload-component")):typeof define==`function`&&define.amd?define(`vue,vue-router,@kyvg/vue3-notification,@ditojs/utils,tippy.js,nanoid,@vueuse/shared,@vueuse/core,focus-trap,sortablejs,codeflask,vue-color,@tiptap/vue-3,@tiptap/extension-document,@tiptap/extension-text,@tiptap/extension-bold,@tiptap/extension-code,@tiptap/extension-italic,@tiptap/extension-link,@tiptap/extension-strike,@tiptap/extension-subscript,@tiptap/extension-superscript,@tiptap/extension-underline,@tiptap/extension-blockquote,@tiptap/extension-code-block,@tiptap/extension-hard-break,@tiptap/extension-heading,@tiptap/extension-paragraph,@tiptap/extension-horizontal-rule,@tiptap/extension-ordered-list,@tiptap/extension-bullet-list,@tiptap/extension-list-item,tiptap-footnotes,@tiptap/extension-history,vue-multiselect,vue-upload-component`.split(`,`),t):(e=typeof globalThis<`u`?globalThis:e||self,e[`dito-admin`]=t(e.vue,e[`vue-router`],e[`@kyvg/vue3-notification`],e[`@ditojs/utils`],e.tippy.js,e.nanoid,e[`@vueuse/shared`],e[`@vueuse/core`],e[`focus-trap`],e.sortablejs,e.codeflask,e[`vue-color`],e[`@tiptap/vue-3`],e[`@tiptap/extension-document`],e[`@tiptap/extension-text`],e[`@tiptap/extension-bold`],e[`@tiptap/extension-code`],e[`@tiptap/extension-italic`],e[`@tiptap/extension-link`],e[`@tiptap/extension-strike`],e[`@tiptap/extension-subscript`],e[`@tiptap/extension-superscript`],e[`@tiptap/extension-underline`],e[`@tiptap/extension-blockquote`],e[`@tiptap/extension-code-block`],e[`@tiptap/extension-hard-break`],e[`@tiptap/extension-heading`],e[`@tiptap/extension-paragraph`],e[`@tiptap/extension-horizontal-rule`],e[`@tiptap/extension-ordered-list`],e[`@tiptap/extension-bullet-list`],e[`@tiptap/extension-list-item`],e[`tiptap-footnotes`],e[`@tiptap/extension-history`],e[`vue-multiselect`],e[`vue-upload-component`]))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,ee,te,ne,re,ie,ae,oe,se,ce,le,ue,de,fe,pe,me,he,ge){var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,xe=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty,Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t||ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Se.call(e,s)&&s!==n&&ve(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},y=(e,t,n)=>(n=e==null?{}:_e(xe(e)),we(t||!e||!e.__esModule||!Se.call(e,`default`)?ve(n,`default`,{value:e,enumerable:!0}):n,e));n=y(n,1),i=y(i),l=y(l,1),u=y(u),he=y(he),ge=y(ge);function Te(e=``){let t={},n=e.toLowerCase(),[r]=/(iphone|ipad|linux; android|darwin|win|mac|linux|freebsd|sunos)/.exec(n)||[],i={darwin:`mac`,iphone:`ios`,ipad:`ios`,"linux; android":`android`}[r]||r;return i&&(t.platform=i,t[i]=!0),n.replace(/(opera|chrome|safari|webkit|firefox|msie|trident)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv:v?([.\d]+))?/g,(e,n,r,i,a)=>{if(!t.chrome){let e=a||i||r;(!t.version||n!==`safari`)&&(t.version=e,t.versionNumber=parseFloat(e)),t.browser=n,t[n]=!0}}),t.chrome&&delete t.webkit,t}var Ee=(0,e.reactive)({title:``,routeComponents:[],user:null,agent:Te(navigator.userAgent||``),loadCache:{},activeLabel:null,clipboardData:null});function b(e,t){return e?`${e}/${t}`:t}function De(e,t){if(e==null||t==null)return null;let n=(0,r.normalizeDataPath)(e),i=(0,r.normalizeDataPath)(t);return n===i?``:i?n.startsWith(`${i}/`)?n.slice(i.length+1):null:n}function Oe(e){let t=(0,r.parseDataPath)(e);return t?.pop(),t}function ke(e){return(0,r.normalizeDataPath)(Oe(e))}function Ae(e,t=!1){return t?Oe(e):(0,r.parseDataPath)(e)}function je(e,t=!1){return(0,r.normalizeDataPath)(Ae(e,t))}function Me(e,t=!1){let n=Ae(e,t);if(n){let e;do e=n.pop();while(e!=null&&(0,r.isInteger)(+e));if(e!=null)return n}return null}function Ne(e,t=!1){return(0,r.normalizeDataPath)(Me(e,t))}function Pe(e,t,n=!1){let i=Ae(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Fe(e,t,n=!1){let i=Me(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Ie(e){let t=(0,r.parseDataPath)(e);return t[t.length-1]}function Le(e){let t=Ie(e);return t==null||(0,r.isInteger)(+t)?null:t}function Re(e){let t=Ie(e),n=t==null?null:+t;return(0,r.isInteger)(n)?n:null}var ze=0;function Be(e,t=`id`){e[t]=`@${++ze}`}function Ve(e){return/^@/.test(e)}function He(e,t=`id`){return e?.[t]!=null&&Object.keys(e).length===1}var Ue={},We={};function Ge(e,t){Ue[e]=t}function Ke(e,t=!1){let n=Ue[e]||null;if(!n&&!t&&!We[e])throw We[e]=!0,Error(`Unknown Dito.js component type: '${e}'`);return n}function qe(e){return(0,r.isObject)(e)?e.type:e}function x(e){return Ke(qe(e),!0)??null}function Je(e){return x(e)?.getSourceType?.(qe(e))??null}function Ye(e,t){for(let n of e)if(ct(n)){let e=t(n.component,n.name,0);if(e!==void 0)return e}else if(S(n))for(let[e,r]of Object.entries(n.components||{})){let n=t(r,e,1);if(n!==void 0)return n}}function Xe(e,t){return e?Ye([e,...pt(e)],t):void 0}function Ze(e,t){return Xe(e,e=>t(e)?e:void 0)??null}function Qe(e,t){return Xe(e,(e,n)=>t(e,n)?!0:void 0)??!1}function $e(e){return Qe(e,()=>!0)??!1}function et(e,t){return!!Xe(e,(e,n)=>{if(C(e)?n===t:et(e,t))return!0})}function S(e){return(0,r.isObject)(e)&&(0,r.isString)(e.type)}function tt(e){return S(e)&&e.type===`form`}function nt(e){return S(e)&&e.type===`view`}function rt(e){return S(e)&&e.type===`tab`}function it(e){return S(e)&&e.type===`panel`}function at(e){return it(e)&&!!e.data}function ot(e){return S(e)&&e.type===`menu`}function st(e){return JSON.stringify(e)}function ct(e){return nt(e)&&(0,r.isObject)(e.component)}function lt(e){return!!e.compact}function ut(e){return!!(e.inlined||e.components)}function C(e){return!!(e.nested||x(e)?.defaultNested===!0)}function dt(e,t){let{label:n}=e;return n!==!1&&(!!n||t&&x(e)?.generateLabel)}function ft(e){return!!x(e)?.omitSpacing}function pt(e){return e?.tabs?Object.values(e.tabs):[]}function mt(e){return e?.panels?Object.values(e.panels):[]}function ht(e){return Je(e)===`object`}function w(e){return Je(e)===`list`}function gt(e){return!!Je(e)&&!!e.resource}var{hasOwnProperty:_t}=Object.prototype,vt=new WeakMap;function yt(t){let n=(0,e.toRaw)(t),r=n,i;do{if(i=vt.get(r),i)break;r=Object.getPrototypeOf(r)}while(r);return i&&r!==n&&vt.set(r,i),i}function T(e,t,n){let i=yt(e),a=t in i?i[t]:void 0;return a!==void 0||_t.call(i,t)?a:(0,r.isFunction)(n)?n():n}function bt(e,t,n){yt(e)[t]=n}var E=class e{constructor(e,t){t=t?(0,r.isFunction)(t)?t():{...t}:{},t.nested??=!0,t.component=e;let n=Object.setPrototypeOf(t,e);vt.set(this,n)}static get(t,n){return n instanceof e?n:new e(t,n)}static createForSchema(t,{schema:n,name:r,nested:i=C(n),data:a,dataPath:o,rootData:s}){return new e(t,()=>({schema:n,name:r,nested:i,data:a,dataPath:o,rootData:s,get value(){return r==null?void 0:a?.[r]}}))}createChildContext(t,n){let r=C(t),i=!!this.schema&&C(this.schema);return e.createForSchema(this.component,{schema:t,name:n,nested:r,data:i?this.item?.[this.name]:this.item,dataPath:r?b(this.dataPath,n):this.dataPath,rootData:this.rootItem})}extend(e){return Object.setPrototypeOf(e,this)}get nested(){return T(this,`nested`,!0)}get schema(){return T(this,`schema`,null)}get value(){return T(this,`value`,()=>this.nested?(0,r.getValueAtDataPath)(this.rootItem,this.dataPath):void 0)}get dataPath(){return T(this,`dataPath`,``)}get name(){return T(this,`name`,()=>Le(this.dataPath))}get index(){return T(this,`index`,()=>Re(this.dataPath))}get itemDataPath(){return je(this.dataPath,this.nested)}get parentItemDataPath(){return Ne(this.dataPath,this.nested)}get itemIndex(){return Re(this.itemDataPath)}get parentItemIndex(){return Re(this.parentItemDataPath)}get item(){return T(this,`data`,()=>Pe(this.rootItem,this.dataPath,this.nested)||null)}get parentItem(){let e=Fe(this.rootItem,this.dataPath,this.nested)||null;return e===this.item?null:e}get rootItem(){return T(this,`rootData`,null)}get processedItem(){return T(this,`processedData`,null)}get processedRootItem(){return T(this,`processedRootData`,null)}get clipboardItem(){return T(this,`clipboardData`,null)}get user(){return T(this,`user`,null)}get api(){return T(this,`api`,null)}get views(){return T(this,`views`,null)}get flattenedViews(){return T(this,`flattenedViews`,null)}get itemLabel(){return T(this,`itemLabel`,null)}get formLabel(){return T(this,`formLabel`,null)}get component(){return T(this,`component`,null)}get schemaComponent(){return T(this,`schemaComponent`,null)}get formComponent(){return T(this,`formComponent`,null)}get viewComponent(){return T(this,`viewComponent`,null)}get dialogComponent(){return T(this,`dialogComponent`,null)}get panelComponent(){return T(this,`panelComponent`,null)}get resourceComponent(){return T(this,`resourceComponent`,null)}get sourceComponent(){return T(this,`sourceComponent`,null)}get option(){return T(this,`option`,void 0)}get options(){return T(this,`options`,void 0)}get open(){return T(this,`open`,void 0)}get searchTerm(){return T(this,`searchTerm`,void 0)}get error(){return T(this,`error`,void 0)}get wasNotified(){return T(this,`wasNotified`,!1)}get isRunning(){return T(this,`isRunning`,!1)}set isRunning(e){bt(this,`isRunning`,e)}get query(){return this.component.$route.query}get request(){return e=>this.component.request(e)}get format(){return(e,t)=>this.component.format(e,t)}get navigate(){return e=>this.component.navigate(e)}get download(){return e=>this.component.download(e)}get getResourceUrl(){return e=>this.component.getResourceUrl(e)}get notify(){return e=>{this.component.notify(e),bt(this,`wasNotified`,!0)}}},xt={data(){return{listeners:null}},methods:{on(e,t){if((0,r.isArray)(e))for(let n of e)this.on(n,t);else if((0,r.isPlainObject)(e))for(let t in e)this.on(t,e[t]);else{let n=this.listeners||=Object.create(null),{callbacks:r}=n[e]||={callbacks:[],queue:[]};r.push(t)}return this},once(e,t){let n=(...r)=>(this.off(e,n),t.apply(this,r));return n.callback=t,this.on(e,n)},off(e,t){if(!arguments.length)delete this.listeners;else if((0,r.isArray)(e))for(let n of e)this.off(n,t);else if((0,r.isPlainObject)(e))for(let t in e)this.off(t,e[t]);else{let n=this.listeners?.[e];if(n){if(!t)delete this.listeners[e];else{let{callbacks:e}=n,r=e.findIndex(e=>e===t||e.callback===t);r!==-1&&e.splice(r,1)}}}return this},emit(e,...t){let n=this.listeners?.[e];if(n){let{queue:r,callbacks:i}=n;return new Promise(n=>{let a=async()=>{let t=r.shift();if(t){let n,r=[];for(let e of i)try{let r=await e.apply(this,t.args);r!==void 0&&(n=r)}catch(e){r.push(e)}if(r.length>0){let n=AggregateError(r,`Errors during event handler for '${e}'`);t.resolve(Promise.reject(n))}else t.resolve(n);a()}};r.push({args:t,resolve:n}),r.length===1&&a()})}return Promise.resolve()},hasListeners(e){if((0,r.isArray)(e)){for(let t of e)if(!this.hasListeners(t))return!1;return e.length>0}return!!this.listeners?.[e]},delegate(e,t){if(t){if((0,r.isArray)(e))for(let n of e)this.delegate(n,t);else this.on(e,(...n)=>t.emit(e,...n))}return this}}},St=new WeakMap,Ct=0;function wt(t,n=null){let r=(0,e.toRaw)(t),i=St.get(r);return!i&&t&&(i=n?.(t)||`@${++Ct}`,St.set(r,i)),i}var Tt=class{graph={};references={};set(e,t,n){e=(0,r.parseDataPath)(e);let i=this.graph;for(let t of e){let e=(0,r.isInteger)(+t)?`*`:t;i=i[e]??={}}i.$settings={...n,...i.$settings,...t}}addSource(e,t){this.set(e,{type:`source`,schema:t},{related:!1})}setSourceRelated(e){this.set(e,{related:!0,reference:this.getReferencePrefix(e)})}addRelation(e,t,n){this.set(e,{type:`relation`,schema:n,internal:!!t,reference:this.getReferencePrefix(t)})}getReferencePrefix(e){return e?this.references[e]??=(0,a.nanoid)(6):null}flatten(){let e=t=>{let n=[];for(let[r,{$settings:i,...a}]of Object.entries(t)){i&&n.push([r,i]);for(let[t,i]of e(a))n.push([`${r}/${t}`,i])}return n};return e(this.graph)}process(e,t,{target:n}){let i=n===`clipboard`;i&&delete t[e.idKey||`id`];for(let[e,n]of this.flatten()){let{type:a,schema:o,internal:s,related:c,reference:l}=n,u=a===`source`,d=a===`relation`;if(u||d&&s){let n=(0,r.getValueAtDataPath)(t,e,()=>null),a=i&&u&&!c,f=i&&(d&&s||u&&c);for(let e of(0,r.asArray)(n).flat()){let t=u&&o.idKey||d&&o.relateBy||`id`,n=e?.[t];if(n!=null&&(a&&delete e[t],f||Ve(n))){Ve(n)&&(n=n.slice(1));let r=i?t:u?`#id`:`#ref`;e[r]=i?`@${n}`:l?`${l}-${n}`:n,r!==t&&delete e[t]}}}}return t}},Et={Boolean:r.isBoolean,Number:r.isNumber,String:r.isString,Date:r.isDate,Array:r.isArray,Object:r.isObject,RegExp:r.isRegExp,Function:r.isFunction},Dt={Boolean:e=>!!e,Number:e=>+e,String:e=>String(e),Date:e=>(0,r.isDate)(e)?e:new Date(e),Array:e=>(0,r.isArray)(e)?e:(0,r.isString)(e)?e.split(`,`):(0,r.asArray)(e),Object:e=>(0,r.isObject)(e)?e:e===!0?{}:null,RegExp:e=>(0,r.isRegExp)(e)?e:new RegExp(e)};function Ot(e,t){if(e&&t!=null){for(let n of e)if(Et[n.name]?.(t))return!0}return!1}function kt(e,t){let n=e&&Dt[e.name||e];return n?n(t):t}var At={},jt=new WeakMap;function D(e){return S(e)&&((0,r.isObject)(e.form||e.forms||e.components)||(0,r.isFunction)(e.components))}function Mt(e){return S(e)&&Object.keys(e?.forms||{}).length>1}function Nt(e,t){let{view:n}=e,r=n&&t.flattenedViews[n];return r&&Ze(r,D)||null}function Pt(e,t){return Nt(e,t)?t.flattenedViews[e.view]:null}function Ft(e,t){return!!Pt(e,t)}function It(e,t){let n=Pt(e,t);return n?ct(n)?n.fullPath:`${n.fullPath}/${n.path}`:null}function Lt(e,t,n){let r=It(e,n);return r?`${r}/${t}`:null}function O(e,t,n){let i=t&&Nt(e,t);if(i)e=i;else if(e.view)throw Error(`Unknown view: '${e.view}'`);let{form:a,forms:o}=e;if(!a&&!o){let{name:t,compact:n,clipboard:r,tabs:i,components:o}=e;if(o||i)a={type:`form`,name:t,compact:n,clipboard:r,tabs:i,components:o};else return{}}return o||={default:a},Object.fromEntries(Object.entries(o).map(([e,i])=>(t&&(0,r.isFunction)(i.components)&&(i=Rt(i,t)),[e,n?.(i)??i])))}function Rt(t,n){let{item:i}=n;if(!(0,r.isObject)(i))return zt(t,n);let a=jt.get(t.components);a||(a=new WeakMap,jt.set(t.components,a));let o=a.get(i);return o||(o=(0,e.computed)(()=>zt(t,n)),a.set(i,o)),o.value}function zt(t,n){let r=(0,e.reactive)({...t,components:t.components(n)});return Gn(n.api,r).catch(console.error),r}function Bt(e,t){return e[t?.type]||e.default||null}function Vt(e,t,n){return Bt(O(e,n),t)||At}function Ht(e){return e===At}function k(e,t){let n=(e,n)=>e.length>0?e.reduce((e,r)=>{let i=n(r);return i&&(e[i.name]=i&&t?{...t,...i}:i),e},{}):null;return(0,r.isArray)(e)?n(e,e=>(0,r.isObject)(e)?e:{name:(0,r.camelize)(e,!1)}):(0,r.isObject)(e)?n(Object.entries(e),([e,t])=>(0,r.isObject)(t)?{name:e,...t}:(0,r.isString)(t)?{name:e,label:t}:null):null}function A(e){return k(e,{type:`button`})}function Ut(e,t,n,r){return e?{schema:e,dataPath:t,componentPath:n,tabComponent:r}:null}function Wt(e,t,n,r=null,i=[]){if(e)for(let[a,o]of Object.entries(e)){let e=Ut(o,b(t,a),b(n,a),r);e&&i.push(e)}return i}function Gt(e,t,n,r,i,a=null,o=null){let s=x(t)?.getPanelSchema?.(e,t,n,a),c=s?[Ut(s,b(n,s.name),b(r,s.name),o)]:[];return Wt(t?.panels,n,i,o,c),c}function j(e,{type:t,schema:n,callback:i=!0,default:a,context:o}={}){let s=t&&(0,r.asArray)(t),c=n?(0,r.isArray)(e)?(0,r.getValueAtDataPath)(n,e,()=>void 0):n[e]:void 0;if(c===void 0&&a!==void 0)return i&&(0,r.isFunction)(a)&&!Ot(s,a)&&(a=a(o)),a;if(Ot(s,c))return c;if(i&&(0,r.isFunction)(c)&&(c=c(o)),s&&c!=null&&!Ot(s,c))for(let e of s){let t=kt(e,c);if(t!==c)return t}return c}function Kt(e,t){return j(`if`,{type:Boolean,schema:e,context:t,default:!0})&&(!$e(e)||!!Je(e)||Qe(e,(e,n)=>Kt(e,t.createChildContext(e,n))))}function M(e){return(0,r.isFunction)(e)?e():e}function qt(e,t){let n=e.default===void 0?x(e)?.defaultValue:e.default;return(0,r.isFunction)(n)?n(M(t)):(0,r.clone)(n)}function Jt(e,t){let n=e.exclude===void 0?x(e)?.excludeValue:e.exclude;return(0,r.isFunction)(n)?n(M(t)):!!n}function Yt(e,t){return!!x(e)?.ignoreMissingValue?.(M(t))}function Xt(e,t,n,r){return!(n in t)||!!x(e)?.treatNullAsMissing?.(M(r))&&t[n]===null}function Zt(e){return!!x(e)?.valueFromDataSchema&&!!(e.data||e.dataPath)}function Qt(e){return e.multiple??!!x(e)?.defaultMultiple}function $t(e,t,n,r,{shouldSetDefaultsOfComponentsWithCompute:i=!0}={}){return(i||!e.compute)&&Xt(e,t,n,r)&&!Yt(e,r)}function en(e,t={},n,{dataPath:i=null,rootData:a=t,shouldProcess:o,shouldSkipSourcesWithResource:s=!1,shouldSetDefaultsOfComponentsWithCompute:c=!0}={}){return N(e,t,{dataPath:i,before:({schema:e,data:t,name:i,dataPath:o})=>{let s=()=>new E(n,{schema:e,name:i,data:t,dataPath:o,rootData:a});$t(e,t,i,s,{shouldSetDefaultsOfComponentsWithCompute:c})&&(t[i]=qt(e,s)),cn(e)&&(0,r.isArray)(t[i])&&ln(e,t[i])},shouldProcess:o,shouldSkipSourcesWithResource:s,options:{component:n,rootData:a}})}function tn(e,t,n,r,{component:i=null,rootData:a=i?.rootData,getOptions:o=null}={}){let s=()=>new E(i,()=>{let i={schema:e,get value(){return t[n]},name:n,data:t,dataPath:r,rootData:a};return o&&Object.defineProperty(i,"options",{get:o,enumerable:!0}),i}),{compute:c}=e;if(c&&j(`if`,{type:Boolean,schema:e,context:M(s),default:!0})){let e=c(M(s));if(e!==void 0)return e}return nn(e,t,n,s)}function nn(e,t,n,r){return Xt(e,t,n,r)&&!Yt(e,r)?qt(e,r):t[n]}function rn(e,t,n){if(n.schemaOnly){let n={},{idKey:r=`id`,orderKey:i}=e,a=t[r];return a!==void 0&&(n[r]=a),Mt(e)&&(n.type=t.type),i&&(n[i]=t[i]),n}return{...t}}function an(e,t,n,i,{component:a,rootData:o,schemaOnly:s,target:c,shouldCallProcess:l=!0}={}){let u={component:a,rootData:o,schemaOnly:s,target:c},d=rn(t,n,u),f=new Tt;return N(e,n,{dataPath:i,processedData:d,before:({schema:e,data:t,name:n,dataPath:i,processedData:o})=>{let s=nn(e,t,n,()=>E.createForSchema(a,{schema:e,name:n,data:t,dataPath:i,rootData:u.rootData}));if((0,r.isArray)(s)){let{wrapPrimitives:t}=e;s=t?s.map(e=>({[t]:e})):[...s]}o[n]=s},after:({schema:e,data:t,name:n,dataPath:i,processedData:o})=>{let{wrapPrimitives:s,process:c}=e,d=o[n],p=()=>new E(a,{schema:e,value:d,name:n,data:t,dataPath:i,rootData:u.rootData,processedData:o});s&&(0,r.isArray)(d)&&(d=d.map(e=>e[s]));let m=x(e)?.processValue;m&&(d=m(M(p),f)),c&&l&&(d=c(M(p))),(!c||l)&&Jt(e,p)?delete o[n]:o[n]=d},options:u}),f.process(t,d,u)}function N(e,t,{dataPath:n=null,componentPath:i=``,processedData:a=null,wrappedPrimitiveName:o=null,before:s=null,after:c=null,shouldProcess:l=()=>!0,shouldSkipSourcesWithResource:u=!1,options:d}){let f={before:s,after:c,shouldProcess:l,shouldSkipSourcesWithResource:u,options:d},p=(e,t)=>e==null?null:b(e,t),m=(e,i)=>{if(e)for(let[m,g]of Object.entries(e)){let e=C(g),_=e&&m!==o?p(n,m):n,v={schema:g,data:t,name:m,dataPath:_,componentPath:b(i,m),processedData:a};if(l(v)){if(u&>(g)){h(g.panels,v.componentPath);continue}if(!at(g)){if(!e)N(g,t,{...f,dataPath:n,componentPath:v.componentPath,processedData:a});else{let{wrapPrimitives:e}=g,n=(n,i=null)=>{e&&!(0,r.isObject)(n)&&(n={[e]:n});let o=i===null?_:p(_,i),s=i===null?v.componentPath:b(v.componentPath,i),c=new E(d.component,{schema:g,data:t,dataPath:_,name:m,rootData:d.rootData}),l=Bt((x(g)?.getFormSchemasForProcessing||O)(g,c),n);if(l){let t=a?rn(g,n,d):null;return N(l,n,{...f,dataPath:o,componentPath:s,processedData:t,wrappedPrimitiveName:e??null})}return{...n}};if(s?.(v),D(g)){let e=a?a[m]:t[m];e!=null&&(e=(0,r.isArray)(e)?a?e.map(n):e.forEach(n):n(e),a&&(a[m]=e))}c?.(v),h(g.panels,v.componentPath)}}}}},h=(e,r)=>{for(let[i,o]of Object.entries(e||{})){let e={schema:o,data:t,name:null,dataPath:n,componentPath:b(r,i),processedData:a};l(e)&&!at(o)&&m(o.components,e.componentPath)}};return m((0,r.isFunction)(e.components)?Vt(e,t,new E(d.component,{schema:e,data:t,dataPath:n,rootData:d.rootData})).components:e.components,i),h(e.tabs,i),h(e.panels,i),a||t}function on(e,t,n,{componentPath:r=``,component:i=null,rootData:a=t}={}){let o={dataPath:``,componentPath:r};t&&N(e,t,{dataPath:``,componentPath:r,shouldProcess:e=>De(n,e.dataPath)!==null,before:e=>{e.dataPath.length>o.dataPath.length&&(o=e)},options:{component:i,rootData:a}});let s=De(n,o.dataPath);return s?b(o.componentPath,s):o.componentPath}function sn(e,t){let n=t[e.idKey||`id`];return n==null?void 0:String(n)}function cn(e){return!!e.orderKey&&!e.wrapPrimitives}function ln(e,t,n){let{orderKey:r}=e;if(r){let e=n?.[0]||0;for(let n=0;n<t.length;n++)t[n][r]=n+e}return t}function un(e,t){return wt(t,t=>sn(e,t))}var dn={computed:{value:{get(){let e=nn(this.schema,this.data,this.name,()=>E.createForSchema(this,{schema:this.schema,name:this.name,data:this.data,dataPath:this.dataPath,rootData:this.rootData})),{format:t}=this.schema;return(0,r.isFunction)(t)?t(new E(this,{value:e})):e},set(e){let{parse:t}=this.schema;t&&(e=t(new E(this,{value:e}))),this.parsedValue=e,this.data[this.name]=e}}}},P={computed:{context(){return new E(this,{nested:this.nested})},parentData(){let e=Fe(this.rootData,this.dataPath,this.nested);return e===this.data?null:e},processedData(){return fn(this,this.dataPath,this.nested)},processedRootData(){return fn(this,``,!1)},item(){return this.data},parentItem(){return this.parentData},rootItem(){return this.rootData},processedItem(){return this.processedData},processedRootItem(){return this.processedRootData}}};function fn(e,t,n=!1){let{schemaComponent:r}=e;for(;r.dataPath.length>t.length;)r=r.parentSchemaComponent;return Pe(r.processedData,t.slice(r.dataPath.length),n)}var pn={validate:e=>(0,r.isCreditCard)(e),message:`is invalid`},mn={validate:(e,t)=>{let n=t===`*`?`+`:`{1,${t}}`;return RegExp(`^[-+]?\\d*(\\.\\d${n})?$`).test(e)},message:(e,t)=>`must be numeric and may contain ${!t||t===`*`?``:t} decimal points`},hn={validate:e=>(0,r.isEmail)(e),message:`must be a valid email`},gn={validate:e=>(0,r.isHostname)(e),message:`is not a host name`},_n={validate:e=>(0,r.isDomain)(e),message:`is not a domain`},vn={validate:e=>(0,r.isInteger)(e),message:`must be whole number`},yn={validate:(e,t)=>e<=t,message(e,t){return`must be ${t} or less`}},bn={validate:(e,t)=>e>=t,message(e,t){return`must be ${t} or more`}},xn={validate:()=>!0},Sn={validate:(e,[t,n])=>e>=t&&e<=n,message(e,[t,n]){return`must be between ${t} and ${n}`}},Cn={validate:(e,t,{password:n})=>e!=null&&e!==``||n&&e===void 0,message:`is required`},wn={validate:e=>(0,r.isUrl)(e),message:`is not a valid URL`},Tn=Ce({creditcard:()=>pn,decimals:()=>mn,domain:()=>_n,email:()=>hn,hostname:()=>gn,integer:()=>vn,max:()=>yn,min:()=>bn,password:()=>xn,range:()=>Sn,required:()=>Cn,url:()=>wn});function En(e,t){let n={...x(e)?.getTypeValidations?.(e,t)};j(`required`,{type:Boolean,schema:e,context:t})&&(n.required=!0);for(let[t,r]of Object.entries(e.rules||{}))r===void 0?delete n[t]:n[t]=r;return n}function Dn(e,t){let n=[];for(let[i,a]of Object.entries(t)){let o=Tn[i];if(o&&(i===`required`||e!=null&&e!==``)){let{validate:i,message:s}=o;i(e,a,t)||n.push({message:(0,r.isFunction)(s)?s(e,a,t):s})}}return n}function On(e,t,{dataPath:n=``,component:i=null,rootData:a=t}={}){let o=null,s=({schema:e,data:t,name:n,dataPath:r})=>new E(i,{schema:e,value:n==null?void 0:t[n],name:n,data:t,dataPath:r,rootData:a});return N(e,t,{dataPath:n,shouldProcess:e=>Kt(e.schema,s(e)),shouldSkipSourcesWithResource:!0,before:e=>{let{schema:t,data:n,name:i,dataPath:a}=e,c=s(e),l=n[i],{format:u}=t;(0,r.isFunction)(u)&&(l=u(c));let d=En(t,c),f=Dn(l,d);f.length>0&&(o||={},o[a]=f)},options:{component:i,rootData:a}}),o}function kn(e,t){let n;if((0,r.isFunction)(t))n=t;else if((0,r.isRegExp)(t))n=e=>t.test(e);else{let e=(0,r.asArray)(t).map(r.normalizeDataPath);n=t=>e.includes(t)}let i=Object.entries(e||{}).filter(([e])=>n(e));return i.length>0?Object.fromEntries(i):null}var An={emits:[`errors`],data(){return{isTouched:!1,isDirty:!1,isValidated:!1,isValid:!1,errors:null,valueWithErrors:void 0}},computed:{hasErrors(){return!!this.errors}},methods:{resetValidation(){this.isTouched=!1,this.isDirty=!1,this.isValidated=!1,this.isValid=!1,this.clearErrors()},validate(e=!0){let t=Dn(this.value,this.validations),n=t.length===0;if(e){this.clearErrors();for(let{message:e}of t)this.addError(e,!0);this.isValidated=!0,this.isValid=n}return n},verify(){return this.validate(!1)},markTouched(){this.isTouched=!0,this.clearErrors()},markDirty(){this.isDirty=!0,this.isValidated=!1,this.isValid=!1,this.clearErrors()},addError(e,t=!1){this.errors||=[],this.valueWithErrors=this.value,t&&(e=`The ${this.label||this.placeholder||this.name} field ${e}.`),this.errors.push(e),this.$emit(`errors`,this.errors)},showValidationErrors(e,t){if(this.errors=[],e.length===0)return!1;for(let{message:t}of e)this.addError(t,!0);return t&&this.scrollIntoView(),!0},getErrors(){return this.errors?[...this.errors]:null},clearErrors(){this.errors=null,this.$emit(`errors`,this.errors)}}};function F(e,{type:t,default:n,get:i,set:a,callback:o=!0}={}){(0,r.isString)(e)&&e.includes(`.`)&&(e=(0,r.parseDataPath)(e));let s=(0,r.normalizeDataPath)(e);return{get(){let r=!i||i.length>0?this.overrides&&s in this.overrides?this.overrides[s]:this.getSchemaValue(e,{type:t,default:n,callback:o}):void 0;return i?i.call(this,r):r},set(e){a?a.call(this,e):(this.overrides||={},this.overrides[s]=e)}}}function jn(e,{default:t,get:n,set:i}={}){return{get(){let i=this.getStore(e);return i===void 0&&t!==void 0&&(i=(0,r.isFunction)(t)?t.call(this):t,this[e]=i,this.getStore(e)),n?n.call(this,i):i},set(t){(!i||(t=i.call(this,t))!==void 0)&&this.setStore(e,t)}}}var Mn={mixins:[dn,P,An],emits:[`update:component`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},width:{type:[Number,String],default:null},label:{type:String,default:null},single:{type:Boolean,default:!1},nested:{type:Boolean,default:!0},accumulatedBasis:{type:Number,default:null}},data(){return{parsedValue:void 0,focused:!1}},computed:{name(){return this.schema.name},type(){return this.schema.type},labelNode(){let e=this.isMounted?this.$el.previousElementSibling:null;return e?.matches(`.dito-label`)?e:null},visible:F(`visible`,{type:Boolean,default(){return this.$options.defaultVisible}}),exclude:F(`exclude`,{type:Boolean,default:!1}),required:F(`required`,{type:Boolean,default:!1}),readonly:F(`readonly`,{type:Boolean,default:!1}),autofocus:F(`autofocus`,{type:Boolean,default:!1}),clearable:F(`clearable`,{type:Boolean,default:!1,get(e){return e&&!this.readonly}}),disabled:F(`disabled`,{type:Boolean,default:!1}),maxLength:F(`maxLength`,{type:Number}),placeholder:F(`placeholder`,{type:String}),autocomplete:F(`autocomplete`,{type:String}),info:F(`info`,{type:String,default:null}),inlineInfo(){return this.label?null:this.info},events(){let e=this.getEvents();for(let t of Object.keys(this.schema.events||{}))e[`on${(0,r.camelize)(t,!0)}`]??=()=>{this.emitEvent(t)};return e},attributes(){let{nativeField:e,textField:t}=this.$options,n={...this.events,disabled:this.disabled||this.readonly&&!t};return e&&(n.name=this.dataPath,this.label&&(n.title=this.label),n.readonly=this.readonly,n.autofocus=this.autofocus,t&&(n.maxlength=this.maxLength,n.placeholder=this.placeholder,n.autocomplete=this.autocomplete)),n},validations(){return En(this.schema,this.context)},showClearButton(){return this.clearable&&this.value!=null}},watch:{value(e){this.hasErrors&&!(0,r.equals)(e,this.valueWithErrors)&&this.clearErrors()},componentPath(e,t){this._registerWithSchemaComponent(!1,t),this._registerWithSchemaComponent(!0,e)}},created(){this._register(!0),this.setupSchemaFields(),this.warnAboutUncomputedValue()},unmounted(){this._register(!1)},methods:{warnAboutUncomputedValue(){this.schema.compute&&!this.dataModel.hasComputedValueEntry(this.componentPath)&&console.warn(`The value of the component at '${this.componentPath}' isn't computed, as its data isn't part of a data model.`)},_register(e){this.$emit(`update:component`,e?this:null),this._registerWithSchemaComponent(e,this.componentPath)},_registerWithSchemaComponent(e,t){this.nested?this.schemaComponent._registerComponent(this,e,t):this.schemaComponent?._registerUnnestedComponent(this,e,t)},getEvents(){let{onFocus:e,onBlur:t,onInput:n,onChange:r}=this;return{onFocus:e,onBlur:t,onInput:n,onChange:r}},async scrollIntoView(){await this.focusSchema(),this.getFocusElement()?.scrollIntoView?.({behavior:`smooth`,block:`center`})},focusElement(){this.getFocusElement()?.focus?.()},blurElement(){this.getFocusElement()?.blur?.()},getFocusElement(){let e=(0,r.asArray)(this.$refs.element)[0]??this;return e.$el??e},async focusSchema(){await this.schemaComponent.focus(),await this.tabComponent?.focus()},async focus(){await this.focusSchema(),this.scrollIntoView(),this.focusElement()},blur(){this.blurElement()},clear(){this.value=null,this.blur(),this.onChange()},onFocus(){this.focused=!0,this.markTouched(),this.emitEvent(`focus`)},onBlur(){this.focused=!1,this.validate(),this.emitEvent(`blur`)},onInput(){this.markDirty(),this.emitEvent(`input`)},onChange(){this.markDirty(),this.emitEvent(`change`,{context:{value:this.parsedValue===void 0?this.value:this.parsedValue},parent:this.schemaComponent})}}},Nn=new WeakMap;async function I(e,t=!1){if(Nn.has(e))return Nn.get(e);let n=e;if((0,r.isFunction)(n)&&(n=n()),(0,r.isPromise)(n)&&(n=await n),(0,r.isModule)(n)&&(n={...n},!n.name&&(t||n.default))){let e=Object.keys(n).filter(e=>e!==`_rerender_only`);if(e.length===1){let t=e[0];n=n[t],t!=="default"&&(n={...n,name:t})}}return Nn.set(e,n),n}async function Pn(e,t=I){let n=(0,r.isFunction)(e)?e():e;return n=await I(n,!1),(0,r.isArray)(n)?n=Object.fromEntries(await(0,r.mapConcurrently)(n,async e=>{let n=await t(e,!0);return[n.name,n]})):(0,r.isObject)(n)&&(n=Object.fromEntries(await(0,r.mapConcurrently)(Object.entries(n),async([e,n])=>[e,await t(n,!0)]))),n}async function Fn(e){return Pn(e,async(e,t)=>(e=await I(e,t),!e.name&&ot(e)&&(e={...e,name:(0,r.camelize)(e.label),items:await Pn(e.items)}),e))}function In(e){return Object.fromEntries(Object.entries(e).reduce((e,[t,n])=>(ot(n)?e.push(...Object.entries(n.items)):e.push([t,n]),e),[]))}async function Ln(t){let{component:n}=t;n&&(n=await I(n,!0),n&&(t.component=(0,e.markRaw)({...n,mixins:[Zn,Mn,...n.mixins||[]]})))}async function Rn(e){await(0,r.mapConcurrently)(Object.values(e||{}),Ln)}var zn=new WeakMap;function L(e,t,n=null,r=0,i=1){if(t){let a=zn.get(t)??0;if(a<i){zn.set(t,a+1);let i=[],o=(t,a,o)=>{i.push(Bn(e,t,a,n,r+o))};return Xe(t,o),Ye(mt(t),o),Promise.all(i)}}}function Bn(e,t,n,i=null,a=0){return R(e,t),Promise.all([(0,r.mapConcurrently)(mt(t),t=>L(e,t,i,a)),x(t)?.processSchema?.(e,t,n,i,a)])}async function Vn(e,t,n,r,i=``){R(t,n),Un(t,n,r,i);let a=[];if(nt(n))await Jn(t,n),await L(t,n,a);else if(ot(n))a=await Promise.all(Object.entries(n.items).map(async([r,i])=>Vn(e,t,i,r,n.fullPath)));else throw Error(`Invalid view schema: '${st(n)}'`);return{path:n.fullPath,children:a,component:e,meta:{api:t,schema:n}}}function R(e,t){let n=e.defaults[t.type]||e.defaults[(0,r.camelize)(t.type)];if(n&&((0,r.isFunction)(n)&&(n=n(t)),(0,r.isObject)(n)))for(let[e,i]of Object.entries(n))t[e]=t[e]===void 0?i:(0,r.assignDeeply)(t[e],i)}function Hn(e,t){Xe(t,t=>{R(e,t);let n=O(t);for(let t of Object.values(n))Hn(e,t)})}function Un(e,t,n,r=null){t.name??=n,t.path??=e.normalizePath(n),r!==null&&(t.fullPath=`${r}/${t.path}`)}async function Wn(e,t,n){let i=[],{form:a,forms:o,components:s,maxDepth:c=1}=t;return o?t.forms=await Pn(o,t=>Gn(e,t,i,n,c)):a?t.form=await Gn(e,a,i,n,c):(0,r.isObject)(s)&&await Gn(e,{type:`form`,components:s},i,n,c),i}async function Gn(e,t,n=null,r=0,i=1){if(t=await I(t,!0),!tt(t))throw Error(`Invalid form schema: '${st(t)}'`);return R(e,t),await Jn(e,t),await L(e,t,n,r,i),t}async function Kn(e,t){if(t=await I(t,!0),!rt(t))throw Error(`Invalid tab schema: '${st(t)}'`);return R(e,t),t}async function qn(e,t){if(t=await I(t,!0),!it(t))throw Error(`Invalid panel schema: '${st(t)}'`);return R(e,t),t}async function Jn(e,t){let{tabs:n,panels:r}=t;n&&(t.tabs=await Pn(n,t=>Kn(e,t))),r&&(t.panels=await Pn(r,t=>qn(e,t)))}function Yn(e){return!!z(e.resource)}function z(e,t={}){let{parent:n,...i}=t;return(0,r.isFunction)(e)&&(e=e(t)),e=(0,r.isObject)(e)?{...i,...e}:(0,r.isString)(e)?{...i,path:e}:null,e&&n!==void 0&&e.parent===void 0&&!e.path?.startsWith(`/`)&&(e.parent=n,e.path||(e.path=`.`)),e}function Xn(e,t){return e!=null&&t?.type===`collection`?{type:`member`,...(0,r.pickBy)(t,(e,t)=>[`method`,`path`,`parent`].includes(t)),id:`${e}`}:null}var Zn={mixins:[xt],inject:[`api`,`$verbs`,`$views`,`$isPopulated`,`$parentComponent`,`$schemaComponent`,`$routeComponent`,`$dataComponent`,`$sourceComponent`,`$resourceComponent`,`$dialogComponent`,`$dataModel`,`$panelComponent`,`$tabComponent`],provide(){let e=()=>this;return this.providesData?{$parentComponent:e,$dataComponent:e}:{$parentComponent:e}},data(){return{appState:Ee,isMounted:!1,overrides:null}},computed:{dataModel(){return this.$dataModel()},providesData(){return!1},sourceSchema(){return this.meta?.schema},user(){return Ee.user},verbs(){return this.$verbs()},views(){return this.$views()},flattenedViews(){return In(this.views)},isPopulated(){return this.$isPopulated()},locale(){return this.api.locale},context(){return new E(this,{nested:!1})},rootComponent(){return this.$root.$refs.root},componentPath(){return this.continueParentComponentPath()},dataPathForComponentPath(){return this.dataPath??this.parentComponent?.dataPathForComponentPath},parentComponent(){return this.$parentComponent()},schemaComponent(){return this.$schemaComponent()},routeComponent(){return this.$routeComponent()},formComponent(){let e=this.routeComponent;return e?.isForm?e:null},viewComponent(){let e=this.routeComponent;return e?.isView?e:null},dataComponent(){return this.providesData?this:this.$dataComponent()},sourceComponent(){return this.$sourceComponent()},resourceComponent(){return this.$resourceComponent()},dialogComponent(){return this.$dialogComponent()},panelComponent(){return this.$panelComponent()},tabComponent(){return this.$tabComponent()},parentSchemaComponent(){return $n(this,`schemaComponent`)},parentRouteComponent(){return $n(this,`routeComponent`)},parentFormComponent(){return $n(this,`formComponent`)},parentResourceComponent(){return $n(this,`resourceComponent`)},rootData(){return this.dataComponent?.data}},mounted(){this.isMounted=!0},beforeCreate(){let e=Qn++;Object.defineProperty(this,"$uid",{get:()=>e})},methods:{labelize:r.labelize,getStore(e){return this.store[e]},setStore(e,t){return this.store[e]=t,t},removeStore(e){delete this.store[e]},getStoreKeyByIndex(e){return this.store.$keysByIndex?.[e]},setStoreKeyByIndex(e,t){this.store.$keysByIndex??={},this.store.$keysByIndex[e]=t},getChildStore(t,n){let r=this.getStore(t);if(!r&&n!=null){let e=this.getStoreKeyByIndex(n);r=this.getStore(e),r&&(this.setStore(t,r),this.removeStore(e))}return r||=this.setStore(t,(0,e.reactive)({})),n!=null&&this.setStoreKeyByIndex(n,t),r},removeChildStore(e,t){this.getChildStore(e,t),this.removeStore(e)},getSchemaValue(e,{type:t,default:n,schema:i=this.schema,context:a=this.context,callback:o=!0}={}){return j(e,{type:t,schema:i,context:a,callback:o,default:(0,r.isFunction)(n)?()=>n.call(this):n})},getLabel(e,t){return e?this.getSchemaValue(`label`,{schema:e,type:[String,Object]})||(0,r.labelize)(t||e.name):(0,r.labelize)(t)||``},getButtonAttributes(e,t=null,n=null){let i=n?null:`${(0,r.labelize)(e)}${t?` ${t}`:``}`;return{class:`dito-button--${e}`,...i&&{title:i,"aria-label":i}}},getQueryLink(e){return{query:e,hash:this.$route.hash}},shouldRenderSchema(e=null){return Kt(e,this.context)},shouldShowSchema(e=null){return this.getSchemaValue(`visible`,{type:Boolean,default:!0,schema:e})},shouldDisableSchema(e=null){return this.getSchemaValue(`disabled`,{type:Boolean,default:!1,schema:e})},getResourcePath(e){return e=z(e,{parent:this.dataComponent?.getResource({method:e?.method,child:e})??null}),this.api.resources.any(e)},getResourceUrl(e){let t=this.getResourcePath(e);return t?this.api.getApiUrl({url:t,query:e.query}):null},async sendRequest({method:e,url:t,resource:n,query:i,data:a,signal:o,internal:s}){t||=this.getResourceUrl(n),e||=n?.method;let c=!s&&this.api.isApiUrl(t);c&&await this.rootComponent.ensureUser();let l=await this.api.request({method:e,url:t,query:i,data:a,signal:o});return c&&e===`patch`&&(0,r.equals)(n,Xn(this.user.id,this.api.users))&&await this.rootComponent.fetchUser(),l},showDialog({components:e,buttons:t,data:n,settings:r}){return this.rootComponent.showDialog({components:e,buttons:t,data:n,settings:r})},request({cache:e,...t}){let n=(e&&{global:this.appState,local:this.dataComponent}[e])?.loadCache,r=n&&`${t.method||`get`} ${t.url} ${JSON.stringify(t.query||``)} ${JSON.stringify(t.data||``)}`;if(n&&r in n)return n[r];let i=this.sendRequest(t).then(e=>e.data).catch(e=>{let t=e.response?.data;throw t?Object.assign(Error(t.message),t):e});return n&&(n[r]=i),i},format(e,{locale:t=this.api.locale,defaults:n=this.api.formats,...i}={}){return(0,r.format)(e,{locale:t,defaults:n,...i})},async navigate(e){return this.$router.push(e)},download(e={}){(0,r.isString)(e)&&(e={url:e});let t=document.createElement(`a`);t.href=e.url?.startsWith(`blob:`)?e.url:this.api.getApiUrl(e),t.download=e.filename??null;let{body:n}=document;n.appendChild(t),t.click(),n.removeChild(t)},continueParentComponentPath(){let{parentComponent:e}=this,t=e?.componentPath??``,n=De(this.dataPath,e?.dataPathForComponentPath);return n?b(t,n):t},async waitForPendingLoadsOf(e){this.rootComponent.registerLoading(!0);try{await e.waitForPendingLoads()}finally{this.rootComponent.registerLoading(!1)}},notify(e){this.rootComponent.notify(e)},closeNotifications(){this.rootComponent.closeNotifications()},setupSchemaFields(){this.setupMethods(),this.setupComputed(),this.setupEvents()},setupMethods(){for(let[e,t]of Object.entries(this.schema.methods||{}))(0,r.isFunction)(t)?this[e]=t:console.error(`Invalid method definition: ${e}: ${t}`)},setupComputed(){let t=({get:t,set:n})=>{let r=(0,e.computed)(()=>t.call(this));return{get:()=>r.value,set:n?e=>n.call(this,e):void 0}};for(let[e,n]of Object.entries(this.schema.computed||{})){let i=(0,r.isFunction)(n)?t({get:n}):(0,r.isObject)(n)&&(0,r.isFunction)(n.get)?t(n):null;i?Object.defineProperty(this,e,i):console.error(`Invalid computed property definition: ${e}: ${n}`)}},setupEvents(){let{watch:e,events:t}=this.schema;if(e){let t=(0,r.isFunction)(e)?e.call(this):e;(0,r.isObject)(t)&&this.$nextTick(()=>{for(let[e,n]of Object.entries(t)){let t=this.schemaComponent.getComponentByName(e)?`data.${e}`:e;this.$watch(t,n)}})}let n=(e,t,n)=>{(0,r.isFunction)(n)?this.on((0,r.hyphenate)(t),n):console.error(`Invalid event definition: ${e}: ${n}`)};if(t)for(let[e,r]of Object.entries(t))n(e,e,r);for(let[e,t]of Object.entries(this.schema))/^on[A-Z]/.test(e)&&n(e,e.slice(2),t)},emitEvent(e,{context:t=null,parent:n=null}={}){let r=this.hasListeners(e),i=n?.hasListeners(e);if(r||i){let a=n=>n.emit(e,t=E.get(this,t)),o=e=>i&&e!==!1?a(n).then(()=>e):e,s=()=>r?a(this).then(o):o(void 0);return[`load`,`change`].includes(e)?this.waitForDataModel().then(s):s()}},async waitForDataModel(){await this.$nextTick(),await this.dataModel?.waitForPendingLoads()},emitSchemaEvent(e,t){return this.schemaComponent.emitEvent(e,t)}}},Qn=0;function $n(e,t){let n=e[t],r=e.parentComponent;for(;r&&r[t]===n;)r=r.parentComponent;return r?.[t]??null}function er(e){let{mixins:t}=e;return t||e.extends?tr({...e},e):e}function tr(e,t){if(t.extends&&tr(e,t.extends),t.mixins)for(let n of t.mixins)tr(e,n);for(let n of nr)n in t&&(e[n]=t[n]);return e}var nr=[`defaultValue`,`defaultNested`,`defaultVisible`,`generateLabel`,`excludeValue`,`ignoreMissingValue`,`treatNullAsMissing`,`valueFromDataSchema`,`omitSpacing`,`processValue`,`getTypeValidations`,`processSchema`,`getPanelSchema`,`getFormSchemasForProcessing`,`beforeRouteUpdate`,`beforeRouteLeave`],rr={},B={mixins:[Zn],components:rr,component(e,t){if(t&&((0,r.isPlainObject)(t)&&(t=er({extends:this,name:e,...t})),rr[e]=t),!(e in rr))throw Error(`Component "${e}" not registered`);return rr[e]},methods:{getTypeComponent:Ke}};function ir(t){return t&&(0,r.asArray)(t).some(t=>t.type!==e.Comment)}function ar(t,n={}){return t=(0,r.isString)(t)?(0,e.useSlots)()[t]:t,ir(t?.(n))}var or=[`type`,`title`,`disabled`],sr={key:0,class:`dito-button__prefix`},cr={key:1,class:`dito-button__text`},lr={key:2,class:`dito-button__suffix`};function ur(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({class:[`dito-button`,[o.classes,{"dito-button--affixed":o.hasAffixes}]],type:r.type,title:r.title,disabled:r.disabled},o.attributes),[o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,sr,[(0,e.renderSlot)(t.$slots,`prefix`)])):(0,e.createCommentVNode)(``,!0),r.text||o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,cr,[(0,e.createTextVNode)((0,e.toDisplayString)(r.text||``),1),(0,e.renderSlot)(t.$slots,`default`)])):(0,e.createCommentVNode)(``,!0),o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,lr,[(0,e.renderSlot)(t.$slots,`suffix`)])):(0,e.createCommentVNode)(``,!0)],16,or)}var V=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},dr=V({inheritAttrs:!1,props:{type:{type:String,default:`button`},text:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1}},computed:{hasAffixes(){return ar(this.$slots.prefix)||ar(this.$slots.suffix)},classes(){return this.$attrs.class},attributes(){let{class:e,...t}=this.$attrs;return t}}},[[`render`,ur]]);function fr(e){return{year:e?.getFullYear()??0,month:e?.getMonth()??0,day:e?.getDate()??0,hour:e?.getHours()??0,minute:e?.getMinutes()??0,second:e?.getSeconds()??0,millisecond:e?.getMilliseconds()??0}}function pr(e,t={}){return new Date(...Object.values({...fr(e),...t}))}function mr(e,{locale:t=`en-US`,date:n=!0,time:r=!0}={}){let i=r?null:0,a=e?.match(/\s*\b([ap])\.?m\.?$/i);a&&(e=e.slice(0,a.index));let[o,s,c,l,u,,d=i,,f=i,,p=i,,m=i]=gr(e,{date:n,time:r});if(u&&u.length>=4){if((t===`en-US`&&s===`/`&&l===`/`||isNaN(+o)&&!isNaN(+c))&&([o,c]=[c,o]),a&&d!==null){let e=a[1].toLowerCase()===`p`;d=d%12+(e?12:0),d=String(d).padStart(2,`0`)}c=_r(c,{locale:t});let e=e=>e===null||e.length===2;if(c!==null&&(!r||e(d)&&e(f)&&e(p))){let e=new Date(+u,+c,+o,+d,+f,+p,+m);return e.getMonth()===+c&&e.getDate()===+o?e:null}}return null}function hr(e,t,{locale:n=`en-US`,date:r=!0,time:i=!0}={}){let a=gr(e,{date:r,time:i}),o=(e,t=a.length)=>{let n=0,r=0;for(;(e===null||n<=e)&&r<t;)n+=a[r++]?.length??0;return{position:n,index:r}},s=r?0:o(null,6).position;t+=s;let{index:c}=o(t),l=n===`en-US`,u=[l?`month`:`day`,null,l?`day`:`month`,null,`year`,null,`hour`,null,`minute`,null,`second`,null,`millisecond`];for(;c--;)if(u[c]){let e=o(null,c).position-s,t=e+a[c].length;return{name:u[c],start:e,end:t}}return null}function gr(e,{date:t=!0,time:n=!0}={}){let r=e?.split(/([\s.,:/]+)/)||[];return t||r.unshift(`1`,`.`,`1`,`.`,`2000`,` `),!n&&r.length>5&&(r.length=5),r}function _r(e,{locale:t=`en-US`}={}){let n=+e;if(!isNaN(n))return n-1;let r=e.trim().toLowerCase();if(r.length<3)return null;let i=new Intl.DateTimeFormat(t,{month:`short`}),a=new Intl.DateTimeFormat(t,{month:`long`});for(let e=0;e<12;e++){let t=new Date(2e3,e,1);if(i.format(t).toLowerCase().startsWith(r)||a.format(t).toLowerCase().startsWith(r))return e}return null}var vr={class:`dito-calendar`,role:`dialog`,"aria-label":`Choose date`},yr={class:`dito-calendar-popup`},br={class:`dito-calendar-inner`},xr={class:`dito-calendar-header`},Sr={class:`dito-calendar-body`},Cr={class:`dito-calendar-weekdays`},wr={class:`dito-calendar-dates`,role:`grid`},Tr=[`aria-label`,`aria-selected`,`aria-disabled`,`onClick`],Er={class:`dito-calendar-footer`},Dr=[`aria-label`,`title`],Or={class:`dito-calendar-header`},kr={class:`dito-calendar-body`},Ar={class:`dito-calendar-months`,role:`listbox`,"aria-label":`Month`},jr=[`aria-label`,`aria-selected`,`onClick`],Mr={class:`dito-calendar-header`},Nr={class:`dito-calendar-body`},Pr={class:`dito-calendar-years`,role:`listbox`,"aria-label":`Year`},Fr=[`aria-label`,`aria-selected`,`onClick`];function Ir(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,vr,[(0,e.createElementVNode)(`div`,yr,[(0,e.createElementVNode)(`div`,br,[a.currentMode===`day`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createElementVNode)(`div`,xr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev dito-calendar-step-year`,role:`button`,tabindex:`0`,"aria-label":`Previous year`,onClick:n[0]||=e=>o.stepYear(-1)}),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev dito-calendar-step-month`,role:`button`,tabindex:`0`,"aria-label":`Previous month`,onClick:n[1]||=e=>o.stepMonth(-1)}),(0,e.createElementVNode)(`span`,null,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-year`,role:`button`,tabindex:`0`,"aria-label":`Switch to year selection`,onClick:n[2]||=e=>o.setMode(`year`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1),(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-month`,role:`button`,tabindex:`0`,"aria-label":`Switch to month selection`,onClick:n[3]||=e=>o.setMode(`month`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{month:!0})),1)]),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next dito-calendar-step-month`,role:`button`,tabindex:`0`,"aria-label":`Next month`,onClick:n[4]||=e=>o.stepMonth(1)}),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next dito-calendar-step-year`,role:`button`,tabindex:`0`,"aria-label":`Next year`,onClick:n[5]||=e=>o.stepYear(1)})]),(0,e.createElementVNode)(`div`,Sr,[(0,e.createElementVNode)(`div`,Cr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.weekdayNames,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,null,(0,e.toDisplayString)(t.short),1))),256))]),(0,e.createElementVNode)(`div`,wr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.dateRange,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(t.state&&`dito-calendar-item-${t.state}`),role:`gridcell`,"aria-label":o.dateToString(t.date),"aria-selected":t.state===`active`,"aria-disabled":t.state===`disabled`,onClick:e=>t.state!==`disabled`&&o.selectDate(t.date)},(0,e.toDisplayString)(t.text),11,Tr))),256))])]),(0,e.createElementVNode)(`div`,Er,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-now`,role:`button`,tabindex:`0`,"aria-label":`Select today (${o.dateToString(new Date)})`,title:o.dateToString(new Date),onClick:n[6]||=e=>o.selectDate(new Date)},null,8,Dr)])],64)):a.currentMode===`month`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createElementVNode)(`div`,Or,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev`,role:`button`,tabindex:`0`,"aria-label":`Previous year`,onClick:n[7]||=e=>o.stepYear(-1)}),(0,e.createElementVNode)(`span`,null,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-year`,role:`button`,tabindex:`0`,"aria-label":`Switch to year selection`,onClick:n[8]||=e=>o.setMode(`year`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1)]),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next`,role:`button`,tabindex:`0`,"aria-label":`Next year`,onClick:n[9]||=e=>o.stepYear(1)})]),(0,e.createElementVNode)(`div`,kr,[(0,e.createElementVNode)(`div`,Ar,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.monthNames,(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(o.getMonthClass(n)),role:`option`,"aria-label":t.long,"aria-selected":o.getMonthClass(n)[`dito-calendar-item-active`],onClick:e=>o.selectMonth(n)},(0,e.toDisplayString)(t.short),11,jr))),256))])])],64)):a.currentMode===`year`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createElementVNode)(`div`,Mr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev`,role:`button`,tabindex:`0`,"aria-label":`Previous decade`,onClick:n[10]||=e=>o.stepDecade(-1)}),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(o.decadeToString(a.currentValue)),1),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next`,role:`button`,tabindex:`0`,"aria-label":`Next decade`,onClick:n[11]||=e=>o.stepDecade(1)})]),(0,e.createElementVNode)(`div`,Nr,[(0,e.createElementVNode)(`div`,Pr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.yearRange,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(o.getYearClass(t)),role:`option`,"aria-label":String(t),"aria-selected":o.getYearClass(t)[`dito-calendar-item-active`],onClick:e=>o.selectYear(t)},(0,e.toDisplayString)(t),11,Fr))),256))])])],64)):(0,e.createCommentVNode)(``,!0)])])])}var Lr={emits:[`update:modelValue`,`select`],props:{modelValue:{type:Date,default:null},locale:{type:String,default:`en-US`},disabledDate:{type:Function,default:()=>!1},mode:{type:String,default:`day`}},data(){let{weekdayNames:e,monthNames:t}=zr(this.locale);return{weekdayNames:e,monthNames:t,dateRange:[],yearRange:[],currentValue:this.modelValue||pr(new Date,{hour:0,minute:0,second:0,millisecond:0}),currentMode:this.mode}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e||new Date,this.updateDateRange())},currentValue(e,t){+e!=+t&&this.updateDateRange()},disabledDate:`updateDateRange`,mode(e){this.currentMode=e}},mounted(){this.updateDateRange()},methods:{getMonthClass(e){return{"dito-calendar-item-active":this.modelValue&&e===this.modelValue.getMonth()&&this.currentValue.getFullYear()===this.modelValue.getFullYear(),"dito-calendar-item-current":e===this.currentValue.getMonth()}},getYearClass(e){return{"dito-calendar-item-active":this.modelValue&&e===this.modelValue.getFullYear(),"dito-calendar-item-current":e===this.currentValue.getFullYear()}},setDate(e,t=!1){this.currentValue=pr(this.currentValue,e),t&&this.$emit(`update:modelValue`,this.currentValue)},stepDecade(e){this.setDate({year:this.currentValue.getFullYear()+e*10})},setMode(e){this.currentMode=e},stepMonth(e){let{currentValue:t}=this,{year:n,month:r}=this.getYearMonth(t.getFullYear(),t.getMonth()+e);this.setDate({month:r,day:Math.min(this.getDaysInMonth(n,r),this.currentValue.getDate())})},stepYear(e){this.setDate({year:this.currentValue.getFullYear()+e})},selectDate(e){this.setDate(fr(e),!0),this.$emit(`select`)},selectMonth(e){this.setMode(`day`),this.setDate({month:e,day:1},!0)},selectYear(e){this.setMode(`month`),this.setDate({year:e},!0)},getYearMonth(e,t){return t>11?(e++,t=0):t<0&&(e--,t=11),{year:e,month:t}},dateToString(e,{year:t,month:n,day:r}={year:!0,month:!0,day:!0}){return e.toLocaleString(this.locale,{year:t&&`numeric`,month:n&&`long`,day:r&&`numeric`})},decadeToString(e){let t=this.getFirstYearOfDecade(e.getFullYear());return`${t} – ${t+9}`},getDaysInMonth(e,t){return new Date(e,t+1,0).getDate()},getFirstYearOfDecade(e){return+`${e.toString().slice(0,-1)}0`},navigate({step:e,enter:t,mode:n=this.currentMode,update:r=!1}){let{currentValue:i}=this;if(e){switch(n){case`day`:this.setDate({day:i.getDate()+e},r);break;case`month`:this.setDate({month:i.getMonth()+e},r);break;case`year`:this.setDate({year:i.getFullYear()+e},r)}return!0}if(t){switch(this.currentMode){case`day`:this.selectDate(i);break;case`month`:this.setMode(`day`);break;case`year`:this.setMode(`month`)}return!0}},updateDateRange(){this.dateRange=[],this.yearRange=[];let{currentValue:e}=this,t=e.getFullYear(),n=e.getMonth(),r=this.getFirstYearOfDecade(t);for(let e=0;e<10;e++)this.yearRange.push(r+e);let i=new Date(t,n,1).getDay()+1;i===0&&(i=7);let a=this.getDaysInMonth(t,n);if(i>1){let e=this.getYearMonth(t,n-1),r=this.getDaysInMonth(e.year,e.month);for(let t=1;t<i;t++){let n=r-i+t+1,a=new Date(e.year,e.month,n);this.dateRange.push({text:n,date:a,state:this.disabledDate(a)?`disabled`:`gray`})}}let o=new Date;for(let r=1;r<=a;r++){let i=new Date(t,n,r),a=e=>e&&e.getDate()===r&&e.getFullYear()===t&&e.getMonth()===n,s=a(this.modelValue)?`active`:a(o)?`today`:this.disabledDate(i)?`disabled`:a(e)?`current`:null;this.dateRange.push({text:r,date:i,state:s})}let s=42-this.dateRange.length;if(s>0){let e=this.getYearMonth(t,n+1);for(let t=1;t<=s;t++){let n=new Date(e.year,e.month,t),r=this.disabledDate(n)?`disabled`:`gray`;this.dateRange.push({text:t,date:n,state:r})}}}}},Rr={};function zr(e){let t=Rr[e];if(!t){let n=[];for(let t=0;t<7;t++){let r=new Date(0,0,t);n.push({long:r.toLocaleString(e,{weekday:`long`}),short:r.toLocaleString(e,{weekday:`short`})})}let r=[];for(let t=1;t<=12;t++){let n=new Date(0,t,0);r.push({long:n.toLocaleString(e,{month:`long`}),short:n.toLocaleString(e,{month:`short`})})}t=Rr[e]={weekdayNames:n,monthNames:r}}return t}var Br=V(Lr,[[`render`,Ir]]);function Vr(e,t){e=e instanceof NodeList?Array.from(e):(0,r.asArray)(e);for(let[n,r]of Object.entries(t))for(let t of e)t.addEventListener(n,r,!1);return{remove(){for(let[n,r]of Object.entries(t))for(let t of e)t.removeEventListener(n,r,!1)}}}function Hr(...e){return{remove(){for(let t of e)t.remove()}}}function Ur(e){return{37:`left`,38:`up`,39:`right`,40:`down`,13:`enter`}[e?.keyCode]}function Wr(e){let t=Ur(e);return{hor:{left:-1,right:1}[t]||0,ver:{up:-1,down:1}[t]||0,enter:t===`enter`}}function Gr(e){let t=(0,r.isString)(e.target)?e.$refs[e.target]:e.target;return t?.$el??t}var Kr={class:`dito-trigger-container`};function qr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Kr,[r.alwaysShow?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):r.trigger===`click`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onClick:n[0]||=(...e)=>o.onClick&&o.onClick(...e)},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):r.trigger===`hover`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onMouseenter:n[1]||=e=>o.onHover(!0),onMouseleave:n[2]||=e=>o.onHover(!1)},[(0,e.renderSlot)(t.$slots,`trigger`)],34)):r.trigger===`focus`||r.trigger===`always`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:3,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(e.Transition,{name:`dito-${r.transition}`},{default:(0,e.withCtx)(()=>[r.trigger===`hover`?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,e.normalizeStyle)(o.popupStyle),onMouseenter:n[3]||=e=>o.onHover(!0),onMouseleave:n[4]||=e=>o.onHover(!1)},[a.showPopup?(0,e.renderSlot)(t.$slots,`popup`,{},void 0,void 0,0):(0,e.createCommentVNode)(``,!0)],38)),[[e.vShow,a.showPopup]]):(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,e.normalizeStyle)(o.popupStyle)},[a.showPopup?(0,e.renderSlot)(t.$slots,`popup`,{},void 0,void 0,0):(0,e.createCommentVNode)(``,!0)],6)),[[e.vShow,a.showPopup]])]),_:3},8,[`name`])])}var Jr=V({emits:[`update:show`],props:{trigger:{type:String,default:`click`},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom`},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:null},customClass:{type:String,default:null},zIndex:{type:Number,default:0},keepInView:{type:Boolean,default:!0},hideWhenClickOutside:{type:Boolean,default:!0},alwaysShow:{type:Boolean,default:!1},cover:{type:Boolean,default:!1},hideDelay:{type:Number,default:0}},data(){return{showPopup:this.show,popupPlacement:this.placement,focusEvents:null,closeEvents:null,popupEvents:null,blurTimer:null,mouseLeaveTimer:null}},computed:{triggerClass(){return{"dito-trigger-disabled":this.disabled}},popupClass(){let e={[`dito-popup-${(0,r.hyphenate)(this.placement)}`]:!0};return this.customClass&&(e[this.customClass]=!0),e},popupStyle(){return this.zIndex?`z-index: ${this.zIndex}`:``},triggerTarget(){return Gr(this)}},watch:{show(e){this.showPopup=e||this.alwaysShow},showPopup(e,t){e^t&&(this.$emit(`update:show`,e),this.$nextTick(()=>this.onShowPopup(e)))}},mounted(){let{trigger:e,popup:t}=this.$refs;this.trigger===`focus`&&(this.focusEvents=this.addFocusEvents(this.triggerTarget??e)),this.hideWhenClickOutside&&!this.alwaysShow&&(this.closeEvents=Vr(window,{mouseup:n=>{this.showPopup&&!t.contains(n.target)&&!e.contains(n.target)&&!this.triggerTarget?.contains(n.target)&&(this.showPopup=!1)},blur:()=>{this.showPopup=!1}})),this.alwaysShow&&(this.showPopup=!0)},created(){this.showPopup=this.show},unmounted(){this.focusEvents?.remove(),this.closeEvents?.remove(),this.popupEvents?.remove()},methods:{isPopupFocused(){return!!this.$refs.popup?.matches(`:focus-within`)},updatePosition(){let{trigger:e,popup:t}=this.$refs;if(this.show&&t.offsetWidth===0){setTimeout(()=>this.updatePosition(),0);return}let n=this.triggerTarget??e,r=this.target===`popup`?e:t.firstElementChild;r&&(r.style.width=getComputedStyle(n).width);let i=n.getBoundingClientRect(),a=i.left+window.scrollX,o=i.top+window.scrollY,s=i.width,c=i.height,l=t.offsetWidth,u=t.offsetHeight,[d,f]=this.popupPlacement.split(`-`)||[];if(this.keepInView){let e=window.innerWidth,t=window.innerHeight;d===`top`?o<u&&(d=`bottom`):d===`bottom`?t-o-c<u&&(d=`top`):d===`left`?a<l&&(d=`right`):d===`right`&&e-a-s<l&&(d=`left`),f===`top`?t-o<u&&(f=`bottom`):f===`bottom`?o+c<u&&(f=`top`):f===`left`?e-a<l&&(f=`right`):f===`right`&&a+s<l&&(f=`left`)}let p=0,m=0;switch(d){case`top`:m-=u;break;case`left`:p-=l;break;case`right`:p+=s;break;case`bottom`:m+=c}switch(f){case`right`:p-=l-s;break;case`bottom`:m-=u-c}if(this.cover&&(d===`top`?m+=c:d===`bottom`&&(m-=c)),n!==e){let t=e.getBoundingClientRect();p+=a-t.left,m+=o-t.top}t.style.left=`${p}px`,t.style.top=`${m}px`},addFocusEvents(e){let t=e.querySelectorAll(`input, textarea`),n;return Hr(Vr(t,{focus:()=>{this.showPopup=!0,clearTimeout(this.blurTimer)},blur:()=>{this.blurTimer=setTimeout(()=>{this.isPopupFocused()||(this.showPopup=!1)},0)}}),Vr(e,{mousedown:e=>{e.target.matches(`input, textarea, button`)||(e.preventDefault(),e.stopPropagation()),e.target.matches(`.dito-button-clear`)||(n=(this.triggerTarget??this.$refs.trigger).querySelector(`input, textarea`),n&&!n.hasAttribute(`readonly`)?n.setAttribute(`readonly`,`true`):n=null)},mouseup:e=>{n&&setTimeout(()=>{n.removeAttribute(`readonly`),!e.target.matches(`input, textarea, button`)&&this.isPopupFocused()&&n.focus(),n=null},0)}}))},onShowPopup(e){e?(this.trigger===`focus`&&(this.popupEvents=this.addFocusEvents(this.$refs.popup)),this.updatePosition()):(this.popupEvents?.remove(),this.popupEvents=null)},onClick(){this.disabled||(this.showPopup=!0)},onHover(e){this.disabled||(clearTimeout(this.mouseLeaveTimer),e?this.showPopup=!0:this.hideDelay?this.mouseLeaveTimer=setTimeout(()=>{this.showPopup=!1},this.hideDelay):this.showPopup=!1)}}},[[`render`,qr]]),Yr=[`id`,`type`,`name`,`title`,`disabled`,`readonly`,`autofocus`,`placeholder`,`autocomplete`,`aria-label`];function Xr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-input`,o.classes]),onMousedown:n[2]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)},[(0,e.renderSlot)(t.$slots,`prefix`),(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:r.id,ref:`input`,"onUpdate:modelValue":n[0]||=e=>a.currentValue=e,type:r.type,name:r.name,title:r.title,disabled:r.disabled,readonly:r.readonly,autofocus:r.autofocus,placeholder:r.placeholder,autocomplete:r.autocomplete,"aria-label":r.title},o.attributes,{onMousedown:n[1]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)}),null,16,Yr),[[e.vModelDynamic,a.currentValue]]),(0,e.renderSlot)(t.$slots,`suffix`)],34)}var H=V({emits:[`update:modelValue`],inheritAttrs:!1,props:{modelValue:{type:[String,Number],default:null},type:{type:String,default:`text`},id:{type:String,default:null},name:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},focused:{type:Boolean,default:!1},placeholder:{type:String,default:null},autocomplete:{type:String,default:`off`}},data(){return{currentValue:this.modelValue}},computed:{classes(){return[this.$attrs.class,{"dito-input--focus":this.focused}]},attributes(){let{class:e,...t}=this.$attrs;return t},input(){return this.$refs.input},size(){let{size:e,min:t,max:n}=this.$attrs,r=e=>e==null?0:`${e}`.length;return e||r(t)||r(n)||void 0}},watch:{modelValue(e,t){e!==t&&(this.currentValue=e)},currentValue(e){e!==this.modelValue&&this.$emit(`update:modelValue`,e)}},methods:{focus(){this.input.focus()},blur(){this.input.blur()},onMouseDown(e){e.target===this.input?e.stopPropagation():!this.disabled&&!this.readonly&&(this.focus(),e.preventDefault())}}},[[`render`,Xr]]);function Zr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`i`,{class:(0,e.normalizeClass)([`dito-icon`,o.classes])},null,2)}var Qr=V({props:{name:{type:String,required:!0},disabled:{type:Boolean,default:!1}},computed:{classes(){let e=`dito-icon`;return{[`${e}--${this.name}`]:!0,[`${e}--disabled`]:this.disabled}}}},[[`render`,Zr]]);function U(e,{start:t,end:n}){e?.setSelectionRange&&(e.focus(),e.setSelectionRange(t,n))}function $r(e){return e&&`selectionStart`in e?{start:e.selectionStart,end:e.selectionEnd}:null}function ei(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoCalendar`),u=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(u,(0,e.mergeProps)({class:`dito-date-picker`,ref:`trigger`,show:a.showPopup,"onUpdate:show":n[7]||=e=>a.showPopup=e,trigger:`focus`},{transition:r.transition,placement:r.placement,disabled:r.disabled,target:r.target}),{trigger:(0,e.withCtx)(()=>[t.$slots.trigger?(0,e.renderSlot)(t.$slots,`trigger`,{},void 0,void 0,0):((0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({key:1,class:`dito-date-picker-input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`calendar`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]))]),popup:(0,e.withCtx)(()=>[(0,e.createVNode)(l,(0,e.mergeProps)({class:`dito-date-picker-popup`,ref:`calendar`,modelValue:a.currentValue,"onUpdate:modelValue":n[5]||=e=>a.currentValue=e},{locale:r.locale,disabledDate:r.disabledDate},{onSelect:n[6]||=e=>a.showPopup=!1}),null,16,[`modelValue`])]),_:3},16,[`show`])}var ti=V({components:{DitoTrigger:Jr,DitoCalendar:Br,DitoInput:H,DitoIcon:Qr},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({date:r.defaultFormats.date,time:!1})},disabledDate:{type:Function,default:()=>!1}},data(){return{currentValue:this.modelValue,showPopup:this.show,inputFocused:!1}},computed:{focused(){return this.inputFocused||this.showPopup},input(){return Gr(this)?.querySelector(`input`)},formatOptions(){return{locale:this.locale,...this.format}},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=mr(e,this.formatOptions);t&&(this.currentValue=t)}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e)},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))},show(e){this.showPopup=e},showPopup(e,t){e^t&&this.$emit(`update:show`,e)},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{onFocus(e){this.inputFocused=e,this.showPopup=e},onKeyDown(e){if(e.key===`Escape`){this.showPopup=!1,e.preventDefault();return}let{ver:t,enter:n}=Wr(e);if(t||n){e.preventDefault();let r=$r(this.input)?.start,i=e=>hr(this.currentText,e,this.formatOptions);if(t&&!this.showPopup)this.showPopup=!0;else{let{calendar:e}=this.$refs;if(e){let{name:a,start:o}=i(r)||{};a&&e.navigate({step:t,enter:n,mode:a,update:!0})&&this.$nextTick(()=>U(this.input,i(o)))}}}},onMouseDown(e){this.showPopup=!this.disabled&&(!e||!this.showPopup),this.showPopup&&this.focus()},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,ei]]),ni={class:`dito-time-picker-popup`,role:`dialog`,"aria-label":`Choose time`},ri={class:`dito-time-picker-panel`},ii={class:`dito-time-picker-hour`,ref:`hour`,role:`listbox`,"aria-label":`Hour`},ai=[`aria-label`,`aria-selected`,`onClick`],oi={class:`dito-time-picker-panel`},si={class:`dito-time-picker-minute`,ref:`minute`,role:`listbox`,"aria-label":`Minute`},ci=[`aria-label`,`aria-selected`,`onClick`],li={class:`dito-time-picker-panel`},ui={class:`dito-time-picker-second`,ref:`second`,role:`listbox`,"aria-label":`Second`},di=[`aria-label`,`aria-selected`,`onClick`];function fi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(l,(0,e.mergeProps)({class:`dito-time-picker`,ref:`trigger`,show:a.showPopup,"onUpdate:show":n[5]||=e=>a.showPopup=e,trigger:`focus`},{transition:r.transition,placement:r.placement,disabled:r.disabled,target:r.target}),{trigger:(0,e.withCtx)(()=>[t.$slots.trigger?(0,e.renderSlot)(t.$slots,`trigger`,{},void 0,void 0,0):((0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({key:1,class:`dito-time-picker-input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`clock`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]))]),popup:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,ni,[(0,e.createElementVNode)(`div`,ri,[(0,e.createElementVNode)(`ul`,ii,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(24,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledHour(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.hour===t-1,class:(0,e.normalizeClass)({selected:o.hour===t-1}),onClick:e=>o.hour=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,ai))],64))),64))],512)]),(0,e.createElementVNode)(`div`,oi,[(0,e.createElementVNode)(`ul`,si,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(60,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledMinute(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.minute===t-1,class:(0,e.normalizeClass)({selected:o.minute===t-1}),onClick:e=>o.minute=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,ci))],64))),64))],512)]),(0,e.createElementVNode)(`div`,li,[(0,e.createElementVNode)(`ul`,ui,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(60,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledSecond(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.second===t-1,class:(0,e.normalizeClass)({selected:o.second===t-1}),onClick:e=>o.second=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,di))],64))),64))],512)])])]),_:3},16,[`show`])}var pi=V({components:{DitoTrigger:Jr,DitoInput:H,DitoIcon:Qr},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({time:r.defaultFormats.time,date:!1})},disabledHour:{type:Function,default:()=>!1},disabledMinute:{type:Function,default:()=>!1},disabledSecond:{type:Function,default:()=>!1}},data(){return{currentValue:this.modelValue,showPopup:this.show,inputFocused:!1,ignoreNextChange:!1}},computed:{focused(){return this.inputFocused||this.showPopup},input(){return Gr(this)?.querySelector(`input`)},formatOptions(){return{locale:this.locale,...this.format}},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=mr(e,this.formatOptions);t&&(this.currentValue=t)}},currentDate(){return this.currentValue||pr(new Date,{hour:0,minute:0,second:0,millisecond:0})},hour:{get(){return this.currentDate.getHours()},set(e){this.setTime({hour:e})}},minute:{get(){return this.currentDate.getMinutes()},set(e){this.setTime({minute:e})}},second:{get(){return this.currentDate.getSeconds()},set(e){this.setTime({second:e})}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e,this.scrollAll(!0))},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e),this.scrollAll(!0))},currentText(){let{input:e}=this,t=$r(e);this.focused&&!this.ignoreNextChange&&t.start===t.end&&this.$nextTick(()=>U(e,t)),this.ignoreNextChange=!1},show(e){this.showPopup=e},showPopup(e,t){e&&this.scrollAll(!1),e^t&&this.$emit(`update:show`,e)},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{leftPad(e){return(`0`+e).slice(-2)},setTime(e){this.currentValue=pr(this.currentDate,{...e,millisecond:0})},scrollAll(e){let t=(t,n)=>{let r=this.$refs[t];if(r){let t=r.scrollHeight/(r.childElementCount+6),i=Math.round(n*t),a=Math.abs(r.scrollTop-i);r.scrollTo({top:i,behavior:e&&a<100?`smooth`:`auto`})}};this.$nextTick(()=>{t(`hour`,this.hour),t(`minute`,this.minute),t(`second`,this.second)})},onFocus(e){this.inputFocused=e,this.showPopup=e},onKeyDown(e){if(e.key===`Escape`){this.showPopup=!1,e.preventDefault();return}let{input:t}=this,n=$r(t),{ver:i,enter:a}=Wr(e);if(i||a){e.preventDefault();let r=e=>hr(this.currentText,e,this.formatOptions);if(i){if(!this.showPopup)this.showPopup=!0;else{let{name:e,start:a}=r(n.start)||{};if(e){let n=this[e]+i,o=this.$refs[e].childElementCount;this[e]=n<0?n+o:n>=o?n-o:n,this.ignoreNextChange=!0,this.$nextTick(()=>U(t,r(a)))}}}else a&&(this.showPopup=!1)}else if(n.start===n.end){let{value:i}=t,a=n.start,o=e=>!isNaN(Number(e));if(e.key.length===1){if(o(e.key)&&a<i.length)i[a]===`:`&&o(i[a-1])&&o(i[a-2])&&a++,o(i[a])&&(o(i[a+1])||o(i[a-1]))&&(t.value=i.slice(0,a)+i.slice(a+1),U(t,{start:a,end:a}));else{let a=(0,r.format)(this.currentValue,this.formatOptions).length;i.length===a?e.preventDefault():i.length>a&&(t.value=i.slice(0,a),U(t,n),e.preventDefault())}}else e.key===`Backspace`&&(a===1||[` `,`:`].includes(i[a-2]))&&(a===i.length||i[a]===`:`?(a--,t.value=i.slice(0,a)+((i[a-1]??``)+`00`)+i.slice(a+1),U(t,{start:a,end:a})):o(i[a])&&!o(+i[a+1])&&(t.value=i.slice(0,a)+`0`+i.slice(a),U(t,{start:a,end:a})))}},onMouseDown(e){this.showPopup=!this.disabled&&(!e||!this.showPopup),this.showPopup&&this.focus()},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,fi]]),mi={class:`dito-date-time-picker`,ref:`picker`};function hi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoDatePicker`),u=(0,e.resolveComponent)(`DitoTimePicker`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,mi,[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`dito-date-time-picker__inner`,{"dito-date-time-picker__inner--focus":o.focused}])},[(0,e.createVNode)(c,(0,e.mergeProps)({class:`dito-date-time-picker__input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`calendar`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]),(0,e.createVNode)(l,(0,e.mergeProps)({ref:`date`,modelValue:a.currentValue,"onUpdate:modelValue":n[5]||=e=>a.currentValue=e,show:a.showDate,"onUpdate:show":n[6]||=e=>a.showDate=e,placement:`bottom-left`,target:t.$refs.picker},o.attributes),{trigger:(0,e.withCtx)(()=>[...n[9]||=[]]),_:1},16,[`modelValue`,`show`,`target`]),(0,e.createVNode)(u,(0,e.mergeProps)({ref:`time`,modelValue:a.currentValue,"onUpdate:modelValue":n[7]||=e=>a.currentValue=e,show:a.showTime,"onUpdate:show":n[8]||=e=>a.showTime=e,placement:`bottom-right`,target:t.$refs.picker},o.attributes),{trigger:(0,e.withCtx)(()=>[...n[10]||=[]]),_:1},16,[`modelValue`,`show`,`target`])],2)],512)}var gi=V({components:{DitoInput:H,DitoDatePicker:ti,DitoTimePicker:pi,DitoIcon:Qr},emits:[`update:modelValue`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placeholder:{type:String,default:null},disabled:{type:Boolean,default:!1},locale:{type:String,default:`en-US`},format:{type:Object,default:null}},data(){return{currentValue:this.modelValue,showDate:!1,showTime:!1,inputFocused:!1,dateFocused:!1,timeFocused:!1,closedMode:null}},computed:{attributes(){let{transition:e,disabled:t,locale:n,formatOptions:r}=this;return{transition:e,disabled:t,locale:n,format:r}},focused(){return this.inputFocused||this.showDate||this.showTime},input(){return this.$refs.input.input},formatOptions(){return(0,r.assignDeeply)({locale:this.locale,time:r.defaultFormats.time,date:r.defaultFormats.date},{date:{month:`short`,format:(e,t,n)=>t===`literal`&&/\bat\b/.test(e)?`, `:this.format?.date?.format?.(e,t,n)??e}},this.format)},timeIndex(){let e=this.currentText;if(e){let t=e.match(/([\S]+\s*)$/)?.[1];if(t)return e.length-t.length}return null},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=mr(e,this.formatOptions);if(t){let e=$r(this.input);this.currentValue=t,this.$nextTick(()=>U(this.input,e))}}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e)},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{onFocus(e){this.inputFocused=e,e?this.updatePopups():(this.showDate=!1,this.showTime=!1)},onMouseDown(e){e&&(this.showDate||this.showTime)?(this.showDate=!1,this.showTime=!1):this.disabled||(this.focus(),requestAnimationFrame(()=>this.updatePopups()))},onKeyDown(e){let t=this.getMode(e);this.$refs[t].onKeyDown(e),e.defaultPrevented?this.closedMode=t:t!==this.closedMode&&this.updatePopups(t)},getMode(e=null){let{start:t}=$r(this.input),{hor:n}=Wr(e);return this.timeIndex===null||t+n<this.timeIndex?`date`:`time`},updatePopups(e=this.getMode()){e&&(this.closedMode=null),this.showDate=e===`date`,this.showTime=e===`time`},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,hi]]),_i={class:`dito-pagination`,"aria-label":`Pagination`},vi={key:0,class:`dito-pagination-total`},yi={key:1,class:`dito-buttons dito-buttons--round`},bi=[`disabled`,`aria-label`,`aria-current`,`onClick`],xi={key:0};function Si(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,_i,[r.showTotal?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,vi,[r.total>0?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)((0,e.toDisplayString)(o.first)+` – `+(0,e.toDisplayString)(o.last)+` / `+(0,e.toDisplayString)(r.total),1)],64)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),o.numPages>1?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,yi,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(o.buttons,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{class:(0,e.normalizeClass)([`dito-button`,o.getButtonClasses(t)]),disabled:t.disabled,"aria-label":o.getButtonLabel(t),"aria-current":t.active?`page`:null,onClick:e=>o.onClickButton(t)},[t.text?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,xi,(0,e.toDisplayString)(t.text),1)):(0,e.createCommentVNode)(``,!0)],10,bi))),256))])):(0,e.createCommentVNode)(``,!0)])}var Ci=V({emits:[`update:page`],props:{total:{type:Number,default:0},page:{type:Number,default:1},pageSize:{type:Number,default:10},showTotal:{type:Boolean,default:!0}},data(){return{showPrev:!0,showNext:!0,currentPage:this.page}},computed:{first(){return(this.currentPage-1)*this.pageSize+1},last(){return Math.min(this.first+this.pageSize-1,this.total)},numPages(){return Math.ceil(this.total/this.pageSize)},buttons(){let{showPrev:e,showNext:t,currentPage:n,numPages:r}=this,i=e+t+1,a=1,o;r<=i?o=r:n<=e+1?o=i:n>=r-t?(o=r,a=r-i+1):(a=n-e,o=n+t);let s=[];s.push({index:n-1,type:`prev`,disabled:n<=1}),a>=2&&s.push({index:1,text:1}),a>2&&s.push({index:Math.max(1,n-10),type:`ellipsis-prev`});for(let e=a;e<=o;e++)s.push({index:e,text:e,active:e===n});return o<r-1&&s.push({index:Math.min(r,n+10),type:`ellipsis-next`}),o<=r-1&&s.push({index:r,text:r}),s.push({index:n+1,type:`next`,disabled:n>=r}),s}},watch:{page(e){this.currentPage=e},pageSize(){this.currentPage>this.numPages&&(this.currentPage=this.numPages)},currentPage(e,t){e!==t&&this.$emit(`update:page`,e)}},created(){this.currentPage=this.page},methods:{getButtonClasses(e){let t=`dito-button`;return{[`${t}--${e.type}`]:e.type,[`${t}--active`]:e.active}},getButtonLabel(e){return e.type===`prev`?`Previous page`:e.type===`next`?`Next page`:e.text?`Page ${e.text}`:null},onClickButton(e){e.index&&!e.disabled&&e.index!==this.currentPage&&(this.currentPage=e.index)}}},[[`render`,Si]]),wi={class:`dito-switch__pane`},Ti=[`id`,`aria-checked`,`name`,`disabled`],Ei={key:0,class:`dito-switch__label`};function Di(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-switch`,o.classes]),style:(0,e.normalizeStyle)(o.styles)},[(0,e.createElementVNode)(`div`,wi,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:r.id,ref:`input`},o.attributes,{"onUpdate:modelValue":n[0]||=e=>a.checked=e,role:`switch`,type:`checkbox`,"aria-checked":a.checked,name:r.name,disabled:r.disabled}),null,16,Ti),[[e.vModelCheckbox,a.checked]]),n[1]||=(0,e.createElementVNode)(`div`,{class:`dito-switch__button`},null,-1),r.labels?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,Ei,[a.checked?(0,e.renderSlot)(t.$slots,`checked`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(r.labels.checked||`on`),1)],void 0,0):(0,e.renderSlot)(t.$slots,`unchecked`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(r.labels.unchecked||`off`),1)],void 0,1)])):(0,e.createCommentVNode)(``,!0)])],6)}var Oi=V({emits:[`update:modelValue`,`change`],inheritAttrs:!1,props:{modelValue:{type:Boolean,default:!1},id:{type:String,default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},labels:{type:[Object,Boolean],default:!1}},data(){return{checked:this.modelValue}},computed:{classes(){let e=`dito-switch`;return[this.$attrs.class,{[`${e}--checked`]:this.checked,[`${e}--disabled`]:this.disabled}]},styles(){let{labels:{checked:e,unchecked:t}={}}=this,n=Math.max(0,e?.length,t?.length);return{"--switch-width":n?`${n*1.5}rem`:null}},attributes(){let{class:e,...t}=this.$attrs;return t}},watch:{modelValue(e){this.checked=e},checked(e){e!==this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))}},methods:{focus(){this.$refs.input.focus()}}},[[`render`,Di]]);function ki({enabled:t},{slots:n}){return t?(0,e.h)(e.Transition,Ni,n):n.default()}ki.props={enabled:{type:Boolean,default:!0}};var Ai=ki,W=(e,t)=>Object.assign(e.style,t),ji=e=>setTimeout(e,0),Mi=e=>getComputedStyle(e).height,Ni={name:`dito-height`,onAfterEnter(e){ji(()=>W(e,{height:null}))},onEnter(e){let{width:t}=getComputedStyle(e);W(e,{width:t,position:`absolute`,visibility:`hidden`,height:`auto`}),ji(()=>{let{height:t}=getComputedStyle(e);W(e,{width:null,position:null,visibility:null,height:0}),Mi(e),ji(()=>W(e,{height:t}))})},onLeave(e){let{height:t}=getComputedStyle(e);W(e,{height:t}),Mi(e),ji(()=>W(e,{height:0}))}},G={data(){return{domHandlers:[]}},unmounted(){for(let{remove:e}of this.domHandlers)e();this.domHandlers=[]},methods:{domOn(e,t,n){let i=Vr(e,(0,r.isObject)(t)?t:{[t]:n});return this.domHandlers.push(i),i}}},Pi=class{hasRole(...e){if(this.roles){for(let t of e)if(this.roles.includes(t))return!0}return!1}},Fi={provide(){return{$schemaParentComponent:()=>this}},data(){return{schemaComponents:[]}},computed:{mainSchemaComponent(){return this.schemaComponents[0]}},methods:{_registerSchemaComponent(e,t){let{schemaComponents:n}=this;t?n.push(e):n.splice(n.indexOf(e),1)}}},Ii={mixins:[Fi],computed:{errors(){return this.schemaComponents.flatMap(({errors:e})=>e||[])},isTouched(){return this.schemaComponents.some(e=>e.isTouched)},isDirty(){return this.schemaComponents.some(e=>e.isDirty)},isValid(){return this.schemaComponents.every(e=>e.isValid)},isValidated(){return this.schemaComponents.every(e=>e.isValid)}},methods:{validateAll(e,t=!0){return this.schemaComponents.every(n=>n.validateAll(e,t))},verifyAll(e){return this.schemaComponents.every(t=>t.verifyAll(e))},resetValidation(){this.schemaComponents.forEach(e=>e.resetValidation())},clearErrors(){this.schemaComponents.forEach(e=>e.clearErrors())},async showValidationErrors(e,t,n=!0){for(let r of this.schemaComponents)await r.showValidationErrors(e,t,n)&&(n=!1);return!n}}},Li={mixins:[Ii],provide(){return{$routeComponent:()=>this}},data(){return{reload:!1,routeRecord:null,store:{},loadCache:{}}},computed:{routeComponent(){return this},routeLevel(){let e=0,t=this;for(;t=t.parentRouteComponent;)e++;return e},matchedRouteRecord(){return this.$route.matched[this.routeLevel]},isLeavingRoute(){return this.matchedRouteRecord?.path!==this.routeRecord?.path},isLastRoute(){let{matched:e}=this.$route;return this.routeRecord===e[e.length-1]},isLastUnnestedRoute(){let{matched:e}=this.$route;for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n.meta.nested)return this.routeRecord===n}return!1},isNestedRoute(){return this.meta.nested},isForm(){return!1},isView(){return!1},meta(){return this.routeRecord?.meta},path(){return this.getRoutePath(this.routeRecord?.path)},label(){return this.getLabel(this.schema)},breadcrumb(){let{breadcrumb:e}=this.schema||{};return e||`${this.breadcrumbPrefix} ${this.label}`},breadcrumbPrefix(){return``},param(){return this.$route.params[this.meta?.param]||null},isMutating(){return!1}},watch:{matchedRouteRecord:{immediate:!0,flush:`sync`,handler(t){t&&(!this.routeRecord||t.path===this.routeRecord.path)&&(this.routeRecord=(0,e.markRaw)(t))}}},beforeRouteUpdate(e,t){return this?.beforeRouteChange(e,t)},beforeRouteLeave(e,t){return this?.beforeRouteChange(e,t)},created(){this.appState.routeComponents.push(this)},unmounted(){let{routeComponents:e}=this.appState;e.splice(e.indexOf(this),1)},methods:{beforeRouteChange(e,t){let n=!0;return t.path.startsWith(this.path)&&!e.path.startsWith(this.path)&&t.path!==e.path&&(this.isFullRouteChange(e,t)||e.path.length<=t.path.length)&&(this.isMutating?n=this.isValidated||this.validateAll():this.isDirty&&(n=window.confirm(`You have unsaved changes. Do you really want to ${this.verbs.cancel}?`))),n},getRoutePath(e){let{path:t}=this.$route;return e?t.split(`/`).slice(0,e.split(`/`).length).join(`/`):t},getChildPath(e){return`${this.path}/${e}`},isFullRouteChange(e,t){let n=this.path.match(/^(\/[^/]*)/)[1];return!(0,r.getCommonPrefix)(e.path,t.path).startsWith(n)}}},Ri=class{currentPromiseOrLoader=null;currentLoadPromise=null;lastFinishedLoad=(0,e.shallowRef)({promiseOrLoader:null,value:void 0,error:null});constructor(t,{createContext:n,onLoadStart:i=null}){this.dataSchema=(0,r.isObject)(t)?t:{data:t},this.createContext=n,this.onLoadStart=i,this.valueOrPromiseOrLoader=(0,e.computed)(()=>this.getValueOrPromiseOrLoader()),this.valueOrUndefinedWhileLoading=(0,e.computed)(()=>this.getValueOrStartLoad())}get value(){return this.valueOrUndefinedWhileLoading.value}get isLoading(){if(this.value!==void 0)return!1;let e=this.valueOrPromiseOrLoader.value;return zi(e)&&this.lastFinishedLoad.value.promiseOrLoader!==e}async waitForValue(){for(;this.isLoading;)await this.currentLoadPromise;return this.value}get lastLoadError(){let{promiseOrLoader:e,error:t}=this.lastFinishedLoad.value;return e===this.valueOrPromiseOrLoader.value?t:null}getValueOrPromiseOrLoader(){let{data:e,dataPath:t}=this.dataSchema;if(e!==void 0)return(0,r.isFunction)(e)?e(this.createContext()):e;if(t){let e=this.createContext();return(0,r.getValueAtDataPath)(e.rootItem,(0,r.normalizeDataPath)(`${e.dataPath}/${t}`),()=>void 0)}}getValueOrStartLoad(){let e=this.valueOrPromiseOrLoader.value;if(!zi(e))return e;let{promiseOrLoader:t,value:n}=this.lastFinishedLoad.value;if(t===e)return n;this.currentPromiseOrLoader!==e&&this.startLoad(e)}startLoad(e){this.currentPromiseOrLoader=e;let t=this.createContext(),n=(t,n=null)=>{this.currentPromiseOrLoader===e&&(this.lastFinishedLoad.value={promiseOrLoader:e,value:t,error:n})},i=Promise.resolve().then(()=>(0,r.isFunction)(e)?e(t):e).then(e=>n(e)).catch(e=>{console.error(e),n(void 0,e)});this.currentLoadPromise=i,this.onLoadStart?.(i)}};function zi(e){return(0,r.isFunction)(e)||(0,r.isPromise)(e)}var Bi=class{computedValueRecords=new Map;optionsRecords=new Map;pendingLoads=new Set;processedDataSnapshot=(0,e.shallowRef)(null);derivedValueDataPaths=null;constructor({component:t,getSchema:n,getData:r,getSourceSchema:i=null}){this.component=t,this.getSchema=n,this.getData=r,this.getSourceSchema=i,this.rootScope=(0,e.effectScope)(!0),this.rootScope.run(()=>{(0,e.watch)([n,r],([e,t])=>this.initializeData(e,t),K),this.dataEntries=(0,e.computed)(()=>this.getDataEntries()),(0,e.watch)(()=>this.dataEntries.value.computedValueEntries,e=>this.updateComputedValueRecords(e),K),(0,e.watch)(()=>this.dataEntries.value.entriesWithMissingValues,e=>this.setDefaultValues(e),K),i&&(0,e.watch)(r,()=>this.takeProcessedDataSnapshot().catch(console.error),K)})}get dataPath(){return this.component.dataPath??``}get componentPath(){return this.component.componentPath??``}get rootData(){return this.component.rootData??this.getData()}get isDirty(){let e=this.processedDataSnapshot.value,t=this.getData();if(!t||e?.data!==t)return!1;let n=this.getProcessedDataForDirtyCheck(),i=this.derivedValueDataPaths?Vi(e.processedData,n,this.derivedValueDataPaths):e.processedData;return!(0,r.equals)(n,i)}stop(){this.rootScope.stop(),this.computedValueRecords.clear(),this.optionsRecords.clear(),this.pendingLoads.clear()}async waitForPendingLoads(){for(;this.pendingLoads.size>0;)await Promise.all(this.pendingLoads),await(0,e.nextTick)()}async takeProcessedDataSnapshot(){let t=this.getData(),n=t?new Set:null;if(this.derivedValueDataPaths=n,this.processedDataSnapshot.value=t?{data:t,processedData:(0,r.clone)(this.getProcessedDataForDirtyCheck())}:null,!t)return;await(0,e.nextTick)(),await this.waitForPendingLoads();let i=this.derivedValueDataPaths!==n,a=!this.rootScope.active;if(i||a)return;this.derivedValueDataPaths=null;let o=this.processedDataSnapshot.value;o?.data===this.getData()&&(this.processedDataSnapshot.value={data:t,processedData:Vi(o.processedData,this.getProcessedDataForDirtyCheck(),n)})}getProcessedDataForDirtyCheck(){let e=this.getSchema(),t=this.getData();return t&&!Ht(e)?an(e,this.getSourceSchema(),t,this.dataPath,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,schemaOnly:!0,target:`clipboard`,shouldCallProcess:!1}):null}async applyCleanChanges(t){let n=this.getData(),i=this.processedDataSnapshot.value?.data===n,a=i?(0,r.clone)(this.getProcessedDataForDirtyCheck()):null;if(t(),i){await(0,e.nextTick)(),await this.waitForPendingLoads();let t=this.processedDataSnapshot.value;t?.data===n&&this.rootScope.active&&(this.processedDataSnapshot.value={data:n,processedData:Hi(t.processedData,a,this.getProcessedDataForDirtyCheck())})}}trackPendingLoad(e){this.pendingLoads.add(e),e.finally(()=>this.pendingLoads.delete(e))}initializeData(e,t){t&&!Ht(e)&&en(e,t,this.component,{dataPath:this.dataPath,rootData:this.rootData,shouldSkipSourcesWithResource:!0,shouldSetDefaultsOfComponentsWithCompute:!1})}getDataEntries(){let e=this.getSchema(),t=this.getData(),n=new Map,r=[];return t&&!Ht(e)&&N(e,t,{dataPath:this.dataPath,componentPath:this.componentPath,shouldProcess:e=>this.isEntryShown(e),shouldSkipSourcesWithResource:!0,before:e=>{Gi(e.schema)&&n.set(e.componentPath,e),this.shouldSetDefaultValue(e)&&r.push(e)},options:{component:this.component,rootData:this.rootData}}),{computedValueEntries:n,entriesWithMissingValues:r}}isEntryShown(e){return e.schema.if===void 0||j(`if`,{type:Boolean,schema:e.schema,context:this.createEntryContext(e),default:!0})}shouldSetDefaultValue(e){let{schema:t,data:n,name:r}=e;return $t(t,n,r,()=>this.createEntryContext(e),{shouldSetDefaultsOfComponentsWithCompute:!1})}setDefaultValues(e){for(let t of e)if(this.shouldSetDefaultValue(t)){let{schema:e,data:n,name:r}=t;n[r]=qt(e,()=>this.createEntryContext(t))}}updateComputedValueRecords(e){let t=this.computedValueRecords;this.computedValueRecords=new Map;for(let[n,r]of e){let e=t.get(n);e?.entry.schema===r.schema&&e.entry.data===r.data?t.delete(n):e={entry:r,scope:this.createComputedValueScope(r)},this.computedValueRecords.set(n,e)}for(let{scope:e}of t.values())e.stop()}createComputedValueScope(t){let n=this.rootScope.run(()=>(0,e.effectScope)());return n.run(()=>{let n=(0,e.computed)(()=>this.isEntryCurrent(t));if(t.schema.compute&&(0,e.watch)(()=>n.value?this.getComputedValueResult(t):null,e=>{e&&this.writeComputedValue(t,e.value)},K),Zt(t.schema)){let r=this.createDataSchemaResolver(t.schema,t);(0,e.watch)(()=>n.value&&!r.isLoading?{value:r.value}:null,e=>{e&&this.writeComputedValue(t,e.value)},K)}}),n}hasComputedValueEntry(e){return this.dataEntries.value.computedValueEntries.has(e)}isEntryCurrent({componentPath:e,schema:t,data:n}){let r=this.dataEntries.value.computedValueEntries.get(e);return r?.schema===t&&r.data===n}getComputedValueResult(e){let{schema:t,data:n,name:r,dataPath:i}=e;try{return{value:tn(t,n,r,i,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,getOptions:t.options?()=>this.getLoadedOptions(e):null})}}catch(e){if(e===Wi)return null;throw e}}getLoadedOptions(e){let t=this.getOptions(e);if(t===void 0)throw Wi;return t}getOptions(e){return this.getOptionsResolver(e).value}getOptionsResolver(e){let{schema:t,data:n,componentPath:r}=e,i=this.optionsRecords.get(r);return(!i||i.entry.schema.options!==t.options||i.entry.data!==n)&&(i={entry:e,resolver:this.createDataSchemaResolver(t.options,e)},this.optionsRecords.set(r,i)),i.resolver}createDataSchemaResolver(e,t){return new Ri(e,{createContext:()=>this.createEntryContext(t),onLoadStart:e=>this.trackPendingLoad(e)})}writeComputedValue(e,t){let{data:n,name:i}=e;(0,r.equals)(t,n[i])||(this.derivedValueDataPaths?.add(this.getRelativeDataPath(e)),n[i]=t)}getRelativeDataPath({schema:e,name:t,dataPath:n}){return(C(e)?(0,r.parseDataPath)(n):[...(0,r.parseDataPath)(n),t]).slice((0,r.parseDataPath)(this.dataPath).length).join(`/`)}createEntryContext({schema:e,data:t,name:n,dataPath:r}){return E.createForSchema(this.component,{schema:e,name:n,data:t,dataPath:r,rootData:this.rootData})}};function Vi(e,t,n){if(n.size===0)return e;let i=(0,r.clone)(e);for(let e of n){let n=(0,r.parseDataPath)(e),a=n.slice(0,-1),o=n.at(-1),s=(0,r.getValueAtDataPath)(i,a,()=>null);if(s&&typeof s==`object`){let n=(0,r.getValueAtDataPath)(t,e,()=>Ui);n===Ui?delete s[o]:s[o]=(0,r.clone)(n)}}return i}function Hi(e,t,n){if((0,r.equals)(t,n))return e;if(!((0,r.isPlainObject)(t)&&(0,r.isPlainObject)(n)&&(0,r.isPlainObject)(e)||(0,r.isArray)(t)&&(0,r.isArray)(n)&&(0,r.isArray)(e)&&t.length===n.length&&n.length===e.length))return(0,r.clone)(n);let i=(0,r.isArray)(e)?[...e]:{...e};for(let r of new Set([...Object.keys(t),...Object.keys(n)]))r in n?i[r]=Hi(e[r],t[r],n[r]):delete i[r];return i}var Ui=Symbol(`notFound`),K={immediate:!0,flush:`post`},Wi=Symbol(`optionsNotLoaded`);function Gi(e){return!!e.compute||Zt(e)}var Ki=[`data-resource`];function qi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoRouterView`),c=(0,e.resolveComponent)(`DitoSchema`);return t.user&&t.shouldRenderSchema(t.viewSchema)?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[t.isLastRoute?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-view dito-scroll-parent`,"data-resource":t.sourceSchema.path},[((0,e.openBlock)(),(0,e.createBlock)(c,{key:t.name,schema:t.viewSchema,data:t.data,meta:t.meta,store:t.getChildStore(t.name),padding:`root`,disabled:t.isLoading,scrollable:``,single:``},null,8,[`schema`,`data`,`meta`,`store`,`disabled`]))],8,Ki)):((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,routeLevel:t.routeLevel+1},null,8,[`routeLevel`]))],64)):(0,e.createCommentVNode)(``,!0)}var Ji=V(B.component(`DitoView`,{mixins:[Li],provide(){return{$sourceComponent:()=>this.mainComponent?.sourceComponent||null,$resourceComponent:()=>this.mainComponent?.resourceComponent||null,$dataModel:()=>this.ownDataModel}},data(){return{isLoading:!1,data:{}}},computed:{dataModel(){return this.ownDataModel},schema(){return this.meta.schema??{}},name(){return this.schema.name},isView(){return!0},isSingleComponentView(){return ct(this.schema)},mainComponent(){return this.mainSchemaComponent?.getComponentByDataPath(this.name)},viewSchema(){let{component:e,...t}=this.schema;return this.isSingleComponentView?{...t,components:{[t.name]:{name:t.name,label:!1,...e}}}:t},providesData(){return Qe(this.viewSchema,Yn)}},watch:{$route:{flush:`post`,handler(e,t){this.isFullRouteChange(e,t)&&(this.isLoading=!1,this.data={})}}},created(){this.ownDataModel=new Bi({component:this,getSchema:()=>this.viewSchema,getData:()=>this.data})},mounted(){this.shouldRenderSchema(this.viewSchema)||this.$router.replace({path:`/`})},beforeUnmount(){this.ownDataModel.stop()},methods:{setData(e){return this.data=e,this.data},getChildPath(e){return this.isSingleComponentView?this.path:`${this.path}/${e}`},setLoading(e){this.isLoading=!!e}}}),[[`render`,qi]]);function Yi(t,n={}){let r,{immediate:i,...a}=n,l=(0,e.shallowRef)(!1),u=(0,e.shallowRef)(!1),d=e=>r&&r.activate(e),f=e=>r&&r.deactivate(e),p=()=>{r&&(r.pause(),u.value=!0)},m=()=>{r&&(r.unpause(),u.value=!1)},h=(0,e.computed)(()=>{let n=(0,e.toValue)(t);return(0,s.toArray)(n).map(t=>{let n=(0,e.toValue)(t);return typeof n==`string`?n:(0,s.unrefElement)(n)}).filter(o.notNullish)});return(0,e.watch)(h,e=>{if(e.length){if(!r)r=(0,c.createFocusTrap)(e,{...a,onActivate(e){l.value=!0,n.onActivate&&n.onActivate(e)},onDeactivate(e){l.value=!1,n.onDeactivate&&n.onDeactivate(e)}}),i&&d();else{let t=r?.active;r?.updateContainerElements(e),!t&&i&&d()}}},{flush:`post`}),(0,s.tryOnScopeDispose)(()=>f()),{hasFocus:l,isPaused:u,activate:d,deactivate:f,pause:p,unpause:m}}var Xi=(0,e.defineComponent)((t,{slots:n})=>{let r=(0,e.shallowRef)(),i=(0,e.reactive)(Yi(r,t.options));return()=>{if(n.default)return(0,e.h)(t.as||`div`,{ref:r},n.default(i))}},{name:`UseFocusTrap`,props:[`as`,`options`]}),Zi=[`aria-label`];function Qi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoButtons`),c=(0,e.resolveComponent)(`DitoSchema`),l=(0,e.resolveComponent)(`UseFocusTrap`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-dialog`,ref:`dialog`,role:`dialog`,"aria-label":t.schema.label||`Dialog`,"aria-modal":`true`,style:(0,e.normalizeStyle)({"--width":t.settings.width?`${t.settings.width}px`:null}),onMouseup:n[2]||=(...e)=>t.onMouseUp&&t.onMouseUp(...e)},[(0,e.createVNode)(l,{class:`dito-dialog__focus-trap`,options:t.focusTrapOptions},{default:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`form`,{class:`dito-scroll-parent`,onSubmit:n[0]||=(0,e.withModifiers)((...e)=>t.submit&&t.submit(...e),[`prevent`]),onKeydown:n[1]||=(0,e.withKeys)((...e)=>t.onEnter&&t.onEnter(...e),[`enter`])},[(0,e.withDirectives)((0,e.createElementVNode)(`button`,null,null,512),[[e.vShow,!1]]),(0,e.createVNode)(c,{schema:t.schema,data:t.dialogData,padding:`root`,scrollable:``,generateLabels:``},{buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{class:`dito-buttons--large`,buttons:t.buttonSchemas,data:t.dialogData},null,8,[`buttons`,`data`])]),_:1},8,[`schema`,`data`])],32)]),_:1},8,[`options`])],44,Zi)}var $i=V(B.component(`DitoDialog`,{mixins:[G],components:{UseFocusTrap:Xi},emits:[`remove`],provide(){return{$dialogComponent:()=>this,$dataModel:()=>this.ownDataModel}},props:{components:{type:Object,required:!0},buttons:{type:Object,required:!0},promise:{type:Object,required:!0},data:{type:Object,default:()=>({})},settings:{type:Object,default:()=>({width:480,clickToClose:!1})}},data(){let e=(0,r.clone)(this.data);for(let t in this.components)t in e||(e[t]=null);return{dialogData:e}},computed:{dataModel(){return this.ownDataModel},dialogComponent(){return this},schema(){return{type:`dialog`,components:this.components}},buttonSchemas(){return Object.fromEntries(Object.entries(A(this.buttons)).map(([e,t])=>(e===`cancel`&&!t.events&&(t={...t,events:{click:()=>this.cancel()}}),[e,t])))},focusTrapOptions(){return{immediate:!0,fallbackFocus:()=>this.$refs.dialog,onDeactivate:this.cancel}},hasButtons(){return Object.keys(this.buttonSchemas).length>0},hasCancel(){return!!this.buttonSchemas.cancel}},created(){this.ownDataModel=new Bi({component:this,getSchema:()=>this.schema,getData:()=>this.dialogData})},mounted(){this.domOn(window,{keyup:e=>{(this.hasCancel||!this.hasButtons)&&e.keyCode===27&&this.cancel()}})},beforeUnmount(){this.ownDataModel.stop()},methods:{remove(){this.$emit(`remove`)},resolve(e){this.promise.resolve(e),this.remove()},reject(e){this.promise.reject(e),this.remove()},onEnter(e){e.target instanceof HTMLInputElement&&this.submit()},async submit(){await this.waitForPendingLoadsOf(this.dataModel),this.resolve(this.dialogData)},cancel(){this.resolve(void 0)},close(){this.cancel()},onMouseUp(){this.settings.clickToClose&&this.close()}}}),[[`render`,Qi]]),ea=[`data-agent-browser`,`data-agent-platform`,`data-agent-version`],ta={key:0,class:`dito-drag-overlay`};function na(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoDialog`),c=(0,e.resolveComponent)(`DitoNavigation`),l=(0,e.resolveComponent)(`DitoHeader`),u=(0,e.resolveComponent)(`DitoRouterView`),d=(0,e.resolveComponent)(`DitoAccount`),f=(0,e.resolveComponent)(`DitoSidebar`),p=(0,e.resolveComponent)(`DitoNotifications`),m=(0,e.resolveDirective)(`resize`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-root`,"data-agent-browser":t.appState.agent.browser,"data-agent-platform":t.appState.agent.platform,"data-agent-version":t.appState.agent.versionNumber},[(0,e.createVNode)(e.Transition,{name:`dito-drag`},{default:(0,e.withCtx)(()=>[t.isDraggingFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ta)):(0,e.createCommentVNode)(``,!0)]),_:1}),(0,e.createVNode)(e.TransitionGroup,{name:`dito-dialog`},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.dialogs,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{key:r,components:n.components,buttons:n.buttons,promise:n.promise,data:n.data,settings:n.settings,onRemove:e=>t.removeDialog(r)},null,8,[`components`,`buttons`,`promise`,`data`,`settings`,`onRemove`]))),128))]),_:1}),(0,e.createVNode)(c),(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`main`,{class:(0,e.normalizeClass)([`dito-page dito-scroll-parent`,t.pageClasses])},[(0,e.createVNode)(l,{spinner:t.options.spinner,isLoading:t.isLoading},null,8,[`spinner`,`isLoading`]),(0,e.createVNode)(u,{routeLevel:0})],2)),[[m,t.onResizePage]]),(0,e.createVNode)(f,null,{default:(0,e.withCtx)(()=>[t.user?((0,e.openBlock)(),(0,e.createBlock)(d,{key:0})):t.allowLogin?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,{key:1,class:`dito-login`,onClick:n[0]||=e=>t.rootComponent.login()},[...n[1]||=[(0,e.createElementVNode)(`span`,null,`Login`,-1)]])):(0,e.createCommentVNode)(``,!0)]),_:1}),(0,e.createVNode)(p,{ref:`notifications`},null,512)],8,ea)}var ra=B.component(`DitoRoot`,{mixins:[G],components:{DitoDialog:$i},provide(){return{$views:()=>this.resolvedViews}},props:{unresolvedViews:{type:[Object,Function,Promise],required:!0},options:{type:Object,default:()=>({})}},data(){return{resolvedViews:{},removeRoutes:null,dialogs:{},pageWidth:0,loadingCount:0,allowLogin:!1,isDraggingFiles:!1}},computed:{notifications(){return this.isMounted&&this.$refs.notifications},isLoading(){return this.loadingCount>0},pageClasses(){let e=`dito-page`;return[this.appState.pageClass,{[`${e}--width-80`]:this.pageWidth<=720,[`${e}--width-60`]:this.pageWidth<=540}]}},created(){this.appState.title=document.title||`Dito.js Admin`,this.appState.routeComponents=[]},async mounted(){this.setupDragAndDrop(),(0,i.delegate)(this.$el,{target:`.dito-info`,theme:`info`,animation:`shift-away-subtle`,interactive:!0,delay:250,zIndex:1,appendTo:e=>e.closest(`.dito-pane`),onShow:e=>e.setContent(e.reference.dataset.info)}),this.domOn(document,{click:e=>{e.target.closest(`.dito-label`)||(this.appState.activeLabel=null)},keyup:e=>{e.code===`Tab`&&(this.appState.activeLabel=null)}});try{this.allowLogin=!1,await this.fetchUser()?await this.resolveViews():await this.login()}catch(e){console.error(e)}this.allowLogin=!0},methods:{setupDragAndDrop(){let e=0,t=[],n=e=>{for(let n of t)n.closest(`.dito-container`).classList.toggle(`dito-drop-target`,e);e||(t=[])},r=e=>{this.isDraggingFiles=e,e?n(!0):setTimeout(()=>n(!1),150)};this.domOn(document,{dragenter:n=>{if(!e&&n.dataTransfer){t=document.querySelectorAll(`.dito-upload`);let e=t.length>0;if(n.dataTransfer.effectAllowed=e?`copy`:`none`,e)r(!0);else{n.preventDefault(),n.stopPropagation();return}}e++},dragleave:t=>{e--,!e&&t.dataTransfer&&r(!1)},dragover:e=>{if(e.dataTransfer){let t=e.target.closest(`.dito-container:has(.dito-upload)`);e.dataTransfer.dropEffect=t?`copy`:`none`,t||(e.preventDefault(),e.stopPropagation())}},drop:t=>{e=0,t.dataTransfer&&r(!1)}})},notify({type:e=`info`,title:t,text:n,error:r,duration:i}={}){this.notifications.notify({type:e,title:t,text:n,error:r,duration:i})},closeNotifications(){this.notifications.destroyAll()},registerLoading(e){this.loadingCount+=e?1:-1},showDialog({components:e,buttons:t,data:n,settings:r}){return new Promise(async(i,a)=>{let o=[];if(await L(this.api,{type:`dialog`,components:e},o,0),o.length>0)throw Error(`Dialogs do not support components that produce routes`);let s=`dialog-${++ia}`;this.dialogs[s]={components:e,buttons:t,data:n,settings:r,promise:{resolve:i,reject:a}}})},removeDialog(e){delete this.dialogs[e]},async login(){this.allowLogin=!0;let{additionalComponents:e,redirectAfterLogin:t}=this.options.login||{},n=await this.showDialog({components:{username:{type:`text`,autofocus:!0},password:{type:`password`},...e},buttons:{login:{type:`submit`,text:`Login`},cancel:{type:`button`,text:`Cancel`}}});if(n)try{let e=await this.sendRequest({resource:this.api.users.login,data:n,internal:!0});t?location.replace(t):(this.setUser(e.data.user),await this.resolveViews())}catch(e){let t=e.response?.data?.error||e;this.notify({type:`error`,error:t,title:`Authentication Error`,text:t}),this.login()}},navigateHome(){return this.navigate(`/`)},async logout(){try{(await this.sendRequest({resource:this.api.users.logout,internal:!0})).data.success&&(this.setUser(null),this.navigateHome())}catch(e){console.error(e)}},async fetchUser(){let e=null;try{e=(await this.sendRequest({resource:this.api.users.session,internal:!0})).data.user||null}catch(e){let t=e.response?.data?.error||e;this.notify({type:`error`,error:t,title:`Authentication Error`,text:t})}return this.setUser(e),e},setUser(e){this.appState.user=e&&Object.setPrototypeOf(e,Pi.prototype),e||(this.resolvedViews={},this.navigateHome())},async ensureUser(){await this.fetchUser()||await this.login()},async resolveViews(){try{this.resolvedViews=await Fn(this.unresolvedViews)}catch(e){return e.request||console.error(e),this.login()}let e=await(0,r.mapConcurrently)(Object.entries(this.resolvedViews),([e,t])=>Vn(Ji,this.api,t,e)),{fullPath:t}=this.$route;this.removeRoutes?.(),this.removeRoutes=aa(this.$router,[{name:`root`,path:`/`,components:{}},...e.flat()]),this.$router.replace(t)},onResizePage({contentRect:{width:e}}){this.pageWidth=e}}}),ia=0;function aa(e,t){let n=[];for(let r of t)n.push(e.addRoute(r));return()=>{for(let e of n)e()}}var oa=V(ra,[[`render`,na]]),sa={class:`dito-menu__item`},ca=[`href`,`aria-current`,`onClick`];function la(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoMenu`,!0),c=(0,e.resolveDirective)(`resize`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:`dito-menu`,style:(0,e.normalizeStyle)({"--width":t.width?`${t.width}px`:null})},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.items,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,sa,[t.shouldShowItem(n)?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-menu__link`,{"dito-menu__link--active":t.isActiveItem(n)}]),href:t.getItemHref(n),"aria-current":t.isActiveItem(n)?`page`:null,onClick:(0,e.withModifiers)(e=>t.onClickItem(n),[`prevent`,`stop`])},(0,e.toDisplayString)(t.getLabel(n)),11,ca),n.items?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,class:`dito-menu__sub`,items:n.items,path:t.getItemPath(n,!1)},null,8,[`items`,`path`])):(0,e.createCommentVNode)(``,!0)],64)):(0,e.createCommentVNode)(``,!0)]))),256))],4)),[[c,t.onResize]])}var ua=V(B.component(`DitoMenu`,{props:{items:{type:[Object,Array],default:()=>[]},path:{type:String,default:``}},data(){return{width:0}},methods:{shouldShowItem(e){return this.shouldRenderSchema(e)&&(!e.items||Object.values(e.items).some(this.shouldRenderSchema))},onResize({contentRect:{width:e}}){e&&(this.width=e)},getItemPath(e,t){let n=e.path?`${this.path}/${e.path}`:null;return t&&n&&e.items?`${n}${this.getItemPath(Object.values(e.items)[0],!1)}`:n},getItemHref(e){let t=this.getItemPath(e,!0);return t?this.$router.resolve(t).href:null},isActiveItem(e){return this.$route.path.startsWith(this.getItemPath(e,!1))||e.items&&Object.values(e.items).some(this.isActiveItem)},onClickItem(e){let t=this.getItemPath(e,!0);t&&this.$router.push({path:t,force:!0})}}}),[[`render`,la]]),da={class:`dito-trail`,"aria-label":`Breadcrumb`},fa=[`aria-current`,`href`,`onClick`];function pa(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,da,[(0,e.createElementVNode)(`ul`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.trail,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-trail__link`,{"dito-trail__link--active":n.path===t.$route.path}]),"aria-current":n.path===t.$route.path?`page`:null,href:t.getComponentHref(n),onClick:(0,e.withModifiers)(e=>t.onClickComponent(n),[`prevent`,`stop`])},[(0,e.createElementVNode)(`span`,{class:(0,e.normalizeClass)([`dito-trail__text`,{"dito-trail__text--dirty":n.isDirty}])},(0,e.toDisplayString)(n.breadcrumb),3)],10,fa)]))),256))]),(0,e.renderSlot)(t.$slots,`default`)])}var ma=V(B.component(`DitoTrail`,{computed:{trail(){return this.appState.routeComponents.filter(e=>!e.isLeavingRoute)}},methods:{getComponentRoutePath(e){let{schema:t}=e;return t.type===`menu`?Object.values(t.items)[0].fullPath:e.path},getComponentHref(e){return this.$router.resolve(this.getComponentRoutePath(e)).href},onClickComponent(e){this.$router.push({path:this.getComponentRoutePath(e),force:!0})}}}),[[`render`,pa]]),ha=[`aria-busy`];function ga(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSpinner`),c=(0,e.resolveComponent)(`DitoTrail`);return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,{class:`dito-header`,"aria-busy":t.isLoading},[(0,e.createVNode)(c,null,{default:(0,e.withCtx)(()=>[t.isLoading?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,size:t.spinner?.size,color:t.spinner?.color},null,8,[`size`,`color`])):(0,e.createCommentVNode)(``,!0)]),_:1}),n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-header__teleport`},null,-1),(0,e.renderSlot)(t.$slots,`default`)],8,ha)}var _a=V(B.component(`DitoHeader`,{props:{spinner:{type:Object,default:null},isLoading:{type:Boolean,default:!1}}}),[[`render`,ga]]),va={class:`dito-navigation dito-scroll-parent`,"aria-label":`Main navigation`};function ya(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`),c=(0,e.resolveComponent)(`DitoMenu`);return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,va,[(0,e.createElementVNode)(`h1`,null,[(0,e.createVNode)(s,{class:`dito-link`,to:`/`},{default:(0,e.withCtx)(()=>[(0,e.createTextVNode)((0,e.toDisplayString)(t.appState.title),1)]),_:1})]),(0,e.createVNode)(c,{class:`dito-scroll`,items:t.views},null,8,[`items`])])}var ba=V(B.component(`DitoNavigation`,{}),[[`render`,ya]]),xa={class:`dito-notifications`,"aria-live":`polite`},Sa={class:`dito-notifications__inner`};function Ca(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`VueNotifications`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,xa,[n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-header`},[(0,e.createElementVNode)(`span`)],-1),(0,e.createElementVNode)(`div`,Sa,[(0,e.createVNode)(s,{ref:`notifications`,classes:`dito-notification`,dangerouslySetInnerHtml:!0,position:``,width:``},null,512)])])}var wa=V(B.component(`DitoNotifications`,{notifications(){return this.isMounted&&this.$refs.notifications},methods:{notify({type:e=`info`,title:t,text:n,error:i,duration:a}={}){t||={warning:`Warning`,error:`Error`,info:`Information`,success:`Success`}[e]||`Notification`,n=`<p>${(0,r.asArray)(n).join(`</p> <p>`)}</p>`.replace(/\n|\r\n|\r/g,`<br>`);let o={warning:`warn`,error:`error`,info:`log`,success:`log`}[e]||`error`;console[o]((0,r.stripHtml)(n),...e===`error`&&i?[i]:[]);let{notifications:s=!0}=this.api;if(s){let{durationFactor:r=20}=s;a??=(40+n.length+t.length)*r,this.$notify({type:e,title:t,text:n,duration:a===0?-1:a})}},destroyAll(){this.notifications.destroyAll()}}}),[[`render`,Ca]]),Ta={class:`dito-header`};function Ea(t,n,r,i,a,o){let s=(0,e.resolveDirective)(`resize`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`aside`,{class:(0,e.normalizeClass)([`dito-sidebar dito-scroll-parent`,t.classes])},[(0,e.createElementVNode)(`nav`,Ta,[(0,e.renderSlot)(t.$slots,`default`)]),n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-sidebar__teleport dito-scroll`},null,-1)],2)),[[s,t.onResizeSidebar]])}var Da=V(B.component(`DitoSidebar`,{data(){return{sidebarWidth:0}},computed:{classes(){let e=`dito-sidebar`;return{[`${e}--width-99`]:this.sidebarWidth<360,[`${e}--width-60`]:this.sidebarWidth<=216}}},methods:{onResizeSidebar({contentRect:{width:e}}){this.sidebarWidth=e}}}),[[`render`,Ea]]),Oa={mixins:[G],data(){return{pulldown:{open:!1,startTime:0,checkTime:!0,events:{mousedown:()=>{this.setPulldownOpen(!1),this.pulldown.handlers.remove()},mouseup:()=>{this.onPulldownMouseUp()&&this.pulldown.handlers.remove()}},handlers:null}}},computed:{pulldownTriggerAttributes(){return{"aria-haspopup":`menu`,"aria-expanded":this.pulldown.open}}},methods:{onPulldownMouseDown(e=null){e===null?(this.setPulldownOpen(!0),this.checkTime=!0):this.checkTime=!1},onPulldownMouseUp(e=null){let{startTime:t}=this.pulldown;if(!this.checkTime||t&&Date.now()-t>250)return this.setPulldownOpen(!1),e!==null&&this.onPulldownSelect(e),!0},onPulldownSelect(){},setPulldownOpen(e){this.pulldown.open=e,this.pulldown.startTime=e?Date.now():0,e&&(this.pulldown.handlers=this.domOn(document,this.pulldown.events))}}},ka={class:`dito-account`},Aa=[`onMousedown`,`onMouseup`];function ja(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,ka,[(0,e.createElementVNode)(`a`,(0,e.mergeProps)({role:`button`},t.pulldownTriggerAttributes,{onMousedown:n[0]||=(0,e.withModifiers)(e=>t.onPulldownMouseDown(),[`stop`])}),[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.user.username),1)],16),(0,e.createElementVNode)(`ul`,{class:(0,e.normalizeClass)([`dito-pulldown`,{"dito-pulldown--open":t.pulldown.open}]),role:`menu`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.items,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:`dito-pulldown__item`,role:`menuitem`,onMousedown:(0,e.withModifiers)(e=>t.onPulldownMouseDown(r),[`stop`]),onMouseup:e=>t.onPulldownMouseUp(r)},(0,e.toDisplayString)(n),41,Aa)]))),256))],2)])}var Ma=V(B.component(`DitoAccount`,{mixins:[Oa],data(){return{items:{settings:`Settings`,logout:`Logout`}}},methods:{onPulldownSelect(e){switch(e){case`logout`:this.rootComponent.logout();break;case`settings`:console.info(`TODO: Implement Settings`)}}}}),[[`render`,ja]]);function Na(t,n,r,i,a,o){return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-spinner`,role:`status`,"aria-label":`Loading`,style:(0,e.normalizeStyle)({"--color":t.color,"--size":t.size,"--margin":t.margin})},[...n[0]||=[(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse1`},null,-1),(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse2`},null,-1),(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse3`},null,-1)]],4)),[[e.vShow,t.loading]])}var Pa=V(B.component(`DitoSpinner`,{props:{loading:{type:Boolean,default:!0},color:{type:String,default:null},size:{type:String,default:null},margin:{type:String,default:null}}}),[[`render`,Na]]);function Fa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSpinner`),c=(0,e.resolveComponent)(`DitoIcon`);return t.item.type===`text`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.as||`div`),{key:0},{default:(0,e.withCtx)(()=>[(0,e.createTextVNode)((0,e.toDisplayString)(t.item.text),1)]),_:1})):t.item.type===`html`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.as||`div`),{key:1,innerHTML:t.item.html},null,8,[`innerHTML`])):t.item.type===`spinner`?((0,e.openBlock)(),(0,e.createBlock)(s,{key:2,size:t.item.size,color:t.item.color},null,8,[`size`,`color`])):t.item.type===`icon`?((0,e.openBlock)(),(0,e.createBlock)(c,{key:3,name:t.item.name,disabled:t.item.disabled},null,8,[`name`,`disabled`])):t.item.type===`component`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.component),(0,e.normalizeProps)((0,e.mergeProps)({key:4},t.item.props)),null,16)):(0,e.createCommentVNode)(``,!0)}var Ia=V(B.component(`DitoAffix`,{components:{DitoSpinner:Pa,DitoIcon:Qr},props:{item:{type:Object,required:!0},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext}}}),[[`render`,Fa]]),La=[`disabled`],Ra=[`data-info`];function za(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffix`);return t.hasContent?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-affixes`,t.classes])},[(0,e.renderSlot)(t.$slots,`prepend`),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.visibleItems,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{class:(0,e.normalizeClass)([`dito-affix`,t.getItemClasses(n)]),key:r,style:(0,e.normalizeStyle)(n.style),item:n,parentContext:t.parentContext},null,8,[`class`,`style`,`item`,`parentContext`]))),128)),t.clearable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-affixes__clear`,type:`button`,title:`Clear`,disabled:t.disabled,onClick:n[0]||=(0,e.withModifiers)(e=>t.$emit(`clear`),[`stop`]),onMousedown:n[1]||=(0,e.withModifiers)(()=>{},[`stop`])},null,40,La)):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`append`),t.inlineInfo?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.inlineInfo},null,8,Ra)):(0,e.createCommentVNode)(``,!0)],2)):(0,e.createCommentVNode)(``,!0)}var q=V(B.component(`DitoAffixes`,{components:{DitoAffix:Ia},emits:[`clear`],props:{items:{type:[String,Object,Array],default:null},mode:{type:String,default:null},position:{type:String,default:null},absolute:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},inlineInfo:{type:String,default:null},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext},processedItems(){return(0,r.asArray)(this.items).filter(Boolean).map(e=>(0,r.isString)(e)?{type:`text`,text:e}:e.type?e:e.text==null?e.html==null?e:{type:`html`,...e}:{type:`text`,...e})},visibleItems(){return this.processedItems.filter(e=>Kt(e,this.context))},classes(){let e=`dito-affixes`;return{[`${e}--${this.position}`]:this.position,[`${e}--${this.mode}`]:this.mode,[`${e}--absolute`]:this.absolute}},hasContent(){return this.visibleItems.length>0||this.clearable||this.inlineInfo||ar(this.$slots.prepend)||ar(this.$slots.append)}},methods:{getItemClasses(e){let t=`dito-affix`;return[{[`${t}--${e.type}`]:e.type,[`${t}--ellipsis`]:this.mode===`ellipsis`&&[`text`,`html`].includes(e.type)},e.class]}}}),[[`render`,za]]),Ba={key:1,class:`dito-label__inner`},Va=[`for`,`innerHTML`],Ha=[`data-info`];function Ua(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`);return t.text||t.collapsible?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.collapsible?`button`:`div`),(0,e.mergeProps)({key:0,class:`dito-label`,type:t.collapsible?`button`:null},t.attributes,{class:{"dito-label--active":t.isActive}}),{default:(0,e.withCtx)(()=>[t.collapsible?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-chevron`,{"dito-chevron--open":!t.collapsed}])},null,2)):(0,e.createCommentVNode)(``,!0),t.text||t.prefixes.length>0||t.suffixes.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ba,[(0,e.createVNode)(s,{items:t.prefixes,position:`prefix`,parentContext:t.context},null,8,[`items`,`parentContext`]),t.text?((0,e.openBlock)(),(0,e.createElementBlock)(`label`,{key:0,for:t.htmlFor,innerHTML:t.text},null,8,Va)):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(s,{items:t.suffixes,mode:`ellipsis`,position:`suffix`,parentContext:t.context},null,8,[`items`,`parentContext`]),t.info?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.info},null,8,Ha)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)]),_:1},16,[`type`,`class`])):(0,e.createCommentVNode)(``,!0)}var Wa=V(B.component(`DitoLabel`,{components:{DitoAffixes:q},emits:[`open`],props:{label:{type:[String,Object],default:null},htmlFor:{type:String,default:null},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},info:{type:String,default:null}},computed:{text(){let{label:e}=this;return(0,r.isObject)(e)?e?.text:e},prefixes(){return(0,r.asArray)(this.label?.prefix)},suffixes(){return(0,r.asArray)(this.label?.suffix)},attributes(){return this.collapsible?{onClick:this.onClick,"aria-expanded":!this.collapsed}:{}},isActive(){return this.appState.activeLabel===this}},methods:{onClick(){this.appState.activeLabel=this,this.$emit(`open`,this.collapsed)}}}),[[`render`,Ua]]),Ga={methods:{getItemFormSchema:Vt,getItemUid:un,getItemId(e,t,n=null){return this.isTransient&&n!==null?String(n):sn(e,t)},getItemDataPath(e,t){let{dataPath:n}=this;return e!==this.schema&&(n=b(n,e.name)),t!=null&&(n=b(n,t)),n},getItemStore(e,t,n){return this.getChildStore(this.getItemUid(e,t),n)},removeItemStore(e,t,n){this.removeChildStore(this.getItemUid(e,t),n)},findItemIdIndex(e,t,n){let r=this.isTransient?n:t?.findIndex((t,r)=>this.getItemId(e,t,r)===n);return r===-1?null:r},getItemLabel(e,t,{index:n=null,extended:i=!1,asObject:a=!1}={}){let{itemLabel:o}=e;if(!t||!i&&o===!1)return null;let s,c=()=>s??=this.getItemDataPath(e,n),l,u=()=>l??=this.getLabel(Vt(e,t,this.context)),d,f,p;if((0,r.isFunction)(o)){let e=o.call(this,new E(this,{nested:!1,data:t,value:t,index:n,get dataPath(){return c()},get formLabel(){return u()}}));(0,r.isObject)(e)?{text:d,prefix:f,suffix:p}=e:d=e,i=!1}else if((0,r.isString)(o)&&!(o in t))d=o;else{let{columns:n}=e,i=t[(0,r.isString)(o)&&o||w(e)&&n&&Object.keys(n)[0]||`name`];d=(0,r.isString)(i)||(0,r.isNumber)(i)?i:null}let m=!!d;if(d??=(i=!0,w(e)&&n!==null?`${n+1}`:``),i){let e=u();e&&(d=`${e} ${m?`'${d}'`:d}`)}return a?d||f||p?{text:d,prefix:f,suffix:p}:null:d}}},Ka={key:0,class:`dito-schema-header`};function qa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanels`),c=(0,e.resolveComponent)(`DitoLabel`),l=(0,e.resolveComponent)(`DitoTabs`),u=(0,e.resolveComponent)(`DitoClipboard`),d=(0,e.resolveComponent)(`DitoPane`),f=(0,e.resolveComponent)(`TransitionHeight`);return(0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[(0,e.renderSlot)(t.$slots,`prepend`),(0,e.createElementVNode)(`div`,(0,e.mergeProps)({class:[`dito-schema`,{"dito-scroll-parent":t.scrollable,"dito-schema--open":t.opened}]},t.$attrs),[t.isPopulated&&t.panelEntries.length>0?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:0,to:`.dito-sidebar__teleport`},[t.active?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,panels:t.panelEntries,data:t.data,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`panels`,`data`,`meta`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),t.hasHeader?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:1,to:t.headerTeleport,disabled:!t.headerTeleport},[t.active?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ka,[t.hasLabel?((0,e.openBlock)(),(0,e.createBlock)(c,{key:0,label:t.label,info:t.info,collapsible:t.collapsible,collapsed:!t.opened,onOpen:t.onOpen},null,8,[`label`,`info`,`collapsible`,`collapsed`,`onOpen`])):(0,e.createCommentVNode)(``,!0),t.tabs?((0,e.openBlock)(),(0,e.createBlock)(e.Transition,{key:1,name:`dito-fade`},{default:(0,e.withCtx)(()=>[t.opened?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,modelValue:t.selectedTab,"onUpdate:modelValue":n[0]||=e=>t.selectedTab=e,tabs:t.renderedTabs},null,8,[`modelValue`,`tabs`])):(0,e.createCommentVNode)(``,!0)]),_:1})):(0,e.createCommentVNode)(``,!0),t.clipboard?((0,e.openBlock)(),(0,e.createBlock)(u,{key:2,clipboard:t.clipboard,schema:t.schema},null,8,[`clipboard`,`schema`])):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`edit-buttons`)])):(0,e.createCommentVNode)(``,!0)],8,[`to`,`disabled`])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(f,{enabled:t.inlined},{default:(0,e.withCtx)(()=>[t.opened?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-schema-content`,{"dito-scroll":t.scrollable}]),ref:`content`},[t.hasTabs?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.tabs,(n,r)=>(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(d,{key:r,class:`dito-pane__tab`,ref_for:!0,ref:`tabs`,tab:r,schema:n,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.padding,single:t.single&&!t.inlined&&!t.hasMainPane,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,accumulatedBasis:t.accumulatedBasis},null,8,[`tab`,`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`,`accumulatedBasis`])),[[e.vShow,t.selectedTab===r]])),128)):(0,e.createCommentVNode)(``,!0),t.hasMainPane?((0,e.openBlock)(),(0,e.createBlock)(d,{key:1,class:`dito-pane__main`,ref:`components`,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.padding,single:t.single&&!t.inlined&&!t.hasTabs,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,accumulatedBasis:t.accumulatedBasis},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`,`accumulatedBasis`])):(0,e.createCommentVNode)(``,!0),!t.inlined&&t.isPopulated?(0,e.renderSlot)(t.$slots,`buttons`,{},void 0,void 0,2):(0,e.createCommentVNode)(``,!0)],2)):(0,e.createCommentVNode)(``,!0)]),_:3},8,[`enabled`]),t.inlined&&!t.hasHeader?(0,e.renderSlot)(t.$slots,`edit-buttons`,{},void 0,void 0,2):(0,e.createCommentVNode)(``,!0)],16),(0,e.renderSlot)(t.$slots,`append`)],64)}var Ja=B.component(`DitoSchema`,{mixins:[P,Ga],components:{TransitionHeight:Ai},inheritAttrs:!1,provide(){return{$schemaComponent:()=>this}},inject:[`$schemaParentComponent`],props:{schema:{type:Object,required:!0},dataSchema:{type:Object,default:e=>e.schema},dataPath:{type:String,default:``},data:{type:Object,default:null},meta:{type:Object,default:()=>({})},store:{type:Object,default:()=>({})},label:{type:[String,Object],default:null},info:{type:String,default:null},single:{type:Boolean,default:!1},padding:{type:String,default:null},active:{type:Boolean,default:!0},inlined:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!1},hasOwnData:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},labelNode:{type:HTMLElement,default:null},accumulatedBasis:{type:Number,default:1}},data(){let{data:e}=this.schema;return{...e&&(0,r.isFunction)(e)?e(this.context):e,selectedTab:null,componentsRegistry:{},unnestedComponentsRegistry:{},panesRegistry:{},panelsRegistry:{},scrollPositions:{}}},computed:{nested(){return!1},schemaComponent(){return this},parentSchemaComponent(){return this.hasOwnData?null:this.parentComponent.schemaComponent},panelEntries(){return Wt(this.schema.panels,this.dataPath,this.componentPath)},tabs(){return k(this.schema.tabs)},renderedTabs(){return this.tabs&&this.data?Object.fromEntries(Object.entries(this.tabs).filter(([,e])=>this.shouldRenderSchema(e))):this.tabs},defaultTab(){let e=null;if(this.renderedTabs){let t=Object.values(this.renderedTabs);for(let{name:n,defaultTab:i}of t){if((0,r.isFunction)(i)?i(this.context):i)return n;e??=n}}return e},routeTab(){return this.$route.hash?.slice(1)||null},clipboard(){return this.schema?.clipboard??null},hasHeader(){return this.hasLabel||this.hasTabs||!!this.clipboard},headerTeleport(){return this.isTopLevelSchema?`.dito-header__teleport`:this.labelNode},processedData(){return this.processData({target:`server`,schemaOnly:!0})},clipboardData:{get(){return this.processData({target:`clipboard`,schemaOnly:!0})},set(e){this.setData(e)}},clipboardItem(){return this.clipboardData},formLabel(){return this.getLabel(this.getItemFormSchema(this.sourceSchema,this.data,this.context))},isDirty(){return this.someComponent(e=>e.isDirty)},isTouched(){return this.someComponent(e=>e.isTouched)},isValid(){return this.everyComponent(e=>e.isValid)},isValidated(){return this.everyComponent(e=>e.isValidated)},hasErrors(){return this.someComponent(e=>e.hasErrors)},hasData(){return!!this.data},hasLabel(){return!!this.label||this.collapsible},hasTabs(){return!!this.tabs},isTopLevelSchema(){return!it(this.schema)&&!this.inlined},hasTopLevelTabs(){return this.hasTabs&&this.isTopLevelSchema},hasMainPane(){let{components:e}=this.schema;return!!e&&Object.keys(e).length>0},opened:jn(`opened`,{default(){return!this.collapsed}}),components(){return Object.values(this.componentsRegistry)},unnestedComponents(){return Object.values(this.unnestedComponentsRegistry)},panes(){return Object.values(this.panesRegistry)},panels(){return Object.values(this.panelsRegistry)},componentsByDataPath(){return this._listEntriesByDataPath(this.componentsRegistry)},panesByDataPath(){return this._listEntriesByDataPath(this.panesRegistry)},panelsByDataPath(){return this._listEntriesByDataPath(this.panelsRegistry)},wide:F(`wide`,{type:Boolean,default:!1})},watch:{schema:{immediate:!0,handler(e){Ht(e)||this.setupSchema()}},routeTab:{immediate:!0,flush:`post`,handler(e){this.hasTopLevelTabs&&(this.selectedTab=e)}},selectedTab(e,t){if(this.scrollable){let{content:n}=this.$refs;this.scrollPositions[t]=n.scrollTop,this.$nextTick(()=>{n.scrollTop=this.scrollPositions[e]??0})}if(this.hasTopLevelTabs){let t=!e||e in this.renderedTabs?e:this.defaultTab;this.$router.replace({query:this.$route.query,hash:t?`#${t}`:null})}this.hasErrors&&this.repositionErrors()}},created(){this._register(!0),this.scrollable&&this.wide&&(this.appState.pageClass=`dito-page--wide`)},mounted(){this.selectedTab=this.routeTab||this.defaultTab},unmounted(){this.emitEvent(`destroy`),this._register(!1),this.scrollable&&this.wide&&(this.appState.pageClass=null)},methods:{setupSchema(){this.setupSchemaFields(),this.delegate(`change`,this.parentSchemaComponent),this.emitEvent(`initialize`)},getComponentsByDataPath(e){return this._getEntriesByDataPath(this.componentsByDataPath,e)},getComponentByDataPath(e){return this.getComponentsByDataPath(e)[0]||null},getComponentsByName(e){return this._getEntriesByName(this.componentsByDataPath,e)},getComponentByName(e){return this.getComponentsByName(e)[0]||null},getComponents(e){return this._getEntries(this.componentsByDataPath,e)},getComponent(e){return this.getComponents(e)[0]||null},getPanelsByDataPath(e){return this._getEntriesByDataPath(this.panelsByDataPath,e)},getPanelByDataPath(e){return this.getPanelsByDataPath(e)[0]||null},getPanels(e){return this._getEntries(this.panelsByDataPath,e)},getPanel(e){return this.getPanels(e)[0]||null},someComponent(e){return this.isPopulated&&this.components.some(e)},everyComponent(e){return this.isPopulated&&this.components.every(e)},onOpen(e){this.emitEvent(`open`,{context:{open:e}}),this.opened=e},onChange(){this.emitEvent(`change`)},resetValidation(){for(let e of this.components)e.resetValidation()},clearErrors(){for(let e of this.components)e.clearErrors()},repositionErrors(){let e=this.$refs.content.closest(`.dito-scroll`),t=()=>e.dispatchEvent(new Event(`scroll`));t(),setTimeout(t,0)},focus(){return this.opened=!0,this.parentSchemaComponent?.focus()},validateAll(e,t=!0){let n=this.hasData?On(this.schema,this.data,{dataPath:this.dataPath,component:this,rootData:this.rootData}):null,r=e?kn(n,e):n;return t&&(r?this._showValidationErrorsByFullDataPath(r,!0,!0).catch(console.error):this.clearErrors()),!r},verifyAll(e){return this.validateAll(e,!1)},async showValidationErrors(e,t,n=!0){let i=Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,r.normalizeDataPath)(this.hasOwnData?b(this.dataPath,e):e),t]));return this._showValidationErrorsByFullDataPath(i,t,n)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let{opened:i}=this;i||(this.opened=!0,await this.$nextTick());let a=[],o=e=>{let n=t?.(e)??!0;return n&&a.push(...e),n},s=async t=>{for(let r of t){let t=`${r.componentPath}/`;a.some(e=>e.componentPath.startsWith(t))||await r.navigateToComponent?.(e,o,{shouldRevealInlinedOnly:n||a.length>0})}},c=this.getComponentsByDataPath(e);c.length>0&&o(c);let l=(0,r.parseDataPath)(e),u=(0,r.parseDataPath)(this.dataPath).length;for(;l.length>u+1;)l.pop(),await s(this.getComponentsByDataPath(l));await s(this.unnestedComponents);let d=a.length>0;return d||(this.opened=i),d},async _showValidationErrorsByFullDataPath(e,t,n){this.clearErrors();let i=[],a=n;for(let[a,o]of Object.entries(e)){let s=null,c=[],l=await this.navigateToComponent(a,e=>{for(let t of e)t.isForm?s=t:c.push(t);return!0});if(Ya(c).forEach((e,r)=>{e.showValidationErrors(o,n&&t&&!s&&r===0)}),s){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e===s.dataPath||e.startsWith(`${s.dataPath}/`)));return s.showValidationErrors(r,n&&t)}if(!l){let e=(0,r.labelize)((0,r.parseDataPath)(a).pop());for(let t of o){let n=e?`The field ${e}`:`The ${this.formLabel}`;i.push(`${n} ${t.message}`)}}n=!1}return a&&!n&&this.notifyErrors(i.join(`
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t(require("vue"),require("vue-router"),require("@kyvg/vue3-notification"),require("@ditojs/utils"),require("tippy.js"),require("nanoid"),require("@vueuse/shared"),require("@vueuse/core"),require("focus-trap"),require("sortablejs"),require("codeflask"),require("vue-color"),require("@tiptap/vue-3"),require("@tiptap/extension-document"),require("@tiptap/extension-text"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-italic"),require("@tiptap/extension-link"),require("@tiptap/extension-strike"),require("@tiptap/extension-subscript"),require("@tiptap/extension-superscript"),require("@tiptap/extension-underline"),require("@tiptap/extension-blockquote"),require("@tiptap/extension-code-block"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-heading"),require("@tiptap/extension-paragraph"),require("@tiptap/extension-horizontal-rule"),require("@tiptap/extension-ordered-list"),require("@tiptap/extension-bullet-list"),require("@tiptap/extension-list-item"),require("tiptap-footnotes"),require("@tiptap/extension-history"),require("vue-multiselect"),require("vue-upload-component")):typeof define==`function`&&define.amd?define(`vue,vue-router,@kyvg/vue3-notification,@ditojs/utils,tippy.js,nanoid,@vueuse/shared,@vueuse/core,focus-trap,sortablejs,codeflask,vue-color,@tiptap/vue-3,@tiptap/extension-document,@tiptap/extension-text,@tiptap/extension-bold,@tiptap/extension-code,@tiptap/extension-italic,@tiptap/extension-link,@tiptap/extension-strike,@tiptap/extension-subscript,@tiptap/extension-superscript,@tiptap/extension-underline,@tiptap/extension-blockquote,@tiptap/extension-code-block,@tiptap/extension-hard-break,@tiptap/extension-heading,@tiptap/extension-paragraph,@tiptap/extension-horizontal-rule,@tiptap/extension-ordered-list,@tiptap/extension-bullet-list,@tiptap/extension-list-item,tiptap-footnotes,@tiptap/extension-history,vue-multiselect,vue-upload-component`.split(`,`),t):(e=typeof globalThis<`u`?globalThis:e||self,e[`dito-admin`]=t(e.vue,e[`vue-router`],e[`@kyvg/vue3-notification`],e[`@ditojs/utils`],e.tippy.js,e.nanoid,e[`@vueuse/shared`],e[`@vueuse/core`],e[`focus-trap`],e.sortablejs,e.codeflask,e[`vue-color`],e[`@tiptap/vue-3`],e[`@tiptap/extension-document`],e[`@tiptap/extension-text`],e[`@tiptap/extension-bold`],e[`@tiptap/extension-code`],e[`@tiptap/extension-italic`],e[`@tiptap/extension-link`],e[`@tiptap/extension-strike`],e[`@tiptap/extension-subscript`],e[`@tiptap/extension-superscript`],e[`@tiptap/extension-underline`],e[`@tiptap/extension-blockquote`],e[`@tiptap/extension-code-block`],e[`@tiptap/extension-hard-break`],e[`@tiptap/extension-heading`],e[`@tiptap/extension-paragraph`],e[`@tiptap/extension-horizontal-rule`],e[`@tiptap/extension-ordered-list`],e[`@tiptap/extension-bullet-list`],e[`@tiptap/extension-list-item`],e[`tiptap-footnotes`],e[`@tiptap/extension-history`],e[`vue-multiselect`],e[`vue-upload-component`]))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,ee,te,ne,re,ie,ae,oe,se,ce,le,ue,de,fe,pe,me,he,ge){var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,xe=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty,Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t||ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Se.call(e,s)&&s!==n&&ve(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},y=(e,t,n)=>(n=e==null?{}:_e(xe(e)),we(t||!e||!e.__esModule||!Se.call(e,`default`)?ve(n,`default`,{value:e,enumerable:!0}):n,e));n=y(n,1),i=y(i),l=y(l,1),u=y(u),he=y(he),ge=y(ge);function Te(e=``){let t={},n=e.toLowerCase(),[r]=/(iphone|ipad|linux; android|darwin|win|mac|linux|freebsd|sunos)/.exec(n)||[],i={darwin:`mac`,iphone:`ios`,ipad:`ios`,"linux; android":`android`}[r]||r;return i&&(t.platform=i,t[i]=!0),n.replace(/(opera|chrome|safari|webkit|firefox|msie|trident)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv:v?([.\d]+))?/g,(e,n,r,i,a)=>{if(!t.chrome){let e=a||i||r;(!t.version||n!==`safari`)&&(t.version=e,t.versionNumber=parseFloat(e)),t.browser=n,t[n]=!0}}),t.chrome&&delete t.webkit,t}var Ee=(0,e.reactive)({title:``,routeComponents:[],user:null,agent:Te(navigator.userAgent||``),loadCache:{},activeLabel:null,clipboardData:null});function b(e,t){return e?`${e}/${t}`:t}function De(e,t){if(e==null||t==null)return null;let n=(0,r.normalizeDataPath)(e),i=(0,r.normalizeDataPath)(t);return n===i?``:i?n.startsWith(`${i}/`)?n.slice(i.length+1):null:n}function Oe(e){let t=(0,r.parseDataPath)(e);return t?.pop(),t}function ke(e){return(0,r.normalizeDataPath)(Oe(e))}function Ae(e,t=!1){return t?Oe(e):(0,r.parseDataPath)(e)}function je(e,t=!1){return(0,r.normalizeDataPath)(Ae(e,t))}function Me(e,t=!1){let n=Ae(e,t);if(n){let e;do e=n.pop();while(e!=null&&(0,r.isInteger)(+e));if(e!=null)return n}return null}function Ne(e,t=!1){return(0,r.normalizeDataPath)(Me(e,t))}function Pe(e,t,n=!1){let i=Ae(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Fe(e,t,n=!1){let i=Me(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Ie(e){let t=(0,r.parseDataPath)(e);return t[t.length-1]}function Le(e){let t=Ie(e);return t==null||(0,r.isInteger)(+t)?null:t}function Re(e){let t=Ie(e),n=t==null?null:+t;return(0,r.isInteger)(n)?n:null}var ze=0;function Be(e,t=`id`){e[t]=`@${++ze}`}function Ve(e){return/^@/.test(e)}function He(e,t=`id`){return e?.[t]!=null&&Object.keys(e).length===1}var Ue={},We={};function Ge(e,t){Ue[e]=t}function Ke(e,t=!1){let n=Ue[e]||null;if(!n&&!t&&!We[e])throw We[e]=!0,Error(`Unknown Dito.js component type: '${e}'`);return n}function qe(e){return(0,r.isObject)(e)?e.type:e}function x(e){return Ke(qe(e),!0)??null}function Je(e){return x(e)?.getSourceType?.(qe(e))??null}function Ye(e,t){for(let n of e)if(ct(n)){let e=t(n.component,n.name,0);if(e!==void 0)return e}else if(S(n))for(let[e,r]of Object.entries(n.components||{})){let n=t(r,e,1);if(n!==void 0)return n}}function Xe(e,t){return e?Ye([e,...pt(e)],t):void 0}function Ze(e,t){return Xe(e,e=>t(e)?e:void 0)??null}function Qe(e,t){return Xe(e,(e,n)=>t(e,n)?!0:void 0)??!1}function $e(e){return Qe(e,()=>!0)??!1}function et(e,t){return!!Xe(e,(e,n)=>{if(C(e)?n===t:et(e,t))return!0})}function S(e){return(0,r.isObject)(e)&&(0,r.isString)(e.type)}function tt(e){return S(e)&&e.type===`form`}function nt(e){return S(e)&&e.type===`view`}function rt(e){return S(e)&&e.type===`tab`}function it(e){return S(e)&&e.type===`panel`}function at(e){return it(e)&&!!e.data}function ot(e){return S(e)&&e.type===`menu`}function st(e){return JSON.stringify(e)}function ct(e){return nt(e)&&(0,r.isObject)(e.component)}function lt(e){return!!e.compact}function ut(e){return!!(e.inlined||e.components)}function C(e){return!!(e.nested||x(e)?.defaultNested===!0)}function dt(e,t){let{label:n}=e;return n!==!1&&(!!n||t&&x(e)?.generateLabel)}function ft(e){return!!x(e)?.omitSpacing}function pt(e){return e?.tabs?Object.values(e.tabs):[]}function mt(e){return e?.panels?Object.values(e.panels):[]}function ht(e){return Je(e)===`object`}function w(e){return Je(e)===`list`}function gt(e){return!!Je(e)&&!!e.resource}var{hasOwnProperty:_t}=Object.prototype,vt=new WeakMap;function yt(t){let n=(0,e.toRaw)(t),r=n,i;do{if(i=vt.get(r),i)break;r=Object.getPrototypeOf(r)}while(r);return i&&r!==n&&vt.set(r,i),i}function T(e,t,n){let i=yt(e),a=t in i?i[t]:void 0;return a!==void 0||_t.call(i,t)?a:(0,r.isFunction)(n)?n():n}function bt(e,t,n){yt(e)[t]=n}var E=class e{constructor(e,t){t=t?(0,r.isFunction)(t)?t():{...t}:{},t.nested??=!0,t.component=e;let n=Object.setPrototypeOf(t,e);vt.set(this,n)}static get(t,n){return n instanceof e?n:new e(t,n)}static createForSchema(t,{schema:n,name:r,nested:i=C(n),data:a,dataPath:o,rootData:s}){return new e(t,()=>({schema:n,name:r,nested:i,data:a,dataPath:o,rootData:s,get value(){return r==null?void 0:a?.[r]}}))}createChildContext(t,n){let r=C(t),i=!!this.schema&&C(this.schema);return e.createForSchema(this.component,{schema:t,name:n,nested:r,data:i?this.item?.[this.name]:this.item,dataPath:r?b(this.dataPath,n):this.dataPath,rootData:this.rootItem})}extend(e){return Object.setPrototypeOf(e,this)}get nested(){return T(this,`nested`,!0)}get schema(){return T(this,`schema`,null)}get value(){return T(this,`value`,()=>this.nested?(0,r.getValueAtDataPath)(this.rootItem,this.dataPath,()=>void 0):void 0)}get dataPath(){return T(this,`dataPath`,``)}get name(){return T(this,`name`,()=>Le(this.dataPath))}get index(){return T(this,`index`,()=>Re(this.dataPath))}get itemDataPath(){return je(this.dataPath,this.nested)}get parentItemDataPath(){return Ne(this.dataPath,this.nested)}get itemIndex(){return Re(this.itemDataPath)}get parentItemIndex(){return Re(this.parentItemDataPath)}get item(){return T(this,`data`,()=>Pe(this.rootItem,this.dataPath,this.nested)||null)}get parentItem(){let e=Fe(this.rootItem,this.dataPath,this.nested)||null;return e===this.item?null:e}get rootItem(){return T(this,`rootData`,null)}get processedItem(){return T(this,`processedData`,null)}get processedRootItem(){return T(this,`processedRootData`,null)}get clipboardItem(){return T(this,`clipboardData`,null)}get user(){return T(this,`user`,null)}get api(){return T(this,`api`,null)}get views(){return T(this,`views`,null)}get flattenedViews(){return T(this,`flattenedViews`,null)}get itemLabel(){return T(this,`itemLabel`,null)}get formLabel(){return T(this,`formLabel`,null)}get component(){return T(this,`component`,null)}get schemaComponent(){return T(this,`schemaComponent`,null)}get formComponent(){return T(this,`formComponent`,null)}get viewComponent(){return T(this,`viewComponent`,null)}get dialogComponent(){return T(this,`dialogComponent`,null)}get panelComponent(){return T(this,`panelComponent`,null)}get resourceComponent(){return T(this,`resourceComponent`,null)}get sourceComponent(){return T(this,`sourceComponent`,null)}get option(){return T(this,`option`,void 0)}get options(){return T(this,`options`,void 0)}get open(){return T(this,`open`,void 0)}get searchTerm(){return T(this,`searchTerm`,void 0)}get error(){return T(this,`error`,void 0)}get wasNotified(){return T(this,`wasNotified`,!1)}get isRunning(){return T(this,`isRunning`,!1)}set isRunning(e){bt(this,`isRunning`,e)}get query(){return this.component.$route.query}get request(){return e=>this.component.request(e)}get format(){return(e,t)=>this.component.format(e,t)}get navigate(){return e=>this.component.navigate(e)}get download(){return e=>this.component.download(e)}get getResourceUrl(){return e=>this.component.getResourceUrl(e)}get notify(){return e=>{this.component.notify(e),bt(this,`wasNotified`,!0)}}},xt={data(){return{listeners:null}},methods:{on(e,t){if((0,r.isArray)(e))for(let n of e)this.on(n,t);else if((0,r.isPlainObject)(e))for(let t in e)this.on(t,e[t]);else{let n=this.listeners||=Object.create(null),{callbacks:r}=n[e]||={callbacks:[],queue:[]};r.push(t)}return this},once(e,t){let n=(...r)=>(this.off(e,n),t.apply(this,r));return n.callback=t,this.on(e,n)},off(e,t){if(!arguments.length)delete this.listeners;else if((0,r.isArray)(e))for(let n of e)this.off(n,t);else if((0,r.isPlainObject)(e))for(let t in e)this.off(t,e[t]);else{let n=this.listeners?.[e];if(n){if(!t)delete this.listeners[e];else{let{callbacks:e}=n,r=e.findIndex(e=>e===t||e.callback===t);r!==-1&&e.splice(r,1)}}}return this},emit(e,...t){let n=this.listeners?.[e];if(n){let{queue:r,callbacks:i}=n;return new Promise(n=>{let a=async()=>{let t=r.shift();if(t){let n,r=[];for(let e of i)try{let r=await e.apply(this,t.args);r!==void 0&&(n=r)}catch(e){r.push(e)}if(r.length>0){let n=AggregateError(r,`Errors during event handler for '${e}'`);t.resolve(Promise.reject(n))}else t.resolve(n);a()}};r.push({args:t,resolve:n}),r.length===1&&a()})}return Promise.resolve()},hasListeners(e){if((0,r.isArray)(e)){for(let t of e)if(!this.hasListeners(t))return!1;return e.length>0}return!!this.listeners?.[e]},delegate(e,t){if(t){if((0,r.isArray)(e))for(let n of e)this.delegate(n,t);else this.on(e,(...n)=>t.emit(e,...n))}return this}}},St=new WeakMap,Ct=0;function wt(t,n=null){let r=(0,e.toRaw)(t),i=St.get(r);return!i&&t&&(i=n?.(t)||`@${++Ct}`,St.set(r,i)),i}var Tt=class{graph={};references={};set(e,t,n){e=(0,r.parseDataPath)(e);let i=this.graph;for(let t of e){let e=(0,r.isInteger)(+t)?`*`:t;i=i[e]??={}}i.$settings={...n,...i.$settings,...t}}addSource(e,t){this.set(e,{type:`source`,schema:t},{related:!1})}setSourceRelated(e){this.set(e,{related:!0,reference:this.getReferencePrefix(e)})}addRelation(e,t,n){this.set(e,{type:`relation`,schema:n,internal:!!t,reference:this.getReferencePrefix(t)})}getReferencePrefix(e){return e?this.references[e]??=(0,a.nanoid)(6):null}flatten(){let e=t=>{let n=[];for(let[r,{$settings:i,...a}]of Object.entries(t)){i&&n.push([r,i]);for(let[t,i]of e(a))n.push([`${r}/${t}`,i])}return n};return e(this.graph)}process(e,t,{target:n}){let i=n===`clipboard`;i&&delete t[e.idKey||`id`];for(let[e,n]of this.flatten()){let{type:a,schema:o,internal:s,related:c,reference:l}=n,u=a===`source`,d=a===`relation`;if(u||d&&s){let n=(0,r.getValueAtDataPath)(t,e,()=>null),a=i&&u&&!c,f=i&&(d&&s||u&&c);for(let e of(0,r.asArray)(n).flat()){let t=u&&o.idKey||d&&o.relateBy||`id`,n=e?.[t];if(n!=null&&(a&&delete e[t],f||Ve(n))){Ve(n)&&(n=n.slice(1));let r=i?t:u?`#id`:`#ref`;e[r]=i?`@${n}`:l?`${l}-${n}`:n,r!==t&&delete e[t]}}}}return t}},Et={Boolean:r.isBoolean,Number:r.isNumber,String:r.isString,Date:r.isDate,Array:r.isArray,Object:r.isObject,RegExp:r.isRegExp,Function:r.isFunction},Dt={Boolean:e=>!!e,Number:e=>+e,String:e=>String(e),Date:e=>(0,r.isDate)(e)?e:new Date(e),Array:e=>(0,r.isArray)(e)?e:(0,r.isString)(e)?e.split(`,`):(0,r.asArray)(e),Object:e=>(0,r.isObject)(e)?e:e===!0?{}:null,RegExp:e=>(0,r.isRegExp)(e)?e:new RegExp(e)};function Ot(e,t){if(e&&t!=null){for(let n of e)if(Et[n.name]?.(t))return!0}return!1}function kt(e,t){let n=e&&Dt[e.name||e];return n?n(t):t}var At={},jt=new WeakMap;function D(e){return S(e)&&((0,r.isObject)(e.form||e.forms||e.components)||(0,r.isFunction)(e.components))}function Mt(e){return S(e)&&Object.keys(e?.forms||{}).length>1}function Nt(e,t){let{view:n}=e,r=n&&t.flattenedViews[n];return r&&Ze(r,D)||null}function Pt(e,t){return Nt(e,t)?t.flattenedViews[e.view]:null}function Ft(e,t){return!!Pt(e,t)}function It(e,t){let n=Pt(e,t);return n?ct(n)?n.fullPath:`${n.fullPath}/${n.path}`:null}function Lt(e,t,n){let r=It(e,n);return r?`${r}/${t}`:null}function O(e,t,n){let i=t&&Nt(e,t);if(i)e=i;else if(e.view)throw Error(`Unknown view: '${e.view}'`);let{form:a,forms:o}=e;if(!a&&!o){let{name:t,compact:n,clipboard:r,tabs:i,components:o}=e;if(o||i)a={type:`form`,name:t,compact:n,clipboard:r,tabs:i,components:o};else return{}}return o||={default:a},Object.fromEntries(Object.entries(o).map(([e,i])=>(t&&(0,r.isFunction)(i.components)&&(i=Rt(i,t)),[e,n?.(i)??i])))}function Rt(t,n){let{item:i}=n;if(!(0,r.isObject)(i))return zt(t,n);let a=jt.get(t.components);a||(a=new WeakMap,jt.set(t.components,a));let o=a.get(i);return o||(o=(0,e.computed)(()=>zt(t,n)),a.set(i,o)),o.value}function zt(t,n){let r=(0,e.reactive)({...t,components:t.components(n)});return Gn(n.api,r).catch(console.error),r}function Bt(e,t){return e[t?.type]||e.default||null}function Vt(e,t,n){return Bt(O(e,n),t)||At}function Ht(e){return e===At}function k(e,t){let n=(e,n)=>e.length>0?e.reduce((e,r)=>{let i=n(r);return i&&(e[i.name]=i&&t?{...t,...i}:i),e},{}):null;return(0,r.isArray)(e)?n(e,e=>(0,r.isObject)(e)?e:{name:(0,r.camelize)(e,!1)}):(0,r.isObject)(e)?n(Object.entries(e),([e,t])=>(0,r.isObject)(t)?{name:e,...t}:(0,r.isString)(t)?{name:e,label:t}:null):null}function A(e){return k(e,{type:`button`})}function Ut(e,t,n,r){return e?{schema:e,dataPath:t,componentPath:n,tabComponent:r}:null}function Wt(e,t,n,r=null,i=[]){if(e)for(let[a,o]of Object.entries(e)){let e=Ut(o,b(t,a),b(n,a),r);e&&i.push(e)}return i}function Gt(e,t,n,r,i,a=null,o=null){let s=x(t)?.getPanelSchema?.(e,t,n,a),c=s?[Ut(s,b(n,s.name),b(r,s.name),o)]:[];return Wt(t?.panels,n,i,o,c),c}function j(e,{type:t,schema:n,callback:i=!0,default:a,context:o}={}){let s=t&&(0,r.asArray)(t),c=n?(0,r.isArray)(e)?(0,r.getValueAtDataPath)(n,e,()=>void 0):n[e]:void 0;if(c===void 0&&a!==void 0)return i&&(0,r.isFunction)(a)&&!Ot(s,a)&&(a=a(o)),a;if(Ot(s,c))return c;if(i&&(0,r.isFunction)(c)&&(c=c(o)),s&&c!=null&&!Ot(s,c))for(let e of s){let t=kt(e,c);if(t!==c)return t}return c}function Kt(e,t){return j(`if`,{type:Boolean,schema:e,context:t,default:!0})&&(!$e(e)||!!Je(e)||Qe(e,(e,n)=>Kt(e,t.createChildContext(e,n))))}function M(e){return(0,r.isFunction)(e)?e():e}function qt(e,t){let n=e.default===void 0?x(e)?.defaultValue:e.default;return(0,r.isFunction)(n)?n(M(t)):(0,r.clone)(n)}function Jt(e,t){let n=e.exclude===void 0?x(e)?.excludeValue:e.exclude;return(0,r.isFunction)(n)?n(M(t)):!!n}function Yt(e,t){return!!x(e)?.ignoreMissingValue?.(M(t))}function Xt(e,t,n,r){return!(n in t)||!!x(e)?.treatNullAsMissing?.(M(r))&&t[n]===null}function Zt(e){return!!x(e)?.valueFromDataSchema&&!!(e.data||e.dataPath)}function Qt(e){return e.multiple??!!x(e)?.defaultMultiple}function $t(e,t,n,r,{shouldSetDefaultsOfComponentsWithCompute:i=!0}={}){return(i||!e.compute)&&Xt(e,t,n,r)&&!Yt(e,r)}function en(e,t={},n,{dataPath:i=null,rootData:a=t,shouldProcess:o,shouldSkipSourcesWithResource:s=!1,shouldSetDefaultsOfComponentsWithCompute:c=!0}={}){return N(e,t,{dataPath:i,before:({schema:e,data:t,name:i,dataPath:o})=>{let s=()=>new E(n,{schema:e,name:i,data:t,dataPath:o,rootData:a});$t(e,t,i,s,{shouldSetDefaultsOfComponentsWithCompute:c})&&(t[i]=qt(e,s)),cn(e)&&(0,r.isArray)(t[i])&&ln(e,t[i])},shouldProcess:o,shouldSkipSourcesWithResource:s,options:{component:n,rootData:a}})}function tn(e,t,n,r,{component:i=null,rootData:a=i?.rootData,getOptions:o=null}={}){let s=()=>new E(i,()=>{let i={schema:e,get value(){return t[n]},name:n,data:t,dataPath:r,rootData:a};return o&&Object.defineProperty(i,"options",{get:o,enumerable:!0}),i}),{compute:c}=e;if(c&&j(`if`,{type:Boolean,schema:e,context:M(s),default:!0})){let e=c(M(s));if(e!==void 0)return e}return nn(e,t,n,s)}function nn(e,t,n,r){return Xt(e,t,n,r)&&!Yt(e,r)?qt(e,r):t[n]}function rn(e,t,n){if(n.schemaOnly){let n={},{idKey:r=`id`,orderKey:i}=e,a=t[r];return a!==void 0&&(n[r]=a),Mt(e)&&(n.type=t.type),i&&(n[i]=t[i]),n}return{...t}}function an(e,t,n,i,{component:a,rootData:o,schemaOnly:s,target:c,shouldCallProcess:l=!0}={}){let u={component:a,rootData:o,schemaOnly:s,target:c},d=rn(t,n,u),f=new Tt;return N(e,n,{dataPath:i,processedData:d,before:({schema:e,data:t,name:n,dataPath:i,processedData:o})=>{let s=nn(e,t,n,()=>E.createForSchema(a,{schema:e,name:n,data:t,dataPath:i,rootData:u.rootData}));if((0,r.isArray)(s)){let{wrapPrimitives:t}=e;s=t?s.map(e=>({[t]:e})):[...s]}o[n]=s},after:({schema:e,data:t,name:n,dataPath:i,processedData:o})=>{let{wrapPrimitives:s,process:c}=e,d=o[n],p=()=>new E(a,{schema:e,value:d,name:n,data:t,dataPath:i,rootData:u.rootData,processedData:o});s&&(0,r.isArray)(d)&&(d=d.map(e=>e[s]));let m=x(e)?.processValue;m&&(d=m(M(p),f)),c&&l&&(d=c(M(p))),(!c||l)&&Jt(e,p)?delete o[n]:o[n]=d},options:u}),f.process(t,d,u)}function N(e,t,{dataPath:n=null,componentPath:i=``,processedData:a=null,wrappedPrimitiveName:o=null,before:s=null,after:c=null,shouldProcess:l=()=>!0,shouldSkipSourcesWithResource:u=!1,options:d}){let f={before:s,after:c,shouldProcess:l,shouldSkipSourcesWithResource:u,options:d},p=(e,t)=>e==null?null:b(e,t),m=(e,i)=>{if(e)for(let[m,g]of Object.entries(e)){let e=C(g),_=e&&m!==o?p(n,m):n,v={schema:g,data:t,name:m,dataPath:_,componentPath:b(i,m),processedData:a};if(l(v)){if(u&>(g)){h(g.panels,v.componentPath);continue}if(!at(g)){if(!e)N(g,t,{...f,dataPath:n,componentPath:v.componentPath,processedData:a});else{let{wrapPrimitives:e}=g,n=(n,i=null)=>{e&&!(0,r.isObject)(n)&&(n={[e]:n});let o=i===null?_:p(_,i),s=i===null?v.componentPath:b(v.componentPath,i),c=new E(d.component,{schema:g,data:t,dataPath:_,name:m,rootData:d.rootData}),l=Bt((x(g)?.getFormSchemasForProcessing||O)(g,c),n);if(l){let t=a?rn(g,n,d):null;return N(l,n,{...f,dataPath:o,componentPath:s,processedData:t,wrappedPrimitiveName:e??null})}return{...n}};if(s?.(v),D(g)){let e=a?a[m]:t[m];e!=null&&(e=(0,r.isArray)(e)?a?e.map(n):e.forEach(n):n(e),a&&(a[m]=e))}c?.(v),h(g.panels,v.componentPath)}}}}},h=(e,r)=>{for(let[i,o]of Object.entries(e||{})){let e={schema:o,data:t,name:null,dataPath:n,componentPath:b(r,i),processedData:a};l(e)&&!at(o)&&m(o.components,e.componentPath)}};return m((0,r.isFunction)(e.components)?Vt(e,t,new E(d.component,{schema:e,data:t,dataPath:n,rootData:d.rootData})).components:e.components,i),h(e.tabs,i),h(e.panels,i),a||t}function on(e,t,n,{componentPath:r=``,component:i=null,rootData:a=t}={}){let o={dataPath:``,componentPath:r};t&&N(e,t,{dataPath:``,componentPath:r,shouldProcess:e=>De(n,e.dataPath)!==null,before:e=>{e.dataPath.length>o.dataPath.length&&(o=e)},options:{component:i,rootData:a}});let s=De(n,o.dataPath);return s?b(o.componentPath,s):o.componentPath}function sn(e,t){let n=t[e.idKey||`id`];return n==null?void 0:String(n)}function cn(e){return!!e.orderKey&&!e.wrapPrimitives}function ln(e,t,n){let{orderKey:r}=e;if(r){let e=n?.[0]||0;for(let n=0;n<t.length;n++)t[n][r]=n+e}return t}function un(e,t){return wt(t,t=>sn(e,t))}var dn={computed:{value:{get(){let e=nn(this.schema,this.data,this.name,()=>E.createForSchema(this,{schema:this.schema,name:this.name,data:this.data,dataPath:this.dataPath,rootData:this.rootData})),{format:t}=this.schema;return(0,r.isFunction)(t)?t(new E(this,{value:e})):e},set(e){let{parse:t}=this.schema;t&&(e=t(new E(this,{value:e}))),this.parsedValue=e,this.data[this.name]=e}}}},P={computed:{context(){return new E(this,{nested:this.nested})},parentData(){let e=Fe(this.rootData,this.dataPath,this.nested);return e===this.data?null:e},processedData(){return fn(this,this.dataPath,this.nested)},processedRootData(){return fn(this,``,!1)},item(){return this.data},parentItem(){return this.parentData},rootItem(){return this.rootData},processedItem(){return this.processedData},processedRootItem(){return this.processedRootData}}};function fn(e,t,n=!1){let{schemaComponent:r}=e;for(;r.dataPath.length>t.length;)r=r.parentSchemaComponent;return Pe(r.processedData,t.slice(r.dataPath.length),n)}var pn={validate:e=>(0,r.isCreditCard)(e),message:`is invalid`},mn={validate:(e,t)=>{let n=t===`*`?`+`:`{1,${t}}`;return RegExp(`^[-+]?\\d*(\\.\\d${n})?$`).test(e)},message:(e,t)=>`must be numeric and may contain ${!t||t===`*`?``:t} decimal points`},hn={validate:e=>(0,r.isEmail)(e),message:`must be a valid email`},gn={validate:e=>(0,r.isHostname)(e),message:`is not a host name`},_n={validate:e=>(0,r.isDomain)(e),message:`is not a domain`},vn={validate:e=>(0,r.isInteger)(e),message:`must be whole number`},yn={validate:(e,t)=>e<=t,message(e,t){return`must be ${t} or less`}},bn={validate:(e,t)=>e>=t,message(e,t){return`must be ${t} or more`}},xn={validate:()=>!0},Sn={validate:(e,[t,n])=>e>=t&&e<=n,message(e,[t,n]){return`must be between ${t} and ${n}`}},Cn={validate:(e,t,{password:n})=>e!=null&&e!==``||n&&e===void 0,message:`is required`},wn={validate:e=>(0,r.isUrl)(e),message:`is not a valid URL`},Tn=Ce({creditcard:()=>pn,decimals:()=>mn,domain:()=>_n,email:()=>hn,hostname:()=>gn,integer:()=>vn,max:()=>yn,min:()=>bn,password:()=>xn,range:()=>Sn,required:()=>Cn,url:()=>wn});function En(e,t){let n={...x(e)?.getTypeValidations?.(e,t)};j(`required`,{type:Boolean,schema:e,context:t})&&(n.required=!0);for(let[t,r]of Object.entries(e.rules||{}))r===void 0?delete n[t]:n[t]=r;return n}function Dn(e,t){let n=[];for(let[i,a]of Object.entries(t)){let o=Tn[i];if(o&&(i===`required`||e!=null&&e!==``)){let{validate:i,message:s}=o;i(e,a,t)||n.push({message:(0,r.isFunction)(s)?s(e,a,t):s})}}return n}function On(e,t,{dataPath:n=``,component:i=null,rootData:a=t}={}){let o=null,s=({schema:e,data:t,name:n,dataPath:r})=>new E(i,{schema:e,value:n==null?void 0:t[n],name:n,data:t,dataPath:r,rootData:a});return N(e,t,{dataPath:n,shouldProcess:e=>Kt(e.schema,s(e)),shouldSkipSourcesWithResource:!0,before:e=>{let{schema:t,data:n,name:i,dataPath:a}=e,c=s(e),l=n[i],{format:u}=t;(0,r.isFunction)(u)&&(l=u(c));let d=En(t,c),f=Dn(l,d);f.length>0&&(o||={},o[a]=f)},options:{component:i,rootData:a}}),o}function kn(e,t){let n;if((0,r.isFunction)(t))n=t;else if((0,r.isRegExp)(t))n=e=>t.test(e);else{let e=(0,r.asArray)(t).map(r.normalizeDataPath);n=t=>e.includes(t)}let i=Object.entries(e||{}).filter(([e])=>n(e));return i.length>0?Object.fromEntries(i):null}var An={emits:[`errors`],data(){return{isTouched:!1,isDirty:!1,isValidated:!1,isValid:!1,errors:null,valueWithErrors:void 0}},computed:{hasErrors(){return!!this.errors}},methods:{resetValidation(){this.isTouched=!1,this.isDirty=!1,this.isValidated=!1,this.isValid=!1,this.clearErrors()},validate(e=!0){let t=Dn(this.value,this.validations),n=t.length===0;if(e){this.clearErrors();for(let{message:e}of t)this.addError(e,!0);this.isValidated=!0,this.isValid=n}return n},verify(){return this.validate(!1)},markTouched(){this.isTouched=!0,this.clearErrors()},markDirty(){this.isDirty=!0,this.isValidated=!1,this.isValid=!1,this.clearErrors()},addError(e,t=!1){this.errors||=[],this.valueWithErrors=this.value,t&&(e=`The ${this.label||this.placeholder||this.name} field ${e}.`),this.errors.push(e),this.$emit(`errors`,this.errors)},showValidationErrors(e,t){if(this.errors=[],e.length===0)return!1;for(let{message:t}of e)this.addError(t,!0);return t&&this.scrollIntoView(),!0},getErrors(){return this.errors?[...this.errors]:null},clearErrors(){this.errors=null,this.$emit(`errors`,this.errors)}}};function F(e,{type:t,default:n,get:i,set:a,callback:o=!0}={}){(0,r.isString)(e)&&e.includes(`.`)&&(e=(0,r.parseDataPath)(e));let s=(0,r.normalizeDataPath)(e);return{get(){let r=!i||i.length>0?this.overrides&&s in this.overrides?this.overrides[s]:this.getSchemaValue(e,{type:t,default:n,callback:o}):void 0;return i?i.call(this,r):r},set(e){a?a.call(this,e):(this.overrides||={},this.overrides[s]=e)}}}function jn(e,{default:t,get:n,set:i}={}){return{get(){let i=this.getStore(e);return i===void 0&&t!==void 0&&(i=(0,r.isFunction)(t)?t.call(this):t,this[e]=i,this.getStore(e)),n?n.call(this,i):i},set(t){(!i||(t=i.call(this,t))!==void 0)&&this.setStore(e,t)}}}var Mn={mixins:[dn,P,An],emits:[`update:component`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},width:{type:[Number,String],default:null},label:{type:String,default:null},single:{type:Boolean,default:!1},nested:{type:Boolean,default:!0},accumulatedBasis:{type:Number,default:null}},data(){return{parsedValue:void 0,focused:!1}},computed:{name(){return this.schema.name},type(){return this.schema.type},labelNode(){let e=this.isMounted?this.$el.previousElementSibling:null;return e?.matches(`.dito-label`)?e:null},visible:F(`visible`,{type:Boolean,default(){return this.$options.defaultVisible}}),exclude:F(`exclude`,{type:Boolean,default:!1}),required:F(`required`,{type:Boolean,default:!1}),readonly:F(`readonly`,{type:Boolean,default:!1}),autofocus:F(`autofocus`,{type:Boolean,default:!1}),clearable:F(`clearable`,{type:Boolean,default:!1,get(e){return e&&!this.readonly}}),disabled:F(`disabled`,{type:Boolean,default:!1}),maxLength:F(`maxLength`,{type:Number}),placeholder:F(`placeholder`,{type:String}),autocomplete:F(`autocomplete`,{type:String}),info:F(`info`,{type:String,default:null}),inlineInfo(){return this.label?null:this.info},events(){let e=this.getEvents();for(let t of Object.keys(this.schema.events||{}))e[`on${(0,r.camelize)(t,!0)}`]??=()=>{this.emitEvent(t)};return e},attributes(){let{nativeField:e,textField:t}=this.$options,n={...this.events,disabled:this.disabled||this.readonly&&!t};return e&&(n.name=this.dataPath,this.label&&(n.title=this.label),n.readonly=this.readonly,n.autofocus=this.autofocus,t&&(n.maxlength=this.maxLength,n.placeholder=this.placeholder,n.autocomplete=this.autocomplete)),n},validations(){return En(this.schema,this.context)},showClearButton(){return this.clearable&&this.value!=null}},watch:{value(e){this.hasErrors&&!(0,r.equals)(e,this.valueWithErrors)&&this.clearErrors()},componentPath(e,t){this._registerWithSchemaComponent(!1,t),this._registerWithSchemaComponent(!0,e)}},created(){this._register(!0),this.setupSchemaFields(),this.warnAboutUncomputedValue()},unmounted(){this._register(!1)},methods:{warnAboutUncomputedValue(){this.schema.compute&&!this.dataModel.hasComputedValueEntry(this.componentPath)&&console.warn(`The value of the component at '${this.componentPath}' isn't computed, as its data isn't part of a data model.`)},_register(e){this.$emit(`update:component`,e?this:null),this._registerWithSchemaComponent(e,this.componentPath)},_registerWithSchemaComponent(e,t){this.nested?this.schemaComponent._registerComponent(this,e,t):this.schemaComponent?._registerUnnestedComponent(this,e,t)},getEvents(){let{onFocus:e,onBlur:t,onInput:n,onChange:r}=this;return{onFocus:e,onBlur:t,onInput:n,onChange:r}},async scrollIntoView(){await this.focusSchema(),this.getFocusElement()?.scrollIntoView?.({behavior:`smooth`,block:`center`})},focusElement(){this.getFocusElement()?.focus?.()},blurElement(){this.getFocusElement()?.blur?.()},getFocusElement(){let e=(0,r.asArray)(this.$refs.element)[0]??this;return e.$el??e},async focusSchema(){await this.schemaComponent.focus(),await this.tabComponent?.focus()},async focus(){await this.focusSchema(),this.scrollIntoView(),this.focusElement()},blur(){this.blurElement()},clear(){this.value=null,this.blur(),this.onChange()},onFocus(){this.focused=!0,this.markTouched(),this.emitEvent(`focus`)},onBlur(){this.focused=!1,this.validate(),this.emitEvent(`blur`)},onInput(){this.markDirty(),this.emitEvent(`input`)},onChange(){this.markDirty(),this.emitEvent(`change`,{context:{value:this.parsedValue===void 0?this.value:this.parsedValue},parent:this.schemaComponent})}}},Nn=new WeakMap;async function I(e,t=!1){if(Nn.has(e))return Nn.get(e);let n=e;if((0,r.isFunction)(n)&&(n=n()),(0,r.isPromise)(n)&&(n=await n),(0,r.isModule)(n)&&(n={...n},!n.name&&(t||n.default))){let e=Object.keys(n).filter(e=>e!==`_rerender_only`);if(e.length===1){let t=e[0];n=n[t],t!=="default"&&(n={...n,name:t})}}return Nn.set(e,n),n}async function Pn(e,t=I){let n=(0,r.isFunction)(e)?e():e;return n=await I(n,!1),(0,r.isArray)(n)?n=Object.fromEntries(await(0,r.mapConcurrently)(n,async e=>{let n=await t(e,!0);return[n.name,n]})):(0,r.isObject)(n)&&(n=Object.fromEntries(await(0,r.mapConcurrently)(Object.entries(n),async([e,n])=>[e,await t(n,!0)]))),n}async function Fn(e){return Pn(e,async(e,t)=>(e=await I(e,t),!e.name&&ot(e)&&(e={...e,name:(0,r.camelize)(e.label),items:await Pn(e.items)}),e))}function In(e){return Object.fromEntries(Object.entries(e).reduce((e,[t,n])=>(ot(n)?e.push(...Object.entries(n.items)):e.push([t,n]),e),[]))}async function Ln(t){let{component:n}=t;n&&(n=await I(n,!0),n&&(t.component=(0,e.markRaw)({...n,mixins:[Zn,Mn,...n.mixins||[]]})))}async function Rn(e){await(0,r.mapConcurrently)(Object.values(e||{}),Ln)}var zn=new WeakMap;function L(e,t,n=null,r=0,i=1){if(t){let a=zn.get(t)??0;if(a<i){zn.set(t,a+1);let i=[],o=(t,a,o)=>{i.push(Bn(e,t,a,n,r+o))};return Xe(t,o),Ye(mt(t),o),Promise.all(i)}}}function Bn(e,t,n,i=null,a=0){return R(e,t),Promise.all([(0,r.mapConcurrently)(mt(t),t=>L(e,t,i,a)),x(t)?.processSchema?.(e,t,n,i,a)])}async function Vn(e,t,n,r,i=``){R(t,n),Un(t,n,r,i);let a=[];if(nt(n))await Jn(t,n),await L(t,n,a);else if(ot(n))a=await Promise.all(Object.entries(n.items).map(async([r,i])=>Vn(e,t,i,r,n.fullPath)));else throw Error(`Invalid view schema: '${st(n)}'`);return{path:n.fullPath,children:a,component:e,meta:{api:t,schema:n}}}function R(e,t){let n=e.defaults[t.type]||e.defaults[(0,r.camelize)(t.type)];if(n&&((0,r.isFunction)(n)&&(n=n(t)),(0,r.isObject)(n)))for(let[e,i]of Object.entries(n))t[e]=t[e]===void 0?i:(0,r.assignDeeply)(t[e],i)}function Hn(e,t){Xe(t,t=>{R(e,t);let n=O(t);for(let t of Object.values(n))Hn(e,t)})}function Un(e,t,n,r=null){t.name??=n,t.path??=e.normalizePath(n),r!==null&&(t.fullPath=`${r}/${t.path}`)}async function Wn(e,t,n){let i=[],{form:a,forms:o,components:s,maxDepth:c=1}=t;return o?t.forms=await Pn(o,t=>Gn(e,t,i,n,c)):a?t.form=await Gn(e,a,i,n,c):(0,r.isObject)(s)&&await Gn(e,{type:`form`,components:s},i,n,c),i}async function Gn(e,t,n=null,r=0,i=1){if(t=await I(t,!0),!tt(t))throw Error(`Invalid form schema: '${st(t)}'`);return R(e,t),await Jn(e,t),await L(e,t,n,r,i),t}async function Kn(e,t){if(t=await I(t,!0),!rt(t))throw Error(`Invalid tab schema: '${st(t)}'`);return R(e,t),t}async function qn(e,t){if(t=await I(t,!0),!it(t))throw Error(`Invalid panel schema: '${st(t)}'`);return R(e,t),t}async function Jn(e,t){let{tabs:n,panels:r}=t;n&&(t.tabs=await Pn(n,t=>Kn(e,t))),r&&(t.panels=await Pn(r,t=>qn(e,t)))}function Yn(e){return!!z(e.resource)}function z(e,t={}){let{parent:n,...i}=t;return(0,r.isFunction)(e)&&(e=e(t)),e=(0,r.isObject)(e)?{...i,...e}:(0,r.isString)(e)?{...i,path:e}:null,e&&n!==void 0&&e.parent===void 0&&!e.path?.startsWith(`/`)&&(e.parent=n,e.path||(e.path=`.`)),e}function Xn(e,t){return e!=null&&t?.type===`collection`?{type:`member`,...(0,r.pickBy)(t,(e,t)=>[`method`,`path`,`parent`].includes(t)),id:`${e}`}:null}var Zn={mixins:[xt],inject:[`api`,`$verbs`,`$views`,`$isPopulated`,`$parentComponent`,`$schemaComponent`,`$routeComponent`,`$dataComponent`,`$sourceComponent`,`$resourceComponent`,`$dialogComponent`,`$dataModel`,`$panelComponent`,`$tabComponent`],provide(){let e=()=>this;return this.providesData?{$parentComponent:e,$dataComponent:e}:{$parentComponent:e}},data(){return{appState:Ee,isMounted:!1,overrides:null}},computed:{dataModel(){return this.$dataModel()},providesData(){return!1},sourceSchema(){return this.meta?.schema},user(){return Ee.user},verbs(){return this.$verbs()},views(){return this.$views()},flattenedViews(){return In(this.views)},isPopulated(){return this.$isPopulated()},locale(){return this.api.locale},context(){return new E(this,{nested:!1})},rootComponent(){return this.$root.$refs.root},componentPath(){return this.continueParentComponentPath()},dataPathForComponentPath(){return this.dataPath??this.parentComponent?.dataPathForComponentPath},parentComponent(){return this.$parentComponent()},schemaComponent(){return this.$schemaComponent()},routeComponent(){return this.$routeComponent()},formComponent(){let e=this.routeComponent;return e?.isForm?e:null},viewComponent(){let e=this.routeComponent;return e?.isView?e:null},dataComponent(){return this.providesData?this:this.$dataComponent()},sourceComponent(){return this.$sourceComponent()},resourceComponent(){return this.$resourceComponent()},dialogComponent(){return this.$dialogComponent()},panelComponent(){return this.$panelComponent()},tabComponent(){return this.$tabComponent()},parentSchemaComponent(){return $n(this,`schemaComponent`)},parentRouteComponent(){return $n(this,`routeComponent`)},parentFormComponent(){return $n(this,`formComponent`)},parentResourceComponent(){return $n(this,`resourceComponent`)},rootData(){return this.dataComponent?.data}},mounted(){this.isMounted=!0},beforeCreate(){let e=Qn++;Object.defineProperty(this,"$uid",{get:()=>e})},methods:{labelize:r.labelize,getStore(e){return this.store[e]},setStore(e,t){return this.store[e]=t,t},removeStore(e){delete this.store[e]},getStoreKeyByIndex(e){return this.store.$keysByIndex?.[e]},setStoreKeyByIndex(e,t){this.store.$keysByIndex??={},this.store.$keysByIndex[e]=t},getChildStore(t,n){let r=this.getStore(t);if(!r&&n!=null){let e=this.getStoreKeyByIndex(n);r=this.getStore(e),r&&(this.setStore(t,r),this.removeStore(e))}return r||=this.setStore(t,(0,e.reactive)({})),n!=null&&this.setStoreKeyByIndex(n,t),r},removeChildStore(e,t){this.getChildStore(e,t),this.removeStore(e)},getSchemaValue(e,{type:t,default:n,schema:i=this.schema,context:a=this.context,callback:o=!0}={}){return j(e,{type:t,schema:i,context:a,callback:o,default:(0,r.isFunction)(n)?()=>n.call(this):n})},getLabel(e,t){return e?this.getSchemaValue(`label`,{schema:e,type:[String,Object]})||(0,r.labelize)(t||e.name):(0,r.labelize)(t)||``},getButtonAttributes(e,t=null,n=null){let i=n?null:`${(0,r.labelize)(e)}${t?` ${t}`:``}`;return{class:`dito-button--${e}`,...i&&{title:i,"aria-label":i}}},getQueryLink(e){return{query:e,hash:this.$route.hash}},shouldRenderSchema(e=null){return Kt(e,this.context)},shouldShowSchema(e=null){return this.getSchemaValue(`visible`,{type:Boolean,default:!0,schema:e})},shouldDisableSchema(e=null){return this.getSchemaValue(`disabled`,{type:Boolean,default:!1,schema:e})},getResourcePath(e){return e=z(e,{parent:this.dataComponent?.getResource({method:e?.method,child:e})??null}),this.api.resources.any(e)},getResourceUrl(e){let t=this.getResourcePath(e);return t?this.api.getApiUrl({url:t,query:e.query}):null},async sendRequest({method:e,url:t,resource:n,query:i,data:a,signal:o,internal:s}){t||=this.getResourceUrl(n),e||=n?.method;let c=!s&&this.api.isApiUrl(t);c&&await this.rootComponent.ensureUser();let l=await this.api.request({method:e,url:t,query:i,data:a,signal:o});return c&&e===`patch`&&(0,r.equals)(n,Xn(this.user.id,this.api.users))&&await this.rootComponent.fetchUser(),l},showDialog({components:e,buttons:t,data:n,settings:r}){return this.rootComponent.showDialog({components:e,buttons:t,data:n,settings:r})},request({cache:e,...t}){let n=(e&&{global:this.appState,local:this.dataComponent}[e])?.loadCache,r=n&&`${t.method||`get`} ${t.url} ${JSON.stringify(t.query||``)} ${JSON.stringify(t.data||``)}`;if(n&&r in n)return n[r];let i=this.sendRequest(t).then(e=>e.data).catch(e=>{let t=e.response?.data;throw t?Object.assign(Error(t.message),t):e});return n&&(n[r]=i),i},format(e,{locale:t=this.api.locale,defaults:n=this.api.formats,...i}={}){return(0,r.format)(e,{locale:t,defaults:n,...i})},async navigate(e){return this.$router.push(e)},download(e={}){(0,r.isString)(e)&&(e={url:e});let t=document.createElement(`a`);t.href=e.url?.startsWith(`blob:`)?e.url:this.api.getApiUrl(e),t.download=e.filename??null;let{body:n}=document;n.appendChild(t),t.click(),n.removeChild(t)},continueParentComponentPath(){let{parentComponent:e}=this,t=e?.componentPath??``,n=De(this.dataPath,e?.dataPathForComponentPath);return n?b(t,n):t},async waitForPendingLoadsOf(e){this.rootComponent.registerLoading(!0);try{await e.waitForPendingLoads()}finally{this.rootComponent.registerLoading(!1)}},notify(e){this.rootComponent.notify(e)},closeNotifications(){this.rootComponent.closeNotifications()},setupSchemaFields(){this.setupMethods(),this.setupComputed(),this.setupEvents()},setupMethods(){for(let[e,t]of Object.entries(this.schema.methods||{}))(0,r.isFunction)(t)?this[e]=t:console.error(`Invalid method definition: ${e}: ${t}`)},setupComputed(){let t=({get:t,set:n})=>{let r=(0,e.computed)(()=>t.call(this));return{get:()=>r.value,set:n?e=>n.call(this,e):void 0}};for(let[e,n]of Object.entries(this.schema.computed||{})){let i=(0,r.isFunction)(n)?t({get:n}):(0,r.isObject)(n)&&(0,r.isFunction)(n.get)?t(n):null;i?Object.defineProperty(this,e,i):console.error(`Invalid computed property definition: ${e}: ${n}`)}},setupEvents(){let{watch:e,events:t}=this.schema;if(e){let t=(0,r.isFunction)(e)?e.call(this):e;(0,r.isObject)(t)&&this.$nextTick(()=>{for(let[e,n]of Object.entries(t)){let t=this.schemaComponent.getComponentByName(e)?`data.${e}`:e;this.$watch(t,n)}})}let n=(e,t,n)=>{(0,r.isFunction)(n)?this.on((0,r.hyphenate)(t),n):console.error(`Invalid event definition: ${e}: ${n}`)};if(t)for(let[e,r]of Object.entries(t))n(e,e,r);for(let[e,t]of Object.entries(this.schema))/^on[A-Z]/.test(e)&&n(e,e.slice(2),t)},emitEvent(e,{context:t=null,parent:n=null}={}){let r=this.hasListeners(e),i=n?.hasListeners(e);if(r||i){let a=n=>n.emit(e,t=E.get(this,t)),o=e=>i&&e!==!1?a(n).then(()=>e):e,s=()=>r?a(this).then(o):o(void 0);return[`load`,`change`].includes(e)?this.waitForDataModel().then(s):s()}},async waitForDataModel(){await this.$nextTick(),await this.dataModel?.waitForPendingLoads()},emitSchemaEvent(e,t){return this.schemaComponent.emitEvent(e,t)}}},Qn=0;function $n(e,t){let n=e[t],r=e.parentComponent;for(;r&&r[t]===n;)r=r.parentComponent;return r?.[t]??null}function er(e){let{mixins:t}=e;return t||e.extends?tr({...e},e):e}function tr(e,t){if(t.extends&&tr(e,t.extends),t.mixins)for(let n of t.mixins)tr(e,n);for(let n of nr)n in t&&(e[n]=t[n]);return e}var nr=[`defaultValue`,`defaultNested`,`defaultVisible`,`generateLabel`,`excludeValue`,`ignoreMissingValue`,`treatNullAsMissing`,`valueFromDataSchema`,`omitSpacing`,`processValue`,`getTypeValidations`,`processSchema`,`getPanelSchema`,`getFormSchemasForProcessing`,`beforeRouteUpdate`,`beforeRouteLeave`],rr={},B={mixins:[Zn],components:rr,component(e,t){if(t&&((0,r.isPlainObject)(t)&&(t=er({extends:this,name:e,...t})),rr[e]=t),!(e in rr))throw Error(`Component "${e}" not registered`);return rr[e]},methods:{getTypeComponent:Ke}};function ir(t){return t&&(0,r.asArray)(t).some(t=>t.type!==e.Comment)}function ar(t,n={}){return t=(0,r.isString)(t)?(0,e.useSlots)()[t]:t,ir(t?.(n))}var or=[`type`,`title`,`disabled`],sr={key:0,class:`dito-button__prefix`},cr={key:1,class:`dito-button__text`},lr={key:2,class:`dito-button__suffix`};function ur(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({class:[`dito-button`,[o.classes,{"dito-button--affixed":o.hasAffixes}]],type:r.type,title:r.title,disabled:r.disabled},o.attributes),[o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,sr,[(0,e.renderSlot)(t.$slots,`prefix`)])):(0,e.createCommentVNode)(``,!0),r.text||o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,cr,[(0,e.createTextVNode)((0,e.toDisplayString)(r.text||``),1),(0,e.renderSlot)(t.$slots,`default`)])):(0,e.createCommentVNode)(``,!0),o.hasAffixes?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,lr,[(0,e.renderSlot)(t.$slots,`suffix`)])):(0,e.createCommentVNode)(``,!0)],16,or)}var V=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},dr=V({inheritAttrs:!1,props:{type:{type:String,default:`button`},text:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1}},computed:{hasAffixes(){return ar(this.$slots.prefix)||ar(this.$slots.suffix)},classes(){return this.$attrs.class},attributes(){let{class:e,...t}=this.$attrs;return t}}},[[`render`,ur]]);function fr(e){return{year:e?.getFullYear()??0,month:e?.getMonth()??0,day:e?.getDate()??0,hour:e?.getHours()??0,minute:e?.getMinutes()??0,second:e?.getSeconds()??0,millisecond:e?.getMilliseconds()??0}}function pr(e,t={}){return new Date(...Object.values({...fr(e),...t}))}function mr(e,{locale:t=`en-US`,date:n=!0,time:r=!0}={}){let i=r?null:0,a=e?.match(/\s*\b([ap])\.?m\.?$/i);a&&(e=e.slice(0,a.index));let[o,s,c,l,u,,d=i,,f=i,,p=i,,m=i]=gr(e,{date:n,time:r});if(u&&u.length>=4){if((t===`en-US`&&s===`/`&&l===`/`||isNaN(+o)&&!isNaN(+c))&&([o,c]=[c,o]),a&&d!==null){let e=a[1].toLowerCase()===`p`;d=d%12+(e?12:0),d=String(d).padStart(2,`0`)}c=_r(c,{locale:t});let e=e=>e===null||e.length===2;if(c!==null&&(!r||e(d)&&e(f)&&e(p))){let e=new Date(+u,+c,+o,+d,+f,+p,+m);return e.getMonth()===+c&&e.getDate()===+o?e:null}}return null}function hr(e,t,{locale:n=`en-US`,date:r=!0,time:i=!0}={}){let a=gr(e,{date:r,time:i}),o=(e,t=a.length)=>{let n=0,r=0;for(;(e===null||n<=e)&&r<t;)n+=a[r++]?.length??0;return{position:n,index:r}},s=r?0:o(null,6).position;t+=s;let{index:c}=o(t),l=n===`en-US`,u=[l?`month`:`day`,null,l?`day`:`month`,null,`year`,null,`hour`,null,`minute`,null,`second`,null,`millisecond`];for(;c--;)if(u[c]){let e=o(null,c).position-s,t=e+a[c].length;return{name:u[c],start:e,end:t}}return null}function gr(e,{date:t=!0,time:n=!0}={}){let r=e?.split(/([\s.,:/]+)/)||[];return t||r.unshift(`1`,`.`,`1`,`.`,`2000`,` `),!n&&r.length>5&&(r.length=5),r}function _r(e,{locale:t=`en-US`}={}){let n=+e;if(!isNaN(n))return n-1;let r=e.trim().toLowerCase();if(r.length<3)return null;let i=new Intl.DateTimeFormat(t,{month:`short`}),a=new Intl.DateTimeFormat(t,{month:`long`});for(let e=0;e<12;e++){let t=new Date(2e3,e,1);if(i.format(t).toLowerCase().startsWith(r)||a.format(t).toLowerCase().startsWith(r))return e}return null}var vr={class:`dito-calendar`,role:`dialog`,"aria-label":`Choose date`},yr={class:`dito-calendar-popup`},br={class:`dito-calendar-inner`},xr={class:`dito-calendar-header`},Sr={class:`dito-calendar-body`},Cr={class:`dito-calendar-weekdays`},wr={class:`dito-calendar-dates`,role:`grid`},Tr=[`aria-label`,`aria-selected`,`aria-disabled`,`onClick`],Er={class:`dito-calendar-footer`},Dr=[`aria-label`,`title`],Or={class:`dito-calendar-header`},kr={class:`dito-calendar-body`},Ar={class:`dito-calendar-months`,role:`listbox`,"aria-label":`Month`},jr=[`aria-label`,`aria-selected`,`onClick`],Mr={class:`dito-calendar-header`},Nr={class:`dito-calendar-body`},Pr={class:`dito-calendar-years`,role:`listbox`,"aria-label":`Year`},Fr=[`aria-label`,`aria-selected`,`onClick`];function Ir(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,vr,[(0,e.createElementVNode)(`div`,yr,[(0,e.createElementVNode)(`div`,br,[a.currentMode===`day`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createElementVNode)(`div`,xr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev dito-calendar-step-year`,role:`button`,tabindex:`0`,"aria-label":`Previous year`,onClick:n[0]||=e=>o.stepYear(-1)}),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev dito-calendar-step-month`,role:`button`,tabindex:`0`,"aria-label":`Previous month`,onClick:n[1]||=e=>o.stepMonth(-1)}),(0,e.createElementVNode)(`span`,null,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-year`,role:`button`,tabindex:`0`,"aria-label":`Switch to year selection`,onClick:n[2]||=e=>o.setMode(`year`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1),(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-month`,role:`button`,tabindex:`0`,"aria-label":`Switch to month selection`,onClick:n[3]||=e=>o.setMode(`month`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{month:!0})),1)]),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next dito-calendar-step-month`,role:`button`,tabindex:`0`,"aria-label":`Next month`,onClick:n[4]||=e=>o.stepMonth(1)}),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next dito-calendar-step-year`,role:`button`,tabindex:`0`,"aria-label":`Next year`,onClick:n[5]||=e=>o.stepYear(1)})]),(0,e.createElementVNode)(`div`,Sr,[(0,e.createElementVNode)(`div`,Cr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.weekdayNames,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,null,(0,e.toDisplayString)(t.short),1))),256))]),(0,e.createElementVNode)(`div`,wr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.dateRange,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(t.state&&`dito-calendar-item-${t.state}`),role:`gridcell`,"aria-label":o.dateToString(t.date),"aria-selected":t.state===`active`,"aria-disabled":t.state===`disabled`,onClick:e=>t.state!==`disabled`&&o.selectDate(t.date)},(0,e.toDisplayString)(t.text),11,Tr))),256))])]),(0,e.createElementVNode)(`div`,Er,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-now`,role:`button`,tabindex:`0`,"aria-label":`Select today (${o.dateToString(new Date)})`,title:o.dateToString(new Date),onClick:n[6]||=e=>o.selectDate(new Date)},null,8,Dr)])],64)):a.currentMode===`month`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createElementVNode)(`div`,Or,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev`,role:`button`,tabindex:`0`,"aria-label":`Previous year`,onClick:n[7]||=e=>o.stepYear(-1)}),(0,e.createElementVNode)(`span`,null,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-select-year`,role:`button`,tabindex:`0`,"aria-label":`Switch to year selection`,onClick:n[8]||=e=>o.setMode(`year`)},(0,e.toDisplayString)(o.dateToString(a.currentValue,{year:!0})),1)]),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next`,role:`button`,tabindex:`0`,"aria-label":`Next year`,onClick:n[9]||=e=>o.stepYear(1)})]),(0,e.createElementVNode)(`div`,kr,[(0,e.createElementVNode)(`div`,Ar,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.monthNames,(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(o.getMonthClass(n)),role:`option`,"aria-label":t.long,"aria-selected":o.getMonthClass(n)[`dito-calendar-item-active`],onClick:e=>o.selectMonth(n)},(0,e.toDisplayString)(t.short),11,jr))),256))])])],64)):a.currentMode===`year`?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createElementVNode)(`div`,Mr,[(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-prev`,role:`button`,tabindex:`0`,"aria-label":`Previous decade`,onClick:n[10]||=e=>o.stepDecade(-1)}),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(o.decadeToString(a.currentValue)),1),(0,e.createElementVNode)(`a`,{class:`dito-calendar-step-next`,role:`button`,tabindex:`0`,"aria-label":`Next decade`,onClick:n[11]||=e=>o.stepDecade(1)})]),(0,e.createElementVNode)(`div`,Nr,[(0,e.createElementVNode)(`div`,Pr,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.yearRange,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)(o.getYearClass(t)),role:`option`,"aria-label":String(t),"aria-selected":o.getYearClass(t)[`dito-calendar-item-active`],onClick:e=>o.selectYear(t)},(0,e.toDisplayString)(t),11,Fr))),256))])])],64)):(0,e.createCommentVNode)(``,!0)])])])}var Lr={emits:[`update:modelValue`,`select`],props:{modelValue:{type:Date,default:null},locale:{type:String,default:`en-US`},disabledDate:{type:Function,default:()=>!1},mode:{type:String,default:`day`}},data(){let{weekdayNames:e,monthNames:t}=zr(this.locale);return{weekdayNames:e,monthNames:t,dateRange:[],yearRange:[],currentValue:this.modelValue||pr(new Date,{hour:0,minute:0,second:0,millisecond:0}),currentMode:this.mode}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e||new Date,this.updateDateRange())},currentValue(e,t){+e!=+t&&this.updateDateRange()},disabledDate:`updateDateRange`,mode(e){this.currentMode=e}},mounted(){this.updateDateRange()},methods:{getMonthClass(e){return{"dito-calendar-item-active":this.modelValue&&e===this.modelValue.getMonth()&&this.currentValue.getFullYear()===this.modelValue.getFullYear(),"dito-calendar-item-current":e===this.currentValue.getMonth()}},getYearClass(e){return{"dito-calendar-item-active":this.modelValue&&e===this.modelValue.getFullYear(),"dito-calendar-item-current":e===this.currentValue.getFullYear()}},setDate(e,t=!1){this.currentValue=pr(this.currentValue,e),t&&this.$emit(`update:modelValue`,this.currentValue)},stepDecade(e){this.setDate({year:this.currentValue.getFullYear()+e*10})},setMode(e){this.currentMode=e},stepMonth(e){let{currentValue:t}=this,{year:n,month:r}=this.getYearMonth(t.getFullYear(),t.getMonth()+e);this.setDate({month:r,day:Math.min(this.getDaysInMonth(n,r),this.currentValue.getDate())})},stepYear(e){this.setDate({year:this.currentValue.getFullYear()+e})},selectDate(e){this.setDate(fr(e),!0),this.$emit(`select`)},selectMonth(e){this.setMode(`day`),this.setDate({month:e,day:1},!0)},selectYear(e){this.setMode(`month`),this.setDate({year:e},!0)},getYearMonth(e,t){return t>11?(e++,t=0):t<0&&(e--,t=11),{year:e,month:t}},dateToString(e,{year:t,month:n,day:r}={year:!0,month:!0,day:!0}){return e.toLocaleString(this.locale,{year:t&&`numeric`,month:n&&`long`,day:r&&`numeric`})},decadeToString(e){let t=this.getFirstYearOfDecade(e.getFullYear());return`${t} – ${t+9}`},getDaysInMonth(e,t){return new Date(e,t+1,0).getDate()},getFirstYearOfDecade(e){return+`${e.toString().slice(0,-1)}0`},navigate({step:e,enter:t,mode:n=this.currentMode,update:r=!1}){let{currentValue:i}=this;if(e){switch(n){case`day`:this.setDate({day:i.getDate()+e},r);break;case`month`:this.setDate({month:i.getMonth()+e},r);break;case`year`:this.setDate({year:i.getFullYear()+e},r)}return!0}if(t){switch(this.currentMode){case`day`:this.selectDate(i);break;case`month`:this.setMode(`day`);break;case`year`:this.setMode(`month`)}return!0}},updateDateRange(){this.dateRange=[],this.yearRange=[];let{currentValue:e}=this,t=e.getFullYear(),n=e.getMonth(),r=this.getFirstYearOfDecade(t);for(let e=0;e<10;e++)this.yearRange.push(r+e);let i=new Date(t,n,1).getDay()+1;i===0&&(i=7);let a=this.getDaysInMonth(t,n);if(i>1){let e=this.getYearMonth(t,n-1),r=this.getDaysInMonth(e.year,e.month);for(let t=1;t<i;t++){let n=r-i+t+1,a=new Date(e.year,e.month,n);this.dateRange.push({text:n,date:a,state:this.disabledDate(a)?`disabled`:`gray`})}}let o=new Date;for(let r=1;r<=a;r++){let i=new Date(t,n,r),a=e=>e&&e.getDate()===r&&e.getFullYear()===t&&e.getMonth()===n,s=a(this.modelValue)?`active`:a(o)?`today`:this.disabledDate(i)?`disabled`:a(e)?`current`:null;this.dateRange.push({text:r,date:i,state:s})}let s=42-this.dateRange.length;if(s>0){let e=this.getYearMonth(t,n+1);for(let t=1;t<=s;t++){let n=new Date(e.year,e.month,t),r=this.disabledDate(n)?`disabled`:`gray`;this.dateRange.push({text:t,date:n,state:r})}}}}},Rr={};function zr(e){let t=Rr[e];if(!t){let n=[];for(let t=0;t<7;t++){let r=new Date(0,0,t);n.push({long:r.toLocaleString(e,{weekday:`long`}),short:r.toLocaleString(e,{weekday:`short`})})}let r=[];for(let t=1;t<=12;t++){let n=new Date(0,t,0);r.push({long:n.toLocaleString(e,{month:`long`}),short:n.toLocaleString(e,{month:`short`})})}t=Rr[e]={weekdayNames:n,monthNames:r}}return t}var Br=V(Lr,[[`render`,Ir]]);function Vr(e,t){e=e instanceof NodeList?Array.from(e):(0,r.asArray)(e);for(let[n,r]of Object.entries(t))for(let t of e)t.addEventListener(n,r,!1);return{remove(){for(let[n,r]of Object.entries(t))for(let t of e)t.removeEventListener(n,r,!1)}}}function Hr(...e){return{remove(){for(let t of e)t.remove()}}}function Ur(e){return{37:`left`,38:`up`,39:`right`,40:`down`,13:`enter`}[e?.keyCode]}function Wr(e){let t=Ur(e);return{hor:{left:-1,right:1}[t]||0,ver:{up:-1,down:1}[t]||0,enter:t===`enter`}}function Gr(e){let t=(0,r.isString)(e.target)?e.$refs[e.target]:e.target;return t?.$el??t}var Kr={class:`dito-trigger-container`};function qr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Kr,[r.alwaysShow?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):r.trigger===`click`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onClick:n[0]||=(...e)=>o.onClick&&o.onClick(...e)},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):r.trigger===`hover`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`,onMouseenter:n[1]||=e=>o.onHover(!0),onMouseleave:n[2]||=e=>o.onHover(!1)},[(0,e.renderSlot)(t.$slots,`trigger`)],34)):r.trigger===`focus`||r.trigger===`always`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:3,class:(0,e.normalizeClass)([`dito-trigger`,o.triggerClass]),ref:`trigger`},[(0,e.renderSlot)(t.$slots,`trigger`)],2)):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(e.Transition,{name:`dito-${r.transition}`},{default:(0,e.withCtx)(()=>[r.trigger===`hover`?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,e.normalizeStyle)(o.popupStyle),onMouseenter:n[3]||=e=>o.onHover(!0),onMouseleave:n[4]||=e=>o.onHover(!1)},[a.showPopup?(0,e.renderSlot)(t.$slots,`popup`,{},void 0,void 0,0):(0,e.createCommentVNode)(``,!0)],38)),[[e.vShow,a.showPopup]]):(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`dito-popup`,o.popupClass]),ref:`popup`,style:(0,e.normalizeStyle)(o.popupStyle)},[a.showPopup?(0,e.renderSlot)(t.$slots,`popup`,{},void 0,void 0,0):(0,e.createCommentVNode)(``,!0)],6)),[[e.vShow,a.showPopup]])]),_:3},8,[`name`])])}var Jr=V({emits:[`update:show`],props:{trigger:{type:String,default:`click`},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom`},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:null},customClass:{type:String,default:null},zIndex:{type:Number,default:0},keepInView:{type:Boolean,default:!0},hideWhenClickOutside:{type:Boolean,default:!0},alwaysShow:{type:Boolean,default:!1},cover:{type:Boolean,default:!1},hideDelay:{type:Number,default:0}},data(){return{showPopup:this.show,popupPlacement:this.placement,focusEvents:null,closeEvents:null,popupEvents:null,blurTimer:null,mouseLeaveTimer:null}},computed:{triggerClass(){return{"dito-trigger-disabled":this.disabled}},popupClass(){let e={[`dito-popup-${(0,r.hyphenate)(this.placement)}`]:!0};return this.customClass&&(e[this.customClass]=!0),e},popupStyle(){return this.zIndex?`z-index: ${this.zIndex}`:``},triggerTarget(){return Gr(this)}},watch:{show(e){this.showPopup=e||this.alwaysShow},showPopup(e,t){e^t&&(this.$emit(`update:show`,e),this.$nextTick(()=>this.onShowPopup(e)))}},mounted(){let{trigger:e,popup:t}=this.$refs;this.trigger===`focus`&&(this.focusEvents=this.addFocusEvents(this.triggerTarget??e)),this.hideWhenClickOutside&&!this.alwaysShow&&(this.closeEvents=Vr(window,{mouseup:n=>{this.showPopup&&!t.contains(n.target)&&!e.contains(n.target)&&!this.triggerTarget?.contains(n.target)&&(this.showPopup=!1)},blur:()=>{this.showPopup=!1}})),this.alwaysShow&&(this.showPopup=!0)},created(){this.showPopup=this.show},unmounted(){this.focusEvents?.remove(),this.closeEvents?.remove(),this.popupEvents?.remove()},methods:{isPopupFocused(){return!!this.$refs.popup?.matches(`:focus-within`)},updatePosition(){let{trigger:e,popup:t}=this.$refs;if(this.show&&t.offsetWidth===0){setTimeout(()=>this.updatePosition(),0);return}let n=this.triggerTarget??e,r=this.target===`popup`?e:t.firstElementChild;r&&(r.style.width=getComputedStyle(n).width);let i=n.getBoundingClientRect(),a=i.left+window.scrollX,o=i.top+window.scrollY,s=i.width,c=i.height,l=t.offsetWidth,u=t.offsetHeight,[d,f]=this.popupPlacement.split(`-`)||[];if(this.keepInView){let e=window.innerWidth,t=window.innerHeight;d===`top`?o<u&&(d=`bottom`):d===`bottom`?t-o-c<u&&(d=`top`):d===`left`?a<l&&(d=`right`):d===`right`&&e-a-s<l&&(d=`left`),f===`top`?t-o<u&&(f=`bottom`):f===`bottom`?o+c<u&&(f=`top`):f===`left`?e-a<l&&(f=`right`):f===`right`&&a+s<l&&(f=`left`)}let p=0,m=0;switch(d){case`top`:m-=u;break;case`left`:p-=l;break;case`right`:p+=s;break;case`bottom`:m+=c}switch(f){case`right`:p-=l-s;break;case`bottom`:m-=u-c}if(this.cover&&(d===`top`?m+=c:d===`bottom`&&(m-=c)),n!==e){let t=e.getBoundingClientRect();p+=a-t.left,m+=o-t.top}t.style.left=`${p}px`,t.style.top=`${m}px`},addFocusEvents(e){let t=e.querySelectorAll(`input, textarea`),n;return Hr(Vr(t,{focus:()=>{this.showPopup=!0,clearTimeout(this.blurTimer)},blur:()=>{this.blurTimer=setTimeout(()=>{this.isPopupFocused()||(this.showPopup=!1)},0)}}),Vr(e,{mousedown:e=>{e.target.matches(`input, textarea, button`)||(e.preventDefault(),e.stopPropagation()),e.target.matches(`.dito-button-clear`)||(n=(this.triggerTarget??this.$refs.trigger).querySelector(`input, textarea`),n&&!n.hasAttribute(`readonly`)?n.setAttribute(`readonly`,`true`):n=null)},mouseup:e=>{n&&setTimeout(()=>{n.removeAttribute(`readonly`),!e.target.matches(`input, textarea, button`)&&this.isPopupFocused()&&n.focus(),n=null},0)}}))},onShowPopup(e){e?(this.trigger===`focus`&&(this.popupEvents=this.addFocusEvents(this.$refs.popup)),this.updatePosition()):(this.popupEvents?.remove(),this.popupEvents=null)},onClick(){this.disabled||(this.showPopup=!0)},onHover(e){this.disabled||(clearTimeout(this.mouseLeaveTimer),e?this.showPopup=!0:this.hideDelay?this.mouseLeaveTimer=setTimeout(()=>{this.showPopup=!1},this.hideDelay):this.showPopup=!1)}}},[[`render`,qr]]),Yr=[`id`,`type`,`name`,`title`,`disabled`,`readonly`,`autofocus`,`placeholder`,`autocomplete`,`aria-label`];function Xr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-input`,o.classes]),onMousedown:n[2]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)},[(0,e.renderSlot)(t.$slots,`prefix`),(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:r.id,ref:`input`,"onUpdate:modelValue":n[0]||=e=>a.currentValue=e,type:r.type,name:r.name,title:r.title,disabled:r.disabled,readonly:r.readonly,autofocus:r.autofocus,placeholder:r.placeholder,autocomplete:r.autocomplete,"aria-label":r.title},o.attributes,{onMousedown:n[1]||=(...e)=>o.onMouseDown&&o.onMouseDown(...e)}),null,16,Yr),[[e.vModelDynamic,a.currentValue]]),(0,e.renderSlot)(t.$slots,`suffix`)],34)}var H=V({emits:[`update:modelValue`],inheritAttrs:!1,props:{modelValue:{type:[String,Number],default:null},type:{type:String,default:`text`},id:{type:String,default:null},name:{type:String,default:null},title:{type:String,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},focused:{type:Boolean,default:!1},placeholder:{type:String,default:null},autocomplete:{type:String,default:`off`}},data(){return{currentValue:this.modelValue}},computed:{classes(){return[this.$attrs.class,{"dito-input--focus":this.focused}]},attributes(){let{class:e,...t}=this.$attrs;return t},input(){return this.$refs.input},size(){let{size:e,min:t,max:n}=this.$attrs,r=e=>e==null?0:`${e}`.length;return e||r(t)||r(n)||void 0}},watch:{modelValue(e,t){e!==t&&(this.currentValue=e)},currentValue(e){e!==this.modelValue&&this.$emit(`update:modelValue`,e)}},methods:{focus(){this.input.focus()},blur(){this.input.blur()},onMouseDown(e){e.target===this.input?e.stopPropagation():!this.disabled&&!this.readonly&&(this.focus(),e.preventDefault())}}},[[`render`,Xr]]);function Zr(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`i`,{class:(0,e.normalizeClass)([`dito-icon`,o.classes])},null,2)}var Qr=V({props:{name:{type:String,required:!0},disabled:{type:Boolean,default:!1}},computed:{classes(){let e=`dito-icon`;return{[`${e}--${this.name}`]:!0,[`${e}--disabled`]:this.disabled}}}},[[`render`,Zr]]);function U(e,{start:t,end:n}){e?.setSelectionRange&&(e.focus(),e.setSelectionRange(t,n))}function $r(e){return e&&`selectionStart`in e?{start:e.selectionStart,end:e.selectionEnd}:null}function ei(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoCalendar`),u=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(u,(0,e.mergeProps)({class:`dito-date-picker`,ref:`trigger`,show:a.showPopup,"onUpdate:show":n[7]||=e=>a.showPopup=e,trigger:`focus`},{transition:r.transition,placement:r.placement,disabled:r.disabled,target:r.target}),{trigger:(0,e.withCtx)(()=>[t.$slots.trigger?(0,e.renderSlot)(t.$slots,`trigger`,{},void 0,void 0,0):((0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({key:1,class:`dito-date-picker-input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`calendar`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]))]),popup:(0,e.withCtx)(()=>[(0,e.createVNode)(l,(0,e.mergeProps)({class:`dito-date-picker-popup`,ref:`calendar`,modelValue:a.currentValue,"onUpdate:modelValue":n[5]||=e=>a.currentValue=e},{locale:r.locale,disabledDate:r.disabledDate},{onSelect:n[6]||=e=>a.showPopup=!1}),null,16,[`modelValue`])]),_:3},16,[`show`])}var ti=V({components:{DitoTrigger:Jr,DitoCalendar:Br,DitoInput:H,DitoIcon:Qr},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({date:r.defaultFormats.date,time:!1})},disabledDate:{type:Function,default:()=>!1}},data(){return{currentValue:this.modelValue,showPopup:this.show,inputFocused:!1}},computed:{focused(){return this.inputFocused||this.showPopup},input(){return Gr(this)?.querySelector(`input`)},formatOptions(){return{locale:this.locale,...this.format}},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=mr(e,this.formatOptions);t&&(this.currentValue=t)}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e)},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))},show(e){this.showPopup=e},showPopup(e,t){e^t&&this.$emit(`update:show`,e)},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{onFocus(e){this.inputFocused=e,this.showPopup=e},onKeyDown(e){if(e.key===`Escape`){this.showPopup=!1,e.preventDefault();return}let{ver:t,enter:n}=Wr(e);if(t||n){e.preventDefault();let r=$r(this.input)?.start,i=e=>hr(this.currentText,e,this.formatOptions);if(t&&!this.showPopup)this.showPopup=!0;else{let{calendar:e}=this.$refs;if(e){let{name:a,start:o}=i(r)||{};a&&e.navigate({step:t,enter:n,mode:a,update:!0})&&this.$nextTick(()=>U(this.input,i(o)))}}}},onMouseDown(e){this.showPopup=!this.disabled&&(!e||!this.showPopup),this.showPopup&&this.focus()},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,ei]]),ni={class:`dito-time-picker-popup`,role:`dialog`,"aria-label":`Choose time`},ri={class:`dito-time-picker-panel`},ii={class:`dito-time-picker-hour`,ref:`hour`,role:`listbox`,"aria-label":`Hour`},ai=[`aria-label`,`aria-selected`,`onClick`],oi={class:`dito-time-picker-panel`},si={class:`dito-time-picker-minute`,ref:`minute`,role:`listbox`,"aria-label":`Minute`},ci=[`aria-label`,`aria-selected`,`onClick`],li={class:`dito-time-picker-panel`},ui={class:`dito-time-picker-second`,ref:`second`,role:`listbox`,"aria-label":`Second`},di=[`aria-label`,`aria-selected`,`onClick`];function fi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(l,(0,e.mergeProps)({class:`dito-time-picker`,ref:`trigger`,show:a.showPopup,"onUpdate:show":n[5]||=e=>a.showPopup=e,trigger:`focus`},{transition:r.transition,placement:r.placement,disabled:r.disabled,target:r.target}),{trigger:(0,e.withCtx)(()=>[t.$slots.trigger?(0,e.renderSlot)(t.$slots,`trigger`,{},void 0,void 0,0):((0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({key:1,class:`dito-time-picker-input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`clock`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]))]),popup:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,ni,[(0,e.createElementVNode)(`div`,ri,[(0,e.createElementVNode)(`ul`,ii,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(24,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledHour(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.hour===t-1,class:(0,e.normalizeClass)({selected:o.hour===t-1}),onClick:e=>o.hour=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,ai))],64))),64))],512)]),(0,e.createElementVNode)(`div`,oi,[(0,e.createElementVNode)(`ul`,si,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(60,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledMinute(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.minute===t-1,class:(0,e.normalizeClass)({selected:o.minute===t-1}),onClick:e=>o.minute=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,ci))],64))),64))],512)]),(0,e.createElementVNode)(`div`,li,[(0,e.createElementVNode)(`ul`,ui,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(60,t=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[r.disabledSecond(t-1)?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,role:`option`,"aria-label":o.leftPad(t-1),"aria-selected":o.second===t-1,class:(0,e.normalizeClass)({selected:o.second===t-1}),onClick:e=>o.second=t-1},(0,e.toDisplayString)(o.leftPad(t-1)),11,di))],64))),64))],512)])])]),_:3},16,[`show`])}var pi=V({components:{DitoTrigger:Jr,DitoInput:H,DitoIcon:Qr},emits:[`update:modelValue`,`update:show`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placement:{type:String,default:`bottom-left`},placeholder:{type:String,default:null},show:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},target:{type:[String,HTMLElement],default:`trigger`},locale:{type:String,default:`en-US`},format:{type:Object,default:()=>({time:r.defaultFormats.time,date:!1})},disabledHour:{type:Function,default:()=>!1},disabledMinute:{type:Function,default:()=>!1},disabledSecond:{type:Function,default:()=>!1}},data(){return{currentValue:this.modelValue,showPopup:this.show,inputFocused:!1,ignoreNextChange:!1}},computed:{focused(){return this.inputFocused||this.showPopup},input(){return Gr(this)?.querySelector(`input`)},formatOptions(){return{locale:this.locale,...this.format}},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=mr(e,this.formatOptions);t&&(this.currentValue=t)}},currentDate(){return this.currentValue||pr(new Date,{hour:0,minute:0,second:0,millisecond:0})},hour:{get(){return this.currentDate.getHours()},set(e){this.setTime({hour:e})}},minute:{get(){return this.currentDate.getMinutes()},set(e){this.setTime({minute:e})}},second:{get(){return this.currentDate.getSeconds()},set(e){this.setTime({second:e})}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e,this.scrollAll(!0))},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e),this.scrollAll(!0))},currentText(){let{input:e}=this,t=$r(e);this.focused&&!this.ignoreNextChange&&t.start===t.end&&this.$nextTick(()=>U(e,t)),this.ignoreNextChange=!1},show(e){this.showPopup=e},showPopup(e,t){e&&this.scrollAll(!1),e^t&&this.$emit(`update:show`,e)},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{leftPad(e){return(`0`+e).slice(-2)},setTime(e){this.currentValue=pr(this.currentDate,{...e,millisecond:0})},scrollAll(e){let t=(t,n)=>{let r=this.$refs[t];if(r){let t=r.scrollHeight/(r.childElementCount+6),i=Math.round(n*t),a=Math.abs(r.scrollTop-i);r.scrollTo({top:i,behavior:e&&a<100?`smooth`:`auto`})}};this.$nextTick(()=>{t(`hour`,this.hour),t(`minute`,this.minute),t(`second`,this.second)})},onFocus(e){this.inputFocused=e,this.showPopup=e},onKeyDown(e){if(e.key===`Escape`){this.showPopup=!1,e.preventDefault();return}let{input:t}=this,n=$r(t),{ver:i,enter:a}=Wr(e);if(i||a){e.preventDefault();let r=e=>hr(this.currentText,e,this.formatOptions);if(i){if(!this.showPopup)this.showPopup=!0;else{let{name:e,start:a}=r(n.start)||{};if(e){let n=this[e]+i,o=this.$refs[e].childElementCount;this[e]=n<0?n+o:n>=o?n-o:n,this.ignoreNextChange=!0,this.$nextTick(()=>U(t,r(a)))}}}else a&&(this.showPopup=!1)}else if(n.start===n.end){let{value:i}=t,a=n.start,o=e=>!isNaN(Number(e));if(e.key.length===1){if(o(e.key)&&a<i.length)i[a]===`:`&&o(i[a-1])&&o(i[a-2])&&a++,o(i[a])&&(o(i[a+1])||o(i[a-1]))&&(t.value=i.slice(0,a)+i.slice(a+1),U(t,{start:a,end:a}));else{let a=(0,r.format)(this.currentValue,this.formatOptions).length;i.length===a?e.preventDefault():i.length>a&&(t.value=i.slice(0,a),U(t,n),e.preventDefault())}}else e.key===`Backspace`&&(a===1||[` `,`:`].includes(i[a-2]))&&(a===i.length||i[a]===`:`?(a--,t.value=i.slice(0,a)+((i[a-1]??``)+`00`)+i.slice(a+1),U(t,{start:a,end:a})):o(i[a])&&!o(+i[a+1])&&(t.value=i.slice(0,a)+`0`+i.slice(a),U(t,{start:a,end:a})))}},onMouseDown(e){this.showPopup=!this.disabled&&(!e||!this.showPopup),this.showPopup&&this.focus()},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,fi]]),mi={class:`dito-date-time-picker`,ref:`picker`};function hi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`DitoDatePicker`),u=(0,e.resolveComponent)(`DitoTimePicker`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,mi,[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`dito-date-time-picker__inner`,{"dito-date-time-picker__inner--focus":o.focused}])},[(0,e.createVNode)(c,(0,e.mergeProps)({class:`dito-date-time-picker__input`,ref:`input`,modelValue:o.currentText,"onUpdate:modelValue":n[1]||=e=>o.currentText=e,type:`text`},{placeholder:r.placeholder,disabled:r.disabled,focused:o.focused,...t.$attrs},{onFocus:n[2]||=e=>o.onFocus(!0),onBlur:n[3]||=e=>o.onFocus(!1),onKeydown:o.onKeyDown,onMousedown:n[4]||=(0,e.withModifiers)(e=>o.onMouseDown(!1),[`stop`])}),{prefix:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`prefix`)]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{name:`calendar`,disabled:r.disabled,onMousedown:n[0]||=(0,e.withModifiers)(e=>o.onMouseDown(!0),[`prevent`])},null,8,[`disabled`]),(0,e.renderSlot)(t.$slots,`suffix`)]),_:3},16,[`modelValue`,`onKeydown`]),(0,e.createVNode)(l,(0,e.mergeProps)({ref:`date`,modelValue:a.currentValue,"onUpdate:modelValue":n[5]||=e=>a.currentValue=e,show:a.showDate,"onUpdate:show":n[6]||=e=>a.showDate=e,placement:`bottom-left`,target:t.$refs.picker},o.attributes),{trigger:(0,e.withCtx)(()=>[...n[9]||=[]]),_:1},16,[`modelValue`,`show`,`target`]),(0,e.createVNode)(u,(0,e.mergeProps)({ref:`time`,modelValue:a.currentValue,"onUpdate:modelValue":n[7]||=e=>a.currentValue=e,show:a.showTime,"onUpdate:show":n[8]||=e=>a.showTime=e,placement:`bottom-right`,target:t.$refs.picker},o.attributes),{trigger:(0,e.withCtx)(()=>[...n[10]||=[]]),_:1},16,[`modelValue`,`show`,`target`])],2)],512)}var gi=V({components:{DitoInput:H,DitoDatePicker:ti,DitoTimePicker:pi,DitoIcon:Qr},emits:[`update:modelValue`,`change`,`focus`,`blur`],inheritAttrs:!1,props:{modelValue:{type:Date,default:null},transition:{type:String,default:`slide`},placeholder:{type:String,default:null},disabled:{type:Boolean,default:!1},locale:{type:String,default:`en-US`},format:{type:Object,default:null}},data(){return{currentValue:this.modelValue,showDate:!1,showTime:!1,inputFocused:!1,dateFocused:!1,timeFocused:!1,closedMode:null}},computed:{attributes(){let{transition:e,disabled:t,locale:n,formatOptions:r}=this;return{transition:e,disabled:t,locale:n,format:r}},focused(){return this.inputFocused||this.showDate||this.showTime},input(){return this.$refs.input.input},formatOptions(){return(0,r.assignDeeply)({locale:this.locale,time:r.defaultFormats.time,date:r.defaultFormats.date},{date:{month:`short`,format:(e,t,n)=>t===`literal`&&/\bat\b/.test(e)?`, `:this.format?.date?.format?.(e,t,n)??e}},this.format)},timeIndex(){let e=this.currentText;if(e){let t=e.match(/([\S]+\s*)$/)?.[1];if(t)return e.length-t.length}return null},currentText:{get(){return(0,r.format)(this.currentValue,this.formatOptions)||``},set(e){let t=mr(e,this.formatOptions);if(t){let e=$r(this.input);this.currentValue=t,this.$nextTick(()=>U(this.input,e))}}}},watch:{modelValue(e,t){+e!=+t&&(this.currentValue=e)},currentValue(e){+e!=+this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))},focused(e,t){e^t&&this.$emit(e?`focus`:`blur`)}},methods:{onFocus(e){this.inputFocused=e,e?this.updatePopups():(this.showDate=!1,this.showTime=!1)},onMouseDown(e){e&&(this.showDate||this.showTime)?(this.showDate=!1,this.showTime=!1):this.disabled||(this.focus(),requestAnimationFrame(()=>this.updatePopups()))},onKeyDown(e){let t=this.getMode(e);this.$refs[t].onKeyDown(e),e.defaultPrevented?this.closedMode=t:t!==this.closedMode&&this.updatePopups(t)},getMode(e=null){let{start:t}=$r(this.input),{hor:n}=Wr(e);return this.timeIndex===null||t+n<this.timeIndex?`date`:`time`},updatePopups(e=this.getMode()){e&&(this.closedMode=null),this.showDate=e===`date`,this.showTime=e===`time`},focus(){this.input.focus()},blur(){this.input.blur()}}},[[`render`,hi]]),_i={class:`dito-pagination`,"aria-label":`Pagination`},vi={key:0,class:`dito-pagination-total`},yi={key:1,class:`dito-buttons dito-buttons--round`},bi=[`disabled`,`aria-label`,`aria-current`,`onClick`],xi={key:0};function Si(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,_i,[r.showTotal?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,vi,[r.total>0?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)((0,e.toDisplayString)(o.first)+` – `+(0,e.toDisplayString)(o.last)+` / `+(0,e.toDisplayString)(r.total),1)],64)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),o.numPages>1?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,yi,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(o.buttons,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{class:(0,e.normalizeClass)([`dito-button`,o.getButtonClasses(t)]),disabled:t.disabled,"aria-label":o.getButtonLabel(t),"aria-current":t.active?`page`:null,onClick:e=>o.onClickButton(t)},[t.text?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,xi,(0,e.toDisplayString)(t.text),1)):(0,e.createCommentVNode)(``,!0)],10,bi))),256))])):(0,e.createCommentVNode)(``,!0)])}var Ci=V({emits:[`update:page`],props:{total:{type:Number,default:0},page:{type:Number,default:1},pageSize:{type:Number,default:10},showTotal:{type:Boolean,default:!0}},data(){return{showPrev:!0,showNext:!0,currentPage:this.page}},computed:{first(){return(this.currentPage-1)*this.pageSize+1},last(){return Math.min(this.first+this.pageSize-1,this.total)},numPages(){return Math.ceil(this.total/this.pageSize)},buttons(){let{showPrev:e,showNext:t,currentPage:n,numPages:r}=this,i=e+t+1,a=1,o;r<=i?o=r:n<=e+1?o=i:n>=r-t?(o=r,a=r-i+1):(a=n-e,o=n+t);let s=[];s.push({index:n-1,type:`prev`,disabled:n<=1}),a>=2&&s.push({index:1,text:1}),a>2&&s.push({index:Math.max(1,n-10),type:`ellipsis-prev`});for(let e=a;e<=o;e++)s.push({index:e,text:e,active:e===n});return o<r-1&&s.push({index:Math.min(r,n+10),type:`ellipsis-next`}),o<=r-1&&s.push({index:r,text:r}),s.push({index:n+1,type:`next`,disabled:n>=r}),s}},watch:{page(e){this.currentPage=e},pageSize(){this.currentPage>this.numPages&&(this.currentPage=this.numPages)},currentPage(e,t){e!==t&&this.$emit(`update:page`,e)}},created(){this.currentPage=this.page},methods:{getButtonClasses(e){let t=`dito-button`;return{[`${t}--${e.type}`]:e.type,[`${t}--active`]:e.active}},getButtonLabel(e){return e.type===`prev`?`Previous page`:e.type===`next`?`Next page`:e.text?`Page ${e.text}`:null},onClickButton(e){e.index&&!e.disabled&&e.index!==this.currentPage&&(this.currentPage=e.index)}}},[[`render`,Si]]),wi={class:`dito-switch__pane`},Ti=[`id`,`aria-checked`,`name`,`disabled`],Ei={key:0,class:`dito-switch__label`};function Di(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-switch`,o.classes]),style:(0,e.normalizeStyle)(o.styles)},[(0,e.createElementVNode)(`div`,wi,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:r.id,ref:`input`},o.attributes,{"onUpdate:modelValue":n[0]||=e=>a.checked=e,role:`switch`,type:`checkbox`,"aria-checked":a.checked,name:r.name,disabled:r.disabled}),null,16,Ti),[[e.vModelCheckbox,a.checked]]),n[1]||=(0,e.createElementVNode)(`div`,{class:`dito-switch__button`},null,-1),r.labels?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,Ei,[a.checked?(0,e.renderSlot)(t.$slots,`checked`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(r.labels.checked||`on`),1)],void 0,0):(0,e.renderSlot)(t.$slots,`unchecked`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(r.labels.unchecked||`off`),1)],void 0,1)])):(0,e.createCommentVNode)(``,!0)])],6)}var Oi=V({emits:[`update:modelValue`,`change`],inheritAttrs:!1,props:{modelValue:{type:Boolean,default:!1},id:{type:String,default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},labels:{type:[Object,Boolean],default:!1}},data(){return{checked:this.modelValue}},computed:{classes(){let e=`dito-switch`;return[this.$attrs.class,{[`${e}--checked`]:this.checked,[`${e}--disabled`]:this.disabled}]},styles(){let{labels:{checked:e,unchecked:t}={}}=this,n=Math.max(0,e?.length,t?.length);return{"--switch-width":n?`${n*1.5}rem`:null}},attributes(){let{class:e,...t}=this.$attrs;return t}},watch:{modelValue(e){this.checked=e},checked(e){e!==this.modelValue&&(this.$emit(`update:modelValue`,e),this.$emit(`change`,e))}},methods:{focus(){this.$refs.input.focus()}}},[[`render`,Di]]);function ki({enabled:t},{slots:n}){return t?(0,e.h)(e.Transition,Ni,n):n.default()}ki.props={enabled:{type:Boolean,default:!0}};var Ai=ki,W=(e,t)=>Object.assign(e.style,t),ji=e=>setTimeout(e,0),Mi=e=>getComputedStyle(e).height,Ni={name:`dito-height`,onAfterEnter(e){ji(()=>W(e,{height:null}))},onEnter(e){let{width:t}=getComputedStyle(e);W(e,{width:t,position:`absolute`,visibility:`hidden`,height:`auto`}),ji(()=>{let{height:t}=getComputedStyle(e);W(e,{width:null,position:null,visibility:null,height:0}),Mi(e),ji(()=>W(e,{height:t}))})},onLeave(e){let{height:t}=getComputedStyle(e);W(e,{height:t}),Mi(e),ji(()=>W(e,{height:0}))}},G={data(){return{domHandlers:[]}},unmounted(){for(let{remove:e}of this.domHandlers)e();this.domHandlers=[]},methods:{domOn(e,t,n){let i=Vr(e,(0,r.isObject)(t)?t:{[t]:n});return this.domHandlers.push(i),i}}},Pi=class{hasRole(...e){if(this.roles){for(let t of e)if(this.roles.includes(t))return!0}return!1}},Fi={provide(){return{$schemaParentComponent:()=>this}},data(){return{schemaComponents:[]}},computed:{mainSchemaComponent(){return this.schemaComponents[0]}},methods:{_registerSchemaComponent(e,t){let{schemaComponents:n}=this;t?n.push(e):n.splice(n.indexOf(e),1)}}},Ii={mixins:[Fi],computed:{errors(){return this.schemaComponents.flatMap(({errors:e})=>e||[])},isTouched(){return this.schemaComponents.some(e=>e.isTouched)},isDirty(){return this.schemaComponents.some(e=>e.isDirty)},isValid(){return this.schemaComponents.every(e=>e.isValid)},isValidated(){return this.schemaComponents.every(e=>e.isValid)}},methods:{validateAll(e,t=!0){return this.schemaComponents.every(n=>n.validateAll(e,t))},verifyAll(e){return this.schemaComponents.every(t=>t.verifyAll(e))},resetValidation(){this.schemaComponents.forEach(e=>e.resetValidation())},clearErrors(){this.schemaComponents.forEach(e=>e.clearErrors())},async showValidationErrors(e,t,n=!0){for(let r of this.schemaComponents)await r.showValidationErrors(e,t,n)&&(n=!1);return!n}}},Li={mixins:[Ii],provide(){return{$routeComponent:()=>this}},data(){return{reload:!1,routeRecord:null,store:{},loadCache:{}}},computed:{routeComponent(){return this},routeLevel(){let e=0,t=this;for(;t=t.parentRouteComponent;)e++;return e},matchedRouteRecord(){return this.$route.matched[this.routeLevel]},isLeavingRoute(){return this.matchedRouteRecord?.path!==this.routeRecord?.path},isLastRoute(){let{matched:e}=this.$route;return this.routeRecord===e[e.length-1]},isLastUnnestedRoute(){let{matched:e}=this.$route;for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n.meta.nested)return this.routeRecord===n}return!1},isNestedRoute(){return this.meta.nested},isForm(){return!1},isView(){return!1},meta(){return this.routeRecord?.meta},path(){return this.getRoutePath(this.routeRecord?.path)},label(){return this.getLabel(this.schema)},breadcrumb(){let{breadcrumb:e}=this.schema||{};return e||`${this.breadcrumbPrefix} ${this.label}`},breadcrumbPrefix(){return``},param(){return this.$route.params[this.meta?.param]||null},isMutating(){return!1}},watch:{matchedRouteRecord:{immediate:!0,flush:`sync`,handler(t){t&&(!this.routeRecord||t.path===this.routeRecord.path)&&(this.routeRecord=(0,e.markRaw)(t))}}},beforeRouteUpdate(e,t){return this?.beforeRouteChange(e,t)},beforeRouteLeave(e,t){return this?.beforeRouteChange(e,t)},created(){this.appState.routeComponents.push(this)},unmounted(){let{routeComponents:e}=this.appState;e.splice(e.indexOf(this),1)},methods:{beforeRouteChange(e,t){let n=!0;return t.path.startsWith(this.path)&&!e.path.startsWith(this.path)&&t.path!==e.path&&(this.isFullRouteChange(e,t)||e.path.length<=t.path.length)&&(this.isMutating?n=this.isValidated||this.validateAll():this.isDirty&&(n=window.confirm(`You have unsaved changes. Do you really want to ${this.verbs.cancel}?`))),n},getRoutePath(e){let{path:t}=this.$route;return e?t.split(`/`).slice(0,e.split(`/`).length).join(`/`):t},getChildPath(e){return`${this.path}/${e}`},isFullRouteChange(e,t){let n=this.path.match(/^(\/[^/]*)/)[1];return!(0,r.getCommonPrefix)(e.path,t.path).startsWith(n)}}},Ri=class{currentPromiseOrLoader=null;currentLoadPromise=null;lastFinishedLoad=(0,e.shallowRef)({promiseOrLoader:null,value:void 0,error:null});constructor(t,{createContext:n,onLoadStart:i=null}){this.dataSchema=(0,r.isObject)(t)?t:{data:t},this.createContext=n,this.onLoadStart=i,this.valueOrPromiseOrLoader=(0,e.computed)(()=>this.getValueOrPromiseOrLoader()),this.valueOrUndefinedWhileLoading=(0,e.computed)(()=>this.getValueOrStartLoad())}get value(){return this.valueOrUndefinedWhileLoading.value}get isLoading(){if(this.value!==void 0)return!1;let e=this.valueOrPromiseOrLoader.value;return zi(e)&&this.lastFinishedLoad.value.promiseOrLoader!==e}async waitForValue(){for(;this.isLoading;)await this.currentLoadPromise;return this.value}get lastLoadError(){let{promiseOrLoader:e,error:t}=this.lastFinishedLoad.value;return e===this.valueOrPromiseOrLoader.value?t:null}getValueOrPromiseOrLoader(){let{data:e,dataPath:t}=this.dataSchema;if(e!==void 0)return(0,r.isFunction)(e)?e(this.createContext()):e;if(t){let e=this.createContext();return(0,r.getValueAtDataPath)(e.rootItem,(0,r.normalizeDataPath)(`${e.dataPath}/${t}`),()=>void 0)}}getValueOrStartLoad(){let e=this.valueOrPromiseOrLoader.value;if(!zi(e))return e;let{promiseOrLoader:t,value:n}=this.lastFinishedLoad.value;if(t===e)return n;this.currentPromiseOrLoader!==e&&this.startLoad(e)}startLoad(e){this.currentPromiseOrLoader=e;let t=this.createContext(),n=(t,n=null)=>{this.currentPromiseOrLoader===e&&(this.lastFinishedLoad.value={promiseOrLoader:e,value:t,error:n})},i=Promise.resolve().then(()=>(0,r.isFunction)(e)?e(t):e).then(e=>n(e)).catch(e=>{console.error(e),n(void 0,e)});this.currentLoadPromise=i,this.onLoadStart?.(i)}};function zi(e){return(0,r.isFunction)(e)||(0,r.isPromise)(e)}var Bi=class{computedValueRecords=new Map;optionsRecords=new Map;pendingLoads=new Set;processedDataSnapshot=(0,e.shallowRef)(null);derivedValueDataPaths=null;constructor({component:t,getSchema:n,getData:r,getSourceSchema:i=null}){this.component=t,this.getSchema=n,this.getData=r,this.getSourceSchema=i,this.rootScope=(0,e.effectScope)(!0),this.rootScope.run(()=>{(0,e.watch)([n,r],([e,t])=>this.initializeData(e,t),K),this.dataEntries=(0,e.computed)(()=>this.getDataEntries()),(0,e.watch)(()=>this.dataEntries.value.computedValueEntries,e=>this.updateComputedValueRecords(e),K),(0,e.watch)(()=>this.dataEntries.value.entriesWithMissingValues,e=>this.setDefaultValues(e),K),i&&(0,e.watch)(r,()=>this.takeProcessedDataSnapshot().catch(console.error),K)})}get dataPath(){return this.component.dataPath??``}get componentPath(){return this.component.componentPath??``}get rootData(){return this.component.rootData??this.getData()}get isDirty(){let e=this.processedDataSnapshot.value,t=this.getData();if(!t||e?.data!==t)return!1;let n=this.getProcessedDataForDirtyCheck(),i=this.derivedValueDataPaths?Vi(e.processedData,n,this.derivedValueDataPaths):e.processedData;return!(0,r.equals)(n,i)}stop(){this.rootScope.stop(),this.computedValueRecords.clear(),this.optionsRecords.clear(),this.pendingLoads.clear()}async waitForPendingLoads(){for(;this.pendingLoads.size>0;)await Promise.all(this.pendingLoads),await(0,e.nextTick)()}async takeProcessedDataSnapshot(){let t=this.getData(),n=t?new Set:null;if(this.derivedValueDataPaths=n,this.processedDataSnapshot.value=t?{data:t,processedData:(0,r.clone)(this.getProcessedDataForDirtyCheck())}:null,!t)return;await(0,e.nextTick)(),await this.waitForPendingLoads();let i=this.derivedValueDataPaths!==n,a=!this.rootScope.active;if(i||a)return;this.derivedValueDataPaths=null;let o=this.processedDataSnapshot.value;o?.data===this.getData()&&(this.processedDataSnapshot.value={data:t,processedData:Vi(o.processedData,this.getProcessedDataForDirtyCheck(),n)})}getProcessedDataForDirtyCheck(){let e=this.getSchema(),t=this.getData();return t&&!Ht(e)?an(e,this.getSourceSchema(),t,this.dataPath,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,schemaOnly:!0,target:`clipboard`,shouldCallProcess:!1}):null}async applyCleanChanges(t){let n=this.getData(),i=this.processedDataSnapshot.value?.data===n,a=i?(0,r.clone)(this.getProcessedDataForDirtyCheck()):null;if(t(),i){await(0,e.nextTick)(),await this.waitForPendingLoads();let t=this.processedDataSnapshot.value;t?.data===n&&this.rootScope.active&&(this.processedDataSnapshot.value={data:n,processedData:Hi(t.processedData,a,this.getProcessedDataForDirtyCheck())})}}trackPendingLoad(e){this.pendingLoads.add(e),e.finally(()=>this.pendingLoads.delete(e))}initializeData(e,t){t&&!Ht(e)&&en(e,t,this.component,{dataPath:this.dataPath,rootData:this.rootData,shouldSkipSourcesWithResource:!0,shouldSetDefaultsOfComponentsWithCompute:!1})}getDataEntries(){let e=this.getSchema(),t=this.getData(),n=new Map,r=[];return t&&!Ht(e)&&N(e,t,{dataPath:this.dataPath,componentPath:this.componentPath,shouldProcess:e=>this.isEntryShown(e),shouldSkipSourcesWithResource:!0,before:e=>{Gi(e.schema)&&n.set(e.componentPath,e),this.shouldSetDefaultValue(e)&&r.push(e)},options:{component:this.component,rootData:this.rootData}}),{computedValueEntries:n,entriesWithMissingValues:r}}isEntryShown(e){return e.schema.if===void 0||j(`if`,{type:Boolean,schema:e.schema,context:this.createEntryContext(e),default:!0})}shouldSetDefaultValue(e){let{schema:t,data:n,name:r}=e;return $t(t,n,r,()=>this.createEntryContext(e),{shouldSetDefaultsOfComponentsWithCompute:!1})}setDefaultValues(e){for(let t of e)if(this.shouldSetDefaultValue(t)){let{schema:e,data:n,name:r}=t;n[r]=qt(e,()=>this.createEntryContext(t))}}updateComputedValueRecords(e){let t=this.computedValueRecords;this.computedValueRecords=new Map;for(let[n,r]of e){let e=t.get(n);e?.entry.schema===r.schema&&e.entry.data===r.data?t.delete(n):e={entry:r,scope:this.createComputedValueScope(r)},this.computedValueRecords.set(n,e)}for(let{scope:e}of t.values())e.stop()}createComputedValueScope(t){let n=this.rootScope.run(()=>(0,e.effectScope)());return n.run(()=>{let n=(0,e.computed)(()=>this.isEntryCurrent(t));if(t.schema.compute&&(0,e.watch)(()=>n.value?this.getComputedValueResult(t):null,e=>{e&&this.writeComputedValue(t,e.value)},K),Zt(t.schema)){let r=this.createDataSchemaResolver(t.schema,t);(0,e.watch)(()=>n.value&&!r.isLoading?{value:r.value}:null,e=>{e&&this.writeComputedValue(t,e.value)},K)}}),n}hasComputedValueEntry(e){return this.dataEntries.value.computedValueEntries.has(e)}isEntryCurrent({componentPath:e,schema:t,data:n}){let r=this.dataEntries.value.computedValueEntries.get(e);return r?.schema===t&&r.data===n}getComputedValueResult(e){let{schema:t,data:n,name:r,dataPath:i}=e;try{return{value:tn(t,n,r,i,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,getOptions:t.options?()=>this.getLoadedOptions(e):null})}}catch(e){if(e===Wi)return null;throw e}}getLoadedOptions(e){let t=this.getOptions(e);if(t===void 0)throw Wi;return t}getOptions(e){return this.getOptionsResolver(e).value}getOptionsResolver(e){let{schema:t,data:n,componentPath:r}=e,i=this.optionsRecords.get(r);return(!i||i.entry.schema.options!==t.options||i.entry.data!==n)&&(i={entry:e,resolver:this.createDataSchemaResolver(t.options,e)},this.optionsRecords.set(r,i)),i.resolver}createDataSchemaResolver(e,t){return new Ri(e,{createContext:()=>this.createEntryContext(t),onLoadStart:e=>this.trackPendingLoad(e)})}writeComputedValue(e,t){let{data:n,name:i}=e;(0,r.equals)(t,n[i])||(this.derivedValueDataPaths?.add(this.getRelativeDataPath(e)),n[i]=t)}getRelativeDataPath({schema:e,name:t,dataPath:n}){return(C(e)?(0,r.parseDataPath)(n):[...(0,r.parseDataPath)(n),t]).slice((0,r.parseDataPath)(this.dataPath).length).join(`/`)}createEntryContext({schema:e,data:t,name:n,dataPath:r}){return E.createForSchema(this.component,{schema:e,name:n,data:t,dataPath:r,rootData:this.rootData})}};function Vi(e,t,n){if(n.size===0)return e;let i=(0,r.clone)(e);for(let e of n){let n=(0,r.parseDataPath)(e),a=n.slice(0,-1),o=n.at(-1),s=(0,r.getValueAtDataPath)(i,a,()=>null);if(s&&typeof s==`object`){let n=(0,r.getValueAtDataPath)(t,e,()=>Ui);n===Ui?delete s[o]:s[o]=(0,r.clone)(n)}}return i}function Hi(e,t,n){if((0,r.equals)(t,n))return e;if(!((0,r.isPlainObject)(t)&&(0,r.isPlainObject)(n)&&(0,r.isPlainObject)(e)||(0,r.isArray)(t)&&(0,r.isArray)(n)&&(0,r.isArray)(e)&&t.length===n.length&&n.length===e.length))return(0,r.clone)(n);let i=(0,r.isArray)(e)?[...e]:{...e};for(let r of new Set([...Object.keys(t),...Object.keys(n)]))r in n?i[r]=Hi(e[r],t[r],n[r]):delete i[r];return i}var Ui=Symbol(`notFound`),K={immediate:!0,flush:`post`},Wi=Symbol(`optionsNotLoaded`);function Gi(e){return!!e.compute||Zt(e)}var Ki=[`data-resource`];function qi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoRouterView`),c=(0,e.resolveComponent)(`DitoSchema`);return t.user&&t.shouldRenderSchema(t.viewSchema)?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[t.isLastRoute?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-view dito-scroll-parent`,"data-resource":t.sourceSchema.path},[((0,e.openBlock)(),(0,e.createBlock)(c,{key:t.name,schema:t.viewSchema,data:t.data,meta:t.meta,store:t.getChildStore(t.name),padding:`root`,disabled:t.isLoading,scrollable:``,single:``},null,8,[`schema`,`data`,`meta`,`store`,`disabled`]))],8,Ki)):((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,routeLevel:t.routeLevel+1},null,8,[`routeLevel`]))],64)):(0,e.createCommentVNode)(``,!0)}var Ji=V(B.component(`DitoView`,{mixins:[Li],provide(){return{$sourceComponent:()=>this.mainComponent?.sourceComponent||null,$resourceComponent:()=>this.mainComponent?.resourceComponent||null,$dataModel:()=>this.ownDataModel}},data(){return{isLoading:!1,data:{}}},computed:{dataModel(){return this.ownDataModel},schema(){return this.meta.schema??{}},name(){return this.schema.name},isView(){return!0},isSingleComponentView(){return ct(this.schema)},mainComponent(){return this.mainSchemaComponent?.getComponentByDataPath(this.name)},viewSchema(){let{component:e,...t}=this.schema;return this.isSingleComponentView?{...t,components:{[t.name]:{name:t.name,label:!1,...e}}}:t},providesData(){return Qe(this.viewSchema,Yn)}},watch:{$route:{flush:`post`,handler(e,t){this.isFullRouteChange(e,t)&&(this.isLoading=!1,this.data={})}}},created(){this.ownDataModel=new Bi({component:this,getSchema:()=>this.viewSchema,getData:()=>this.data})},mounted(){this.shouldRenderSchema(this.viewSchema)||this.$router.replace({path:`/`})},beforeUnmount(){this.ownDataModel.stop()},methods:{setData(e){return this.data=e,this.data},getChildPath(e){return this.isSingleComponentView?this.path:`${this.path}/${e}`},setLoading(e){this.isLoading=!!e}}}),[[`render`,qi]]);function Yi(t,n={}){let r,{immediate:i,...a}=n,l=(0,e.shallowRef)(!1),u=(0,e.shallowRef)(!1),d=e=>r&&r.activate(e),f=e=>r&&r.deactivate(e),p=()=>{r&&(r.pause(),u.value=!0)},m=()=>{r&&(r.unpause(),u.value=!1)},h=(0,e.computed)(()=>{let n=(0,e.toValue)(t);return(0,s.toArray)(n).map(t=>{let n=(0,e.toValue)(t);return typeof n==`string`?n:(0,s.unrefElement)(n)}).filter(o.notNullish)});return(0,e.watch)(h,e=>{if(e.length){if(!r)r=(0,c.createFocusTrap)(e,{...a,onActivate(e){l.value=!0,n.onActivate&&n.onActivate(e)},onDeactivate(e){l.value=!1,n.onDeactivate&&n.onDeactivate(e)}}),i&&d();else{let t=r?.active;r?.updateContainerElements(e),!t&&i&&d()}}},{flush:`post`}),(0,s.tryOnScopeDispose)(()=>f()),{hasFocus:l,isPaused:u,activate:d,deactivate:f,pause:p,unpause:m}}var Xi=(0,e.defineComponent)((t,{slots:n})=>{let r=(0,e.shallowRef)(),i=(0,e.reactive)(Yi(r,t.options));return()=>{if(n.default)return(0,e.h)(t.as||`div`,{ref:r},n.default(i))}},{name:`UseFocusTrap`,props:[`as`,`options`]}),Zi=[`aria-label`];function Qi(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoButtons`),c=(0,e.resolveComponent)(`DitoSchema`),l=(0,e.resolveComponent)(`UseFocusTrap`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-dialog`,ref:`dialog`,role:`dialog`,"aria-label":t.schema.label||`Dialog`,"aria-modal":`true`,style:(0,e.normalizeStyle)({"--width":t.settings.width?`${t.settings.width}px`:null}),onMouseup:n[2]||=(...e)=>t.onMouseUp&&t.onMouseUp(...e)},[(0,e.createVNode)(l,{class:`dito-dialog__focus-trap`,options:t.focusTrapOptions},{default:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`form`,{class:`dito-scroll-parent`,onSubmit:n[0]||=(0,e.withModifiers)((...e)=>t.submit&&t.submit(...e),[`prevent`]),onKeydown:n[1]||=(0,e.withKeys)((...e)=>t.onEnter&&t.onEnter(...e),[`enter`])},[(0,e.withDirectives)((0,e.createElementVNode)(`button`,null,null,512),[[e.vShow,!1]]),(0,e.createVNode)(c,{schema:t.schema,data:t.dialogData,padding:`root`,scrollable:``,generateLabels:``},{buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{class:`dito-buttons--large`,buttons:t.buttonSchemas,data:t.dialogData},null,8,[`buttons`,`data`])]),_:1},8,[`schema`,`data`])],32)]),_:1},8,[`options`])],44,Zi)}var $i=V(B.component(`DitoDialog`,{mixins:[G],components:{UseFocusTrap:Xi},emits:[`remove`],provide(){return{$dialogComponent:()=>this,$dataModel:()=>this.ownDataModel}},props:{components:{type:Object,required:!0},buttons:{type:Object,required:!0},promise:{type:Object,required:!0},data:{type:Object,default:()=>({})},settings:{type:Object,default:()=>({width:480,clickToClose:!1})}},data(){let e=(0,r.clone)(this.data);for(let t in this.components)t in e||(e[t]=null);return{dialogData:e}},computed:{dataModel(){return this.ownDataModel},dialogComponent(){return this},schema(){return{type:`dialog`,components:this.components}},buttonSchemas(){return Object.fromEntries(Object.entries(A(this.buttons)).map(([e,t])=>(e===`cancel`&&!t.events&&(t={...t,events:{click:()=>this.cancel()}}),[e,t])))},focusTrapOptions(){return{immediate:!0,fallbackFocus:()=>this.$refs.dialog,onDeactivate:this.cancel}},hasButtons(){return Object.keys(this.buttonSchemas).length>0},hasCancel(){return!!this.buttonSchemas.cancel}},created(){this.ownDataModel=new Bi({component:this,getSchema:()=>this.schema,getData:()=>this.dialogData})},mounted(){this.domOn(window,{keyup:e=>{(this.hasCancel||!this.hasButtons)&&e.keyCode===27&&this.cancel()}})},beforeUnmount(){this.ownDataModel.stop()},methods:{remove(){this.$emit(`remove`)},resolve(e){this.promise.resolve(e),this.remove()},reject(e){this.promise.reject(e),this.remove()},onEnter(e){e.target instanceof HTMLInputElement&&this.submit()},async submit(){await this.waitForPendingLoadsOf(this.dataModel),this.resolve(this.dialogData)},cancel(){this.resolve(void 0)},close(){this.cancel()},onMouseUp(){this.settings.clickToClose&&this.close()}}}),[[`render`,Qi]]),ea=[`data-agent-browser`,`data-agent-platform`,`data-agent-version`],ta={key:0,class:`dito-drag-overlay`};function na(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoDialog`),c=(0,e.resolveComponent)(`DitoNavigation`),l=(0,e.resolveComponent)(`DitoHeader`),u=(0,e.resolveComponent)(`DitoRouterView`),d=(0,e.resolveComponent)(`DitoAccount`),f=(0,e.resolveComponent)(`DitoSidebar`),p=(0,e.resolveComponent)(`DitoNotifications`),m=(0,e.resolveDirective)(`resize`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-root`,"data-agent-browser":t.appState.agent.browser,"data-agent-platform":t.appState.agent.platform,"data-agent-version":t.appState.agent.versionNumber},[(0,e.createVNode)(e.Transition,{name:`dito-drag`},{default:(0,e.withCtx)(()=>[t.isDraggingFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ta)):(0,e.createCommentVNode)(``,!0)]),_:1}),(0,e.createVNode)(e.TransitionGroup,{name:`dito-dialog`},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.dialogs,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{key:r,components:n.components,buttons:n.buttons,promise:n.promise,data:n.data,settings:n.settings,onRemove:e=>t.removeDialog(r)},null,8,[`components`,`buttons`,`promise`,`data`,`settings`,`onRemove`]))),128))]),_:1}),(0,e.createVNode)(c),(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`main`,{class:(0,e.normalizeClass)([`dito-page dito-scroll-parent`,t.pageClasses])},[(0,e.createVNode)(l,{spinner:t.options.spinner,isLoading:t.isLoading},null,8,[`spinner`,`isLoading`]),(0,e.createVNode)(u,{routeLevel:0})],2)),[[m,t.onResizePage]]),(0,e.createVNode)(f,null,{default:(0,e.withCtx)(()=>[t.user?((0,e.openBlock)(),(0,e.createBlock)(d,{key:0})):t.allowLogin?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,{key:1,class:`dito-login`,onClick:n[0]||=e=>t.rootComponent.login()},[...n[1]||=[(0,e.createElementVNode)(`span`,null,`Login`,-1)]])):(0,e.createCommentVNode)(``,!0)]),_:1}),(0,e.createVNode)(p,{ref:`notifications`},null,512)],8,ea)}var ra=B.component(`DitoRoot`,{mixins:[G],components:{DitoDialog:$i},provide(){return{$views:()=>this.resolvedViews}},props:{unresolvedViews:{type:[Object,Function,Promise],required:!0},options:{type:Object,default:()=>({})}},data(){return{resolvedViews:{},removeRoutes:null,dialogs:{},pageWidth:0,loadingCount:0,allowLogin:!1,isDraggingFiles:!1}},computed:{notifications(){return this.isMounted&&this.$refs.notifications},isLoading(){return this.loadingCount>0},pageClasses(){let e=`dito-page`;return[this.appState.pageClass,{[`${e}--width-80`]:this.pageWidth<=720,[`${e}--width-60`]:this.pageWidth<=540}]}},created(){this.appState.title=document.title||`Dito.js Admin`,this.appState.routeComponents=[]},async mounted(){this.setupDragAndDrop(),(0,i.delegate)(this.$el,{target:`.dito-info`,theme:`info`,animation:`shift-away-subtle`,interactive:!0,delay:250,zIndex:1,appendTo:e=>e.closest(`.dito-pane`),onShow:e=>e.setContent(e.reference.dataset.info)}),this.domOn(document,{click:e=>{e.target.closest(`.dito-label`)||(this.appState.activeLabel=null)},keyup:e=>{e.code===`Tab`&&(this.appState.activeLabel=null)}});try{this.allowLogin=!1,await this.fetchUser()?await this.resolveViews():await this.login()}catch(e){console.error(e)}this.allowLogin=!0},methods:{setupDragAndDrop(){let e=0,t=[],n=e=>{for(let n of t)n.closest(`.dito-container`).classList.toggle(`dito-drop-target`,e);e||(t=[])},r=e=>{this.isDraggingFiles=e,e?n(!0):setTimeout(()=>n(!1),150)};this.domOn(document,{dragenter:n=>{if(!e&&n.dataTransfer){t=document.querySelectorAll(`.dito-upload`);let e=t.length>0;if(n.dataTransfer.effectAllowed=e?`copy`:`none`,e)r(!0);else{n.preventDefault(),n.stopPropagation();return}}e++},dragleave:t=>{e--,!e&&t.dataTransfer&&r(!1)},dragover:e=>{if(e.dataTransfer){let t=e.target.closest(`.dito-container:has(.dito-upload)`);e.dataTransfer.dropEffect=t?`copy`:`none`,t||(e.preventDefault(),e.stopPropagation())}},drop:t=>{e=0,t.dataTransfer&&r(!1)}})},notify({type:e=`info`,title:t,text:n,error:r,duration:i}={}){this.notifications.notify({type:e,title:t,text:n,error:r,duration:i})},closeNotifications(){this.notifications.destroyAll()},registerLoading(e){this.loadingCount+=e?1:-1},showDialog({components:e,buttons:t,data:n,settings:r}){return new Promise(async(i,a)=>{let o=[];if(await L(this.api,{type:`dialog`,components:e},o,0),o.length>0)throw Error(`Dialogs do not support components that produce routes`);let s=`dialog-${++ia}`;this.dialogs[s]={components:e,buttons:t,data:n,settings:r,promise:{resolve:i,reject:a}}})},removeDialog(e){delete this.dialogs[e]},async login(){this.allowLogin=!0;let{additionalComponents:e,redirectAfterLogin:t}=this.options.login||{},n=await this.showDialog({components:{username:{type:`text`,autofocus:!0},password:{type:`password`},...e},buttons:{login:{type:`submit`,text:`Login`},cancel:{type:`button`,text:`Cancel`}}});if(n)try{let e=await this.sendRequest({resource:this.api.users.login,data:n,internal:!0});t?location.replace(t):(this.setUser(e.data.user),await this.resolveViews())}catch(e){let t=e.response?.data?.error||e;this.notify({type:`error`,error:t,title:`Authentication Error`,text:t}),this.login()}},navigateHome(){return this.navigate(`/`)},async logout(){try{(await this.sendRequest({resource:this.api.users.logout,internal:!0})).data.success&&(this.setUser(null),this.navigateHome())}catch(e){console.error(e)}},async fetchUser(){let e=null;try{e=(await this.sendRequest({resource:this.api.users.session,internal:!0})).data.user||null}catch(e){let t=e.response?.data?.error||e;this.notify({type:`error`,error:t,title:`Authentication Error`,text:t})}return this.setUser(e),e},setUser(e){this.appState.user=e&&Object.setPrototypeOf(e,Pi.prototype),e||(this.resolvedViews={},this.navigateHome())},async ensureUser(){await this.fetchUser()||await this.login()},async resolveViews(){try{this.resolvedViews=await Fn(this.unresolvedViews)}catch(e){return e.request||console.error(e),this.login()}let e=await(0,r.mapConcurrently)(Object.entries(this.resolvedViews),([e,t])=>Vn(Ji,this.api,t,e)),{fullPath:t}=this.$route;this.removeRoutes?.(),this.removeRoutes=aa(this.$router,[{name:`root`,path:`/`,components:{}},...e.flat()]),this.$router.replace(t)},onResizePage({contentRect:{width:e}}){this.pageWidth=e}}}),ia=0;function aa(e,t){let n=[];for(let r of t)n.push(e.addRoute(r));return()=>{for(let e of n)e()}}var oa=V(ra,[[`render`,na]]),sa={class:`dito-menu__item`},ca=[`href`,`aria-current`,`onClick`];function la(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoMenu`,!0),c=(0,e.resolveDirective)(`resize`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:`dito-menu`,style:(0,e.normalizeStyle)({"--width":t.width?`${t.width}px`:null})},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.items,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,sa,[t.shouldShowItem(n)?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-menu__link`,{"dito-menu__link--active":t.isActiveItem(n)}]),href:t.getItemHref(n),"aria-current":t.isActiveItem(n)?`page`:null,onClick:(0,e.withModifiers)(e=>t.onClickItem(n),[`prevent`,`stop`])},(0,e.toDisplayString)(t.getLabel(n)),11,ca),n.items?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,class:`dito-menu__sub`,items:n.items,path:t.getItemPath(n,!1)},null,8,[`items`,`path`])):(0,e.createCommentVNode)(``,!0)],64)):(0,e.createCommentVNode)(``,!0)]))),256))],4)),[[c,t.onResize]])}var ua=V(B.component(`DitoMenu`,{props:{items:{type:[Object,Array],default:()=>[]},path:{type:String,default:``}},data(){return{width:0}},methods:{shouldShowItem(e){return this.shouldRenderSchema(e)&&(!e.items||Object.values(e.items).some(this.shouldRenderSchema))},onResize({contentRect:{width:e}}){e&&(this.width=e)},getItemPath(e,t){let n=e.path?`${this.path}/${e.path}`:null;return t&&n&&e.items?`${n}${this.getItemPath(Object.values(e.items)[0],!1)}`:n},getItemHref(e){let t=this.getItemPath(e,!0);return t?this.$router.resolve(t).href:null},isActiveItem(e){return this.$route.path.startsWith(this.getItemPath(e,!1))||e.items&&Object.values(e.items).some(this.isActiveItem)},onClickItem(e){let t=this.getItemPath(e,!0);t&&this.$router.push({path:t,force:!0})}}}),[[`render`,la]]),da={class:`dito-trail`,"aria-label":`Breadcrumb`},fa=[`aria-current`,`href`,`onClick`];function pa(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,da,[(0,e.createElementVNode)(`ul`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.trail,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-trail__link`,{"dito-trail__link--active":n.path===t.$route.path}]),"aria-current":n.path===t.$route.path?`page`:null,href:t.getComponentHref(n),onClick:(0,e.withModifiers)(e=>t.onClickComponent(n),[`prevent`,`stop`])},[(0,e.createElementVNode)(`span`,{class:(0,e.normalizeClass)([`dito-trail__text`,{"dito-trail__text--dirty":n.isDirty}])},(0,e.toDisplayString)(n.breadcrumb),3)],10,fa)]))),256))]),(0,e.renderSlot)(t.$slots,`default`)])}var ma=V(B.component(`DitoTrail`,{computed:{trail(){return this.appState.routeComponents.filter(e=>!e.isLeavingRoute)}},methods:{getComponentRoutePath(e){let{schema:t}=e;return t.type===`menu`?Object.values(t.items)[0].fullPath:e.path},getComponentHref(e){return this.$router.resolve(this.getComponentRoutePath(e)).href},onClickComponent(e){this.$router.push({path:this.getComponentRoutePath(e),force:!0})}}}),[[`render`,pa]]),ha=[`aria-busy`];function ga(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSpinner`),c=(0,e.resolveComponent)(`DitoTrail`);return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,{class:`dito-header`,"aria-busy":t.isLoading},[(0,e.createVNode)(c,null,{default:(0,e.withCtx)(()=>[t.isLoading?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,size:t.spinner?.size,color:t.spinner?.color},null,8,[`size`,`color`])):(0,e.createCommentVNode)(``,!0)]),_:1}),n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-header__teleport`},null,-1),(0,e.renderSlot)(t.$slots,`default`)],8,ha)}var _a=V(B.component(`DitoHeader`,{props:{spinner:{type:Object,default:null},isLoading:{type:Boolean,default:!1}}}),[[`render`,ga]]),va={class:`dito-navigation dito-scroll-parent`,"aria-label":`Main navigation`};function ya(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`),c=(0,e.resolveComponent)(`DitoMenu`);return(0,e.openBlock)(),(0,e.createElementBlock)(`nav`,va,[(0,e.createElementVNode)(`h1`,null,[(0,e.createVNode)(s,{class:`dito-link`,to:`/`},{default:(0,e.withCtx)(()=>[(0,e.createTextVNode)((0,e.toDisplayString)(t.appState.title),1)]),_:1})]),(0,e.createVNode)(c,{class:`dito-scroll`,items:t.views},null,8,[`items`])])}var ba=V(B.component(`DitoNavigation`,{}),[[`render`,ya]]),xa={class:`dito-notifications`,"aria-live":`polite`},Sa={class:`dito-notifications__inner`};function Ca(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`VueNotifications`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,xa,[n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-header`},[(0,e.createElementVNode)(`span`)],-1),(0,e.createElementVNode)(`div`,Sa,[(0,e.createVNode)(s,{ref:`notifications`,classes:`dito-notification`,dangerouslySetInnerHtml:!0,position:``,width:``},null,512)])])}var wa=V(B.component(`DitoNotifications`,{notifications(){return this.isMounted&&this.$refs.notifications},methods:{notify({type:e=`info`,title:t,text:n,error:i,duration:a}={}){t||={warning:`Warning`,error:`Error`,info:`Information`,success:`Success`}[e]||`Notification`,n=`<p>${(0,r.asArray)(n).join(`</p> <p>`)}</p>`.replace(/\n|\r\n|\r/g,`<br>`);let o={warning:`warn`,error:`error`,info:`log`,success:`log`}[e]||`error`;console[o]((0,r.stripHtml)(n),...e===`error`&&i?[i]:[]);let{notifications:s=!0}=this.api;if(s){let{durationFactor:r=20}=s;a??=(40+n.length+t.length)*r,this.$notify({type:e,title:t,text:n,duration:a===0?-1:a})}},destroyAll(){this.notifications.destroyAll()}}}),[[`render`,Ca]]),Ta={class:`dito-header`};function Ea(t,n,r,i,a,o){let s=(0,e.resolveDirective)(`resize`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`aside`,{class:(0,e.normalizeClass)([`dito-sidebar dito-scroll-parent`,t.classes])},[(0,e.createElementVNode)(`nav`,Ta,[(0,e.renderSlot)(t.$slots,`default`)]),n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-sidebar__teleport dito-scroll`},null,-1)],2)),[[s,t.onResizeSidebar]])}var Da=V(B.component(`DitoSidebar`,{data(){return{sidebarWidth:0}},computed:{classes(){let e=`dito-sidebar`;return{[`${e}--width-99`]:this.sidebarWidth<360,[`${e}--width-60`]:this.sidebarWidth<=216}}},methods:{onResizeSidebar({contentRect:{width:e}}){this.sidebarWidth=e}}}),[[`render`,Ea]]),Oa={mixins:[G],data(){return{pulldown:{open:!1,startTime:0,checkTime:!0,events:{mousedown:()=>{this.setPulldownOpen(!1),this.pulldown.handlers.remove()},mouseup:()=>{this.onPulldownMouseUp()&&this.pulldown.handlers.remove()}},handlers:null}}},computed:{pulldownTriggerAttributes(){return{"aria-haspopup":`menu`,"aria-expanded":this.pulldown.open}}},methods:{onPulldownMouseDown(e=null){e===null?(this.setPulldownOpen(!0),this.checkTime=!0):this.checkTime=!1},onPulldownMouseUp(e=null){let{startTime:t}=this.pulldown;if(!this.checkTime||t&&Date.now()-t>250)return this.setPulldownOpen(!1),e!==null&&this.onPulldownSelect(e),!0},onPulldownSelect(){},setPulldownOpen(e){this.pulldown.open=e,this.pulldown.startTime=e?Date.now():0,e&&(this.pulldown.handlers=this.domOn(document,this.pulldown.events))}}},ka={class:`dito-account`},Aa=[`onMousedown`,`onMouseup`];function ja(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,ka,[(0,e.createElementVNode)(`a`,(0,e.mergeProps)({role:`button`},t.pulldownTriggerAttributes,{onMousedown:n[0]||=(0,e.withModifiers)(e=>t.onPulldownMouseDown(),[`stop`])}),[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.user.username),1)],16),(0,e.createElementVNode)(`ul`,{class:(0,e.normalizeClass)([`dito-pulldown`,{"dito-pulldown--open":t.pulldown.open}]),role:`menu`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.items,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:`dito-pulldown__item`,role:`menuitem`,onMousedown:(0,e.withModifiers)(e=>t.onPulldownMouseDown(r),[`stop`]),onMouseup:e=>t.onPulldownMouseUp(r)},(0,e.toDisplayString)(n),41,Aa)]))),256))],2)])}var Ma=V(B.component(`DitoAccount`,{mixins:[Oa],data(){return{items:{settings:`Settings`,logout:`Logout`}}},methods:{onPulldownSelect(e){switch(e){case`logout`:this.rootComponent.logout();break;case`settings`:console.info(`TODO: Implement Settings`)}}}}),[[`render`,ja]]);function Na(t,n,r,i,a,o){return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-spinner`,role:`status`,"aria-label":`Loading`,style:(0,e.normalizeStyle)({"--color":t.color,"--size":t.size,"--margin":t.margin})},[...n[0]||=[(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse1`},null,-1),(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse2`},null,-1),(0,e.createElementVNode)(`div`,{class:`dito-spinner__pulse dito-spinner__pulse3`},null,-1)]],4)),[[e.vShow,t.loading]])}var Pa=V(B.component(`DitoSpinner`,{props:{loading:{type:Boolean,default:!0},color:{type:String,default:null},size:{type:String,default:null},margin:{type:String,default:null}}}),[[`render`,Na]]);function Fa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSpinner`),c=(0,e.resolveComponent)(`DitoIcon`);return t.item.type===`text`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.as||`div`),{key:0},{default:(0,e.withCtx)(()=>[(0,e.createTextVNode)((0,e.toDisplayString)(t.item.text),1)]),_:1})):t.item.type===`html`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.as||`div`),{key:1,innerHTML:t.item.html},null,8,[`innerHTML`])):t.item.type===`spinner`?((0,e.openBlock)(),(0,e.createBlock)(s,{key:2,size:t.item.size,color:t.item.color},null,8,[`size`,`color`])):t.item.type===`icon`?((0,e.openBlock)(),(0,e.createBlock)(c,{key:3,name:t.item.name,disabled:t.item.disabled},null,8,[`name`,`disabled`])):t.item.type===`component`?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.item.component),(0,e.normalizeProps)((0,e.mergeProps)({key:4},t.item.props)),null,16)):(0,e.createCommentVNode)(``,!0)}var Ia=V(B.component(`DitoAffix`,{components:{DitoSpinner:Pa,DitoIcon:Qr},props:{item:{type:Object,required:!0},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext}}}),[[`render`,Fa]]),La=[`disabled`],Ra=[`data-info`];function za(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffix`);return t.hasContent?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-affixes`,t.classes])},[(0,e.renderSlot)(t.$slots,`prepend`),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.visibleItems,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{class:(0,e.normalizeClass)([`dito-affix`,t.getItemClasses(n)]),key:r,style:(0,e.normalizeStyle)(n.style),item:n,parentContext:t.parentContext},null,8,[`class`,`style`,`item`,`parentContext`]))),128)),t.clearable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-affixes__clear`,type:`button`,title:`Clear`,disabled:t.disabled,onClick:n[0]||=(0,e.withModifiers)(e=>t.$emit(`clear`),[`stop`]),onMousedown:n[1]||=(0,e.withModifiers)(()=>{},[`stop`])},null,40,La)):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`append`),t.inlineInfo?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.inlineInfo},null,8,Ra)):(0,e.createCommentVNode)(``,!0)],2)):(0,e.createCommentVNode)(``,!0)}var q=V(B.component(`DitoAffixes`,{components:{DitoAffix:Ia},emits:[`clear`],props:{items:{type:[String,Object,Array],default:null},mode:{type:String,default:null},position:{type:String,default:null},absolute:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},inlineInfo:{type:String,default:null},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext},processedItems(){return(0,r.asArray)(this.items).filter(Boolean).map(e=>(0,r.isString)(e)?{type:`text`,text:e}:e.type?e:e.text==null?e.html==null?e:{type:`html`,...e}:{type:`text`,...e})},visibleItems(){return this.processedItems.filter(e=>Kt(e,this.context))},classes(){let e=`dito-affixes`;return{[`${e}--${this.position}`]:this.position,[`${e}--${this.mode}`]:this.mode,[`${e}--absolute`]:this.absolute}},hasContent(){return this.visibleItems.length>0||this.clearable||this.inlineInfo||ar(this.$slots.prepend)||ar(this.$slots.append)}},methods:{getItemClasses(e){let t=`dito-affix`;return[{[`${t}--${e.type}`]:e.type,[`${t}--ellipsis`]:this.mode===`ellipsis`&&[`text`,`html`].includes(e.type)},e.class]}}}),[[`render`,za]]),Ba={key:1,class:`dito-label__inner`},Va=[`for`,`innerHTML`],Ha=[`data-info`];function Ua(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`);return t.text||t.collapsible?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.collapsible?`button`:`div`),(0,e.mergeProps)({key:0,class:`dito-label`,type:t.collapsible?`button`:null},t.attributes,{class:{"dito-label--active":t.isActive}}),{default:(0,e.withCtx)(()=>[t.collapsible?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-chevron`,{"dito-chevron--open":!t.collapsed}])},null,2)):(0,e.createCommentVNode)(``,!0),t.text||t.prefixes.length>0||t.suffixes.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ba,[(0,e.createVNode)(s,{items:t.prefixes,position:`prefix`,parentContext:t.context},null,8,[`items`,`parentContext`]),t.text?((0,e.openBlock)(),(0,e.createElementBlock)(`label`,{key:0,for:t.htmlFor,innerHTML:t.text},null,8,Va)):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(s,{items:t.suffixes,mode:`ellipsis`,position:`suffix`,parentContext:t.context},null,8,[`items`,`parentContext`]),t.info?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.info},null,8,Ha)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)]),_:1},16,[`type`,`class`])):(0,e.createCommentVNode)(``,!0)}var Wa=V(B.component(`DitoLabel`,{components:{DitoAffixes:q},emits:[`open`],props:{label:{type:[String,Object],default:null},htmlFor:{type:String,default:null},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},info:{type:String,default:null}},computed:{text(){let{label:e}=this;return(0,r.isObject)(e)?e?.text:e},prefixes(){return(0,r.asArray)(this.label?.prefix)},suffixes(){return(0,r.asArray)(this.label?.suffix)},attributes(){return this.collapsible?{onClick:this.onClick,"aria-expanded":!this.collapsed}:{}},isActive(){return this.appState.activeLabel===this}},methods:{onClick(){this.appState.activeLabel=this,this.$emit(`open`,this.collapsed)}}}),[[`render`,Ua]]),Ga={methods:{getItemFormSchema:Vt,getItemUid:un,getItemId(e,t,n=null){return this.isTransient&&n!==null?String(n):sn(e,t)},getItemDataPath(e,t){let{dataPath:n}=this;return e!==this.schema&&(n=b(n,e.name)),t!=null&&(n=b(n,t)),n},getItemStore(e,t,n){return this.getChildStore(this.getItemUid(e,t),n)},removeItemStore(e,t,n){this.removeChildStore(this.getItemUid(e,t),n)},findItemIdIndex(e,t,n){let r=this.isTransient?n:t?.findIndex((t,r)=>this.getItemId(e,t,r)===n);return r===-1?null:r},getItemLabel(e,t,{index:n=null,extended:i=!1,asObject:a=!1}={}){let{itemLabel:o}=e;if(!t||!i&&o===!1)return null;let s,c=()=>s??=this.getItemDataPath(e,n),l,u=()=>l??=this.getLabel(Vt(e,t,this.context)),d,f,p;if((0,r.isFunction)(o)){let e=o.call(this,new E(this,{nested:!1,data:t,value:t,index:n,get dataPath(){return c()},get formLabel(){return u()}}));(0,r.isObject)(e)?{text:d,prefix:f,suffix:p}=e:d=e,i=!1}else if((0,r.isString)(o)&&!(o in t))d=o;else{let{columns:n}=e,i=t[(0,r.isString)(o)&&o||w(e)&&n&&Object.keys(n)[0]||`name`];d=(0,r.isString)(i)||(0,r.isNumber)(i)?i:null}let m=!!d;if(d??=(i=!0,w(e)&&n!==null?`${n+1}`:``),i){let e=u();e&&(d=`${e} ${m?`'${d}'`:d}`)}return a?d||f||p?{text:d,prefix:f,suffix:p}:null:d}}},Ka={key:0,class:`dito-schema-header`};function qa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanels`),c=(0,e.resolveComponent)(`DitoLabel`),l=(0,e.resolveComponent)(`DitoTabs`),u=(0,e.resolveComponent)(`DitoClipboard`),d=(0,e.resolveComponent)(`DitoPane`),f=(0,e.resolveComponent)(`TransitionHeight`);return(0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[(0,e.renderSlot)(t.$slots,`prepend`),(0,e.createElementVNode)(`div`,(0,e.mergeProps)({class:[`dito-schema`,{"dito-scroll-parent":t.scrollable,"dito-schema--open":t.opened}]},t.$attrs),[t.isPopulated&&t.panelEntries.length>0?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:0,to:`.dito-sidebar__teleport`},[t.active?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,panels:t.panelEntries,data:t.data,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`panels`,`data`,`meta`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),t.hasHeader?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:1,to:t.headerTeleport,disabled:!t.headerTeleport},[t.active?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ka,[t.hasLabel?((0,e.openBlock)(),(0,e.createBlock)(c,{key:0,label:t.label,info:t.info,collapsible:t.collapsible,collapsed:!t.opened,onOpen:t.onOpen},null,8,[`label`,`info`,`collapsible`,`collapsed`,`onOpen`])):(0,e.createCommentVNode)(``,!0),t.tabs?((0,e.openBlock)(),(0,e.createBlock)(e.Transition,{key:1,name:`dito-fade`},{default:(0,e.withCtx)(()=>[t.opened?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,modelValue:t.selectedTab,"onUpdate:modelValue":n[0]||=e=>t.selectedTab=e,tabs:t.renderedTabs},null,8,[`modelValue`,`tabs`])):(0,e.createCommentVNode)(``,!0)]),_:1})):(0,e.createCommentVNode)(``,!0),t.clipboard?((0,e.openBlock)(),(0,e.createBlock)(u,{key:2,clipboard:t.clipboard,schema:t.schema},null,8,[`clipboard`,`schema`])):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`edit-buttons`)])):(0,e.createCommentVNode)(``,!0)],8,[`to`,`disabled`])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(f,{enabled:t.inlined},{default:(0,e.withCtx)(()=>[t.opened?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-schema-content`,{"dito-scroll":t.scrollable}]),ref:`content`},[t.hasTabs?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.tabs,(n,r)=>(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(d,{key:r,class:`dito-pane__tab`,ref_for:!0,ref:`tabs`,tab:r,schema:n,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.padding,single:t.single&&!t.inlined&&!t.hasMainPane,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,accumulatedBasis:t.accumulatedBasis},null,8,[`tab`,`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`,`accumulatedBasis`])),[[e.vShow,t.selectedTab===r]])),128)):(0,e.createCommentVNode)(``,!0),t.hasMainPane?((0,e.openBlock)(),(0,e.createBlock)(d,{key:1,class:`dito-pane__main`,ref:`components`,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.padding,single:t.single&&!t.inlined&&!t.hasTabs,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,accumulatedBasis:t.accumulatedBasis},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`single`,`disabled`,`compact`,`generateLabels`,`accumulatedBasis`])):(0,e.createCommentVNode)(``,!0),!t.inlined&&t.isPopulated?(0,e.renderSlot)(t.$slots,`buttons`,{},void 0,void 0,2):(0,e.createCommentVNode)(``,!0)],2)):(0,e.createCommentVNode)(``,!0)]),_:3},8,[`enabled`]),t.inlined&&!t.hasHeader?(0,e.renderSlot)(t.$slots,`edit-buttons`,{},void 0,void 0,2):(0,e.createCommentVNode)(``,!0)],16),(0,e.renderSlot)(t.$slots,`append`)],64)}var Ja=B.component(`DitoSchema`,{mixins:[P,Ga],components:{TransitionHeight:Ai},inheritAttrs:!1,provide(){return{$schemaComponent:()=>this}},inject:[`$schemaParentComponent`],props:{schema:{type:Object,required:!0},dataSchema:{type:Object,default:e=>e.schema},dataPath:{type:String,default:``},data:{type:Object,default:null},meta:{type:Object,default:()=>({})},store:{type:Object,default:()=>({})},label:{type:[String,Object],default:null},info:{type:String,default:null},single:{type:Boolean,default:!1},padding:{type:String,default:null},active:{type:Boolean,default:!0},inlined:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!1},hasOwnData:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},labelNode:{type:HTMLElement,default:null},accumulatedBasis:{type:Number,default:1}},data(){let{data:e}=this.schema;return{...e&&(0,r.isFunction)(e)?e(this.context):e,selectedTab:null,componentsRegistry:{},unnestedComponentsRegistry:{},panesRegistry:{},panelsRegistry:{},scrollPositions:{}}},computed:{nested(){return!1},schemaComponent(){return this},parentSchemaComponent(){return this.hasOwnData?null:this.parentComponent.schemaComponent},panelEntries(){return Wt(this.schema.panels,this.dataPath,this.componentPath)},tabs(){return k(this.schema.tabs)},renderedTabs(){return this.tabs&&this.data?Object.fromEntries(Object.entries(this.tabs).filter(([,e])=>this.shouldRenderSchema(e))):this.tabs},defaultTab(){let e=null;if(this.renderedTabs){let t=Object.values(this.renderedTabs);for(let{name:n,defaultTab:i}of t){if((0,r.isFunction)(i)?i(this.context):i)return n;e??=n}}return e},routeTab(){return this.$route.hash?.slice(1)||null},clipboard(){return this.schema?.clipboard??null},hasHeader(){return this.hasLabel||this.hasTabs||!!this.clipboard},headerTeleport(){return this.isTopLevelSchema?`.dito-header__teleport`:this.labelNode},processedData(){return this.processData({target:`server`,schemaOnly:!0})},clipboardData:{get(){return this.processData({target:`clipboard`,schemaOnly:!0})},set(e){this.setData(e)}},clipboardItem(){return this.clipboardData},formLabel(){return this.getLabel(this.getItemFormSchema(this.sourceSchema,this.data,this.context))},isDirty(){return this.someComponent(e=>e.isDirty)},isTouched(){return this.someComponent(e=>e.isTouched)},isValid(){return this.everyComponent(e=>e.isValid)},isValidated(){return this.everyComponent(e=>e.isValidated)},hasErrors(){return this.someComponent(e=>e.hasErrors)},hasData(){return!!this.data},hasLabel(){return!!this.label||this.collapsible},hasTabs(){return!!this.tabs},isTopLevelSchema(){return!it(this.schema)&&!this.inlined},hasTopLevelTabs(){return this.hasTabs&&this.isTopLevelSchema},hasMainPane(){let{components:e}=this.schema;return!!e&&Object.keys(e).length>0},opened:jn(`opened`,{default(){return!this.collapsed}}),components(){return Object.values(this.componentsRegistry)},unnestedComponents(){return Object.values(this.unnestedComponentsRegistry)},panes(){return Object.values(this.panesRegistry)},panels(){return Object.values(this.panelsRegistry)},componentsByDataPath(){return this._listEntriesByDataPath(this.componentsRegistry)},panesByDataPath(){return this._listEntriesByDataPath(this.panesRegistry)},panelsByDataPath(){return this._listEntriesByDataPath(this.panelsRegistry)},wide:F(`wide`,{type:Boolean,default:!1})},watch:{schema:{immediate:!0,handler(e){Ht(e)||this.setupSchema()}},routeTab:{immediate:!0,flush:`post`,handler(e){this.hasTopLevelTabs&&(this.selectedTab=e)}},selectedTab(e,t){if(this.scrollable){let{content:n}=this.$refs;this.scrollPositions[t]=n.scrollTop,this.$nextTick(()=>{n.scrollTop=this.scrollPositions[e]??0})}if(this.hasTopLevelTabs){let t=!e||e in this.renderedTabs?e:this.defaultTab;this.$router.replace({query:this.$route.query,hash:t?`#${t}`:null})}this.hasErrors&&this.repositionErrors()}},created(){this._register(!0),this.scrollable&&this.wide&&(this.appState.pageClass=`dito-page--wide`)},mounted(){this.selectedTab=this.routeTab||this.defaultTab},unmounted(){this.emitEvent(`destroy`),this._register(!1),this.scrollable&&this.wide&&(this.appState.pageClass=null)},methods:{setupSchema(){this.setupSchemaFields(),this.delegate(`change`,this.parentSchemaComponent),this.emitEvent(`initialize`)},getComponentsByDataPath(e){return this._getEntriesByDataPath(this.componentsByDataPath,e)},getComponentByDataPath(e){return this.getComponentsByDataPath(e)[0]||null},getComponentsByName(e){return this._getEntriesByName(this.componentsByDataPath,e)},getComponentByName(e){return this.getComponentsByName(e)[0]||null},getComponents(e){return this._getEntries(this.componentsByDataPath,e)},getComponent(e){return this.getComponents(e)[0]||null},getPanelsByDataPath(e){return this._getEntriesByDataPath(this.panelsByDataPath,e)},getPanelByDataPath(e){return this.getPanelsByDataPath(e)[0]||null},getPanels(e){return this._getEntries(this.panelsByDataPath,e)},getPanel(e){return this.getPanels(e)[0]||null},someComponent(e){return this.isPopulated&&this.components.some(e)},everyComponent(e){return this.isPopulated&&this.components.every(e)},onOpen(e){this.emitEvent(`open`,{context:{open:e}}),this.opened=e},onChange(){this.emitEvent(`change`)},resetValidation(){for(let e of this.components)e.resetValidation()},clearErrors(){for(let e of this.components)e.clearErrors()},repositionErrors(){let e=this.$refs.content.closest(`.dito-scroll`),t=()=>e.dispatchEvent(new Event(`scroll`));t(),setTimeout(t,0)},focus(){return this.opened=!0,this.parentSchemaComponent?.focus()},validateAll(e,t=!0){let n=this.hasData?On(this.schema,this.data,{dataPath:this.dataPath,component:this,rootData:this.rootData}):null,r=e?kn(n,e):n;return t&&(r?this._showValidationErrorsByFullDataPath(r,!0,!0).catch(console.error):this.clearErrors()),!r},verifyAll(e){return this.validateAll(e,!1)},async showValidationErrors(e,t,n=!0){let i=Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,r.normalizeDataPath)(this.hasOwnData?b(this.dataPath,e):e),t]));return this._showValidationErrorsByFullDataPath(i,t,n)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let{opened:i}=this;i||(this.opened=!0,await this.$nextTick());let a=[],o=e=>{let n=t?.(e)??!0;return n&&a.push(...e),n},s=async t=>{for(let r of t){let t=`${r.componentPath}/`;a.some(e=>e.componentPath.startsWith(t))||await r.navigateToComponent?.(e,o,{shouldRevealInlinedOnly:n||a.length>0})}},c=this.getComponentsByDataPath(e);c.length>0&&o(c);let l=(0,r.parseDataPath)(e),u=(0,r.parseDataPath)(this.dataPath).length;for(;l.length>u+1;)l.pop(),await s(this.getComponentsByDataPath(l));await s(this.unnestedComponents);let d=a.length>0;return d||(this.opened=i),d},async _showValidationErrorsByFullDataPath(e,t,n){this.clearErrors();let i=[],a=n;for(let[a,o]of Object.entries(e)){let s=null,c=[],l=await this.navigateToComponent(a,e=>{for(let t of e)t.isForm?s=t:c.push(t);return!0});if(Ya(c).forEach((e,r)=>{e.showValidationErrors(o,n&&t&&!s&&r===0)}),s){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e===s.dataPath||e.startsWith(`${s.dataPath}/`)));return s.showValidationErrors(r,n&&t)}if(!l){let e=(0,r.labelize)((0,r.parseDataPath)(a).pop());for(let t of o){let n=e?`The field ${e}`:`The ${this.formLabel}`;i.push(`${n} ${t.message}`)}}n=!1}return a&&!n&&this.notifyErrors(i.join(`
|
|
2
2
|
`)),!n},notifyErrors(e){this.notify({type:`error`,title:`Validation Errors`,text:e||`Please correct the highlighted errors.`})},resetData(){Object.assign(this.data,en(this.dataSchema,{},this)),this.clearErrors()},setData(e){for(let t in e)if(t in this.data&&!(0,r.equals)(this.data[t],e[t])){this.data[t]=e[t];for(let e of this.getComponentsByName(t))e.markDirty()}return this.data},filterData(e){let t={},n={};for(let[i,a]of Object.entries(e)){if(((0,r.isArray)(a)||(0,r.isObject)(a))&&this.getComponentsByName(i).some(e=>e.providesData)){n[i]=a;continue}t[i]=a}return{localData:t,foreignData:n}},processData({target:e=`clipboard`,schemaOnly:t=!0}={}){return an(this.dataSchema,this.sourceSchema,this.data,this.dataPath,{rootData:this.rootData,component:this,schemaOnly:t,target:e})},_register(e){this.$schemaParentComponent()?._registerSchemaComponent(this,e)},_registerComponent(e,t,n){this._registerEntry(this.componentsRegistry,e,t,n),this.parentSchemaComponent?._registerComponent(e,t,n)},_registerUnnestedComponent(e,t,n){this._registerEntry(this.unnestedComponentsRegistry,e,t,n)},_registerPane(e,t,n){this._registerEntry(this.panesRegistry,e,t,n)},_registerPanel(e,t,n){this._registerEntry(this.panelsRegistry,e,t,n)},_registerEntry(e,t,n,r=t.componentPath){n?e[r]=t:e[r]===t&&delete e[r]},_listEntriesByDataPath(e){return Object.values(e).reduce((e,t)=>{let{dataPath:n}=t;return(e[n]||=[]).push(t),e},{})},_getEntries(e,t){return(0,r.normalizeDataPath)(t).startsWith(this.dataPath)?this._getEntriesByDataPath(e,t):this._getEntriesByName(e,t)},_getEntriesByDataPath(e,t){return Ya(e[(0,r.normalizeDataPath)(t)]||[])},_getEntriesByName(e,t){return Ya(e[b(this.dataPath,t)]||[])}}});function Ya(e){return e.length>1?[...e].sort(Xa):e}function Xa(e,t){let n=e.$el,r=t.$el;return!n||!r||n===r?0:n.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Za=V(Ja,[[`render`,qa]]);function Qa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoEditButtons`),c=(0,e.resolveComponent)(`DitoSchema`);return(0,e.openBlock)(),(0,e.createBlock)(c,{class:`dito-schema-inlined`,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,label:t.isCompact?null:t.label,info:t.info,padding:t.padding??`inlined`,inlined:!0,disabled:t.disabled,compact:t.isCompact,collapsed:t.collapsed,collapsible:t.collapsible,generateLabels:!t.isCompact,labelNode:t.labelNode,accumulatedBasis:t.accumulatedBasis},{"edit-buttons":(0,e.withCtx)(()=>[t.deletable||t.draggable||t.editable||t.insertIndex!=null?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:t.disabled,deletable:t.deletable,draggable:t.draggable,editable:t.editable,editPath:t.editPath,creatable:t.insertIndex!=null,createPath:t.createPath,insertIndex:t.insertIndex,onDelete:n[0]||=e=>t.$emit(`delete`)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`deletable`,`draggable`,`editable`,`editPath`,`creatable`,`createPath`,`insertIndex`])):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`schema`,`dataPath`,`data`,`meta`,`store`,`label`,`info`,`padding`,`disabled`,`compact`,`collapsed`,`collapsible`,`generateLabels`,`labelNode`,`accumulatedBasis`])}var $a=V(B.component(`DitoSchemaInlined`,{emits:[`delete`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},label:{type:[String,Object],default:null},info:{type:String,default:null},padding:{type:String,default:null},disabled:{type:Boolean,required:!0},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},editPath:{type:String,default:null},createPath:{type:String,default:null},insertIndex:{type:Number,default:null},labelNode:{type:HTMLElement,default:null},accumulatedBasis:{type:Number,default:null}},computed:{isCompact(){return lt(this.schema)},hasLabel(){return!this.isCompact&&!!this.label}}}),[[`render`,Qa]]),eo=[`id`,`role`,`aria-labelledby`],to={key:0,class:`dito-pane__break`},no={key:2,class:`dito-pane__break`};function ro(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoContainer`),c=(0,e.resolveDirective)(`resize`);return t.isPopulated&&t.componentSchemas.length>0?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-pane`,t.classes]),id:t.tabPanelId,role:t.tab?`tabpanel`:null,"aria-labelledby":t.tabId},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.componentSchemas,({schema:n,dataPath:r,nestedDataPath:i,nested:a,store:o},c)=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[[`before`,`both`].includes(n.break)?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,to)):(0,e.createCommentVNode)(``,!0),t.shouldRenderComponent(n,a,r)?((0,e.openBlock)(),(0,e.createBlock)(s,{ref_for:!0,ref:`containers`,key:i,"data-index":c,schema:n,dataPath:r,data:t.data,meta:t.meta,store:o,single:t.isSingleComponent,nested:a,disabled:t.disabled,compact:t.compact,generateLabels:t.generateLabels,verticalLabels:t.isInLabeledRow(c),accumulatedBasis:t.accumulatedBasis},null,8,[`data-index`,`schema`,`dataPath`,`data`,`meta`,`store`,`single`,`nested`,`disabled`,`compact`,`generateLabels`,`verticalLabels`,`accumulatedBasis`])):(0,e.createCommentVNode)(``,!0),[`after`,`both`].includes(n.break)?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,no)):(0,e.createCommentVNode)(``,!0)],64))),256))],10,eo)),[[c,t.onResizePane]]):(0,e.createCommentVNode)(``,!0)}var io=V(B.component(`DitoPane`,{mixins:[P],provide(){return{$tabComponent:()=>this.tabComponent}},props:{schema:{type:Object,required:!0},dataPath:{type:String,default:``},data:{type:Object,default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},tab:{type:String,default:null},single:{type:Boolean,default:!1},padding:{type:String,default:null},disabled:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},accumulatedBasis:{type:Number,default:null}},data(){return{positions:[]}},computed:{nested(){return!1},classes(){let e=`dito-pane`;return{[`${e}--single`]:this.isSingleComponent,[`${e}--padding-${this.padding}`]:!!this.padding}},tabComponent(){return this.tab?this:this.$tabComponent()},componentPath(){let{componentPath:e}=this.parentComponent;return this.tab?b(e,this.tab):e},tabId(){let{componentPath:e}=this.schemaComponent;return this.tab?`${e}-tab-${this.tab}`:null},tabPanelId(){let{componentPath:e}=this.schemaComponent;return this.tab?`${e}-tabpanel-${this.tab}`:null},componentSchemas(){let e=this.sourceSchema?.wrapPrimitives;return Object.entries(this.schema?.components||{}).map(([t,n])=>{n={...n,name:t};let r=C(n),i=b(this.dataPath,t),a=r&&!e?i:this.dataPath;return{schema:n,dataPath:a,nestedDataPath:i,nested:r,store:this.getChildStore(t)}})},isSingleComponent(){return this.single&&this.componentSchemas.length===1},verticalLabelsByIndices(){let{positions:e}=this,t=t=>e[t]&&(t===e.length-1||n(t).top>e[t].top),n=t=>{for(let n=t+1;n<e.length;n++)if(e[n])return e[n];return 0},r=[],i=[];for(let n=0;n<e.length;n++)i.push(n),t(n)&&(r.push(i),i=[]);i.length>0&&r.push(i);let a=[];for(let e of r){let t=!1;for(let n of e){let e=this.positions[n];if(e?.height>2&&(e.node.matches(`:has(> .dito-label)`)||e.node.closest(`.dito-container`).matches(`.dito-container--label-vertical`))){t=!0;break}}for(let n of e)a[n]=t}return a}},watch:{"componentSchemas.length"(e){this.positions.length=e},componentPath(e,t){this._register(!1,t),this._register(!0,e)}},created(){this._register(!0)},unmounted(){this._register(!1)},methods:{shouldRenderComponent(e,t,n){return Kt(e,E.createForSchema(this,{schema:e,name:e.name,nested:t,data:this.data,dataPath:n,rootData:this.rootData}))},_register(e,t=this.componentPath){this.schemaComponent._registerPane(this,e,t)},focus(){if(this.tab)return this.$router.push({hash:`#${this.tab}`})},onResizePane(){this.$nextTick(()=>{for(let e of this.$refs.containers??[]){let t=e.$el,n=+t.dataset.index,r=t.getBoundingClientRect(),i=getComputedStyle(t),a=parseFloat(i.padding),o=parseFloat(i.fontSize),s=r.height-2*a;this.positions[n]=s<=0?null:{top:r.y,height:s/o,node:t}}})},isInLabeledRow(e){return!!this.verticalLabelsByIndices[e]}}}),[[`render`,ro]]);function ao(e){let t=(0,r.isString)(e)&&e.match(/^\s*([+-]?\d+)\s*\/\s*([+-]?\d+)\s*$/);if(t){let[,e,n]=t;return parseFloat(e)/parseFloat(n)}return parseFloat(e)}function oo(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanels`),c=(0,e.resolveComponent)(`DitoLabel`),l=(0,e.resolveComponent)(`DitoErrors`);return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-container`,t.containerClasses]),style:(0,e.normalizeStyle)(t.containerStyles)},[t.isMounted&&t.panelEntries.length>0?((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{key:0,to:`.dito-sidebar__teleport`},[(0,e.createVNode)(s,{panels:t.panelEntries,data:t.data,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`panels`,`data`,`meta`,`store`,`disabled`])])):(0,e.createCommentVNode)(``,!0),t.hasLabel?((0,e.openBlock)(),(0,e.createBlock)(c,{key:1,class:(0,e.normalizeClass)(t.labelClasses),htmlFor:t.labelHtmlFor,label:t.label,info:t.info},null,8,[`class`,`htmlFor`,`label`,`info`])):(0,e.createCommentVNode)(``,!0),t.hasLabel&&t.isLabel?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.typeComponent),{key:2,class:(0,e.normalizeClass)([`dito-component`,t.componentClasses]),ref:`component`,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,width:t.width,label:t.label,single:t.single,nested:t.nested,accumulatedBasis:t.combinedBasis,onErrors:t.onErrors,"onUpdate:component":n[0]||=e=>t.component=e},null,40,[`class`,`schema`,`dataPath`,`data`,`meta`,`store`,`width`,`label`,`single`,`nested`,`accumulatedBasis`,`onErrors`])),(0,e.createVNode)(l,{errors:t.errors},null,8,[`errors`])],6)),[[e.vShow,t.componentVisible]])}var so=V(B.component(`DitoContainer`,{mixins:[dn,P],props:{schema:{type:Object,required:!0},dataPath:{type:String,default:``},data:{type:[Object,Array],required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},single:{type:Boolean,default:!1},nested:{type:Boolean,default:!0},disabled:{type:Boolean,required:!0},compact:{type:Boolean,default:!1},generateLabels:{type:Boolean,default:!1},verticalLabels:{type:Boolean,default:!1},accumulatedBasis:{type:Number,default:null}},data(){return{errors:null,component:null}},computed:{context(){return new E(this.component??this,{nested:this.nested})},name(){return this.schema.name},componentPath(){return b(this.parentComponent.componentPath,this.name)},type(){return this.schema.type},typeComponent(){return Ke(this.type)},isLabel(){return this.type===`label`},hasLabel(){return dt(this.schema,this.generateLabels)},label(){return this.hasLabel?this.getLabel(this.schema):null},labelHtmlFor(){return this.nested?this.componentPath:null},info:F(`info`,{type:String,default:null}),width:F(`width`,{type:[String,Number],default(){return this.typeComponent?.defaultWidth},get(e){return e===void 0?1:(0,r.isString)(e)?e.match(/^\s*[<>]?\s*(.*)$/)[1]:e}}),widthOperator:F(`width`,{type:String,get(e){return(0,r.isString)(e)&&e.match(/^\s*([<>]?)/)[1]||null}}),componentVisible:F(`visible`,{type:Boolean,default(){return this.typeComponent?.defaultVisible}}),componentDisabled:F(`disabled`,{type:Boolean,default:!1,get(e){return e||this.disabled}}),flexGrow(){return this.widthOperator===`>`||this.width===`fill`},flexShrink(){return this.widthOperator===`<`},flexBasis(){let e=this.width;return[null,`auto`,`fill`].includes(e)?`auto`:/%$/.test(e)?parseFloat(e)/100:/[a-z]/.test(e)?e:ao(e)},combinedBasis(){let{accumulatedBasis:e,flexBasis:t}=this;return(0,r.isNumber)(e)&&(0,r.isNumber)(t)?e*t:null},containerClasses(){let{class:e}=this.schema,t=`dito-container`;return{[`${t}--disabled`]:this.componentDisabled,[`${t}--has-errors`]:!!this.errors,[`${t}--single`]:this.single,[`${t}--compact`]:this.compact,[`${t}--label-vertical`]:this.verticalLabels,[`${t}--omit-spacing`]:ft(this.schema),...(0,r.isString)(e)?{[e]:!0}:e}},containerStyles(){let{flexBasis:e,combinedBasis:t}=this;return{"--grow":+!!this.flexGrow,"--shrink":+!!this.flexShrink,"--basis":(0,r.isNumber)(e)?`${e*100}%`:e,"--basis-mobile":(0,r.isNumber)(t)&&t<=.25?`${e*200}%`:null}},componentClasses(){return{"dito-component--single":this.single,...this.getLayoutClasses(`dito-component`)}},labelClasses(){return{"dito-label--visible":this.isLabel,...this.getLayoutClasses(`dito-label`)}},panelEntries(){return Gt(this.api,this.schema,this.dataPath,this.nested?this.componentPath:this.parentComponent.componentPath,this.componentPath,this.$refs.component,this.tabComponent)}},methods:{getLayoutClasses(e){return{[`${e}--fill`]:this.width===`fill`||this.flexBasis!==`auto`,[`${e}--grow`]:this.flexGrow,[`${e}--shrink`]:this.flexShrink}},onErrors(e){this.errors=e}}}),[[`render`,oo]]),co={class:`dito-tabs`,role:`tablist`},lo=[`id`,`aria-selected`,`aria-controls`,`tabindex`,`onClick`];function uo(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,co,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.tabs,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`a`,{class:(0,e.normalizeClass)([`dito-tabs__link`,{"dito-tabs__link--active":t.modelValue===r}]),id:t.getTabId(r),key:r,role:`tab`,"aria-selected":t.modelValue===r,"aria-controls":t.getTabPanelId(r),tabindex:t.modelValue===r?0:-1,onClick:e=>t.$emit(`update:modelValue`,r)},(0,e.toDisplayString)(t.getLabel(n,r)),11,lo))),128))])}var fo=V(B.component(`DitoTabs`,{emits:[`update:modelValue`],props:{tabs:{type:Object,default:null},modelValue:{type:String,default:null}},methods:{getTabId(e){return`${this.schemaComponent.componentPath}-tab-${e}`},getTabPanelId(e){return`${this.schemaComponent.componentPath}-tabpanel-${e}`}}}),[[`render`,uo]]);function po(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoButtons`),c=(0,e.resolveComponent)(`DitoSchema`);return t.shouldRenderSchema(t.panelSchema)?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.panelTag),{key:0,class:`dito-panel`,role:`region`,"aria-label":t.getLabel(t.schema),onSubmit:n[0]||=(0,e.withModifiers)(()=>{},[`prevent`])},{default:(0,e.withCtx)(()=>[(0,e.createVNode)(c,{class:`dito-panel__schema`,schema:t.panelSchema,dataSchema:t.panelDataSchema,dataPath:t.panelDataPath,data:t.panelData,meta:t.meta,store:t.store,padding:`nested`,disabled:t.disabled,hasOwnData:t.hasOwnData,generateLabels:``},{prepend:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`h2`,{class:(0,e.normalizeClass)([`dito-panel__header`,{"dito-panel__header--sticky":t.sticky}])},[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabel(t.schema)),1),(0,e.createVNode)(s,{class:`dito-buttons--small`,buttons:t.panelButtonSchemas,buttonsName:`panelButtons`,dataPath:t.panelDataPath,data:t.panelData,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])],2)]),buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{buttons:t.buttonSchemas,dataPath:t.panelDataPath,data:t.panelData,meta:t.meta,store:t.store,disabled:t.disabled},null,8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])]),_:1},8,[`schema`,`dataSchema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`hasOwnData`])]),_:1},40,[`aria-label`])),[[e.vShow,t.visible&&(!t.panelTabComponent||t.panelTabComponent.visible)]]):(0,e.createCommentVNode)(``,!0)}var mo=V(B.component(`DitoPanel`,{mixins:[P,Ii],provide(){return{$panelComponent:()=>this,$tabComponent:()=>this.panelTabComponent}},props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},disabled:{type:Boolean,required:!0},panelTabComponent:{type:Object,default:null},panelComponentPath:{type:String,required:!0}},data(){return{ownData:null}},computed:{nested(){return!0},context(){return new E(this,{nested:!1,data:this.panelData,dataPath:this.panelDataPath})},panelComponent(){return this},componentPath(){return this.panelComponentPath},tabComponent(){return this.panelTabComponent},buttonSchemas(){return A(this.schema.buttons)},panelButtonSchemas(){return A(this.schema.panelButtons)},hasOwnData(){return!!this.ownData},panelData(){return this.ownData||this.data},panelSchema(){if(this.hasOwnData)return this.schema;{let{data:e,...t}=this.schema;return t}},panelTag(){return this.hasOwnData?`form`:`div`},panelDataSchema(){return this.hasOwnData?this.schema:this.schemaComponent.schema},panelDataPath(){return this.hasOwnData?this.dataPath:this.schemaComponent.dataPath},visible:F(`visible`,{type:Boolean,default:!0}),sticky:F(`sticky`,{type:Boolean,default:!1})},watch:{componentPath(e,t){this._register(!1,t),this._register(!0,e)}},created(){this._register(!0);let{data:e}=this.schema;e&&(this.ownData=(0,r.isFunction)(e)?e(this.context):e)},unmounted(){this._register(!1)},methods:{_register(e,t=this.componentPath){this.schemaComponent._registerPanel(this,e,t)}}}),[[`render`,po]]),ho={key:0,class:`dito-panels`};function go(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanel`);return t.panels.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ho,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.panels,({schema:n,dataPath:r,componentPath:i,tabComponent:a})=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(n)?((0,e.openBlock)(),(0,e.createBlock)(s,{key:t.getPanelKey(r,a),schema:n,dataPath:r,panelComponentPath:i,data:t.data,meta:t.meta,store:t.getChildStore(n.name),disabled:n.disabled??t.disabled,panelTabComponent:a},null,8,[`schema`,`dataPath`,`panelComponentPath`,`data`,`meta`,`store`,`disabled`,`panelTabComponent`])):(0,e.createCommentVNode)(``,!0)],64))),256))])):(0,e.createCommentVNode)(``,!0)}var _o=V(B.component(`DitoPanels`,{mixins:[P],props:{panels:{type:Array,default:null},data:{type:Object,required:!0},meta:{type:Object,required:!0},store:{type:Object,required:!0},disabled:{type:Boolean,required:!0}},computed:{nested(){return!1}},methods:{getPanelKey(e,t){return t?`${t.tab}_${e}`:e}}}),[[`render`,go]]),vo={key:0,class:`dito-buttons`},yo={key:0,class:`dito-container`};function bo(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoContainer`),c=(0,e.resolveComponent)(`DitoVnode`);return t.buttonSchemas||t.hasSlotContent(t.$slots.default)?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,vo,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.buttonSchemas,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(n)?((0,e.openBlock)(),(0,e.createBlock)(s,{key:r,schema:n,dataPath:r,data:t.data,meta:t.meta,nested:t.nested,store:t.getChildStore(n.name),disabled:t.disabled},null,8,[`schema`,`dataPath`,`data`,`meta`,`nested`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)],64))),256)),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.$slots.default?.(),n=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.hasVNodeContent(n)?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,yo,[(0,e.createVNode)(c,{vnode:n},null,8,[`vnode`])])):(0,e.createCommentVNode)(``,!0)],64))),256))])):(0,e.createCommentVNode)(``,!0)}var xo=V(B.component(`DitoButtons`,{mixins:[P],provide:{$tabComponent:()=>null},props:{buttons:{type:Object,default:null},dataPath:{type:String,default:``},data:{type:[Object,Array],default:null},meta:{type:Object,default:()=>({})},store:{type:Object,default:()=>({})},nested:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},buttonsName:{type:String,default:`buttons`}},computed:{componentPath(){return b(this.continueParentComponentPath(),`$${this.buttonsName}`)},buttonSchemas(){let{dataPath:e,buttons:t}=this;return t?Object.values(t).reduce((t,n)=>(t[b(e,n.name)]=n,t),{}):null}},methods:{hasSlotContent:ar,hasVNodeContent:ir}}),[[`render`,bo]]),So=[`disabled`];function Co(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`),c=(0,e.resolveComponent)(`DitoCreateButton`),l=(0,e.resolveComponent)(`DitoButtons`);return(0,e.openBlock)(),(0,e.createBlock)(l,{class:`dito-edit-buttons dito-buttons--round`,buttons:t.buttons,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,onClick:n[1]||=(0,e.withModifiers)(()=>{},[`stop`])},{default:(0,e.withCtx)(()=>[t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:0,class:[`dito-button`,{"dito-button--disabled":t.isDraggableDisabled}]},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.editable?((0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({key:1,class:[`dito-button`,{"dito-button--disabled":t.isEditableDisabled}],to:t.editPath?{path:t.editPath}:{}},t.getButtonAttributes(t.verbs.edit)),null,16,[`class`,`to`])):(0,e.createCommentVNode)(``,!0),t.creatable?((0,e.openBlock)(),(0,e.createBlock)(c,{key:2,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,path:t.createPath,verb:t.verbs.create,text:t.insertIndex==null?t.createButtonText:null,disabled:t.isCreatableDisabled,insertIndex:t.insertIndex},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`path`,`verb`,`text`,`disabled`,`insertIndex`])):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:3,class:`dito-button`,type:`button`,disabled:t.isDeletableDisabled},t.getButtonAttributes(t.verbs.delete),{onClick:n[0]||=e=>t.$emit(`delete`)}),null,16,So)):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`nested`])}var wo=V(B.component(`DitoEditButtons`,{mixins:[P],emits:[`delete`],props:{buttons:{type:Object,default:null},schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!1},disabled:{type:Boolean,required:!0},draggable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},creatable:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},editPath:{type:String,default:null},createPath:{type:String,default:null},insertIndex:{type:Number,default:null}},computed:{formLabel(){return this.getLabel(this.schema.form)},isDraggableDisabled(){return this.disabled||!this.hasSchemaOption(`draggable`)},isDeletableDisabled(){return this.disabled||!this.hasSchemaOption(`deletable`)},isEditableDisabled(){return this.disabled||!this.editPath||!this.hasSchemaOption(`editable`)},isCreatableDisabled(){return this.disabled||!this.createPath||!this.hasSchemaOption(`creatable`)},createButtonText(){return this.schema.creatable?.label||this.formLabel&&`${(0,r.capitalize)(this.verbs.create)} ${this.formLabel}`||null}},methods:{hasSchemaOption(e){return this.getSchemaValue(e,{type:Boolean,default:!0})}}}),[[`render`,Co]]),To={class:`dito-create-button`},Eo=[`type`,`disabled`],Do=[`disabled`],Oo=[`onMousedown`,`onMouseup`];function ko(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,To,[t.creatableForm?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:0,class:`dito-button`,type:t.isInlined?`button`:`submit`,disabled:t.disabled},t.getButtonAttributes(t.verb,t.formLabel,t.text),{onClick:n[0]||=e=>t.createItem(t.creatableForm)}),(0,e.toDisplayString)(t.text),17,Eo)):t.creatableForms?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createElementVNode)(`button`,(0,e.mergeProps)({class:`dito-button`,type:`button`,disabled:t.disabled},{...t.pulldownTriggerAttributes,...t.getButtonAttributes(t.verb,null,t.text)},{onMousedown:n[1]||=(0,e.withModifiers)(e=>t.onPulldownMouseDown(),[`stop`])}),(0,e.toDisplayString)(t.text),17,Do),(0,e.createElementVNode)(`ul`,{class:(0,e.normalizeClass)([`dito-pulldown`,{"dito-pulldown--open":t.pulldown.open}]),role:`menu`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.creatableForms,(n,r)=>(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`a`,{class:(0,e.normalizeClass)([`dito-pulldown__item`,{"dito-pulldown__item--disabled":t.shouldDisableSchema(n)}]),role:`menuitem`,onMousedown:(0,e.withModifiers)(e=>t.onPulldownMouseDown(r),[`stop`]),onMouseup:e=>t.onPulldownMouseUp(r)},(0,e.toDisplayString)(t.getLabel(n)),43,Oo)],512)),[[e.vShow,t.shouldShowSchema(n)]])),256))],2)],64)):(0,e.createCommentVNode)(``,!0)])}var Ao=V(B.component(`DitoCreateButton`,{mixins:[P,Oa],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Object,Array],default:null},meta:{type:Object,required:!0},store:{type:Object,required:!0},nested:{type:Boolean,default:!1},path:{type:String,required:!0},verb:{type:String,required:!0},text:{type:String,default:null},disabled:{type:Boolean,required:!0},insertIndex:{type:Number,default:null}},computed:{forms(){return O(this.insertIndex==null?this.schema:this.sourceSchema||this.schema,this.context)},creatableForms(){let e=Object.entries(this.forms).filter(([,e])=>this.isFormCreatable(e));return e.length>0?Object.fromEntries(e):null},creatableForm(){let e=this.creatableForms;return e&&Object.keys(e).length===1&&e.default||null},formLabel(){let e=this.creatableForm;return e?this.getSchemaValue(`label`,{schema:e,type:String}):null},isInlined(){return ut(this.schema)}},methods:{isFormCreatable(e){return this.shouldRenderSchema(e)&&this.getSchemaValue(`creatable`,{type:Boolean,default:!0,schema:e})},createItem(e,t=null){if(this.shouldDisableSchema(e))throw Error(`Not allowed to create item for given form`);if(this.isInlined)this.sourceComponent.createItem(e,t,this.insertIndex);else{let{creatable:e}=this.schema,n={...t&&{type:t},...e?.query?.(this.context)};this.$router.push({path:`${this.path}/create`,query:n})}},onPulldownSelect(e){this.createItem(this.forms[e],e),this.setPulldownOpen(!1)}}}),[[`render`,ko]]),jo={key:0,class:`dito-clipboard dito-buttons dito-buttons--round`},Mo=[`disabled`],No=[`disabled`];function Po(t,n,r,i,a,o){return t.clipboard?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,jo,[(0,e.createElementVNode)(`button`,{class:`dito-button dito-button--copy`,ref:`copyData`,type:`button`,title:`Copy Data`,disabled:!t.copyEnabled,onClick:n[0]||=(...e)=>t.onCopy&&t.onCopy(...e)},null,8,Mo),(0,e.createElementVNode)(`button`,{class:`dito-button dito-button--paste`,type:`button`,title:`Paste Data`,disabled:!t.pasteEnabled,onClick:n[1]||=(...e)=>t.onPaste&&t.onPaste(...e)},null,8,No)])):(0,e.createCommentVNode)(``,!0)}var Fo=V(B.component(`DitoClipboard`,{mixins:[G],props:{clipboard:{type:[Boolean,Object],required:!0},schema:{type:Object,required:!0}},data(){return{copyEnabled:!1,pasteEnabled:!1}},computed:{clipboardOptions(){return(0,r.isObject)(this.clipboard)?this.clipboard:{}},copyData(){let{copy:e}=this.clipboardOptions;return e?t=>e.call(this,new E(this,{clipboardData:t})):e=>(0,r.clone)(e)},pasteData(){let{paste:e}=this.clipboardOptions;return e?t=>e.call(this,new E(this,{clipboardData:t})):e=>e}},watch:{"parentComponent.hasData":{immediate:!0,handler:`updateCopy`},"appState.clipboardData":{immediate:!0,handler:`updatePaste`}},mounted(){this.domOn(document,{copy:this.updatePaste}),this.domOn(window,{focus:this.updatePaste})},methods:{checkClipboardData(e){let{$schema:t,...n}=e||{};return t===this.schema.name?n:null},async getClipboardData(e){let{clipboardData:t}=this.appState;try{let e=await navigator.clipboard?.readText?.();e&&(t=JSON.parse(e))}catch(t){e&&(console.error(t,t.name,t.message),t.name===`SyntaxError`&&alert(r.deindent`
|
|
3
3
|
The data in the clipboard appears to be malformed:
|
|
4
4
|
${t.message}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dito.js Admin is a schema based admin interface for Dito.js Server, featuring auto-generated views and forms and built with Vue.js",
|
|
6
6
|
"repository": "https://github.com/ditojs/dito/tree/main/packages/admin",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"vue-router": "^5.3.1",
|
|
132
132
|
"vue-upload-component": "^3.2.2"
|
|
133
133
|
},
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "5fdd07d3192698bfab4a3bedc061a08341c67282"
|
|
135
135
|
}
|
package/src/DitoContext.js
CHANGED
|
@@ -154,9 +154,10 @@ export default class DitoContext {
|
|
|
154
154
|
'value',
|
|
155
155
|
() =>
|
|
156
156
|
// If the value is not defined on the underlying object, it's not a type
|
|
157
|
-
// component. If it is nested, we can still get
|
|
157
|
+
// component, or its value is missing. If it is nested, we can still get
|
|
158
|
+
// the value from the root, or `undefined` if it's missing there too.
|
|
158
159
|
this.nested
|
|
159
|
-
? getValueAtDataPath(this.rootItem, this.dataPath)
|
|
160
|
+
? getValueAtDataPath(this.rootItem, this.dataPath, () => undefined)
|
|
160
161
|
: undefined
|
|
161
162
|
)
|
|
162
163
|
}
|