@odoo/owl 1.4.5 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});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:":"},{...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 W=["label","title","placeholder","alt"],q=/[\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(q.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&&W.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} = _${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:W};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."):console.log("Owl is now running in 'prod' mode.")}}),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 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 o.shouldPatch?(e.__patch(e.__owl__.vnode,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);const r=e.__owl__;o===r.currentFiber&&(r.currentFiber=null)}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,e.currentFiber=null,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])}}$e.template=null,$e._template=null,$e.current=null,$e.components={},$e.env={},$e.scheduler=he;class ye 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 xe(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 Ee(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 Ne(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 Ce(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 Le=Ne("mountedCB",!0),Te=Ne("willUnmountCB"),Ae=Ne("willPatchCB"),De=Ne("patchedCB",!0),Pe=Ce("willStartCB"),ke=Ce("willUpdatePropsCB");function Ie(e){const t=$e.current;t.env=Object.assign(Object.create(t.env),e)}var Re=Object.freeze({__proto__:null,useState:Ee,onMounted:Le,onWillUnmount:Te,onWillPatch:Ae,onPatched:De,onWillStart:Pe,onWillUpdateProps:ke,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:Ie,useExternalListener:function(e,t,n,o){const r=n.bind($e.current);Le((()=>e.addEventListener(t,r,o))),Te((()=>e.removeEventListener(t,r,o)))}});class Se extends ye{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 Oe=(e,t)=>e===t;function Fe(e,...t){const n="__template__"+J.nextId++,o=String.raw(e,...t);return J.registerTemplate(n,o),n}var Ue=Object.freeze({__proto__:null,xml:Fe,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 je extends $e{async __updateProps(e,t){this.render(t.force)}}je.template=Fe`<t t-slot="default"/>`;class Me 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:{},Ie({[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}}Me.template=Fe`<portal><t t-slot="default"/></portal>`,Me.props={target:{type:String}};class Be 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)}}}Be.template=Fe`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});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){const o=new Set;t=Object.create(t);const r=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 s=0,c=[];for(;s<r.length;){let e=r[s],i=r[s-1],u=r[s+1],h=c[c.length-1];switch(e.type){case"LEFT_BRACE":case"LEFT_BRACKET":c.push(e.type);break;case"RIGHT_BRACE":case"RIGHT_BRACKET":c.pop()}let p="SYMBOL"===e.type&&!n.includes(e.value);if("SYMBOL"!==e.type||n.includes(e.value)||i&&("LEFT_BRACE"===h&&a(i)&&l(u)&&(r.splice(s+1,0,{type:"COLON",value:":"},Object.assign({},e)),u=r[s+1]),"OPERATOR"===i.type&&"."===i.value?p=!1:"LEFT_BRACE"!==i.type&&"COMMA"!==i.type||u&&"COLON"===u.type&&(p=!1)),"TEMPLATE_STRING"===e.type&&(e.value=e.replace((e=>d(e,t)))),u&&"OPERATOR"===u.type&&"=>"===u.value)if("RIGHT_PAREN"===e.type){let e=s-1;for(;e>0&&"LEFT_PAREN"!==r[e].type;)"SYMBOL"===r[e].type&&r[e].originalValue&&(r[e].value=r[e].originalValue,t[r[e].value]={id:r[e].value,expr:r[e].value},o.add(r[e].value)),e--}else t[e.value]={id:e.value,expr:e.value},o.add(e.value);p&&(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}']`)),s++}for(const e of r)"SYMBOL"===e.type&&o.has(e.value)&&(e.isLocal=!0);return r}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=>("this"===e.value&&(o.has("this")||(o.add("this"),this.addLine(`const this_${t} = utils.getComponent(context);`)),e.value=`this_${t}`),e.varName&&!e.isLocal&&(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 $={create:w,update:w};function b(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:b,update:b};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],$=n[g];for(;p<=m&&f<=g;)null==_?_=t[++p]:null==v?v=t[--m]:null==w?w=n[++f]:null==$?$=n[--g]:L(_,w)?(h(_,w,o),_=t[++p],w=n[++f]):L(v,$)?(h(v,$,o),v=t[--m],$=n[--g]):L(_,$)?(h(_,$,o),s.insertBefore(e,_.elm,s.nextSibling(v.elm)),_=t[++p],$=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,$,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 W=["label","title","placeholder","alt"],q=/[\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 Y(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 Z(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=Y(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?Y(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(q.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&&W.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=>`'${Z(e)}':true`)).join(",");l?t.addLine(`Object.assign(${l}, {${e}})`):(l=`_${t.generateID()}`,t.addLine(`let ${l} = {${e}};`))}}else t.addLine(`let _${e} = '${Z(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:W};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&&(o.includes("=>")?l[n]=e.captureExpression(o):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"),$=n.getAttribute("t-att-class"),b=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($){let t=e.formatExpression($);"{"===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||!!b&&`'${b}'`;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 $e=1;class be{constructor(e,t){be.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=$e++;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!==be;)t=t.__proto__,n=t.name;if(t===be)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])}}be.template=null,be._template=null,be.current=null,be.components={},be.env={},be.scheduler=he;class ye 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 xe(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 Ee(e){const n=be.current,o=n.__owl__;return o.observer||(o.observer=new t,o.observer.notifyCB=n.render.bind(n)),o.observer.observe(e)}function Ne(e,t=!1){return t?function(t){const n=be.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=be.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 Ce(e){return function(t){const n=be.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 Le=Ne("mountedCB",!0),Te=Ne("willUnmountCB"),Ae=Ne("willPatchCB"),De=Ne("patchedCB",!0),Pe=Ce("willStartCB"),ke=Ce("willUpdatePropsCB");function Ie(e){const t=be.current;t.env=Object.assign(Object.create(t.env),e)}var Re=Object.freeze({__proto__:null,useState:Ee,onMounted:Le,onWillUnmount:Te,onWillPatch:Ae,onPatched:De,onWillStart:Pe,onWillUpdateProps:ke,useRef:function(e){const t=be.current.__owl__;return{get el(){const n=t.refs&&t.refs[e];return n instanceof HTMLElement?n:n instanceof be?n.el:null},get comp(){const n=t.refs&&t.refs[e];return n instanceof be?n:null}}},useComponent:function(){return be.current},useEnv:function(){return be.current.env},useSubEnv:Ie,useExternalListener:function(e,t,n,o){const r=n.bind(be.current);Le((()=>e.addEventListener(t,r,o))),Te((()=>e.removeEventListener(t,r,o)))}});class Se extends ye{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 Oe=(e,t)=>e===t;function Fe(e,...t){const n="__template__"+J.nextId++,o=String.raw(e,...t);return J.registerTemplate(n,o),n}var Ue=Object.freeze({__proto__:null,xml:Fe,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 je extends be{async __updateProps(e,t){this.render(t.force)}}je.template=Fe`<t t-slot="default"/>`;class Me extends be{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:{},Ie({[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}}Me.template=Fe`<portal><t t-slot="default"/></portal>`,Me.props={target:{type:String}};class Be extends be{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)}}}Be.template=Fe`
2
2
  <a t-att-class="{'router-link-active': isActive }"
3
3
  t-att-href="href"
4
4
  t-on-click="navigate">
5
5
  <t t-slot="default"/>
6
6
  </a>
7
- `;class We extends $e{get routeComponent(){return this.env.router.currentRoute&&this.env.router.currentRoute.component}}We.template=Fe`
7
+ `;class We extends be{get routeComponent(){return this.env.router.currentRoute&&this.env.router.currentRoute.component}}We.template=Fe`
8
8
  <t>
9
9
  <t
10
10
  t-if="routeComponent"
@@ -12,4 +12,4 @@
12
12
  t-key="env.router.currentRouteName"
13
13
  t-props="env.router.currentParams" />
14
14
  </t>
15
- `;const qe=/\{\{(.*?)\}\}/,Ke=new RegExp(qe.source,"g");function Ve(e){const t=[];let n;do{n=Ke.exec(e),n&&t.push(n[1])}while(n);return t}function ze(e){const t=e.split(qe).map(((e,t)=>t%2?"(.*)":e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"))).join("");return new RegExp(`^${t}$`)}const He=ye,Ge=Ee,Qe={EventBus:e,Observer:t},Ze={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?Ve(e.path):[],e.extractionRegExp=ze(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(Ke,((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:Be},Ye=Se,Je=B,Xe=Ue,et={AsyncRoot:je,Portal:Me},tt=Object.assign({},Re,{useContext:function(e){const t=$e.current;return xe(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 Se))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||Oe;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)})),xe(r,n,(function(){let e=!1;for(let t of r.updateFunctions[o])e=t()||e;if(e)return n.render()})),ke((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})}}),nt={};exports.Component=$e,exports.Context=He,exports.QWeb=J,exports.Store=Ye,exports.__info__=nt,exports.browser=F,exports.config=ce,exports.core=Qe,exports.hooks=tt,exports.misc=et,exports.mount=async function(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},exports.router=Ze,exports.tags=Xe,exports.useState=Ge,exports.utils=Je,nt.version="1.4.5",nt.date="2021-09-22T14:34:13.251Z",nt.hash="37313c4",nt.url="https://github.com/odoo/owl";
15
+ `;const qe=/\{\{(.*?)\}\}/,Ke=new RegExp(qe.source,"g");function Ve(e){const t=[];let n;do{n=Ke.exec(e),n&&t.push(n[1])}while(n);return t}function ze(e){const t=e.split(qe).map(((e,t)=>t%2?"(.*)":e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"))).join("");return new RegExp(`^${t}$`)}const He=ye,Ge=Ee,Qe={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?Ve(e.path):[],e.extractionRegExp=ze(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(Ke,((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:Be},Ze=Se,Je=B,Xe=Ue,et={AsyncRoot:je,Portal:Me},tt=Object.assign({},Re,{useContext:function(e){const t=be.current;return xe(e,t,t.render.bind(t))},useDispatch:function(e){return(e=e||be.current.env.store).dispatch.bind(e)},useGetters:function(e){return(e=e||be.current.env.store).getters},useStore:function(e,t={}){const n=be.current,o=n.__owl__.id,r=t.store||n.env.store;if(!(r instanceof Se))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||Oe;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)})),xe(r,n,(function(){let e=!1;for(let t of r.updateFunctions[o])e=t()||e;if(e)return n.render()})),ke((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})}}),nt={};exports.Component=be,exports.Context=He,exports.QWeb=J,exports.Store=Ze,exports.__info__=nt,exports.browser=F,exports.config=ce,exports.core=Qe,exports.hooks=tt,exports.misc=et,exports.mount=async function(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},exports.router=Ye,exports.tags=Xe,exports.useState=Ge,exports.utils=Je,nt.version="1.4.9",nt.date="2021-12-07T09:21:41.690Z",nt.hash="73f94fb",nt.url="https://github.com/odoo/owl";
package/dist/owl.es.js CHANGED
@@ -356,6 +356,7 @@ const isRightSeparator = (token) => token && (token.type === "RIGHT_BRACE" || to
356
356
  * the list of variables so it does not get replaced by a lookup in the context
357
357
  */
358
358
  function compileExprToArray(expr, scope) {
359
+ const localVars = new Set();
359
360
  scope = Object.create(scope);
360
361
  const tokens = tokenize(expr);
361
362
  let i = 0;
@@ -381,7 +382,7 @@ function compileExprToArray(expr, scope) {
381
382
  if (groupType === "LEFT_BRACE" &&
382
383
  isLeftSeparator(prevToken) &&
383
384
  isRightSeparator(nextToken)) {
384
- tokens.splice(i + 1, 0, { type: "COLON", value: ":" }, { ...token });
385
+ tokens.splice(i + 1, 0, { type: "COLON", value: ":" }, Object.assign({}, token));
385
386
  nextToken = tokens[i + 1];
386
387
  }
387
388
  if (prevToken.type === "OPERATOR" && prevToken.value === ".") {
@@ -404,12 +405,14 @@ function compileExprToArray(expr, scope) {
404
405
  if (tokens[j].type === "SYMBOL" && tokens[j].originalValue) {
405
406
  tokens[j].value = tokens[j].originalValue;
406
407
  scope[tokens[j].value] = { id: tokens[j].value, expr: tokens[j].value };
408
+ localVars.add(tokens[j].value);
407
409
  }
408
410
  j--;
409
411
  }
410
412
  }
411
413
  else {
412
414
  scope[token.value] = { id: token.value, expr: token.value };
415
+ localVars.add(token.value);
413
416
  }
414
417
  }
415
418
  if (isVar) {
@@ -424,6 +427,13 @@ function compileExprToArray(expr, scope) {
424
427
  }
425
428
  i++;
426
429
  }
430
+ // Mark all variables that have been used locally.
431
+ // This assumes the expression has only one scope (incorrect but "good enough for now")
432
+ for (const token of tokens) {
433
+ if (token.type === "SYMBOL" && localVars.has(token.value)) {
434
+ token.isLocal = true;
435
+ }
436
+ }
427
437
  return tokens;
428
438
  }
429
439
  function compileExpr(expr, scope) {
@@ -575,7 +585,18 @@ class CompilationContext {
575
585
  const done = new Set();
576
586
  return tokens
577
587
  .map((tok) => {
578
- if (tok.varName) {
588
+ // "this" in captured expressions should be the current component
589
+ if (tok.value === "this") {
590
+ if (!done.has("this")) {
591
+ done.add("this");
592
+ this.addLine(`const this_${argId} = utils.getComponent(context);`);
593
+ }
594
+ tok.value = `this_${argId}`;
595
+ }
596
+ // Variables that should be looked up in the scope. isLocal is for arrow
597
+ // function arguments that should stay untouched (eg "ev => ev" should
598
+ // not become "const ev_1 = scope['ev']; ev_1 => ev_1")
599
+ if (tok.varName && !tok.isLocal) {
579
600
  if (!done.has(tok.varName)) {
580
601
  done.add(tok.varName);
581
602
  this.addLine(`const ${tok.varName}_${argId} = ${tok.value};`);
@@ -888,16 +909,16 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
888
909
  }
889
910
  return map;
890
911
  }
891
- const hooks = ["create", "update", "remove", "destroy", "pre", "post"];
912
+ const hooks$1 = ["create", "update", "remove", "destroy", "pre", "post"];
892
913
  function init(modules, domApi) {
893
914
  let i, j, cbs = {};
894
915
  const api = domApi !== undefined ? domApi : htmlDomApi;
895
- for (i = 0; i < hooks.length; ++i) {
896
- cbs[hooks[i]] = [];
916
+ for (i = 0; i < hooks$1.length; ++i) {
917
+ cbs[hooks$1[i]] = [];
897
918
  for (j = 0; j < modules.length; ++j) {
898
- const hook = modules[j][hooks[i]];
919
+ const hook = modules[j][hooks$1[i]];
899
920
  if (hook !== undefined) {
900
- cbs[hooks[i]].push(hook);
921
+ cbs[hooks$1[i]].push(hook);
901
922
  }
902
923
  }
903
924
  }
@@ -2506,7 +2527,8 @@ QWeb.addDirective({
2506
2527
  ctx.addLine(`if (!_${arrayID}) { throw new Error('QWeb error: Invalid loop expression')}`);
2507
2528
  let keysID = ctx.generateID();
2508
2529
  let valuesID = ctx.generateID();
2509
- ctx.addLine(`let _${keysID} = _${valuesID} = _${arrayID};`);
2530
+ ctx.addLine(`let _${keysID} = _${arrayID};`);
2531
+ ctx.addLine(`let _${valuesID} = _${arrayID};`);
2510
2532
  ctx.addIf(`!(_${arrayID} instanceof Array)`);
2511
2533
  ctx.addLine(`_${keysID} = Object.keys(_${arrayID});`);
2512
2534
  ctx.addLine(`_${valuesID} = Object.values(_${arrayID});`);
@@ -2920,9 +2942,6 @@ Object.defineProperty(config, "mode", {
2920
2942
  This is not suitable for production use.
2921
2943
  See https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for more information.`);
2922
2944
  }
2923
- else {
2924
- console.log(`Owl is now running in 'prod' mode.`);
2925
- }
2926
2945
  },
2927
2946
  });
2928
2947
  Object.defineProperty(config, "enableTransitions", {
@@ -3175,7 +3194,12 @@ QWeb.addDirective({
3175
3194
  else if (!name.startsWith("t-")) {
3176
3195
  if (name !== "class" && name !== "style") {
3177
3196
  // this is a prop!
3178
- props[name] = ctx.formatExpression(value) || "undefined";
3197
+ if (value.includes("=>")) {
3198
+ props[name] = ctx.captureExpression(value);
3199
+ }
3200
+ else {
3201
+ props[name] = ctx.formatExpression(value) || "undefined";
3202
+ }
3179
3203
  }
3180
3204
  }
3181
3205
  }
@@ -3658,6 +3682,7 @@ class Fiber {
3658
3682
  // build patchQueue
3659
3683
  const patchQueue = [];
3660
3684
  const doWork = function (f) {
3685
+ f.component.__owl__.currentFiber = null;
3661
3686
  patchQueue.push(f);
3662
3687
  return f.child;
3663
3688
  };
@@ -3700,8 +3725,9 @@ class Fiber {
3700
3725
  component.__patch(target, fiber.vnode);
3701
3726
  }
3702
3727
  else {
3703
- if (fiber.shouldPatch) {
3704
- component.__patch(component.__owl__.vnode, fiber.vnode);
3728
+ const vnode = component.__owl__.vnode;
3729
+ if (fiber.shouldPatch && vnode) {
3730
+ component.__patch(vnode, fiber.vnode);
3705
3731
  // When updating a Component's props (in directive),
3706
3732
  // the component has a pvnode AND should be patched.
3707
3733
  // However, its pvnode.elm may have changed if it is a High Order Component
@@ -3714,10 +3740,6 @@ class Fiber {
3714
3740
  component.__owl__.pvnode.elm = component.__owl__.vnode.elm;
3715
3741
  }
3716
3742
  }
3717
- const compOwl = component.__owl__;
3718
- if (fiber === compOwl.currentFiber) {
3719
- compOwl.currentFiber = null;
3720
- }
3721
3743
  }
3722
3744
  // insert into the DOM (mount case)
3723
3745
  let inDOM = false;
@@ -4371,7 +4393,6 @@ class Component {
4371
4393
  __callMounted() {
4372
4394
  const __owl__ = this.__owl__;
4373
4395
  __owl__.status = 3 /* MOUNTED */;
4374
- __owl__.currentFiber = null;
4375
4396
  this.mounted();
4376
4397
  if (__owl__.mountedCB) {
4377
4398
  __owl__.mountedCB();
@@ -4664,7 +4685,7 @@ function partitionBy(arr, fn) {
4664
4685
  return acc;
4665
4686
  }, []);
4666
4687
  }
4667
- class Context extends EventBus {
4688
+ class Context$1 extends EventBus {
4668
4689
  constructor(state = {}) {
4669
4690
  super();
4670
4691
  this.rev = 1;
@@ -4777,7 +4798,7 @@ function useContextWithCB(ctx, component, method) {
4777
4798
  * will return an observed object (or array). Changes to that value will then
4778
4799
  * trigger a rerendering of the current component.
4779
4800
  */
4780
- function useState(state) {
4801
+ function useState$1(state) {
4781
4802
  const component = Component.current;
4782
4803
  const __owl__ = component.__owl__;
4783
4804
  if (!__owl__.observer) {
@@ -4913,7 +4934,7 @@ function useExternalListener(target, eventName, handler, eventParams) {
4913
4934
 
4914
4935
  var _hooks = /*#__PURE__*/Object.freeze({
4915
4936
  __proto__: null,
4916
- useState: useState,
4937
+ useState: useState$1,
4917
4938
  onMounted: onMounted,
4918
4939
  onWillUnmount: onWillUnmount,
4919
4940
  onWillPatch: onWillPatch,
@@ -4927,7 +4948,7 @@ var _hooks = /*#__PURE__*/Object.freeze({
4927
4948
  useExternalListener: useExternalListener
4928
4949
  });
4929
4950
 
4930
- class Store extends Context {
4951
+ class Store$1 extends Context$1 {
4931
4952
  constructor(config) {
4932
4953
  super(config.state);
4933
4954
  this.actions = config.actions;
@@ -4966,7 +4987,7 @@ function useStore(selector, options = {}) {
4966
4987
  const component = Component.current;
4967
4988
  const componentId = component.__owl__.id;
4968
4989
  const store = options.store || component.env.store;
4969
- if (!(store instanceof Store)) {
4990
+ if (!(store instanceof Store$1)) {
4970
4991
  throw new Error(`No store found when connecting '${component.constructor.name}'`);
4971
4992
  }
4972
4993
  let result = selector(store.state, component.props);
@@ -5513,15 +5534,15 @@ function makeExtractionRegExp(path) {
5513
5534
  *
5514
5535
  * Note that dynamic values, such as a date or a commit hash are added by rollup
5515
5536
  */
5516
- const Context$1 = Context;
5517
- const useState$1 = useState;
5537
+ const Context = Context$1;
5538
+ const useState = useState$1;
5518
5539
  const core = { EventBus, Observer };
5519
5540
  const router = { Router, RouteComponent, Link };
5520
- const Store$1 = Store;
5541
+ const Store = Store$1;
5521
5542
  const utils = _utils;
5522
5543
  const tags = _tags;
5523
5544
  const misc = { AsyncRoot, Portal };
5524
- const hooks$1 = Object.assign({}, _hooks, {
5545
+ const hooks = Object.assign({}, _hooks, {
5525
5546
  useContext: useContext,
5526
5547
  useDispatch: useDispatch,
5527
5548
  useGetters: useGetters,
@@ -5529,10 +5550,10 @@ const hooks$1 = Object.assign({}, _hooks, {
5529
5550
  });
5530
5551
  const __info__ = {};
5531
5552
 
5532
- export { Component, Context$1 as Context, QWeb, Store$1 as Store, __info__, browser, config, core, hooks$1 as hooks, misc, mount, router, tags, useState$1 as useState, utils };
5553
+ export { Component, Context, QWeb, Store, __info__, browser, config, core, hooks, misc, mount, router, tags, useState, utils };
5533
5554
 
5534
5555
 
5535
- __info__.version = '1.4.5';
5536
- __info__.date = '2021-09-22T14:34:13.251Z';
5537
- __info__.hash = '37313c4';
5556
+ __info__.version = '1.4.9';
5557
+ __info__.date = '2021-12-07T09:21:41.690Z';
5558
+ __info__.hash = '73f94fb';
5538
5559
  __info__.url = 'https://github.com/odoo/owl';