@ditojs/admin 3.1.3 → 3.2.1

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.
@@ -1,7 +1,7 @@
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,ee,_,te,ne,re,ie,ae,oe,se,ce,le,ue,de,fe,pe,me,he,ge,_e){var ve=Object.create,ye=Object.defineProperty,be=Object.getOwnPropertyDescriptor,xe=Object.getOwnPropertyNames,Se=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty,we=(e,t)=>{let n={};for(var r in e)ye(n,r,{get:e[r],enumerable:!0});return t||ye(n,Symbol.toStringTag,{value:`Module`}),n},Te=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=xe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Ce.call(e,s)&&s!==n&&ye(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=be(t,s))||r.enumerable});return e},v=(e,t,n)=>(n=e==null?{}:ve(Se(e)),Te(t||!e||!e.__esModule||!Ce.call(e,`default`)?ye(n,`default`,{value:e,enumerable:!0}):n,e));n=v(n,1),i=v(i),l=v(l,1),u=v(u),ge=v(ge),_e=v(_e);function Ee(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 De=(0,e.reactive)({title:``,routeComponents:[],user:null,agent:Ee(navigator.userAgent||``),loadCache:{},activeLabel:null,clipboardData:null});function y(e,t){return e?`${e}/${t}`:t}function Oe(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 ke(e){let t=(0,r.parseDataPath)(e);return t?.pop(),t}function Ae(e){return(0,r.normalizeDataPath)(ke(e))}function je(e,t=!1){return t?ke(e):(0,r.parseDataPath)(e)}function Me(e,t=!1){return(0,r.normalizeDataPath)(je(e,t))}function Ne(e,t=!1){let n=je(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 Pe(e,t=!1){return(0,r.normalizeDataPath)(Ne(e,t))}function Fe(e,t,n=!1){let i=je(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Ie(e,t,n=!1){let i=Ne(t,n);return i?(0,r.getValueAtDataPath)(e,i):null}function Le(e){let t=(0,r.parseDataPath)(e);return t[t.length-1]}function Re(e){let t=Le(e);return t==null||(0,r.isInteger)(+t)?null:t}function ze(e){let t=Le(e),n=t==null?null:+t;return(0,r.isInteger)(n)?n:null}var Be=0;function Ve(e,t=`id`){e[t]=`@${++Be}`}function He(e){return/^@/.test(e)}function Ue(e,t=`id`){return e?.[t]!=null&&Object.keys(e).length===1}var We={},Ge={};function Ke(e,t){We[e]=t}function qe(e,t=!1){let n=We[e]||null;if(!n&&!t&&!Ge[e])throw Ge[e]=!0,Error(`Unknown Dito.js component type: '${e}'`);return n}function Je(e){return(0,r.isObject)(e)?e.type:e}function b(e){return qe(Je(e),!0)??null}function Ye(e){return b(e)?.getSourceType?.(Je(e))??null}function Xe(e,t){for(let n of e)if(lt(n)){let e=t(n.component,n.name,0);if(e!==void 0)return e}else if(x(n))for(let[e,r]of Object.entries(n.components||{})){let n=t(r,e,1);if(n!==void 0)return n}}function Ze(e,t){return e?Xe([e,...mt(e)],t):void 0}function Qe(e,t){return Ze(e,e=>t(e)?e:void 0)??null}function $e(e,t){return Ze(e,(e,n)=>t(e,n)?!0:void 0)??!1}function et(e){return $e(e,()=>!0)??!1}function tt(e,t){return!!Ze(e,(e,n)=>{if(S(e)?n===t:tt(e,t))return!0})}function x(e){return(0,r.isObject)(e)&&(0,r.isString)(e.type)}function nt(e){return x(e)&&e.type===`form`}function rt(e){return x(e)&&e.type===`view`}function it(e){return x(e)&&e.type===`tab`}function at(e){return x(e)&&e.type===`panel`}function ot(e){return at(e)&&!!e.data}function st(e){return x(e)&&e.type===`menu`}function ct(e){return JSON.stringify(e)}function lt(e){return rt(e)&&(0,r.isObject)(e.component)}function ut(e){return!!e.compact}function dt(e){return!!(e.inlined||e.components)}function S(e){return!!(e.nested||b(e)?.defaultNested===!0)}function ft(e,t){let{label:n}=e;return n!==!1&&(!!n||t&&b(e)?.generateLabel)}function pt(e){return!!b(e)?.omitSpacing}function mt(e){return e?.tabs?Object.values(e.tabs):[]}function ht(e){return e?.panels?Object.values(e.panels):[]}function C(e){return Ye(e)===`object`}function w(e){return Ye(e)===`list`}function gt(e){return!!Ye(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=S(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=S(t),i=!!this.schema&&S(this.schema);return e.createForSchema(this.component,{schema:t,name:n,nested:r,data:i?this.item?.[this.name]:this.item,dataPath:r?y(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`,()=>Re(this.dataPath))}get index(){return T(this,`index`,()=>ze(this.dataPath))}get itemDataPath(){return Me(this.dataPath,this.nested)}get parentItemDataPath(){return Pe(this.dataPath,this.nested)}get itemIndex(){return ze(this.itemDataPath)}get parentItemIndex(){return ze(this.parentItemDataPath)}get item(){return T(this,`data`,()=>Fe(this.rootItem,this.dataPath,this.nested)||null)}get parentItem(){let e=Ie(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||He(n))){He(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 x(e)&&((0,r.isObject)(e.form||e.forms||e.components)||(0,r.isFunction)(e.components))}function Mt(e){return x(e)&&Object.keys(e?.forms||{}).length>1}function Nt(e,t){let{view:n}=e,r=n&&t.flattenedViews[n];return r&&Qe(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?lt(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 Kn(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 Ut(e){return k(e,{type:`button`})}function Wt(e,t,n,r){return e?{schema:e,dataPath:t,componentPath:n,tabComponent:r}:null}function Gt(e,t,n,r=null,i=[]){if(e)for(let[a,o]of Object.entries(e)){let e=Wt(o,y(t,a),y(n,a),r);e&&i.push(e)}return i}function Kt(e,t,n,r,i,a=null,o=null){let s=b(t)?.getPanelSchema?.(e,t,n,a),c=s?[Wt(s,y(n,s.name),y(r,s.name),o)]:[];return Gt(t?.panels,n,i,o,c),c}function A(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 qt(e,t){return A(`if`,{type:Boolean,schema:e,context:t,default:!0})&&(!et(e)||!!Ye(e)||$e(e,(e,n)=>qt(e,t.createChildContext(e,n))))}function j(e){return(0,r.isFunction)(e)?e():e}function Jt(e,t){let n=e.default===void 0?b(e)?.defaultValue:e.default;return(0,r.isFunction)(n)?n(j(t)):(0,r.clone)(n)}function Yt(e,t){let n=e.exclude===void 0?b(e)?.excludeValue:e.exclude;return(0,r.isFunction)(n)?n(j(t)):!!n}function Xt(e,t){return!!b(e)?.ignoreMissingValue?.(j(t))}function Zt(e,t,n,r){return!(n in t)||!!b(e)?.treatNullAsMissing?.(j(r))&&t[n]===null}function Qt(e){return!!b(e)?.valueFromDataSchema&&!!(e.data||e.dataPath)}function $t(e){return e.multiple??!!b(e)?.defaultMultiple}function en(e,t,n,r,{shouldSetDefaultsOfComponentsWithCompute:i=!0}={}){return(i||!e.compute)&&Zt(e,t,n,r)&&!Xt(e,r)}function tn(e,t={},n,{dataPath:i=null,rootData:a=t,shouldProcess:o,shouldSkipSourcesWithResource:s=!1,shouldSetDefaultsOfComponentsWithCompute:c=!0}={}){return M(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});en(e,t,i,s,{shouldSetDefaultsOfComponentsWithCompute:c})&&(t[i]=Jt(e,s)),ln(e)&&(0,r.isArray)(t[i])&&un(e,t[i])},shouldProcess:o,shouldSkipSourcesWithResource:s,options:{component:n,rootData:a}})}function nn(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&&A(`if`,{type:Boolean,schema:e,context:j(s),default:!0})){let e=c(j(s));if(e!==void 0)return e}return rn(e,t,n,s)}function rn(e,t,n,r){return Zt(e,t,n,r)&&!Xt(e,r)?Jt(e,r):t[n]}function an(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 on(e,t,n,i,{component:a,rootData:o,schemaOnly:s,target:c,shouldCallComputeAndProcess:l=!0}={}){let u={component:a,rootData:o,schemaOnly:s,target:c},d=an(t,n,u),f=new Tt;return M(e,n,{dataPath:i,processedData:d,before:({schema:e,data:t,name:n,dataPath:i,processedData:o})=>{let s=l?nn(e,t,n,i,u):rn(e,t,n,()=>new E(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=b(e)?.processValue;m&&(d=m(j(p),f)),c&&l&&(d=c(j(p))),(!c||l)&&Yt(e,p)?delete o[n]:o[n]=d},options:u}),f.process(t,d,u)}function M(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:y(e,t),m=(e,i)=>{if(e)for(let[m,g]of Object.entries(e)){let e=S(g),ee=e&&m!==o?p(n,m):n,_={schema:g,data:t,name:m,dataPath:ee,componentPath:y(i,m),processedData:a};if(l(_)){if(u&&gt(g)){h(g.panels,_.componentPath);continue}if(!ot(g)){if(!e)M(g,t,{...f,dataPath:n,componentPath:_.componentPath,processedData:a});else{let{wrapPrimitives:e}=g,n=(n,i=null)=>{e&&!(0,r.isObject)(n)&&(n={[e]:n});let o=i===null?ee:p(ee,i),s=i===null?_.componentPath:y(_.componentPath,i),c=new E(d.component,{schema:g,data:t,dataPath:ee,name:m,rootData:d.rootData}),l=Bt((b(g)?.getFormSchemasForProcessing||O)(g,c),n);if(l){let t=a?an(g,n,d):null;return M(l,n,{...f,dataPath:o,componentPath:s,processedData:t,wrappedPrimitiveName:e??null})}return{...n}};if(s?.(_),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?.(_),h(g.panels,_.componentPath)}}}}},h=(e,r)=>{for(let[i,o]of Object.entries(e||{})){let e={schema:o,data:t,name:null,dataPath:n,componentPath:y(r,i),processedData:a};l(e)&&!ot(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 sn(e,t,n,{componentPath:r=``,component:i=null,rootData:a=t}={}){let o={dataPath:``,componentPath:r};t&&M(e,t,{dataPath:``,componentPath:r,shouldProcess:e=>Oe(n,e.dataPath)!==null,before:e=>{e.dataPath.length>o.dataPath.length&&(o=e)},options:{component:i,rootData:a}});let s=Oe(n,o.dataPath);return s?y(o.componentPath,s):o.componentPath}function cn(e,t){let n=t[e.idKey||`id`];return n==null?void 0:String(n)}function ln(e){return!!e.orderKey&&!e.wrapPrimitives}function un(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 dn(e,t){return wt(t,t=>cn(e,t))}var fn={computed:{value:{get(){let e=nn(this.schema,this.data,this.name,this.dataPath,{component:this}),{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}}}},N={computed:{context(){return new E(this,{nested:this.nested})},parentData(){let e=Ie(this.rootData,this.dataPath,this.nested);return e===this.data?null:e},processedData(){return pn(this,this.dataPath,this.nested)},processedRootData(){return pn(this,``,!1)},item(){return this.data},parentItem(){return this.parentData},rootItem(){return this.rootData},processedItem(){return this.processedData},processedRootItem(){return this.processedRootData}}};function pn(e,t,n=!1){let{schemaComponent:r}=e;for(;r.dataPath.length>t.length;)r=r.parentSchemaComponent;return Fe(r.processedData,t.slice(r.dataPath.length),n)}var mn={validate:e=>(0,r.isCreditCard)(e),message:`is invalid`},hn={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`},gn={validate:e=>(0,r.isEmail)(e),message:`must be a valid email`},_n={validate:e=>(0,r.isHostname)(e),message:`is not a host name`},vn={validate:e=>(0,r.isDomain)(e),message:`is not a domain`},yn={validate:e=>(0,r.isInteger)(e),message:`must be whole number`},bn={validate:(e,t)=>e<=t,message(e,t){return`must be ${t} or less`}},xn={validate:(e,t)=>e>=t,message(e,t){return`must be ${t} or more`}},Sn={validate:()=>!0},Cn={validate:(e,[t,n])=>e>=t&&e<=n,message(e,[t,n]){return`must be between ${t} and ${n}`}},wn={validate:(e,t,{password:n})=>e!=null&&e!==``||n&&e===void 0,message:`is required`},Tn={validate:e=>(0,r.isUrl)(e),message:`is not a valid URL`},En=we({creditcard:()=>mn,decimals:()=>hn,domain:()=>vn,email:()=>gn,hostname:()=>_n,integer:()=>yn,max:()=>bn,min:()=>xn,password:()=>Sn,range:()=>Cn,required:()=>wn,url:()=>Tn});function Dn(e,t){let n={...b(e)?.getTypeValidations?.(e,t)};A(`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 On(e,t){let n=[];for(let[i,a]of Object.entries(t)){let o=En[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 kn(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 M(e,t,{dataPath:n,shouldProcess:e=>qt(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=Dn(t,c),f=On(l,d);f.length>0&&(o||={},o[a]=f)},options:{component:i,rootData:a}}),o}function An(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 jn={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=On(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 P(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 Mn(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 Nn={mixins:[fn,N,jn],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},formModel(){return(this.dialogComponent??this.routeComponent).formModel},type(){return this.schema.type},labelNode(){let e=this.isMounted?this.$el.previousElementSibling:null;return e?.matches(`.dito-label`)?e:null},visible:P(`visible`,{type:Boolean,default(){return this.$options.defaultVisible}}),exclude:P(`exclude`,{type:Boolean,default:!1}),required:P(`required`,{type:Boolean,default:!1}),readonly:P(`readonly`,{type:Boolean,default:!1}),autofocus:P(`autofocus`,{type:Boolean,default:!1}),clearable:P(`clearable`,{type:Boolean,default:!1,get(e){return e&&!this.readonly}}),disabled:P(`disabled`,{type:Boolean,default:!1}),maxLength:P(`maxLength`,{type:Number}),placeholder:P(`placeholder`,{type:String}),autocomplete:P(`autocomplete`,{type:String}),info:P(`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 Dn(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()},unmounted(){this._register(!1)},methods:{_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})}}},Pn=new WeakMap;async function F(e,t=!1){if(Pn.has(e))return Pn.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 Pn.set(e,n),n}async function Fn(e,t=F){let n=(0,r.isFunction)(e)?e():e;return n=await F(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 In(e){return Fn(e,async(e,t)=>(e=await F(e,t),!e.name&&st(e)&&(e={...e,name:(0,r.camelize)(e.label),items:await Fn(e.items)}),e))}function Ln(e){return Object.fromEntries(Object.entries(e).reduce((e,[t,n])=>(st(n)?e.push(...Object.entries(n.items)):e.push([t,n]),e),[]))}async function Rn(t){let{component:n}=t;n&&(n=await F(n,!0),n&&(t.component=(0,e.markRaw)({...n,mixins:[Qn,Nn,...n.mixins||[]]})))}async function zn(e){await(0,r.mapConcurrently)(Object.values(e||{}),Rn)}var Bn=new WeakMap;function I(e,t,n=null,r=0,i=1){if(t){let a=Bn.get(t)??0;if(a<i){Bn.set(t,a+1);let i=[],o=(t,a,o)=>{i.push(Vn(e,t,a,n,r+o))};return Ze(t,o),Xe(ht(t),o),Promise.all(i)}}}function Vn(e,t,n,i=null,a=0){return L(e,t),Promise.all([(0,r.mapConcurrently)(ht(t),t=>I(e,t,i,a)),b(t)?.processSchema?.(e,t,n,i,a)])}async function Hn(e,t,n,r,i=``){L(t,n),Wn(t,n,r,i);let a=[];if(rt(n))await Yn(t,n),await I(t,n,a);else if(st(n))a=await Promise.all(Object.entries(n.items).map(async([r,i])=>Hn(e,t,i,r,n.fullPath)));else throw Error(`Invalid view schema: '${ct(n)}'`);return{path:n.fullPath,children:a,component:e,meta:{api:t,schema:n}}}function L(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 Un(e,t){Ze(t,t=>{L(e,t);let n=O(t);for(let t of Object.values(n))Un(e,t)})}function Wn(e,t,n,r=null){t.name??=n,t.path??=e.normalizePath(n),r!==null&&(t.fullPath=`${r}/${t.path}`)}async function Gn(e,t,n){let i=[],{form:a,forms:o,components:s,maxDepth:c=1}=t;return o?t.forms=await Fn(o,t=>Kn(e,t,i,n,c)):a?t.form=await Kn(e,a,i,n,c):(0,r.isObject)(s)&&await Kn(e,{type:`form`,components:s},i,n,c),i}async function Kn(e,t,n=null,r=0,i=1){if(t=await F(t,!0),!nt(t))throw Error(`Invalid form schema: '${ct(t)}'`);return L(e,t),await Yn(e,t),await I(e,t,n,r,i),t}async function qn(e,t){if(t=await F(t,!0),!it(t))throw Error(`Invalid tab schema: '${ct(t)}'`);return L(e,t),t}async function Jn(e,t){if(t=await F(t,!0),!at(t))throw Error(`Invalid panel schema: '${ct(t)}'`);return L(e,t),t}async function Yn(e,t){let{tabs:n,panels:r}=t;n&&(t.tabs=await Fn(n,t=>qn(e,t))),r&&(t.panels=await Fn(r,t=>Jn(e,t)))}function Xn(e){return!!R(e.resource)}function R(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 Zn(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 Qn={mixins:[xt],inject:[`api`,`$verbs`,`$views`,`$isPopulated`,`$parentComponent`,`$schemaComponent`,`$routeComponent`,`$dataComponent`,`$sourceComponent`,`$resourceComponent`,`$dialogComponent`,`$panelComponent`,`$tabComponent`],provide(){let e=()=>this;return this.providesData?{$parentComponent:e,$dataComponent:e}:{$parentComponent:e}},data(){return{appState:De,isMounted:!1,overrides:null}},computed:{providesData(){return!1},sourceSchema(){return this.meta?.schema},user(){return De.user},verbs(){return this.$verbs()},views(){return this.$views()},flattenedViews(){return Ln(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 er(this,`schemaComponent`)},parentRouteComponent(){return er(this,`routeComponent`)},parentFormComponent(){return er(this,`formComponent`)},parentResourceComponent(){return er(this,`resourceComponent`)},rootData(){return this.dataComponent?.data}},mounted(){this.isMounted=!0},beforeCreate(){let e=$n++;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 A(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 qt(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=R(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,Zn(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=Oe(this.dataPath,e?.dataPathForComponentPath);return n?y(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.$nextTick(s):s()}},emitSchemaEvent(e,t){return this.schemaComponent.emitEvent(e,t)}}},$n=0;function er(e,t){let n=e[t],r=e.parentComponent;for(;r&&r[t]===n;)r=r.parentComponent;return r?.[t]??null}function tr(e){let{mixins:t}=e;return t||e.extends?nr({...e},e):e}function nr(e,t){if(t.extends&&nr(e,t.extends),t.mixins)for(let n of t.mixins)nr(e,n);for(let n of rr)n in t&&(e[n]=t[n]);return e}var rr=[`defaultValue`,`defaultNested`,`defaultVisible`,`generateLabel`,`excludeValue`,`ignoreMissingValue`,`treatNullAsMissing`,`valueFromDataSchema`,`omitSpacing`,`processValue`,`getTypeValidations`,`processSchema`,`getPanelSchema`,`getFormSchemasForProcessing`,`beforeRouteUpdate`,`beforeRouteLeave`],ir={},z={mixins:[Qn],components:ir,component(e,t){if(t&&((0,r.isPlainObject)(t)&&(t=tr({extends:this,name:e,...t})),ir[e]=t),!(e in ir))throw Error(`Component "${e}" not registered`);return ir[e]},methods:{getTypeComponent:qe}};function ar(t){return t&&(0,r.asArray)(t).some(t=>t.type!==e.Comment)}function B(t,n={}){return t=(0,r.isString)(t)?(0,e.useSlots)()[t]:t,ar(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 B(this.$slots.prefix)||B(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),{immediate:!0}),this.dataEntries=(0,e.computed)(()=>this.getDataEntries()),(0,e.watch)(()=>this.dataEntries.value.computedValueEntries,e=>this.updateComputedValueRecords(e),{immediate:!0}),(0,e.watch)(()=>this.dataEntries.value.entriesWithMissingValues,e=>this.setDefaultValues(e),{immediate:!0}),i&&(0,e.watch)(r,()=>this.takeProcessedDataSnapshot().catch(console.error),{immediate:!0})})}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)?on(e,this.getSourceSchema(),t,this.dataPath,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,schemaOnly:!0,target:`clipboard`,shouldCallComputeAndProcess:!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)&&tn(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)&&M(e,t,{dataPath:this.dataPath,componentPath:this.componentPath,shouldProcess:e=>this.isEntryShown(e),shouldSkipSourcesWithResource:!0,before:e=>{Wi(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||A(`if`,{type:Boolean,schema:e.schema,context:this.createEntryContext(e),default:!0})}shouldSetDefaultValue(e){let{schema:t,data:n,name:r}=e;return en(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]=Jt(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?{value:this.getComputedValue(t)}:null,e=>{e&&this.writeComputedValue(t,e.value)},{immediate:!0}),Qt(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)},{immediate:!0})}}),n}isEntryCurrent({componentPath:e,schema:t,data:n}){let r=this.dataEntries.value.computedValueEntries.get(e);return r?.schema===t&&r.data===n}getComputedValue(e){let{schema:t,data:n,name:r,dataPath:i}=e;return nn(t,n,r,i,{component:this.component.mainSchemaComponent??this.component,rootData:this.rootData,getOptions:t.options?()=>this.getOptions(e):null})}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(S(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`);function Wi(e){return!!e.compute||Qt(e)}var Gi=[`data-resource`];function Ki(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,Gi)):((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,routeLevel:t.routeLevel+1},null,8,[`routeLevel`]))],64)):(0,e.createCommentVNode)(``,!0)}var qi=V(z.component(`DitoView`,{mixins:[Li],provide(){return{$sourceComponent:()=>this.mainComponent?.sourceComponent||null,$resourceComponent:()=>this.mainComponent?.resourceComponent||null}},data(){return{isLoading:!1,data:{}}},computed:{schema(){return this.meta.schema??{}},name(){return this.schema.name},isView(){return!0},isSingleComponentView(){return lt(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 $e(this.viewSchema,Xn)}},watch:{$route:{flush:`post`,handler(e,t){this.isFullRouteChange(e,t)&&(this.isLoading=!1,this.data={})}}},created(){this.formModel=new Bi({component:this,getSchema:()=>this.viewSchema,getData:()=>this.data})},mounted(){this.shouldRenderSchema(this.viewSchema)||this.$router.replace({path:`/`})},beforeUnmount(){this.formModel.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`,Ki]]);function Ji(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 Yi=(0,e.defineComponent)((t,{slots:n})=>{let r=(0,e.shallowRef)(),i=(0,e.reactive)(Ji(r,t.options));return()=>{if(n.default)return(0,e.h)(t.as||`div`,{ref:r},n.default(i))}},{name:`UseFocusTrap`,props:[`as`,`options`]}),Xi=[`aria-label`];function Zi(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,Xi)}var Qi=V(z.component(`DitoDialog`,{mixins:[G],components:{UseFocusTrap:Yi},emits:[`remove`],provide(){return{$dialogComponent:()=>this}},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:{dialogComponent(){return this},schema(){return{type:`dialog`,components:this.components}},buttonSchemas(){return Object.fromEntries(Object.entries(Ut(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.formModel=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.formModel.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.formModel),this.resolve(this.dialogData)},cancel(){this.resolve(void 0)},close(){this.cancel()},onMouseUp(){this.settings.clickToClose&&this.close()}}}),[[`render`,Zi]]),$i=[`data-agent-browser`,`data-agent-platform`,`data-agent-version`],ea={key:0,class:`dito-drag-overlay`};function ta(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`,ea)):(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,$i)}var na=z.component(`DitoRoot`,{mixins:[G],components:{DitoDialog:Qi},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 I(this.api,{type:`dialog`,components:e},o,0),o.length>0)throw Error(`Dialogs do not support components that produce routes`);let s=`dialog-${++ra}`;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 In(this.unresolvedViews)}catch(e){return e.request||console.error(e),this.login()}let e=await(0,r.mapConcurrently)(Object.entries(this.resolvedViews),([e,t])=>Hn(qi,this.api,t,e)),{fullPath:t}=this.$route;this.removeRoutes?.(),this.removeRoutes=ia(this.$router,[{name:`root`,path:`/`,components:{}},...e.flat()]),this.$router.replace(t)},onResizePage({contentRect:{width:e}}){this.pageWidth=e}}}),ra=0;function ia(e,t){let n=[];for(let r of t)n.push(e.addRoute(r));return()=>{for(let e of n)e()}}var aa=V(na,[[`render`,ta]]),oa={class:`dito-menu__item`},sa=[`href`,`aria-current`,`onClick`];function ca(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`,oa,[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,sa),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 la=V(z.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`,ca]]),ua={class:`dito-trail`,"aria-label":`Breadcrumb`},da=[`aria-current`,`href`,`onClick`];function fa(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,ua,[(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,da)]))),256))]),(0,e.renderSlot)(t.$slots,`default`)])}var pa=V(z.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`,fa]]),ma=[`aria-busy`];function ha(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,ma)}var ga=V(z.component(`DitoHeader`,{props:{spinner:{type:Object,default:null},isLoading:{type:Boolean,default:!1}}}),[[`render`,ha]]),_a={class:`dito-navigation dito-scroll-parent`,"aria-label":`Main navigation`};function va(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`,_a,[(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 ya=V(z.component(`DitoNavigation`,{}),[[`render`,va]]),ba={class:`dito-notifications`,"aria-live":`polite`},xa={class:`dito-notifications__inner`};function Sa(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`VueNotifications`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,ba,[n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-header`},[(0,e.createElementVNode)(`span`)],-1),(0,e.createElementVNode)(`div`,xa,[(0,e.createVNode)(s,{ref:`notifications`,classes:`dito-notification`,dangerouslySetInnerHtml:!0,position:``,width:``},null,512)])])}var Ca=V(z.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`,Sa]]),wa={class:`dito-header`};function Ta(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`,wa,[(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 Ea=V(z.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`,Ta]]),Da={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))}}},Oa={class:`dito-account`},ka=[`onMousedown`,`onMouseup`];function Aa(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Oa,[(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,ka)]))),256))],2)])}var ja=V(z.component(`DitoAccount`,{mixins:[Da],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`,Aa]]);function Ma(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 Na=V(z.component(`DitoSpinner`,{props:{loading:{type:Boolean,default:!0},color:{type:String,default:null},size:{type:String,default:null},margin:{type:String,default:null}}}),[[`render`,Ma]]);function Pa(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 Fa=V(z.component(`DitoAffix`,{components:{DitoSpinner:Na,DitoIcon:Qr},props:{item:{type:Object,required:!0},parentContext:{type:Object,required:!0}},computed:{context(){return this.parentContext}}}),[[`render`,Pa]]),Ia=[`disabled`],La=[`data-info`];function Ra(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,Ia)):(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,La)):(0,e.createCommentVNode)(``,!0)],2)):(0,e.createCommentVNode)(``,!0)}var K=V(z.component(`DitoAffixes`,{components:{DitoAffix:Fa},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=>qt(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||B(this.$slots.prepend)||B(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`,Ra]]),za={key:1,class:`dito-label__inner`},Ba=[`for`,`innerHTML`],Va=[`data-info`];function Ha(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`,za,[(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,Ba)):(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,Va)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)]),_:1},16,[`type`,`class`])):(0,e.createCommentVNode)(``,!0)}var Ua=V(z.component(`DitoLabel`,{components:{DitoAffixes:K},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`,Ha]]),Wa={methods:{getItemFormSchema:Vt,getItemUid:dn,getItemId(e,t,n=null){return this.isTransient&&n!==null?String(n):cn(e,t)},getItemDataPath(e,t){let{dataPath:n}=this;return e!==this.schema&&(n=y(n,e.name)),t!=null&&(n=y(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}}},Ga={key:0,class:`dito-schema-header`};function Ka(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`,Ga,[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 qa=z.component(`DitoSchema`,{mixins:[N,Wa],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 Gt(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!at(this.schema)&&!this.inlined},hasTopLevelTabs(){return this.hasTabs&&this.isTopLevelSchema},hasMainPane(){let{components:e}=this.schema;return!!e&&Object.keys(e).length>0},opened:Mn(`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:P(`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?kn(this.schema,this.data,{dataPath:this.dataPath,component:this,rootData:this.rootData}):null,r=e?An(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?y(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(Ja(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
- `)),!n},notifyErrors(e){this.notify({type:`error`,title:`Validation Errors`,text:e||`Please correct the highlighted errors.`})},resetData(){Object.assign(this.data,tn(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 on(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 Ja(e[(0,r.normalizeDataPath)(t)]||[])},_getEntriesByName(e,t){return Ja(e[y(this.dataPath,t)]||[])}}});function Ja(e){return e.length>1?[...e].sort(Ya):e}function Ya(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 Xa=V(qa,[[`render`,Ka]]);function Za(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 Qa=V(z.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 ut(this.schema)},hasLabel(){return!this.isCompact&&!!this.label}}}),[[`render`,Za]]),$a=[`id`,`role`,`aria-labelledby`],eo={key:0,class:`dito-pane__break`},to={key:2,class:`dito-pane__break`};function no(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`,eo)):(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`,to)):(0,e.createCommentVNode)(``,!0)],64))),256))],10,$a)),[[c,t.onResizePane]]):(0,e.createCommentVNode)(``,!0)}var ro=V(z.component(`DitoPane`,{mixins:[N],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?y(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=S(n),i=y(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 qt(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`,no]]);function io(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 ao(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 oo=V(z.component(`DitoContainer`,{mixins:[fn,N],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 y(this.parentComponent.componentPath,this.name)},type(){return this.schema.type},typeComponent(){return qe(this.type)},isLabel(){return this.type===`label`},hasLabel(){return ft(this.schema,this.generateLabels)},label(){return this.hasLabel?this.getLabel(this.schema):null},labelHtmlFor(){return this.nested?this.componentPath:null},info:P(`info`,{type:String,default:null}),width:P(`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:P(`width`,{type:String,get(e){return(0,r.isString)(e)&&e.match(/^\s*([<>]?)/)[1]||null}}),componentVisible:P(`visible`,{type:Boolean,default(){return this.typeComponent?.defaultVisible}}),componentDisabled:P(`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:io(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`]:pt(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 Kt(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`,ao]]),so={class:`dito-tabs`,role:`tablist`},co=[`id`,`aria-selected`,`aria-controls`,`tabindex`,`onClick`];function lo(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,so,[((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,co))),128))])}var uo=V(z.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`,lo]]);function fo(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 po=V(z.component(`DitoPanel`,{mixins:[N,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 Ut(this.schema.buttons)},panelButtonSchemas(){return Ut(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:P(`visible`,{type:Boolean,default:!0}),sticky:P(`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`,fo]]),mo={key:0,class:`dito-panels`};function ho(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoPanel`);return t.panels.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,mo,[((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 go=V(z.component(`DitoPanels`,{mixins:[N],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`,ho]]),_o={key:0,class:`dito-buttons`},vo={key:0,class:`dito-container`};function yo(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`,_o,[((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`,vo,[(0,e.createVNode)(c,{vnode:n},null,8,[`vnode`])])):(0,e.createCommentVNode)(``,!0)],64))),256))])):(0,e.createCommentVNode)(``,!0)}var bo=V(z.component(`DitoButtons`,{mixins:[N],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 y(this.continueParentComponentPath(),`$${this.buttonsName}`)},buttonSchemas(){let{dataPath:e,buttons:t}=this;return t?Object.values(t).reduce((t,n)=>(t[y(e,n.name)]=n,t),{}):null}},methods:{hasSlotContent:B,hasVNodeContent:ar}}),[[`render`,yo]]),xo=[`disabled`];function So(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,xo)):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`buttons`,`dataPath`,`data`,`meta`,`store`,`nested`])}var Co=V(z.component(`DitoEditButtons`,{mixins:[N],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`,So]]),wo={class:`dito-create-button`},To=[`type`,`disabled`],Eo=[`disabled`],Do=[`onMousedown`,`onMouseup`];function Oo(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,wo,[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,To)):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,Eo),(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,Do)],512)),[[e.vShow,t.shouldShowSchema(n)]])),256))],2)],64)):(0,e.createCommentVNode)(``,!0)])}var ko=V(z.component(`DitoCreateButton`,{mixins:[N,Da],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 dt(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`,Oo]]),Ao={key:0,class:`dito-clipboard dito-buttons dito-buttons--round`},jo=[`disabled`],Mo=[`disabled`];function No(t,n,r,i,a,o){return t.clipboard?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ao,[(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,jo),(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,Mo)])):(0,e.createCommentVNode)(``,!0)}var Po=V(z.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`
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&&gt(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},formModel(){return(this.dialogComponent??this.routeComponent).formModel},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.formModel.hasComputedValueEntry(this.componentPath)&&console.warn(`The value of the component at '${this.componentPath}' isn't computed, as its data isn't part of a form 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`,`$panelComponent`,`$tabComponent`],provide(){let e=()=>this;return this.providesData?{$parentComponent:e,$dataComponent:e}:{$parentComponent:e}},data(){return{appState:Ee,isMounted:!1,overrides:null}},computed:{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.$nextTick(s):s()}},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}},data(){return{isLoading:!1,data:{}}},computed:{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.formModel=new Bi({component:this,getSchema:()=>this.viewSchema,getData:()=>this.data})},mounted(){this.shouldRenderSchema(this.viewSchema)||this.$router.replace({path:`/`})},beforeUnmount(){this.formModel.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}},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:{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.formModel=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.formModel.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.formModel),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
+ `)),!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}
5
- `))}return this.checkClipboardData(t)},updateCopy(){this.copyEnabled=this.parentComponent.hasData},async updatePaste(){if(this.pasteEnabled=!!this.checkClipboardData(this.appState.clipboardData),!this.pasteEnabled&&this.appState.agent.chrome){let e=await this.getClipboardData(!1);this.pasteEnabled=!!e}},async onCopy(){let e=this.parentComponent.clipboardData;try{e&&={$schema:this.schema.name,...this.copyData(e)},this.appState.clipboardData=e,this.pasteEnabled=!0;try{let t=JSON.stringify(e,null,2);await navigator.clipboard?.writeText?.(t)}catch(e){console.error(e,e.name,e.message)}}catch(e){console.error(e),alert(e.message)}},async onPaste(){let e=await this.getClipboardData(!0);try{e&&=this.pasteData(e),e&&(this.parentComponent.clipboardData=e)}catch(e){console.error(e),alert(e.message)}}}}),[[`render`,No]]);function Fo({routeLevel:n}){return(0,e.h)(t.RouterView,null,{default:({Component:t,route:r})=>t?(0,e.h)(t,{key:r.matched[n]?.path}):null})}Fo.props={routeLevel:{type:Number,required:!0}};var Io=z.component(`DitoRouterView`,Fo),Lo={mixins:[Wa,{data(){return{isLoading:!1}},methods:{setLoading(e,{updateRoot:t=!1,updateView:n=!1}={}){!this.isLoading^!e&&(this.isLoading=!!e,t&&this.rootComponent.registerLoading(e),n&&this.viewComponent.setLoading(this.isLoading))}}}],provide(){return{$resourceComponent:()=>this,$verbs:()=>this.verbs,$isPopulated:()=>this.hasData}},data(){return{loadedData:null,abortController:null}},computed:{resourceComponent(){return this},resource(){return this.getResource()},providesData(){return!!this.resource},linksToView(){return!1},isTransient(){let e=this.formComponent;return!this.providesData&&!this.linksToView||e&&(e.isTransient||e.isCreating)},transientNote(){return this.isTransient&&`<b>Note</b>: the parent still needs to be saved in order to persist this change.`},shouldLoad(){return!this.isTransient&&!this.isLoading},hasData(){return!!this.loadedData},verbs(){return this.getVerbs()},paginationRange(){let{paginate:e}=this.sourceSchema;if(this.isListSource&&e){let{page:t=0}=this.query||{},n=t*e;return[n,n+e-1]}return null},queryParams(){let e=this.paginationRange,{page:t,...n}=this.query||{};return{...n,...e&&{range:e.join(`,`)}}}},created(){(this.providesData||this.isCreating)&&this.setupData()},methods:{getResource({method:e=`get`,child:t}={}){let n=this.sourceSchema?.resource;return R(n,{type:`collection`,method:e,parent:this.parentResourceComponent?.getResource({method:e,child:n})??null,child:t})},getVerbs(){let e=this.$verbs();return this.isTransient?{...e,create:`add`,created:`added`,save:`apply`,saved:`applied`,delete:`remove`,deleted:`removed`}:e},clearData(){this.loadedData=null},setData(e){return this.loadedData=e,this.loadedData},setupData(){this.ensureData()},ensureData(){this.shouldLoad&&(this.hasData?this.reloadData():this.loadData(!0))},reloadData(){this.loadData(!1)},loadData(e){this.isTransient||(e&&this.clearData(),this.requestData())},createData(e,t){return tn(e,t?{type:t}:{},this)},requestData(){let e=this.queryParams;this.handleRequest({method:`get`,query:e},(e,t)=>{if(e){if(t){let{data:e}=t;if(e?.type===`FilterValidation`&&this.onFilterErrors?.(e.errors)||this.isUnauthorizedError(t))return!0}}else this.isForm&&this.isDirty||this.setData(t.data),this.emitSchemaEvent(`load`)})},isValidationError(e){return e?.status===400},isUnauthorizedError(e){return e?.status===401},async handleRequest({method:e,resource:t=this.getResource({method:e}),query:n,data:i},a){let o={updateRoot:!0,updateView:this.isInView};this.abortController?.abort();let s=new AbortController;this.abortController=s;let{signal:c}=s;e=t.method||e;let l={method:e,resource:t,query:n,data:i,signal:c};this.setLoading(!0,o);try{a(null,await this.sendRequest(l))}catch(e){if(e.name!==`AbortError`){let{response:t}=e;if(!a(e,t)){let n=t?.data,i=(0,r.isString)(n?.type)?(0,r.labelize)(n.type):`Error`,a=n?.message??e;this.notify({type:`error`,error:e,title:i,text:a})}}}this.abortController===s&&(this.abortController=null,this.setLoading(!1,o))},getPayloadData(e,t){return[`post`,`put`,`patch`].includes(t)&&(e.getSchemaValue([`resource`,`data`])||e.processedItem)},async submit(e){let{resource:t}=e.schema;if(t=R(t,{parent:this.getResource({method:t?.method,child:t})}),t){let{method:n}=t,r=this.getPayloadData(e,n);return this.submitResource(e,t,n,r)}return!1},async submitResource(e,t,n,i,{setData:a=!1,onSuccess:o,onError:s,notifySuccess:c=()=>this.notify({type:`success`,title:`Request Successful`,text:`Request was successfully sent.`}),notifyError:l=e=>this.notify({type:`error`,error:e,title:`Request Error`,text:[`Unable to send request${e?`:`:``}`,e?.message||e]})}={}){return new Promise(u=>{this.handleRequest({method:n,resource:t,data:i},async(t,n)=>{let i=n?.data;if(t){let a=this.isValidationError(n)&&i.errors;if(a)await this.showValidationErrors(a,!0);else{let n=(0,r.isObject)(i)?i:t;s?.(n),await this.emitButtonEvent(e,`error`,{notify:l,error:n})}u(!1)}else{if(a&&i){let{foreignData:e}=this.mainSchemaComponent.filterData(this.data),t=this.parentRouteComponent?.routeRecord?.meta;t&&(t.reload=!0),this.setData((0,r.assignDeeply)({},e,i))}o?.(),await this.emitButtonEvent(e,`success`,{notify:c}),u(!0)}})})},async emitButtonEvent(e,t,{notify:n,error:r}){let i=new E(e,{nested:!1,data:this.data,itemLabel:this.itemLabel,error:r}),a=await e.emitEvent(t,{context:i});return n&&a===void 0&&!i.wasNotified&&n(r),a}}};function Ro(e){return new URL(`file:${e}`).pathname}var zo=[`data-resource`],Bo={type:`submit`,disabled:``};function Vo(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoRouterView`),c=(0,e.resolveComponent)(`DitoButtons`),l=(0,e.resolveComponent)(`DitoSchema`),u=(0,e.resolveComponent)(`DitoFormInner`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-form dito-scroll-parent`,{"dito-form-nested":t.isNestedRoute}]),"data-resource":t.sourceSchema.path},[!t.isLastUnnestedRoute&&!t.isNestedRoute?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,routeLevel:t.routeLevel+1},null,8,[`routeLevel`])),[[e.vShow,!t.isActiveRoute]]):(0,e.createCommentVNode)(``,!0),(0,e.withDirectives)((0,e.createVNode)(u,{nested:t.isNestedRoute,label:t.itemLabel},{default:(0,e.withCtx)(()=>[(0,e.withDirectives)((0,e.createElementVNode)(`button`,Bo,null,512),[[e.vShow,!1]]),(0,e.createVNode)(l,{schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.isNestedRoute?`nested`:`root`,active:t.isActiveRoute,disabled:t.isLoading,scrollable:!t.isNestedRoute,generateLabels:``},{buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(c,{class:(0,e.normalizeClass)([`dito-buttons--round dito-buttons--large dito-buttons--main`,{"dito-buttons--sticky":!t.isNestedRoute}]),buttons:t.buttonSchemas,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:t.isLoading},null,8,[`class`,`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])]),_:1},8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`active`,`disabled`,`scrollable`])]),_:1},8,[`nested`,`label`]),[[e.vShow,t.isActiveRoute]])],10,zo)}var Ho=V(z.component(`DitoForm`,{mixins:[Li,Lo],data(){return{createdData:null,clonedData:void 0}},computed:{isForm(){return!0},verbs(){let e=this.getVerbs(),{isCreating:t,providesData:n}=this;return{...e,submit:t?e.create:e.save,submitted:t?e.created:e.saved,cancel:n?e.cancel:e.close,cancelled:n?e.cancelled:e.closed}},schema(){return this.getItemFormSchema(this.sourceSchema,this.data||(this.creationType?{type:this.creationType}:null),this.context)},buttonSchemas(){return Ut((0,r.assignDeeply)({cancel:{type:`button`,events:{click:()=>this.cancel()}},submit:!this.isMutating&&{type:`submit`,closeForm:!0,events:{click:({component:e})=>e.submit()}}},this.schema.buttons))},isActiveRoute(){return this.isLastRoute||this.isLastUnnestedRoute},isTransient(){return!this.providesData},isCreating(){return this.param===`create`},isDirty(){return!this.isMutating&&this.formModel.isDirty},isMutating(){return!!this.sourceSchema.mutate},selectedTab(){return this.mainSchemaComponent?.selectedTab||null},creationType(){return this.$route.query.type},itemId(){return this.isCreating?null:this.param??null},method(){return this.isCreating?`post`:`patch`},breadcrumbPrefix(){return(0,r.capitalize)(this.isCreating?this.verbs.create:this.verbs.edit)},data(){return this.createdData||this.loadedData||this.inheritedData||null},dataPath(){return this.getDataPathFrom(this.dataComponent)},componentPath(){let{parentRouteComponent:e}=this;return this.isTransient&&e?sn(e.isView?e.viewSchema:e.schema,e.data,this.getDataPathFrom(e),{componentPath:e.componentPath,component:this,rootData:this.rootData}):``},sourceLocation(){let e=this.isLeavingRoute?null:this.parentRouteComponent.data;if(!e)return null;let t=(0,r.parseDataPath)(this.getDataPathFrom(this.parentRouteComponent)),n=this.routeRecord.path.split(`/`),i=n.slice(n.length-t.length),a=t[t.length-1];C(this.sourceSchema)&&a===`create`&&t.length--;let o=null;for(let n=0,r=t.length;n<r&&e;n++){let a=t[n];o=/^:id/.test(i[n])?a===`create`?null:this.findItemIdIndex(this.sourceSchema,e,a):a,n<r-1&&(e=e[o])}return e?{data:e,key:o}:null},sourceData(){return this.sourceLocation?.data??null},sourceKey(){return this.sourceLocation?.key??null},sourceItem(){return this.sourceData&&this.sourceKey!==null?this.sourceData[this.sourceKey]:void 0},inheritedData(){return this.isTransient?this.isMutating?this.sourceItem:this.clonedData:void 0},hasData(){return!!this.data},itemLabel(){return this.getItemLabel(this.sourceSchema,this.data,{extended:!0})}},watch:{$route:{flush:`post`,handler(e,t){let n=this.meta?.param;n&&this.providesData&&t.matched[0].path===e.matched[0].path&&t.params[n]!==`create`&&e.params[n]!==t.params[n]&&this.loadData(!0)}},sourceItem:{immediate:!0,handler(e){this.isTransient&&(this.isMutating||(this.clonedData=(0,r.clone)(e)),e===null&&!this.isCreating&&C(this.sourceSchema)&&this.$router.push({path:`${this.path}/create`}))}},isCreating(e){e&&this.setupData()}},created(){this.formModel=new Bi({component:this,getSchema:()=>this.schema,getData:()=>this.data,getSourceSchema:()=>this.sourceSchema})},beforeUnmount(){this.formModel.stop()},methods:{emitSchemaEvent(e,t){return this.mainSchemaComponent?.emitEvent(e,t)},getDataPathFrom(e){return this.api.denormalizePath(this.path.slice((e.isView?0:e.path.length)+1))},getResource(e){let t=Lo.methods.getResource.call(this,e);return Zn(this.itemId,t)||t},setupData(){this.isCreating?this.createdData||=this.createData(this.schema,this.creationType):this.ensureData()},setSourceData(e){if(this.sourceData&&this.sourceKey!==null){let{mainSchemaComponent:t}=this;return this.sourceData[this.sourceKey]=t.filterData(e).localData,t.onChange(),!0}return!1},addSourceData(e){return C(this.sourceSchema)?this.setSourceData(e):!!this.sourceData?.push(e)},clearData(){this.setData(null)},setData(e){return this.isTransient?(this.setSourceData(e),this.sourceItem):(this.createdData=null,this.loadedData=e,this.data)},applyCleanChanges(e){return this.formModel.applyCleanChanges(e)},async cancel(){return this.close()},async close(){return this.navigate(this.parentRouteComponent.path)},getSubmitVerb(e=!0){return this.isCreating?e?`create`:`created`:e?`submit`:`submitted`},async submit(e,{validate:t=!0,closeForm:n=!1}={}){if(await this.waitForPendingLoadsOf(this.formModel),t&&!this.validateAll())return!1;let i=e=>this.verbs[this.getSubmitVerb(e)],{method:a}=this,o=this.getResource({method:a}),s=R(e.schema.resource,{parent:o});o=s||o,a=o?.method||a;let c=this.getPayloadData(e,a),l;if(l=!s&&this.isTransient?await this.submitTransient(e,o,a,c,{onSuccess:()=>this.emitSchemaEvent(this.getSubmitVerb()),onError:e=>this.emitSchemaEvent(`error`,{context:{error:e}}),notifySuccess:()=>{let e=i(!1);this.notify({type:`info`,title:this.isCreating?`Item ${(0,r.capitalize)(e)}`:`Change ${(0,r.capitalize)(e)}`,text:[this.isCreating?`${this.itemLabel} was ${e}.`:`Changes to ${this.itemLabel} were ${e}.`,this.transientNote]})},notifyError:e=>{let t=i(!0);this.notify({type:`error`,error:e,title:`Request Error`,text:`Unable to ${t} ${this.itemLabel}.`})}}):await this.submitResource(e,o,a,c,{setData:!0,onSuccess:()=>this.emitSchemaEvent(this.getSubmitVerb()),onError:e=>this.emitSchemaEvent(`error`,{context:{error:e}}),notifySuccess:()=>{let e=i(!1);this.notify({type:`success`,title:`Successfully ${(0,r.capitalize)(e)}`,text:`${this.itemLabel} was ${e}.`})},notifyError:e=>{let t=i(!0);this.notify({type:`error`,error:e,title:`Request Error`,text:[`Unable to ${t} ${this.itemLabel}${e?`:`:``}`,e?.message||e]})}}),l){if(this.resetValidation(),this.formModel.takeProcessedDataSnapshot().catch(console.error),n||e.closeForm)this.close();else if(this.isCreating){let e=this.getItemId(this.schema,this.data);this.$router.replace({path:Ro(`${this.path}/../${e}`),hash:this.$route.hash})}}return l},async submitTransient(e,t,n,r,{onSuccess:i,onError:a,notifySuccess:o,notifyError:s}){let c=this.isCreating?this.addSourceData(r):this.setSourceData(r);if(c)i?.(),await this.emitButtonEvent(e,`success`,{notify:o});else{let t=`Could not submit transient item`;a?.(t),await this.emitButtonEvent(e,`error`,{notify:s,error:t})}return c}}}),[[`render`,Vo]]),Uo={key:0},Wo=[`aria-label`];function Go(t,n,r,i,a,o){return t.nested?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Uo,[(0,e.renderSlot)(t.$slots,`default`)])):((0,e.openBlock)(),(0,e.createElementBlock)(`form`,{key:1,class:`dito-scroll-parent`,"aria-label":t.label,onSubmit:n[0]||=(0,e.withModifiers)(()=>{},[`prevent`])},[(0,e.renderSlot)(t.$slots,`default`)],40,Wo))}var Ko=V(z.component(`DitoFormInner`,{props:{nested:{type:Boolean,default:!1},label:{type:String,default:null}}}),[[`render`,Go]]),qo=z.component(`DitoFormNested`,{extends:Ho}),Jo={key:0,class:`dito-errors`,role:`alert`};function Yo(t,n,r,i,a,o){return t.errors?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Jo,[(0,e.createElementVNode)(`ul`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.errors,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,(0,e.toDisplayString)(t),1))),256))])])):(0,e.createCommentVNode)(``,!0)}var Xo=V(z.component(`DitoErrors`,{props:{errors:{type:Array,default:null}},data(){return{tip:null}},watch:{errors(){this.$nextTick(this.updateErrors)}},unmounted(){this.tip?.destroy()},methods:{updateErrors(){let{tip:t}=this;t?.hide(),this.errors&&(t=this.tip??=(0,e.markRaw)((0,i.default)(this.$el.closest(`.dito-container`))),t.setProps({content:this.errors.join(`
6
- `),theme:`error`,trigger:`manual`,appendTo:`parent`,placement:`bottom-start`,animation:`shift-away-subtle`,popperOptions:{modifiers:[{name:`flip`,enabled:!1}]},interactive:!0,hideOnClick:!1,offset:[3,3],zIndex:1}),t.popper.addEventListener(`mousedown`,()=>t.hide()),t.show())}}}),[[`render`,Yo]]),Zo={class:`dito-scopes`},Qo=[`aria-pressed`,`title`,`onClick`];function $o(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Zo,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.scopes,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{key:r,to:t.getScopeLink(n),custom:``},{default:(0,e.withCtx)(({navigate:r})=>[(0,e.createElementVNode)(`button`,{class:(0,e.normalizeClass)([`dito-button`,{"dito-button--selected":n.name===t.query.scope}]),type:`button`,"aria-pressed":n.name===t.query.scope,title:n.hint||t.getLabel(n),onClick:r},(0,e.toDisplayString)(t.getLabel(n)),11,Qo)]),_:2},1032,[`to`]))),128))])}var es=V(z.component(`DitoScopes`,{props:{query:{type:Object,required:!0},scopes:{type:Object,required:!0}},methods:{getScopeLink(e){let t={...this.query,scope:e.name};return t.page&&=0,this.getQueryLink(t)}}}),[[`render`,$o]]);function ts(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`Pagination`);return(0,e.openBlock)(),(0,e.createBlock)(s,{page:t.page,"onUpdate:page":n[0]||=e=>t.page=e,pageSize:t.limit,total:t.total},null,8,[`page`,`pageSize`,`total`])}var ns=V(z.component(`DitoPagination`,{components:{Pagination:Ci},props:{query:{type:Object,required:!0},limit:{type:Number,required:!0},total:{type:Number,required:!0}},computed:{page:{get(){return(+this.query.page||0)+1},set(e){this.page!==e&&this.$router.push(this.getQueryLink({...this.query,page:e-1}))}}}}),[[`render`,ts]]),rs={data(){return{isDragging:!1}},methods:{getDraggableOptions(e=window.dito.settings?.forceDragFallback??!1){let t=`dito-draggable`;return{animation:150,handle:`.dito-button--drag`,dragClass:`${t}__drag`,chosenClass:`${t}__chosen`,ghostClass:`${t}__ghost`,fallbackClass:`${t}__fallback`,forceFallback:e,onStart:this.onStartDrag,onEnd:this.onEndDrag}},onStartDrag(){this.isDragging=!0},onEndDrag({oldIndex:e,newIndex:t}){this.isDragging=!1,e!==t&&this.onChange()}}},is=[`id`,`data-path`],as={key:0,class:`dito-tree-header`},os=[`aria-label`,`aria-expanded`],ss=[`innerHTML`],cs={key:1,class:`dito-tree-info`},ls={key:1,class:`dito-tree-leaf`},us=[`innerHTML`],ds={key:2,class:`dito-buttons dito-buttons--small`},fs={key:1,class:`dito-properties`};function ps(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoLabel`),c=(0,e.resolveComponent)(`DitoTableCell`),l=(0,e.resolveComponent)(`DitoTreeItem`,!0),u=(0,e.resolveComponent)(`DitoDraggable`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-tree-item`,{"dito-tree-item--dragging":t.isDragging,"dito-tree-item--active":t.active}]),id:t.componentPath,style:(0,e.normalizeStyle)(t.level>0&&{"--level":t.level}),"data-path":t.path},[t.label?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,as,[t.numEntries?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-tree-branch`,role:`button`,tabindex:`0`,"aria-label":t.ariaLabel,"aria-expanded":t.opened,onClick:n[0]||=(0,e.withModifiers)(e=>t.opened=!t.opened,[`stop`]),onKeydown:n[1]||=(0,e.withKeys)((0,e.withModifiers)(e=>t.opened=!t.opened,[`prevent`]),[`enter`,`space`])},[t.numEntries?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-chevron`,{"dito-chevron--open":t.opened}])},null,2)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:t.label},null,8,ss),t.details?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,cs,(0,e.toDisplayString)(t.details),1)):(0,e.createCommentVNode)(``,!0)],40,os)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ls,[(0,e.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:t.label},null,8,us)])),t.hasEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ds,[t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:0,class:`dito-button`},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.editable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:1,class:`dito-button`,type:`button`},t.getButtonAttributes(t.verbs.edit),{onClick:n[2]||=(...e)=>t.onEdit&&t.onEdit(...e)}),null,16)):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:2,class:`dito-button`,type:`button`},t.getButtonAttributes(t.verbs.delete),{onClick:n[3]||=(...e)=>t.onDelete&&t.onDelete(...e)}),null,16)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),t.properties?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`table`,fs,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.properties,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,null,[(0,e.createElementVNode)(`td`,null,[n.label===!1?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,label:t.getLabel(n)},null,8,[`label`]))]),(0,e.createVNode)(c,{cell:n,schema:n,dataPath:t.getPropertyDataPath(n),data:t.data,meta:t.nestedMeta,store:t.store,disabled:t.disabled},null,8,[`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])]))),256))],512)),[[e.vShow,t.opened]]):(0,e.createCommentVNode)(``,!0),t.childrenSchema?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(u,{key:2,options:t.getDraggableOptions(!0),draggable:t.childrenDraggable,modelValue:t.childrenList,"onUpdate:modelValue":n[4]||=e=>t.childrenList=e},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.childrenItems,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(l,{key:t.getItemUid(t.childrenSchema,n.data),schema:t.childrenSchema,dataPath:t.getItemDataPath(t.childrenSchema,r),data:n.data,path:n.path,open:n.open,active:n.active,draggable:t.childrenDraggable,label:t.getItemLabel(t.childrenSchema,n.data,{index:r}),level:t.level+1},null,8,[`schema`,`dataPath`,`data`,`path`,`open`,`active`,`draggable`,`label`,`level`]))),128))]),_:1},8,[`options`,`draggable`,`modelValue`])),[[e.vShow,t.opened]]):(0,e.createCommentVNode)(``,!0)],14,is)}var ms=V(z.component(`DitoTreeItem`,{mixins:[Wa,rs],emits:[`update:data`],inject:[`container`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Array,Object],default:null},path:{type:String,default:``},open:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},label:{type:String,default:null},level:{type:Number,default:0}},data(){return{opened:this.open||this.schema.open}},computed:{componentPath(){let{componentPath:e,dataPath:t}=this.container,n=Oe(this.dataPath,t);return n?y(e,n):e},meta(){return this.container.meta},store(){return this.container.store},disabled(){return this.container.disabled},nestedMeta(){return{...this.meta,schema:this.schema}},properties(){return k(this.schema.properties)},childrenSchema(){return this.schema.children},childrenList:{get(){let e=this.childrenSchema?.name;return e&&this.data[e]},set(e){let t=this.childrenSchema?.name;t&&(un(this.childrenSchema,e),this.data[t]=e,this.$emit(`update:data`,e))}},childrenDraggable(){return this.childrenList?.length>1&&this.getSchemaValue(`draggable`,{type:Boolean,default:!1,schema:this.childrenSchema})},numChildren(){return this.childrenList?.length||0},numProperties(){return this.properties?.length||0},numEntries(){return this.numProperties+this.numChildren},childrenItems(){let{childrenSchema:e,childrenList:t}=this;if(e&&t){let{editPath:n}=this.container,r=!this.path&&e.open;return t.map((t,i)=>{let a=e.path&&`${this.path}/${e.path}/${i}`;return{data:t,path:a,open:r||n.startsWith(a)&&a.length<n.length,active:n===a}})}return[]},ariaLabel(){return this.label?(0,r.stripHtml)(this.label):null},details(){let{numChildren:e}=this;return e&&`${e} ${e===1?`item`:`items`}`},hasEditButtons(){return this.draggable||this.editable||this.deletable},creatable:P(`creatable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)}}),editable:P(`editable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)}}),deletable:P(`deletable`,{type:Boolean,default:!1})},methods:{getPropertyDataPath(e){return y(this.dataPath,e.name)},editPath(e){this.$router.push({path:`${this.container.path}${e}`,query:this.$route.query})},onEdit(){this.editPath(this.path)},onDelete(){},onChange(){this.container.onChange()},onEndDrag(e){rs.methods.onEndDrag.call(this,e);let{item:t}=e;t.classList.contains(`dito-tree-item--active`)&&this.$nextTick(()=>{this.editPath(e.item.dataset.path)})}}}),[[`render`,ps]]),hs={class:`dito-table-head`},gs=[`aria-sort`,`onClick`],_s={key:1},vs={key:0};function ys(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`);return(0,e.openBlock)(),(0,e.createElementBlock)(`thead`,hs,[(0,e.createElementVNode)(`tr`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.columns,r=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(r)?((0,e.openBlock)(),(0,e.createElementBlock)(`th`,{key:0,scope:`col`,class:(0,e.normalizeClass)(t.getColumnClass(r))},[r.sortable?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,to:t.getSortLink(r),custom:``},{default:(0,e.withCtx)(({navigate:i})=>[(0,e.createElementVNode)(`button`,{class:(0,e.normalizeClass)([`dito-button`,t.getSortClass(r)]),type:`button`,"aria-sort":t.getSortState(r),onClick:i},[n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-button__order-arrows`},null,-1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabel(r)),1)],10,gs)]),_:2},1032,[`to`])):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,_s,(0,e.toDisplayString)(t.getLabel(r)),1))],2)):(0,e.createCommentVNode)(``,!0)],64))),256)),t.hasEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`th`,vs,[...n[1]||=[(0,e.createElementVNode)(`span`,null,null,-1)]])):(0,e.createCommentVNode)(``,!0)])])}var bs=V(z.component(`DitoTableHead`,{props:{query:{type:Object,required:!0},columns:{type:Object,required:!0},hasEditButtons:{type:Boolean,required:!0}},computed:{sort(){let e=(this.query.order||``).split(/\s+/);return{name:e[0],order:e[1]}}},methods:{getColumnClass(e){return`dito-column--${(0,r.hyphenate)(e.name)}`},getSortClass(e){return this.sort.name===e.name?`dito-button--selected dito-button--order-${this.sort.order}`:null},getSortState(e){return{asc:`ascending`,desc:`descending`}[this.sort.name===e.name&&this.sort.order]||`none`},getSortLink(e){let t=this.sort.name===e.name&&this.sort.order===`asc`?`desc`:`asc`;return this.getQueryLink({...this.query,order:`${e.name} ${t}`})}}}),[[`render`,ys]]),xs=[`innerHTML`];function Ss(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`td`,{class:(0,e.normalizeClass)(t.cell.class),style:(0,e.normalizeStyle)(t.cell.style)},[t.cell.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.cell.component),{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,disabled:t.disabled},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`])):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:1,innerHTML:t.renderCell(t.data)},null,8,xs))],6)}var Cs=V(z.component(`DitoTableCell`,{mixins:[N],props:{cell:{type:Object,required:!0},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},nested:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},methods:{renderCell(e){let{name:t,render:n}=this.cell,i=e[t];return n?n.call(this,new E(this,{name:t,value:i,data:e,dataPath:y(this.dataPath,t)})):(0,r.escapeHtml)(i)}}}),[[`render`,Ss]]),ws={class:`dito-upload-file`},Ts={class:`dito-thumbnail__inner`},Es=[`src`],Ds={key:1,class:`dito-thumbnail__type`};function Os(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,ws,[t.thumbnail?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-thumbnail`,`dito-thumbnail--${t.thumbnail}`])},[(0,e.createElementVNode)(`div`,Ts,[t.source?((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:0,src:t.source,crossorigin:`anonymous`},null,8,Es)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ds,[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.type),1)]))])],2)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.file.name),1)])}var ks=z.component(`DitoUploadFile`,{props:{file:{type:Object,required:!0},thumbnail:{type:String,default:null},thumbnailUrl:{type:String,default:null}},data(){return{uploadUrl:null}},computed:{type(){return As[this.file.type]||this.file.name.split(`.`).pop().toUpperCase()},source(){return this.uploadUrl||this.thumbnailUrl}},watch:{"file.upload.file":{immediate:!0,handler(e){if(this.thumbnail&&e?.type.startsWith(`image/`)){let t=new FileReader;t.onload=()=>{this.uploadUrl=t.result},t.readAsDataURL(e)}else this.uploadUrl=null}}}}),As={"text/plain":`TXT`,"text/html":`HTML`,"text/css":`CSS`,"text/javascript":`JS`,"image/jpeg":`JPG`,"image/png":`PNG`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"movie/mp4":`MP4`,"audio/mpeg":`MP3`,"application/json":`JSON`,"application/xml":`XML`,"application/pdf":`PDF`,"application/zip":`ZIP`},js=V(ks,[[`render`,Os]]);function Ms(t,n,r={}){let i,{document:a=s.defaultDocument,watchElement:o=!1,...c}=r,u={onUpdate:e=>{Fs(n,e.oldIndex,e.newIndex,e)}},d=()=>{i?.destroy(),i=void 0},f=e=>{e&&i===void 0&&(i=new l.default(e,{...u,...c}))},p=()=>{let e=typeof t==`string`?a?.querySelector(t):(0,s.unrefElement)(t);e&&f(e)},m=(e,t)=>{if(t!==void 0)i?.option(e,t);else return i?.option(e)},h;return o&&typeof t!=`string`?h=(0,e.watch)(()=>(0,s.unrefElement)(t),e=>{d(),e&&f(e)},{immediate:!0,flush:`post`}):(0,s.tryOnMounted)(p),(0,s.tryOnScopeDispose)(()=>{h?.(),d()}),{stop:()=>{d()},start:p,option:m}}function Ns(e,t,n){let r=e.children[n];e.insertBefore(t,r)}function Ps(e){e.parentNode&&e.parentNode.removeChild(e)}function Fs(t,n,r,i=null){i!=null&&(Ps(i.item),Ns(i.from,i.item,n));let a=(0,e.isRef)(t),o=a?[...(0,e.toValue)(t)]:(0,e.toValue)(t);if(r>=0&&r<o.length){let i=o.splice(n,1)[0];(0,e.nextTick)(()=>{o.splice(r,0,i),a&&(t.value=o)})}}var Is=(0,e.defineComponent)((t,{slots:n})=>{let r=(0,s.useVModel)(t,`modelValue`),i=(0,e.shallowRef)(),a=(0,e.reactive)(Ms(i,r,t.options));return()=>{if(n.default)return(0,e.h)(t.as||`div`,{ref:i},n.default(a))}},{name:`UseSortable`,props:[`as`,`modelValue`,`options`]});function Ls(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`UseSortable`);return t.draggable?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,class:(0,e.normalizeClass)([`dito-draggable`,{"dito-draggable--dragging":t.isDragging}]),as:t.as,modelValue:t.modelValue,options:{...t.options,onStart:t.onStart,onEnd:t.onEnd},"onUpdate:modelValue":n[0]||=e=>t.$emit(`update:modelValue`,e)},{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`default`)]),_:3},8,[`class`,`as`,`modelValue`,`options`])):((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.as),{key:1},{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`default`)]),_:3}))}var Rs=V(z.component(`DitoDraggable`,{mixins:[G],components:{UseSortable:Is},emits:[`update:modelValue`],props:{modelValue:{type:Array,required:!0},as:{type:String,default:`div`},options:{type:Object,required:!0},draggable:{type:Boolean,default:!0}},data(){return{mouseEvents:null,isDragging:!1}},methods:{onStart(e){this.options.onStart?.(e),this.isDragging=!0,this.mouseEvents?.remove()},onEnd(e){this.options.onEnd?.(e),this.mouseEvents=this.domOn(document,{mousedown:this.onMouse,mousemove:this.onMouse,mouseleave:this.onMouse})},onMouse(){this.isDragging=!1,this.mouseEvents?.remove(),this.mouseEvents=null}}}),[[`render`,Ls]]);function zs({vnode:e}){return e}zs.props={vnode:{type:Object,required:!0}};var Bs=z.component(`DitoVnode`,zs),Vs=we({DitoAccount:()=>ja,DitoAffix:()=>Fa,DitoAffixes:()=>K,DitoButtons:()=>bo,DitoClipboard:()=>Po,DitoContainer:()=>oo,DitoCreateButton:()=>ko,DitoDialog:()=>Qi,DitoDraggable:()=>Rs,DitoEditButtons:()=>Co,DitoErrors:()=>Xo,DitoForm:()=>Ho,DitoFormInner:()=>Ko,DitoFormNested:()=>qo,DitoHeader:()=>ga,DitoLabel:()=>Ua,DitoMenu:()=>la,DitoNavigation:()=>ya,DitoNotifications:()=>Ca,DitoPagination:()=>ns,DitoPane:()=>ro,DitoPanel:()=>po,DitoPanels:()=>go,DitoRoot:()=>aa,DitoRouterView:()=>Io,DitoSchema:()=>Xa,DitoSchemaInlined:()=>Qa,DitoScopes:()=>es,DitoSidebar:()=>Ea,DitoSpinner:()=>Na,DitoTableCell:()=>Cs,DitoTableHead:()=>bs,DitoTabs:()=>uo,DitoTrail:()=>pa,DitoTreeItem:()=>ms,DitoUploadFile:()=>js,DitoVNode:()=>Bs,DitoView:()=>qi}),q={extends:z,mixins:[Nn],nativeField:!1,textField:!1,defaultValue:null,defaultNested:!0,defaultVisible:!0,defaultMultiple:!1,generateLabel:!0,excludeValue:!1,ignoreMissingValue:null,treatNullAsMissing:null,omitSpacing:!1,getTypeValidations:null,component:z.component,get:qe,register(e,t={}){e=(0,r.asArray)(e),Hs(t)&&console.warn(`Type '${e[0]}': The \`getValidations()\` method isn't supported anymore, use the static \`getTypeValidations(schema, context)\` option instead.`);let n=this.component(`DitoType${(0,r.camelize)(e[0],!0)}`,t);for(let t of e)Ke(t,n);return n}};function Hs(e){return[e,...e.mixins??[]].some(({methods:e})=>!!e?.getValidations)}var Us=[`data-info`];function Ws(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoButton`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:[`dito-button`,t.buttonClass],id:t.componentPath,ref:`element`,type:t.type,text:t.text,title:t.title,disabled:t.disabled},t.attributes),{prefix:(0,e.withCtx)(()=>[t.prefixes.length>0?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,items:t.prefixes,position:`prefix`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])):(0,e.createCommentVNode)(``,!0)]),suffix:(0,e.withCtx)(()=>[t.suffixes.length>0?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,items:t.suffixes,position:`suffix`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])):(0,e.createCommentVNode)(``,!0),!t.label&&t.info?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.info},null,8,Us)):(0,e.createCommentVNode)(``,!0)]),_:1},16,[`id`,`type`,`text`,`title`,`disabled`,`class`])}var Gs=V(q.register([`button`,`submit`],{components:{DitoAffixes:K,DitoButton:dr},defaultValue:()=>void 0,excludeValue:!0,defaultWidth:`auto`,generateLabel:!1,data(){return{isRunning:!1}},computed:{verb(){return this.verbs[this.name]},buttonClass(){return this.verb?`dito-button--${this.verb}`:null},text:P(`text`,{type:String}),title(){return this.text||(0,r.labelize)(this.verb)},prefixes(){return(0,r.asArray)(this.schema.prefix)},suffixes(){return(0,r.asArray)(this.schema.suffix)},closeForm:P(`closeForm`,{type:Boolean,default:!1})},methods:{getEvents(){let{onFocus:e,onBlur:t,onClick:n}=this;return{onFocus:e,onBlur:t,onClick:n}},async submit(e){return this.resourceComponent?.submit(this,e)},async onClick(){this.isRunning=!0;try{await this.emitEvent(`click`,{parent:this.schemaComponent})===void 0&&Xn(this.schema)&&await this.submit()}catch(e){if(await this.emitEvent(`error`,{error:e})===void 0){if(e instanceof AggregateError)for(let t of e.errors)this.notify({type:`error`,text:t});else this.notify({type:`error`,text:e})}}finally{this.isRunning=!1}}}}),[[`render`,Ws]]),Ks={class:`dito-checkbox`},qs=[`id`];function Js(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ks,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.value=e,type:`checkbox`},t.attributes),null,16,qs),[[e.vModelCheckbox,t.value]])])}var Ys=V(q.register(`checkbox`,{nativeField:!0}),[[`render`,Js]]),Xs={computed:{multiple(){return $t(this.schema)},selectedValue:{get(){let e=e=>{let t=this.relate?this.getValueForOption(e):e;return this.hasOptions?this.getOptionForValue(t)?t:null:e};return this.multiple&&(0,r.isArray)(this.value)?this.value.map(e).filter(e=>e!==null):e(this.value)},set(e){let t=e=>{if(!this.relate)return e;let t=this.getOptionForValue(e);return this.shouldSetTemporaryId(t)&&Ve(t,`id`),t};this.value=this.multiple&&(0,r.isArray)(e)?e.map(t):t(e)}},shouldReplaceValueWithSelectedValue(){return this.hasOptions&&(this.selectedValue===null&&this.value!==null||Ue(this.value))},selectedOption(){return this.getOptionForValue(this.selectedValue)},optionsResolver(){return this.formModel.getOptionsResolver({schema:this.schema,data:this.data,name:this.name,dataPath:this.dataPath,componentPath:this.componentPath})},isLoadingOptions(){return this.optionsResolver.isLoading},options(){let e=this.optionsResolver.value??[];if(!(0,r.isArray)(e))throw Error(`Invalid options data, should be array: ${e}`);return this.groupBy?this.groupOptions(e):e},activeOptions(){return this.options},hasOptions(){return this.activeOptions.length>0},relate:P(`relate`,{type:Boolean,default:!1,callback:!1}),groupBy:P(`groupBy`,{type:String,default:null}),optionLabel:P(`options.label`,{type:[String,Function],default:null,get(e){return e||this.getOptionKey(`label`)||null}}),optionValue:P(`options.value`,{type:[String,Function],default:null,get(e){return e||this.relate&&`id`||this.getOptionKey(`value`)||null}}),optionEquals:P(`options.equals`,{type:Function,default:null}),searchFilter:P(`search`,{type:[Object,Function],default:null,get(e){if(e){let{filter:t,debounce:n}=(0,r.isFunction)(e)?{filter:e}:e;return n?(0,r.debounceAsync)(t,n):t}}}),editable:P(`editable`,{type:Boolean,default:!1,get(e){return e&&Ft(this.schema,this.context)}}),editPath(){return this.editable&&this.selectedValue?Lt(this.schema,this.selectedValue,this.context):null},groupByLabel(){return this.groupBy?`label`:null},groupByOptions(){return this.groupBy?`options`:null}},watch:{shouldReplaceValueWithSelectedValue:{handler(e){e&&this.replaceValueWithSelectedValue()},immediate:!0},value(){this.shouldReplaceValueWithSelectedValue&&this.replaceValueWithSelectedValue()},"optionsResolver.lastLoadError"(e){e&&this.addError(e.message||e)}},methods:{getOptionKey(e){let[t]=this.activeOptions;return(0,r.isObject)(t)&&e in t?e:null},replaceValueWithSelectedValue(){let{selectedValue:e}=this;this.formModel.applyCleanChanges(()=>{this.selectedValue=e}).catch(console.error)},groupOptions(e){let t={};return e.reduce((e,n)=>{let r=n[this.groupBy],i=t[r];return i||(i=t[r]={[this.groupByLabel]:r,[this.groupByOptions]:[]},e.push(i)),i[this.groupByOptions].push(n),e},[])},shouldSetTemporaryId(e){return this.relate&&(0,r.isObject)(e)&&e.id==null},getOptionForValue(e){let t=(e,n,r)=>{for(let i of e)if(r){let e=t(i.options,n,null);if(e)return e}else if(this.optionEquals?this.optionEquals(new E(this,{value:n,option:i})):n===this.getValueForOption(i))return i};return this.optionValue?t(this.activeOptions,e,this.groupBy):e},getValueForOption(t){if(this.shouldSetTemporaryId(t))return(0,e.toRaw)(t);let{optionValue:n}=this;return(0,r.isString)(n)?t?.[n]??null:(0,r.isFunction)(n)?n(new E(this,{option:t})):t},getLabelForOption(e){let{optionLabel:t}=this;return(0,r.isString)(t)?e?.[t]:(0,r.isFunction)(t)?t(new E(this,{option:e})):(0,r.labelize)(`${e}`)}},processValue({schema:e,value:t,dataPath:n},i){if(e.relate){let a=e.options?.dataPath,o=a?(0,r.normalizeDataPath)(`${n}/${a}`):null;i.addRelation(n,o,e),o&&i.setSourceRelated(o);let s=e=>e&&{id:e.id};t=$t(e)&&(0,r.isArray)(t)?t.map(s):s(t)}return t}},Zs=[`id`,`aria-label`],Qs={class:`dito-checkbox`},$s=[`value`];function ec(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:(0,e.normalizeClass)([`dito-checkboxes`,`dito-layout--${t.schema.layout||`vertical`}`]),id:t.componentPath,role:`group`,"aria-label":t.label},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.options,r=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`label`,null,[(0,e.createElementVNode)(`div`,Qs,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({ref_for:!0,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedOptions=e,type:`checkbox`,value:t.getValueForOption(r)},{ref_for:!0},t.attributes),null,16,$s),[[e.vModelCheckbox,t.selectedOptions]]),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabelForOption(r)),1)])])]))),256))],10,Zs)}var tc=V(q.register(`checkboxes`,{mixins:[Xs],nativeField:!0,defaultValue:[],defaultWidth:`auto`,defaultMultiple:!0,computed:{multiple(){return!0},selectedOptions:{get(){return(this.selectedValue||[]).filter(e=>e)},set(e){this.selectedValue=e||[]}}}}),[[`render`,ec]]),nc=[`id`],rc={class:`dito-code__editor`,ref:`editor`};function ic(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-code`,id:t.componentPath,style:(0,e.normalizeStyle)(t.style)},[(0,e.createElementVNode)(`div`,rc,null,512),t.resizable?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-resize`,onMousedown:n[0]||=(0,e.withModifiers)((...e)=>t.onDragResize&&t.onDragResize(...e),[`stop`,`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0)],12,nc)}var ac=V(q.register(`code`,{mixins:[G],data(){return{height:null}},computed:{lines:P(`lines`,{type:Number,default:3}),language:P(`language`,{type:String,default:`javascript`}),indentSize:P(`indentSize`,{type:Number,default:2}),resizable:P(`resizable`,{type:Boolean,default:!1}),style(){return{height:this.height||`calc(${this.lines}em * var(--line-height))`}}},mounted(){let e=new u.default(this.$refs.editor,{language:this.language,indentSize:this.indentSize,lineNumbers:!1}),t=!1,n=!1,r=!1,i=()=>{!this.focused&&t&&(t=!1,this.onChange())};this.domOn(this.$refs.editor.querySelector(`textarea`),{focus:()=>this.onFocus(),blur:()=>{this.onBlur(),i()}});let a=t=>{t!==e.code&&(r=!0,e.updateCode(t))},o=e=>{e!==this.value&&(n=!0,this.value=e,t=!0,i())};e.onUpdate(e=>{r?r=!1:o(e)}),this.$watch(`value`,e=>{n?n=!1:a(e||``)}),this.$watch(`language`,t=>{e.updateLanguage(t)}),this.$watch(()=>this.readonly||this.disabled,t=>t?e.enableReadonlyMode():e.disableReadonlyMode(),{immediate:!0}),a(this.value||``)},methods:{focusElement(){this.$el.querySelector(`textarea`)?.focus()},blurElement(){this.$el.querySelector(`textarea`)?.blur()},onDragResize(e){let t=({clientX:e,clientY:t})=>({x:e,y:t}),n=t(e).y,r=parseFloat(getComputedStyle(this.$el).height),i=e=>{let{y:i}=t(e);r+=i-n,n=i,this.height=`${Math.max(r,0)}px`},a=this.domOn(document,{mousemove:i,mouseup(e){i(e),a.remove()}})}}}),[[`render`,ic]]),oc={key:0,class:`dito-color__preview`};function sc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`SketchPicker`),u=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(u,{class:`dito-color`,show:t.showPopup,"onUpdate:show":n[2]||=e=>t.showPopup=e,trigger:`focus`},{trigger:(0,e.withCtx)(()=>[(0,e.createVNode)(c,(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.hexValue,"onUpdate:modelValue":n[0]||=e=>t.hexValue=e,type:`input`,size:`8`,focused:t.showPopup},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},{append:(0,e.withCtx)(()=>[t.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,oc,[(0,e.createElementVNode)(`div`,{style:(0,e.normalizeStyle)({background:`#${t.hexValue||`00000000`}`})},null,4)])):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`focused`])]),popup:(0,e.withCtx)(()=>[(0,e.createVNode)(l,{class:`dito-color__picker`,tinyColor:t.colorValue,"onUpdate:tinyColor":n[1]||=e=>t.colorValue=e,disableAlpha:!t.alpha,disableFields:!t.inputs,presetColors:t.presets},null,8,[`tinyColor`,`disableAlpha`,`disableFields`,`presetColors`])]),_:1},8,[`show`])}var cc=q.register(`color`,{components:{DitoTrigger:Jr,DitoInput:H,DitoAffixes:K,SketchPicker:d.SketchPicker},data(){return{showPopup:!1,convertedValue:null}},computed:{canUpdateValue(){return!this.focused||this.readonly},colorValue:{get(){return(0,d.tinycolor)(this.convertedValue||this.value||`#000000`)},set(e){this.convertedValue=null;let{value:t}=this;(!t||e.toHex8String()!==(0,d.tinycolor)(t).toHex8String())&&(this.value=uc(e,this.colorFormat))}},hexValue:{get(){let e=(0,d.tinycolor)(this.value);return e.isValid()?e.toString(e.getAlpha()<1?`hex8`:`hex6`).slice(1).toLowerCase():null},set(e){if((0,d.tinycolor)(e).isValid()){let t=lc(e,this.colorFormat);this.canUpdateValue?this.value=t:this.convertedValue=t}}},colorFormat:P(`format`,{type:String,default:`hex`}),alpha:P(`alpha`,{type:Boolean,default:!1}),inputs:P(`inputs`,{type:Boolean,default:!0}),presets:P(`presets`,{type:Array,default:[`#ffffff`,`#c3c3c3`,`#7f7f7f`,`#000000`,`#880015`,`#ed1c24`,`#ff7f27`,`#fff200`,`#22b14c`,`#00a2e8`,`#3f48cc`,`#a349a4`,`#b97a57`,`#ffaec9`,`#ffc90e`,`#00000000`]})},watch:{value:`onChange`,canUpdateValue(e){e&&this.convertedValue!==null&&(this.value=this.convertedValue,this.convertedValue=null)}}});function lc(e,t){return uc((0,d.tinycolor)(e),t)}function uc(e,t){switch(t){case`rgb`:return e.toRgb();case`prgb`:return e.toPercentageRgb();case`name`:return e.toName();case`hsl`:return e.toHsl();case`hsv`:return e.toHsv();case`hex3`:return`#${e.toHex(!0)}`;case`hex4`:return`#${e.toHex8(!0)}`;case`hex8`:return`#${e.toHex8()}`;default:return e.getAlpha()<1?`#${e.toHex8()}`:`#${e.toHex()}`}}var dc=V(cc,[[`render`,sc]]);function fc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),(0,e.normalizeProps)((0,e.guardReactiveProps)(t.$props)),null,16)}var pc=V(q.register(`component`,{defaultValue:()=>void 0,ignoreMissingValue:({schema:e})=>!(`default`in e),async processSchema(e,t){await Rn(t)}}),[[`render`,fc]]),mc=[`id`,`name`,`value`,`disabled`];function hc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`input`,{class:`dito-text dito-input`,id:t.componentPath,ref:`element`,name:t.name,type:`text`,value:t.value,disabled:t.disabled,readonly:!0},null,8,mc)}var gc=V(q.register([`computed`,`data`,`hidden`],{defaultValue:()=>void 0,defaultVisible:!1,valueFromDataSchema:!0}),[[`render`,hc]]),_c={class:`dito-date`};function vc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,_c,[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.getComponent(t.type)),(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.dateValue,"onUpdate:modelValue":n[0]||=e=>t.dateValue=e,locale:t.locale,format:t.formats},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`locale`,`format`]))])}var yc=V(q.register([`date`,`datetime`,`time`],{components:{DitoAffixes:K},nativeField:!0,textField:!0,computed:{dateValue:{get(){let{value:e}=this;return e&&((0,r.parsePlainDate)(e)??new Date(e))},set(e){this.value=e}},formats:P(`formats`,{type:Object,default:null,get(e){let{date:t,time:n}=(0,r.assignDeeply)({},this.api.formats,e);return{date:[`date`,`datetime`].includes(this.type)?t:null,time:[`time`,`datetime`].includes(this.type)?n:null}}})},methods:{getComponent(e){return{date:ti,time:pi,datetime:gi}[e]}},processValue({schema:e,value:t}){return(0,r.isDate)(t)?e.type===`date`?(0,r.formatPlainDate)(t):t.toISOString():t}}),[[`render`,vc]]);function bc(e){let t=e?(0,r.isArray)(e)?e:Object.entries(e):[];return new URLSearchParams(t.reduce((e,[t,n])=>{if((0,r.isArray)(n))for(let r of n)e.push([t,r??``]);else n!=null&&e.push([t,n]);return e},[])).toString().replaceAll(/%(?:21|24|28|29|2C|2F|3A|3B|3D|3F|40)/g,decodeURIComponent)}function xc({path:e,query:t,hash:n}){let{location:r}=window;history.replaceState(history.state,null,`${r.origin}${e??r.pathname}?${t?bc(t):r.search.slice(1)}${n??r.hash}`)}var J={mixins:[Wa,Lo,Fi],defaultValue:e=>w(e.schema)?[]:null,excludeValue:e=>!!e.schema.resource,provide(){return{$sourceComponent:()=>this}},data(){return{wrappedPrimitives:null}},computed:{sourceComponent(){return this},isObjectSource(){return C(this.type)},isListSource(){return w(this.type)},hasData(){return!!this.value},shouldRender(){return this.sourceDepth<this.maxDepth},isReady(){return this.shouldRender&&(this.hasData||!this.providesData)},isInView(){return!!this.viewComponent},wrapPrimitives(){return this.schema.wrapPrimitives},valueListData(){let{value:e}=this;return this.isObjectSource?e==null?[]:[e]:(this.isListResults(e)?e.results:e)||[]},primitiveValues(){return this.wrapPrimitives?[...this.valueListData]:null},listData:{get(){return this.wrapPrimitives?this.wrappedPrimitives||[]:this.valueListData},set(e){this.wrapPrimitives?this.wrappedPrimitives=e:this.value=this.isObjectSource?e?.length>0?e[0]:null:un(this.sourceSchema,e,this.paginationRange)}},objectData:{get(){return this.listData[0]||null},set(e){this.listData=e?[e]:[]}},sourceSchema(){return this.schema},sourceDepth(){return this.$route.matched.reduce((e,t)=>e+ +(t.meta.schema===this.sourceSchema),0)},path(){return this.routeComponent.getChildPath(this.schema.path)},defaultQuery(){let{defaultOrder:e}=this;return e?{order:e}:{}},query:Mn(`query`,{get(e){return{...this.defaultQuery,...e}},set(e){let{scope:t=this.defaultScope?.name,page:n=this.schema.page,type:i}=this.query;return e={...this.query,...t!=null&&{scope:t},...n!=null&&{page:n},...i!=null&&{type:i},...e},(0,r.equals)(e,this.$route.query)||xc({query:e}),e}}),total:Mn(`total`),columns(){return k(this.schema.columns)},scopes(){return k(this.schema.scopes)},defaultScope(){let e=null;if(this.scopes)for(let t of Object.values(this.scopes)){if(t.defaultScope)return t;e||=t}return e},defaultOrder(){if(this.columns)for(let e of Object.values(this.columns)){let{defaultSort:t}=e;if(t){let n=(0,r.isString)(t)?t:`asc`;return`${e.name} ${n}`}}return null},nestedMeta(){return{...this.meta,schema:this.schema}},forms(){return Object.values(O(this.schema,this.context))},view(){return Pt(this.schema,this.context)},linksToView(){return!!this.view},buttonSchemas(){return Ut(this.schema.buttons)},isCompact(){return this.forms.every(ut)},isInlined(){return dt(this.schema)},paginate:P(`paginate`,{type:Number}),render:P(`render`,{type:Function,default:null}),hasItems(){return this.isListSource||!!this.value},creatable:P(`creatable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)?!this.isObjectSource||!this.value:!1}}),editable:P(`editable`,{type:Boolean,default:!1,get(e){return e&&!this.isInlined&&this.hasItems}}),deletable:P(`deletable`,{type:Boolean,default:!1,get(e){return e&&this.hasItems}}),draggable:P(`draggable`,{type:Boolean,default:!1,get(e){return this.isListSource&&e}}),collapsible:P(`collapsible`,{type:Boolean,default:!1,get(e){return e&&this.isInlined}}),collapsed:P(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}}),maxDepth:P(`maxDepth`,{type:Number,default:1}),createPath(){return this.creatable?It(this.schema,this.context)||this.path:null}},watch:{$route:{flush:`post`,handler(e,t){this.providesData&&(t.path===e.path&&t.hash===e.hash?(this.query=e.query,this.loadData(!1)):this.meta.reload&&t.path!==e.path&&t.path.startsWith(e.path)&&(this.meta.reload=!1,this.loadData(!1)))}},value:{immediate:!0,handler(e){this.isListResults(e)&&this.unwrapListData(e)}},primitiveValues:{immediate:!0,handler(e){if(e&&!(0,r.equals)(e,this.unwrapPrimitives())){let{wrapPrimitives:t}=this;this.wrappedPrimitives=e.map(e=>({[t]:e}))}}},wrappedPrimitives:{deep:!0,handler(){let e=this.unwrapPrimitives();e&&!(0,r.equals)(e,this.primitiveValues)&&(this.value=e)}}},methods:{setupData(){this.query=this.$route.query,this.ensureData()},clearData(){this.total=0,this.setLoadedValue(null)},setData(e){if(this.isListSource&&(0,r.isArray)(e))this.setLoadedListItems(e);else if(!e||this.isObjectSource&&(0,r.isObject)(e))this.setLoadedValue(e);else if(!this.unwrapListData(e)&&(0,r.isObject)(e)&&this.isInView)return this.viewComponent.setData(e);return this.value},isListResults(e){return this.isListSource&&(0,r.isObject)(e)&&(0,r.isNumber)(e.total)&&(0,r.isArray)(e.results)},unwrapPrimitives(){let{wrapPrimitives:e,wrappedPrimitives:t}=this;return e&&t?t.map(t=>t[e]):null},unwrapListData(e){if(this.isListResults(e))return this.total=e.total,this.setLoadedListItems(e.results),this.value},setLoadedListItems(e){this.setLoadedValue(un(this.sourceSchema,e,this.paginationRange))},setLoadedValue(e){this.formModel.applyCleanChanges(()=>{this.value=e}).catch(console.error)},createItem(e,t,n=null){let r=this.createData(e,t);if(this.isObjectSource)this.objectData=r;else{let{listData:e}=this;n==null?e.push(r):e.splice(n,0,r),this.listData=e}return this.collapsible&&this.$nextTick(()=>this.openSchemaComponent(n??-1)),this.onChange(),r},removeItem(e,t){let n=!1;if(this.isObjectSource)this.objectData=null,n=!0;else{let{listData:e}=this;t>=0&&(e.splice(t,1),this.listData=e,n=!0)}n&&(this.removeItemStore(this.schema,e,t),this.onChange())},deleteItem(e,t){let n=e&&this.getItemLabel(this.schema,e,{index:t,extended:!0}),r=()=>this.notify({type:this.isTransient?`info`:`success`,title:`Successfully Removed`,text:[`${n} was ${this.verbs.deleted}.`,this.transientNote]});if(e&&window.confirm(`Do you really want to ${this.verbs.delete} ${n}?`)){if(this.isTransient)this.removeItem(e,t),r();else{let n=this.getItemId(this.schema,e,t),i=`delete`,a=Zn(n,this.getResource({method:i}));a&&this.handleRequest({method:i,resource:a},n=>{n||(this.removeItem(e,t),r()),this.reloadData()})}}},getSchemaComponent(e){let{listData:t,schemaComponents:n}=this,r=n.at(e);if(t?.length){let i=t.at(e);return i==null?null:r?.data===i?r:n.find(e=>e.data===i)}return r},openSchemaComponent(e){let t=this.getSchemaComponent(e);t&&(t.opened=!0)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let i=e.startsWith(this.dataPath)?this.isListSource?(0,r.parseDataPath)(e.slice(this.dataPath.length+1))[0]??null:0:null;return i!==null&&(0,r.isNumber)(+i)&&await this.getSchemaComponent(+i)?.navigateToComponent(e,t,{shouldRevealInlinedOnly:n})?!0:!n&&this.navigateToRouteComponent(e,t)},navigateToRouteComponent(e,t){return new Promise((n,i)=>{let a=()=>{let{routeComponents:e}=this.appState,r=e[e.length-1];n(t?.([r])??!0)},o=(0,r.parseDataPath)(e);for(;o.length>0;){let e=this.routeComponent.getChildPath(this.api.normalizePath((0,r.normalizeDataPath)(o))),{matched:t}=this.$router.resolve(e);if(t.length&&t[0].name!==`catch-all`){this.$route.path===e?a():this.$router.push({path:e}).catch(i).then(()=>{this.$nextTick(a)});return}o.pop()}n(!1)})}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){Wn(e,t,n);let c=dt(t);if(c&&t.resource)throw Error(`Nested ${this.isListSource?`lists`:this.isObjectSource?`objects`:`schema`} cannot load data from their own resources`);let l=`id${i+1}`,u={api:e,schema:t},d={...u,flatten:o,nested:a,param:l},f=await Gn(e,t,i);if(s&&await s(f,i+1),D(t)&&!c){let e=i===0?``:t.path,n={path:Cc(e,w(t)?l:null),component:z.component(a?`DitoFormNested`:`DitoForm`),meta:d};C(t)&&r.push({...n,path:Cc(e,l)}),e&&w(t)&&r.push({path:e,redirect:`.`,meta:u});let[s,c]=f.reduce((e,t)=>(e[+!t.meta.flatten].push(t),e),[[],[]]);if(c.length&&(n.children=c),r.push(n),s.length)for(let e of s)r.push({...e.redirect?e:n,path:`${n.path}/${e.path}`,meta:{...e.meta,flatten:o}})}},processValue({schema:e,value:t,dataPath:n},r){return r.addSource(n,e),D(e)?t:Sc(t)}};function Sc(e){return(0,r.isArray)(e)?e.map(e=>(0,r.isObject)(e)?{...e}:e):(0,r.isObject)(e)?{...e}:e}function Cc(e,t){return t?e?`${e}/:${t}`:`:${t}`:e}var wc={text(e){let t=[{label:`contains`,value:`contains`},{label:`equals`,value:`equals`},{label:`starts with`,value:`starts-with`},{label:`ends with`,value:`ends-with`}];return{operator:e.operators?{type:`select`,width:`2/5`,options:(0,r.isArray)(e.operators)?t.filter(t=>e.operators.includes(t.value)):t,clearable:!0}:null,text:{type:`text`,width:e.operators?`3/5`:`fill`,clearable:!0}}},"date-range"(){let e={type:`datetime`,width:`1/2`,formats:{date:{day:`2-digit`,month:`2-digit`,year:`numeric`}},clearable:!0};return{from:e,to:e}}};function Tc(e,t,n,r){let{sticky:i,...a}=t,o={type:`panel`,label:`Filters`,name:`$filters`,disabled:!1,sticky:i,data(){return Mc(o,r.value)},components:kc(a),buttons:Ec(!1),panelButtons:Ec(!0),events:{change(){this.applyFilters()}},computed:{filters(){return jc(this.schema,this.data)},hasFilters(){return this.filters.length>0}},methods:{applyFilters(){r.value={...r.value,filter:this.filters,page:void 0}},clearFilters(){this.resetData(),this.applyFilters()}}};return Un(e,o),o}function Ec(e){return{clear:{type:`button`,text:e?null:`Clear`,disabled:({schemaComponent:e})=>!e.hasFilters,events:{click({schemaComponent:e}){e.clearFilters()}}},submit:{type:`submit`,text:e?null:`Filter`,visible:!e,events:{click({schemaComponent:e}){e.applyFilters()}}}}}function Dc(e){return`$${e}`}function Oc(e){return e.startsWith(`$`)?e.slice(1):null}function kc(e){let t={};for(let n of Object.values(k(e)||{})){let{filter:e,width:i,...a}=n,o=e?wc[e]?.(n):n.components;if(o){a.type=`form`,a.components={};for(let[e,t]of Object.entries(o))if(t){let n=t.label||(0,r.labelize)(t.name||e);a.components[e]={...t,label:!1,placeholder:n}}t[Dc(n.name)]={label:a.label??(0,r.labelize)(n.name),type:`object`,width:i,default:()=>({}),form:a,inlined:!0}}else throw Error(`Invalid filter '${n.name}': Unknown filter type '${e}'.`)}return t}function Ac(e,t){return e.components[t]?.form?.components}function jc(e,t){let n=[];for(let r in t){let i=t[r];if(i){let t=Object.keys(Ac(e,r)).map(e=>i[e]??null);t.some(e=>e!==null)&&n.push(`${Oc(r)}:${t.map(JSON.stringify).join(`,`)}`)}}return n}function Mc(e,t){let n={};if(t)for(let e of(0,r.asArray)(t.filter)){let[,t,i]=e.match(/^(\w+):(.*)$/);try{n[t]=(0,r.asArray)(JSON.parse(`[${i}]`))}catch{}}let i={};for(let t in e.components){let r={},a=n[Oc(t)];if(a){let n=Ac(e,t);if(n){let e=0;for(let t in n)r[t]=a[e++]}}i[t]=r}return i}var Nc=[`id`,`aria-label`],Pc={key:0,class:`dito-list__header`},Fc={key:1,class:`dito-spacer`},Ic=[`id`],Lc={key:1},Rc=[`innerHTML`],zc=[`innerHTML`],Bc={key:2,class:`dito-table__buttons`},Vc={key:1},Hc=[`colspan`];function Uc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoScopes`),c=(0,e.resolveComponent)(`DitoPagination`),l=(0,e.resolveComponent)(`DitoTableHead`),u=(0,e.resolveComponent)(`DitoTableCell`),d=(0,e.resolveComponent)(`DitoSchemaInlined`),f=(0,e.resolveComponent)(`DitoEditButtons`),p=(0,e.resolveComponent)(`DitoDraggable`);return t.isReady?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-list`,id:t.componentPath,role:`region`,"aria-label":t.label||t.labelize(t.schema.name)},[t.scopes||t.hasPagination?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Pc,[t.scopes?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,query:t.query,scopes:t.scopes},null,8,[`query`,`scopes`])):t.hasPagination?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Fc)):(0,e.createCommentVNode)(``,!0),t.hasPagination?((0,e.openBlock)(),(0,e.createBlock)(c,{key:2,query:t.query,limit:t.paginate,total:t.total||0},null,8,[`query`,`limit`,`total`])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`table`,{class:(0,e.normalizeClass)([`dito-table`,{"dito-table--separators":t.isInlined,"dito-table--larger-padding":t.hasEditButtons&&!t.isInlined,"dito-table--alternate-colors":!t.isInlined,"dito-table--even-count":t.hasEvenCount}])},[t.columns?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,query:t.query,columns:t.columns,hasEditButtons:t.hasEditButtons},null,8,[`query`,`columns`,`hasEditButtons`])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(p,{as:`tbody`,options:t.getDraggableOptions(),draggable:t.draggable,modelValue:t.listData,"onUpdate:modelValue":n[0]||=e=>t.listData=e},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.listData,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,{id:t.getComponentPath(r),key:t.getItemUid(t.schema,n)},[t.columns?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.columns,i=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(i)?((0,e.openBlock)(),(0,e.createBlock)(u,{key:i.name,class:(0,e.normalizeClass)(t.getCellClass(i)),cell:i,schema:t.schema,dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.store,nested:!1,disabled:t.disabled||t.isLoading},null,8,[`class`,`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)],64))),256)):((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Lc,[t.isInlined?((0,e.openBlock)(),(0,e.createBlock)(d,{key:0,label:t.getItemLabel(t.schema,n,{index:r,asObject:!0}),schema:t.getItemFormSchema(t.schema,n,t.context),dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.getItemStore(t.schema,n,r),disabled:t.disabled||t.isLoading,collapsed:t.collapsed,collapsible:t.collapsible,deletable:t.deletable,draggable:t.draggable&&t.listData.length>1,editable:t.editable,editPath:t.getEditPath(n,r),createPath:t.createPath,insertIndex:t.creatable&&t.draggable?r:null,onDelete:e=>t.deleteItem(n,r)},null,8,[`label`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`draggable`,`editable`,`editPath`,`createPath`,`insertIndex`,`onDelete`])):t.schema.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),{key:1,dataPath:t.getDataPath(r),data:n,nested:!1},null,8,[`dataPath`,`data`])):t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:2,innerHTML:t.render(t.getContext(n,r))},null,8,Rc)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:3,innerHTML:t.getItemLabel(t.schema,n,{index:r})},null,8,zc))])),t.hasCellEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Bc,[(0,e.createVNode)(f,{nested:``,schema:t.getItemFormSchema(t.schema,n,t.context),dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.getItemStore(t.schema,n,r),disabled:t.disabled||t.isLoading,deletable:t.deletable,draggable:t.draggable,editable:t.editable,editPath:t.getEditPath(n,r),onDelete:e=>t.deleteItem(n,r)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`deletable`,`draggable`,`editable`,`editPath`,`onDelete`])])):(0,e.createCommentVNode)(``,!0)],8,Ic))),128))]),_:1},8,[`options`,`draggable`,`modelValue`]),t.hasListButtons&&!t.single?((0,e.openBlock)(),(0,e.createElementBlock)(`tfoot`,Vc,[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`td`,{class:`dito-table__buttons`,colspan:t.numColumns},[(0,e.createVNode)(f,{buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath},null,8,[`buttons`,`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`,`creatable`,`createPath`])],8,Hc)])])):(0,e.createCommentVNode)(``,!0)],2),t.hasListButtons&&t.single?((0,e.openBlock)(),(0,e.createBlock)(f,{key:1,class:`dito-buttons--large dito-buttons--main dito-buttons--sticky`,buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.listData,meta:t.meta,store:t.store,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath},null,8,[`buttons`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`creatable`,`createPath`])):(0,e.createCommentVNode)(``,!0)],8,Nc)):(0,e.createCommentVNode)(``,!0)}var Wc=V(q.register(`list`,{mixins:[J,rs],getSourceType(e){return e},getPanelSchema(t,n,i,a){let{filters:o}=n;if(o)return Tc(t,o,i,(0,e.computed)({get(){return a.query},set(e){let t=e=>(0,r.pickBy)(e,e=>e!==void 0);(0,r.equals)(t(e),t(a.query))||(a.query=e,a.loadData(!1))}}))},computed:{hasPagination(){return!!this.paginate},hasListButtons(){return!!(this.buttonSchemas||this.creatable)},hasEditButtons(){let{listData:e}=this;return e.length>0&&(this.editable||this.deletable||this.draggable)},hasCellEditButtons(){return!this.isInlined&&this.hasEditButtons},hasEvenCount(){return!(this.listData.length%2)},numColumns(){return(this.columns?Object.keys(this.columns).length:1)+ +!!this.hasCellEditButtons}},methods:{getDataPath(e){return y(this.dataPath,e)},getComponentPath(e){return y(this.componentPath,e)},getEditPath(e,t){if(this.editable){let n=this.getItemId(this.schema,e,t);return Lt(this.schema,n,this.context)||`${this.path}/${n}`}return null},getCellClass(e){return`dito-cell--${(0,r.hyphenate)(e.name)}`},getContext(e,t){return new E(this,{data:e,value:e,index:t,dataPath:this.getDataPath(t)})},onFilterErrors(e){let t=y(this.dataPath,`$filters`),n=this.schemaComponent.getPanelByDataPath(t);if(n)return n.showValidationErrors(e,!0),!0}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Rn(t),zn(t.columns),J.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,Uc]]);function Gc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoLabel`);return(0,e.openBlock)(),(0,e.createBlock)(s,{class:`dito-label-component`,label:t.value},null,8,[`label`])}var Kc=V(q.register(`label`,{excludeValue:!0,generateLabel:!1}),[[`render`,Gc]]);function qc(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Xc(e.charCodeAt(r-1))&&Yc(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=qc(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Jc(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Xc(e.charCodeAt(i-1))&&Yc(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Jc(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Yc(e){return e>=56320&&e<57344}function Xc(e){return e>=55296&&e<56320}var Y=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return qc(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Jc(this,e,t,n)}findIndex(e){if(e==0)return Qc(0,e);if(e==this.size)return Qc(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Qc(t+1,i):Qc(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Y.empty=new Y([],0);var Zc={index:0,offset:0};function Qc(e,t){return Zc.index=e,Zc.offset=t,Zc}function $c(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!$c(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!$c(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var X=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&$c(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};X.none=[];var el=class extends Error{},tl=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=rl(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(nl(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Y.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};tl.empty=new tl(Y.empty,0,0);function nl(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(nl(a.content,t-i-1,n-i-1)))}function rl(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=rl(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function il(e,t,n){if(n.openStart>e.depth)throw new el(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new el(`Inconsistent open depths`);return al(e,t,n,0)}function al(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=al(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return Q(a,ul(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Q(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=dl(n,e);return Q(a,ll(e,i,o,t,r))}}function ol(e,t){if(!t.type.compatibleContent(e.type))throw new el(`Cannot join `+t.type.name+` onto `+e.type.name)}function sl(e,t,n){let r=e.node(n);return ol(r,t.node(n)),r}function Z(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function cl(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Z(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Z(i.child(e),r);t&&t.depth==n&&t.textOffset&&Z(t.nodeBefore,r)}function Q(e,t){if(!e.type.validContent(t))throw new el(`Invalid content for node `+e.type.name);return e.copy(t)}function ll(e,t,n,r,i){let a=e.depth>i&&sl(e,t,i+1),o=r.depth>i&&sl(n,r,i+1),s=[];return cl(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(ol(a,o),Z(Q(a,ll(e,t,n,r,i+1)),s)):(a&&Z(Q(a,ul(e,t,i+1)),s),cl(t,n,i,s),o&&Z(Q(o,ul(n,r,i+1)),s)),cl(r,null,i,s),new Y(s)}function ul(e,t,n){let r=[];return cl(null,e,n,r),e.depth>n&&Z(Q(sl(e,t,n+1),ul(e,t,n+1)),r),cl(t,null,n,r),new Y(r)}function dl(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Y.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var fl=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return X.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new gl(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=hl.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else hl.set(t,r=new pl);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%ml,i}},pl=class{constructor(){this.elts=[],this.i=0}},ml=12,hl=new WeakMap,gl=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},_l=Object.create(null),vl=class e{constructor(e,t,n,r=X.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Y.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&$c(this.attrs,t||e.defaultAttrs||_l)&&X.sameSet(this.marks,n||X.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return tl.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new tl(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return il(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return fl.resolveCached(this,e)}resolveNoCache(e){return fl.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),yl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Y.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),bl(this.type.attrs,this.attrs,`node`,this.type.name);let e=X.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];bl(n.type.attrs,n.attrs,`mark`,n.type.name),e=n.addToSet(e)}if(!X.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Y.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};vl.prototype.text=void 0;function yl(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function bl(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}var xl=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Sl(t,n);if(r.next==null)return e.empty;let i=Cl(r);r.next&&r.err(`Unexpected trailing text`);let a=Nl(Al(i));return Pl(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Y.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
7
- `)}};xl.empty=new xl(!0);var Sl=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Cl(e){let t=[];do t.push(wl(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function wl(e){let t=[];do t.push(Tl(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Tl(e){let t=kl(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Dl(e,t);else break;return t}function El(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Dl(e,t){let n=El(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:El(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ol(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function kl(e){if(e.eat(`(`)){let t=Cl(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Ol(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Al(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function jl(e,t){return t-e}function Ml(e,t){let n=[];return r(t),n.sort(jl);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Nl(e){let t=Object.create(null);return n(Ml(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Ml(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new xl(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(jl);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Pl(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var Fl=[`id`],Il={key:0,class:`dito-buttons dito-buttons--toolbar`},Ll={class:`dito-buttons__group`},Rl=[`aria-label`,`aria-pressed`,`onClick`];function zl(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`EditorContent`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-markup`,id:t.componentPath},[t.groupedButtons.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Il,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.groupedButtons,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ll,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t,({id:t,label:n,icon:r,isActive:i,onClick:a})=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{class:(0,e.normalizeClass)([`dito-button`,{"dito-button--active":i}]),key:t,"aria-label":n,"aria-pressed":i,onClick:a},[(0,e.createVNode)(s,{name:r},null,8,[`name`])],10,Rl))),128))]))),256))])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(c,{class:`dito-markup-editor`,ref:`editor`,editor:t.editor,style:(0,e.normalizeStyle)(t.styles)},null,8,[`editor`,`style`]),t.resizable?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-resize`,onMousedown:n[0]||=(0,e.withModifiers)((...e)=>t.onDragResize&&t.onDragResize(...e),[`stop`,`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0)],8,Fl)}var Bl=q.register(`markup`,{mixins:[G],components:{EditorContent:f.EditorContent,DitoIcon:Qr},data(){return{editor:null,height:null}},computed:{lines(){return this.schema.lines||10},hardBreak(){return!!this.schema.hardBreak},styles(){return{height:this.height||`calc(${this.lines}em * var(--line-height))`}},markButtons(){return this.getButtons(`marks`,{bold:!0,italic:!0,underline:!0,strike:!0,small:!0,code:!0,subscript:!0,superscript:!0,link:{onClick:e=>this.onClickLink(e)}})},basicNodeButtons(){return this.getButtons(`nodes`,{paragraph:{command:`setParagraph`},heading:{attribute:`level`,values:[1,2,3,4,5,6]}})},advancedNodeButtons(){return this.getButtons(`nodes`,{bulletList:!0,orderedList:!0,blockquote:!0,codeBlock:!0})},toolButtons(){return this.getButtons(`tools`,{undo:!0,redo:!0,footnotes:{command:`addFootnote`}})},groupedButtons(){return[this.markButtons,this.basicNodeButtons,this.advancedNodeButtons,this.toolButtons].filter(e=>e.length>0)},parseOptions(){return{preserveWhitespace:{collapse:!1,preserve:!0,"preserve-all":`full`}[this.whitespace]}},editorOptions(){return{editable:!this.readonly,autoFocus:this.autofocus,disableInputRules:!this.enableRules.input,disablePasteRules:!this.enableRules.paste,parseOptions:this.parseOptions,editorProps:this.hardBreak?{handlePaste:(e,t,n)=>{let r=[];n.content.forEach((t,n,i)=>{i>0&&t.type.name===`paragraph`&&r.push(e.state.schema.nodes.hardBreak.create()),t.type.name===`paragraph`?t.content.forEach(e=>r.push(e)):r.push(t)});let i=e.state.schema.nodes.paragraph.create(null,Y.from(r));return e.dispatch(e.state.tr.replaceSelection(new tl(Y.from(i),0,0))),!0}}:{}}},resizable:P(`resizable`,{type:Boolean,default:!1}),whitespace:P(`whitespace`,{type:String,default:`collapse`}),enableRules:P(`enableRules`,{type:[Object,Boolean],default:!1,get(e){return(0,r.isObject)(e)?e:{input:!!e,paste:!!e}}})},watch:{readonly:`updateEditorOptions`,autofocus:`updateEditorOptions`,enableRules:`updateEditorOptions`},created(){let e=!1,t=!1,n=()=>this.onFocus(),i=()=>{s(),this.onBlur(),c()},a=()=>{o(),this.onInput()},o=(0,r.debounce)(()=>s(),100),s=()=>{let n=this.editor.getHTML(),r=this.hardBreak?n.replace(/^<p>(.*?)<\/p>$/s,`$1`):n;r!==this.value&&(e=!0,t=!0,this.value=r),this.focused||c()},c=()=>{e&&(e=!1,this.onChange())};this.$watch(`value`,e=>{if(t)t=!1;else{let t=this.hardBreak?`<p>${e}</p>`:e;this.editor.commands.setContent(t,{emitUpdate:!1,parseOptions:this.parseOptions})}}),this.editor=new f.Editor({...this.editorOptions,onFocus:n,onBlur:i,onUpdate:a,extensions:this.getExtensions(),content:this.value||``})},unmounted(){this.editor.destroy()},methods:{onDragResize(e){let t=({clientX:e,clientY:t})=>({x:e,y:t}),n=t(e).y,r=parseFloat(getComputedStyle(this.$refs.editor.$el).height),i=e=>{let{y:i}=t(e);r+=i-n,n=i,this.height=`${Math.max(r,0)}px`},a=this.domOn(document,{mousemove:i,mouseup(e){i(e),a.remove()}})},updateEditorOptions(){this.editor.setOptions(this.editorOptions)},async onClickLink(e){let t=await this.rootComponent.showDialog({components:{href:{type:`url`,label:`Link`,autofocus:!0},title:{type:`text`,label:`Title`}},buttons:{cancel:{},apply:{type:`submit`},remove:{events:{click({dialogComponent:e}){e.resolve(null)}}}},data:(0,f.getMarkAttributes)(this.editor.state,`link`)});if(t){let{href:n,title:r}=t;if(n)try{new URL(n)}catch{n=`https://${n}`}e.commands.setLink({href:n,title:r})}else t===null&&e.commands.unsetLink()},getExtensions(){let{marks:e={},nodes:t={},tools:n={}}=this.schema;return[n.footnotes?p.Document.extend({content:`block+ footnotes?`}):p.Document,m.Text,le.Paragraph,e.bold&&h.Bold,e.italic&&ee.Italic,e.underline&&ie.Underline,e.strike&&te.Strike,e.small&&Vl,e.code&&g.Code,e.subscript&&re.Superscript,e.superscript&&ne.Subscript,e.link&&Hl,t.blockquote&&ae.Blockquote,t.codeBlock&&oe.CodeBlock,t.heading&&ce.Heading.configure({levels:t.heading}),t.horizontalRule&&ue.HorizontalRule,(t.orderedList||t.bulletList)&&pe.ListItem,t.bulletList&&fe.BulletList,t.orderedList&&de.OrderedList,...n.footnotes?[me.Footnotes,me.Footnote,me.FootnoteReference]:[],n.history&&he.History,se.HardBreak.extend({addKeyboardShortcuts:()=>{let e=()=>this.editor.commands.setHardBreak();return{"Mod-Enter":e,"Shift-Enter":e,...this.hardBreak?{Enter:e}:null}}})].filter(e=>!!e)},getButtons(e,t){let n=[],{commands:i}=this.editor,a=({name:e,id:t=e,label:a=this.labelize(t),icon:o,command:s,attributes:c,onClick:l})=>{n.push({id:t,label:a,icon:o,isActive:this.editor.isActive(e,c),onClick:()=>{s??=e in i?e:`toggle${(0,r.camelize)(e,!0)}`,s in i&&(l?l(this.editor,c):(e=>this.editor.chain()[s](e).focus().run())(c))}})},o=this.schema[e];if(o)for(let[e,n]of Object.entries(t)){let t=o[[`undo`,`redo`].includes(e)?`history`:e],i=(0,r.hyphenate)(e);if(t){if(n===!0)a({name:e,icon:i});else if((0,r.isObject)(n)){let{command:o,attribute:s,values:c,onClick:l}=n;if(s){if((0,r.isArray)(c)&&(0,r.isArray)(t))for(let n of c)t.includes(n)&&a({name:e,id:`${e}-${n}`,icon:`${i}-${n}`,command:o,attributes:{[s]:n},onClick:l})}else a({name:e,icon:i,command:o,onClick:l})}}}return n},focusElement(){this.editor.commands.focus()},blurElement(){this.editor.commands.blur()}}}),Vl=f.Mark.create({name:`small`,parseHTML(){return[{tag:`small`}]},renderHTML(){return[`small`,0]},addCommands(){return{setSmall:e=>({commands:t})=>t.setMark(this.name,e),toggleSmall:e=>({commands:t})=>t.toggleMark(this.name,e),unsetSmall:()=>({commands:e})=>e.unsetMark(this.name)}}}),Hl=_.Link.extend({inclusive:!1,addAttributes(){return{href:{default:null},title:{default:null}}},parseHTML(){return[{tag:`a`,getAttrs:e=>({href:e.getAttribute(`href`),title:e.getAttribute(`title`)})}]},renderHTML({HTMLAttributes:e}){return[`a`,e,0]}}),Ul=V(Bl,[[`render`,zl]]),Wl={class:`dito-multiselect`},Gl={class:`dito-multiselect__inner`};function Kl(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`VueMultiselect`),l=(0,e.resolveComponent)(`DitoEditButtons`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Wl,[(0,e.createElementVNode)(`div`,Gl,[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`]),(0,e.createVNode)(c,(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.selectedOptions,"onUpdate:modelValue":n[0]||=e=>t.selectedOptions=e,"aria-label":t.label,class:t.multiselectClasses,showLabels:!1,placeholder:t.placeholder,tagPlaceholder:`Press enter to add new tag`,options:t.populate&&t.activeOptions||[],customLabel:t.getLabelForOption,trackBy:t.optionValue,groupLabel:t.groupByLabel,groupValues:t.groupByOptions,multiple:t.multiple,taggable:t.taggable,searchable:t.searchable,internalSearch:!t.searchFilter,preserveSearch:!!t.searchFilter,clearOnSelect:!t.searchFilter,closeOnSelect:!t.stayOpen,loading:t.isLoadingOptions||t.isLoadingSearchedOptions},t.attributes,{onOpen:t.onOpen,onClose:t.onClose,onTag:t.onAddTag,onSearchChange:t.onSearchChange}),null,16,[`id`,`modelValue`,`aria-label`,`class`,`placeholder`,`options`,`customLabel`,`trackBy`,`groupLabel`,`groupValues`,`multiple`,`taggable`,`searchable`,`internalSearch`,`preserveSearch`,`clearOnSelect`,`closeOnSelect`,`loading`,`onOpen`,`onClose`,`onTag`,`onSearchChange`]),(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),t.editable?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:!1,editable:t.editable,editPath:t.editPath},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`editable`,`editPath`])):(0,e.createCommentVNode)(``,!0)])}var ql=V(q.register(`multiselect`,{mixins:[Xs],components:{DitoAffixes:K,VueMultiselect:ge.default},data(){return{searchedOptions:null,isLoadingSearchedOptions:!1,currentSearchTerm:null,populate:!1}},computed:{selectedOptions:{get(){return this.multiple?(this.selectedValue||[]).map(e=>this.getOptionForValue(e)||this.addTagOption(e)).filter(Boolean):this.selectedOption},set(e){this.selectedValue=this.multiple?(e||[]).map(e=>this.getValueForOption(e)):this.getValueForOption(e),this.onChange()}},activeOptions(){return this.searchedOptions||this.options},multiple:P(`multiple`,{type:Boolean,default:!1}),searchable:P(`searchable`,{type:Boolean,default:!1}),taggable:P(`taggable`,{type:Boolean,default:!1}),stayOpen:P(`stayOpen`,{type:Boolean,default:!1}),multiselectClasses(){let e=`multiselect`;return{[`${e}--multiple`]:this.multiple,[`${e}--loading`]:this.isLoadingOptions||this.isLoadingSearchedOptions,[`${e}--highlight`]:this.showHighlight}},placeholder(){let{placeholder:e,searchable:t,taggable:n}=this.schema;return(0,r.isBoolean)(e)&&(e=e?void 0:null),e===void 0?t&&n?`Search or add a ${this.label}`:t?`Select or search ${this.label}`:void 0:e},showHighlight(){return this.isMounted&&this.$refs.element.pointerDirty}},mounted(){this.autofocus&&this.focus()},methods:{addTagOption(e){if(this.taggable){let{optionLabel:t,optionValue:n}=this,r=t&&n?{[t]:e,[n]:e}:e;return this.options.push(r),r}},focusElement(){this.$refs.element.activate()},blurElement(){this.$refs.element.deactivate()},onOpen(){this.populate=!0},onClose(){this.focused&&this.onBlur()},onBlur(){this.$refs.element.isOpen||Nn.methods.onBlur.call(this)},onAddTag(e){let t=this.addTagOption(e);t&&(this.value??=[],this.value.push(this.getValueForOption(t)))},async loadSearchedOptions(e){try{return await this.optionsResolver.waitForValue(),await this.searchFilter(new E(this,{searchTerm:e}))}catch(e){return this.addError(e.message||e),null}},async onSearchChange(e){if(this.searchFilter){if(this.currentSearchTerm=e,e){this.searchedOptions=[];let t=setTimeout(()=>{this.isLoadingSearchedOptions=!0},0),n=await this.loadSearchedOptions(e);clearTimeout(t),e===this.currentSearchTerm&&(this.searchedOptions=n,this.isLoadingSearchedOptions=!1)}else this.searchedOptions=null,this.isLoadingSearchedOptions=!1}}}}),[[`render`,Kl]]),Jl={getTypeValidations(e,t){let n=e.type===`integer`,r=n=>A(n,{type:Number,schema:e,context:t}),i=(e,t)=>n&&e!=null?t(e):e,a=A(`range`,{type:Array,schema:e,context:t}),o=i(r(`min`)??a?.[0],Math.floor),s=i(r(`max`)??a?.[1],Math.ceil),c=i(r(`step`),Math.ceil),l=r(`decimals`),u={};if(o!=null&&s!=null?u.range=[o,s]:(o!=null&&(u.min=o),s!=null&&(u.max=s)),l!=null)u.decimals=l;else if(c){let e=(`${c}`.split(`.`)[1]||``).length;e>0?u.decimals=e:u.integer=!0}return n&&(u.integer=!0),u},computed:{inputValue:{get(){return this.value===null?``:this.value},set(e){this.value=e===``?null:this.isInteger?Number(e):parseFloat(e)}},isInteger(){return!1},stepValue(){return this.step==null&&!this.isInteger?`any`:this.step},decimals:P(`decimals`,{type:Number}),step:P(`step`,{type:Number,get(e){return this.isInteger&&e!=null?Math.ceil(e):e}}),min:P(`min`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[0]:e,this.isInteger&&e!=null?Math.floor(e):e}}),max:P(`max`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[1]:e,this.isInteger&&e!=null?Math.ceil(e):e}}),range:P(`range`,{type:Array,get(){let{min:e,max:t}=this;return e!=null&&t!=null?[e,t]:void 0},set(e){(0,r.isArray)(e)&&([this.min,this.max]=e)}})}};function Yl(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:`dito-number`,id:t.componentPath,ref:`element`,modelValue:t.inputValue,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:`number`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`min`,`max`,`step`])}var Xl=V(q.register([`number`,`integer`],{mixins:[Jl],components:{DitoInput:H,DitoAffixes:K},nativeField:!0,textField:!0,computed:{isInteger(){return this.type===`integer`}}}),[[`render`,Yl]]),Zl=[`id`],Ql={key:0,class:`dito-object-content`},$l=[`innerHTML`],eu=[`innerHTML`];function tu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSchemaInlined`),c=(0,e.resolveComponent)(`DitoEditButtons`);return t.isReady?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-object`,id:t.componentPath},[t.objectData?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ql,[t.isInlined?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,label:t.objectLabel,schema:t.getItemFormSchema(t.schema,t.objectData,t.context),dataPath:t.dataPath,data:t.objectData,meta:t.nestedMeta,store:t.store,disabled:t.disabled||t.isLoading,collapsed:t.collapsed,collapsible:t.collapsible,deletable:t.deletable,accumulatedBasis:t.accumulatedBasis,onDelete:n[0]||=e=>t.deleteItem(t.objectData)},null,8,[`label`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`accumulatedBasis`])):t.schema.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),{key:1,dataPath:t.dataPath,data:t.objectData,nested:!1},null,8,[`dataPath`,`data`])):t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:2,innerHTML:t.render(t.getContext())},null,8,$l)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:3,innerHTML:t.getItemLabel(t.schema,t.objectData)},null,8,eu))])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(c,{buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.objectData,path:t.path,meta:t.meta,store:t.store,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath,editable:t.editable,editPath:t.path,deletable:!t.isInlined&&t.deletable,onDelete:n[1]||=e=>t.deleteItem(t.objectData)},null,8,[`buttons`,`schema`,`dataPath`,`data`,`path`,`meta`,`store`,`disabled`,`creatable`,`createPath`,`editable`,`editPath`,`deletable`])],8,Zl)):(0,e.createCommentVNode)(``,!0)}var nu=V(q.register(`object`,{mixins:[J],getSourceType(e){return e},computed:{objectLabel(){return this.collapsible?this.getItemLabel(this.schema,this.objectData,{asObject:!0}):null}},methods:{getContext(){return new E(this,{data:this.objectData})}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Rn(t),J.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,tu]]),ru=q.register(`panel`,{defaultNested:!1,generateLabel:!1,omitSpacing:!0,getPanelSchema(e,t){return t},async processSchema(e,t,n,r,i){await I(e,t,r,i)},render(){return null}}),iu=[`id`,`value`,`max`];function au(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`progress`,(0,e.mergeProps)({class:`dito-progress`,id:t.componentPath,ref:`element`,value:t.progressValue,max:t.progressMax},t.attributes),null,16,iu)}var ou=V(q.register(`progress`,{mixins:[Jl],computed:{progressValue(){let{value:e,range:t,step:n}=this;return e===null?e=``:(t&&(e-=t[0]),n&&(e=Math.round(e/n)*n)),e},progressMax(){let{range:e}=this;return e?e[1]-e[0]:null}}}),[[`render`,au]]),su=[`id`,`aria-label`],cu=[`value`];function lu(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:(0,e.normalizeClass)([`dito-radio-buttons`,`dito-layout--${t.schema.layout||`vertical`}`]),id:t.componentPath,role:`radiogroup`,"aria-label":t.label},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.options,r=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`label`,null,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({class:`dito-radio-button`,ref_for:!0,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedValue=e,type:`radio`,value:t.getValueForOption(r)},{ref_for:!0},t.attributes),null,16,cu),[[e.vModelRadio,t.selectedValue]]),(0,e.createTextVNode)((0,e.toDisplayString)(t.getLabelForOption(r)),1)])]))),256))],10,su)}var uu=V(q.register(`radio`,{mixins:[Xs],nativeField:!0,defaultWidth:`auto`}),[[`render`,lu]]);function du(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSchemaInlined`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-section`,{"dito-section--labelled":t.hasLabel}])},[(0,e.createVNode)(s,{class:`dito-section__schema`,schema:t.getItemFormSchema(t.schema,t.item,t.context),dataPath:t.dataPath,data:t.item,meta:t.meta,store:t.store,label:t.label,info:t.info,padding:t.hasLabel?`nested`:`inlined`,disabled:t.disabled,collapsed:t.collapsed,collapsible:t.collapsible,labelNode:t.labelNode},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`label`,`info`,`padding`,`disabled`,`collapsed`,`collapsible`,`labelNode`])],2)}var fu=V(q.register(`section`,{mixins:[Fi],defaultValue:({schema:e})=>e.nested?{}:void 0,ignoreMissingValue:({schema:e})=>!e.nested&&!(`default`in e),treatNullAsMissing:({schema:e})=>!!e.nested,defaultNested:!1,generateLabel:!1,computed:{item(){return this.nested?this.value:this.data},hasLabel(){return!!this.schema.label},collapsible:P(`collapsible`,{type:Boolean,default:!1}),collapsed:P(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}})},methods:{getItemFormSchema:Vt,async navigateToComponent(e,t,n){let{mainSchemaComponent:i}=this,a=this.dataPath?`${this.dataPath}/`:``,o=(0,r.normalizeDataPath)(e),s=o.startsWith(a)?(0,r.parseDataPath)(o.slice(a.length))[0]:null;return!!i&&tt(i.schema,s)&&i.navigateToComponent(e,t,n)}},async processSchema(e,t,n,r,i){await I(e,t,r,i)}}),[[`render`,du]]),pu={class:`dito-select`},mu={class:`dito-select__inner`},hu=[`id`],gu=[`label`],_u=[`value`],vu=[`value`],yu=[`value`];function bu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoEditButtons`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,pu,[(0,e.createElementVNode)(`div`,mu,[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`]),(0,e.withDirectives)((0,e.createElementVNode)(`select`,(0,e.mergeProps)({id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedValue=e},t.attributes,{onMousedown:n[1]||=e=>t.populate=!0,onFocus:n[2]||=e=>t.populate=!0}),[t.populate?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.options,n=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.groupBy?((0,e.openBlock)(),(0,e.createElementBlock)(`optgroup`,{key:0,label:n[t.groupByLabel]},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(n[t.groupByOptions],n=>((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{value:t.getValueForOption(n)},(0,e.toDisplayString)(t.getLabelForOption(n)),9,_u))),256))],8,gu)):((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{key:1,value:t.getValueForOption(n)},(0,e.toDisplayString)(t.getLabelForOption(n)),9,vu))],64))),256)):t.selectedOption?((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{key:1,value:t.selectedValue},(0,e.toDisplayString)(t.getLabelForOption(t.selectedOption)),9,yu)):(0,e.createCommentVNode)(``,!0)],16,hu),[[e.vModelSelect,t.selectedValue]]),(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),t.editable?((0,e.openBlock)(),(0,e.createBlock)(c,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:!1,editable:t.editable,editPath:t.editPath},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`editable`,`editPath`])):(0,e.createCommentVNode)(``,!0)])}var xu=V(q.register(`select`,{mixins:[Xs],components:{DitoAffixes:K},nativeField:!0,data(){return{populate:!0}}}),[[`render`,bu]]),Su={class:`dito-slider`},Cu=[`id`,`min`,`max`,`step`];function wu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Su,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({class:`dito-range`,id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:`range`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),null,16,Cu),[[e.vModelText,t.inputValue]]),t.input?((0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({key:0,class:`dito-number`,modelValue:t.inputValue,"onUpdate:modelValue":n[1]||=e=>t.inputValue=e,type:`number`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),null,16,[`modelValue`,`min`,`max`,`step`])):(0,e.createCommentVNode)(``,!0)])}var Tu=V(q.register(`slider`,{mixins:[Jl],components:{DitoInput:H},nativeField:!0,computed:{input:P(`input`,{type:Boolean,default:!0})}}),[[`render`,wu]]);function Eu(e,t,n,r,i,a){return null}var Du=V(q.register(`spacer`,{defaultValue:()=>void 0,excludeValue:!0,generateLabel:!1}),[[`render`,Eu]]);function Ou(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSwitch`);return(0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({class:`dito-switch`,id:t.componentPath,ref:`element`,modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,labels:t.labels},t.attributes),null,16,[`id`,`modelValue`,`labels`])}var ku=V(q.register(`switch`,{defaultValue:!1,defaultWidth:`auto`,components:{DitoSwitch:Oi},computed:{labels(){return this.schema.labels}}}),[[`render`,Ou]]),Au={computed:{trim:P(`trim`,{type:Boolean,default:!1})},processValue(e){let{schema:t,value:n}=e;return t.trim&&n!=null&&(0,r.isString)(n)&&(n=n.trim()),n===``&&(n=Jt(t,e)),n}};function ju(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:`dito-text`,id:t.componentPath,ref:`element`,modelValue:t.inputValue,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:t.inputType},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`type`])}var Mu=`****************`,Nu=V(q.register([`text`,`email`,`url`,`hostname`,`domain`,`tel`,`password`,`creditcard`],{mixins:[Au],components:{DitoInput:H,DitoAffixes:K},nativeField:!0,textField:!0,ignoreMissingValue:({schema:e})=>e.type===`password`,getTypeValidations(e){let t={email:`email`,url:`url`,hostname:`hostname`,domain:`domain`,password:`password`,creditcard:`creditcard`}[e.type];return t?{[t]:!0}:{}},computed:{inputType(){return{creditcard:`text`,hostname:`text`,domain:`text`}[this.type]||this.type},inputValue:{get(){return this.type===`password`&&this.value===void 0&&!this.focused?Mu:this.value},set(e){this.value=e}}}}),[[`render`,ju]]),Pu=[`id`,`rows`];function Fu(t,n,r,i,a,o){return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`textarea`,(0,e.mergeProps)({class:`dito-textarea dito-input`,id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.value=e},t.attributes,{rows:t.lines,class:{"dito-textarea--resizable":t.resizable}}),null,16,Pu)),[[e.vModelText,t.value]])}var Iu=V(q.register(`textarea`,{mixins:[Au],nativeField:!0,textField:!0,computed:{lines(){return this.schema.lines||4},resizable:P(`resizable`,{type:Boolean,default:!1})}}),[[`render`,Fu]]),Lu={class:`dito-tree-list`},Ru={class:`dito-tree-panel`},zu={key:0,class:`dito-tree-form-container`};function Bu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoScopes`),c=(0,e.resolveComponent)(`DitoTreeItem`),l=(0,e.resolveComponent)(`DitoRouterView`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Lu,[t.scopes?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,query:t.query,scopes:t.scopes},null,8,[`query`,`scopes`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,Ru,[(0,e.createVNode)(c,{schema:t.treeSchema,dataPath:t.treeDataPath,data:t.treeData,draggable:t.draggable,open:!0,"onUpdate:data":n[0]||=e=>t.value=e},null,8,[`schema`,`dataPath`,`data`,`draggable`]),t.editPath&&t.hasEditableForms?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,zu,[(0,e.createVNode)(l,{routeLevel:t.routeComponent.routeLevel+1},null,8,[`routeLevel`])])):(0,e.createCommentVNode)(``,!0)])])}var Vu=V(q.register([`tree-list`,`tree-object`],{mixins:[J],provide(){return{container:this}},getSourceType(e){return e===`tree-object`?`object`:`list`},computed:{path(){return this.formComponent?.path},editPath(){let e=this.$route.path.slice(this.path?.length);return e.startsWith(`/${this.schema.path}`)?e:``},treeData(){return this.isListSource?{[this.name]:this.value}:this.value},treeDataPath(){return this.isListSource?Ae(this.dataPath):this.dataPath},treeSchema(){return this.isListSource?{children:{name:this.name,...this.schema}}:this.schema},hasEditableForms(){let e=t=>D(t)&&(this.getSchemaValue(`editable`,{type:Boolean,default:!1,schema:t})||t.children&&e(t.children));return e(this.schema)}},async processSchema(e,t,n,r,i,a=!0,o=!1,s=null){await Promise.all([zn(t.properties),J.processSchema(e,t,n,r,i,a,o,(n,r)=>{let{children:i}=t;if(i)return i.type=`tree-list`,this.processSchema(e,i,i.name,n,r,a,!0,s)})])},getFormSchemasForProcessing(e,t){let{children:n}=e;return O(e,t,n?e=>({...e,components:{...e.components,[n.name]:n}}):null)}}),[[`render`,Bu]]),$=[``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Hu(e,{base:t=10}={}){let n=Wu(t),r=Math.abs(e),i=Math.min(r>=1?Math.floor(Math.log(r)/Math.log(n)):0,$.length-1),a=Gu(r,n,i);a>=n&&i<$.length-1&&(a=Gu(r,n,++i));let o=$[i],s=o?t===10?`${o}B`:`${o.toUpperCase()}iB`:`B`;return`${e<0?`-`:``}${a} ${s}`}function Uu(e,{base:t=10}={}){let[,n,r]=String(e).match(/^([\d.,]*)\s*(\D*)$/)||[],i=parseFloat(n?.replace(`,`,`.`));if(!isFinite(i))throw Error(`Can't interpret file size: ${e}`);let a=Wu(/^[kmgtpezy]ib?$/i.test(r)?2:t),o=r.replace(/^bits?$/,`b`).match(/^([KMGTPEZY]?)b$/);if(o){let e=$.indexOf(o[1].replace(`K`,`k`));return Math.round(i*a**e/8)}let s=$.findIndex(e=>e.toLowerCase()===r.toLowerCase().replace(/^(bytes?|b)$/,``).replace(/^(\w)(i?b|i)$/,`$1`));if(s>=0)return Math.round(i*a**s);throw Error(`Invalid file size unit: ${r}`)}function Wu(e){return e===10?1e3:1024}function Gu(e,t,n){let r=n>0?100:1;return Math.round(e/t**n*r)/r}var Ku={class:`dito-upload`},qu={class:`dito-table dito-table--separators dito-table--background`},Ju=[`innerHTML`],Yu={key:1},Xu=[`download`,`href`,`onClick`],Zu={key:2},Qu={class:`dito-upload__size`},$u={class:`dito-upload__status`},ed={class:`dito-table__buttons`},td={class:`dito-buttons dito-buttons--round`},nd=[`title`],rd=[`onClick`],id={key:0},ad={colspan:4},od={class:`dito-upload-footer`},sd=[`value`],cd={class:`dito-buttons dito-buttons--round`},ld=[`title`];function ud(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`VueUpload`),c=(0,e.resolveComponent)(`DitoUploadFile`),l=(0,e.resolveComponent)(`DitoDraggable`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ku,[(0,e.createVNode)(s,{class:`dito-upload__input`,ref:`upload`,modelValue:t.uploads,"onUpdate:modelValue":n[0]||=e=>t.uploads=e,inputId:t.dataPath,name:t.dataPath,disabled:t.disabled,postAction:t.uploadPath,extensions:t.extensions,accept:t.accept,multiple:t.multiple,size:t.maxSize,drop:t.$el?.closest(`.dito-container`),dropDirectory:!0,onInputFilter:t.onInputFilter,onInputFile:t.onInputFile},null,8,[`modelValue`,`inputId`,`name`,`disabled`,`postAction`,`extensions`,`accept`,`multiple`,`size`,`drop`,`onInputFilter`,`onInputFile`]),(0,e.createElementVNode)(`table`,qu,[n[5]||=(0,e.createElementVNode)(`thead`,{class:`dito-table-head`},[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`File`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`Size`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`Status`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`)])])],-1),(0,e.createVNode)(l,{modelValue:t.files,"onUpdate:modelValue":n[2]||=e=>t.files=e,as:`tbody`,options:t.getDraggableOptions(),draggable:t.draggable},{default:(0,e.withCtx)(()=>[t.multiple||!t.isUploadActive?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.files,(r,i)=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,{key:r.name},[t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,{key:0,innerHTML:t.renderFile(r,i)},null,8,Ju)):t.downloadUrls[i]?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Yu,[(0,e.createElementVNode)(`a`,{download:r.name,href:t.downloadUrls[i],target:`_blank`,onClick:(0,e.withModifiers)(e=>t.onClickDownload(r,i),[`prevent`])},[(0,e.createVNode)(c,{file:r,thumbnail:t.thumbnails,thumbnailUrl:t.thumbnailUrls[i]},null,8,[`file`,`thumbnail`,`thumbnailUrl`])],8,Xu)])):((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Zu,[(0,e.createVNode)(c,{file:r,thumbnail:t.thumbnails,thumbnailUrl:t.thumbnailUrls[i]},null,8,[`file`,`thumbnail`,`thumbnailUrl`])])),(0,e.createElementVNode)(`td`,Qu,(0,e.toDisplayString)(t.formatFileSize(r.size)),1),(0,e.createElementVNode)(`td`,$u,[r.upload?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[r.upload.error?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)(`Error: `+(0,e.toDisplayString)(r.upload.error),1)],64)):r.upload.active?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createTextVNode)(`Uploading...`)],64)):r.upload.success?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createTextVNode)(`Uploaded`)],64)):(0,e.createCommentVNode)(``,!0)],64)):((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createTextVNode)(`Stored`)],64))]),(0,e.createElementVNode)(`td`,ed,[(0,e.createElementVNode)(`div`,td,[t.multiple?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-button dito-button--upload`,title:t.uploadTitle,onClick:n[1]||=(...e)=>t.onClickUpload&&t.onClickUpload(...e)},null,8,nd)),t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:1,class:`dito-button`},{ref_for:!0},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:2,class:`dito-button`,type:`button`},{ref_for:!0},t.getButtonAttributes(t.verbs.delete),{onClick:e=>t.deleteFile(r,i)}),null,16,rd)):(0,e.createCommentVNode)(``,!0)])])]))),128)):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`modelValue`,`options`,`draggable`]),t.multiple||t.isUploadActive||!t.hasFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`tfoot`,id,[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`td`,ad,[(0,e.createElementVNode)(`div`,od,[t.isUploadActive?((0,e.openBlock)(),(0,e.createElementBlock)(`progress`,{key:0,class:`dito-progress`,value:t.uploadProgress,max:`100`},null,8,sd)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,cd,[t.isUploadActive?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-button`,type:`button`,onClick:n[3]||=(0,e.withModifiers)(e=>t.upload.active=!1,[`prevent`])},`Cancel`)):(0,e.createCommentVNode)(``,!0),t.multiple||!t.hasFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,class:`dito-button dito-button--upload`,title:t.uploadTitle,onClick:n[4]||=(...e)=>t.onClickUpload&&t.onClickUpload(...e)},null,8,ld)):(0,e.createCommentVNode)(``,!0)])])])])])):(0,e.createCommentVNode)(``,!0)])])}var dd=q.register(`upload`,{mixins:[rs],components:{VueUpload:_e.default},data(){return{uploads:[]}},computed:{upload(){return this.$refs.upload},uploadTitle(){return this.multiple?`Upload Files`:`Upload File`},files(){return fd(this.value)},downloadUrls(){return this.files.map((e,t)=>this.getDownloadUrl(e,t))},thumbnailUrls(){return this.files.map((e,t)=>this.getThumbnailUrl(e,t))},multiple:P(`multiple`,{type:Boolean,default:!1,callback:!1}),extensions:P(`extensions`,{type:[Array,String,RegExp]}),accept:P(`accept`,{type:Array,get(e){return(0,r.isArray)(e)?e.join(`,`):e}}),maxSize:P(`maxSize`,{type:[String,Number],get(e){return e?Uu(e):void 0}}),draggable:P(`draggable`,{type:Boolean,default:!1,get(e){return e&&this.files.length>1}}),deletable:P(`deletable`,{type:Boolean,default:!1}),render:P(`render`,{type:Function,default:null}),thumbnails:P(`thumbnails`,{type:[Boolean,String],default(e){return e??!!this.schema.thumbnailUrl},get(e){return e===!0?`medium`:e||null}}),hasFiles(){return this.files.length>0},hasUploads(){return this.uploads.length>0},isUploadReady(){return this.hasUploads&&!(this.upload.active||this.upload.uploaded)},isUploadActive(){return this.hasUploads&&this.upload.active},uploadProgress(){return this.uploads.reduce((e,t)=>e+ +t.progress,0)/this.uploads.length},uploadPath(){return this.getResourceUrl({type:`upload`,method:`post`,path:this.api.normalizePath(this.dataPath)})}},watch:{isUploadReady(e){e&&this.$nextTick(()=>{this.upload.active=!0})}},methods:{formatFileSize:Hu,getFileContext(e,t){return this.multiple?new E(this,{value:e,data:this.files,index:t,dataPath:y(this.dataPath,t)}):this.context},renderFile(e,t){return this.render(this.getFileContext(e,t))},getDownloadUrl(e,t){return e.url?e.url:!e.upload||e.upload.success?this.getSchemaValue(`downloadUrl`,{type:`String`,default:null,context:this.getFileContext(e,t)}):null},getThumbnailUrl(e,t){return!e.upload||e.upload.success?this.getSchemaValue(`thumbnailUrl`,{type:`String`,default:null,context:this.getFileContext(e,t)})||(e.type.startsWith(`image/`)?e.url:null):null},deleteFile(e,t){let{name:n}=e;e&&window.confirm(`Do you really want to ${this.verbs.remove} ${n}?`)&&(this.multiple?this.value.splice(t,1):this.value=null,e.upload&&this.upload.remove(e.upload),this.onChange(),this.notify({type:`info`,title:`Successfully Removed`,text:`${n} was ${this.verbs.deleted}.`}))},getFileIndex(e){return this.multiple&&this.value?this.value.findIndex(t=>t.id===e.id):-1},addFile(e){this.multiple?this.value?this.value.push(e):this.value=[e]:this.value=e},replaceFile(e,t){if(this.multiple){let n=this.getFileIndex(e);n>=0&&(t?this.value[n]=t:this.value.splice(n,1))}else this.value=t},removeFile(e){this.replaceFile(e,null)},onInputFile(e,t){if(e&&!t){let{id:t,name:n,size:r}=e;this.addFile({id:t,name:n,size:r,upload:e})}if(e&&t){let{success:t,error:n}=e;if(t){this.onChange();let t=e.response[0];t?(t.upload=e,this.replaceFile(e,t)):this.removeFile(e)}else if(n){this.removeFile(e);let t={abort:`Upload aborted`,denied:`Upload denied`,extension:`Unsupported file-type: ${e.name}`,network:`Network error encountered during upload`,server:`Server error occurred during upload`,size:`File is too large: ${Hu(e.size)}`,timeout:`Timeout occurred during upload`}[n]||`Unknown File Upload Error: '${n}'`;this.notify({type:`error`,error:n,title:`File Upload Error`,text:t})}}},onInputFilter(e){let t=e?.xhr;this.api.cors?.credentials&&t&&!t.withCredentials&&(t.withCredentials=!0)},async onClickDownload(e,t){try{let n=await(await fetch(this.downloadUrls[t])).blob();this.download({filename:e.name,url:URL.createObjectURL(n)})}catch(e){console.error(e)}},onClickUpload(e){this.upload.$el.querySelector(`input`).dispatchEvent(new e.constructor(e.type,e))}},processValue({schema:e,value:t}){let n=fd(t).map(({upload:e,...t})=>!e||e.success?t:null).filter(e=>e);return e.multiple?n:n[0]||null}});function fd(e){return e?(0,r.asArray)(e):[]}var pd=V(dd,[[`render`,ud]]),md=we({DitoDitoTypeComponent:()=>pc,DitoTypeButton:()=>Gs,DitoTypeCheckbox:()=>Ys,DitoTypeCheckboxes:()=>tc,DitoTypeCode:()=>ac,DitoTypeColor:()=>dc,DitoTypeComputed:()=>gc,DitoTypeDate:()=>yc,DitoTypeLabel:()=>Kc,DitoTypeList:()=>Wc,DitoTypeMarkup:()=>Ul,DitoTypeMultiselect:()=>ql,DitoTypeNumber:()=>Xl,DitoTypeObject:()=>nu,DitoTypePanel:()=>ru,DitoTypeProgress:()=>ou,DitoTypeRadio:()=>uu,DitoTypeSection:()=>fu,DitoTypeSelect:()=>xu,DitoTypeSlider:()=>Tu,DitoTypeSpacer:()=>Du,DitoTypeSwitch:()=>ku,DitoTypeText:()=>Nu,DitoTypeTextarea:()=>Iu,DitoTypeTreeList:()=>Vu,DitoTypeUpload:()=>pd}),hd={mounted(e,t){gd(e,t.value,t.arg)},unmounted(e,t){_d(e,t.value,t.arg)}};function gd(e,t,n){bd.getObserver(n).observe(e,t)}function _d(e,t,n){bd.getObserver(n).unobserve(e,t)}var vd=typeof ResizeObserver<`u`,yd={},bd=class e{constructor(e,t){this.key=e,this.options=t,this.observer=vd?new ResizeObserver(e=>this.handle(e)):null,this.handlersByNode=new WeakMap,this.nodeCount=0}observe(e,t){let n=this.handlersByNode.get(e);n||(n=new Set,this.handlersByNode.set(e,n),this.observer?.observe(e,this.options),this.nodeCount++),n.add(t)}unobserve(e,t){let n=this.handlersByNode.get(e);n?.delete(t)&&n.size===0&&(this.handlersByNode.delete(e),this.observer?.unobserve(e),--this.nodeCount===0&&delete yd[this.key])}handle(e){for(let t of e){let e=this.handlersByNode.get(t.target);if(e){let n={target:t.target,contentRect:t.contentRect,borderBoxSize:(0,r.asArray)(t.borderBoxSize),contentBoxSize:(0,r.asArray)(t.contentBoxSize),devicePixelContentBoxSize:(0,r.asArray)(t.devicePixelContentBoxSize)};for(let t of e)t(n)}}}static getObserver({box:t=`content-box`}={}){let n={box:t},r=JSON.stringify(n);return yd[r]||=new e(r,n),yd[r]}},xd=class extends Error{constructor(e){super(`Request failed with status code: ${e.status} (${e.statusText})`),this.response=e}};async function Sd(e,{url:t,method:n=`get`,query:r=null,headers:i=null,data:a=null,signal:o=null,timeout:s=e.timeout??null}){let c=e.isApiUrl(t),l=[o,s&&AbortSignal.timeout(s)];o=AbortSignal.any(l.filter(Boolean));let u=await fetch(e.getApiUrl({url:t,query:r}),{method:n.toUpperCase(),...a&&{body:JSON.stringify(a)},headers:{...c&&e.headers,...i},credentials:c&&e.cors?.credentials?`include`:`same-origin`,signal:o});if(u.headers.get(`Content-Type`)?.includes(`application/json`)&&(u.data=await u.json()),!u.ok)throw new xd(u);return u}function Cd(e,t){return!(0,r.isAbsoluteUrl)(t)||t.startsWith(e.url)}function wd(e,{url:t,query:n}){!t.startsWith(e.url)&&!(0,r.isAbsoluteUrl)(t)&&(t=Td(e.url,t));let i=bc(n);return i?`${t}${t.includes(`?`)?`&`:`?`}${i}`:t}function Td(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}var Ed=[`create`,`created`,`save`,`saved`,`apply`,`applied`,`submit`,`submitted`,`delete`,`deleted`,`remove`,`removed`,`clear`,`cleared`,`edit`,`edited`,`close`,`closed`,`cancel`,`cancelled`,`drag`,`dragged`,`login`,`logged in`].reduce((e,t)=>(e[t]=t,e),{});return class{constructor(i,{dito:a={},api:o,views:s={},...c}={}){this.el=i,this.api=o=(0,r.assignDeeply)({base:`/`},a.api,o),this.options=c,o.locale||=`en-US`,o.formats=(0,r.assignDeeply)({},r.defaultFormats,o.formats),o.request||=e=>Sd(o,e),o.getApiUrl||=e=>wd(o,e),o.isApiUrl||=e=>Cd(o,e),o.normalizePath||=o.normalizePaths?r.hyphenate:e=>e,o.denormalizePath||=o.normalizePaths?r.camelize:e=>e,o.defaults||={};let l=R(o.users,{type:`collection`})||{};l.login=R(l.login||`login`,{method:`post`,parent:l}),l.logout=R(l.logout||`logout`,{method:`post`,parent:l}),l.session=R(l.session||`session`,{method:`get`,parent:l}),o.users=l,o.resources={any(e){let t=this[e?.type]||this.default;return e&&t.call(this,e)},default(e){let t=this.any(e.parent);return t?`${t}/${e.path}`:e.path},collection(e){return this.default(e)},member(e){return`${this.default(e)}/${e.id}`},upload(e){return`${this.collection(e.parent)}/upload/${e.path}`},...o.resources},o.headers={"Content-Type":`application/json`,...o.headers},(0,r.isString)(i)&&(i=document.querySelector(i));let u=this.app=(0,e.createApp)({components:{DitoRoot:aa,VueNotifications:n.default,...Vs,...md},provide:{api:o,$verbs:()=>Ed,$views:()=>{},$isPopulated:()=>!0,$parentComponent:()=>null,$schemaComponent:()=>null,$schemaParentComponent:()=>null,$routeComponent:()=>null,$dataComponent:()=>null,$sourceComponent:()=>null,$resourceComponent:()=>null,$dialogComponent:()=>null,$panelComponent:()=>null,$tabComponent:()=>null},render:()=>(0,e.h)(aa,{ref:`root`,class:a.settings.rootClass,unresolvedViews:s,options:c})});u.config.errorHandler=console.error,u.use(n.default,{componentName:`VueNotifications`,name:`notify`}),u.directive(`resize`,hd),u.use((0,t.createRouter)({routes:[{name:`catch-all`,path:`/:_(.*)`,components:{}}],history:(0,t.createWebHistory)(a.base),linkActiveClass:``,linkExactActiveClass:``})),i.classList.add(`dito-app`),u.mount(i)}register(e,t){return q.register(e,t)}}});
5
+ `))}return this.checkClipboardData(t)},updateCopy(){this.copyEnabled=this.parentComponent.hasData},async updatePaste(){if(this.pasteEnabled=!!this.checkClipboardData(this.appState.clipboardData),!this.pasteEnabled&&this.appState.agent.chrome){let e=await this.getClipboardData(!1);this.pasteEnabled=!!e}},async onCopy(){let e=this.parentComponent.clipboardData;try{e&&={$schema:this.schema.name,...this.copyData(e)},this.appState.clipboardData=e,this.pasteEnabled=!0;try{let t=JSON.stringify(e,null,2);await navigator.clipboard?.writeText?.(t)}catch(e){console.error(e,e.name,e.message)}}catch(e){console.error(e),alert(e.message)}},async onPaste(){let e=await this.getClipboardData(!0);try{e&&=this.pasteData(e),e&&(this.parentComponent.clipboardData=e)}catch(e){console.error(e),alert(e.message)}}}}),[[`render`,Po]]);function Io({routeLevel:n}){return(0,e.h)(t.RouterView,null,{default:({Component:t,route:r})=>t?(0,e.h)(t,{key:r.matched[n]?.path}):null})}Io.props={routeLevel:{type:Number,required:!0}};var Lo=B.component(`DitoRouterView`,Io),Ro={mixins:[Ga,{data(){return{isLoading:!1}},methods:{setLoading(e,{updateRoot:t=!1,updateView:n=!1}={}){!this.isLoading^!e&&(this.isLoading=!!e,t&&this.rootComponent.registerLoading(e),n&&this.viewComponent.setLoading(this.isLoading))}}}],provide(){return{$resourceComponent:()=>this,$verbs:()=>this.verbs,$isPopulated:()=>this.hasData}},data(){return{loadedData:null,abortController:null}},computed:{resourceComponent(){return this},resource(){return this.getResource()},providesData(){return!!this.resource},linksToView(){return!1},isTransient(){let e=this.formComponent;return!this.providesData&&!this.linksToView||e&&(e.isTransient||e.isCreating)},transientNote(){return this.isTransient&&`<b>Note</b>: the parent still needs to be saved in order to persist this change.`},shouldLoad(){return!this.isTransient&&!this.isLoading},hasData(){return!!this.loadedData},verbs(){return this.getVerbs()},paginationRange(){let{paginate:e}=this.sourceSchema;if(this.isListSource&&e){let{page:t=0}=this.query||{},n=t*e;return[n,n+e-1]}return null},queryParams(){let e=this.paginationRange,{page:t,...n}=this.query||{};return{...n,...e&&{range:e.join(`,`)}}}},created(){(this.providesData||this.isCreating)&&this.setupData()},methods:{getResource({method:e=`get`,child:t}={}){let n=this.sourceSchema?.resource;return z(n,{type:`collection`,method:e,parent:this.parentResourceComponent?.getResource({method:e,child:n})??null,child:t})},getVerbs(){let e=this.$verbs();return this.isTransient?{...e,create:`add`,created:`added`,save:`apply`,saved:`applied`,delete:`remove`,deleted:`removed`}:e},clearData(){this.loadedData=null},setData(e){return this.loadedData=e,this.loadedData},setupData(){this.ensureData()},ensureData(){this.shouldLoad&&(this.hasData?this.reloadData():this.loadData(!0))},reloadData(){this.loadData(!1)},loadData(e){this.isTransient||(e&&this.clearData(),this.requestData())},createData(e,t){return en(e,t?{type:t}:{},this)},requestData(){let e=this.queryParams;this.handleRequest({method:`get`,query:e},(e,t)=>{if(e){if(t){let{data:e}=t;if(e?.type===`FilterValidation`&&this.onFilterErrors?.(e.errors)||this.isUnauthorizedError(t))return!0}}else this.isForm&&this.isDirty||this.setData(t.data),this.emitSchemaEvent(`load`)})},isValidationError(e){return e?.status===400},isUnauthorizedError(e){return e?.status===401},async handleRequest({method:e,resource:t=this.getResource({method:e}),query:n,data:i},a){let o={updateRoot:!0,updateView:this.isInView};this.abortController?.abort();let s=new AbortController;this.abortController=s;let{signal:c}=s;e=t.method||e;let l={method:e,resource:t,query:n,data:i,signal:c};this.setLoading(!0,o);try{a(null,await this.sendRequest(l))}catch(e){if(e.name!==`AbortError`){let{response:t}=e;if(!a(e,t)){let n=t?.data,i=(0,r.isString)(n?.type)?(0,r.labelize)(n.type):`Error`,a=n?.message??e;this.notify({type:`error`,error:e,title:i,text:a})}}}this.abortController===s&&(this.abortController=null,this.setLoading(!1,o))},getPayloadData(e,t){return[`post`,`put`,`patch`].includes(t)&&(e.getSchemaValue([`resource`,`data`])||e.processedItem)},async submit(e){let{resource:t}=e.schema;if(t=z(t,{parent:this.getResource({method:t?.method,child:t})}),t){let{method:n}=t,r=this.getPayloadData(e,n);return this.submitResource(e,t,n,r)}return!1},async submitResource(e,t,n,i,{setData:a=!1,onSuccess:o,onError:s,notifySuccess:c=()=>this.notify({type:`success`,title:`Request Successful`,text:`Request was successfully sent.`}),notifyError:l=e=>this.notify({type:`error`,error:e,title:`Request Error`,text:[`Unable to send request${e?`:`:``}`,e?.message||e]})}={}){return new Promise(u=>{this.handleRequest({method:n,resource:t,data:i},async(t,n)=>{let i=n?.data;if(t){let a=this.isValidationError(n)&&i.errors;if(a)await this.showValidationErrors(a,!0);else{let n=(0,r.isObject)(i)?i:t;s?.(n),await this.emitButtonEvent(e,`error`,{notify:l,error:n})}u(!1)}else{if(a&&i){let{foreignData:e}=this.mainSchemaComponent.filterData(this.data),t=this.parentRouteComponent?.routeRecord?.meta;t&&(t.reload=!0),this.setData((0,r.assignDeeply)({},e,i))}o?.(),await this.emitButtonEvent(e,`success`,{notify:c}),u(!0)}})})},async emitButtonEvent(e,t,{notify:n,error:r}){let i=new E(e,{nested:!1,data:this.data,itemLabel:this.itemLabel,error:r}),a=await e.emitEvent(t,{context:i});return n&&a===void 0&&!i.wasNotified&&n(r),a}}};function zo(e){return new URL(`file:${e}`).pathname}var Bo=[`data-resource`],Vo={type:`submit`,disabled:``};function Ho(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoRouterView`),c=(0,e.resolveComponent)(`DitoButtons`),l=(0,e.resolveComponent)(`DitoSchema`),u=(0,e.resolveComponent)(`DitoFormInner`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-form dito-scroll-parent`,{"dito-form-nested":t.isNestedRoute}]),"data-resource":t.sourceSchema.path},[!t.isLastUnnestedRoute&&!t.isNestedRoute?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,routeLevel:t.routeLevel+1},null,8,[`routeLevel`])),[[e.vShow,!t.isActiveRoute]]):(0,e.createCommentVNode)(``,!0),(0,e.withDirectives)((0,e.createVNode)(u,{nested:t.isNestedRoute,label:t.itemLabel},{default:(0,e.withCtx)(()=>[(0,e.withDirectives)((0,e.createElementVNode)(`button`,Vo,null,512),[[e.vShow,!1]]),(0,e.createVNode)(l,{schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,padding:t.isNestedRoute?`nested`:`root`,active:t.isActiveRoute,disabled:t.isLoading,scrollable:!t.isNestedRoute,generateLabels:``},{buttons:(0,e.withCtx)(()=>[(0,e.createVNode)(c,{class:(0,e.normalizeClass)([`dito-buttons--round dito-buttons--large dito-buttons--main`,{"dito-buttons--sticky":!t.isNestedRoute}]),buttons:t.buttonSchemas,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:t.isLoading},null,8,[`class`,`buttons`,`dataPath`,`data`,`meta`,`store`,`disabled`])]),_:1},8,[`schema`,`dataPath`,`data`,`meta`,`store`,`padding`,`active`,`disabled`,`scrollable`])]),_:1},8,[`nested`,`label`]),[[e.vShow,t.isActiveRoute]])],10,Bo)}var Uo=V(B.component(`DitoForm`,{mixins:[Li,Ro],data(){return{createdData:null,clonedData:void 0}},computed:{isForm(){return!0},verbs(){let e=this.getVerbs(),{isCreating:t,providesData:n}=this;return{...e,submit:t?e.create:e.save,submitted:t?e.created:e.saved,cancel:n?e.cancel:e.close,cancelled:n?e.cancelled:e.closed}},schema(){return this.getItemFormSchema(this.sourceSchema,this.data||(this.creationType?{type:this.creationType}:null),this.context)},buttonSchemas(){return A((0,r.assignDeeply)({cancel:{type:`button`,events:{click:()=>this.cancel()}},submit:!this.isMutating&&{type:`submit`,closeForm:!0,events:{click:({component:e})=>e.submit()}}},this.schema.buttons))},isActiveRoute(){return this.isLastRoute||this.isLastUnnestedRoute},isTransient(){return!this.providesData},isCreating(){return this.param===`create`},isDirty(){return!this.isMutating&&this.formModel.isDirty},isMutating(){return!!this.sourceSchema.mutate},selectedTab(){return this.mainSchemaComponent?.selectedTab||null},creationType(){return this.$route.query.type},itemId(){return this.isCreating?null:this.param??null},method(){return this.isCreating?`post`:`patch`},breadcrumbPrefix(){return(0,r.capitalize)(this.isCreating?this.verbs.create:this.verbs.edit)},data(){return this.createdData||this.loadedData||this.inheritedData||null},dataPath(){return this.getDataPathFrom(this.dataComponent)},componentPath(){let{parentRouteComponent:e}=this;return this.isTransient&&e?on(e.isView?e.viewSchema:e.schema,e.data,this.getDataPathFrom(e),{componentPath:e.componentPath,component:this,rootData:this.rootData}):``},sourceLocation(){let e=this.isLeavingRoute?null:this.parentRouteComponent.data;if(!e)return null;let t=(0,r.parseDataPath)(this.getDataPathFrom(this.parentRouteComponent)),n=this.routeRecord.path.split(`/`),i=n.slice(n.length-t.length),a=t[t.length-1];ht(this.sourceSchema)&&a===`create`&&t.length--;let o=null;for(let n=0,r=t.length;n<r&&e;n++){let a=t[n];o=/^:id/.test(i[n])?a===`create`?null:this.findItemIdIndex(this.sourceSchema,e,a):a,n<r-1&&(e=e[o])}return e?{data:e,key:o}:null},sourceData(){return this.sourceLocation?.data??null},sourceKey(){return this.sourceLocation?.key??null},sourceItem(){return this.sourceData&&this.sourceKey!==null?this.sourceData[this.sourceKey]:void 0},inheritedData(){return this.isTransient?this.isMutating?this.sourceItem:this.clonedData:void 0},hasData(){return!!this.data},itemLabel(){return this.getItemLabel(this.sourceSchema,this.data,{extended:!0})}},watch:{$route:{flush:`post`,handler(e,t){let n=this.meta?.param;n&&this.providesData&&t.matched[0].path===e.matched[0].path&&t.params[n]!==`create`&&e.params[n]!==t.params[n]&&this.loadData(!0)}},sourceItem:{immediate:!0,handler(e){this.isTransient&&(this.isMutating||(this.clonedData=(0,r.clone)(e)),e===null&&!this.isCreating&&ht(this.sourceSchema)&&this.$router.push({path:`${this.path}/create`}))}},isCreating(e){e&&this.setupData()}},created(){this.formModel=new Bi({component:this,getSchema:()=>this.schema,getData:()=>this.data,getSourceSchema:()=>this.sourceSchema})},beforeUnmount(){this.formModel.stop()},methods:{emitSchemaEvent(e,t){return this.mainSchemaComponent?.emitEvent(e,t)},getDataPathFrom(e){return this.api.denormalizePath(this.path.slice((e.isView?0:e.path.length)+1))},getResource(e){let t=Ro.methods.getResource.call(this,e);return Xn(this.itemId,t)||t},setupData(){this.isCreating?this.createdData||=this.createData(this.schema,this.creationType):this.ensureData()},setSourceData(e){if(this.sourceData&&this.sourceKey!==null){let{mainSchemaComponent:t}=this;return this.sourceData[this.sourceKey]=t.filterData(e).localData,t.onChange(),!0}return!1},addSourceData(e){return ht(this.sourceSchema)?this.setSourceData(e):!!this.sourceData?.push(e)},clearData(){this.setData(null)},setData(e){return this.isTransient?(this.setSourceData(e),this.sourceItem):(this.createdData=null,this.loadedData=e,this.data)},applyCleanChanges(e){return this.formModel.applyCleanChanges(e)},async cancel(){return this.close()},async close(){return this.navigate(this.parentRouteComponent.path)},getSubmitVerb(e=!0){return this.isCreating?e?`create`:`created`:e?`submit`:`submitted`},async submit(e,{validate:t=!0,closeForm:n=!1}={}){if(await this.waitForPendingLoadsOf(this.formModel),t&&!this.validateAll())return!1;let i=e=>this.verbs[this.getSubmitVerb(e)],{method:a}=this,o=this.getResource({method:a}),s=z(e.schema.resource,{parent:o});o=s||o,a=o?.method||a;let c=this.getPayloadData(e,a),l;if(l=!s&&this.isTransient?await this.submitTransient(e,o,a,c,{onSuccess:()=>this.emitSchemaEvent(this.getSubmitVerb()),onError:e=>this.emitSchemaEvent(`error`,{context:{error:e}}),notifySuccess:()=>{let e=i(!1);this.notify({type:`info`,title:this.isCreating?`Item ${(0,r.capitalize)(e)}`:`Change ${(0,r.capitalize)(e)}`,text:[this.isCreating?`${this.itemLabel} was ${e}.`:`Changes to ${this.itemLabel} were ${e}.`,this.transientNote]})},notifyError:e=>{let t=i(!0);this.notify({type:`error`,error:e,title:`Request Error`,text:`Unable to ${t} ${this.itemLabel}.`})}}):await this.submitResource(e,o,a,c,{setData:!0,onSuccess:()=>this.emitSchemaEvent(this.getSubmitVerb()),onError:e=>this.emitSchemaEvent(`error`,{context:{error:e}}),notifySuccess:()=>{let e=i(!1);this.notify({type:`success`,title:`Successfully ${(0,r.capitalize)(e)}`,text:`${this.itemLabel} was ${e}.`})},notifyError:e=>{let t=i(!0);this.notify({type:`error`,error:e,title:`Request Error`,text:[`Unable to ${t} ${this.itemLabel}${e?`:`:``}`,e?.message||e]})}}),l){if(this.resetValidation(),this.formModel.takeProcessedDataSnapshot().catch(console.error),n||e.closeForm)this.close();else if(this.isCreating){let e=this.getItemId(this.schema,this.data);this.$router.replace({path:zo(`${this.path}/../${e}`),hash:this.$route.hash})}}return l},async submitTransient(e,t,n,r,{onSuccess:i,onError:a,notifySuccess:o,notifyError:s}){let c=this.isCreating?this.addSourceData(r):this.setSourceData(r);if(c)i?.(),await this.emitButtonEvent(e,`success`,{notify:o});else{let t=`Could not submit transient item`;a?.(t),await this.emitButtonEvent(e,`error`,{notify:s,error:t})}return c}}}),[[`render`,Ho]]),Wo={key:0},Go=[`aria-label`];function Ko(t,n,r,i,a,o){return t.nested?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Wo,[(0,e.renderSlot)(t.$slots,`default`)])):((0,e.openBlock)(),(0,e.createElementBlock)(`form`,{key:1,class:`dito-scroll-parent`,"aria-label":t.label,onSubmit:n[0]||=(0,e.withModifiers)(()=>{},[`prevent`])},[(0,e.renderSlot)(t.$slots,`default`)],40,Go))}var qo=V(B.component(`DitoFormInner`,{props:{nested:{type:Boolean,default:!1},label:{type:String,default:null}}}),[[`render`,Ko]]),Jo=B.component(`DitoFormNested`,{extends:Uo}),Yo={key:0,class:`dito-errors`,role:`alert`};function Xo(t,n,r,i,a,o){return t.errors?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Yo,[(0,e.createElementVNode)(`ul`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.errors,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,(0,e.toDisplayString)(t),1))),256))])])):(0,e.createCommentVNode)(``,!0)}var Zo=V(B.component(`DitoErrors`,{props:{errors:{type:Array,default:null}},data(){return{tip:null}},watch:{errors(){this.$nextTick(this.updateErrors)}},unmounted(){this.tip?.destroy()},methods:{updateErrors(){let{tip:t}=this;t?.hide(),this.errors&&(t=this.tip??=(0,e.markRaw)((0,i.default)(this.$el.closest(`.dito-container`))),t.setProps({content:this.errors.join(`
6
+ `),theme:`error`,trigger:`manual`,appendTo:`parent`,placement:`bottom-start`,animation:`shift-away-subtle`,popperOptions:{modifiers:[{name:`flip`,enabled:!1}]},interactive:!0,hideOnClick:!1,offset:[3,3],zIndex:1}),t.popper.addEventListener(`mousedown`,()=>t.hide()),t.show())}}}),[[`render`,Xo]]),Qo={class:`dito-scopes`},$o=[`aria-pressed`,`title`,`onClick`];function es(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Qo,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.scopes,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(s,{key:r,to:t.getScopeLink(n),custom:``},{default:(0,e.withCtx)(({navigate:r})=>[(0,e.createElementVNode)(`button`,{class:(0,e.normalizeClass)([`dito-button`,{"dito-button--selected":n.name===t.query.scope}]),type:`button`,"aria-pressed":n.name===t.query.scope,title:n.hint||t.getLabel(n),onClick:r},(0,e.toDisplayString)(t.getLabel(n)),11,$o)]),_:2},1032,[`to`]))),128))])}var ts=V(B.component(`DitoScopes`,{props:{query:{type:Object,required:!0},scopes:{type:Object,required:!0}},methods:{getScopeLink(e){let t={...this.query,scope:e.name};return t.page&&=0,this.getQueryLink(t)}}}),[[`render`,es]]);function ns(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`Pagination`);return(0,e.openBlock)(),(0,e.createBlock)(s,{page:t.page,"onUpdate:page":n[0]||=e=>t.page=e,pageSize:t.limit,total:t.total},null,8,[`page`,`pageSize`,`total`])}var rs=V(B.component(`DitoPagination`,{components:{Pagination:Ci},props:{query:{type:Object,required:!0},limit:{type:Number,required:!0},total:{type:Number,required:!0}},computed:{page:{get(){return(+this.query.page||0)+1},set(e){this.page!==e&&this.$router.push(this.getQueryLink({...this.query,page:e-1}))}}}}),[[`render`,ns]]),is={data(){return{isDragging:!1}},methods:{getDraggableOptions(e=window.dito.settings?.forceDragFallback??!1){let t=`dito-draggable`;return{animation:150,handle:`.dito-button--drag`,dragClass:`${t}__drag`,chosenClass:`${t}__chosen`,ghostClass:`${t}__ghost`,fallbackClass:`${t}__fallback`,forceFallback:e,onStart:this.onStartDrag,onEnd:this.onEndDrag}},onStartDrag(){this.isDragging=!0},onEndDrag({oldIndex:e,newIndex:t}){this.isDragging=!1,e!==t&&this.onChange()}}},as=[`id`,`data-path`],os={key:0,class:`dito-tree-header`},ss=[`aria-label`,`aria-expanded`],cs=[`innerHTML`],ls={key:1,class:`dito-tree-info`},us={key:1,class:`dito-tree-leaf`},ds=[`innerHTML`],fs={key:2,class:`dito-buttons dito-buttons--small`},ps={key:1,class:`dito-properties`};function ms(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoLabel`),c=(0,e.resolveComponent)(`DitoTableCell`),l=(0,e.resolveComponent)(`DitoTreeItem`,!0),u=(0,e.resolveComponent)(`DitoDraggable`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-tree-item`,{"dito-tree-item--dragging":t.isDragging,"dito-tree-item--active":t.active}]),id:t.componentPath,style:(0,e.normalizeStyle)(t.level>0&&{"--level":t.level}),"data-path":t.path},[t.label?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,os,[t.numEntries?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-tree-branch`,role:`button`,tabindex:`0`,"aria-label":t.ariaLabel,"aria-expanded":t.opened,onClick:n[0]||=(0,e.withModifiers)(e=>t.opened=!t.opened,[`stop`]),onKeydown:n[1]||=(0,e.withKeys)((0,e.withModifiers)(e=>t.opened=!t.opened,[`prevent`]),[`enter`,`space`])},[t.numEntries?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-chevron`,{"dito-chevron--open":t.opened}])},null,2)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:t.label},null,8,cs),t.details?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ls,(0,e.toDisplayString)(t.details),1)):(0,e.createCommentVNode)(``,!0)],40,ss)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,us,[(0,e.createElementVNode)(`div`,{class:`dito-tree-label`,innerHTML:t.label},null,8,ds)])),t.hasEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,fs,[t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:0,class:`dito-button`},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.editable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:1,class:`dito-button`,type:`button`},t.getButtonAttributes(t.verbs.edit),{onClick:n[2]||=(...e)=>t.onEdit&&t.onEdit(...e)}),null,16)):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:2,class:`dito-button`,type:`button`},t.getButtonAttributes(t.verbs.delete),{onClick:n[3]||=(...e)=>t.onDelete&&t.onDelete(...e)}),null,16)):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),t.properties?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`table`,ps,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.properties,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,null,[(0,e.createElementVNode)(`td`,null,[n.label===!1?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,label:t.getLabel(n)},null,8,[`label`]))]),(0,e.createVNode)(c,{cell:n,schema:n,dataPath:t.getPropertyDataPath(n),data:t.data,meta:t.nestedMeta,store:t.store,disabled:t.disabled},null,8,[`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])]))),256))],512)),[[e.vShow,t.opened]]):(0,e.createCommentVNode)(``,!0),t.childrenSchema?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)(u,{key:2,options:t.getDraggableOptions(!0),draggable:t.childrenDraggable,modelValue:t.childrenList,"onUpdate:modelValue":n[4]||=e=>t.childrenList=e},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.childrenItems,(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(l,{key:t.getItemUid(t.childrenSchema,n.data),schema:t.childrenSchema,dataPath:t.getItemDataPath(t.childrenSchema,r),data:n.data,path:n.path,open:n.open,active:n.active,draggable:t.childrenDraggable,label:t.getItemLabel(t.childrenSchema,n.data,{index:r}),level:t.level+1},null,8,[`schema`,`dataPath`,`data`,`path`,`open`,`active`,`draggable`,`label`,`level`]))),128))]),_:1},8,[`options`,`draggable`,`modelValue`])),[[e.vShow,t.opened]]):(0,e.createCommentVNode)(``,!0)],14,as)}var hs=V(B.component(`DitoTreeItem`,{mixins:[Ga,is],emits:[`update:data`],inject:[`container`],props:{schema:{type:Object,required:!0},dataPath:{type:String,required:!0},data:{type:[Array,Object],default:null},path:{type:String,default:``},open:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},label:{type:String,default:null},level:{type:Number,default:0}},data(){return{opened:this.open||this.schema.open}},computed:{componentPath(){let{componentPath:e,dataPath:t}=this.container,n=De(this.dataPath,t);return n?b(e,n):e},meta(){return this.container.meta},store(){return this.container.store},disabled(){return this.container.disabled},nestedMeta(){return{...this.meta,schema:this.schema}},properties(){return k(this.schema.properties)},childrenSchema(){return this.schema.children},childrenList:{get(){let e=this.childrenSchema?.name;return e&&this.data[e]},set(e){let t=this.childrenSchema?.name;t&&(ln(this.childrenSchema,e),this.data[t]=e,this.$emit(`update:data`,e))}},childrenDraggable(){return this.childrenList?.length>1&&this.getSchemaValue(`draggable`,{type:Boolean,default:!1,schema:this.childrenSchema})},numChildren(){return this.childrenList?.length||0},numProperties(){return this.properties?.length||0},numEntries(){return this.numProperties+this.numChildren},childrenItems(){let{childrenSchema:e,childrenList:t}=this;if(e&&t){let{editPath:n}=this.container,r=!this.path&&e.open;return t.map((t,i)=>{let a=e.path&&`${this.path}/${e.path}/${i}`;return{data:t,path:a,open:r||n.startsWith(a)&&a.length<n.length,active:n===a}})}return[]},ariaLabel(){return this.label?(0,r.stripHtml)(this.label):null},details(){let{numChildren:e}=this;return e&&`${e} ${e===1?`item`:`items`}`},hasEditButtons(){return this.draggable||this.editable||this.deletable},creatable:F(`creatable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)}}),editable:F(`editable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)}}),deletable:F(`deletable`,{type:Boolean,default:!1})},methods:{getPropertyDataPath(e){return b(this.dataPath,e.name)},editPath(e){this.$router.push({path:`${this.container.path}${e}`,query:this.$route.query})},onEdit(){this.editPath(this.path)},onDelete(){},onChange(){this.container.onChange()},onEndDrag(e){is.methods.onEndDrag.call(this,e);let{item:t}=e;t.classList.contains(`dito-tree-item--active`)&&this.$nextTick(()=>{this.editPath(e.item.dataset.path)})}}}),[[`render`,ms]]),gs={class:`dito-table-head`},_s=[`aria-sort`,`onClick`],vs={key:1},ys={key:0};function bs(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`RouterLink`);return(0,e.openBlock)(),(0,e.createElementBlock)(`thead`,gs,[(0,e.createElementVNode)(`tr`,null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.columns,r=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(r)?((0,e.openBlock)(),(0,e.createElementBlock)(`th`,{key:0,scope:`col`,class:(0,e.normalizeClass)(t.getColumnClass(r))},[r.sortable?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,to:t.getSortLink(r),custom:``},{default:(0,e.withCtx)(({navigate:i})=>[(0,e.createElementVNode)(`button`,{class:(0,e.normalizeClass)([`dito-button`,t.getSortClass(r)]),type:`button`,"aria-sort":t.getSortState(r),onClick:i},[n[0]||=(0,e.createElementVNode)(`div`,{class:`dito-button__order-arrows`},null,-1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabel(r)),1)],10,_s)]),_:2},1032,[`to`])):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,vs,(0,e.toDisplayString)(t.getLabel(r)),1))],2)):(0,e.createCommentVNode)(``,!0)],64))),256)),t.hasEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`th`,ys,[...n[1]||=[(0,e.createElementVNode)(`span`,null,null,-1)]])):(0,e.createCommentVNode)(``,!0)])])}var xs=V(B.component(`DitoTableHead`,{props:{query:{type:Object,required:!0},columns:{type:Object,required:!0},hasEditButtons:{type:Boolean,required:!0}},computed:{sort(){let e=(this.query.order||``).split(/\s+/);return{name:e[0],order:e[1]}}},methods:{getColumnClass(e){return`dito-column--${(0,r.hyphenate)(e.name)}`},getSortClass(e){return this.sort.name===e.name?`dito-button--selected dito-button--order-${this.sort.order}`:null},getSortState(e){return{asc:`ascending`,desc:`descending`}[this.sort.name===e.name&&this.sort.order]||`none`},getSortLink(e){let t=this.sort.name===e.name&&this.sort.order===`asc`?`desc`:`asc`;return this.getQueryLink({...this.query,order:`${e.name} ${t}`})}}}),[[`render`,bs]]),Ss=[`innerHTML`];function Cs(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`td`,{class:(0,e.normalizeClass)(t.cell.class),style:(0,e.normalizeStyle)(t.cell.style)},[t.cell.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.cell.component),{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,disabled:t.disabled},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`])):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:1,innerHTML:t.renderCell(t.data)},null,8,Ss))],6)}var ws=V(B.component(`DitoTableCell`,{mixins:[P],props:{cell:{type:Object,required:!0},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},nested:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},methods:{renderCell(e){let{name:t,render:n}=this.cell,i=e[t];return n?n.call(this,new E(this,{name:t,value:i,data:e,dataPath:b(this.dataPath,t)})):(0,r.escapeHtml)(i)}}}),[[`render`,Cs]]),Ts={class:`dito-upload-file`},Es={class:`dito-thumbnail__inner`},Ds=[`src`],Os={key:1,class:`dito-thumbnail__type`};function ks(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ts,[t.thumbnail?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`dito-thumbnail`,`dito-thumbnail--${t.thumbnail}`])},[(0,e.createElementVNode)(`div`,Es,[t.source?((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:0,src:t.source,crossorigin:`anonymous`},null,8,Ds)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Os,[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.type),1)]))])],2)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.file.name),1)])}var As=B.component(`DitoUploadFile`,{props:{file:{type:Object,required:!0},thumbnail:{type:String,default:null},thumbnailUrl:{type:String,default:null}},data(){return{uploadUrl:null}},computed:{type(){return js[this.file.type]||this.file.name.split(`.`).pop().toUpperCase()},source(){return this.uploadUrl||this.thumbnailUrl}},watch:{"file.upload.file":{immediate:!0,handler(e){if(this.thumbnail&&e?.type.startsWith(`image/`)){let t=new FileReader;t.onload=()=>{this.uploadUrl=t.result},t.readAsDataURL(e)}else this.uploadUrl=null}}}}),js={"text/plain":`TXT`,"text/html":`HTML`,"text/css":`CSS`,"text/javascript":`JS`,"image/jpeg":`JPG`,"image/png":`PNG`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"movie/mp4":`MP4`,"audio/mpeg":`MP3`,"application/json":`JSON`,"application/xml":`XML`,"application/pdf":`PDF`,"application/zip":`ZIP`},Ms=V(As,[[`render`,ks]]);function Ns(t,n,r={}){let i,{document:a=s.defaultDocument,watchElement:o=!1,...c}=r,u={onUpdate:e=>{Is(n,e.oldIndex,e.newIndex,e)}},d=()=>{i?.destroy(),i=void 0},f=e=>{e&&i===void 0&&(i=new l.default(e,{...u,...c}))},p=()=>{let e=typeof t==`string`?a?.querySelector(t):(0,s.unrefElement)(t);e&&f(e)},m=(e,t)=>{if(t!==void 0)i?.option(e,t);else return i?.option(e)},h;return o&&typeof t!=`string`?h=(0,e.watch)(()=>(0,s.unrefElement)(t),e=>{d(),e&&f(e)},{immediate:!0,flush:`post`}):(0,s.tryOnMounted)(p),(0,s.tryOnScopeDispose)(()=>{h?.(),d()}),{stop:()=>{d()},start:p,option:m}}function Ps(e,t,n){let r=e.children[n];e.insertBefore(t,r)}function Fs(e){e.parentNode&&e.parentNode.removeChild(e)}function Is(t,n,r,i=null){i!=null&&(Fs(i.item),Ps(i.from,i.item,n));let a=(0,e.isRef)(t),o=a?[...(0,e.toValue)(t)]:(0,e.toValue)(t);if(r>=0&&r<o.length){let i=o.splice(n,1)[0];(0,e.nextTick)(()=>{o.splice(r,0,i),a&&(t.value=o)})}}var Ls=(0,e.defineComponent)((t,{slots:n})=>{let r=(0,s.useVModel)(t,`modelValue`),i=(0,e.shallowRef)(),a=(0,e.reactive)(Ns(i,r,t.options));return()=>{if(n.default)return(0,e.h)(t.as||`div`,{ref:i},n.default(a))}},{name:`UseSortable`,props:[`as`,`modelValue`,`options`]});function Rs(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`UseSortable`);return t.draggable?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,class:(0,e.normalizeClass)([`dito-draggable`,{"dito-draggable--dragging":t.isDragging}]),as:t.as,modelValue:t.modelValue,options:{...t.options,onStart:t.onStart,onEnd:t.onEnd},"onUpdate:modelValue":n[0]||=e=>t.$emit(`update:modelValue`,e)},{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`default`)]),_:3},8,[`class`,`as`,`modelValue`,`options`])):((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.as),{key:1},{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(t.$slots,`default`)]),_:3}))}var zs=V(B.component(`DitoDraggable`,{mixins:[G],components:{UseSortable:Ls},emits:[`update:modelValue`],props:{modelValue:{type:Array,required:!0},as:{type:String,default:`div`},options:{type:Object,required:!0},draggable:{type:Boolean,default:!0}},data(){return{mouseEvents:null,isDragging:!1}},methods:{onStart(e){this.options.onStart?.(e),this.isDragging=!0,this.mouseEvents?.remove()},onEnd(e){this.options.onEnd?.(e),this.mouseEvents=this.domOn(document,{mousedown:this.onMouse,mousemove:this.onMouse,mouseleave:this.onMouse})},onMouse(){this.isDragging=!1,this.mouseEvents?.remove(),this.mouseEvents=null}}}),[[`render`,Rs]]);function Bs({vnode:e}){return e}Bs.props={vnode:{type:Object,required:!0}};var Vs=B.component(`DitoVnode`,Bs),Hs=Ce({DitoAccount:()=>Ma,DitoAffix:()=>Ia,DitoAffixes:()=>q,DitoButtons:()=>xo,DitoClipboard:()=>Fo,DitoContainer:()=>so,DitoCreateButton:()=>Ao,DitoDialog:()=>$i,DitoDraggable:()=>zs,DitoEditButtons:()=>wo,DitoErrors:()=>Zo,DitoForm:()=>Uo,DitoFormInner:()=>qo,DitoFormNested:()=>Jo,DitoHeader:()=>_a,DitoLabel:()=>Wa,DitoMenu:()=>ua,DitoNavigation:()=>ba,DitoNotifications:()=>wa,DitoPagination:()=>rs,DitoPane:()=>io,DitoPanel:()=>mo,DitoPanels:()=>_o,DitoRoot:()=>oa,DitoRouterView:()=>Lo,DitoSchema:()=>Za,DitoSchemaInlined:()=>$a,DitoScopes:()=>ts,DitoSidebar:()=>Da,DitoSpinner:()=>Pa,DitoTableCell:()=>ws,DitoTableHead:()=>xs,DitoTabs:()=>fo,DitoTrail:()=>ma,DitoTreeItem:()=>hs,DitoUploadFile:()=>Ms,DitoVNode:()=>Vs,DitoView:()=>Ji}),J={extends:B,mixins:[Mn],nativeField:!1,textField:!1,defaultValue:null,defaultNested:!0,defaultVisible:!0,defaultMultiple:!1,generateLabel:!0,excludeValue:!1,ignoreMissingValue:null,treatNullAsMissing:null,omitSpacing:!1,getTypeValidations:null,component:B.component,get:Ke,register(e,t={}){e=(0,r.asArray)(e),Us(t)&&console.warn(`Type '${e[0]}': The \`getValidations()\` method isn't supported anymore, use the static \`getTypeValidations(schema, context)\` option instead.`);let n=this.component(`DitoType${(0,r.camelize)(e[0],!0)}`,t);for(let t of e)Ge(t,n);return n}};function Us(e){return[e,...e.mixins??[]].some(({methods:e})=>!!e?.getValidations)}var Ws=[`data-info`];function Gs(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoButton`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:[`dito-button`,t.buttonClass],id:t.componentPath,ref:`element`,type:t.type,text:t.text,title:t.title,disabled:t.disabled},t.attributes),{prefix:(0,e.withCtx)(()=>[t.prefixes.length>0?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,items:t.prefixes,position:`prefix`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])):(0,e.createCommentVNode)(``,!0)]),suffix:(0,e.withCtx)(()=>[t.suffixes.length>0?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,items:t.suffixes,position:`suffix`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])):(0,e.createCommentVNode)(``,!0),!t.label&&t.info?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-info`,"data-info":t.info},null,8,Ws)):(0,e.createCommentVNode)(``,!0)]),_:1},16,[`id`,`type`,`text`,`title`,`disabled`,`class`])}var Ks=V(J.register([`button`,`submit`],{components:{DitoAffixes:q,DitoButton:dr},defaultValue:()=>void 0,excludeValue:!0,defaultWidth:`auto`,generateLabel:!1,data(){return{isRunning:!1}},computed:{verb(){return this.verbs[this.name]},buttonClass(){return this.verb?`dito-button--${this.verb}`:null},text:F(`text`,{type:String}),title(){return this.text||(0,r.labelize)(this.verb)},prefixes(){return(0,r.asArray)(this.schema.prefix)},suffixes(){return(0,r.asArray)(this.schema.suffix)},closeForm:F(`closeForm`,{type:Boolean,default:!1})},methods:{getEvents(){let{onFocus:e,onBlur:t,onClick:n}=this;return{onFocus:e,onBlur:t,onClick:n}},async submit(e){return this.resourceComponent?.submit(this,e)},async onClick(){this.isRunning=!0;try{await this.emitEvent(`click`,{parent:this.schemaComponent})===void 0&&Yn(this.schema)&&await this.submit()}catch(e){if(await this.emitEvent(`error`,{error:e})===void 0){if(e instanceof AggregateError)for(let t of e.errors)this.notify({type:`error`,text:t});else this.notify({type:`error`,text:e})}}finally{this.isRunning=!1}}}}),[[`render`,Gs]]),qs={class:`dito-checkbox`},Js=[`id`];function Ys(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,qs,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.value=e,type:`checkbox`},t.attributes),null,16,Js),[[e.vModelCheckbox,t.value]])])}var Xs=V(J.register(`checkbox`,{nativeField:!0}),[[`render`,Ys]]),Zs={computed:{multiple(){return Qt(this.schema)},selectedValue:{get(){let e=e=>{let t=this.relate?this.getValueForOption(e):e;return this.hasOptions?this.getOptionForValue(t)?t:null:e};return this.multiple&&(0,r.isArray)(this.value)?this.value.map(e).filter(e=>e!==null):e(this.value)},set(e){let t=e=>{if(!this.relate)return e;let t=this.getOptionForValue(e);return this.shouldSetTemporaryId(t)&&Be(t,`id`),t};this.value=this.multiple&&(0,r.isArray)(e)?e.map(t):t(e)}},shouldReplaceValueWithSelectedValue(){return this.hasOptions&&(this.selectedValue===null&&this.value!==null||He(this.value))},selectedOption(){return this.getOptionForValue(this.selectedValue)},optionsResolver(){return this.formModel.getOptionsResolver({schema:this.schema,data:this.data,name:this.name,dataPath:this.dataPath,componentPath:this.componentPath})},isLoadingOptions(){return this.optionsResolver.isLoading},options(){let e=this.optionsResolver.value??[];if(!(0,r.isArray)(e))throw Error(`Invalid options data, should be array: ${e}`);return this.groupBy?this.groupOptions(e):e},activeOptions(){return this.options},hasOptions(){return this.activeOptions.length>0},relate:F(`relate`,{type:Boolean,default:!1,callback:!1}),groupBy:F(`groupBy`,{type:String,default:null}),optionLabel:F(`options.label`,{type:[String,Function],default:null,get(e){return e||this.getOptionKey(`label`)||null}}),optionValue:F(`options.value`,{type:[String,Function],default:null,get(e){return e||this.relate&&`id`||this.getOptionKey(`value`)||null}}),optionEquals:F(`options.equals`,{type:Function,default:null}),searchFilter:F(`search`,{type:[Object,Function],default:null,get(e){if(e){let{filter:t,debounce:n}=(0,r.isFunction)(e)?{filter:e}:e;return n?(0,r.debounceAsync)(t,n):t}}}),editable:F(`editable`,{type:Boolean,default:!1,get(e){return e&&Ft(this.schema,this.context)}}),editPath(){return this.editable&&this.selectedValue?Lt(this.schema,this.selectedValue,this.context):null},groupByLabel(){return this.groupBy?`label`:null},groupByOptions(){return this.groupBy?`options`:null}},watch:{shouldReplaceValueWithSelectedValue:{handler(e){e&&this.replaceValueWithSelectedValue()},immediate:!0},value(){this.shouldReplaceValueWithSelectedValue&&this.replaceValueWithSelectedValue()},"optionsResolver.lastLoadError"(e){e&&this.addError(e.message||e)}},methods:{getOptionKey(e){let[t]=this.activeOptions;return(0,r.isObject)(t)&&e in t?e:null},replaceValueWithSelectedValue(){let{selectedValue:e}=this;this.formModel.applyCleanChanges(()=>{this.selectedValue=e}).catch(console.error)},groupOptions(e){let t={};return e.reduce((e,n)=>{let r=n[this.groupBy],i=t[r];return i||(i=t[r]={[this.groupByLabel]:r,[this.groupByOptions]:[]},e.push(i)),i[this.groupByOptions].push(n),e},[])},shouldSetTemporaryId(e){return this.relate&&(0,r.isObject)(e)&&e.id==null},getOptionForValue(e){let t=(e,n,r)=>{for(let i of e)if(r){let e=t(i.options,n,null);if(e)return e}else if(this.optionEquals?this.optionEquals(new E(this,{value:n,option:i})):n===this.getValueForOption(i))return i};return this.optionValue?t(this.activeOptions,e,this.groupBy):e},getValueForOption(t){if(this.shouldSetTemporaryId(t))return(0,e.toRaw)(t);let{optionValue:n}=this;return(0,r.isString)(n)?t?.[n]??null:(0,r.isFunction)(n)?n(new E(this,{option:t})):t},getLabelForOption(e){let{optionLabel:t}=this;return(0,r.isString)(t)?e?.[t]:(0,r.isFunction)(t)?t(new E(this,{option:e})):(0,r.labelize)(`${e}`)}},processValue({schema:e,value:t,dataPath:n},i){if(e.relate){let a=e.options?.dataPath,o=a?(0,r.normalizeDataPath)(`${n}/${a}`):null;i.addRelation(n,o,e),o&&i.setSourceRelated(o);let s=e=>e&&{id:e.id};t=Qt(e)&&(0,r.isArray)(t)?t.map(s):s(t)}return t}},Qs=[`id`,`aria-label`],$s={class:`dito-checkbox`},ec=[`value`];function tc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:(0,e.normalizeClass)([`dito-checkboxes`,`dito-layout--${t.schema.layout||`vertical`}`]),id:t.componentPath,role:`group`,"aria-label":t.label},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.options,r=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`label`,null,[(0,e.createElementVNode)(`div`,$s,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({ref_for:!0,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedOptions=e,type:`checkbox`,value:t.getValueForOption(r)},{ref_for:!0},t.attributes),null,16,ec),[[e.vModelCheckbox,t.selectedOptions]]),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.getLabelForOption(r)),1)])])]))),256))],10,Qs)}var nc=V(J.register(`checkboxes`,{mixins:[Zs],nativeField:!0,defaultValue:[],defaultWidth:`auto`,defaultMultiple:!0,computed:{multiple(){return!0},selectedOptions:{get(){return(this.selectedValue||[]).filter(e=>e)},set(e){this.selectedValue=e||[]}}}}),[[`render`,tc]]),rc=[`id`],ic={class:`dito-code__editor`,ref:`editor`};function ac(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-code`,id:t.componentPath,style:(0,e.normalizeStyle)(t.style)},[(0,e.createElementVNode)(`div`,ic,null,512),t.resizable?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-resize`,onMousedown:n[0]||=(0,e.withModifiers)((...e)=>t.onDragResize&&t.onDragResize(...e),[`stop`,`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0)],12,rc)}var oc=V(J.register(`code`,{mixins:[G],data(){return{height:null}},computed:{lines:F(`lines`,{type:Number,default:3}),language:F(`language`,{type:String,default:`javascript`}),indentSize:F(`indentSize`,{type:Number,default:2}),resizable:F(`resizable`,{type:Boolean,default:!1}),style(){return{height:this.height||`calc(${this.lines}em * var(--line-height))`}}},mounted(){let e=new u.default(this.$refs.editor,{language:this.language,indentSize:this.indentSize,lineNumbers:!1}),t=!1,n=!1,r=!1,i=()=>{!this.focused&&t&&(t=!1,this.onChange())};this.domOn(this.$refs.editor.querySelector(`textarea`),{focus:()=>this.onFocus(),blur:()=>{this.onBlur(),i()}});let a=t=>{t!==e.code&&(r=!0,e.updateCode(t))},o=e=>{e!==this.value&&(n=!0,this.value=e,t=!0,i())};e.onUpdate(e=>{r?r=!1:o(e)}),this.$watch(`value`,e=>{n?n=!1:a(e||``)}),this.$watch(`language`,t=>{e.updateLanguage(t)}),this.$watch(()=>this.readonly||this.disabled,t=>t?e.enableReadonlyMode():e.disableReadonlyMode(),{immediate:!0}),a(this.value||``)},methods:{focusElement(){this.$el.querySelector(`textarea`)?.focus()},blurElement(){this.$el.querySelector(`textarea`)?.blur()},onDragResize(e){let t=({clientX:e,clientY:t})=>({x:e,y:t}),n=t(e).y,r=parseFloat(getComputedStyle(this.$el).height),i=e=>{let{y:i}=t(e);r+=i-n,n=i,this.height=`${Math.max(r,0)}px`},a=this.domOn(document,{mousemove:i,mouseup(e){i(e),a.remove()}})}}}),[[`render`,ac]]),sc={key:0,class:`dito-color__preview`};function cc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`),l=(0,e.resolveComponent)(`SketchPicker`),u=(0,e.resolveComponent)(`DitoTrigger`);return(0,e.openBlock)(),(0,e.createBlock)(u,{class:`dito-color`,show:t.showPopup,"onUpdate:show":n[2]||=e=>t.showPopup=e,trigger:`focus`},{trigger:(0,e.withCtx)(()=>[(0,e.createVNode)(c,(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.hexValue,"onUpdate:modelValue":n[0]||=e=>t.hexValue=e,type:`input`,size:`8`,focused:t.showPopup},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},{append:(0,e.withCtx)(()=>[t.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,sc,[(0,e.createElementVNode)(`div`,{style:(0,e.normalizeStyle)({background:`#${t.hexValue||`00000000`}`})},null,4)])):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`focused`])]),popup:(0,e.withCtx)(()=>[(0,e.createVNode)(l,{class:`dito-color__picker`,tinyColor:t.colorValue,"onUpdate:tinyColor":n[1]||=e=>t.colorValue=e,disableAlpha:!t.alpha,disableFields:!t.inputs,presetColors:t.presets},null,8,[`tinyColor`,`disableAlpha`,`disableFields`,`presetColors`])]),_:1},8,[`show`])}var lc=J.register(`color`,{components:{DitoTrigger:Jr,DitoInput:H,DitoAffixes:q,SketchPicker:d.SketchPicker},data(){return{showPopup:!1,convertedValue:null}},computed:{canUpdateValue(){return!this.focused||this.readonly},colorValue:{get(){return(0,d.tinycolor)(this.convertedValue||this.value||`#000000`)},set(e){this.convertedValue=null;let{value:t}=this;(!t||e.toHex8String()!==(0,d.tinycolor)(t).toHex8String())&&(this.value=dc(e,this.colorFormat))}},hexValue:{get(){let e=(0,d.tinycolor)(this.value);return e.isValid()?e.toString(e.getAlpha()<1?`hex8`:`hex6`).slice(1).toLowerCase():null},set(e){if((0,d.tinycolor)(e).isValid()){let t=uc(e,this.colorFormat);this.canUpdateValue?this.value=t:this.convertedValue=t}}},colorFormat:F(`format`,{type:String,default:`hex`}),alpha:F(`alpha`,{type:Boolean,default:!1}),inputs:F(`inputs`,{type:Boolean,default:!0}),presets:F(`presets`,{type:Array,default:[`#ffffff`,`#c3c3c3`,`#7f7f7f`,`#000000`,`#880015`,`#ed1c24`,`#ff7f27`,`#fff200`,`#22b14c`,`#00a2e8`,`#3f48cc`,`#a349a4`,`#b97a57`,`#ffaec9`,`#ffc90e`,`#00000000`]})},watch:{value:`onChange`,canUpdateValue(e){e&&this.convertedValue!==null&&(this.value=this.convertedValue,this.convertedValue=null)}}});function uc(e,t){return dc((0,d.tinycolor)(e),t)}function dc(e,t){switch(t){case`rgb`:return e.toRgb();case`prgb`:return e.toPercentageRgb();case`name`:return e.toName();case`hsl`:return e.toHsl();case`hsv`:return e.toHsv();case`hex3`:return`#${e.toHex(!0)}`;case`hex4`:return`#${e.toHex8(!0)}`;case`hex8`:return`#${e.toHex8()}`;default:return e.getAlpha()<1?`#${e.toHex8()}`:`#${e.toHex()}`}}var fc=V(lc,[[`render`,cc]]);function pc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),(0,e.normalizeProps)((0,e.guardReactiveProps)(t.$props)),null,16)}var mc=V(J.register(`component`,{defaultValue:()=>void 0,ignoreMissingValue:({schema:e})=>!(`default`in e),async processSchema(e,t){await Ln(t)}}),[[`render`,pc]]),hc=[`id`,`name`,`value`,`disabled`];function gc(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`input`,{class:`dito-text dito-input`,id:t.componentPath,ref:`element`,name:t.name,type:`text`,value:t.value,disabled:t.disabled,readonly:!0},null,8,hc)}var _c=V(J.register([`computed`,`data`,`hidden`],{defaultValue:()=>void 0,defaultVisible:!1,valueFromDataSchema:!0}),[[`render`,gc]]),vc={class:`dito-date`};function yc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,vc,[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.getComponent(t.type)),(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.dateValue,"onUpdate:modelValue":n[0]||=e=>t.dateValue=e,locale:t.locale,format:t.formats},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`locale`,`format`]))])}var bc=V(J.register([`date`,`datetime`,`time`],{components:{DitoAffixes:q},nativeField:!0,textField:!0,computed:{dateValue:{get(){let{value:e}=this;return e&&((0,r.parsePlainDate)(e)??new Date(e))},set(e){this.value=e}},formats:F(`formats`,{type:Object,default:null,get(e){let{date:t,time:n}=(0,r.assignDeeply)({},this.api.formats,e);return{date:[`date`,`datetime`].includes(this.type)?t:null,time:[`time`,`datetime`].includes(this.type)?n:null}}})},methods:{getComponent(e){return{date:ti,time:pi,datetime:gi}[e]}},processValue({schema:e,value:t}){return(0,r.isDate)(t)?e.type===`date`?(0,r.formatPlainDate)(t):t.toISOString():t}}),[[`render`,yc]]);function xc(e){let t=e?(0,r.isArray)(e)?e:Object.entries(e):[];return new URLSearchParams(t.reduce((e,[t,n])=>{if((0,r.isArray)(n))for(let r of n)e.push([t,r??``]);else n!=null&&e.push([t,n]);return e},[])).toString().replaceAll(/%(?:21|24|28|29|2C|2F|3A|3B|3D|3F|40)/g,decodeURIComponent)}function Sc({path:e,query:t,hash:n}){let{location:r}=window;history.replaceState(history.state,null,`${r.origin}${e??r.pathname}?${t?xc(t):r.search.slice(1)}${n??r.hash}`)}var Y={mixins:[Ga,Ro,Fi],defaultValue:e=>w(e.schema)?[]:null,excludeValue:e=>!!e.schema.resource,provide(){return{$sourceComponent:()=>this}},data(){return{wrappedPrimitives:null}},computed:{sourceComponent(){return this},isObjectSource(){return ht(this.type)},isListSource(){return w(this.type)},hasData(){return!!this.value},shouldRender(){return this.sourceDepth<this.maxDepth},isReady(){return this.shouldRender&&(this.hasData||!this.providesData)},isInView(){return!!this.viewComponent},wrapPrimitives(){return this.schema.wrapPrimitives},valueListData(){let{value:e}=this;return this.isObjectSource?e==null?[]:[e]:(this.isListResults(e)?e.results:e)||[]},primitiveValues(){return this.wrapPrimitives?[...this.valueListData]:null},listData:{get(){return this.wrapPrimitives?this.wrappedPrimitives||[]:this.valueListData},set(e){this.wrapPrimitives?this.wrappedPrimitives=e:this.value=this.isObjectSource?e?.length>0?e[0]:null:ln(this.sourceSchema,e,this.paginationRange)}},objectData:{get(){return this.listData[0]||null},set(e){this.listData=e?[e]:[]}},sourceSchema(){return this.schema},sourceDepth(){return this.$route.matched.reduce((e,t)=>e+ +(t.meta.schema===this.sourceSchema),0)},path(){return this.routeComponent.getChildPath(this.schema.path)},defaultQuery(){let{defaultOrder:e}=this;return e?{order:e}:{}},query:jn(`query`,{get(e){return{...this.defaultQuery,...e}},set(e){let{scope:t=this.defaultScope?.name,page:n=this.schema.page,type:i}=this.query;return e={...this.query,...t!=null&&{scope:t},...n!=null&&{page:n},...i!=null&&{type:i},...e},(0,r.equals)(e,this.$route.query)||Sc({query:e}),e}}),total:jn(`total`),columns(){return k(this.schema.columns)},scopes(){return k(this.schema.scopes)},defaultScope(){let e=null;if(this.scopes)for(let t of Object.values(this.scopes)){if(t.defaultScope)return t;e||=t}return e},defaultOrder(){if(this.columns)for(let e of Object.values(this.columns)){let{defaultSort:t}=e;if(t){let n=(0,r.isString)(t)?t:`asc`;return`${e.name} ${n}`}}return null},nestedMeta(){return{...this.meta,schema:this.schema}},forms(){return Object.values(O(this.schema,this.context))},view(){return Pt(this.schema,this.context)},linksToView(){return!!this.view},buttonSchemas(){return A(this.schema.buttons)},isCompact(){return this.forms.every(lt)},isInlined(){return ut(this.schema)},paginate:F(`paginate`,{type:Number}),render:F(`render`,{type:Function,default:null}),hasItems(){return this.isListSource||!!this.value},creatable:F(`creatable`,{type:Boolean,default:!1,get(e){return e&&D(this.schema)?!this.isObjectSource||!this.value:!1}}),editable:F(`editable`,{type:Boolean,default:!1,get(e){return e&&!this.isInlined&&this.hasItems}}),deletable:F(`deletable`,{type:Boolean,default:!1,get(e){return e&&this.hasItems}}),draggable:F(`draggable`,{type:Boolean,default:!1,get(e){return this.isListSource&&e}}),collapsible:F(`collapsible`,{type:Boolean,default:!1,get(e){return e&&this.isInlined}}),collapsed:F(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}}),maxDepth:F(`maxDepth`,{type:Number,default:1}),createPath(){return this.creatable?It(this.schema,this.context)||this.path:null}},watch:{$route:{flush:`post`,handler(e,t){this.providesData&&(t.path===e.path&&t.hash===e.hash?(this.query=e.query,this.loadData(!1)):this.meta.reload&&t.path!==e.path&&t.path.startsWith(e.path)&&(this.meta.reload=!1,this.loadData(!1)))}},value:{immediate:!0,handler(e){this.isListResults(e)&&this.unwrapListData(e)}},primitiveValues:{immediate:!0,handler(e){if(e&&!(0,r.equals)(e,this.unwrapPrimitives())){let{wrapPrimitives:t}=this;this.wrappedPrimitives=e.map(e=>({[t]:e}))}}},wrappedPrimitives:{deep:!0,handler(){let e=this.unwrapPrimitives();e&&!(0,r.equals)(e,this.primitiveValues)&&(this.value=e)}}},methods:{setupData(){this.query=this.$route.query,this.ensureData()},clearData(){this.total=0,this.setLoadedValue(null)},setData(e){if(this.isListSource&&(0,r.isArray)(e))this.setLoadedListItems(e);else if(!e||this.isObjectSource&&(0,r.isObject)(e))this.setLoadedValue(e);else if(!this.unwrapListData(e)&&(0,r.isObject)(e)&&this.isInView)return this.viewComponent.setData(e);return this.value},isListResults(e){return this.isListSource&&(0,r.isObject)(e)&&(0,r.isNumber)(e.total)&&(0,r.isArray)(e.results)},unwrapPrimitives(){let{wrapPrimitives:e,wrappedPrimitives:t}=this;return e&&t?t.map(t=>t[e]):null},unwrapListData(e){if(this.isListResults(e))return this.total=e.total,this.setLoadedListItems(e.results),this.value},setLoadedListItems(e){this.setLoadedValue(ln(this.sourceSchema,e,this.paginationRange))},setLoadedValue(e){this.formModel.applyCleanChanges(()=>{this.value=e}).catch(console.error)},createItem(e,t,n=null){let r=this.createData(e,t);if(this.isObjectSource)this.objectData=r;else{let{listData:e}=this;n==null?e.push(r):e.splice(n,0,r),this.listData=e}return this.collapsible&&this.$nextTick(()=>this.openSchemaComponent(n??-1)),this.onChange(),r},removeItem(e,t){let n=!1;if(this.isObjectSource)this.objectData=null,n=!0;else{let{listData:e}=this;t>=0&&(e.splice(t,1),this.listData=e,n=!0)}n&&(this.removeItemStore(this.schema,e,t),this.onChange())},deleteItem(e,t){let n=e&&this.getItemLabel(this.schema,e,{index:t,extended:!0}),r=()=>this.notify({type:this.isTransient?`info`:`success`,title:`Successfully Removed`,text:[`${n} was ${this.verbs.deleted}.`,this.transientNote]});if(e&&window.confirm(`Do you really want to ${this.verbs.delete} ${n}?`)){if(this.isTransient)this.removeItem(e,t),r();else{let n=this.getItemId(this.schema,e,t),i=`delete`,a=Xn(n,this.getResource({method:i}));a&&this.handleRequest({method:i,resource:a},n=>{n||(this.removeItem(e,t),r()),this.reloadData()})}}},getSchemaComponent(e){let{listData:t,schemaComponents:n}=this,r=n.at(e);if(t?.length){let i=t.at(e);return i==null?null:r?.data===i?r:n.find(e=>e.data===i)}return r},openSchemaComponent(e){let t=this.getSchemaComponent(e);t&&(t.opened=!0)},async navigateToComponent(e,t,{shouldRevealInlinedOnly:n=!1}={}){let i=e.startsWith(this.dataPath)?this.isListSource?(0,r.parseDataPath)(e.slice(this.dataPath.length+1))[0]??null:0:null;return i!==null&&(0,r.isNumber)(+i)&&await this.getSchemaComponent(+i)?.navigateToComponent(e,t,{shouldRevealInlinedOnly:n})?!0:!n&&this.navigateToRouteComponent(e,t)},navigateToRouteComponent(e,t){return new Promise((n,i)=>{let a=()=>{let{routeComponents:e}=this.appState,r=e[e.length-1];n(t?.([r])??!0)},o=(0,r.parseDataPath)(e);for(;o.length>0;){let e=this.routeComponent.getChildPath(this.api.normalizePath((0,r.normalizeDataPath)(o))),{matched:t}=this.$router.resolve(e);if(t.length&&t[0].name!==`catch-all`){this.$route.path===e?a():this.$router.push({path:e}).catch(i).then(()=>{this.$nextTick(a)});return}o.pop()}n(!1)})}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){Un(e,t,n);let c=ut(t);if(c&&t.resource)throw Error(`Nested ${this.isListSource?`lists`:this.isObjectSource?`objects`:`schema`} cannot load data from their own resources`);let l=`id${i+1}`,u={api:e,schema:t},d={...u,flatten:o,nested:a,param:l},f=await Wn(e,t,i);if(s&&await s(f,i+1),D(t)&&!c){let e=i===0?``:t.path,n={path:wc(e,w(t)?l:null),component:B.component(a?`DitoFormNested`:`DitoForm`),meta:d};ht(t)&&r.push({...n,path:wc(e,l)}),e&&w(t)&&r.push({path:e,redirect:`.`,meta:u});let[s,c]=f.reduce((e,t)=>(e[+!t.meta.flatten].push(t),e),[[],[]]);if(c.length&&(n.children=c),r.push(n),s.length)for(let e of s)r.push({...e.redirect?e:n,path:`${n.path}/${e.path}`,meta:{...e.meta,flatten:o}})}},processValue({schema:e,value:t,dataPath:n},r){return r.addSource(n,e),D(e)?t:Cc(t)}};function Cc(e){return(0,r.isArray)(e)?e.map(e=>(0,r.isObject)(e)?{...e}:e):(0,r.isObject)(e)?{...e}:e}function wc(e,t){return t?e?`${e}/:${t}`:`:${t}`:e}var Tc={text(e){let t=[{label:`contains`,value:`contains`},{label:`equals`,value:`equals`},{label:`starts with`,value:`starts-with`},{label:`ends with`,value:`ends-with`}];return{operator:e.operators?{type:`select`,width:`2/5`,options:(0,r.isArray)(e.operators)?t.filter(t=>e.operators.includes(t.value)):t,clearable:!0}:null,text:{type:`text`,width:e.operators?`3/5`:`fill`,clearable:!0}}},"date-range"(){let e={type:`datetime`,width:`1/2`,formats:{date:{day:`2-digit`,month:`2-digit`,year:`numeric`}},clearable:!0};return{from:e,to:e}}};function Ec(e,t,n,r){let{sticky:i,...a}=t,o={type:`panel`,label:`Filters`,name:`$filters`,disabled:!1,sticky:i,data(){return Nc(o,r.value)},components:Ac(a),buttons:Dc(!1),panelButtons:Dc(!0),events:{change(){this.applyFilters()}},computed:{filters(){return Mc(this.schema,this.data)},hasFilters(){return this.filters.length>0}},methods:{applyFilters(){r.value={...r.value,filter:this.filters,page:void 0}},clearFilters(){this.resetData(),this.applyFilters()}}};return Hn(e,o),o}function Dc(e){return{clear:{type:`button`,text:e?null:`Clear`,disabled:({schemaComponent:e})=>!e.hasFilters,events:{click({schemaComponent:e}){e.clearFilters()}}},submit:{type:`submit`,text:e?null:`Filter`,visible:!e,events:{click({schemaComponent:e}){e.applyFilters()}}}}}function Oc(e){return`$${e}`}function kc(e){return e.startsWith(`$`)?e.slice(1):null}function Ac(e){let t={};for(let n of Object.values(k(e)||{})){let{filter:e,width:i,...a}=n,o=e?Tc[e]?.(n):n.components;if(o){a.type=`form`,a.components={};for(let[e,t]of Object.entries(o))if(t){let n=t.label||(0,r.labelize)(t.name||e);a.components[e]={...t,label:!1,placeholder:n}}t[Oc(n.name)]={label:a.label??(0,r.labelize)(n.name),type:`object`,width:i,default:()=>({}),form:a,inlined:!0}}else throw Error(`Invalid filter '${n.name}': Unknown filter type '${e}'.`)}return t}function jc(e,t){return e.components[t]?.form?.components}function Mc(e,t){let n=[];for(let r in t){let i=t[r];if(i){let t=Object.keys(jc(e,r)).map(e=>i[e]??null);t.some(e=>e!==null)&&n.push(`${kc(r)}:${t.map(JSON.stringify).join(`,`)}`)}}return n}function Nc(e,t){let n={};if(t)for(let e of(0,r.asArray)(t.filter)){let[,t,i]=e.match(/^(\w+):(.*)$/);try{n[t]=(0,r.asArray)(JSON.parse(`[${i}]`))}catch{}}let i={};for(let t in e.components){let r={},a=n[kc(t)];if(a){let n=jc(e,t);if(n){let e=0;for(let t in n)r[t]=a[e++]}}i[t]=r}return i}var Pc=[`id`,`aria-label`],Fc={key:0,class:`dito-list__header`},Ic={key:1,class:`dito-spacer`},Lc=[`id`],Rc={key:1},zc=[`innerHTML`],Bc=[`innerHTML`],Vc={key:2,class:`dito-table__buttons`},Hc={key:1},Uc=[`colspan`];function Wc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoScopes`),c=(0,e.resolveComponent)(`DitoPagination`),l=(0,e.resolveComponent)(`DitoTableHead`),u=(0,e.resolveComponent)(`DitoTableCell`),d=(0,e.resolveComponent)(`DitoSchemaInlined`),f=(0,e.resolveComponent)(`DitoEditButtons`),p=(0,e.resolveComponent)(`DitoDraggable`);return t.isReady?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-list`,id:t.componentPath,role:`region`,"aria-label":t.label||t.labelize(t.schema.name)},[t.scopes||t.hasPagination?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Fc,[t.scopes?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,query:t.query,scopes:t.scopes},null,8,[`query`,`scopes`])):t.hasPagination?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ic)):(0,e.createCommentVNode)(``,!0),t.hasPagination?((0,e.openBlock)(),(0,e.createBlock)(c,{key:2,query:t.query,limit:t.paginate,total:t.total||0},null,8,[`query`,`limit`,`total`])):(0,e.createCommentVNode)(``,!0)])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`table`,{class:(0,e.normalizeClass)([`dito-table`,{"dito-table--separators":t.isInlined,"dito-table--larger-padding":t.hasEditButtons&&!t.isInlined,"dito-table--alternate-colors":!t.isInlined,"dito-table--even-count":t.hasEvenCount}])},[t.columns?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,query:t.query,columns:t.columns,hasEditButtons:t.hasEditButtons},null,8,[`query`,`columns`,`hasEditButtons`])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(p,{as:`tbody`,options:t.getDraggableOptions(),draggable:t.draggable,modelValue:t.listData,"onUpdate:modelValue":n[0]||=e=>t.listData=e},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.listData,(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,{id:t.getComponentPath(r),key:t.getItemUid(t.schema,n)},[t.columns?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.columns,i=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.shouldRenderSchema(i)?((0,e.openBlock)(),(0,e.createBlock)(u,{key:i.name,class:(0,e.normalizeClass)(t.getCellClass(i)),cell:i,schema:t.schema,dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.store,nested:!1,disabled:t.disabled||t.isLoading},null,8,[`class`,`cell`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`])):(0,e.createCommentVNode)(``,!0)],64))),256)):((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Rc,[t.isInlined?((0,e.openBlock)(),(0,e.createBlock)(d,{key:0,label:t.getItemLabel(t.schema,n,{index:r,asObject:!0}),schema:t.getItemFormSchema(t.schema,n,t.context),dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.getItemStore(t.schema,n,r),disabled:t.disabled||t.isLoading,collapsed:t.collapsed,collapsible:t.collapsible,deletable:t.deletable,draggable:t.draggable&&t.listData.length>1,editable:t.editable,editPath:t.getEditPath(n,r),createPath:t.createPath,insertIndex:t.creatable&&t.draggable?r:null,onDelete:e=>t.deleteItem(n,r)},null,8,[`label`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`draggable`,`editable`,`editPath`,`createPath`,`insertIndex`,`onDelete`])):t.schema.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),{key:1,dataPath:t.getDataPath(r),data:n,nested:!1},null,8,[`dataPath`,`data`])):t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:2,innerHTML:t.render(t.getContext(n,r))},null,8,zc)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:3,innerHTML:t.getItemLabel(t.schema,n,{index:r})},null,8,Bc))])),t.hasCellEditButtons?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Vc,[(0,e.createVNode)(f,{nested:``,schema:t.getItemFormSchema(t.schema,n,t.context),dataPath:t.getDataPath(r),data:n,meta:t.nestedMeta,store:t.getItemStore(t.schema,n,r),disabled:t.disabled||t.isLoading,deletable:t.deletable,draggable:t.draggable,editable:t.editable,editPath:t.getEditPath(n,r),onDelete:e=>t.deleteItem(n,r)},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`deletable`,`draggable`,`editable`,`editPath`,`onDelete`])])):(0,e.createCommentVNode)(``,!0)],8,Lc))),128))]),_:1},8,[`options`,`draggable`,`modelValue`]),t.hasListButtons&&!t.single?((0,e.openBlock)(),(0,e.createElementBlock)(`tfoot`,Hc,[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`td`,{class:`dito-table__buttons`,colspan:t.numColumns},[(0,e.createVNode)(f,{buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,nested:t.nested,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath},null,8,[`buttons`,`schema`,`dataPath`,`data`,`meta`,`store`,`nested`,`disabled`,`creatable`,`createPath`])],8,Uc)])])):(0,e.createCommentVNode)(``,!0)],2),t.hasListButtons&&t.single?((0,e.openBlock)(),(0,e.createBlock)(f,{key:1,class:`dito-buttons--large dito-buttons--main dito-buttons--sticky`,buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.listData,meta:t.meta,store:t.store,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath},null,8,[`buttons`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`creatable`,`createPath`])):(0,e.createCommentVNode)(``,!0)],8,Pc)):(0,e.createCommentVNode)(``,!0)}var Gc=V(J.register(`list`,{mixins:[Y,is],getSourceType(e){return e},getPanelSchema(t,n,i,a){let{filters:o}=n;if(o)return Ec(t,o,i,(0,e.computed)({get(){return a.query},set(e){let t=e=>(0,r.pickBy)(e,e=>e!==void 0);(0,r.equals)(t(e),t(a.query))||(a.query=e,a.loadData(!1))}}))},computed:{hasPagination(){return!!this.paginate},hasListButtons(){return!!(this.buttonSchemas||this.creatable)},hasEditButtons(){let{listData:e}=this;return e.length>0&&(this.editable||this.deletable||this.draggable)},hasCellEditButtons(){return!this.isInlined&&this.hasEditButtons},hasEvenCount(){return!(this.listData.length%2)},numColumns(){return(this.columns?Object.keys(this.columns).length:1)+ +!!this.hasCellEditButtons}},methods:{getDataPath(e){return b(this.dataPath,e)},getComponentPath(e){return b(this.componentPath,e)},getEditPath(e,t){if(this.editable){let n=this.getItemId(this.schema,e,t);return Lt(this.schema,n,this.context)||`${this.path}/${n}`}return null},getCellClass(e){return`dito-cell--${(0,r.hyphenate)(e.name)}`},getContext(e,t){return new E(this,{data:e,value:e,index:t,dataPath:this.getDataPath(t)})},onFilterErrors(e){let t=b(this.dataPath,`$filters`),n=this.schemaComponent.getPanelByDataPath(t);if(n)return n.showValidationErrors(e,!0),!0}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Ln(t),Rn(t.columns),Y.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,Wc]]);function Kc(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoLabel`);return(0,e.openBlock)(),(0,e.createBlock)(s,{class:`dito-label-component`,label:t.value},null,8,[`label`])}var qc=V(J.register(`label`,{excludeValue:!0,generateLabel:!1}),[[`render`,Kc]]);function Jc(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Zc(e.charCodeAt(r-1))&&Xc(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Jc(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Yc(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Zc(e.charCodeAt(i-1))&&Xc(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Yc(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Xc(e){return e>=56320&&e<57344}function Zc(e){return e>=55296&&e<56320}var X=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Jc(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Yc(this,e,t,n)}findIndex(e){if(e==0)return $c(0,e);if(e==this.size)return $c(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?$c(t+1,i):$c(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};X.empty=new X([],0);var Qc={index:0,offset:0};function $c(e,t){return Qc.index=e,Qc.offset=t,Qc}function el(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!el(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!el(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Z=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&el(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Z.none=[];var tl=class extends Error{},nl=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=il(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(rl(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(X.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};nl.empty=new nl(X.empty,0,0);function rl(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(rl(a.content,t-i-1,n-i-1)))}function il(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=il(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function al(e,t,n){if(n.openStart>e.depth)throw new tl(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new tl(`Inconsistent open depths`);return ol(e,t,n,0)}function ol(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ol(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return $(a,dl(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return $(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=fl(n,e);return $(a,ul(e,i,o,t,r))}}function sl(e,t){if(!t.type.compatibleContent(e.type))throw new tl(`Cannot join `+t.type.name+` onto `+e.type.name)}function cl(e,t,n){let r=e.node(n);return sl(r,t.node(n)),r}function Q(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ll(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Q(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Q(i.child(e),r);t&&t.depth==n&&t.textOffset&&Q(t.nodeBefore,r)}function $(e,t){if(!e.type.validContent(t))throw new tl(`Invalid content for node `+e.type.name);return e.copy(t)}function ul(e,t,n,r,i){let a=e.depth>i&&cl(e,t,i+1),o=r.depth>i&&cl(n,r,i+1),s=[];return ll(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(sl(a,o),Q($(a,ul(e,t,n,r,i+1)),s)):(a&&Q($(a,dl(e,t,i+1)),s),ll(t,n,i,s),o&&Q($(o,dl(n,r,i+1)),s)),ll(r,null,i,s),new X(s)}function dl(e,t,n){let r=[];return ll(null,e,n,r),e.depth>n&&Q($(cl(e,t,n+1),dl(e,t,n+1)),r),ll(t,null,n,r),new X(r)}function fl(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(X.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var pl=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Z.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new _l(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=gl.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else gl.set(t,r=new ml);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%hl,i}},ml=class{constructor(){this.elts=[],this.i=0}},hl=12,gl=new WeakMap,_l=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},vl=Object.create(null),yl=class e{constructor(e,t,n,r=Z.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||X.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&el(this.attrs,t||e.defaultAttrs||vl)&&Z.sameSet(this.marks,n||Z.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return nl.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new nl(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return al(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return pl.resolveCached(this,e)}resolveNoCache(e){return pl.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),bl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=X.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),xl(this.type.attrs,this.attrs,`node`,this.type.name);let e=Z.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];xl(n.type.attrs,n.attrs,`mark`,n.type.name),e=n.addToSet(e)}if(!Z.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=X.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};yl.prototype.text=void 0;function bl(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function xl(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}var Sl=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Cl(t,n);if(r.next==null)return e.empty;let i=wl(r);r.next&&r.err(`Unexpected trailing text`);let a=Pl(jl(i));return Fl(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return X.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
7
+ `)}};Sl.empty=new Sl(!0);var Cl=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function wl(e){let t=[];do t.push(Tl(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Tl(e){let t=[];do t.push(El(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function El(e){let t=Al(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Ol(e,t);else break;return t}function Dl(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Ol(e,t){let n=Dl(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Dl(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function kl(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Al(e){if(e.eat(`(`)){let t=wl(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=kl(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function jl(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Ml(e,t){return t-e}function Nl(e,t){let n=[];return r(t),n.sort(Ml);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Pl(e){let t=Object.create(null);return n(Nl(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Nl(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Sl(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Ml);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Fl(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var Il=[`id`],Ll={key:0,class:`dito-buttons dito-buttons--toolbar`},Rl={class:`dito-buttons__group`},zl=[`aria-label`,`aria-pressed`,`onClick`];function Bl(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoIcon`),c=(0,e.resolveComponent)(`EditorContent`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`dito-markup`,id:t.componentPath},[t.groupedButtons.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ll,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.groupedButtons,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Rl,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t,({id:t,label:n,icon:r,isActive:i,onClick:a})=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{class:(0,e.normalizeClass)([`dito-button`,{"dito-button--active":i}]),key:t,"aria-label":n,"aria-pressed":i,onClick:a},[(0,e.createVNode)(s,{name:r},null,8,[`name`])],10,zl))),128))]))),256))])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(c,{class:`dito-markup-editor`,ref:`editor`,editor:t.editor,style:(0,e.normalizeStyle)(t.styles)},null,8,[`editor`,`style`]),t.resizable?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`dito-resize`,onMousedown:n[0]||=(0,e.withModifiers)((...e)=>t.onDragResize&&t.onDragResize(...e),[`stop`,`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0)],8,Il)}var Vl=J.register(`markup`,{mixins:[G],components:{EditorContent:f.EditorContent,DitoIcon:Qr},data(){return{editor:null,height:null}},computed:{lines(){return this.schema.lines||10},hardBreak(){return!!this.schema.hardBreak},styles(){return{height:this.height||`calc(${this.lines}em * var(--line-height))`}},markButtons(){return this.getButtons(`marks`,{bold:!0,italic:!0,underline:!0,strike:!0,small:!0,code:!0,subscript:!0,superscript:!0,link:{onClick:e=>this.onClickLink(e)}})},basicNodeButtons(){return this.getButtons(`nodes`,{paragraph:{command:`setParagraph`},heading:{attribute:`level`,values:[1,2,3,4,5,6]}})},advancedNodeButtons(){return this.getButtons(`nodes`,{bulletList:!0,orderedList:!0,blockquote:!0,codeBlock:!0})},toolButtons(){return this.getButtons(`tools`,{undo:!0,redo:!0,footnotes:{command:`addFootnote`}})},groupedButtons(){return[this.markButtons,this.basicNodeButtons,this.advancedNodeButtons,this.toolButtons].filter(e=>e.length>0)},parseOptions(){return{preserveWhitespace:{collapse:!1,preserve:!0,"preserve-all":`full`}[this.whitespace]}},editorOptions(){return{editable:!this.readonly,autoFocus:this.autofocus,disableInputRules:!this.enableRules.input,disablePasteRules:!this.enableRules.paste,parseOptions:this.parseOptions,editorProps:this.hardBreak?{handlePaste:(e,t,n)=>{let r=[];n.content.forEach((t,n,i)=>{i>0&&t.type.name===`paragraph`&&r.push(e.state.schema.nodes.hardBreak.create()),t.type.name===`paragraph`?t.content.forEach(e=>r.push(e)):r.push(t)});let i=e.state.schema.nodes.paragraph.create(null,X.from(r));return e.dispatch(e.state.tr.replaceSelection(new nl(X.from(i),0,0))),!0}}:{}}},resizable:F(`resizable`,{type:Boolean,default:!1}),whitespace:F(`whitespace`,{type:String,default:`collapse`}),enableRules:F(`enableRules`,{type:[Object,Boolean],default:!1,get(e){return(0,r.isObject)(e)?e:{input:!!e,paste:!!e}}})},watch:{readonly:`updateEditorOptions`,autofocus:`updateEditorOptions`,enableRules:`updateEditorOptions`},created(){let e=!1,t=!1,n=()=>this.onFocus(),i=()=>{s(),this.onBlur(),c()},a=()=>{o(),this.onInput()},o=(0,r.debounce)(()=>s(),100),s=()=>{let n=this.editor.getHTML(),r=this.hardBreak?n.replace(/^<p>(.*?)<\/p>$/s,`$1`):n;r!==this.value&&(e=!0,t=!0,this.value=r),this.focused||c()},c=()=>{e&&(e=!1,this.onChange())};this.$watch(`value`,e=>{if(t)t=!1;else{let t=this.hardBreak?`<p>${e}</p>`:e;this.editor.commands.setContent(t,{emitUpdate:!1,parseOptions:this.parseOptions})}}),this.editor=new f.Editor({...this.editorOptions,onFocus:n,onBlur:i,onUpdate:a,extensions:this.getExtensions(),content:this.value||``})},unmounted(){this.editor.destroy()},methods:{onDragResize(e){let t=({clientX:e,clientY:t})=>({x:e,y:t}),n=t(e).y,r=parseFloat(getComputedStyle(this.$refs.editor.$el).height),i=e=>{let{y:i}=t(e);r+=i-n,n=i,this.height=`${Math.max(r,0)}px`},a=this.domOn(document,{mousemove:i,mouseup(e){i(e),a.remove()}})},updateEditorOptions(){this.editor.setOptions(this.editorOptions)},async onClickLink(e){let t=await this.rootComponent.showDialog({components:{href:{type:`url`,label:`Link`,autofocus:!0},title:{type:`text`,label:`Title`}},buttons:{cancel:{},apply:{type:`submit`},remove:{events:{click({dialogComponent:e}){e.resolve(null)}}}},data:(0,f.getMarkAttributes)(this.editor.state,`link`)});if(t){let{href:n,title:r}=t;if(n)try{new URL(n)}catch{n=`https://${n}`}e.commands.setLink({href:n,title:r})}else t===null&&e.commands.unsetLink()},getExtensions(){let{marks:e={},nodes:t={},tools:n={}}=this.schema;return[n.footnotes?p.Document.extend({content:`block+ footnotes?`}):p.Document,m.Text,ce.Paragraph,e.bold&&h.Bold,e.italic&&_.Italic,e.underline&&re.Underline,e.strike&&ee.Strike,e.small&&Hl,e.code&&g.Code,e.subscript&&ne.Superscript,e.superscript&&te.Subscript,e.link&&Ul,t.blockquote&&ie.Blockquote,t.codeBlock&&ae.CodeBlock,t.heading&&se.Heading.configure({levels:t.heading}),t.horizontalRule&&le.HorizontalRule,(t.orderedList||t.bulletList)&&fe.ListItem,t.bulletList&&de.BulletList,t.orderedList&&ue.OrderedList,...n.footnotes?[pe.Footnotes,pe.Footnote,pe.FootnoteReference]:[],n.history&&me.History,oe.HardBreak.extend({addKeyboardShortcuts:()=>{let e=()=>this.editor.commands.setHardBreak();return{"Mod-Enter":e,"Shift-Enter":e,...this.hardBreak?{Enter:e}:null}}})].filter(e=>!!e)},getButtons(e,t){let n=[],{commands:i}=this.editor,a=({name:e,id:t=e,label:a=this.labelize(t),icon:o,command:s,attributes:c,onClick:l})=>{n.push({id:t,label:a,icon:o,isActive:this.editor.isActive(e,c),onClick:()=>{s??=e in i?e:`toggle${(0,r.camelize)(e,!0)}`,s in i&&(l?l(this.editor,c):(e=>this.editor.chain()[s](e).focus().run())(c))}})},o=this.schema[e];if(o)for(let[e,n]of Object.entries(t)){let t=o[[`undo`,`redo`].includes(e)?`history`:e],i=(0,r.hyphenate)(e);if(t){if(n===!0)a({name:e,icon:i});else if((0,r.isObject)(n)){let{command:o,attribute:s,values:c,onClick:l}=n;if(s){if((0,r.isArray)(c)&&(0,r.isArray)(t))for(let n of c)t.includes(n)&&a({name:e,id:`${e}-${n}`,icon:`${i}-${n}`,command:o,attributes:{[s]:n},onClick:l})}else a({name:e,icon:i,command:o,onClick:l})}}}return n},focusElement(){this.editor.commands.focus()},blurElement(){this.editor.commands.blur()}}}),Hl=f.Mark.create({name:`small`,parseHTML(){return[{tag:`small`}]},renderHTML(){return[`small`,0]},addCommands(){return{setSmall:e=>({commands:t})=>t.setMark(this.name,e),toggleSmall:e=>({commands:t})=>t.toggleMark(this.name,e),unsetSmall:()=>({commands:e})=>e.unsetMark(this.name)}}}),Ul=v.Link.extend({inclusive:!1,addAttributes(){return{href:{default:null},title:{default:null}}},parseHTML(){return[{tag:`a`,getAttrs:e=>({href:e.getAttribute(`href`),title:e.getAttribute(`title`)})}]},renderHTML({HTMLAttributes:e}){return[`a`,e,0]}}),Wl=V(Vl,[[`render`,Bl]]),Gl={class:`dito-multiselect`},Kl={class:`dito-multiselect__inner`};function ql(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`VueMultiselect`),l=(0,e.resolveComponent)(`DitoEditButtons`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Gl,[(0,e.createElementVNode)(`div`,Kl,[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`]),(0,e.createVNode)(c,(0,e.mergeProps)({id:t.componentPath,ref:`element`,modelValue:t.selectedOptions,"onUpdate:modelValue":n[0]||=e=>t.selectedOptions=e,"aria-label":t.label,class:t.multiselectClasses,showLabels:!1,placeholder:t.placeholder,tagPlaceholder:`Press enter to add new tag`,options:t.populate&&t.activeOptions||[],customLabel:t.getLabelForOption,trackBy:t.optionValue,groupLabel:t.groupByLabel,groupValues:t.groupByOptions,multiple:t.multiple,taggable:t.taggable,searchable:t.searchable,internalSearch:!t.searchFilter,preserveSearch:!!t.searchFilter,clearOnSelect:!t.searchFilter,closeOnSelect:!t.stayOpen,loading:t.isLoadingOptions||t.isLoadingSearchedOptions},t.attributes,{onOpen:t.onOpen,onClose:t.onClose,onTag:t.onAddTag,onSearchChange:t.onSearchChange}),null,16,[`id`,`modelValue`,`aria-label`,`class`,`placeholder`,`options`,`customLabel`,`trackBy`,`groupLabel`,`groupValues`,`multiple`,`taggable`,`searchable`,`internalSearch`,`preserveSearch`,`clearOnSelect`,`closeOnSelect`,`loading`,`onOpen`,`onClose`,`onTag`,`onSearchChange`]),(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),t.editable?((0,e.openBlock)(),(0,e.createBlock)(l,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:!1,editable:t.editable,editPath:t.editPath},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`editable`,`editPath`])):(0,e.createCommentVNode)(``,!0)])}var Jl=V(J.register(`multiselect`,{mixins:[Zs],components:{DitoAffixes:q,VueMultiselect:he.default},data(){return{searchedOptions:null,isLoadingSearchedOptions:!1,currentSearchTerm:null,populate:!1}},computed:{selectedOptions:{get(){return this.multiple?(this.selectedValue||[]).map(e=>this.getOptionForValue(e)||this.addTagOption(e)).filter(Boolean):this.selectedOption},set(e){this.selectedValue=this.multiple?(e||[]).map(e=>this.getValueForOption(e)):this.getValueForOption(e),this.onChange()}},activeOptions(){return this.searchedOptions||this.options},multiple:F(`multiple`,{type:Boolean,default:!1}),searchable:F(`searchable`,{type:Boolean,default:!1}),taggable:F(`taggable`,{type:Boolean,default:!1}),stayOpen:F(`stayOpen`,{type:Boolean,default:!1}),multiselectClasses(){let e=`multiselect`;return{[`${e}--multiple`]:this.multiple,[`${e}--loading`]:this.isLoadingOptions||this.isLoadingSearchedOptions,[`${e}--highlight`]:this.showHighlight}},placeholder(){let{placeholder:e,searchable:t,taggable:n}=this.schema;return(0,r.isBoolean)(e)&&(e=e?void 0:null),e===void 0?t&&n?`Search or add a ${this.label}`:t?`Select or search ${this.label}`:void 0:e},showHighlight(){return this.isMounted&&this.$refs.element.pointerDirty}},mounted(){this.autofocus&&this.focus()},methods:{addTagOption(e){if(this.taggable){let{optionLabel:t,optionValue:n}=this,r=t&&n?{[t]:e,[n]:e}:e;return this.options.push(r),r}},focusElement(){this.$refs.element.activate()},blurElement(){this.$refs.element.deactivate()},onOpen(){this.populate=!0},onClose(){this.focused&&this.onBlur()},onBlur(){this.$refs.element.isOpen||Mn.methods.onBlur.call(this)},onAddTag(e){let t=this.addTagOption(e);t&&(this.value??=[],this.value.push(this.getValueForOption(t)))},async loadSearchedOptions(e){try{return await this.optionsResolver.waitForValue(),await this.searchFilter(new E(this,{searchTerm:e}))}catch(e){return this.addError(e.message||e),null}},async onSearchChange(e){if(this.searchFilter){if(this.currentSearchTerm=e,e){this.searchedOptions=[];let t=setTimeout(()=>{this.isLoadingSearchedOptions=!0},0),n=await this.loadSearchedOptions(e);clearTimeout(t),e===this.currentSearchTerm&&(this.searchedOptions=n,this.isLoadingSearchedOptions=!1)}else this.searchedOptions=null,this.isLoadingSearchedOptions=!1}}}}),[[`render`,ql]]),Yl={getTypeValidations(e,t){let n=e.type===`integer`,r=n=>j(n,{type:Number,schema:e,context:t}),i=(e,t)=>n&&e!=null?t(e):e,a=j(`range`,{type:Array,schema:e,context:t}),o=i(r(`min`)??a?.[0],Math.floor),s=i(r(`max`)??a?.[1],Math.ceil),c=i(r(`step`),Math.ceil),l=r(`decimals`),u={};if(o!=null&&s!=null?u.range=[o,s]:(o!=null&&(u.min=o),s!=null&&(u.max=s)),l!=null)u.decimals=l;else if(c){let e=(`${c}`.split(`.`)[1]||``).length;e>0?u.decimals=e:u.integer=!0}return n&&(u.integer=!0),u},computed:{inputValue:{get(){return this.value===null?``:this.value},set(e){this.value=e===``?null:this.isInteger?Number(e):parseFloat(e)}},isInteger(){return!1},stepValue(){return this.step==null&&!this.isInteger?`any`:this.step},decimals:F(`decimals`,{type:Number}),step:F(`step`,{type:Number,get(e){return this.isInteger&&e!=null?Math.ceil(e):e}}),min:F(`min`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[0]:e,this.isInteger&&e!=null?Math.floor(e):e}}),max:F(`max`,{type:Number,get(e){return e=e===void 0?this.getSchemaValue(`range`,{type:Array})?.[1]:e,this.isInteger&&e!=null?Math.ceil(e):e}}),range:F(`range`,{type:Array,get(){let{min:e,max:t}=this;return e!=null&&t!=null?[e,t]:void 0},set(e){(0,r.isArray)(e)&&([this.min,this.max]=e)}})}};function Xl(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:`dito-number`,id:t.componentPath,ref:`element`,modelValue:t.inputValue,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:`number`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`min`,`max`,`step`])}var Zl=V(J.register([`number`,`integer`],{mixins:[Yl],components:{DitoInput:H,DitoAffixes:q},nativeField:!0,textField:!0,computed:{isInteger(){return this.type===`integer`}}}),[[`render`,Xl]]),Ql=[`id`],$l={key:0,class:`dito-object-content`},eu=[`innerHTML`],tu=[`innerHTML`];function nu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSchemaInlined`),c=(0,e.resolveComponent)(`DitoEditButtons`);return t.isReady?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`dito-object`,id:t.componentPath},[t.objectData?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,$l,[t.isInlined?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,label:t.objectLabel,schema:t.getItemFormSchema(t.schema,t.objectData,t.context),dataPath:t.dataPath,data:t.objectData,meta:t.nestedMeta,store:t.store,disabled:t.disabled||t.isLoading,collapsed:t.collapsed,collapsible:t.collapsible,deletable:t.deletable,accumulatedBasis:t.accumulatedBasis,onDelete:n[0]||=e=>t.deleteItem(t.objectData)},null,8,[`label`,`schema`,`dataPath`,`data`,`meta`,`store`,`disabled`,`collapsed`,`collapsible`,`deletable`,`accumulatedBasis`])):t.schema.component?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.schema.component),{key:1,dataPath:t.dataPath,data:t.objectData,nested:!1},null,8,[`dataPath`,`data`])):t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:2,innerHTML:t.render(t.getContext())},null,8,eu)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:3,innerHTML:t.getItemLabel(t.schema,t.objectData)},null,8,tu))])):(0,e.createCommentVNode)(``,!0),(0,e.createVNode)(c,{buttons:t.buttonSchemas,schema:t.schema,dataPath:t.dataPath,data:t.objectData,path:t.path,meta:t.meta,store:t.store,disabled:t.disabled||t.isLoading,creatable:t.creatable,createPath:t.createPath,editable:t.editable,editPath:t.path,deletable:!t.isInlined&&t.deletable,onDelete:n[1]||=e=>t.deleteItem(t.objectData)},null,8,[`buttons`,`schema`,`dataPath`,`data`,`path`,`meta`,`store`,`disabled`,`creatable`,`createPath`,`editable`,`editPath`,`deletable`])],8,Ql)):(0,e.createCommentVNode)(``,!0)}var ru=V(J.register(`object`,{mixins:[Y],getSourceType(e){return e},computed:{objectLabel(){return this.collapsible?this.getItemLabel(this.schema,this.objectData,{asObject:!0}):null}},methods:{getContext(){return new E(this,{data:this.objectData})}},async processSchema(e,t,n,r,i,a=!1,o=!1,s=null){await Promise.all([Ln(t),Y.processSchema(e,t,n,r,i,a,o,s)])}}),[[`render`,nu]]),iu=J.register(`panel`,{defaultNested:!1,generateLabel:!1,omitSpacing:!0,getPanelSchema(e,t){return t},async processSchema(e,t,n,r,i){await L(e,t,r,i)},render(){return null}}),au=[`id`,`value`,`max`];function ou(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`progress`,(0,e.mergeProps)({class:`dito-progress`,id:t.componentPath,ref:`element`,value:t.progressValue,max:t.progressMax},t.attributes),null,16,au)}var su=V(J.register(`progress`,{mixins:[Yl],computed:{progressValue(){let{value:e,range:t,step:n}=this;return e===null?e=``:(t&&(e-=t[0]),n&&(e=Math.round(e/n)*n)),e},progressMax(){let{range:e}=this;return e?e[1]-e[0]:null}}}),[[`render`,ou]]),cu=[`id`,`aria-label`],lu=[`value`];function uu(t,n,r,i,a,o){return(0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{class:(0,e.normalizeClass)([`dito-radio-buttons`,`dito-layout--${t.schema.layout||`vertical`}`]),id:t.componentPath,role:`radiogroup`,"aria-label":t.label},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.options,r=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,null,[(0,e.createElementVNode)(`label`,null,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({class:`dito-radio-button`,ref_for:!0,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedValue=e,type:`radio`,value:t.getValueForOption(r)},{ref_for:!0},t.attributes),null,16,lu),[[e.vModelRadio,t.selectedValue]]),(0,e.createTextVNode)((0,e.toDisplayString)(t.getLabelForOption(r)),1)])]))),256))],10,cu)}var du=V(J.register(`radio`,{mixins:[Zs],nativeField:!0,defaultWidth:`auto`}),[[`render`,uu]]);function fu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSchemaInlined`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`dito-section`,{"dito-section--labelled":t.hasLabel}])},[(0,e.createVNode)(s,{class:`dito-section__schema`,schema:t.getItemFormSchema(t.schema,t.item,t.context),dataPath:t.dataPath,data:t.item,meta:t.meta,store:t.store,label:t.label,info:t.info,padding:t.hasLabel?`nested`:`inlined`,disabled:t.disabled,collapsed:t.collapsed,collapsible:t.collapsible,labelNode:t.labelNode},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`label`,`info`,`padding`,`disabled`,`collapsed`,`collapsible`,`labelNode`])],2)}var pu=V(J.register(`section`,{mixins:[Fi],defaultValue:({schema:e})=>e.nested?{}:void 0,ignoreMissingValue:({schema:e})=>!e.nested&&!(`default`in e),treatNullAsMissing:({schema:e})=>!!e.nested,defaultNested:!1,generateLabel:!1,computed:{item(){return this.nested?this.value:this.data},hasLabel(){return!!this.schema.label},collapsible:F(`collapsible`,{type:Boolean,default:!1}),collapsed:F(`collapsed`,{type:Boolean,default:!1,get(e){return e&&this.collapsible}})},methods:{getItemFormSchema:Vt,async navigateToComponent(e,t,n){let{mainSchemaComponent:i}=this,a=this.dataPath?`${this.dataPath}/`:``,o=(0,r.normalizeDataPath)(e),s=o.startsWith(a)?(0,r.parseDataPath)(o.slice(a.length))[0]:null;return!!i&&et(i.schema,s)&&i.navigateToComponent(e,t,n)}},async processSchema(e,t,n,r,i){await L(e,t,r,i)}}),[[`render`,fu]]),mu={class:`dito-select`},hu={class:`dito-select__inner`},gu=[`id`],_u=[`label`],vu=[`value`],yu=[`value`],bu=[`value`];function xu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoEditButtons`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,mu,[(0,e.createElementVNode)(`div`,hu,[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,absolute:``,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`]),(0,e.withDirectives)((0,e.createElementVNode)(`select`,(0,e.mergeProps)({id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.selectedValue=e},t.attributes,{onMousedown:n[1]||=e=>t.populate=!0,onFocus:n[2]||=e=>t.populate=!0}),[t.populate?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.options,n=>((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,[t.groupBy?((0,e.openBlock)(),(0,e.createElementBlock)(`optgroup`,{key:0,label:n[t.groupByLabel]},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(n[t.groupByOptions],n=>((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{value:t.getValueForOption(n)},(0,e.toDisplayString)(t.getLabelForOption(n)),9,vu))),256))],8,_u)):((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{key:1,value:t.getValueForOption(n)},(0,e.toDisplayString)(t.getLabelForOption(n)),9,yu))],64))),256)):t.selectedOption?((0,e.openBlock)(),(0,e.createElementBlock)(`option`,{key:1,value:t.selectedValue},(0,e.toDisplayString)(t.getLabelForOption(t.selectedOption)),9,bu)):(0,e.createCommentVNode)(``,!0)],16,gu),[[e.vModelSelect,t.selectedValue]]),(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,absolute:``,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),t.editable?((0,e.openBlock)(),(0,e.createBlock)(c,{key:0,schema:t.schema,dataPath:t.dataPath,data:t.data,meta:t.meta,store:t.store,disabled:!1,editable:t.editable,editPath:t.editPath},null,8,[`schema`,`dataPath`,`data`,`meta`,`store`,`editable`,`editPath`])):(0,e.createCommentVNode)(``,!0)])}var Su=V(J.register(`select`,{mixins:[Zs],components:{DitoAffixes:q},nativeField:!0,data(){return{populate:!0}}}),[[`render`,xu]]),Cu={class:`dito-slider`},wu=[`id`,`min`,`max`,`step`];function Tu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Cu,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,(0,e.mergeProps)({class:`dito-range`,id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:`range`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),null,16,wu),[[e.vModelText,t.inputValue]]),t.input?((0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({key:0,class:`dito-number`,modelValue:t.inputValue,"onUpdate:modelValue":n[1]||=e=>t.inputValue=e,type:`number`},t.attributes,{min:t.min,max:t.max,step:t.stepValue}),null,16,[`modelValue`,`min`,`max`,`step`])):(0,e.createCommentVNode)(``,!0)])}var Eu=V(J.register(`slider`,{mixins:[Yl],components:{DitoInput:H},nativeField:!0,computed:{input:F(`input`,{type:Boolean,default:!0})}}),[[`render`,Tu]]);function Du(e,t,n,r,i,a){return null}var Ou=V(J.register(`spacer`,{defaultValue:()=>void 0,excludeValue:!0,generateLabel:!1}),[[`render`,Du]]);function ku(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoSwitch`);return(0,e.openBlock)(),(0,e.createBlock)(s,(0,e.mergeProps)({class:`dito-switch`,id:t.componentPath,ref:`element`,modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,labels:t.labels},t.attributes),null,16,[`id`,`modelValue`,`labels`])}var Au=V(J.register(`switch`,{defaultValue:!1,defaultWidth:`auto`,components:{DitoSwitch:Oi},computed:{labels(){return this.schema.labels}}}),[[`render`,ku]]),ju={computed:{trim:F(`trim`,{type:Boolean,default:!1})},processValue(e){let{schema:t,value:n}=e;return t.trim&&n!=null&&(0,r.isString)(n)&&(n=n.trim()),n===``&&(n=qt(t,e)),n}};function Mu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoAffixes`),c=(0,e.resolveComponent)(`DitoInput`);return(0,e.openBlock)(),(0,e.createBlock)(c,(0,e.mergeProps)({class:`dito-text`,id:t.componentPath,ref:`element`,modelValue:t.inputValue,"onUpdate:modelValue":n[0]||=e=>t.inputValue=e,type:t.inputType},t.attributes),{prefix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.prefix,position:`prefix`,mode:`input`,disabled:t.disabled,parentContext:t.context},null,8,[`items`,`disabled`,`parentContext`])]),suffix:(0,e.withCtx)(()=>[(0,e.createVNode)(s,{items:t.schema.suffix,position:`suffix`,mode:`input`,clearable:t.showClearButton,disabled:t.disabled,inlineInfo:t.inlineInfo,parentContext:t.context,onClear:t.clear},null,8,[`items`,`clearable`,`disabled`,`inlineInfo`,`parentContext`,`onClear`])]),_:1},16,[`id`,`modelValue`,`type`])}var Nu=`****************`,Pu=V(J.register([`text`,`email`,`url`,`hostname`,`domain`,`tel`,`password`,`creditcard`],{mixins:[ju],components:{DitoInput:H,DitoAffixes:q},nativeField:!0,textField:!0,ignoreMissingValue:({schema:e})=>e.type===`password`,getTypeValidations(e){let t={email:`email`,url:`url`,hostname:`hostname`,domain:`domain`,password:`password`,creditcard:`creditcard`}[e.type];return t?{[t]:!0}:{}},computed:{inputType(){return{creditcard:`text`,hostname:`text`,domain:`text`}[this.type]||this.type},inputValue:{get(){return this.type===`password`&&this.value===void 0&&!this.focused?Nu:this.value},set(e){this.value=e}}}}),[[`render`,Mu]]),Fu=[`id`,`rows`];function Iu(t,n,r,i,a,o){return(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`textarea`,(0,e.mergeProps)({class:`dito-textarea dito-input`,id:t.componentPath,ref:`element`,"onUpdate:modelValue":n[0]||=e=>t.value=e},t.attributes,{rows:t.lines,class:{"dito-textarea--resizable":t.resizable}}),null,16,Fu)),[[e.vModelText,t.value]])}var Lu=V(J.register(`textarea`,{mixins:[ju],nativeField:!0,textField:!0,computed:{lines(){return this.schema.lines||4},resizable:F(`resizable`,{type:Boolean,default:!1})}}),[[`render`,Iu]]),Ru={class:`dito-tree-list`},zu={class:`dito-tree-panel`},Bu={key:0,class:`dito-tree-form-container`};function Vu(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`DitoScopes`),c=(0,e.resolveComponent)(`DitoTreeItem`),l=(0,e.resolveComponent)(`DitoRouterView`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ru,[t.scopes?((0,e.openBlock)(),(0,e.createBlock)(s,{key:0,query:t.query,scopes:t.scopes},null,8,[`query`,`scopes`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,zu,[(0,e.createVNode)(c,{schema:t.treeSchema,dataPath:t.treeDataPath,data:t.treeData,draggable:t.draggable,open:!0,"onUpdate:data":n[0]||=e=>t.value=e},null,8,[`schema`,`dataPath`,`data`,`draggable`]),t.editPath&&t.hasEditableForms?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Bu,[(0,e.createVNode)(l,{routeLevel:t.routeComponent.routeLevel+1},null,8,[`routeLevel`])])):(0,e.createCommentVNode)(``,!0)])])}var Hu=V(J.register([`tree-list`,`tree-object`],{mixins:[Y],provide(){return{container:this}},getSourceType(e){return e===`tree-object`?`object`:`list`},computed:{path(){return this.formComponent?.path},editPath(){let e=this.$route.path.slice(this.path?.length);return e.startsWith(`/${this.schema.path}`)?e:``},treeData(){return this.isListSource?{[this.name]:this.value}:this.value},treeDataPath(){return this.isListSource?ke(this.dataPath):this.dataPath},treeSchema(){return this.isListSource?{children:{name:this.name,...this.schema}}:this.schema},hasEditableForms(){let e=t=>D(t)&&(this.getSchemaValue(`editable`,{type:Boolean,default:!1,schema:t})||t.children&&e(t.children));return e(this.schema)}},async processSchema(e,t,n,r,i,a=!0,o=!1,s=null){await Promise.all([Rn(t.properties),Y.processSchema(e,t,n,r,i,a,o,(n,r)=>{let{children:i}=t;if(i)return i.type=`tree-list`,this.processSchema(e,i,i.name,n,r,a,!0,s)})])},getFormSchemasForProcessing(e,t){let{children:n}=e;return O(e,t,n?e=>({...e,components:{...e.components,[n.name]:n}}):null)}}),[[`render`,Vu]]),Uu=[``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Wu(e,{base:t=10}={}){let n=Ku(t),r=Math.abs(e),i=Math.min(r>=1?Math.floor(Math.log(r)/Math.log(n)):0,Uu.length-1),a=qu(r,n,i);a>=n&&i<Uu.length-1&&(a=qu(r,n,++i));let o=Uu[i],s=o?t===10?`${o}B`:`${o.toUpperCase()}iB`:`B`;return`${e<0?`-`:``}${a} ${s}`}function Gu(e,{base:t=10}={}){let[,n,r]=String(e).match(/^([\d.,]*)\s*(\D*)$/)||[],i=parseFloat(n?.replace(`,`,`.`));if(!isFinite(i))throw Error(`Can't interpret file size: ${e}`);let a=Ku(/^[kmgtpezy]ib?$/i.test(r)?2:t),o=r.replace(/^bits?$/,`b`).match(/^([KMGTPEZY]?)b$/);if(o){let e=Uu.indexOf(o[1].replace(`K`,`k`));return Math.round(i*a**e/8)}let s=Uu.findIndex(e=>e.toLowerCase()===r.toLowerCase().replace(/^(bytes?|b)$/,``).replace(/^(\w)(i?b|i)$/,`$1`));if(s>=0)return Math.round(i*a**s);throw Error(`Invalid file size unit: ${r}`)}function Ku(e){return e===10?1e3:1024}function qu(e,t,n){let r=n>0?100:1;return Math.round(e/t**n*r)/r}var Ju={class:`dito-upload`},Yu={class:`dito-table dito-table--separators dito-table--background`},Xu=[`innerHTML`],Zu={key:1},Qu=[`download`,`href`,`onClick`],$u={key:2},ed={class:`dito-upload__size`},td={class:`dito-upload__status`},nd={class:`dito-table__buttons`},rd={class:`dito-buttons dito-buttons--round`},id=[`title`],ad=[`onClick`],od={key:0},sd={colspan:4},cd={class:`dito-upload-footer`},ld=[`value`],ud={class:`dito-buttons dito-buttons--round`},dd=[`title`];function fd(t,n,r,i,a,o){let s=(0,e.resolveComponent)(`VueUpload`),c=(0,e.resolveComponent)(`DitoUploadFile`),l=(0,e.resolveComponent)(`DitoDraggable`);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ju,[(0,e.createVNode)(s,{class:`dito-upload__input`,ref:`upload`,modelValue:t.uploads,"onUpdate:modelValue":n[0]||=e=>t.uploads=e,inputId:t.dataPath,name:t.dataPath,disabled:t.disabled,postAction:t.uploadPath,extensions:t.extensions,accept:t.accept,multiple:t.multiple,size:t.maxSize,drop:t.$el?.closest(`.dito-container`),dropDirectory:!0,onInputFilter:t.onInputFilter,onInputFile:t.onInputFile},null,8,[`modelValue`,`inputId`,`name`,`disabled`,`postAction`,`extensions`,`accept`,`multiple`,`size`,`drop`,`onInputFilter`,`onInputFile`]),(0,e.createElementVNode)(`table`,Yu,[n[5]||=(0,e.createElementVNode)(`thead`,{class:`dito-table-head`},[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`File`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`Size`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`,null,`Status`)]),(0,e.createElementVNode)(`th`,{scope:`col`},[(0,e.createElementVNode)(`span`)])])],-1),(0,e.createVNode)(l,{modelValue:t.files,"onUpdate:modelValue":n[2]||=e=>t.files=e,as:`tbody`,options:t.getDraggableOptions(),draggable:t.draggable},{default:(0,e.withCtx)(()=>[t.multiple||!t.isUploadActive?((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,{key:0},(0,e.renderList)(t.files,(r,i)=>((0,e.openBlock)(),(0,e.createElementBlock)(`tr`,{key:r.name},[t.render?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,{key:0,innerHTML:t.renderFile(r,i)},null,8,Xu)):t.downloadUrls[i]?((0,e.openBlock)(),(0,e.createElementBlock)(`td`,Zu,[(0,e.createElementVNode)(`a`,{download:r.name,href:t.downloadUrls[i],target:`_blank`,onClick:(0,e.withModifiers)(e=>t.onClickDownload(r,i),[`prevent`])},[(0,e.createVNode)(c,{file:r,thumbnail:t.thumbnails,thumbnailUrl:t.thumbnailUrls[i]},null,8,[`file`,`thumbnail`,`thumbnailUrl`])],8,Qu)])):((0,e.openBlock)(),(0,e.createElementBlock)(`td`,$u,[(0,e.createVNode)(c,{file:r,thumbnail:t.thumbnails,thumbnailUrl:t.thumbnailUrls[i]},null,8,[`file`,`thumbnail`,`thumbnailUrl`])])),(0,e.createElementVNode)(`td`,ed,(0,e.toDisplayString)(t.formatFileSize(r.size)),1),(0,e.createElementVNode)(`td`,td,[r.upload?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[r.upload.error?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)(`Error: `+(0,e.toDisplayString)(r.upload.error),1)],64)):r.upload.active?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createTextVNode)(`Uploading...`)],64)):r.upload.success?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createTextVNode)(`Uploaded`)],64)):(0,e.createCommentVNode)(``,!0)],64)):((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createTextVNode)(`Stored`)],64))]),(0,e.createElementVNode)(`td`,nd,[(0,e.createElementVNode)(`div`,rd,[t.multiple?(0,e.createCommentVNode)(``,!0):((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-button dito-button--upload`,title:t.uploadTitle,onClick:n[1]||=(...e)=>t.onClickUpload&&t.onClickUpload(...e)},null,8,id)),t.draggable?((0,e.openBlock)(),(0,e.createElementBlock)(`a`,(0,e.mergeProps)({key:1,class:`dito-button`},{ref_for:!0},t.getButtonAttributes(t.verbs.drag)),null,16)):(0,e.createCommentVNode)(``,!0),t.deletable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,(0,e.mergeProps)({key:2,class:`dito-button`,type:`button`},{ref_for:!0},t.getButtonAttributes(t.verbs.delete),{onClick:e=>t.deleteFile(r,i)}),null,16,ad)):(0,e.createCommentVNode)(``,!0)])])]))),128)):(0,e.createCommentVNode)(``,!0)]),_:1},8,[`modelValue`,`options`,`draggable`]),t.multiple||t.isUploadActive||!t.hasFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`tfoot`,od,[(0,e.createElementVNode)(`tr`,null,[(0,e.createElementVNode)(`td`,sd,[(0,e.createElementVNode)(`div`,cd,[t.isUploadActive?((0,e.openBlock)(),(0,e.createElementBlock)(`progress`,{key:0,class:`dito-progress`,value:t.uploadProgress,max:`100`},null,8,ld)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,ud,[t.isUploadActive?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`dito-button`,type:`button`,onClick:n[3]||=(0,e.withModifiers)(e=>t.upload.active=!1,[`prevent`])},`Cancel`)):(0,e.createCommentVNode)(``,!0),t.multiple||!t.hasFiles?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,class:`dito-button dito-button--upload`,title:t.uploadTitle,onClick:n[4]||=(...e)=>t.onClickUpload&&t.onClickUpload(...e)},null,8,dd)):(0,e.createCommentVNode)(``,!0)])])])])])):(0,e.createCommentVNode)(``,!0)])])}var pd=J.register(`upload`,{mixins:[is],components:{VueUpload:ge.default},data(){return{uploads:[]}},computed:{upload(){return this.$refs.upload},uploadTitle(){return this.multiple?`Upload Files`:`Upload File`},files(){return md(this.value)},downloadUrls(){return this.files.map((e,t)=>this.getDownloadUrl(e,t))},thumbnailUrls(){return this.files.map((e,t)=>this.getThumbnailUrl(e,t))},multiple:F(`multiple`,{type:Boolean,default:!1,callback:!1}),extensions:F(`extensions`,{type:[Array,String,RegExp]}),accept:F(`accept`,{type:Array,get(e){return(0,r.isArray)(e)?e.join(`,`):e}}),maxSize:F(`maxSize`,{type:[String,Number],get(e){return e?Gu(e):void 0}}),draggable:F(`draggable`,{type:Boolean,default:!1,get(e){return e&&this.files.length>1}}),deletable:F(`deletable`,{type:Boolean,default:!1}),render:F(`render`,{type:Function,default:null}),thumbnails:F(`thumbnails`,{type:[Boolean,String],default(e){return e??!!this.schema.thumbnailUrl},get(e){return e===!0?`medium`:e||null}}),hasFiles(){return this.files.length>0},hasUploads(){return this.uploads.length>0},isUploadReady(){return this.hasUploads&&!(this.upload.active||this.upload.uploaded)},isUploadActive(){return this.hasUploads&&this.upload.active},uploadProgress(){return this.uploads.reduce((e,t)=>e+ +t.progress,0)/this.uploads.length},uploadPath(){return this.getResourceUrl({type:`upload`,method:`post`,path:this.api.normalizePath(this.dataPath)})}},watch:{isUploadReady(e){e&&this.$nextTick(()=>{this.upload.active=!0})}},methods:{formatFileSize:Wu,getFileContext(e,t){return this.multiple?new E(this,{value:e,data:this.files,index:t,dataPath:b(this.dataPath,t)}):this.context},renderFile(e,t){return this.render(this.getFileContext(e,t))},getDownloadUrl(e,t){return e.url?e.url:!e.upload||e.upload.success?this.getSchemaValue(`downloadUrl`,{type:`String`,default:null,context:this.getFileContext(e,t)}):null},getThumbnailUrl(e,t){return!e.upload||e.upload.success?this.getSchemaValue(`thumbnailUrl`,{type:`String`,default:null,context:this.getFileContext(e,t)})||(e.type.startsWith(`image/`)?e.url:null):null},deleteFile(e,t){let{name:n}=e;e&&window.confirm(`Do you really want to ${this.verbs.remove} ${n}?`)&&(this.multiple?this.value.splice(t,1):this.value=null,e.upload&&this.upload.remove(e.upload),this.onChange(),this.notify({type:`info`,title:`Successfully Removed`,text:`${n} was ${this.verbs.deleted}.`}))},getFileIndex(e){return this.multiple&&this.value?this.value.findIndex(t=>t.id===e.id):-1},addFile(e){this.multiple?this.value?this.value.push(e):this.value=[e]:this.value=e},replaceFile(e,t){if(this.multiple){let n=this.getFileIndex(e);n>=0&&(t?this.value[n]=t:this.value.splice(n,1))}else this.value=t},removeFile(e){this.replaceFile(e,null)},onInputFile(e,t){if(e&&!t){let{id:t,name:n,size:r}=e;this.addFile({id:t,name:n,size:r,upload:e})}if(e&&t){let{success:t,error:n}=e;if(t){this.onChange();let t=e.response[0];t?(t.upload=e,this.replaceFile(e,t)):this.removeFile(e)}else if(n){this.removeFile(e);let t={abort:`Upload aborted`,denied:`Upload denied`,extension:`Unsupported file-type: ${e.name}`,network:`Network error encountered during upload`,server:`Server error occurred during upload`,size:`File is too large: ${Wu(e.size)}`,timeout:`Timeout occurred during upload`}[n]||`Unknown File Upload Error: '${n}'`;this.notify({type:`error`,error:n,title:`File Upload Error`,text:t})}}},onInputFilter(e){let t=e?.xhr;this.api.cors?.credentials&&t&&!t.withCredentials&&(t.withCredentials=!0)},async onClickDownload(e,t){try{let n=await(await fetch(this.downloadUrls[t])).blob();this.download({filename:e.name,url:URL.createObjectURL(n)})}catch(e){console.error(e)}},onClickUpload(e){this.upload.$el.querySelector(`input`).dispatchEvent(new e.constructor(e.type,e))}},processValue({schema:e,value:t}){let n=md(t).map(({upload:e,...t})=>!e||e.success?t:null).filter(e=>e);return e.multiple?n:n[0]||null}});function md(e){return e?(0,r.asArray)(e):[]}var hd=V(pd,[[`render`,fd]]),gd=Ce({DitoDitoTypeComponent:()=>mc,DitoTypeButton:()=>Ks,DitoTypeCheckbox:()=>Xs,DitoTypeCheckboxes:()=>nc,DitoTypeCode:()=>oc,DitoTypeColor:()=>fc,DitoTypeComputed:()=>_c,DitoTypeDate:()=>bc,DitoTypeLabel:()=>qc,DitoTypeList:()=>Gc,DitoTypeMarkup:()=>Wl,DitoTypeMultiselect:()=>Jl,DitoTypeNumber:()=>Zl,DitoTypeObject:()=>ru,DitoTypePanel:()=>iu,DitoTypeProgress:()=>su,DitoTypeRadio:()=>du,DitoTypeSection:()=>pu,DitoTypeSelect:()=>Su,DitoTypeSlider:()=>Eu,DitoTypeSpacer:()=>Ou,DitoTypeSwitch:()=>Au,DitoTypeText:()=>Pu,DitoTypeTextarea:()=>Lu,DitoTypeTreeList:()=>Hu,DitoTypeUpload:()=>hd}),_d={mounted(e,t){vd(e,t.value,t.arg)},unmounted(e,t){yd(e,t.value,t.arg)}};function vd(e,t,n){Sd.getObserver(n).observe(e,t)}function yd(e,t,n){Sd.getObserver(n).unobserve(e,t)}var bd=typeof ResizeObserver<`u`,xd={},Sd=class e{constructor(e,t){this.key=e,this.options=t,this.observer=bd?new ResizeObserver(e=>this.handle(e)):null,this.handlersByNode=new WeakMap,this.nodeCount=0}observe(e,t){let n=this.handlersByNode.get(e);n||(n=new Set,this.handlersByNode.set(e,n),this.observer?.observe(e,this.options),this.nodeCount++),n.add(t)}unobserve(e,t){let n=this.handlersByNode.get(e);n?.delete(t)&&n.size===0&&(this.handlersByNode.delete(e),this.observer?.unobserve(e),--this.nodeCount===0&&delete xd[this.key])}handle(e){for(let t of e){let e=this.handlersByNode.get(t.target);if(e){let n={target:t.target,contentRect:t.contentRect,borderBoxSize:(0,r.asArray)(t.borderBoxSize),contentBoxSize:(0,r.asArray)(t.contentBoxSize),devicePixelContentBoxSize:(0,r.asArray)(t.devicePixelContentBoxSize)};for(let t of e)t(n)}}}static getObserver({box:t=`content-box`}={}){let n={box:t},r=JSON.stringify(n);return xd[r]||=new e(r,n),xd[r]}},Cd=class extends Error{constructor(e){super(`Request failed with status code: ${e.status} (${e.statusText})`),this.response=e}};async function wd(e,{url:t,method:n=`get`,query:r=null,headers:i=null,data:a=null,signal:o=null,timeout:s=e.timeout??null}){let c=e.isApiUrl(t),l=[o,s&&AbortSignal.timeout(s)];o=AbortSignal.any(l.filter(Boolean));let u=await fetch(e.getApiUrl({url:t,query:r}),{method:n.toUpperCase(),...a&&{body:JSON.stringify(a)},headers:{...c&&e.headers,...i},credentials:c&&e.cors?.credentials?`include`:`same-origin`,signal:o});if(u.headers.get(`Content-Type`)?.includes(`application/json`)&&(u.data=await u.json()),!u.ok)throw new Cd(u);return u}function Td(e,t){return!(0,r.isAbsoluteUrl)(t)||t.startsWith(e.url)}function Ed(e,{url:t,query:n}){!t.startsWith(e.url)&&!(0,r.isAbsoluteUrl)(t)&&(t=Dd(e.url,t));let i=xc(n);return i?`${t}${t.includes(`?`)?`&`:`?`}${i}`:t}function Dd(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}var Od=[`create`,`created`,`save`,`saved`,`apply`,`applied`,`submit`,`submitted`,`delete`,`deleted`,`remove`,`removed`,`clear`,`cleared`,`edit`,`edited`,`close`,`closed`,`cancel`,`cancelled`,`drag`,`dragged`,`login`,`logged in`].reduce((e,t)=>(e[t]=t,e),{});return class{constructor(i,{dito:a={},api:o,views:s={},...c}={}){this.el=i,this.api=o=(0,r.assignDeeply)({base:`/`},a.api,o),this.options=c,o.locale||=`en-US`,o.formats=(0,r.assignDeeply)({},r.defaultFormats,o.formats),o.request||=e=>wd(o,e),o.getApiUrl||=e=>Ed(o,e),o.isApiUrl||=e=>Td(o,e),o.normalizePath||=o.normalizePaths?r.hyphenate:e=>e,o.denormalizePath||=o.normalizePaths?r.camelize:e=>e,o.defaults||={};let l=z(o.users,{type:`collection`})||{};l.login=z(l.login||`login`,{method:`post`,parent:l}),l.logout=z(l.logout||`logout`,{method:`post`,parent:l}),l.session=z(l.session||`session`,{method:`get`,parent:l}),o.users=l,o.resources={any(e){let t=this[e?.type]||this.default;return e&&t.call(this,e)},default(e){let t=this.any(e.parent);return t?`${t}/${e.path}`:e.path},collection(e){return this.default(e)},member(e){return`${this.default(e)}/${e.id}`},upload(e){return`${this.collection(e.parent)}/upload/${e.path}`},...o.resources},o.headers={"Content-Type":`application/json`,...o.headers},(0,r.isString)(i)&&(i=document.querySelector(i));let u=this.app=(0,e.createApp)({components:{DitoRoot:oa,VueNotifications:n.default,...Hs,...gd},provide:{api:o,$verbs:()=>Od,$views:()=>{},$isPopulated:()=>!0,$parentComponent:()=>null,$schemaComponent:()=>null,$schemaParentComponent:()=>null,$routeComponent:()=>null,$dataComponent:()=>null,$sourceComponent:()=>null,$resourceComponent:()=>null,$dialogComponent:()=>null,$panelComponent:()=>null,$tabComponent:()=>null},render:()=>(0,e.h)(oa,{ref:`root`,class:a.settings.rootClass,unresolvedViews:s,options:c})});u.config.errorHandler=console.error,u.use(n.default,{componentName:`VueNotifications`,name:`notify`}),u.directive(`resize`,_d),u.use((0,t.createRouter)({routes:[{name:`catch-all`,path:`/:_(.*)`,components:{}}],history:(0,t.createWebHistory)(a.base),linkActiveClass:``,linkExactActiveClass:``})),i.classList.add(`dito-app`),u.mount(i)}register(e,t){return J.register(e,t)}}});