@odoo/owl 1.4.8 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -66
- package/dist/owl.cjs.js +4629 -5046
- package/dist/owl.cjs.min.js +1 -15
- package/dist/owl.es.js +4601 -5036
- package/dist/owl.es.min.js +1 -15
- package/dist/owl.iife.js +4629 -5046
- package/dist/owl.iife.min.js +1 -15
- package/dist/types/app/app.d.ts +29 -0
- package/dist/types/app/template_helpers.d.ts +49 -0
- package/dist/types/app/template_set.d.ts +34 -0
- package/dist/types/blockdom/attributes.d.ts +8 -0
- package/dist/types/blockdom/block_compiler.d.ts +21 -0
- package/dist/types/blockdom/config.d.ts +8 -0
- package/dist/types/blockdom/events.d.ts +7 -0
- package/dist/types/blockdom/html.d.ts +16 -0
- package/dist/types/blockdom/index.d.ts +24 -0
- package/dist/types/blockdom/list.d.ts +17 -0
- package/dist/types/blockdom/multi.d.ts +16 -0
- package/dist/types/blockdom/text.d.ts +25 -0
- package/dist/types/blockdom/toggler.d.ts +16 -0
- package/dist/types/compiler/code_generator.d.ts +144 -0
- package/dist/types/compiler/index.d.ts +9 -0
- package/dist/types/{qweb/expression_parser.d.ts → compiler/inline_expressions.d.ts} +5 -6
- package/dist/types/compiler/parser.d.ts +157 -0
- package/dist/types/component/component.d.ts +15 -294
- package/dist/types/component/component_node.d.ts +54 -0
- package/dist/types/component/error_handling.d.ts +13 -0
- package/dist/types/component/fibers.d.ts +32 -0
- package/dist/types/component/handler.d.ts +1 -0
- package/dist/types/component/lifecycle_hooks.d.ts +12 -0
- package/dist/types/component/props_validation.d.ts +14 -1
- package/dist/types/component/scheduler.d.ts +5 -21
- package/dist/types/component/status.d.ts +9 -0
- package/dist/types/hooks.d.ts +26 -35
- package/dist/types/index.d.ts +27 -47
- package/dist/types/memo.d.ts +6 -0
- package/dist/types/portal.d.ts +11 -0
- package/dist/types/reactivity.d.ts +64 -0
- package/dist/types/utils.d.ts +14 -21
- package/package.json +14 -9
- package/dist/types/browser.d.ts +0 -12
- package/dist/types/component/directive.d.ts +0 -1
- package/dist/types/component/fiber.d.ts +0 -75
- package/dist/types/component/styles.d.ts +0 -12
- package/dist/types/config.d.ts +0 -12
- package/dist/types/context.d.ts +0 -36
- package/dist/types/core/event_bus.d.ts +0 -42
- package/dist/types/core/observer.d.ts +0 -30
- package/dist/types/core/owl_event.d.ts +0 -10
- package/dist/types/misc/async_root.d.ts +0 -13
- package/dist/types/misc/portal.d.ts +0 -70
- package/dist/types/qweb/base_directives.d.ts +0 -1
- package/dist/types/qweb/compilation_context.d.ts +0 -69
- package/dist/types/qweb/extensions.d.ts +0 -28
- package/dist/types/qweb/index.d.ts +0 -3
- package/dist/types/qweb/qweb.d.ts +0 -141
- package/dist/types/router/link.d.ts +0 -11
- package/dist/types/router/route_component.d.ts +0 -6
- package/dist/types/router/router.d.ts +0 -57
- package/dist/types/store.d.ts +0 -63
- package/dist/types/tags.d.ts +0 -29
- package/dist/types/vdom/html_to_vdom.d.ts +0 -2
- package/dist/types/vdom/index.d.ts +0 -2
- package/dist/types/vdom/modules.d.ts +0 -5
- package/dist/types/vdom/vdom.d.ts +0 -101
package/dist/owl.es.min.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
class e{constructor(){this.subscriptions={}}on(e,t,n){if(!n)throw new Error("Missing callback");this.subscriptions[e]||(this.subscriptions[e]=[]),this.subscriptions[e].push({owner:t,callback:n})}off(e,t){const n=this.subscriptions[e];n&&(this.subscriptions[e]=n.filter((e=>e.owner!==t)))}trigger(e,...t){const n=this.subscriptions[e]||[];for(let e=0,o=n.length;e<o;e++){const o=n[e];o.callback.call(o.owner,...t)}}clear(){this.subscriptions={}}}class t{constructor(){this.rev=1,this.allowMutations=!0,this.weakMap=new WeakMap}notifyCB(){}observe(e,t){if(null===e||"object"!=typeof e||e instanceof Date||e instanceof Promise)return e;return(this.weakMap.get(e)||this._observe(e,t)).proxy}revNumber(e){const t=this.weakMap.get(e);return t?t.rev:0}_observe(e,t){var n=this;const o=new Proxy(e,{get(t,o){const r=t[o];return n.observe(r,e)},set(e,t,o){if(o!==e[t]){if(!n.allowMutations)throw new Error(`Observed state cannot be changed here! (key: "${t}", val: "${o}")`);n._updateRevNumber(e),e[t]=o,n.notifyCB()}return!0},deleteProperty:(e,t)=>(t in e&&(delete e[t],n._updateRevNumber(e),n.notifyCB()),!0)}),r={value:e,proxy:o,rev:this.rev,parent:t};return this.weakMap.set(e,r),this.weakMap.set(r.proxy,r),r}_updateRevNumber(e){this.rev++;let t=this.weakMap.get(e),n=e;do{t=this.weakMap.get(n),t.rev++}while((n=t.parent)&&n!==e)}}const n="true,false,NaN,null,undefined,debugger,console,window,in,instanceof,new,function,return,this,eval,void,Math,RegExp,Array,Object,Date".split(","),o=Object.assign(Object.create(null),{and:"&&",or:"||",gt:">",gte:">=",lt:"<",lte:"<="}),r=Object.assign(Object.create(null),{"{":"LEFT_BRACE","}":"RIGHT_BRACE","[":"LEFT_BRACKET","]":"RIGHT_BRACKET",":":"COLON",",":"COMMA","(":"LEFT_PAREN",")":"RIGHT_PAREN"}),s="...,.,===,==,+,!==,!=,!,||,&&,>=,>,<=,<,?,-,*,/,%,typeof ,=>,=,;,in ".split(",");const i=[function(e){let t=e[0],n=t;if("'"!==t&&'"'!==t&&"`"!==t)return!1;let o,r=1;for(;e[r]&&e[r]!==n;){if(o=e[r],t+=o,"\\"===o){if(r++,o=e[r],!o)throw new Error("Invalid expression");t+=o}r++}if(e[r]!==n)throw new Error("Invalid expression");return t+=n,"`"===n?{type:"TEMPLATE_STRING",value:t,replace:e=>t.replace(/\$\{(.*?)\}/g,((t,n)=>"${"+e(n)+"}"))}:{type:"VALUE",value:t}},function(e){let t=e[0];if(t&&t.match(/[0-9]/)){let n=1;for(;e[n]&&e[n].match(/[0-9]|\./);)t+=e[n],n++;return{type:"VALUE",value:t}}return!1},function(e){for(let t of s)if(e.startsWith(t))return{type:"OPERATOR",value:t};return!1},function(e){let t=e[0];if(t&&t.match(/[a-zA-Z_\$]/)){let n=1;for(;e[n]&&e[n].match(/\w/);)t+=e[n],n++;return t in o?{type:"OPERATOR",value:o[t],size:t.length}:{type:"SYMBOL",value:t}}return!1},function(e){const t=e[0];return!(!t||!(t in r))&&{type:r[t],value:t}}];const a=e=>e&&("LEFT_BRACE"===e.type||"COMMA"===e.type),l=e=>e&&("RIGHT_BRACE"===e.type||"COMMA"===e.type);function c(e,t){t=Object.create(t);const o=function(e){const t=[];let n=!0;for(;n;)if(e=e.trim()){for(let o of i)if(n=o(e),n){t.push(n),e=e.slice(n.size||n.value.length);break}}else n=!1;if(e.length)throw new Error(`Tokenizer error: could not tokenize "${e}"`);return t}(e);let r=0,s=[];for(;r<o.length;){let e=o[r],i=o[r-1],c=o[r+1],u=s[s.length-1];switch(e.type){case"LEFT_BRACE":case"LEFT_BRACKET":s.push(e.type);break;case"RIGHT_BRACE":case"RIGHT_BRACKET":s.pop()}let h="SYMBOL"===e.type&&!n.includes(e.value);if("SYMBOL"!==e.type||n.includes(e.value)||i&&("LEFT_BRACE"===u&&a(i)&&l(c)&&(o.splice(r+1,0,{type:"COLON",value:":"},Object.assign({},e)),c=o[r+1]),"OPERATOR"===i.type&&"."===i.value?h=!1:"LEFT_BRACE"!==i.type&&"COMMA"!==i.type||c&&"COLON"===c.type&&(h=!1)),"TEMPLATE_STRING"===e.type&&(e.value=e.replace((e=>d(e,t)))),c&&"OPERATOR"===c.type&&"=>"===c.value)if("RIGHT_PAREN"===e.type){let e=r-1;for(;e>0&&"LEFT_PAREN"!==o[e].type;)"SYMBOL"===o[e].type&&o[e].originalValue&&(o[e].value=o[e].originalValue,t[o[e].value]={id:o[e].value,expr:o[e].value}),e--}else t[e.value]={id:e.value,expr:e.value};h&&(e.varName=e.value,e.value in t&&"id"in t[e.value]?e.value=t[e.value].expr:(e.originalValue=e.value,e.value=`scope['${e.value}']`)),r++}return o}function d(e,t){return c(e,t).map((e=>e.value)).join("")}const u=/\{\{.*?\}\}/g;class h{constructor(e){this.code=[],this.variables={},this.escaping=!1,this.parentNode=null,this.parentTextNode=null,this.rootNode=null,this.indentLevel=0,this.shouldDefineParent=!1,this.shouldDefineScope=!1,this.protectedScopeNumber=0,this.shouldDefineQWeb=!1,this.shouldDefineUtils=!1,this.shouldDefineRefs=!1,this.shouldDefineResult=!0,this.loopNumber=0,this.inPreTag=!1,this.allowMultipleRoots=!1,this.hasParentWidget=!1,this.hasKey0=!1,this.keyStack=[],this.rootContext=this,this.templateName=e||"noname",this.addLine("let h = this.h;")}generateID(){return h.nextID++}generateTemplateKey(e=""){const t=this.generateID();if(0===this.loopNumber&&!this.hasKey0)return`'${e}__${t}__'`;let n=`\`${e}__${t}__`;for(let e=this.hasKey0?0:1;e<this.loopNumber+1;e++)n+=`\${key${e}}__`;return this.addLine(`let k${t} = ${n}\`;`),"k"+t}generateCode(){return this.shouldDefineResult&&this.code.unshift(" let result;"),this.shouldDefineScope&&this.code.unshift(" let scope = Object.create(context);"),this.shouldDefineRefs&&this.code.unshift(" context.__owl__.refs = context.__owl__.refs || {};"),this.shouldDefineParent&&(this.hasParentWidget?this.code.unshift(" let parent = extra.parent;"):this.code.unshift(" let parent = context;")),this.shouldDefineQWeb&&this.code.unshift(" let QWeb = this.constructor;"),this.shouldDefineUtils&&this.code.unshift(" let utils = this.constructor.utils;"),this.code}withParent(e){if(!this.allowMultipleRoots&&this===this.rootContext&&(this.parentNode||this.parentTextNode))throw new Error("A template should not have more than one root node");return this.rootContext.rootNode||(this.rootContext.rootNode=e),!this.parentNode&&this.rootContext.shouldDefineResult&&this.addLine(`result = vn${e};`),this.subContext("parentNode",e)}subContext(e,t){const n=Object.create(this);return n[e]=t,n}indent(){this.rootContext.indentLevel++}dedent(){this.rootContext.indentLevel--}addLine(e){const t=new Array(this.indentLevel+2).join(" ");return this.code.push(t+e),this.code.length-1}addIf(e){this.addLine(`if (${e}) {`),this.indent()}addElse(){this.dedent(),this.addLine("} else {"),this.indent()}closeIf(){this.dedent(),this.addLine("}")}getValue(e){return e in this.variables?this.getValue(this.variables[e]):e}formatExpression(e){return this.rootContext.shouldDefineScope=!0,d(e,this.variables)}captureExpression(e){this.rootContext.shouldDefineScope=!0;const t=this.generateID(),n=c(e,this.variables),o=new Set;return n.map((e=>(e.varName&&(o.has(e.varName)||(o.add(e.varName),this.addLine(`const ${e.varName}_${t} = ${e.value};`)),e.value=`${e.varName}_${t}`),e.value))).join("")}interpolate(e){let t=e.match(u);return t&&t[0].length===e.length?`(${this.formatExpression(e.slice(2,-2))})`:"`"+e.replace(/\{\{.*?\}\}/g,(e=>"${"+this.formatExpression(e.slice(2,-2))+"}"))+"`"}startProtectScope(e){const t=this.generateID();this.rootContext.protectedScopeNumber++,this.rootContext.shouldDefineScope=!0;return this.addLine(`let _origScope${t} = scope;`),this.addLine("scope = Object.create(scope);"),e||this.addLine("scope.__access_mode__ = 'ro';"),t}stopProtectScope(e){this.rootContext.protectedScopeNumber--,this.addLine(`scope = _origScope${e};`)}}function p(e,t){var n,o,r=t.elm,s=e.data.props,i=t.data.props;if((s||i)&&s!==i){for(n in i=i||{},s=s||{})i[n]||delete r[n];for(n in i)o=i[n],s[n]===o||"value"===n&&r[n]===o||(r[n]=o)}}h.nextID=1;const f={create:p,update:p};function m(e,t,n){if("function"==typeof e)e.call(t,n,t);else if("object"==typeof e)if("function"==typeof e[0])if(2===e.length)e[0].call(t,e[1],n,t);else{var o=e.slice(1);o.push(n),o.push(t),e[0].apply(t,o)}else for(let o=0,r=e.length;o<r;o++)m(e[o],t,n)}function _(){return function e(t){!function(e,t){var n=e.type,o=t.data.on;o&&(o[n]?m(o[n],t,e):o["!"+n]&&m(o["!"+n],t,e))}(t,e.vnode)}}function v(e,t){var n,o=e.data.on,r=e.listener,s=e.elm,i=t&&t.data.on,a=t&&t.elm;if(o!==i){if(o&&r)if(i){for(n in o)if(!i[n]){const e="!"===n.charAt(0);n=e?n.slice(1):n,s.removeEventListener(n,r,e)}}else for(n in o){const e="!"===n.charAt(0);n=e?n.slice(1):n,s.removeEventListener(n,r,e)}if(i){var l=t.listener=e.listener||_();if(l.vnode=t,o){for(n in i)if(!o[n]){const e="!"===n.charAt(0);n=e?n.slice(1):n,a.addEventListener(n,l,e)}}else for(n in i){const e="!"===n.charAt(0);n=e?n.slice(1):n,a.addEventListener(n,l,e)}}}}const g={create:v,update:v,destroy:v};function w(e,t){var n,o=t.elm,r=e.data.attrs,s=t.data.attrs;if((r||s)&&r!==s){for(n in r=r||{},s=s||{}){const e=s[n];r[n]!==e&&(!0===e?o.setAttribute(n,""):!1===e?o.removeAttribute(n):120!==n.charCodeAt(0)?o.setAttribute(n,e):58===n.charCodeAt(3)?o.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,e):58===n.charCodeAt(5)?o.setAttributeNS("http://www.w3.org/1999/xlink",n,e):o.setAttribute(n,e))}for(n in r)n in s||o.removeAttribute(n)}}const b={create:w,update:w};function $(e,t){var n,o,r,s=e.data.class,i=t.data.class;if((s||i)&&s!==i){for(o in s=s||{},i=i||{},r=t.elm,s)!o||i[o]||Object.prototype.hasOwnProperty.call(i,o)||r.classList.remove(o);for(o in i)(n=i[o])!==s[o]&&r.classList[n?"add":"remove"](o)}}const y={create:$,update:$};function x(e,t,n,o,r){return{sel:e,data:t,children:n,text:o,elm:r,key:void 0===t?void 0:t.key}}function E(e){return void 0===e}function N(e){return void 0!==e}const C=x("",{},[],void 0,void 0);function L(e,t){return e.key===t.key&&e.sel===t.sel}function T(e,t,n){let o,r,s,i={};for(o=t;o<=n;++o)s=e[o],null!=s&&(r=s.key,void 0!==r&&(i[r]=o));return i}const A=["create","update","remove","destroy","pre","post"];const D=Array.isArray;function P(e){return"string"==typeof e||"number"==typeof e}const k={createElement:function(e){return document.createElement(e)},createElementNS:function(e,t){return document.createElementNS(e,t)},createTextNode:function(e){return document.createTextNode(e)},createComment:function(e){return document.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){e.textContent=t}};function I(e,t,n){if("dummy"!==n&&(e.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==t))for(let e=0,n=t.length;e<n;++e){const n=t[e];let o=n.data;void 0!==o&&I(o,n.children,n.sel)}}function R(e,t,n){var o,r,s,i,a={};if(void 0!==n?(a=t,D(n)?o=n:P(n)?r=n:n&&n.sel&&(o=[n])):void 0!==t&&(D(t)?o=t:P(t)?r=t:t&&t.sel?o=[t]:a=t),void 0!==o)for(s=0,i=o.length;s<i;++s)P(o[s])&&(o[s]=x(void 0,void 0,void 0,o[s],void 0));return x(e,a,o,r,void 0)}const S=function(e,t){let n,o,r={};const s=void 0!==t?t:k;for(n=0;n<A.length;++n)for(r[A[n]]=[],o=0;o<e.length;++o){const t=e[o][A[n]];void 0!==t&&r[A[n]].push(t)}function i(e){const t=e.id?"#"+e.id:"",n=e.className?"."+e.className.split(" ").join("."):"";return x(s.tagName(e).toLowerCase()+t+n,{},[],void 0,e)}function a(e,t){return function(){if(0==--t){const t=s.parentNode(e);s.removeChild(t,e)}}}function l(e,t){let n,o,i=e.data;void 0!==i&&N(n=i.hook)&&N(n=n.init)&&(n(e),i=e.data);let a=e.children,c=e.sel;if("!"===c)E(e.text)&&(e.text=""),e.elm=s.createComment(e.text);else if(void 0!==c){const d=e.elm||(e.elm=N(i)&&N(n=i.ns)?s.createElementNS(n,c):s.createElement(c));for(n=0,o=r.create.length;n<o;++n)r.create[n](C,e);if(D(a))for(n=0,o=a.length;n<o;++n){const e=a[n];null!=e&&s.appendChild(d,l(e,t))}else P(e.text)&&s.appendChild(d,s.createTextNode(e.text));n=e.data.hook,N(n)&&(n.create&&n.create(C,e),n.insert&&t.push(e))}else e.elm=s.createTextNode(e.text);return e.elm}function c(e,t,n,o,r,i){for(;o<=r;++o){const r=n[o];null!=r&&s.insertBefore(e,l(r,i),t)}}function d(e){let t,n,o,s,i=e.data;if(void 0!==i){for(N(t=i.hook)&&N(t=t.destroy)&&t(e),t=0,n=r.destroy.length;t<n;++t)r.destroy[t](e);if(void 0!==e.children)for(o=0,s=e.children.length;o<s;++o)t=e.children[o],null!=t&&"string"!=typeof t&&d(t)}}function u(e,t,n,o){for(;n<=o;++n){let o,i,l,c,u=t[n];if(null!=u)if(N(u.sel)){for(d(u),l=r.remove.length+1,c=a(u.elm,l),o=0,i=r.remove.length;o<i;++o)r.remove[o](u,c);N(o=u.data)&&N(o=o.hook)&&N(o=o.remove)?o(u,c):c()}else s.removeChild(e,u.elm)}}function h(e,t,n){let o,i,a;N(o=t.data)&&N(a=o.hook)&&N(o=a.prepatch)&&o(e,t);const d=t.elm=e.elm;let p=e.children,f=t.children;if(e!==t){if(void 0!==t.data){for(o=0,i=r.update.length;o<i;++o)r.update[o](e,t);o=t.data.hook,N(o)&&N(o=o.update)&&o(e,t)}E(t.text)?N(p)&&N(f)?p!==f&&function(e,t,n,o){let r,i,a,d,p=0,f=0,m=t.length-1,_=t[0],v=t[m],g=n.length-1,w=n[0],b=n[g];for(;p<=m&&f<=g;)null==_?_=t[++p]:null==v?v=t[--m]:null==w?w=n[++f]:null==b?b=n[--g]:L(_,w)?(h(_,w,o),_=t[++p],w=n[++f]):L(v,b)?(h(v,b,o),v=t[--m],b=n[--g]):L(_,b)?(h(_,b,o),s.insertBefore(e,_.elm,s.nextSibling(v.elm)),_=t[++p],b=n[--g]):L(v,w)?(h(v,w,o),s.insertBefore(e,v.elm,_.elm),v=t[--m],w=n[++f]):(void 0===r&&(r=T(t,p,m)),i=r[w.key],E(i)?(s.insertBefore(e,l(w,o),_.elm),w=n[++f]):(a=t[i],a.sel!==w.sel?s.insertBefore(e,l(w,o),_.elm):(h(a,w,o),t[i]=void 0,s.insertBefore(e,a.elm,_.elm)),w=n[++f]));(p<=m||f<=g)&&(p>m?(d=null==n[g+1]?null:n[g+1].elm,c(e,d,n,f,g,o)):u(e,t,p,m))}(d,p,f,n):N(f)?(N(e.text)&&s.setTextContent(d,""),c(d,null,f,0,f.length-1,n)):N(p)?u(d,p,0,p.length-1):N(e.text)&&s.setTextContent(d,""):e.text!==t.text&&(N(p)&&u(d,p,0,p.length-1),s.setTextContent(d,t.text)),N(a)&&N(o=a.postpatch)&&o(e,t)}}return function(e,t){let n,o,a,c;const d=[];for(n=0,o=r.pre.length;n<o;++n)r.pre[n]();for(function(e){return void 0!==e.sel}(e)||(e=i(e)),L(e,t)?h(e,t,d):(a=e.elm,c=s.parentNode(a),l(t,d),null!==c&&(s.insertBefore(c,t.elm,s.nextSibling(a)),u(c,[e],0,0))),n=0,o=d.length;n<o;++n)d[n].data.hook.insert(d[n]);for(n=0,o=r.post.length;n<o;++n)r.post[n]();return t}}([g,b,f,y]);let O=null;const F={setTimeout:window.setTimeout.bind(window),clearTimeout:window.clearTimeout.bind(window),setInterval:window.setInterval.bind(window),clearInterval:window.clearInterval.bind(window),requestAnimationFrame:window.requestAnimationFrame.bind(window),random:Math.random,Date:window.Date,fetch:(window.fetch||(()=>{})).bind(window),get localStorage(){return O||window.localStorage},set localStorage(e){O=e}};const U={};function j(e){if(void 0===e)return"";if("number"==typeof e)return String(e);const t=document.createElement("p");return t.textContent=e,t.innerHTML}function M(e,t){for(let n in e)if(e[n]!==t[n])return!1;return!0}var B=Object.freeze({__proto__:null,whenReady:function(e){return new Promise((function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e,!1)})).then(e||function(){})},loadJS:function(e){if(e in U)return U[e];const t=new Promise((function(t,n){const o=document.createElement("script");o.type="text/javascript",o.src=e,o.onload=function(){t()},o.onerror=function(){n(`Error loading file '${e}'`)};(document.head||document.getElementsByTagName("head")[0]).appendChild(o)}));return U[e]=t,t},loadFile:async function(e){const t=await F.fetch(e);if(!t.ok)throw new Error("Error while fetching xml templates");return await t.text()},escape:j,debounce:function(e,t,n){let o;return function(){const r=this,s=arguments;function i(){o=null,n||e.apply(r,s)}const a=n&&!o;F.clearTimeout(o),o=F.setTimeout(i,t),a&&e.apply(r,s)}},shallowEqual:M});const q=["label","title","placeholder","alt"],W=/[\r\n]/,K=/\s+/g,V=/^(\s*)([\s\S]+?)(\s*)$/,z={create:"(_, n)",insert:"vn",remove:"(vn, rm)",destroy:"()"};function H(e){return e&&e.hasOwnProperty("__owl__")}function G(e){return e.map((e=>{if(e.sel){const t=document.createElement(e.sel);return S(t,e).elm.outerHTML}return e.text})).join("")}const Q={zero:Symbol("zero"),toClassObj(e){const t={};if("string"==typeof e){if(!(e=e.trim()))return{};let n=e.split(/\s+/);for(let e=0;e<n.length;e++)t[n[e]]=!0;return t}for(let n in e){const o=e[n],r=n.split(/\s+/);for(let e of r)t[e]=t[e]||o}return t},combine(e,t){let n=e;const o=[];for(;!H(t);)o.push(t),t=t.__proto__;for(;o.length;){let e=o.pop();n=Object.create(n),Object.assign(n,e)}return n},shallowEqual:M,addNameSpace(e){I(e.data,e.children,e.sel)},VDomArray:class extends Array{toString(){return G(this)}},vDomToString:G,getComponent(e){for(;e&&!H(e);)e=e.__proto__;return e},getScope(e,t){const n=e;for(;e&&!e.hasOwnProperty(t)&&(!e.hasOwnProperty("__access_mode__")||"ro"!==e.__access_mode__);){const t=e.__proto__;if(!t||H(t))return n;e=t}return e}};function Z(e){const t=(new DOMParser).parseFromString(e,"text/xml");if(t.getElementsByTagName("parsererror").length){let n="Invalid XML in template.";const o=t.getElementsByTagName("parsererror")[0].textContent;if(o){n+="\nThe parser has produced the following error message:\n"+o;const t=/\d+/g,r=t.exec(o);if(r){const s=Number(r[0]),i=e.split("\n")[s-1],a=t.exec(o);if(i&&a){const e=Number(a[0])-1;i[e]&&(n+=`\nThe error might be located at xml line ${s} column ${e}\n${i}\n${"-".repeat(e-1)}^`)}}}throw new Error(n)}return t}function Y(e){return e.replace(/\'/g,"\\'")}class J extends e{constructor(e={}){super(),this.h=R,this.subTemplates={},this.isUpdating=!1,this.templates=Object.create(J.TEMPLATES),e.templates&&this.addTemplates(e.templates),e.translateFn&&(this.translateFn=e.translateFn)}static addDirective(e){if(e.name in J.DIRECTIVE_NAMES)throw new Error(`Directive "${e.name} already registered`);J.DIRECTIVES.push(e),J.DIRECTIVE_NAMES[e.name]=1,J.DIRECTIVES.sort(((e,t)=>e.priority-t.priority)),e.extraNames&&e.extraNames.forEach((e=>J.DIRECTIVE_NAMES[e]=1))}static registerComponent(e,t){if(J.components[e])throw new Error(`Component '${e}' has already been registered`);J.components[e]=t}static registerTemplate(e,t){if(J.TEMPLATES[e])throw new Error(`Template '${e}' has already been registered`);const n=new J;n.addTemplate(e,t),J.TEMPLATES[e]=n.templates[e]}addTemplate(e,t,n){if(n&&e in this.templates)return;const o=Z(t);if(!o.firstChild)throw new Error("Invalid template (should not be empty)");this._addTemplate(e,o.firstChild)}addTemplates(e){if(!e)return;const t=("string"==typeof e?Z(e):e).getElementsByTagName("templates")[0];if(t)for(let e of t.children){const t=e.getAttribute("t-name");this._addTemplate(t,e)}}_addTemplate(e,t){if(e in this.templates)throw new Error(`Template ${e} already defined`);this._processTemplate(t);const n={elem:t,fn:function(t,o){const r=this._compile(e);return n.fn=r,r.call(this,t,o)}};this.templates[e]=n}_processTemplate(e){let t=e.querySelectorAll("[t-elif], [t-else]");for(let e=0,n=t.length;e<n;e++){let n=t[e],o=n.previousElementSibling,r=function(e){return o.getAttribute(e)},s=function(e){return+!!n.getAttribute(e)};if(!o||!r("t-if")&&!r("t-elif"))throw new Error("t-elif and t-else directives must be preceded by a t-if or t-elif directive");{if(r("t-foreach"))throw new Error("t-if cannot stay at the same level as t-foreach when using t-elif or t-else");if(["t-if","t-elif","t-else"].map(s).reduce((function(e,t){return e+t}))>1)throw new Error("Only one conditional branching directive is allowed per node");let e;for(;(e=n.previousSibling)!==o;){if(e.nodeValue.trim().length&&8!==e.nodeType)throw new Error("text is not allowed between branching directives");e.remove()}}}}render(e,t={},n=null){const o=this.templates[e];if(!o)throw new Error(`Template ${e} does not exist`);return o.fn.call(this,t,n)}renderToString(e,t={},n){const o=this.render(e,t,n);if(void 0===o.sel)return o.text;const r=document.createElement(o.sel),s=S(r,o).elm;return function e(t){3===t.nodeType&&(t.textContent=j(t.textContent));for(let n of t.childNodes)e(n)}(s),s.outerHTML}forceUpdate(){this.isUpdating=!0,Promise.resolve().then((()=>{this.isUpdating&&(this.isUpdating=!1,this.trigger("update"))}))}_compile(e,t={}){const n=t.elem||this.templates[e].elem,o=n.attributes.hasOwnProperty("t-debug"),r=new h(e);if("t"!==n.tagName&&(r.shouldDefineResult=!1),t.hasParent&&(r.variables=Object.create(null),r.parentNode=r.generateID(),r.allowMultipleRoots=!0,r.shouldDefineParent=!0,r.hasParentWidget=!0,r.shouldDefineResult=!1,r.addLine(`let c${r.parentNode} = extra.parentNode;`),t.defineKey&&(r.addLine('let key0 = extra.key || "";'),r.hasKey0=!0)),this._compileNode(n,r),!t.hasParent)if(r.shouldDefineResult)r.addLine("return result;");else{if(!r.rootNode)throw new Error(`A template should have one root node (${r.templateName})`);r.addLine(`return vn${r.rootNode};`)}let s=r.generateCode();const i=r.templateName.replace(/`/g,"'").slice(0,200);let a;s.unshift(` // Template name: "${i}"`);try{a=new Function("context, extra",s.join("\n"))}catch(e){throw console.groupCollapsed("Invalid Code generated by "+i),console.warn(s.join("\n")),console.groupEnd(),new Error(`Invalid generated code while compiling template '${i}': ${e.message}`)}if(o){const t=this.templates[e];if(t){const e=`Template: ${t.elem.outerHTML}\nCompiled code:\n${a.toString()}`;console.log(e)}}return a}_compileNode(e,t){if(!(e instanceof Element)){let n=e.textContent;if(!t.inPreTag){if(W.test(n)&&!n.trim())return;n=n.replace(K," ")}if(this.translateFn&&"off"!==e.parentNode.getAttribute("t-translation")){const e=V.exec(n);n=e[1]+this.translateFn(e[2])+e[3]}if(t.parentNode)3===e.nodeType?t.addLine(`c${t.parentNode}.push({text: \`${n}\`});`):8===e.nodeType&&t.addLine(`c${t.parentNode}.push(h('!', \`${n}\`));`);else if(t.parentTextNode)t.addLine(`vn${t.parentTextNode}.text += \`${n}\`;`);else{let e=t.generateID();t.addLine(`let vn${e} = {text: \`${n}\`};`),t.addLine(`result = vn${e};`),t.rootContext.rootNode=e,t.rootContext.parentTextNode=e}return}if("t"!==e.tagName&&e.hasAttribute("t-call")){const t=document.implementation.createDocument("http://www.w3.org/1999/xhtml","t",null).documentElement;t.setAttribute("t-call",e.getAttribute("t-call")),e.removeAttribute("t-call"),e.prepend(t)}const n=e.tagName[0];if(n===n.toUpperCase())e.setAttribute("t-component",e.tagName);else if("t"!==e.tagName&&e.hasAttribute("t-component"))throw new Error(`Directive 't-component' can only be used on <t> nodes (used on a <${e.tagName}>)`);const o=e.attributes,r=[],s=[];for(let t=0;t<o.length;t++){let n=o[t].name;if(n.startsWith("t-")){if(!(n.slice(2).split(/-|\./)[0]in J.DIRECTIVE_NAMES))throw new Error(`Unknown QWeb directive: '${n}'`);if("t"!==e.tagName&&("t-esc"===n||"t-raw"===n)){const t=document.implementation.createDocument("http://www.w3.org/1999/xhtml","t",null).documentElement;t.setAttribute(n,e.getAttribute(n));for(let n of Array.from(e.childNodes))t.appendChild(n);e.appendChild(t),e.removeAttribute(n)}}}const i=J.DIRECTIVES.length,a=o.length;let l=!1;for(let e=0;e<i;e++){let t,n,s=J.DIRECTIVES[e];for(let e=0;e<a;e++){const i=o[e].name;(i==="t-"+s.name||i.startsWith("t-"+s.name+"-")||i.startsWith("t-"+s.name+"."))&&(t=i,n=o[e].textContent,r.push({directive:s,value:n,fullName:t}),"on"!==s.name&&"model"!==s.name||(l=!0))}}for(let{directive:n,value:o,fullName:i}of r)if(n.finalize&&s.push({directive:n,value:o,fullName:i}),n.atNodeEncounter){if(n.atNodeEncounter({node:e,qweb:this,ctx:t,fullName:i,value:o})){for(let{directive:n,value:o,fullName:r}of s)n.finalize({node:e,qweb:this,ctx:t,fullName:r,value:o});return}}if("t"!==e.nodeName||e.hasAttribute("t-tag")){let n={},o=function(e,t){n[e]=n[e]||[],n[e].push(t)};if("select"===e.tagName&&e.hasAttribute("t-att-value")){const n=e.getAttribute("t-att-value");let r=t.generateID();t.addLine(`let expr${r} = ${t.formatExpression(n)};`);let s="expr"+r;e.setAttribute("t-att-value",s),o("create",`n.elm.value=${s};`)}let s=this._compileGenericNode(e,t,l);t=t.withParent(s);for(let{directive:n,value:i,fullName:a}of r)n.atNodeCreation&&n.atNodeCreation({node:e,qweb:this,ctx:t,fullName:a,value:i,nodeID:s,addNodeHook:o});if(Object.keys(n).length){t.addLine(`p${s}.hook = {`);for(let e in n){t.addLine(` ${e}: ${z[e]} => {`);for(let o of n[e])t.addLine(" "+o);t.addLine(" },")}t.addLine("};")}}"pre"===e.nodeName&&(t=t.subContext("inPreTag",!0)),this._compileChildren(e,t);("svg"===e.nodeName||"g"===e.nodeName&&t.rootNode===t.parentNode)&&(t.rootContext.shouldDefineUtils=!0,t.addLine(`utils.addNameSpace(vn${t.parentNode});`));for(let{directive:n,value:o,fullName:r}of s)n.finalize({node:e,qweb:this,ctx:t,fullName:r,value:o})}_compileGenericNode(e,t,n=!0){if(1!==e.nodeType)throw new Error("unsupported node type");const o=e.attributes,r=[],s=[],i=[];function a(t,n){let o=!1;switch(e.nodeName){case"input":let n=e.getAttribute("type");"checkbox"!==n&&"radio"!==n||"checked"!==t&&"indeterminate"!==t||(o=!0),"value"!==t&&"readonly"!==t&&"disabled"!==t||(o=!0);break;case"option":o="selected"===t||"disabled"===t;break;case"textarea":o="readonly"===t||"disabled"===t||"value"===t;break;case"select":o="disabled"===t||"value"===t;break;case"button":case"optgroup":o="disabled"===t}o&&s.push(`${t}: ${n}`)}let l="";for(let n=0;n<o.length;n++){let s=o[n].name,c=o[n].textContent;if(this.translateFn&&q.includes(s)&&(c=this.translateFn(c)),!s.startsWith("t-")&&!e.getAttribute("t-attf-"+s)){const e=t.generateID();if("class"===s){if(c=c.trim()){let e=c.split(/\s+/).map((e=>`'${Y(e)}':true`)).join(",");l?t.addLine(`Object.assign(${l}, {${e}})`):(l="_"+t.generateID(),t.addLine(`let ${l} = {${e}};`))}}else t.addLine(`let _${e} = '${Y(c)}';`),s.match(/^[a-zA-Z]+$/)||(s='"'+s+'"'),r.push(`${s}: _${e}`),a(s,"_"+e)}if(s.startsWith("t-att-")){let n=s.slice(6);const o=t.getValue(c);let i="string"==typeof o?t.formatExpression(o):"scope."+o.id;if("class"===n)t.rootContext.shouldDefineUtils=!0,i=`utils.toClassObj(${i})`,l?t.addLine(`Object.assign(${l}, ${i})`):(l="_"+t.generateID(),t.addLine(`let ${l} = ${i};`));else{const s=t.generateID();n.match(/^[a-zA-Z]+$/)||(n='"'+n+'"');const l=e.getAttribute(n);if(l){const e=t.generateID();t.addLine(`let _${e} = ${i};`),i=`'${l}' + (_${e} ? ' ' + _${e} : '')`;const o=r.findIndex((e=>e.startsWith(n+":")));r.splice(o,1)}"select"===e.nodeName&&"value"===n?(r.push(`${n}: ${o}`),a(n,o)):(t.addLine(`let _${s} = ${i};`),r.push(`${n}: _${s}`),a(n,"_"+s))}}if(s.startsWith("t-attf-")){let n=s.slice(7);n.match(/^[a-zA-Z]+$/)||(n='"'+n+'"');const o=t.interpolate(c),i=t.generateID();let a=e.getAttribute(n);a?t.addLine(`let _${i} = '${a} ' + ${o};`):t.addLine(`let _${i} = ${o};`),r.push(`${n}: _${i}`)}if("t-att"===s){let e=t.generateID();t.addLine(`let _${e} = ${t.formatExpression(c)};`),i.push(e)}}let c=t.generateID();const d=["key:"+(t.loopNumber||t.hasKey0?`\`\${key${t.loopNumber}}_${c}\``:c)];r.length+i.length>0&&d.push(`attrs:{${r.join(",")}}`),s.length>0&&d.push(`props:{${s.join(",")}}`),l&&d.push("class:"+l),n&&d.push("on:{}"),t.addLine(`let c${c} = [], p${c} = {${d.join(",")}};`);for(let e of i)t.addIf(`_${e} instanceof Array`),t.addLine(`p${c}.attrs[_${e}[0]] = _${e}[1];`),t.addElse(),t.addLine(`for (let key in _${e}) {`),t.indent(),t.addLine(`p${c}.attrs[key] = _${e}[key];`),t.dedent(),t.addLine("}"),t.closeIf();let u=`'${e.nodeName}'`;if(e.hasAttribute("t-tag")){const n=e.getAttribute("t-tag");e.removeAttribute("t-tag"),u="tag"+t.generateID(),t.addLine(`let ${u} = ${t.formatExpression(n)};`)}return t.addLine(`let vn${c} = h(${u}, p${c}, c${c});`),t.parentNode?t.addLine(`c${t.parentNode}.push(vn${c});`):(t.loopNumber||t.hasKey0)&&(t.rootContext.shouldDefineResult=!0,t.addLine(`result = vn${c};`)),c}_compileChildren(e,t){if(e.childNodes.length>0)for(let n of Array.from(e.childNodes))this._compileNode(n,t)}}J.utils=Q,J.components=Object.create(null),J.DIRECTIVE_NAMES={name:1,att:1,attf:1,translation:1,tag:1},J.DIRECTIVES=[],J.TEMPLATES={},J.nextId=1,J.dev=!1,J.enableTransitions=!0,J.slots={},J.nextSlotId=1,J.subTemplates={};const X=new DOMParser;function ee(e){if(!(e instanceof Element))return e instanceof Comment?R("!",e.textContent):{text:e.textContent};const t={};for(let n of e.attributes)t[n.name]=n.textContent;const n=[];for(let t of e.childNodes)n.push(ee(t));const o=R(e.tagName,{attrs:t},n);return"svg"===o.sel&&I(o.data,o.children,o.sel),o}function te(e,t,n,o){if(o.rootContext.shouldDefineScope=!0,"0"===e){if(o.parentNode){o.rootContext.shouldDefineUtils=!0;const e=o.escaping?"{text: utils.vDomToString(scope[utils.zero])}":"...scope[utils.zero]";o.addLine(`c${o.parentNode}.push(${e});`)}return}let r;if("string"==typeof e?(r="_"+o.generateID(),o.addLine(`let ${r} = ${o.formatExpression(e)};`)):r="scope."+e.id,o.addIf(r+" != null"),o.escaping){let t;if(e.hasBody&&(o.rootContext.shouldDefineUtils=!0,t=o.startProtectScope(),o.addLine(`${r} = ${r} instanceof utils.VDomArray ? utils.vDomToString(${r}) : ${r};`)),o.parentTextNode)o.addLine(`vn${o.parentTextNode}.text += ${r};`);else if(o.parentNode)o.addLine(`c${o.parentNode}.push({text: ${r}});`);else{let e=o.generateID();o.rootContext.rootNode=e,o.rootContext.parentTextNode=e,o.addLine(`let vn${e} = {text: ${r}};`),o.rootContext.shouldDefineResult&&o.addLine("result = vn"+e)}e.hasBody&&o.stopProtectScope(t)}else o.rootContext.shouldDefineUtils=!0,e.hasBody?(o.addLine(`const vnodeArray = ${r} instanceof utils.VDomArray ? ${r} : utils.htmlToVDOM(${r});`),o.addLine(`c${o.parentNode}.push(...vnodeArray);`)):o.addLine(`c${o.parentNode}.push(...utils.htmlToVDOM(${r}));`);t.childNodes.length&&(o.addElse(),n._compileChildren(t,o)),o.closeIf()}J.utils.htmlToVDOM=function(e){const t=X.parseFromString(e,"text/html"),n=[];for(let e of t.body.childNodes)n.push(ee(e));return n},J.addDirective({name:"esc",priority:70,atNodeEncounter:({node:e,qweb:t,ctx:n})=>(te(n.getValue(e.getAttribute("t-esc")),e,t,n.subContext("escaping",!0)),!0)}),J.addDirective({name:"raw",priority:80,atNodeEncounter:({node:e,qweb:t,ctx:n})=>(te(n.getValue(e.getAttribute("t-raw")),e,t,n),!0)}),J.addDirective({name:"set",extraNames:["value"],priority:60,atNodeEncounter({node:e,qweb:t,ctx:n}){n.rootContext.shouldDefineScope=!0;const o=e.getAttribute("t-set");let r=e.getAttribute("t-value");n.variables[o]=n.variables[o]||{};let s=n.variables[o];const i=e.hasChildNodes();if(s.id=o,s.expr="scope."+o,r){const e=n.formatExpression(r);let t="scope";n.protectedScopeNumber&&(n.rootContext.shouldDefineUtils=!0,t=`utils.getScope(scope, '${o}')`),n.addLine(`${t}.${o} = ${e};`),s.value=e}if(i){n.rootContext.shouldDefineUtils=!0,r&&n.addIf(`!(${s.expr})`);const o=n.generateID(),i=n.parentNode;n.parentNode=o,n.addLine(`let c${o} = new utils.VDomArray();`);const a=e.cloneNode(!0);for(let e of["t-set","t-value","t-if","t-else","t-elif"])a.removeAttribute(e);t._compileNode(a,n),n.addLine(`${s.expr} = c${o}`),s.value="c"+o,s.hasBody=!0,n.parentNode=i,r&&n.closeIf()}return!0}}),J.addDirective({name:"if",priority:20,atNodeEncounter({node:e,ctx:t}){let n=t.getValue(e.getAttribute("t-if"));return t.addIf("string"==typeof n?t.formatExpression(n):"scope."+n.id),!1},finalize({ctx:e}){e.closeIf()}}),J.addDirective({name:"elif",priority:30,atNodeEncounter({node:e,ctx:t}){let n=t.getValue(e.getAttribute("t-elif"));return t.addLine(`else if (${"string"==typeof n?t.formatExpression(n):"scope."+n.id}) {`),t.indent(),!1},finalize({ctx:e}){e.closeIf()}}),J.addDirective({name:"else",priority:40,atNodeEncounter:({ctx:e})=>(e.addLine("else {"),e.indent(),!1),finalize({ctx:e}){e.closeIf()}}),J.addDirective({name:"call",priority:50,atNodeEncounter({node:e,qweb:t,ctx:n}){n.rootContext.shouldDefineScope=!0,n.rootContext.shouldDefineUtils=!0;const o=e.getAttribute("t-call"),r=u.test(o),s=t.templates[o];if(!r&&!s)throw new Error(`Cannot find template "${o}" (t-call)`);let i;if(r){const e=n.generateID();n.addLine(`let tname${e} = ${n.interpolate(o)};`),n.addLine(`let tid${e} = this.subTemplates[tname${e}];`),n.addIf("!tid"+e),n.addLine(`tid${e} = this.constructor.nextId++;`),n.addLine(`this.subTemplates[tname${e}] = tid${e};`),n.addLine(`this.constructor.subTemplates[tid${e}] = this._compile(tname${e}, {hasParent: true, defineKey: true});`),n.closeIf(),i="tid"+e}else{let e=t.subTemplates[o];if(!e){e=J.nextId++,t.subTemplates[o]=e;const n=t._compile(o,{hasParent:!0,defineKey:!0});J.subTemplates[e]=n}i=`'${e}'`}let a=e.hasChildNodes();const l=n.startProtectScope();if(a){n.addLine("{"),n.indent();const o=e.cloneNode(!0);for(let e of["t-if","t-else","t-elif","t-call"])o.removeAttribute(e);n.addLine("{"),n.indent(),n.addLine("let c__0 = [];"),t._compileNode(o,n.subContext("parentNode","__0")),n.rootContext.shouldDefineUtils=!0,n.addLine("scope[utils.zero] = c__0;"),n.dedent(),n.addLine("}")}const c=n.rootContext.shouldDefineParent?"parent":"utils.getComponent(context)",d=n.generateTemplateKey(),h=`Object.assign({}, extra, {parentNode: ${n.parentNode?"c"+n.parentNode:"result"}, parent: ${c}, key: ${d}})`;return n.parentNode?n.addLine(`this.constructor.subTemplates[${i}].call(this, scope, ${h});`):(n.rootContext.shouldDefineResult=!0,n.addLine("result = []"),n.addLine(`this.constructor.subTemplates[${i}].call(this, scope, ${h});`),n.addLine("result = result[0]")),a&&(n.dedent(),n.addLine("}")),n.stopProtectScope(l),!0}}),J.addDirective({name:"foreach",extraNames:["as"],priority:10,atNodeEncounter({node:e,qweb:t,ctx:n}){n.rootContext.shouldDefineScope=!0,n=n.subContext("loopNumber",n.loopNumber+1);const o=e.getAttribute("t-foreach"),r=e.getAttribute("t-as");let s=n.generateID();n.addLine(`let _${s} = ${n.formatExpression(o)};`),n.addLine(`if (!_${s}) { throw new Error('QWeb error: Invalid loop expression')}`);let i=n.generateID(),a=n.generateID();n.addLine(`let _${i} = _${s};`),n.addLine(`let _${a} = _${s};`),n.addIf(`!(_${s} instanceof Array)`),n.addLine(`_${i} = Object.keys(_${s});`),n.addLine(`_${a} = Object.values(_${s});`),n.closeIf(),n.addLine(`let _length${i} = _${i}.length;`);let l=n.startProtectScope(!0);const c="i"+n.loopNumber;n.addLine(`for (let ${c} = 0; ${c} < _length${i}; ${c}++) {`),n.indent(),n.addLine(`scope.${r}_first = ${c} === 0`),n.addLine(`scope.${r}_last = ${c} === _length${i} - 1`),n.addLine(`scope.${r}_index = ${c}`),n.addLine(`scope.${r} = _${i}[${c}]`),n.addLine(`scope.${r}_value = _${a}[${c}]`);const d=e.cloneNode(!0);if(!d.hasAttribute("t-key")&&1===e.children.length&&"t"!==e.children[0].tagName&&!e.children[0].hasAttribute("t-key")&&console.warn(`Directive t-foreach should always be used with a t-key! (in template: '${n.templateName}')`),d.hasAttribute("t-key")){const e=n.formatExpression(d.getAttribute("t-key"));n.addLine(`let key${n.loopNumber} = ${e};`),d.removeAttribute("t-key")}else n.addLine(`let key${n.loopNumber} = i${n.loopNumber};`);return d.removeAttribute("t-foreach"),t._compileNode(d,n),n.dedent(),n.addLine("}"),n.stopProtectScope(l),!0}}),J.addDirective({name:"debug",priority:1,atNodeEncounter({ctx:e}){e.addLine("debugger;")}}),J.addDirective({name:"log",priority:1,atNodeEncounter({ctx:e,value:t}){const n=e.formatExpression(t);e.addLine(`console.log(${n})`)}});const ne={prevent:"e.preventDefault();",self:"if (e.target !== this.elm) {return}",stop:"e.stopPropagation();"},oe=/^[$A-Z_][0-9A-Z_$]*$/i;function re(e,t,n,o,r=ne){let s,[i,...a]=t.slice(5).split(".");if(a.includes("capture")&&(i="!"+i),!i)throw new Error("Missing event name with t-on directive");let l="";const c=n.replace(/\(.*\)/,(function(e){return l=e.slice(1,-1),""}));if(c.match(oe)){e.rootContext.shouldDefineUtils=!0;const t="utils.getComponent(context)";if(l){const n=e.generateID();e.addLine(`let args${n} = [${e.formatExpression(l)}];`),s=`${t}['${c}'](...args${n}, e);`,o=!1}else s=`${t}['${c}'](e);`}else o=!1,s=e.captureExpression(n),s=`const res = (() => { return ${s} })(); if (typeof res === 'function') { res(e) }`;let d=`function (e) {if (context.__owl__.status === 5){return}${a.map((e=>r[e])).join("")}${s}}`;if(o){const t=e.generateTemplateKey(i);e.addLine(`extra.handlers[${t}] = extra.handlers[${t}] || ${d};`),d=`extra.handlers[${t}]`}return{event:i,handler:d}}function se(e){return 1e3*Number(e.slice(0,-1).replace(",","."))}function ie(e,t){if(!e.parentNode)return;const n=window.getComputedStyle(e),o=function(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max.apply(null,t.map(((t,n)=>se(t)+se(e[n]))))}((n.transitionDelay||"").split(", "),(n.transitionDuration||"").split(", "));if(o>0){const n=()=>{e.parentNode&&(t(),F.clearTimeout(r),e.removeEventListener("transitionend",n))};e.addEventListener("transitionend",n,{once:!0});const r=F.setTimeout(n,o+1)}else t()}J.addDirective({name:"on",priority:90,atNodeCreation({ctx:e,fullName:t,value:n,nodeID:o}){const{event:r,handler:s}=re(e,t,n,!0);e.addLine(`p${o}.on['${r}'] = ${s};`)}}),J.addDirective({name:"ref",priority:95,atNodeCreation({ctx:e,value:t,addNodeHook:n}){e.rootContext.shouldDefineRefs=!0;const o="ref"+e.generateID();e.addLine(`const ${o} = ${e.interpolate(t)};`),n("create",`context.__owl__.refs[${o}] = n.elm;`),n("destroy",`delete context.__owl__.refs[${o}];`)}}),J.utils.nextFrame=function(e){requestAnimationFrame((()=>requestAnimationFrame(e)))},J.utils.transitionInsert=function(e,t){const n=e.elm,o=n.parentElement&&n.parentElement.querySelector(`*[data-owl-key='${e.key}']`);o&&o.remove(),n.classList.add(t+"-enter"),n.classList.add(t+"-enter-active"),n.classList.remove(t+"-leave-active"),n.classList.remove(t+"-leave-to");const r=()=>{n.classList.remove(t+"-enter-active"),n.classList.remove(t+"-enter-to")};this.nextFrame((()=>{n.classList.remove(t+"-enter"),n.classList.add(t+"-enter-to"),ie(n,r)}))},J.utils.transitionRemove=function(e,t,n){const o=e.elm;o.setAttribute("data-owl-key",e.key),o.classList.add(t+"-leave"),o.classList.add(t+"-leave-active");const r=()=>{o.classList.contains(t+"-leave-active")&&(o.classList.remove(t+"-leave-active"),o.classList.remove(t+"-leave-to"),n())};this.nextFrame((()=>{o.classList.remove(t+"-leave"),o.classList.add(t+"-leave-to"),ie(o,r)}))},J.addDirective({name:"transition",priority:96,atNodeCreation({ctx:e,value:t,addNodeHook:n}){if(!J.enableTransitions)return;e.rootContext.shouldDefineUtils=!0;const o={insert:`utils.transitionInsert(vn, '${t}');`,remove:`utils.transitionRemove(vn, '${t}', rm);`};for(let e in o)n(e,o[e])}}),J.addDirective({name:"slot",priority:80,atNodeEncounter({ctx:e,value:t,node:n,qweb:o}){const r=e.generateID(),s=t.match(u)?e.interpolate(t):`'${t}'`;e.addLine(`const slot${r} = this.constructor.slots[context.__owl__.slotId + '_' + ${s}];`),e.addIf("slot"+r);let i="c"+e.parentNode;if(e.parentNode||(e.rootContext.shouldDefineResult=!0,e.rootContext.shouldDefineUtils=!0,i="children"+e.generateID(),e.addLine(`let ${i}= []`),e.addLine("result = {}")),e.addLine(`slot${r}.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: ${i}, parent: extra.parent || context}));`),e.parentNode||e.addLine(`utils.defineProxy(result, ${i}[0]);`),n.hasChildNodes()){e.addElse();const t=n.cloneNode(!0);t.removeAttribute("t-slot"),o._compileNode(t,e)}return e.closeIf(),!0}}),J.utils.toNumber=function(e){const t=parseFloat(e);return isNaN(t)?e:t};const ae=/\.[\w_]+\s*$/,le=/\[[^\[]+\]\s*$/;J.addDirective({name:"model",priority:42,atNodeCreation({ctx:e,nodeID:t,value:n,node:o,fullName:r,addNodeHook:s}){const i=o.getAttribute("type");let a,l,c,d=r.includes(".lazy")?"change":"input";if(ae.test(n)){const o=n.lastIndexOf(".");c=n.slice(0,o),e.addLine(`let expr${t} = ${e.formatExpression(c)};`),l=`expr${t}${n.slice(o)}`}else{if(!le.test(n))throw new Error(`Invalid t-model expression: "${n}" (it should be assignable)`);{const o=n.lastIndexOf("[");c=n.slice(0,o),e.addLine(`let expr${t} = ${e.formatExpression(c)};`);let r=n.trimRight().slice(o+1,-1);e.addLine(`let exprKey${t} = ${e.formatExpression(r)};`),l=`expr${t}[exprKey${t}]`}}const u=e.generateTemplateKey();if("select"===o.tagName)e.addLine(`p${t}.props = {value: ${l}};`),s("create",`n.elm.value=${l};`),d="change",a=`(ev) => {${l} = ev.target.value}`;else if("checkbox"===i)e.addLine(`p${t}.props = {checked: ${l}};`),a=`(ev) => {${l} = ev.target.checked}`;else if("radio"===i){const n=o.getAttribute("value");e.addLine(`p${t}.props = {checked:${l} === '${n}'};`),a=`(ev) => {${l} = ev.target.value}`,d="click"}else{e.addLine(`p${t}.props = {value: ${l}};`);let n="ev.target.value"+(r.includes(".trim")?".trim()":"");r.includes(".number")&&(e.rootContext.shouldDefineUtils=!0,n=`utils.toNumber(${n})`),a=`(ev) => {${l} = ${n}}`}e.addLine(`extra.handlers[${u}] = extra.handlers[${u}] || (${a});`),e.addLine(`p${t}.on['${d}'] = extra.handlers[${u}];`)}}),J.addDirective({name:"key",priority:45,atNodeEncounter({ctx:e,value:t,node:n}){0===e.loopNumber&&(e.keyStack.push(e.rootContext.hasKey0),e.rootContext.hasKey0=!0),e.addLine("{"),e.indent(),e.addLine(`let key${e.loopNumber} = ${e.formatExpression(t)};`)},finalize({ctx:e}){e.dedent(),e.addLine("}"),0===e.loopNumber&&(e.rootContext.hasKey0=e.keyStack.pop())}});const ce={translatableAttributes:q};Object.defineProperty(ce,"mode",{get:()=>J.dev?"dev":"prod",set(e){J.dev="dev"===e,J.dev&&console.info("Owl is running in 'dev' mode.\n\nThis is not suitable for production use.\nSee https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for more information.")}}),Object.defineProperty(ce,"enableTransitions",{get:()=>J.enableTransitions,set(e){J.enableTransitions=e}});class de extends CustomEvent{constructor(e,t,n){super(t,n),this.originalComponent=e}}const ue=Object.assign({},ne,{self:"if (e.target !== vn.elm) {return}"});J.utils.defineProxy=function(e,t){for(let n in t)Object.defineProperty(e,n,{get:()=>t[n],set(e){t[n]=e}})},J.utils.assignHooks=function(e,t){if("hook"in e){const n=e.hook;for(let e in t){const o=n[e],r=t[e];n[e]=o?(...e)=>{o(...e),r(...e)}:r}}else e.hook=t},J.addDirective({name:"component",extraNames:["props"],priority:100,atNodeEncounter({ctx:e,value:t,node:n,qweb:o}){e.addLine(`// Component '${t}'`),e.rootContext.shouldDefineQWeb=!0,e.rootContext.shouldDefineParent=!0,e.rootContext.shouldDefineUtils=!0,e.rootContext.shouldDefineScope=!0;let r=!!n.getAttribute("t-props");const s=[];let i="";const a=n.attributes,l={};for(let t=0;t<a.length;t++){const n=a[t].name,o=a[t].textContent;n.startsWith("t-on-")?s.push([n,o]):"t-transition"===n?J.enableTransitions&&(i=o):n.startsWith("t-")||"class"!==n&&"style"!==n&&(l[n]=e.formatExpression(o)||"undefined")}let c,d=Object.keys(l).map((e=>e+":"+l[e])).join(","),h=e.generateID(),p=!1;if("t"===n.tagName&&!n.hasAttribute("t-key")&&t.match(u)){A();const t=e.generateID();e.addLine(`let k${t} = '___' + componentKey${h}`),c="k"+t}else c=e.generateTemplateKey();let f=n.getAttribute("t-ref"),m="",_="";f&&(e.rootContext.shouldDefineRefs=!0,_="ref"+e.generateID(),e.addLine(`const ${_} = ${e.interpolate(f)};`),m=`context.__owl__.refs[${_}] = w${h};`);let v=`w${h}.destroy();`;f&&(v+=`delete context.__owl__.refs[${_}];`),i&&(v=`let finalize = () => {\n ${v}\n };\n delete w${h}.__owl__.transitionInserted;\n utils.transitionRemove(vn, '${i}', finalize);`);let g="",w=n.getAttribute("class"),b=n.getAttribute("t-att-class"),$=n.getAttribute("style"),y=n.getAttribute("t-att-style");if(y){const t="_"+e.generateID();e.addLine(`const ${t} = ${e.formatExpression(y)};`),y=t}let x="";if(w||b||$||y||s.length){if(w){let t=w.trim().split(/\s+/).map((e=>`'${e}':true`)).join(",");x="_"+e.generateID(),e.addLine(`let ${x} = {${t}};`)}if(b){let t=e.formatExpression(b);"{"===t[0]&&"}"===t[t.length-1]||(t=`utils.toClassObj(${t})`),w?e.addLine(`Object.assign(${x}, ${t})`):(x="_"+e.generateID(),e.addLine(`let ${x} = ${t};`))}const t=y||!!$&&`'${$}'`;g=`utils.assignHooks(vnode.data, {create(_, vn){${t?`vn.elm.style = ${t};`:""}${s.map((function([t,n]){const o=t.match(/\.capture/);t=o?t.replace(/\.capture/,""):t;const{event:r,handler:s}=re(e,t,n,!1,ue);return o?`vn.elm.addEventListener('${r}', ${s}, true);`:`vn.elm.addEventListener('${r}', ${s});`})).join("")}}});`}e.addLine(`let w${h} = ${c} in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[${c}]] : false;`);let E=!e.parentNode;if(E){let t=e.generateID();e.rootContext.rootNode=t,E=!0,e.rootContext.shouldDefineResult=!0,e.addLine(`let vn${t} = {};`),e.addLine(`result = vn${t};`)}if(r){const t=e.formatExpression(n.getAttribute("t-props"));e.addLine(`let props${h} = Object.assign({}, ${t}, {${d}});`)}else e.addLine(`let props${h} = {${d}};`);e.addIf(`w${h} && w${h}.__owl__.currentFiber && !w${h}.__owl__.vnode`),e.addLine(`w${h}.destroy();`),e.addLine(`w${h} = false;`),e.closeIf();let N="";E&&(N=`utils.defineProxy(vn${e.rootNode}, pvnode);`);const C=n.childNodes.length;let L=C?"utils.combine(context, scope)":"undefined";e.addIf("w"+h);let T="";function A(){if(!p){const n=e.interpolate(t);e.addLine(`let componentKey${h} = ${n};`),p=!0}}y&&(T=`.then(()=>{if (w${h}.__owl__.status === 5) {return};w${h}.el.style=${y};});`),e.addLine(`w${h}.__updateProps(props${h}, extra.fiber, ${L})${T};`),e.addLine(`let pvnode = w${h}.__owl__.pvnode;`),N&&e.addLine(N),e.parentNode&&e.addLine(`c${e.parentNode}.push(pvnode);`),e.addElse(),A();const D=t.match(u)?"false":e.formatExpression(t);if(e.addLine(`let W${h} = ${D} || context.constructor.components[componentKey${h}] || QWeb.components[componentKey${h}];`),e.addLine(`if (!W${h}) {throw new Error('Cannot find the definition of component "' + componentKey${h} + '"')}`),e.addLine(`w${h} = new W${h}(parent, props${h});`),i&&(e.addLine(`const __patch${h} = w${h}.__patch;`),e.addLine(`w${h}.__patch = (t, vn) => {__patch${h}.call(w${h}, t, vn); if(!w${h}.__owl__.transitionInserted){w${h}.__owl__.transitionInserted = true;utils.transitionInsert(w${h}.__owl__.vnode, '${i}');}};`)),e.addLine(`parent.__owl__.cmap[${c}] = w${h}.__owl__.id;`),C){const t=n.cloneNode(!0);for(let e of t.children)e.hasAttribute("t-set")&&e.hasChildNodes()&&(e.setAttribute("t-set-slot",e.getAttribute("t-set")),e.removeAttribute("t-set"));const r=Array.from(t.querySelectorAll("[t-set-slot]")),s=new Set,i=J.nextSlotId++;if(e.addLine(`w${h}.__owl__.slotId = ${i};`),r.length)for(let e=0,n=r.length;e<n;e++){const n=r[e];let a=n.parentElement,l=!1;for(;a!==t;){if(a.hasAttribute("t-component")||a.tagName[0]===a.tagName[0].toUpperCase()){l=!0;break}a=a.parentElement}if(l)continue;let c=n.getAttribute("t-set-slot");if(s.has(c))continue;s.add(c),n.removeAttribute("t-set-slot"),n.parentElement.removeChild(n);const d=o._compile(`slot_${c}_template`,{elem:n,hasParent:!0});J.slots[`${i}_${c}`]=d}if(t.childNodes.length){let e=!1;const n=t.ownerDocument.createElement("t");for(let o of Object.values(t.childNodes))e=e||!(o instanceof Text)||Boolean(o.textContent.trim().length),n.appendChild(o);if(e){const e=o._compile("slot_default_template",{elem:n,hasParent:!0});J.slots[i+"_default"]=e}}}e.addLine(`let fiber = w${h}.__prepare(extra.fiber, ${L}, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; ${g}});`);const P=m?`insert(vn) {${m}},`:"";return e.addLine(`let pvnode = h('dummy', {key: ${c}, hook: {${P}remove() {},destroy(vn) {${v}}}});`),N&&e.addLine(N),e.parentNode&&e.addLine(`c${e.parentNode}.push(pvnode);`),e.addLine(`w${h}.__owl__.pvnode = pvnode;`),e.closeIf(),x&&e.addLine(`w${h}.__owl__.classObj=${x};`),e.addLine(`w${h}.__owl__.parentLastFiberId = extra.fiber.id;`),!0}});const he=new class{constructor(e){this.tasks=[],this.isRunning=!1,this.requestAnimationFrame=e}start(){this.isRunning=!0,this.scheduleTasks()}stop(){this.isRunning=!1}addFiber(e){return e=e.root,new Promise(((t,n)=>{if(e.error)return n(e.error);this.tasks.push({fiber:e,callback:()=>{if(e.error)return n(e.error);t()}}),this.isRunning||this.start()}))}rejectFiber(e,t){e=e.root;const n=this.tasks.findIndex((t=>t.fiber===e));if(n>=0){const[o]=this.tasks.splice(n,1);e.cancel(),e.error=new Error(t),o.callback()}}flush(){let e=this.tasks;this.tasks=[],e=e.filter((e=>{if(e.fiber.isCompleted)return e.callback(),!1;if(0===e.fiber.counter){if(!e.fiber.error)try{e.fiber.complete()}catch(t){e.fiber.handleError(t)}return e.callback(),!1}return!0})),this.tasks=e.concat(this.tasks),0===this.tasks.length&&this.stop()}scheduleTasks(){this.requestAnimationFrame((()=>{this.flush(),this.isRunning&&this.scheduleTasks()}))}}(F.requestAnimationFrame);class pe{constructor(e,t,n,o,r){this.id=pe.nextId++,this.isCompleted=!1,this.shouldPatch=!0,this.isRendered=!1,this.counter=0,this.vnode=null,this.child=null,this.sibling=null,this.lastChild=null,this.parent=null,this.component=t,this.force=n,this.target=o,this.position=r;const s=t.__owl__;this.scope=s.scope,this.root=e?e.root:this,this.parent=e;let i=s.currentFiber;if(i&&!i.isCompleted){if(this.force=!0,i.root===i&&!e)return this._reuseFiber(i),i;this._remapFiber(i)}this.root.counter++,s.currentFiber=this}_reuseFiber(e){e.cancel(),e.target=this.target||e.target,e.position=this.position||e.position,e.isCompleted=!1,e.isRendered=!1,e.child&&(e.child.parent=null,e.child=null,e.lastChild=null),e.counter=1,e.id=pe.nextId++}_remapFiber(e){if(e.cancel(),this.shouldPatch=e.shouldPatch,e===e.root&&e.counter++,e.parent&&!this.parent)if(this.parent=e.parent,this.root=this.parent.root,this.sibling=e.sibling,this.parent.lastChild===e&&(this.parent.lastChild=this),this.parent.child===e)this.parent.child=this;else{let t=this.parent.child;for(;;){if(t.sibling===e){t.sibling=this;break}t=t.sibling}}}_walk(e){let t=this,n=this;for(;;){const o=e(n);if(o)n=o;else{if(n===t)return;for(;!n.sibling;){if(!n.parent||n.parent===t)return;n=n.parent}n=n.sibling}}}complete(){let e=this.component;this.isCompleted=!0;const t=e.__owl__.status;if(5===t)return;const n=[];this._walk((function(e){return e.component.__owl__.currentFiber=null,n.push(e),e.child}));const o=n.length;if(3===t)for(let t=0;t<o;t++){const o=n[t];o.shouldPatch&&(e=o.component,e.__owl__.willPatchCB&&e.__owl__.willPatchCB(),e.willPatch())}for(let t=o-1;t>=0;t--){const o=n[t];if(e=o.component,o.target&&0===t){let t;if("self"===o.position){if(t=o.target,t.tagName.toLowerCase()!==o.vnode.sel)throw new Error(`Cannot attach '${e.constructor.name}' to target node (not same tag name)`);const n=o.vnode.data?{key:o.vnode.data.key}:{},r=R(o.vnode.sel,n);r.elm=t,t=r}else t=e.__owl__.vnode||document.createElement(o.vnode.sel);e.__patch(t,o.vnode)}else{const t=e.__owl__.vnode;o.shouldPatch&&t?(e.__patch(t,o.vnode),e.__owl__.pvnode&&(e.__owl__.pvnode.elm=e.__owl__.vnode.elm)):(e.__patch(document.createElement(o.vnode.sel),o.vnode),e.__owl__.pvnode.elm=e.__owl__.vnode.elm)}}let r=!1;if(this.target){switch(this.position){case"first-child":this.target.prepend(this.component.el);break;case"last-child":this.target.appendChild(this.component.el)}r=document.body.contains(this.component.el),this.component.env.qweb.trigger("dom-appended")}if(3===t||r)for(let t=o-1;t>=0;t--){const o=n[t];e=o.component,o.shouldPatch&&!this.target?(e.patched(),e.__owl__.patchedCB&&e.__owl__.patchedCB()):e.__callMounted()}else for(let t=o-1;t>=0;t--){e=n[t].component,e.__owl__.status=4}}cancel(){this._walk((e=>(e.isRendered||e.root.counter--,e.isCompleted=!0,e.child)))}handleError(e){let t=this.component;this.vnode=t.__owl__.vnode||R("div");const n=t.env.qweb;let o=t;if(!function e(r){let s=!1;for(n.trigger("error",r);t&&!(s=!!t.catchError);)o=t,t=t.__owl__.parent;if(s){try{t.catchError(r)}catch(n){return o=t,t=t.__owl__.parent,e(n)}return!0}return!1}(e)){this.root.counter=0,this.root.error=e,he.flush();try{o.destroy()}catch(e){}}}}function fe(e,t){if(!0===t)return!0;if("function"==typeof t)return"object"==typeof e?e instanceof t:typeof e===t.name.toLowerCase();if(t instanceof Array){let n=!1;for(let o=0,r=t.length;o<r;o++)n=n||fe(e,t[o]);return n}if(t.optional&&void 0===e)return!0;let n=!t.type||fe(e,t.type);if(t.validate&&(n=n&&t.validate(e)),t.type===Array&&t.element)for(let o=0,r=e.length;o<r;o++)n=n&&fe(e[o],t.element);if(t.type===Object&&t.shape){const o=t.shape;for(let t in o)n=n&&fe(e[t],o[t]);if(n)for(let t in e)if(!(t in o))throw new Error(`unknown prop '${t}'`)}return n}pe.nextId=1,J.utils.validateProps=function(e,t){const n=e.props;if(n instanceof Array){for(let o=0,r=n.length;o<r;o++){const r=n[o];if("?"===r[r.length-1])break;if(!(r in t))throw new Error(`Missing props '${n[o]}' (component '${e.name}')`)}for(let o in t)if(!n.includes(o)&&!n.includes(o+"?"))throw new Error(`Unknown prop '${o}' given to component '${e.name}'`)}else if(n){for(let o in n){if(void 0===t[o]){if(n[o]&&!n[o].optional)throw new Error(`Missing props '${o}' (component '${e.name}')`);continue}let r;try{r=fe(t[o],n[o])}catch(t){throw t.message=`Invalid prop '${o}' in component ${e.name} (${t.message})`,t}if(!r)throw new Error(`Invalid Prop '${o}' in component '${e.name}'`)}for(let o in t)if(!(o in n))throw new Error(`Unknown prop '${o}' given to component '${e.name}'`)}};const me={};function _e(e){const t=e.split(/(\{|\}|;)/).map((e=>e.trim())),n=[],o=[];let r=[];function s(e,t){const o=[];for(const r of n[e]){let i=t&&t+" "+r||r;i.includes("&")&&(i=r.replace(/&/g,t||"")),e<n.length-1&&(i=s(e+1,i)),o.push(i)}return o.join(", ")}function i(){r.length&&(o.push(s(0)+" {"),o.push(...r),o.push("}"),r=[])}for(;t.length;){let e=t.shift();"}"===e?(i(),n.pop()):("{"===t[0]&&(i(),n.push(e.split(/\s*,\s*/)),t.shift()),";"===t[0]&&r.push(" "+e+";"))}return o.join("\n")}function ve(e,t){const n=me[e];if(!n)throw new Error(`Invalid css stylesheet for component '${t}'. Did you forget to use the 'css' tag helper?`);n.setAttribute("component",t),document.head.appendChild(n)}var ge;!function(e){e[e.CREATED=0]="CREATED",e[e.WILLSTARTED=1]="WILLSTARTED",e[e.RENDERED=2]="RENDERED",e[e.MOUNTED=3]="MOUNTED",e[e.UNMOUNTED=4]="UNMOUNTED",e[e.DESTROYED=5]="DESTROYED"}(ge||(ge={}));const we=Symbol("portal");let be=1;class $e{constructor(e,t){$e.current=this;let n=this.constructor;const o=n.defaultProps;o&&(t=t||{},this.__applyDefaultProps(t,o)),this.props=t,J.dev&&J.utils.validateProps(n,this.props);const r=be++;let s;if(e){this.env=e.env;const t=e.__owl__;t.children[r]=this,s=t.depth+1}else this.env=this.constructor.env,this.env.qweb||(this.env.qweb=new J),this.env.browser||(this.env.browser=F),this.env.qweb.on("update",this,(()=>{switch(this.__owl__.status){case 3:this.render(!0);break;case 5:this.env.qweb.off("update",this)}})),s=0;const i=this.env.qweb,a=n.template||this.__getTemplate(i);this.__owl__={id:r,depth:s,vnode:null,pvnode:null,status:0,parent:e||null,children:{},cmap:{},currentFiber:null,parentLastFiberId:0,boundHandlers:{},mountedCB:null,willUnmountCB:null,willPatchCB:null,patchedCB:null,willStartCB:null,willUpdatePropsCB:null,observer:null,renderFn:i.render.bind(i,a),classObj:null,refs:null,scope:null},n.style&&this.__applyStyles(n),this.setup()}get el(){return this.__owl__.vnode?this.__owl__.vnode.elm:null}setup(){}async willStart(){}mounted(){}async willUpdateProps(e){}willPatch(){}patched(){}willUnmount(){}async mount(e,t={}){if(!(e instanceof HTMLElement||e instanceof DocumentFragment)){let e=`Component '${this.constructor.name}' cannot be mounted: the target is not a valid DOM node.`;throw e+="\nMaybe the DOM is not ready yet? (in that case, you can use owl.utils.whenReady)",new Error(e)}const n=t.position||"last-child",o=this.__owl__,r=o.currentFiber;switch(o.status){case 0:{const t=new pe(null,this,!0,e,n);return t.shouldPatch=!1,this.__prepareAndRender(t,(()=>{})),he.addFiber(t)}case 1:case 2:return r.target=e,r.position=n,he.addFiber(r);case 4:{const t=new pe(null,this,!0,e,n);return t.shouldPatch=!1,this.__render(t),he.addFiber(t)}case 3:if("self"!==n&&this.el.parentNode!==e){const t=new pe(null,this,!0,e,n);return t.shouldPatch=!1,this.__render(t),he.addFiber(t)}return Promise.resolve();case 5:throw new Error("Cannot mount a destroyed component")}}unmount(){3===this.__owl__.status&&(this.__callWillUnmount(),this.el.remove())}async render(e=!1){const t=this.__owl__,n=t.currentFiber;if(!t.vnode&&!n)return;if(n&&!n.isRendered&&!n.isCompleted)return he.addFiber(n.root);const o=t.status,r=new pe(null,this,e,null,null);return Promise.resolve().then((()=>{if(3===t.status||3!==o){if(r.isCompleted||r.isRendered)return;this.__render(r)}else r.isCompleted=!0,t.currentFiber=null})),he.addFiber(r)}destroy(){const e=this.__owl__;if(5!==e.status){const t=this.el;this.__destroy(e.parent),t&&t.remove()}}shouldUpdate(e){return!0}trigger(e,t){this.__trigger(this,e,t)}__destroy(e){const t=this.__owl__;3===t.status&&(t.willUnmountCB&&t.willUnmountCB(),this.willUnmount(),t.status=4);const n=t.children;for(let e in n)n[e].__destroy(this);if(e){let n=t.id;delete e.__owl__.children[n],t.parent=null}t.status=5,delete t.vnode,t.currentFiber&&(t.currentFiber.isCompleted=!0)}__callMounted(){const e=this.__owl__;e.status=3,this.mounted(),e.mountedCB&&e.mountedCB()}__callWillUnmount(){const e=this.__owl__;e.willUnmountCB&&e.willUnmountCB(),this.willUnmount(),e.status=4,e.currentFiber&&(e.currentFiber.isCompleted=!0,e.currentFiber.root.counter=0);const t=e.children;for(let e in t){const n=t[e];3===n.__owl__.status&&n.__callWillUnmount()}}__trigger(e,t,n){if(this.el){const o=new de(e,t,{bubbles:!0,cancelable:!0,detail:n}),r=this.env[we];r&&r(o),this.el.dispatchEvent(o)}}async __updateProps(e,t,n){this.__owl__.scope=n;if(t.force||this.shouldUpdate(e)){const n=this.__owl__,o=new pe(t,this,t.force,null,null);t.child?t.lastChild.sibling=o:t.child=o,t.lastChild=o;const r=this.constructor.defaultProps;if(r&&this.__applyDefaultProps(e,r),J.dev&&J.utils.validateProps(this.constructor,e),await Promise.all([this.willUpdateProps(e),n.willUpdatePropsCB&&n.willUpdatePropsCB(e)]),o.isCompleted)return;this.props=e,this.__render(o)}}__patch(e,t){this.__owl__.vnode=S(e,t)}__prepare(e,t,n){this.__owl__.scope=t;const o=new pe(e,this,e.force,null,null);return o.shouldPatch=!1,e.child?e.lastChild.sibling=o:e.child=o,e.lastChild=o,this.__prepareAndRender(o,n),o}__applyStyles(e){for(;e&&e.style;)e.hasOwnProperty("style")&&(ve(e.style,e.name),delete e.style),e=e.__proto__}__getTemplate(e){let t=this.constructor;if(!t.hasOwnProperty("_template")){let n=t.name;for(;!(n in e.templates)&&t!==$e;)t=t.__proto__,n=t.name;if(t===$e)throw new Error(`Could not find template for component "${this.constructor.name}"`);t._template=n}return t._template}async __prepareAndRender(e,t){try{const e=Promise.all([this.willStart(),this.__owl__.willStartCB&&this.__owl__.willStartCB()]);if(this.__owl__.status=1,await e,5===this.__owl__.status)return Promise.resolve()}catch(t){return e.handleError(t),Promise.resolve()}e.isCompleted||(this.__render(e),this.__owl__.status=2,t())}__render(e){const t=this.__owl__;let n;t.observer&&(t.observer.allowMutations=!1);try{let n=t.renderFn(this,{handlers:t.boundHandlers,fiber:e});for(let n in t.children){const o=t.children[n],r=o.__owl__;3!==r.status&&r.parentLastFiberId<e.id&&(o.__destroy(r.parent),r.pvnode&&(delete r.pvnode.key,delete r.pvnode.data.hook.remove))}if(!n)throw new Error(`Rendering '${this.constructor.name}' did not return anything`);if(e.vnode=n,t.classObj){const e=n.data;e.class=Object.assign(e.class||{},t.classObj)}}catch(e){n=e}t.observer&&(t.observer.allowMutations=!0),e.root.counter--,e.isRendered=!0,n&&e.handleError(n)}__applyDefaultProps(e,t){for(let n in t)void 0===e[n]&&(e[n]=t[n])}}async function ye(e,t){const{env:n,props:o,target:r}=t;let s=e.hasOwnProperty("env")?e.env:null;n&&(e.env=n);const i=new e(null,o);s?e.env=s:delete e.env;const a=t.position||"last-child";return await i.mount(r,{position:a}),i}$e.template=null,$e._template=null,$e.current=null,$e.components={},$e.env={},$e.scheduler=he;class xe extends e{constructor(e={}){super(),this.rev=1,this.mapping={},this.observer=new t,this.observer.notifyCB=()=>{let e=this.rev;return Promise.resolve().then((()=>{e===this.rev&&this.__notifyComponents()}))},this.state=this.observer.observe(e),this.subscriptions.update=[]}async __notifyComponents(){const e=++this.rev,t=function(e,t){let n,o=!1;return e.reduce(((e,r)=>{let s=t(r);return o&&(s===n?o.push(r):o=!1),o||(o=[r],e.push(o)),n=s,e}),[])}(this.subscriptions.update,(e=>e.owner?e.owner.__owl__.depth:-1));for(let n of t){const t=n.map((t=>t.callback.call(t.owner,e)));he.flush(),await Promise.all(t)}}}function Ee(e,n,o){const r=n.__owl__,s=r.id,i=e.mapping;if(s in i)return e.state;r.observer||(r.observer=new t,r.observer.notifyCB=n.render.bind(n)),i[s]=0;const a=r.renderFn;r.renderFn=function(t,n){return i[s]=e.rev,a(t,n)},e.on("update",n,(async e=>{i[s]<e&&(i[s]=e,await o())}));const l=n.__destroy;return n.__destroy=t=>{e.off("update",n),delete i[s],l.call(n,t)},e.state}function Ne(e){const n=$e.current,o=n.__owl__;return o.observer||(o.observer=new t,o.observer.notifyCB=n.render.bind(n)),o.observer.observe(e)}function Ce(e,t=!1){return t?function(t){const n=$e.current;if(n.__owl__[e]){const o=n.__owl__[e];n.__owl__[e]=function(){o.call(n),t.call(n)}}else n.__owl__[e]=t}:function(t){const n=$e.current;if(n.__owl__[e]){const o=n.__owl__[e];n.__owl__[e]=function(){t.call(n),o.call(n)}}else n.__owl__[e]=t}}function Le(e){return function(t){const n=$e.current;if(n.__owl__[e]){const o=n.__owl__[e];n.__owl__[e]=function(...e){return Promise.all([o.call(n,...e),t.call(n,...e)])}}else n.__owl__[e]=t}}const Te=Ce("mountedCB",!0),Ae=Ce("willUnmountCB"),De=Ce("willPatchCB"),Pe=Ce("patchedCB",!0),ke=Le("willStartCB"),Ie=Le("willUpdatePropsCB");function Re(e){const t=$e.current;t.env=Object.assign(Object.create(t.env),e)}var Se=Object.freeze({__proto__:null,useState:Ne,onMounted:Te,onWillUnmount:Ae,onWillPatch:De,onPatched:Pe,onWillStart:ke,onWillUpdateProps:Ie,useRef:function(e){const t=$e.current.__owl__;return{get el(){const n=t.refs&&t.refs[e];return n instanceof HTMLElement?n:n instanceof $e?n.el:null},get comp(){const n=t.refs&&t.refs[e];return n instanceof $e?n:null}}},useComponent:function(){return $e.current},useEnv:function(){return $e.current.env},useSubEnv:Re,useExternalListener:function(e,t,n,o){const r=n.bind($e.current);Te((()=>e.addEventListener(t,r,o))),Ae((()=>e.removeEventListener(t,r,o)))}});class Oe extends xe{constructor(e){if(super(e.state),this.actions=e.actions,this.env=e.env,this.getters={},this.updateFunctions=[],e.getters){const t={state:this.state,getters:this.getters};for(let n in e.getters)this.getters[n]=e.getters[n].bind(this,t)}}dispatch(e,...t){if(!this.actions[e])throw new Error(`[Error] action ${e} is undefined`);return this.actions[e]({dispatch:this.dispatch.bind(this),env:this.env,state:this.state,getters:this.getters},...t)}__notifyComponents(){return this.trigger("before-update"),super.__notifyComponents()}}const Fe=(e,t)=>e===t;function Ue(e,...t){const n="__template__"+J.nextId++,o=String.raw(e,...t);return J.registerTemplate(n,o),n}var je=Object.freeze({__proto__:null,xml:Ue,css:function(e,...t){const n="__sheet__"+J.nextId++;return function(e,t){const n=document.createElement("style");n.innerHTML=_e(t),me[e]=n}(n,String.raw(e,...t)),n}});class Me extends $e{async __updateProps(e,t){this.render(t.force)}}Me.template=Ue`<t t-slot="default"/>`;class Be extends $e{constructor(e,t){super(e,t),this.doTargetLookUp=!0,this._handledEvents=new Set,this._handlerTunnel=e=>{e.stopPropagation(),this.__trigger(e.originalComponent,e.type,e.detail)},this.parentEnv=null,this.portal=null,this.target=null,this.parentEnv=e?e.env:{},Re({[we]:e=>{this._handledEvents.has(e.type)||(this.portal.elm.addEventListener(e.type,this._handlerTunnel),this._handledEvents.add(e.type))}})}__callWillUnmount(){super.__callWillUnmount(),this.el.appendChild(this.portal.elm),this.doTargetLookUp=!0}__checkVNodeStructure(e){const t=e.children;let n=0;for(let e of t)e.sel&&n++;if(1!==n)throw new Error(`Portal must have exactly one non-text child (has ${n})`)}__checkTargetPresence(){if(!this.target||!document.contains(this.target))throw new Error(`Could not find any match for "${this.props.target}"`)}__deployPortal(){this.__checkTargetPresence(),this.target.appendChild(this.portal.elm)}__destroy(e){if(this.portal&&this.portal.elm){const e=this.portal.elm,t=e.parentNode;t&&t.removeChild(e)}super.__destroy(e)}__patch(e,t){if(this.doTargetLookUp){const e=document.querySelector(this.props.target);e?(this.doTargetLookUp=!1,this.target=e):this.env.qweb.on("dom-appended",this,(()=>{this.doTargetLookUp=!1,this.env.qweb.off("dom-appended",this),this.target=document.querySelector(this.props.target),this.__deployPortal()}))}this.__checkVNodeStructure(t);const n=(!this.portal||this.el.contains(this.portal.elm))&&!this.doTargetLookUp;this.doTargetLookUp||n||this.__checkTargetPresence();const o=this.portal?this.portal:document.createElement(t.children[0].sel);this.portal=S(o,t.children[0]),t.children=[],super.__patch(e,t),n&&this.__deployPortal()}__trigger(e,t,n){const o=this.env;this.env=this.parentEnv,super.__trigger(e,t,n),this.env=o}}Be.template=Ue`<portal><t t-slot="default"/></portal>`,Be.props={target:{type:String}};class qe extends $e{constructor(){super(...arguments),this.href=this.env.router.destToPath(this.props)}async willUpdateProps(e){this.href=this.env.router.destToPath(e)}get isActive(){return"hash"===this.env.router.mode?document.location.hash===this.href:document.location.pathname===this.href}navigate(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||void 0!==e.button&&0!==e.button)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}e.preventDefault(),this.env.router.navigate(this.props)}}}qe.template=Ue`
|
|
2
|
-
<a t-att-class="{'router-link-active': isActive }"
|
|
3
|
-
t-att-href="href"
|
|
4
|
-
t-on-click="navigate">
|
|
5
|
-
<t t-slot="default"/>
|
|
6
|
-
</a>
|
|
7
|
-
`;class We extends $e{get routeComponent(){return this.env.router.currentRoute&&this.env.router.currentRoute.component}}We.template=Ue`
|
|
8
|
-
<t>
|
|
9
|
-
<t
|
|
10
|
-
t-if="routeComponent"
|
|
11
|
-
t-component="routeComponent"
|
|
12
|
-
t-key="env.router.currentRouteName"
|
|
13
|
-
t-props="env.router.currentParams" />
|
|
14
|
-
</t>
|
|
15
|
-
`;const Ke=/\{\{(.*?)\}\}/,Ve=new RegExp(Ke.source,"g");function ze(e){const t=[];let n;do{n=Ve.exec(e),n&&t.push(n[1])}while(n);return t}function He(e){const t=e.split(Ke).map(((e,t)=>t%2?"(.*)":e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"))).join("");return new RegExp(`^${t}$`)}const Ge=xe,Qe=Ne,Ze={EventBus:e,Observer:t},Ye={Router:class{constructor(e,t,n={mode:"history"}){this.currentRoute=null,this.currentParams=null,e.router=this,this.mode=n.mode,this.env=e,this.routes={},this.routeIds=[];let o=1;for(let e of t)e.name||(e.name="__route__"+o++),e.component&&J.registerComponent("__component__"+e.name,e.component),e.redirect&&this.validateDestination(e.redirect),e.params=e.path?ze(e.path):[],e.extractionRegExp=He(e.path),this.routes[e.name]=e,this.routeIds.push(e.name)}async start(){this._listener=e=>this._navigate(this.currentPath(),e),window.addEventListener("popstate",this._listener),"hash"===this.mode&&window.addEventListener("hashchange",this._listener);const e=await this.matchAndApplyRules(this.currentPath());if("match"===e.type){this.currentRoute=e.route,this.currentParams=e.params;const t=this.routeToPath(e.route,e.params);t!==this.currentPath()&&this.setUrlFromPath(t)}}async navigate(e){const t=this.destToPath(e);return this._navigate(t)}async _navigate(e,t){const n=this.currentRouteName,o=this.currentParams,r=await this.matchAndApplyRules(e);if("match"===r.type){let n=this.routeToPath(r.route,r.params);e.indexOf("?")>-1&&(n+="?"+e.split("?")[1]);t&&t instanceof PopStateEvent||this.setUrlFromPath(n),this.currentRoute=r.route,this.currentParams=r.params}else"nomatch"===r.type&&(this.currentRoute=null,this.currentParams=null);return!(this.currentRouteName===n&&M(this.currentParams,o))&&(this.env.qweb.forceUpdate(),!0)}destToPath(e){return this.validateDestination(e),e.path||this.routeToPath(this.routes[e.to],e.params)}get currentRouteName(){return this.currentRoute&&this.currentRoute.name}setUrlFromPath(e){const t="hash"===this.mode?location.pathname:"",n=location.origin+t+e;n!==window.location.href&&window.history.pushState({},e,n)}validateDestination(e){if(!e.path&&!e.to||e.path&&e.to)throw new Error("Invalid destination: "+JSON.stringify(e))}routeToPath(e,t){return("hash"===this.mode?"#":"")+e.path.replace(Ve,((e,n)=>{const[o]=n.split(".");return t[o]}))}currentPath(){return("history"===this.mode?window.location.pathname:window.location.hash.slice(1))||"/"}match(e){for(let t of this.routeIds){let n=this.routes[t],o=this.getRouteParams(n,e);if(o)return{type:"match",route:n,params:o}}return{type:"nomatch"}}async matchAndApplyRules(e){const t=this.match(e);return"match"===t.type?this.applyRules(t):t}async applyRules(e){const t=e.route;if(t.redirect){const e=this.destToPath(t.redirect);return this.matchAndApplyRules(e)}if(t.beforeRouteEnter){const e=await t.beforeRouteEnter({env:this.env,from:this.currentRoute,to:t});if(!1===e)return{type:"cancelled"};if(!0!==e){const t=this.destToPath(e);return this.matchAndApplyRules(t)}}return e}getRouteParams(e,t){if("*"===e.path)return{};t.indexOf("?")>-1&&(t=t.split("?")[0]),t.startsWith("#")&&(t=t.slice(1));const n=t.match(e.extractionRegExp);if(!n)return!1;const o={};return e.params.forEach(((e,t)=>{const[r,s]=e.split("."),i=n[t+1];return o[r]="number"===s?parseInt(i,10):i})),o}},RouteComponent:We,Link:qe},Je=Oe,Xe=B,et=je,tt={AsyncRoot:Me,Portal:Be},nt=Object.assign({},Se,{useContext:function(e){const t=$e.current;return Ee(e,t,t.render.bind(t))},useDispatch:function(e){return(e=e||$e.current.env.store).dispatch.bind(e)},useGetters:function(e){return(e=e||$e.current.env.store).getters},useStore:function(e,t={}){const n=$e.current,o=n.__owl__.id,r=t.store||n.env.store;if(!(r instanceof Oe))throw new Error(`No store found when connecting '${n.constructor.name}'`);let s=e(r.state,n.props);const i=r.observer.revNumber.bind(r.observer);let a=i(s);const l=t.isEqual||Fe;function c(t,n){const o=s;s=e(t,n);const r=i(s);return(r>0&&a!==r||!l(o,s))&&(a=r,!0)}r.updateFunctions[o]||(r.updateFunctions[o]=[]),t.onUpdate&&r.on("before-update",n,(()=>{const o=e(r.state,n.props);t.onUpdate(o)})),r.updateFunctions[o].push((function(){return c(r.state,n.props)})),Ee(r,n,(function(){let e=!1;for(let t of r.updateFunctions[o])e=t()||e;if(e)return n.render()})),Ie((e=>{c(r.state,e)}));const d=n.__destroy;return n.__destroy=e=>{delete r.updateFunctions[o],t.onUpdate&&r.off("before-update",n),d.call(n,e)},"object"!=typeof s||null===s?s:new Proxy(s,{get:(e,t)=>s[t],set(e,t,n){throw new Error("Store state should only be modified through actions")},has:(e,t)=>t in s})}}),ot={};export{$e as Component,Ge as Context,J as QWeb,Je as Store,ot as __info__,F as browser,ce as config,Ze as core,nt as hooks,tt as misc,ye as mount,Ye as router,et as tags,Qe as useState,Xe as utils};ot.version="1.4.8",ot.date="2021-11-03T12:44:58.365Z",ot.hash="307b936",ot.url="https://github.com/odoo/owl";
|
|
1
|
+
function t(t){t=t.slice();const e=[];let n;for(;(n=t[0])&&"string"==typeof n;)e.push(t.shift());return{modifiers:e,data:t}}const e={shouldNormalizeDom:!0,mainEventHandler:(e,n,o)=>("function"==typeof e?e(n):Array.isArray(e)&&(e=t(e).data)[0](e[1],n),!1)};class n{constructor(t,e){this.key=t,this.child=e}mount(t,e){this.parentEl=t,this.child.mount(t,e)}moveBefore(t,e){this.child.moveBefore(t?t.child:null,e)}patch(t,e){if(this===t)return;let n=this.child,o=t.child;this.key===t.key?n.patch(o,e):(o.mount(this.parentEl,n.firstNode()),e&&n.beforeRemove(),n.remove(),this.child=o,this.key=t.key)}beforeRemove(){this.child.beforeRemove()}remove(){this.child.remove()}firstNode(){return this.child.firstNode()}toString(){return this.child.toString()}}function o(t,e){return new n(t,e)}const{setAttribute:r,removeAttribute:i}=Element.prototype,s=DOMTokenList.prototype,l=s.add,a=s.remove,c=Array.isArray,{split:h,trim:u}=String.prototype,d=/\s+/;function f(t,e){switch(e){case!1:case void 0:i.call(this,t);break;case!0:r.call(this,t,"");break;default:r.call(this,t,e)}}function p(t){return function(e){f.call(this,t,e)}}function m(t){if(c(t))f.call(this,t[0],t[1]);else for(let e in t)f.call(this,e,t[e])}function g(t,e){if(c(t)){const n=t[0],o=t[1];if(n===e[0]){if(o===e[1])return;f.call(this,n,o)}else i.call(this,e[0]),f.call(this,n,o)}else{for(let n in e)n in t||i.call(this,n);for(let n in t){const o=t[n];o!==e[n]&&f.call(this,n,o)}}}function b(t){const e={};switch(typeof t){case"string":const n=u.call(t);if(!n)return{};let o=h.call(n,d);for(let t=0,n=o.length;t<n;t++)e[o[t]]=!0;return e;case"object":for(let n in t){const o=t[n];if(o){const t=h.call(n,d);for(let n of t)e[n]=o}}return e;case"undefined":return{};case"number":return{[t]:!0};default:return{[t]:!0}}}function v(t){t=""===t?{}:b(t);const e=this.classList;for(let n in t)l.call(e,n)}function y(t,e){e=""===e?{}:b(e),t=""===t?{}:b(t);const n=this.classList;for(let o in e)o in t||a.call(n,o);for(let o in t)o in e||l.call(n,o)}function w(t){return function(e){this[t]=e}}function x(t,e){switch(t){case"input":return"checked"===e||"indeterminate"===e||"value"===e||"readonly"===e||"disabled"===e;case"option":return"selected"===e||"disabled"===e;case"textarea":return"value"===e||"readonly"===e||"disabled"===e;case"select":return"value"===e||"disabled"===e;case"button":case"optgroup":return"disabled"===e}return!1}function k(t){const n=t.split(".")[0],o=t.includes(".capture");return t.includes(".synthetic")?function(t,n=!1){let o="__event__synthetic_"+t;n&&(o+="_capture");!function(t,n,o=!1){if(E[n])return;document.addEventListener(t,(t=>function(t,n){let o=n.target;for(;null!==o;){const r=o[t];if(r)for(const t of Object.values(r)){if(e.mainEventHandler(t,n,o))return}o=o.parentNode}}(n,t)),{capture:o}),E[n]=!0}(t,o,n);const r=N++;function i(t){const e=this[o]||{};e[r]=t,this[o]=e}return{setup:i,update:i}}(n,o):function(t,n=!1){let o=`__event__${t}_${$++}`;n&&(o+="_capture");function r(t){const n=t.currentTarget;if(!n||!document.contains(n))return;const r=n[o];r&&e.mainEventHandler(r,t,n)}function i(e){this[o]=e,this.addEventListener(t,r,{capture:n})}function s(t){this[o]=t}return{setup:i,update:s}}(n,o)}let $=1;let N=1;const E={};const A=Node.prototype,T=A.insertBefore,L=(_=A,C="textContent",Object.getOwnPropertyDescriptor(_,C)).set;var _,C;const S=A.removeChild;class D{constructor(t){this.children=t}mount(t,e){const n=this.children,o=n.length,r=new Array(o);for(let i=0;i<o;i++){let o=n[i];if(o)o.mount(t,e);else{const n=document.createTextNode("");r[i]=n,T.call(t,n,e)}}this.anchors=r,this.parentEl=t}moveBefore(t,e){if(t){const n=t.children[0];e=(n?n.firstNode():t.anchors[0])||null}const n=this.children,o=this.parentEl,r=this.anchors;for(let t=0,i=n.length;t<i;t++){let i=n[t];if(i)i.moveBefore(null,e);else{const n=r[t];T.call(o,n,e)}}}patch(t,e){if(this===t)return;const n=this.children,o=t.children,r=this.anchors,i=this.parentEl;for(let t=0,s=n.length;t<s;t++){const s=n[t],l=o[t];if(s)if(l)s.patch(l,e);else{const o=s.firstNode(),l=document.createTextNode("");r[t]=l,T.call(i,l,o),e&&s.beforeRemove(),s.remove(),n[t]=void 0}else if(l){n[t]=l;const e=r[t];l.mount(i,e),S.call(i,e)}}}beforeRemove(){const t=this.children;for(let e=0,n=t.length;e<n;e++){const n=t[e];n&&n.beforeRemove()}}remove(){const t=this.parentEl;if(this.isOnlyChild)L.call(t,"");else{const e=this.children,n=this.anchors;for(let o=0,r=e.length;o<r;o++){const r=e[o];r?r.remove():S.call(t,n[o])}}}firstNode(){const t=this.children[0];return t?t.firstNode():this.anchors[0]}toString(){return this.children.map((t=>t?t.toString():"")).join("")}}function B(t){return new D(t)}const O=Node.prototype,I=CharacterData.prototype,R=O.insertBefore,P=((t,e)=>Object.getOwnPropertyDescriptor(t,e))(I,"data").set,j=O.removeChild;class M{constructor(t){this.text=t}mountNode(t,e,n){this.parentEl=e,R.call(e,t,n),this.el=t}moveBefore(t,e){const n=t?t.el:e;R.call(this.parentEl,this.el,n)}beforeRemove(){}remove(){j.call(this.parentEl,this.el)}firstNode(){return this.el}toString(){return this.text}}class F extends M{mount(t,e){this.mountNode(document.createTextNode(K(this.text)),t,e)}patch(t){const e=t.text;this.text!==e&&(P.call(this.el,K(e)),this.text=e)}}class V extends M{mount(t,e){this.mountNode(document.createComment(K(this.text)),t,e)}patch(){}}function z(t){return new F(t)}function W(t){return new V(t)}function K(t){switch(typeof t){case"string":return t;case"number":return String(t);case"boolean":return t?"true":"false";default:return t||""}}const H=(t,e)=>Object.getOwnPropertyDescriptor(t,e),U=Node.prototype,q=Element.prototype,G=H(CharacterData.prototype,"data").set,X=H(U,"firstChild").get,Y=H(U,"nextSibling").get,Z=()=>{},Q={};function J(t){if(t in Q)return Q[t];const n=(new DOMParser).parseFromString(`<t>${t}</t>`,"text/xml").firstChild.firstChild;e.shouldNormalizeDom&&tt(n);const o=et(n),r=rt(o),i=function(t,e){let n=function(t,e){const{refN:n,collectors:o,children:r}=e,i=o.length;e.locations.sort(((t,e)=>t.idx-e.idx));const s=e.locations.map((t=>({refIdx:t.refIdx,setData:t.setData,updateData:t.updateData}))),l=s.length,a=r.length,c=r,h=n>0,u=U.cloneNode,d=U.insertBefore,f=q.remove;class p{constructor(t){this.data=t}beforeRemove(){}remove(){f.call(this.el)}firstNode(){return this.el}moveBefore(t,e){const n=t?t.el:e;d.call(this.parentEl,this.el,n)}toString(){const t=document.createElement("div");return this.mount(t,null),t.innerHTML}mount(e,n){const o=u.call(t,!0);d.call(e,o,n),this.el=o,this.parentEl=e}patch(t,e){}}h&&(p.prototype.mount=function(e,r){const h=u.call(t,!0),f=new Array(n);this.refs=f,f[0]=h;for(let t=0;t<i;t++){const e=o[t];f[e.idx]=e.getVal.call(f[e.prevIdx])}if(l){const t=this.data;for(let e=0;e<l;e++){const n=s[e];n.setData.call(f[n.refIdx],t[e])}}if(d.call(e,h,r),a){const t=this.children;for(let e=0;e<a;e++){const n=t[e];if(n){const t=c[e],o=t.afterRefIdx?f[t.afterRefIdx]:null;n.isOnlyChild=t.isOnlyChild,n.mount(f[t.parentRefIdx],o)}}}this.el=h,this.parentEl=e},p.prototype.patch=function(t,e){if(this===t)return;const n=this.refs;if(l){const e=this.data,o=t.data;for(let t=0;t<l;t++){const r=e[t],i=o[t];if(r!==i){const e=s[t];e.updateData.call(n[e.refIdx],i,r)}}this.data=o}if(a){let o=this.children;const r=t.children;for(let t=0;t<a;t++){const i=o[t],s=r[t];if(i)s?i.patch(s,e):(e&&i.beforeRemove(),i.remove(),o[t]=void 0);else if(s){const e=c[t],r=e.afterRefIdx?n[e.afterRefIdx]:null;s.mount(n[e.parentRefIdx],r),o[t]=s}}}});return p}(t,e);if(e.cbRefs.length){const t=e.cbRefs,o=e.refList;let r=t.length;n=class extends n{mount(t,e){o.push(new Array(r)),super.mount(t,e);for(let t of o.pop())t()}remove(){super.remove();for(let e of t){(0,this.data[e])(null)}}}}if(e.children.length)return n=class extends n{constructor(t,e){super(t),this.children=e}},n.prototype.beforeRemove=D.prototype.beforeRemove,(t,e=[])=>new n(t,e);return t=>new n(t)}(o.el,r);return Q[t]=i,i}function tt(t){if(t.nodeType!==Node.TEXT_NODE||/\S/.test(t.textContent)){if(t.nodeType!==Node.ELEMENT_NODE||"pre"!==t.tagName)for(let e=t.childNodes.length-1;e>=0;--e)tt(t.childNodes.item(e))}else t.remove()}function et(t,e=null,n=null){switch(t.nodeType){case Node.ELEMENT_NODE:{let o=n&&n.currentNS;const r=t.tagName;let i=void 0;const s=[];if(r.startsWith("block-text-")){const t=parseInt(r.slice(11),10);s.push({type:"text",idx:t}),i=document.createTextNode("")}if(r.startsWith("block-child-")){n.isRef||nt(n);const t=parseInt(r.slice(12),10);s.push({type:"child",idx:t}),i=document.createTextNode("")}const l=t.attributes,a=l.getNamedItem("block-ns");if(a&&(l.removeNamedItem("block-ns"),o=a.value),i||(i=o?document.createElementNS(o,r):document.createElement(r)),i instanceof Element)for(let t=0;t<l.length;t++){const e=l[t].name,n=l[t].value;if(e.startsWith("block-handler-")){const t=parseInt(e.slice(14),10);s.push({type:"handler",idx:t,event:n})}else if(e.startsWith("block-attribute-")){const t=parseInt(e.slice(16),10);s.push({type:"attribute",idx:t,name:n,tag:r})}else"block-attributes"===e?s.push({type:"attributes",idx:parseInt(n,10)}):"block-ref"===e?s.push({type:"ref",idx:parseInt(n,10)}):i.setAttribute(l[t].name,n)}const c={parent:e,firstChild:null,nextSibling:null,el:i,info:s,refN:0,currentNS:o};if(t.firstChild){const e=t.childNodes[0];if(1===t.childNodes.length&&e.nodeType===Node.ELEMENT_NODE&&e.tagName.startsWith("block-child-")){const t=e.tagName,n=parseInt(t.slice(12),10);s.push({idx:n,type:"child",isOnlyChild:!0})}else{c.firstChild=et(t.firstChild,c,c),i.appendChild(c.firstChild.el);let e=t.firstChild,n=c.firstChild;for(;e=e.nextSibling;)n.nextSibling=et(e,n,c),i.appendChild(n.nextSibling.el),n=n.nextSibling}}return c.info.length&&nt(c),c}case Node.TEXT_NODE:case Node.COMMENT_NODE:return{parent:e,firstChild:null,nextSibling:null,el:t.nodeType===Node.TEXT_NODE?document.createTextNode(t.textContent):document.createComment(t.textContent),info:[],refN:0,currentNS:null}}throw new Error("boom")}function nt(t){t.isRef=!0;do{t.refN++}while(t=t.parent)}function ot(t){let e=t.parent;for(;e&&e.nextSibling===t;)t=e,e=e.parent;return e}function rt(t,e,n){if(!e){e={collectors:[],locations:[],children:new Array(t.info.filter((t=>"child"===t.type)).length),cbRefs:[],refN:t.refN,refList:[]},n=0}if(t.refN){const o=n,r=t.isRef,i=t.firstChild?t.firstChild.refN:0,s=t.nextSibling?t.nextSibling.refN:0;if(r){for(let e of t.info)e.refIdx=o;t.refIdx=o,function(t,e){for(let n of e.info)switch(n.type){case"text":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:it,updateData:it});break;case"child":n.isOnlyChild?t.children[n.idx]={parentRefIdx:n.refIdx,isOnlyChild:!0}:t.children[n.idx]={parentRefIdx:ot(e).refIdx,afterRefIdx:n.refIdx};break;case"attribute":{const e=n.refIdx;let o,r;if(x(n.tag,n.name)){const t=w(n.name);r=t,o=t}else"class"===n.name?(r=v,o=y):(r=p(n.name),o=r);t.locations.push({idx:n.idx,refIdx:e,setData:r,updateData:o});break}case"attributes":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:m,updateData:g});break;case"handler":{const{setup:e,update:o}=k(n.event);t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:e,updateData:o});break}case"ref":const o=t.cbRefs.push(n.idx)-1;t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:st(o,t.refList),updateData:Z})}}(e,t),n++}if(s){const r=n+i;e.collectors.push({idx:r,prevIdx:o,getVal:Y}),rt(t.nextSibling,e,r)}i&&(e.collectors.push({idx:n,prevIdx:o,getVal:X}),rt(t.firstChild,e,n))}return e}function it(t){G.call(this,K(t))}function st(t,e){return function(n){e[e.length-1][t]=()=>n(this)}}const lt=Node.prototype,at=lt.insertBefore,ct=lt.appendChild,ht=lt.removeChild,ut=((t,e)=>Object.getOwnPropertyDescriptor(t,e))(lt,"textContent").set;class dt{constructor(t){this.children=t}mount(t,e){const n=this.children,o=document.createTextNode("");this.anchor=o,at.call(t,o,e);const r=n.length;if(r){const e=n[0].mount;for(let i=0;i<r;i++)e.call(n[i],t,o)}this.parentEl=t}moveBefore(t,e){if(t){const n=t.children[0];e=(n?n.firstNode():t.anchor)||null}const n=this.children;for(let t=0,o=n.length;t<o;t++)n[t].moveBefore(null,e);this.parentEl.insertBefore(this.anchor,e)}patch(t,e){if(this===t)return;const n=this.children,o=t.children;if(0===o.length&&0===n.length)return;this.children=o;const r=o[0]||n[0],{mount:i,patch:s,remove:l,beforeRemove:a,moveBefore:c,firstNode:h}=r,u=this.anchor,d=this.isOnlyChild,f=this.parentEl;if(0===o.length&&d){if(e)for(let t=0,e=n.length;t<e;t++)a.call(n[t]);return ut.call(f,""),void ct.call(f,u)}let p=0,m=0,g=n[0],b=o[0],v=n.length-1,y=o.length-1,w=n[v],x=o[y],k=void 0;for(;p<=v&&m<=y;){if(null===g){g=n[++p];continue}if(null===w){w=n[--v];continue}let t=g.key,r=b.key;if(t===r){s.call(g,b,e),o[m]=g,g=n[++p],b=o[++m];continue}let l=w.key,a=x.key;if(l===a){s.call(w,x,e),o[y]=w,w=n[--v],x=o[--y];continue}if(t===a){s.call(g,x,e),o[y]=g;const t=o[y+1];c.call(g,t,u),g=n[++p],x=o[--y];continue}if(l===r){s.call(w,b,e),o[m]=w;const t=n[p];c.call(w,t,u),w=n[--v],b=o[++m];continue}k=k||pt(n,p,v);let d=k[r];if(void 0===d)i.call(b,f,h.call(g)||null);else{const t=n[d];c.call(t,g,null),s.call(t,b,e),o[m]=t,n[d]=null}b=o[++m]}if(p<=v||m<=y)if(p>v){const t=o[y+1],e=t?h.call(t)||null:u;for(let t=m;t<=y;t++)i.call(o[t],f,e)}else for(let t=p;t<=v;t++){let o=n[t];o&&(e&&a.call(o),l.call(o))}}beforeRemove(){const t=this.children,e=t.length;if(e){const n=t[0].beforeRemove;for(let o=0;o<e;o++)n.call(t[o])}}remove(){const{parentEl:t,anchor:e}=this;if(this.isOnlyChild)ut.call(t,"");else{const n=this.children,o=n.length;if(o){const t=n[0].remove;for(let e=0;e<o;e++)t.call(n[e])}ht.call(t,e)}}firstNode(){const t=this.children[0];return t?t.firstNode():void 0}toString(){return this.children.map((t=>t.toString())).join("")}}function ft(t){return new dt(t)}function pt(t,e,n){let o={};for(let r=e;r<=n;r++)o[t[r].key]=r;return o}const mt=Node.prototype,gt=mt.insertBefore,bt=mt.removeChild;class vt{constructor(t){this.content=[],this.html=t}mount(t,e){this.parentEl=t;const n=document.createElement("template");n.innerHTML=this.html,this.content=[...n.content.childNodes];for(let n of this.content)gt.call(t,n,e);if(!this.content.length){const n=document.createTextNode("");this.content.push(n),gt.call(t,n,e)}}moveBefore(t,e){const n=t?t.content[0]:e,o=this.parentEl;for(let t of this.content)gt.call(o,t,n)}patch(t){if(this===t)return;const e=t.html;if(this.html!==e){const n=this.parentEl,o=this.content[0],r=document.createElement("template");r.innerHTML=e;const i=[...r.content.childNodes];for(let t of i)gt.call(n,t,o);if(!i.length){const t=document.createTextNode("");i.push(t),gt.call(n,t,o)}this.remove(),this.content=i,this.html=t.html}}beforeRemove(){}remove(){const t=this.parentEl;for(let e of this.content)bt.call(t,e)}firstNode(){return this.content[0]}toString(){return this.html}}function yt(t){return new vt(t)}function wt(t,e,n=null){t.mount(e,n)}function xt(t,e){const n=e.defaultProps;if(n)for(let e in n)void 0===t[e]&&(t[e]=n[e])}function kt(t,e){if(!0===e)return!0;if("function"==typeof e)return"object"==typeof t?t instanceof e:typeof t===e.name.toLowerCase();if(e instanceof Array){let n=!1;for(let o=0,r=e.length;o<r;o++)n=n||kt(t,e[o]);return n}if(e.optional&&void 0===t)return!0;let n=!e.type||kt(t,e.type);if(e.validate&&(n=n&&e.validate(t)),e.type===Array&&e.element)for(let o=0,r=t.length;o<r;o++)n=n&&kt(t[o],e.element);if(e.type===Object&&e.shape){const o=e.shape;for(let e in o)n=n&&kt(t[e],o[e]);if(n)for(let e in t)if(!(e in o))throw new Error(`unknown prop '${e}'`)}return n}class $t extends EventTarget{trigger(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))}}function Nt(t){return new Promise((function(t){"loading"!==document.readyState?t(!0):document.addEventListener("DOMContentLoaded",t,!1)})).then(t||function(){})}async function Et(t){const e=await fetch(t);if(!e.ok)throw new Error("Error while fetching xml templates");return await e.text()}class At extends String{}function Tt(t){return new At(t)}function Lt(t){const e=t.__owl__.component,n=Object.create(e);for(let e in t)n[e]=t[e];return n}const _t=Symbol("isBoundary");class Ct{constructor(t,e,n){this.fn=t,this.ctx=Lt(e),this.node=n}evaluate(){return this.fn(this.ctx,this.node)}toString(){return this.evaluate().toString()}}let St=new WeakMap;const Dt={withDefault:function(t,e){return null==t||!1===t?e:t},zero:Symbol("zero"),isBoundary:_t,callSlot:function(t,e,n,r,i,s,l){n=n+"__slot_"+r;const a=t.props&&t.props.slots||{},{__render:c,__ctx:h,__scope:u}=a[r]||{},d=Object.create(h||{});u&&(d[u]=s||{});const f=c?c.call(h.__owl__.component,d,e,n):null;if(l){let s=void 0,a=void 0;return f?s=i?o(r,f):f:a=l.call(t.__owl__.component,t,e,n),B([s,a])}return f||z("")},capture:Lt,withKey:function(t,e){return t.key=e,t},prepareList:function(t){let e,n;if(Array.isArray(t))e=t,n=t;else{if(!t)throw new Error("Invalid loop expression");n=Object.keys(t),e=Object.values(t)}const o=n.length;return[e,n,o,new Array(o)]},setContextValue:function(t,e,n){const o=t;for(;!t.hasOwnProperty(e)&&!t.hasOwnProperty(_t);){const e=t.__proto__;if(!e){t=o;break}t=e}t[e]=n},multiRefSetter:function(t,e){let n=0;return o=>{if(o&&(n++,n>1))throw new Error("Cannot have 2 elements with same ref name at the same time");(0===n||o)&&(t[e]=o)}},shallowEqual:function(t,e){for(let n=0,o=t.length;n<o;n++)if(t[n]!==e[n])return!1;return!0},toNumber:function(t){const e=parseFloat(t);return isNaN(e)?t:e},validateProps:function(t,e,n){const o="string"!=typeof t?t:n.constructor.components[t];if(!o)return;xt(e,o);const r=o.defaultProps||{};let i=(s=o.props)instanceof Array?Object.fromEntries(s.map((t=>t.endsWith("?")?[t.slice(0,-1),!1]:[t,!0]))):s||{"*":!0};var s;const l="*"in i;for(let t in i){if("*"===t)continue;const n=i[t];let s,l=!!n;if("object"==typeof n&&"optional"in n&&(l=!n.optional),l&&t in r)throw new Error(`A default value cannot be defined for a mandatory prop (name: '${t}', component: ${o.name})`);if(void 0!==e[t]){try{s=kt(e[t],n)}catch(e){throw e.message=`Invalid prop '${t}' in component ${o.name} (${e.message})`,e}if(!s)throw new Error(`Invalid Prop '${t}' in component '${o.name}'`)}else if(l)throw new Error(`Missing props '${t}' (component '${o.name}')`)}if(!l)for(let t in e)if(!(t in i))throw new Error(`Unknown prop '${t}' given to component '${o.name}'`)},LazyValue:Ct,safeOutput:function(t){if(!t)return t;let e,n;return t instanceof At?(e="string_safe",n=yt(t)):t instanceof Ct?(e="lazy_value",n=t.evaluate()):t instanceof String||"string"==typeof t?(e="string_unsafe",n=z(t)):(e="block_safe",n=t),o(e,n)},bind:function(t,e){let n=t.__owl__.component,o=St.get(n);o||(o=new WeakMap,St.set(n,o));let r=o.get(e);return r||(r=e.bind(n),o.set(e,r)),r}},Bt=new WeakMap,Ot=new WeakMap;function It(t,e,n=!1){if(!t)return!1;const o=t.fiber;o&&Bt.set(o,e);const r=Ot.get(t);if(r){let t=!1;for(let n=r.length-1;n>=0;n--)try{r[n](e),t=!0;break}catch(t){e=t}if(t)return n&&o&&o.node.fiber&&o.root.counter--,!0}return It(t.parent,e)}function Rt(t){const e=t.error,n="node"in t?t.node:t.fiber.node,o="fiber"in t?t.fiber:n.fiber;let r=o;do{r.node.fiber=r,r=r.parent}while(r);Bt.set(o.root,e);if(!It(n,e,!0)){console.warn("[Owl] Unhandled error. Destroying the root component");try{n.app.destroy()}catch(t){console.error(t)}}}function Pt(t,e){let n=t.fiber;if(n){jt(e.root,n.children),n.root=null}return new Mt(t,e)}function jt(t,e){let n=0;for(let o of e)o.node.fiber=null,o.root=t,o.bdom||n++,n+=jt(t,o.children);return n}class Mt{constructor(t,e){if(this.bdom=null,this.children=[],this.appliedToDom=!1,this.node=t,this.parent=e,e){const t=e.root;t.counter++,this.root=t,e.children.push(this)}else this.root=this}}class Ft extends Mt{constructor(){super(...arguments),this.counter=1,this.willPatch=[],this.patched=[],this.mounted=[],this.locked=!1}complete(){const t=this.node;this.locked=!0;let e=void 0;try{for(e of this.willPatch){let t=e.node;if(t.fiber===e){const e=t.component;for(let n of t.willPatch)n.call(e)}}e=void 0,t.patch(),this.locked=!1;let n=this.mounted;for(;e=n.pop();)if(e=e,e.appliedToDom)for(let t of e.node.mounted)t();let o=this.patched;for(;e=o.pop();)if(e=e,e.appliedToDom)for(let t of e.node.patched)t()}catch(t){this.locked=!1,Rt({fiber:e||this,error:t})}}}class Vt extends Ft{constructor(t,e,n={}){super(t,null),this.target=e,this.position=n.position||"last-child"}complete(){let t=this;try{const e=this.node;if(e.app.constructor.validateTarget(this.target),e.bdom)e.updateDom();else if(e.bdom=this.bdom,"last-child"===this.position||0===this.target.childNodes.length)wt(e.bdom,this.target);else{const t=this.target.childNodes[0];wt(e.bdom,this.target,t)}e.fiber=null,e.status=1,this.appliedToDom=!0;let n=this.mounted;for(;t=n.pop();)if(t.appliedToDom)for(let e of t.node.mounted)e()}catch(e){Rt({fiber:t,error:e})}}}let zt=null;function Wt(){if(!zt)throw new Error("No active component (a hook function should only be called in 'setup')");return zt}function Kt(){return zt.component}class Ht{constructor(t,e,n,o){this.fiber=null,this.bdom=null,this.status=0,this.children=Object.create(null),this.refs={},this.willStart=[],this.willUpdateProps=[],this.willUnmount=[],this.mounted=[],this.willPatch=[],this.patched=[],this.willDestroy=[],zt=this,this.app=n,this.parent=o||null,this.level=o?o.level+1:0,xt(e,t);const r=o&&o.childEnv||n.env;this.childEnv=r,this.component=new t(e,r,this),this.renderFn=n.getTemplate(t.template).bind(this.component,this.component,this),this.component.setup(),zt=null}mountComponent(t,e){const n=new Vt(this,t,e);this.app.scheduler.addFiber(n),this.initiateRender(n)}async initiateRender(t){this.fiber=t,this.mounted.length&&t.root.mounted.push(t);const e=this.component;try{await Promise.all(this.willStart.map((t=>t.call(e))))}catch(t){return void Rt({node:this,error:t})}0===this.status&&this.fiber===t&&this._render(t)}async render(){let t=this.fiber;if(t&&t.root.locked&&(await Promise.resolve(),t=this.fiber),t&&!t.bdom&&!Bt.has(t))return;if(!this.bdom&&!t)return;const e=function(t){let e=t.fiber;if(e){let t=e.root;return t.counter-=jt(t,e.children),e.children=[],t.counter++,e.bdom=null,Bt.has(e)&&(Bt.delete(e),Bt.delete(t),e.appliedToDom=!1),e}const n=new Ft(t,null);return t.willPatch.length&&n.willPatch.push(n),t.patched.length&&n.patched.push(n),n}(this);this.fiber=e,this.app.scheduler.addFiber(e),await Promise.resolve(),2!==this.status&&(this.fiber!==e||!t&&e.parent||this._render(e))}_render(t){try{t.bdom=this.renderFn(),t.root.counter--}catch(t){Rt({node:this,error:t})}}destroy(){let t=1===this.status;this._destroy(),t&&this.bdom.remove()}_destroy(){const t=this.component;if(1===this.status)for(let e of this.willUnmount)e.call(t);for(let t of Object.values(this.children))t._destroy();for(let e of this.willDestroy)e.call(t);this.status=2}async updateAndRender(t,e){const n=Pt(this,e);this.fiber=n;const o=this.component;xt(t,o.constructor);const r=Promise.all(this.willUpdateProps.map((e=>e.call(o,t))));if(await r,n!==this.fiber)return;o.props=t,this._render(n);const i=e.root;this.willPatch.length&&i.willPatch.push(n),this.patched.length&&i.patched.push(n)}updateDom(){if(this.fiber)if(this.bdom===this.fiber.bdom)for(let t in this.children){this.children[t].updateDom()}else this.bdom.patch(this.fiber.bdom,!1),this.fiber.appliedToDom=!0,this.fiber=null}firstNode(){const t=this.bdom;return t?t.firstNode():void 0}mount(t,e){const n=this.fiber.bdom;this.bdom=n,n.mount(t,e),this.status=1,this.fiber.appliedToDom=!0,this.fiber=null}moveBefore(t,e){this.bdom.moveBefore(t?t.bdom:null,e)}patch(){const t=Object.keys(this.children).length>0;this.bdom.patch(this.fiber.bdom,t),t&&this.cleanOutdatedChildren(),this.fiber.appliedToDom=!0,this.fiber=null}beforeRemove(){this._destroy()}remove(){this.bdom.remove()}cleanOutdatedChildren(){const t=this.children;for(const e in t){const n=t[e],o=n.status;1!==o&&(delete t[e],2!==o&&n.destroy())}}}function Ut(t){const e=Wt();e.willStart.push(t.bind(e.component))}function qt(t){const e=Wt();e.willUpdateProps.push(t.bind(e.component))}function Gt(t){const e=Wt();e.mounted.push(t.bind(e.component))}function Xt(t){const e=Wt();e.willPatch.unshift(t.bind(e.component))}function Yt(t){const e=Wt();e.patched.push(t.bind(e.component))}function Zt(t){const e=Wt();e.willUnmount.unshift(t.bind(e.component))}function Qt(t){const e=Wt();e.willDestroy.push(t.bind(e.component))}function Jt(t){const e=Wt(),n=e.renderFn;e.renderFn=()=>(t.call(e.component),n())}function te(t){const e=Wt(),n=e.renderFn;e.renderFn=()=>{const o=n();return t.call(e.component),o}}function ee(t){const e=Wt();let n=Ot.get(e);n||(n=[],Ot.set(e,n)),n.push(t.bind(e.component))}const ne="true,false,NaN,null,undefined,debugger,console,window,in,instanceof,new,function,return,this,eval,void,Math,RegExp,Array,Object,Date".split(","),oe=Object.assign(Object.create(null),{and:"&&",or:"||",gt:">",gte:">=",lt:"<",lte:"<="}),re=Object.assign(Object.create(null),{"{":"LEFT_BRACE","}":"RIGHT_BRACE","[":"LEFT_BRACKET","]":"RIGHT_BRACKET",":":"COLON",",":"COMMA","(":"LEFT_PAREN",")":"RIGHT_PAREN"}),ie="...,.,===,==,+,!==,!=,!,||,&&,>=,>,<=,<,?,-,*,/,%,typeof ,=>,=,;,in ".split(",");const se=[function(t){let e=t[0],n=e;if("'"!==e&&'"'!==e&&"`"!==e)return!1;let o,r=1;for(;t[r]&&t[r]!==n;){if(o=t[r],e+=o,"\\"===o){if(r++,o=t[r],!o)throw new Error("Invalid expression");e+=o}r++}if(t[r]!==n)throw new Error("Invalid expression");return e+=n,"`"===n?{type:"TEMPLATE_STRING",value:e,replace:t=>e.replace(/\$\{(.*?)\}/g,((e,n)=>"${"+t(n)+"}"))}:{type:"VALUE",value:e}},function(t){let e=t[0];if(e&&e.match(/[0-9]/)){let n=1;for(;t[n]&&t[n].match(/[0-9]|\./);)e+=t[n],n++;return{type:"VALUE",value:e}}return!1},function(t){for(let e of ie)if(t.startsWith(e))return{type:"OPERATOR",value:e};return!1},function(t){let e=t[0];if(e&&e.match(/[a-zA-Z_\$]/)){let n=1;for(;t[n]&&t[n].match(/\w/);)e+=t[n],n++;return e in oe?{type:"OPERATOR",value:oe[e],size:e.length}:{type:"SYMBOL",value:e}}return!1},function(t){const e=t[0];return!(!e||!(e in re))&&{type:re[e],value:e}}];const le=t=>t&&("LEFT_BRACE"===t.type||"COMMA"===t.type),ae=t=>t&&("RIGHT_BRACE"===t.type||"COMMA"===t.type);function ce(t){const e=new Set,n=function(t){const e=[];let n=!0;for(;n;)if(t=t.trim()){for(let o of se)if(n=o(t),n){e.push(n),t=t.slice(n.size||n.value.length);break}}else n=!1;if(t.length)throw new Error(`Tokenizer error: could not tokenize "${t}"`);return e}(t);let o=0,r=[];for(;o<n.length;){let t=n[o],i=n[o-1],s=n[o+1],l=r[r.length-1];switch(t.type){case"LEFT_BRACE":case"LEFT_BRACKET":r.push(t.type);break;case"RIGHT_BRACE":case"RIGHT_BRACKET":r.pop()}let a="SYMBOL"===t.type&&!ne.includes(t.value);if("SYMBOL"!==t.type||ne.includes(t.value)||i&&("LEFT_BRACE"===l&&le(i)&&ae(s)&&(n.splice(o+1,0,{type:"COLON",value:":"},{...t}),s=n[o+1]),"OPERATOR"===i.type&&"."===i.value?a=!1:"LEFT_BRACE"!==i.type&&"COMMA"!==i.type||s&&"COLON"===s.type&&(a=!1)),"TEMPLATE_STRING"===t.type&&(t.value=t.replace((t=>he(t)))),s&&"OPERATOR"===s.type&&"=>"===s.value)if("RIGHT_PAREN"===t.type){let t=o-1;for(;t>0&&"LEFT_PAREN"!==n[t].type;)"SYMBOL"===n[t].type&&n[t].originalValue&&(n[t].value=n[t].originalValue,e.add(n[t].value)),t--}else e.add(t.value);a&&(t.varName=t.value,e.has(t.value)||(t.originalValue=t.value,t.value=`ctx['${t.value}']`)),o++}for(const t of n)"SYMBOL"===t.type&&t.varName&&e.has(t.value)&&(t.originalValue=t.value,t.value="_"+t.value,t.isLocal=!0);return n}function he(t){return ce(t).map((t=>t.value)).join("")}const ue=/\{\{.*?\}\}/g,de=/\{\{.*?\}\}/g;function fe(t){let e=t.match(ue);return e&&e[0].length===t.length?`(${he(t.slice(2,-2))})`:"`"+t.replace(de,(t=>"${"+he(t.slice(2,-2))+"}"))+"`"}const pe=document.implementation.createDocument(null,null,null),me=new Set(["stop","capture","prevent","self","synthetic"]);class ge{constructor(t,e){this.dynamicTagName=null,this.isRoot=!1,this.hasDynamicChildren=!1,this.children=[],this.data=[],this.childNumber=0,this.parentVar="",this.id=ge.nextBlockId++,this.varName="b"+this.id,this.blockName="block"+this.id,this.target=t,this.type=e}static generateId(t){return this.nextDataIds[t]=(this.nextDataIds[t]||0)+1,t+this.nextDataIds[t]}insertData(t,e="d"){const n=ge.generateId(e);return this.target.addLine(`let ${n} = ${t};`),this.data.push(n)-1}insert(t){this.currentDom?this.currentDom.appendChild(t):this.dom=t}generateExpr(t){if("block"===this.type){const t=this.children.length;let e=this.data.length?`[${this.data.join(", ")}]`:t?"[]":"";return t&&(e+=", ["+this.children.map((t=>t.varName)).join(", ")+"]"),this.dynamicTagName?`toggler(${this.dynamicTagName}, ${this.blockName}(${this.dynamicTagName})(${e}))`:`${this.blockName}(${e})`}return"list"===this.type?`list(c_block${this.id})`:t}asXmlString(){const t=pe.createElement("t");return t.appendChild(this.dom),t.innerHTML}}function be(t,e){return Object.assign({block:null,index:0,forceNewBlock:!0,translate:t.translate,tKeyExpr:null,nameSpace:t.nameSpace,tModelSelectedExpr:t.tModelSelectedExpr},e)}ge.nextBlockId=1,ge.nextDataIds={};class ve{constructor(t){this.indentLevel=0,this.loopLevel=0,this.code=[],this.hasRoot=!1,this.hasCache=!1,this.hasRef=!1,this.refInfo={},this.shouldProtectScope=!1,this.name=t}addLine(t,e){const n=new Array(this.indentLevel+2).join(" ");void 0===e?this.code.push(n+t):this.code.splice(e,0,n+t)}generateCode(){let t=[];if(t.push(`function ${this.name}(ctx, node, key = "") {`),this.hasRef){t.push(" const refs = ctx.__owl__.refs;");for(let e in this.refInfo){const[n,o]=this.refInfo[e];t.push(` const ${n} = ${o};`)}}this.shouldProtectScope&&(t.push(" ctx = Object.create(ctx);"),t.push(" ctx[isBoundary] = 1")),this.hasCache&&(t.push(" let cache = ctx.cache || {};"),t.push(" let nextCache = ctx.cache = {};"));for(let e of this.code)t.push(e);return this.hasRoot||t.push("return text('');"),t.push("}"),t.join("\n ")}}const ye=["label","title","placeholder","alt"],we=/^(\s*)([\s\S]+?)(\s*)$/;class xe{constructor(t,e){if(this.blocks=[],this.ids={},this.nextBlockId=1,this.isDebug=!1,this.targets=[],this.target=new ve("template"),this.translatableAttributes=ye,this.staticCalls=[],this.helpers=new Set,this.translateFn=e.translateFn||(t=>t),e.translatableAttributes){const t=new Set(ye);for(let n of e.translatableAttributes)n.startsWith("-")?t.delete(n.slice(1)):t.add(n);this.translatableAttributes=[...t]}this.hasSafeContext=e.hasSafeContext||!1,this.dev=e.dev||!1,this.ast=t,this.templateName=e.name}generateCode(){const t=this.ast;this.isDebug=12===t.type,ge.nextBlockId=1,ge.nextDataIds={},this.compileAST(t,{block:null,index:0,forceNewBlock:!1,isLast:!0,translate:!0,tKeyExpr:null});let e=[" let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;"];this.helpers.size&&e.push(`let { ${[...this.helpers].join(", ")} } = helpers;`),this.templateName&&e.push(`// Template name: "${this.templateName}"`);for(let{id:t,template:n}of this.staticCalls)e.push(`const ${t} = getTemplate(${n});`);if(this.blocks.length){e.push("");for(let t of this.blocks)if(t.dom){let n=t.asXmlString();t.dynamicTagName?(n=n.replace(/^<\w+/,`<\${tag || '${t.dom.nodeName}'}`),n=n.replace(/\w+>$/,`\${tag || '${t.dom.nodeName}'}>`),e.push(`let ${t.blockName} = tag => createBlock(\`${n}\`);`)):e.push(`let ${t.blockName} = createBlock(\`${n}\`);`)}}if(this.targets.length)for(let t of this.targets)e.push(""),e=e.concat(t.generateCode());e.push(""),e=e.concat("return "+this.target.generateCode());const n=e.join("\n ");if(this.isDebug){const t="[Owl Debug]\n"+n;console.log(t)}return n}compileInNewTarget(t,e,n){const o=this.generateId(t),r=this.target,i=new ve(o);this.targets.push(i),this.target=i;const s=be(n);return this.compileAST(e,s),this.target=r,o}addLine(t){this.target.addLine(t)}generateId(t=""){return this.ids[t]=(this.ids[t]||0)+1,t+this.ids[t]}insertAnchor(t){const e="block-child-"+t.children.length,n=pe.createElement(e);t.insert(n)}createBlock(t,e,n){const o=this.target.hasRoot,r=new ge(this.target,e);return o||n.preventRoot||(this.target.hasRoot=!0,r.isRoot=!0),t&&(t.children.push(r),"list"===t.type&&(r.parentVar="c_block"+t.id)),r}insertBlock(t,e,n){let o=e.generateExpr(t);const r=n.tKeyExpr;if(e.parentVar){let t="key"+this.target.loopLevel;return r&&(t=`${r} + ${t}`),this.helpers.add("withKey"),void this.addLine(`${e.parentVar}[${n.index}] = withKey(${o}, ${t});`)}r&&(o=`toggler(${r}, ${o})`),e.isRoot&&!n.preventRoot?this.addLine(`return ${o};`):this.addLine(`let ${e.varName} = ${o};`)}captureExpression(t,e=!1){if(!e&&!t.includes("=>"))return he(t);const n=ce(t),o=new Map;return n.map((t=>{if(t.varName&&!t.isLocal){if(!o.has(t.varName)){const e=this.generateId("v");o.set(t.varName,e),this.addLine(`const ${e} = ${t.value};`)}t.value=o.get(t.varName)}return t.value})).join("")}compileAST(t,e){switch(t.type){case 1:this.compileComment(t,e);break;case 0:this.compileText(t,e);break;case 2:this.compileTDomNode(t,e);break;case 4:this.compileTEsc(t,e);break;case 8:this.compileTOut(t,e);break;case 5:this.compileTIf(t,e);break;case 9:this.compileTForeach(t,e);break;case 10:this.compileTKey(t,e);break;case 3:this.compileMulti(t,e);break;case 7:this.compileTCall(t,e);break;case 15:this.compileTCallBlock(t,e);break;case 6:this.compileTSet(t,e);break;case 11:this.compileComponent(t,e);break;case 12:this.compileDebug(t,e);break;case 13:this.compileLog(t,e);break;case 14:this.compileTSlot(t,e);break;case 16:this.compileTTranslation(t,e);break;case 17:this.compileTPortal(t,e)}}compileDebug(t,e){this.addLine("debugger;"),t.content&&this.compileAST(t.content,e)}compileLog(t,e){this.addLine(`console.log(${he(t.expr)});`),t.content&&this.compileAST(t.content,e)}compileComment(t,e){let{block:n,forceNewBlock:o}=e;if(!n||o)n=this.createBlock(n,"comment",e),this.insertBlock(`comment(\`${t.value}\`)`,n,{...e,forceNewBlock:o&&!n});else{const e=pe.createComment(t.value);n.insert(e)}}compileText(t,e){let{block:n,forceNewBlock:o}=e,r=t.value;if(r&&!1!==e.translate){const t=we.exec(r);r=t[1]+this.translateFn(t[2])+t[3]}if(!n||o)n=this.createBlock(n,"text",e),this.insertBlock(`text(\`${r}\`)`,n,{...e,forceNewBlock:o&&!n});else{const e=0===t.type?pe.createTextNode:pe.createComment;n.insert(e.call(pe,r))}}generateHandlerCode(t,e){const n=t.split(".").slice(1).map((t=>{if(!me.has(t))throw new Error(`Unknown event modifier: '${t}'`);return`"${t}"`}));let o="";return n.length&&(o=n.join(",")+", "),`[${o}${this.captureExpression(e)}, ctx]`}compileTDomNode(t,e){let{block:n,forceNewBlock:o}=e;const r=!n||o||null!==t.dynamicTag||t.ns;let i=this.target.code.length;if(r&&((t.dynamicTag||e.tKeyExpr||t.ns)&&e.block&&this.insertAnchor(e.block),n=this.createBlock(n,"block",e),this.blocks.push(n),t.dynamicTag)){const e=this.generateId("tag");this.addLine(`let ${e} = ${he(t.dynamicTag)};`),n.dynamicTagName=e}const s={},l=t.ns||e.nameSpace;l&&r&&(s["block-ns"]=l);for(let o in t.attrs){let r,i;if(o.startsWith("t-attf")){r=fe(t.attrs[o]);const e=n.insertData(r,"attr");i=o.slice(7),s["block-attribute-"+e]=i}else if(o.startsWith("t-att")){r=he(t.attrs[o]);const e=n.insertData(r,"attr");"t-att"===o?s["block-attributes"]=String(e):(i=o.slice(6),s["block-attribute-"+e]=i)}else this.translatableAttributes.includes(o)?s[o]=this.translateFn(t.attrs[o]):(r=`"${t.attrs[o]}"`,i=o,s[o]=t.attrs[o]);if("value"===i&&e.tModelSelectedExpr){s["block-attribute-"+n.insertData(`${e.tModelSelectedExpr} === ${r}`,"attr")]="selected"}}for(let e in t.on){const o=this.generateHandlerCode(e,t.on[e]);s["block-handler-"+n.insertData(o,"hdlr")]=e}if(t.ref){this.target.hasRef=!0;if(ue.test(t.ref)){const e=t.ref.replace(ue,(t=>"${"+this.captureExpression(t.slice(2,-2),!0)+"}")),o=n.insertData(`(el) => refs[\`${e}\`] = el`,"ref");s["block-ref"]=String(o)}else{let e=t.ref;if(e in this.target.refInfo){this.helpers.add("multiRefSetter");const t=this.target.refInfo[e],o=n.data.push(t[0])-1;s["block-ref"]=String(o),t[1]=`multiRefSetter(refs, \`${e}\`)`}else{let t=this.generateId("ref");this.target.refInfo[e]=[t,`(el) => refs[\`${e}\`] = el`];const o=n.data.push(t)-1;s["block-ref"]=String(o)}}}let a;if(t.model){const{hasDynamicChildren:e,baseExpr:o,expr:r,eventType:i,shouldNumberize:l,shouldTrim:c,targetAttr:h,specialInitTargetAttr:u}=t.model,d=he(o),f=this.generateId("bExpr");this.addLine(`const ${f} = ${d};`);const p=he(r),m=this.generateId("expr");this.addLine(`const ${m} = ${p};`);const g=`${f}[${m}]`;let b;if(u)b=n.insertData(`${g} === '${s[h]}'`,"attr"),s["block-attribute-"+b]=u;else if(e){a=""+this.generateId("bValue"),this.addLine(`let ${a} = ${g}`)}else b=n.insertData(""+g,"attr"),s["block-attribute-"+b]=h;this.helpers.add("toNumber");let v="ev.target."+h;v=c?v+".trim()":v,v=l?`toNumber(${v})`:v;const y=`[(ev) => { ${g} = ${v}; }]`;b=n.insertData(y,"hdlr"),s["block-handler-"+b]=i}const c=pe.createElement(t.tag);for(const[t,e]of Object.entries(s))"class"===t&&""===e||c.setAttribute(t,e);if(n.insert(c),t.content.length){const o=n.currentDom;n.currentDom=c;const r=t.content;for(let o=0;o<r.length;o++){const i=t.content[o],s=be(e,{block:n,index:n.childNumber,forceNewBlock:!1,isLast:e.isLast&&o===r.length-1,tKeyExpr:e.tKeyExpr,nameSpace:l,tModelSelectedExpr:a});this.compileAST(i,s)}n.currentDom=o}if(r&&(this.insertBlock(n.blockName+"(ddd)",n,e),n.children.length&&n.hasDynamicChildren)){const t=this.target.code,e=n.children.slice();let o=e.shift();for(let n=i;n<t.length&&(!t[n].trimStart().startsWith(`let ${o.varName} `)||(t[n]=t[n].replace("let "+o.varName,o.varName),o=e.shift(),o));n++);this.target.addLine(`let ${n.children.map((t=>t.varName))};`,i)}}compileTEsc(t,e){let n,{block:o,forceNewBlock:r}=e;if("0"===t.expr?(this.helpers.add("zero"),n="ctx[zero]"):(n=he(t.expr),t.defaultValue&&(this.helpers.add("withDefault"),n=`withDefault(${n}, \`${t.defaultValue}\`)`)),!o||r)o=this.createBlock(o,"text",e),this.insertBlock(`text(${n})`,o,{...e,forceNewBlock:r&&!o});else{const t=o.insertData(n,"txt"),e=pe.createElement("block-text-"+t);o.insert(e)}}compileTOut(t,e){let{block:n}=e;n&&this.insertAnchor(n),n=this.createBlock(n,"html",e),this.helpers.add("0"===t.expr?"zero":"safeOutput");let o="0"===t.expr?"ctx[zero]":`safeOutput(${he(t.expr)})`;if(t.body){const n=ge.nextBlockId,r=be(e);this.compileAST({type:3,content:t.body},r),this.helpers.add("withDefault"),o=`withDefault(${o}, b${n})`}this.insertBlock(""+o,n,e)}compileTIf(t,e,n){let{block:o,forceNewBlock:r,index:i}=e,s=i;const l=this.target.code.length,a=!o||"multi"!==o.type&&r;o&&(o.hasDynamicChildren=!0),(!o||"multi"!==o.type&&r)&&(o=this.createBlock(o,"multi",e)),this.addLine(`if (${he(t.condition)}) {`),this.target.indentLevel++,this.insertAnchor(o);const c=be(e,{block:o,index:s});if(this.compileAST(t.content,c),this.target.indentLevel--,t.tElif)for(let n of t.tElif){this.addLine(`} else if (${he(n.condition)}) {`),this.target.indentLevel++,this.insertAnchor(o);const t=be(e,{block:o,index:s});this.compileAST(n.content,t),this.target.indentLevel--}if(t.tElse){this.addLine("} else {"),this.target.indentLevel++,this.insertAnchor(o);const n=be(e,{block:o,index:s});this.compileAST(t.tElse,n),this.target.indentLevel--}if(this.addLine("}"),a){if(o.children.length){const t=this.target.code,e=o.children.slice();let n=e.shift();for(let o=l;o<t.length&&(!t[o].trimStart().startsWith(`let ${n.varName} `)||(t[o]=t[o].replace("let "+n.varName,n.varName),n=e.shift(),n));o++);this.target.addLine(`let ${o.children.map((t=>t.varName))};`,l)}const t=o.children.map((t=>t.varName)).join(", ");this.insertBlock(`multi([${t}])`,o,e)}}compileTForeach(t,e){let{block:n}=e;n&&this.insertAnchor(n),n=this.createBlock(n,"list",e),this.target.loopLevel++;const o="i"+this.target.loopLevel;this.addLine("ctx = Object.create(ctx);");const r="v_block"+n.id,i="k_block"+n.id,s="l_block"+n.id,l="c_block"+n.id;let a;this.helpers.add("prepareList"),this.addLine(`const [${i}, ${r}, ${s}, ${l}] = prepareList(${he(t.collection)});`),this.dev&&this.addLine(`const keys${n.id} = new Set();`),this.addLine(`for (let ${o} = 0; ${o} < ${s}; ${o}++) {`),this.target.indentLevel++,this.addLine(`ctx[\`${t.elem}\`] = ${r}[${o}];`),t.hasNoFirst||this.addLine(`ctx[\`${t.elem}_first\`] = ${o} === 0;`),t.hasNoLast||this.addLine(`ctx[\`${t.elem}_last\`] = ${o} === ${r}.length - 1;`),t.hasNoIndex||this.addLine(`ctx[\`${t.elem}_index\`] = ${o};`),t.hasNoValue||this.addLine(`ctx[\`${t.elem}_value\`] = ${i}[${o}];`),this.addLine(`let key${this.target.loopLevel} = ${t.key?he(t.key):o};`),this.dev&&(this.addLine(`if (keys${n.id}.has(key${this.target.loopLevel})) { throw new Error(\`Got duplicate key in t-foreach: \${key${this.target.loopLevel}}\`)}`),this.addLine(`keys${n.id}.add(key${this.target.loopLevel});`)),t.memo&&(this.target.hasCache=!0,a=this.generateId(),this.addLine(`let memo${a} = ${he(t.memo)}`),this.addLine(`let vnode${a} = cache[key${this.target.loopLevel}];`),this.addLine(`if (vnode${a}) {`),this.target.indentLevel++,this.addLine(`if (shallowEqual(vnode${a}.memo, memo${a})) {`),this.target.indentLevel++,this.addLine(`${l}[${o}] = vnode${a};`),this.addLine(`nextCache[key${this.target.loopLevel}] = vnode${a};`),this.addLine("continue;"),this.target.indentLevel--,this.addLine("}"),this.target.indentLevel--,this.addLine("}"));const c=be(e,{block:n,index:o});this.compileAST(t.body,c),t.memo&&this.addLine(`nextCache[key${this.target.loopLevel}] = Object.assign(${l}[${o}], {memo: memo${a}});`),this.target.indentLevel--,this.target.loopLevel--,this.addLine("}"),e.isLast||this.addLine("ctx = ctx.__proto__;"),this.insertBlock("l",n,e)}compileTKey(t,e){const n=this.generateId("tKey_");this.addLine(`const ${n} = ${he(t.expr)};`),e=be(e,{tKeyExpr:n,block:e.block,index:e.index}),this.compileAST(t.content,e)}compileMulti(t,e){let{block:n,forceNewBlock:o}=e;const r=!n||o;let i=this.target.code.length;if(r){if(t.content.filter((t=>6!==t.type)).length<=1){for(let n of t.content)this.compileAST(n,e);return}n=this.createBlock(n,"multi",e)}let s=0;for(let o=0,r=t.content.length;o<r;o++){const i=t.content[o],l=6===i.type,a=be(e,{block:n,index:s,forceNewBlock:!l,preventRoot:e.preventRoot,isLast:e.isLast&&o===r-1});this.compileAST(i,a),l||s++}if(r){if(n.hasDynamicChildren&&n.children.length){const t=this.target.code,e=n.children.slice();let o=e.shift();for(let n=i;n<t.length&&(!t[n].trimStart().startsWith(`let ${o.varName} `)||(t[n]=t[n].replace("let "+o.varName,o.varName),o=e.shift(),o));n++);this.target.addLine(`let ${n.children.map((t=>t.varName))};`,i)}const t=n.children.map((t=>t.varName)).join(", ");this.insertBlock(`multi([${t}])`,n,e)}}compileTCall(t,e){let{block:n,forceNewBlock:o}=e;if(t.body){this.addLine("ctx = Object.create(ctx);"),this.addLine("ctx[isBoundary] = 1;"),this.helpers.add("isBoundary");const n=ge.nextBlockId,o=be(e,{preventRoot:!0});this.compileAST({type:3,content:t.body},o),n!==ge.nextBlockId&&(this.helpers.add("zero"),this.addLine(`ctx[zero] = b${n};`))}const r=ue.test(t.name),i=r?fe(t.name):"`"+t.name+"`";n&&(o||this.insertAnchor(n));const s=`key + \`${this.generateComponentKey()}\``;if(r){const t=this.generateId("template");this.addLine(`const ${t} = ${i};`),n=this.createBlock(n,"multi",e),this.helpers.add("call"),this.insertBlock(`call(this, ${t}, ctx, node, ${s})`,n,{...e,forceNewBlock:!n})}else{const t=this.generateId("callTemplate_");this.helpers.add("getTemplate"),this.staticCalls.push({id:t,template:i}),n=this.createBlock(n,"multi",e),this.insertBlock(`${t}.call(this, ctx, node, ${s})`,n,{...e,forceNewBlock:!n})}t.body&&!e.isLast&&this.addLine("ctx = ctx.__proto__;")}compileTCallBlock(t,e){let{block:n,forceNewBlock:o}=e;n&&(o||this.insertAnchor(n)),n=this.createBlock(n,"multi",e),this.insertBlock(he(t.name),n,{...e,forceNewBlock:!n})}compileTSet(t,e){this.target.shouldProtectScope=!0,this.helpers.add("isBoundary").add("withDefault");const n=t.value?he(t.value||""):"null";if(t.body){this.helpers.add("LazyValue");const o={type:3,content:t.body};let r=`new LazyValue(${this.compileInNewTarget("value",o,e)}, ctx, node)`;r=t.value?r?`withDefault(${n}, ${r})`:n:r,this.addLine(`ctx[\`${t.name}\`] = ${r};`)}else{let e;e=t.defaultValue?t.value?`withDefault(${n}, \`${t.defaultValue}\`)`:`\`${t.defaultValue}\``:n,this.helpers.add("setContextValue"),this.addLine(`setContextValue(ctx, "${t.name}", ${e});`)}}generateComponentKey(){const t=[this.generateId("__")];for(let e=0;e<this.target.loopLevel;e++)t.push(`\${key${e+1}}`);return t.join("__")}formatProp(t,e){if(e=this.captureExpression(e),t.includes(".")){let[n,o]=t.split(".");if("bind"!==o)throw new Error("Invalid prop suffix");this.helpers.add("bind"),t=n,e=`bind(ctx, ${e||void 0})`}return`${t=/^[a-z_]+$/i.test(t)?t:`'${t}'`}: ${e||void 0}`}formatPropObject(t){const e=[];for(const[n,o]of Object.entries(t))e.push(this.formatProp(n,o));return e.join(", ")}compileComponent(t,e){let{block:n}=e;const o="slots"in t.props,r=[],i=this.formatPropObject(t.props);i&&r.push(i);let s="";if(!!Object.keys(t.slots).length){let n="ctx";!this.target.loopLevel&&this.hasSafeContext||(n=this.generateId("ctx"),this.helpers.add("capture"),this.addLine(`const ${n} = capture(ctx);`));let o=[];for(let r in t.slots){const i=t.slots[r].content,s=[`__render: ${this.compileInNewTarget("slot",i,e)}, __ctx: ${n}`],l=t.slots[r].scope;l&&s.push(`__scope: "${l}"`),t.slots[r].attrs&&s.push(this.formatPropObject(t.slots[r].attrs));const a=`{${s.join(", ")}}`;o.push(`'${r}': ${a}`)}s=`{${o.join(", ")}}`}!s||t.dynamicProps||o||r.push("slots: "+s);const l=`{${r.join(",")}}`;let a,c=l;t.dynamicProps&&(c=r.length?`Object.assign({}, ${he(t.dynamicProps)}, ${l})`:`Object.assign({}, ${he(t.dynamicProps)})`),(s&&(t.dynamicProps||o)||this.dev)&&(a=this.generateId("props"),this.addLine(`const ${a} = ${c};`),c=a),s&&(t.dynamicProps||o)&&this.addLine(`${a}.slots = Object.assign(${s}, ${a}.slots)`);const h=this.generateComponentKey();let u;t.isDynamic?(u=this.generateId("Comp"),this.addLine(`let ${u} = ${he(t.name)};`)):u=`\`${t.name}\``,this.dev&&this.addLine(`helpers.validateProps(${u}, ${a}, ctx);`),n&&(!1===e.forceNewBlock||e.tKeyExpr)&&this.insertAnchor(n);let d=`key + \`${h}\``;e.tKeyExpr&&(d=`${e.tKeyExpr} + ${d}`);let f=`component(${`${u}, ${c}, ${d}, node, ctx`})`;t.isDynamic&&(f=`toggler(${u}, ${f})`),n=this.createBlock(n,"multi",e),this.insertBlock(f,n,e)}compileTSlot(t,e){this.helpers.add("callSlot");let n,o,{block:r}=e,i=!1;t.name.match(ue)?(i=!0,o=fe(t.name)):o="'"+t.name+"'";const s=t.attrs?`{${this.formatPropObject(t.attrs)}}`:null;if(t.defaultContent){n=`callSlot(ctx, node, key, ${o}, ${i}, ${s}, ${this.compileInNewTarget("defaultContent",t.defaultContent,e)})`}else if(i){let t=this.generateId("slot");this.addLine(`const ${t} = ${o};`),n=`toggler(${t}, callSlot(ctx, node, key, ${t}), ${i}, ${s})`}else n=`callSlot(ctx, node, key, ${o}, ${i}, ${s})`;r&&this.insertAnchor(r),r=this.createBlock(r,"multi",e),this.insertBlock(n,r,{...e,forceNewBlock:!1})}compileTTranslation(t,e){t.content&&this.compileAST(t.content,Object.assign({},e,{translate:!1}))}compileTPortal(t,e){this.helpers.add("Portal");let{block:n}=e;const o=this.compileInNewTarget("slot",t.content,e),r=this.generateComponentKey();let i="ctx";!this.target.loopLevel&&this.hasSafeContext||(i=this.generateId("ctx"),this.helpers.add("capture"),this.addLine(`const ${i} = capture(ctx);`));const s=`component(Portal, {target: ${t.target},slots: {'default': {__render: ${o}, __ctx: ${i}}}}, key + \`${r}\`, node, ctx)`;n&&this.insertAnchor(n),n=this.createBlock(n,"multi",e),this.insertBlock(s,n,{...e,forceNewBlock:!1})}}const ke=new WeakMap;function $e(t){if("string"==typeof t){return Ne(function(t){const e=(new DOMParser).parseFromString(t,"text/xml");if(e.getElementsByTagName("parsererror").length){let n="Invalid XML in template.";const o=e.getElementsByTagName("parsererror")[0].textContent;if(o){n+="\nThe parser has produced the following error message:\n"+o;const e=/\d+/g,r=e.exec(o);if(r){const i=Number(r[0]),s=t.split("\n")[i-1],l=e.exec(o);if(s&&l){const t=Number(l[0])-1;s[t]&&(n+=`\nThe error might be located at xml line ${i} column ${t}\n${s}\n${"-".repeat(t-1)}^`)}}}throw new Error(n)}return e}(`<t>${t}</t>`).firstChild)}let e=ke.get(t);return e||(e=Ne(t.cloneNode(!0)),ke.set(t,e)),e}function Ne(t){var e;(function(t){let e=t.querySelectorAll("[t-elif], [t-else]");for(let t=0,n=e.length;t<n;t++){let n=e[t],o=n.previousElementSibling,r=t=>o.getAttribute(t),i=t=>+!!n.getAttribute(t);if(!o||!r("t-if")&&!r("t-elif"))throw new Error("t-elif and t-else directives must be preceded by a t-if or t-elif directive");{if(r("t-foreach"))throw new Error("t-if cannot stay at the same level as t-foreach when using t-elif or t-else");if(["t-if","t-elif","t-else"].map(i).reduce((function(t,e){return t+e}))>1)throw new Error("Only one conditional branching directive is allowed per node");let t;for(;(t=n.previousSibling)!==o;){if(t.nodeValue.trim().length&&8!==t.nodeType)throw new Error("text is not allowed between branching directives");t.remove()}}}})(e=t),function(t){const e=[...t.querySelectorAll("[t-esc]")].filter((t=>t.tagName[0]===t.tagName[0].toUpperCase()||t.hasAttribute("t-component")));for(const t of e){if(t.childNodes.length)throw new Error("Cannot have t-esc on a component that already has content");const e=t.getAttribute("t-esc");t.removeAttribute("t-esc");const n=t.ownerDocument.createElement("t");null!=e&&n.setAttribute("t-esc",e),t.appendChild(n)}}(e);return Ee(t,{inPreTag:!1,inSVG:!1})||{type:0,value:""}}function Ee(t,e){return t instanceof Element?function(t,e){if(t.hasAttribute("t-debug"))return t.removeAttribute("t-debug"),{type:12,content:Ee(t,e)};if(t.hasAttribute("t-log")){const n=t.getAttribute("t-log");return t.removeAttribute("t-log"),{type:13,expr:n,content:Ee(t,e)}}return null}(t,e)||function(t,e){if(!t.hasAttribute("t-foreach"))return null;const n=t.outerHTML,o=t.getAttribute("t-foreach");t.removeAttribute("t-foreach");const r=t.getAttribute("t-as")||"";t.removeAttribute("t-as");const i=t.getAttribute("t-key");if(!i)throw new Error(`"Directive t-foreach should always be used with a t-key!" (expression: t-foreach="${o}" t-as="${r}")`);t.removeAttribute("t-key");const s=t.getAttribute("t-memo")||"";t.removeAttribute("t-memo");const l=Ee(t,e);if(!l)return null;const a=!n.includes("t-call"),c=a&&!n.includes(r+"_first"),h=a&&!n.includes(r+"_last"),u=a&&!n.includes(r+"_index"),d=a&&!n.includes(r+"_value");return{type:9,collection:o,elem:r,body:l,memo:s,key:i,hasNoFirst:c,hasNoLast:h,hasNoIndex:u,hasNoValue:d}}(t,e)||function(t,e){if(!t.hasAttribute("t-if"))return null;const n=t.getAttribute("t-if");t.removeAttribute("t-if");const o=Ee(t,e)||{type:0,value:""};let r=t.nextElementSibling;const i=[];for(;r&&r.hasAttribute("t-elif");){const t=r.getAttribute("t-elif");r.removeAttribute("t-elif");const n=Ee(r,e),o=r.nextElementSibling;r.remove(),r=o,n&&i.push({condition:t,content:n})}let s=null;r&&r.hasAttribute("t-else")&&(r.removeAttribute("t-else"),s=Ee(r,e),r.remove());return{type:5,condition:n,content:o,tElif:i.length?i:null,tElse:s}}(t,e)||function(t,e){if(!t.hasAttribute("t-portal"))return null;const n=t.getAttribute("t-portal");t.removeAttribute("t-portal");const o=Ee(t,e);if(!o)return{type:0,value:""};return{type:17,target:n,content:o}}(t,e)||function(t,e){if(!t.hasAttribute("t-call"))return null;const n=t.getAttribute("t-call");if(t.removeAttribute("t-call"),"t"!==t.tagName){const o=Ee(t,e),r={type:7,name:n,body:null};if(o&&2===o.type)return o.content=[r],o;if(o&&11===o.type)return{...o,slots:{default:{content:r}}}}const o=De(t,e);return{type:7,name:n,body:o.length?o:null}}(t,e)||function(t,e){if(!t.hasAttribute("t-call-block"))return null;return{type:15,name:t.getAttribute("t-call-block")}}(t)||function(t,e){if(!t.hasAttribute("t-esc"))return null;const n=t.getAttribute("t-esc");t.removeAttribute("t-esc");const o={type:4,expr:n,defaultValue:t.textContent||""};let r=t.getAttribute("t-ref");t.removeAttribute("t-ref");const i=Ee(t,e);if(!i)return o;if(2===i.type)return{...i,ref:r,content:[o]};if(11===i.type)throw new Error("t-esc is not supported on Component nodes");return o}(t,e)||function(t,e){if(!t.hasAttribute("t-key"))return null;const n=t.getAttribute("t-key");t.removeAttribute("t-key");const o=Ee(t,e);if(!o)return null;return{type:10,expr:n,content:o}}(t,e)||function(t,e){if("off"!==t.getAttribute("t-translation"))return null;return t.removeAttribute("t-translation"),{type:16,content:Ee(t,e)}}(t,e)||function(t,e){if(!t.hasAttribute("t-slot"))return null;const n=t.getAttribute("t-slot");t.removeAttribute("t-slot");const o={};for(let e of t.getAttributeNames()){const n=t.getAttribute(e);o[e]=n}return{type:14,name:n,attrs:o,defaultContent:Be(t,e)}}(t,e)||function(t,e){if(!t.hasAttribute("t-out")&&!t.hasAttribute("t-raw"))return null;t.hasAttribute("t-raw")&&console.warn('t-raw has been deprecated in favor of t-out. If the value to render is not wrapped by the "markup" function, it will be escaped');const n=t.getAttribute("t-out")||t.getAttribute("t-raw");t.removeAttribute("t-out"),t.removeAttribute("t-raw");const o={type:8,expr:n,body:null},r=t.getAttribute("t-ref");t.removeAttribute("t-ref");const i=Ee(t,e);if(!i)return o;if(2===i.type)return o.body=i.content.length?i.content:null,{...i,ref:r,content:[o]};return o}(t,e)||function(t,e){let n=t.tagName;const o=n[0];let r=t.hasAttribute("t-component");if(r&&"t"!==n)throw new Error(`Directive 't-component' can only be used on <t> nodes (used on a <${n}>)`);if(o!==o.toUpperCase()&&!r)return null;r&&(n=t.getAttribute("t-component"),t.removeAttribute("t-component"));const i=t.getAttribute("t-props");t.removeAttribute("t-props");const s=t.getAttribute("t-slot-scope");t.removeAttribute("t-slot-scope");const l={};for(let e of t.getAttributeNames()){const n=t.getAttribute(e);if(e.startsWith("t-")){const t=Se.get(e.split("-").slice(0,2).join("-"));throw new Error(t||"unsupported directive on Component: "+e)}l[e]=n}const a={};if(t.hasChildNodes()){const n=t.cloneNode(!0),o=Array.from(n.querySelectorAll("[t-set-slot]"));for(let t of o){if("t"!==t.tagName)throw new Error(`Directive 't-set-slot' can only be used on <t> nodes (used on a <${t.tagName}>)`);const o=t.getAttribute("t-set-slot");let r=t.parentElement,i=!1;for(;r!==n;){if(r.hasAttribute("t-component")||r.tagName[0]===r.tagName[0].toUpperCase()){i=!0;break}r=r.parentElement}if(i)continue;t.removeAttribute("t-set-slot"),t.remove();const s=Ee(t,e);if(s){const e={content:s},n={};for(let o of t.getAttributeNames()){const r=t.getAttribute(o);"t-slot-scope"!==o?n[o]=r:e.scope=r}Object.keys(n).length&&(e.attrs=n),a[o]=e}}const r=Be(n,e);r&&(a.default={content:r},s&&(a.default.scope=s))}return{type:11,name:n,isDynamic:r,dynamicProps:i,props:l,slots:a}}(t,e)||function(t,e){const{tagName:n}=t,o=t.getAttribute("t-tag");if(t.removeAttribute("t-tag"),"t"===n&&!o)return null;e=Object.assign({},e),"pre"===n&&(e.inPreTag=!0);const r=Ce.has(n)&&!e.inSVG;e.inSVG=e.inSVG||r;const i=r?"http://www.w3.org/2000/svg":null,s=t.getAttribute("t-ref");t.removeAttribute("t-ref");const l=t.getAttributeNames(),a={},c={};let h=null;for(let o of l){const r=t.getAttribute(o);if(o.startsWith("t-on")){if("t-on"===o)throw new Error("Missing event name with t-on directive");c[o.slice(5)]=r}else if(o.startsWith("t-model")){if(!["input","select","textarea"].includes(n))throw new Error("The t-model directive only works with <input>, <textarea> and <select>");let i,s;if(Le.test(r)){const t=r.lastIndexOf(".");i=r.slice(0,t),s=`'${r.slice(t+1)}'`}else{if(!_e.test(r))throw new Error(`Invalid t-model expression: "${r}" (it should be assignable)`);{const t=r.lastIndexOf("[");i=r.slice(0,t),s=r.slice(t+1,-1)}}const l=t.getAttribute("type"),a="input"===n,c="select"===n,u="textarea"===n,d=a&&"checkbox"===l,f=a&&"radio"===l,p=a&&!d&&!f,m=o.includes(".lazy"),g=o.includes(".number");h={baseExpr:i,expr:s,targetAttr:d?"checked":"value",specialInitTargetAttr:f?"checked":null,eventType:f?"click":c||m?"change":"input",shouldTrim:o.includes(".trim")&&(p||u),shouldNumberize:g&&(p||u)},c&&((e=Object.assign({},e)).tModelInfo=h)}else if("t-name"!==o){if(o.startsWith("t-")&&!o.startsWith("t-att"))throw new Error(`Unknown QWeb directive: '${o}'`);const t=e.tModelInfo;t&&["t-att-value","t-attf-value"].includes(o)&&(t.hasDynamicChildren=!0),a[o]=r}}const u=De(t,e);return{type:2,tag:n,dynamicTag:o,attrs:a,on:c,ref:s,content:u,model:h,ns:i}}(t,e)||function(t,e){if(!t.hasAttribute("t-set"))return null;const n=t.getAttribute("t-set"),o=t.getAttribute("t-value")||null,r=t.innerHTML===t.textContent&&t.textContent||null;let i=null;t.textContent!==t.innerHTML&&(i=De(t,e));return{type:6,name:n,value:o,defaultValue:r,body:i}}(t,e)||function(t,e){if("t"!==t.tagName)return null;return Be(t,e)}(t,e):function(t,e){if(t.nodeType===Node.TEXT_NODE){let n=t.textContent||"";if(!e.inPreTag){if(Ae.test(n)&&!n.trim())return null;n=n.replace(Te," ")}return{type:0,value:n}}if(t.nodeType===Node.COMMENT_NODE)return{type:1,value:t.textContent||""};return null}(t,e)}const Ae=/[\r\n]/,Te=/\s+/g;const Le=/\.[\w_]+\s*$/,_e=/\[[^\[]+\]\s*$/,Ce=new Set(["svg","g","path"]);const Se=new Map([["t-on","t-on is no longer supported on components. Consider passing a callback in props."],["t-ref","t-ref is no longer supported on components. Consider exposing only the public part of the component's API through a callback prop."],["t-att","t-att makes no sense on component: props are already treated as expressions"],["t-attf","t-attf is not supported on components: use template strings for string interpolation in props"]]);function De(t,e){const n=[];for(let o of t.childNodes){const t=Ee(o,e);t&&(3===t.type?n.push(...t.content):n.push(t))}return n}function Be(t,e){const n=De(t,e);switch(n.length){case 0:return null;case 1:return n[0];default:return{type:3,content:n}}}const Oe={text:z,createBlock:J,list:ft,multi:B,html:yt,toggler:o,component:function(t,e,n,o,r){let i=o.children[n],s="string"!=typeof t;i&&(i.status<1?(i.destroy(),i=void 0):2===i.status&&(i=void 0)),s&&i&&i.component.constructor!==t&&(i=void 0);const l=o.fiber;if(i)i.updateAndRender(e,l);else{let a;if(s)a=t;else if(a=r.constructor.components[t],!a)throw new Error(`Cannot find the definition of component "${t}"`);i=new Ht(a,e,o.app,o),o.children[n]=i;const c=Pt(i,l);i.initiateRender(c)}return i},comment:W},Ie={};function Re(...t){const e="__template__"+Re.nextId++,n=String.raw(...t);return Ie[e]=n,e}Re.nextId=1;class Pe{constructor(t,e,n){this.props=t,this.env=e,this.__owl__=n}setup(){}render(){this.__owl__.render()}}Pe.template="";const je=z("").constructor;class Me extends je{constructor(t,e){super(""),this.target=null,this.selector=t,this.realBDom=e}mount(t,e){if(super.mount(t,e),this.target=document.querySelector(this.selector),!this.target){let t=this.el;for(;t&&t.parentElement instanceof HTMLElement;)t=t.parentElement;if(this.target=t&&t.querySelector(this.selector),!this.target)throw new Error("invalid portal target")}this.realBDom.mount(this.target,null)}beforeRemove(){this.realBDom.beforeRemove()}remove(){this.realBDom&&(super.remove(),this.realBDom.remove(),this.realBDom=null)}patch(t){super.patch(t),this.realBDom?this.realBDom.patch(t.realBDom,!0):(this.realBDom=t.realBDom,this.realBDom.mount(this.target,null))}}class Fe extends Pe{setup(){const t=this.__owl__,e=t.renderFn;t.renderFn=()=>new Me(this.props.target,e()),Zt((()=>{t.bdom&&t.bdom.remove()}))}}Fe.template=Re`<t t-slot="default"/>`,Fe.props={target:{type:String},slots:!0};class Ve{constructor(){this.tasks=new Set,this.isRunning=!1,this.requestAnimationFrame=Ve.requestAnimationFrame}start(){this.isRunning=!0,this.scheduleTasks()}stop(){this.isRunning=!1}addFiber(t){this.tasks.add(t.root),this.isRunning||this.start()}flush(){this.tasks.forEach((t=>{if(t.root!==t)return void this.tasks.delete(t);const e=Bt.has(t);e&&0!==t.counter?this.tasks.delete(t):2!==t.node.status?0===t.counter&&(e||t.complete(),this.tasks.delete(t)):this.tasks.delete(t)})),0===this.tasks.size&&this.stop()}scheduleTasks(){this.requestAnimationFrame((()=>{this.flush(),this.isRunning&&this.scheduleTasks()}))}}Ve.requestAnimationFrame=window.requestAnimationFrame.bind(window);class ze extends class{constructor(t={}){this.rawTemplates=Object.create(Ie),this.templates={},this.utils=Object.assign({},Dt,{call:(t,e,n,r,i)=>o(e,this.getTemplate(e).call(t,n,r,i)),getTemplate:t=>this.getTemplate(t)}),this.dev=t.dev||!1,this.translateFn=t.translateFn,this.translatableAttributes=t.translatableAttributes,t.templates&&this.addTemplates(t.templates)}addTemplate(t,e,n={}){if(t in this.rawTemplates&&!n.allowDuplicate)throw new Error(`Template ${t} already defined`);this.rawTemplates[t]=e}addTemplates(t,e={}){if(t){t=t instanceof Document?t:function(t){const e=(new DOMParser).parseFromString(t,"text/xml");if(e.getElementsByTagName("parsererror").length){let n="Invalid XML in template.";const o=e.getElementsByTagName("parsererror")[0].textContent;if(o){n+="\nThe parser has produced the following error message:\n"+o;const e=/\d+/g,r=e.exec(o);if(r){const i=Number(r[0]),s=t.split("\n")[i-1],l=e.exec(o);if(s&&l){const t=Number(l[0])-1;s[t]&&(n+=`\nThe error might be located at xml line ${i} column ${t}\n${s}\n${"-".repeat(t-1)}^`)}}}throw new Error(n)}return e}(t);for(const n of t.querySelectorAll("[t-name]")){const t=n.getAttribute("t-name");this.addTemplate(t,n,e)}}}getTemplate(t){if(!(t in this.templates)){const e=this.rawTemplates[t];if(void 0===e)throw new Error(`Missing template: "${t}"`);const n=this._compileTemplate(t,e),o=this.templates;this.templates[t]=function(e,n){return o[t].call(this,e,n)};const r=n(Oe,this.utils);this.templates[t]=r}return this.templates[t]}_compileTemplate(t,e){return function(t,e={}){const n=$e(t),o=t instanceof Node?!(t instanceof Element)||null===t.querySelector("[t-set], [t-call]"):!t.includes("t-set")&&!t.includes("t-call"),r=new xe(n,{...e,hasSafeContext:o}).generateCode();return new Function("bdom, helpers",r)}(e,{name:t,dev:this.dev,translateFn:this.translateFn,translatableAttributes:this.translatableAttributes})}}{constructor(t,e={}){super(e),this.scheduler=new Ve,this.root=null,this.Root=t,e.test&&(this.dev=!0),this.dev&&!e.test&&console.info("Owl is running in 'dev' mode.\n\nThis is not suitable for production use.\nSee https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for more information.");const n=Object.getOwnPropertyDescriptors(e.env||{});this.env=Object.freeze(Object.defineProperties({},n)),this.props=e.props||{}}mount(t,e){ze.validateTarget(t);const n=this.makeNode(this.Root,this.props),o=this.mountNode(n,t,e);return this.root=n,o}makeNode(t,e){return new Ht(t,e,this)}mountNode(t,e,n){const o=new Promise(((e,n)=>{let o=!1;t.mounted.push((()=>{e(t.component),o=!0}));let r=Ot.get(t);r||(r=[],Ot.set(t,r)),r.unshift((t=>{throw o?console.error(t):n(t),t}))}));return t.mountComponent(e,n),o}destroy(){this.root&&this.root.destroy()}}async function We(t,e,n={}){return new ze(t,n).mount(e,n)}function Ke(t){switch(t.__owl__.status){case 0:return"new";case 1:return"mounted";case 2:return"destroyed"}}ze.validateTarget=function(t){if(!(t instanceof HTMLElement))throw new Error("Cannot mount component: the target is not a valid DOM element");if(!document.body.contains(t))throw new Error("Cannot mount a component on a detached dom node")};class He extends Pe{constructor(t,e,n){super(t,e,n);let o=!1;const r=n.patch;n.patch=()=>{o&&(r.call(n),o=!1)};let i=t;const s=n.updateAndRender;n.updateAndRender=function(t,e){return!function(t,e){for(let n in t)if("slots"!==n&&t[n]!==e[n])return!1;return!0}(i,t)&&(i=t,s.call(n,t,e),o=!0),Promise.resolve()}}}He.template=Re`<t t-slot="default"/>`;const Ue=Symbol("Target"),qe=Symbol("Skip"),Ge=Symbol("Key changes"),Xe=Object.prototype.toString;function Ye(t){if("object"!=typeof t)return!1;const e=Xe.call(t).slice(8,-1);return"Object"===e||"Array"===e}function Ze(t){return t[qe]=!0,t}function Qe(t){return t[Ue]}const Je=new WeakMap;function tn(t,e,n){Je.get(t)||Je.set(t,new Map);const o=Je.get(t);o.get(e)||o.set(e,new Set),o.get(e).add(n),nn.has(n)||nn.set(n,new Set),nn.get(n).add(t)}function en(t,e){const n=Je.get(t);if(!n)return;const o=n.get(e);if(o)for(const t of[...o])on(t),t()}const nn=new WeakMap;function on(t){const e=nn.get(t);if(e){for(const n of e){const e=Je.get(n);if(e)for(const n of e.values())n.delete(t)}e.clear()}}const rn=new WeakMap;function sn(t,e=(()=>{})){if(!Ye(t))throw new Error("Cannot make the given value reactive");if(qe in t)return t;const n=t[Ue];if(n)return sn(n,e);rn.has(t)||rn.set(t,new Map);const o=rn.get(t);if(!o.has(e)){const n=new Proxy(t,{get(t,n,o){if(n===Ue)return t;tn(t,n,e);const r=Reflect.get(t,n,o);return Ye(r)?sn(r,e):r},set(t,e,n,o){const r=!Object.hasOwnProperty.call(t,e),i=Reflect.get(t,e,o),s=Reflect.set(t,e,n,o);return r&&en(t,Ge),(i!==n||Array.isArray(t)&&"length"===e)&&en(t,e),s},deleteProperty(t,e){const n=Reflect.deleteProperty(t,e);return en(t,Ge),en(t,e),n},ownKeys:t=>(tn(t,Ge,e),Reflect.ownKeys(t)),has:(t,n)=>(tn(t,Ge,e),Reflect.has(t,n))});o.set(e,n)}return o.get(e)}const ln=new WeakMap;function an(t){const e=Wt();ln.has(e)||(ln.set(e,function(t){let e=!1;return async()=>{await Promise.resolve(),e||(e=!0,t(),await Promise.resolve(),e=!1)}}((()=>e.render()))),Qt((()=>on(n))));const n=ln.get(e);return sn(t,n)}function cn(t){const e=Wt().refs;return{get el(){return e[t]||null}}}function hn(){return Wt().component.env}function un(t,e){const n=Object.create(t),o=Object.getOwnPropertyDescriptors(e);return Object.freeze(Object.defineProperties(n,o))}function dn(t){const e=Wt();e.component.env=un(e.component.env,t),fn(t)}function fn(t){const e=Wt();e.childEnv=un(e.childEnv,t)}const pn=()=>{};function mn(t,e=(()=>[NaN])){let n,o;Gt((()=>{o=e(),n=t(...o)||pn})),Yt((()=>{const r=e();r.some(((t,e)=>t!==o[e]))&&(o=r,n(),n=t(...o)||pn)})),Zt((()=>n()))}function gn(t,e,n,o){const r=Wt(),i=n.bind(r.component);Gt((()=>t.addEventListener(e,i,o))),Zt((()=>t.removeEventListener(e,i,o)))}e.shouldNormalizeDom=!1,e.mainEventHandler=(e,n,o)=>{const{data:r,modifiers:i}=t(e);e=r;let s=!1;if(i.length){let t=!1;const e=n.target===o;for(const o of i)switch(o){case"self":if(t=!0,e)continue;return s;case"prevent":(t&&e||!t)&&n.preventDefault();continue;case"stop":(t&&e||!t)&&n.stopPropagation(),s=!0;continue}}if(Object.hasOwnProperty.call(e,0)){const t=e[0];if("function"!=typeof t)throw new Error(`Invalid handler (expected a function, received: '${t}')`);let o=e[1]?e[1].__owl__:null;o&&1!==o.status||t.call(o?o.component:null,n)}return s},Dt.Portal=Fe;const bn={config:e,mount:wt,patch:function(t,e,n=!1){t.patch(e,n)},remove:function(t,e=!1){e&&t.beforeRemove(),t.remove()},list:ft,multi:B,text:z,toggler:o,createBlock:J,html:yt,comment:W},vn={};export{ze as App,Pe as Component,$t as EventBus,He as Memo,vn as __info__,bn as blockDom,Et as loadFile,Ze as markRaw,Tt as markup,We as mount,ee as onError,Gt as onMounted,Yt as onPatched,te as onRendered,Qt as onWillDestroy,Xt as onWillPatch,Jt as onWillRender,Ut as onWillStart,Zt as onWillUnmount,qt as onWillUpdateProps,sn as reactive,Ke as status,Qe as toRaw,fn as useChildSubEnv,Kt as useComponent,mn as useEffect,hn as useEnv,gn as useExternalListener,cn as useRef,an as useState,dn as useSubEnv,Nt as whenReady,Re as xml};vn.version="2.0.0-alpha.2",vn.date="2022-02-14T12:42:47.468Z",vn.hash="4a922ed",vn.url="https://github.com/odoo/owl";
|