import{aM as t}from"./backend-ai-webui-CHZ-bl4E.js";
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/const e=!1,n=t=>t,o="string"==typeof document.head.style.touchAction,i="__polymerGestures",s="__polymerGesturesHandled",c="__polymerGesturesTouchAction",u=["mousedown","mousemove","mouseup","click"],r=[0,1,4,2],a=function(){try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}();function h(t){return u.indexOf(t)>-1}let d=!1;function f(t){if(!h(t)&&"touchend"!==t)return o&&d&&e?{passive:!0}:void 0}!function(){try{const t=Object.defineProperty({},"passive",{get(){d=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(t){}}();const l=navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/u),m={button:!0,command:!0,fieldset:!0,input:!0,keygen:!0,optgroup:!0,option:!0,select:!0,textarea:!0};function p(t){const e=t.type;if(!h(e))return!1;if("mousemove"===e){let e=void 0===t.buttons?1:t.buttons;return t instanceof window.MouseEvent&&!a&&(e=r[t.which]||0),Boolean(1&e)}return 0===(void 0===t.button?0:t.button)}const v={mouse:{target:null,mouseIgnoreJob:null},touch:{x:0,y:0,id:-1,scrollDecided:!1}};function y(t,e,n){t.movefn=e,t.upfn=n,document.addEventListener("mousemove",e),document.addEventListener("mouseup",n)}function w(t){document.removeEventListener("mousemove",t.movefn),document.removeEventListener("mouseup",t.upfn),t.movefn=null,t.upfn=null}const g=window.ShadyDOM&&window.ShadyDOM.noPatch?window.ShadyDOM.composedPath:t=>t.composedPath&&t.composedPath()||[],x={},b=[];function E(t){const e=g(t);return e.length>0?e[0]:t.target}function M(t){const e=t.type,n=t.currentTarget[i];if(!n)return;const u=n[e];if(!u)return;if(!t[s]&&(t[s]={},e.startsWith("touch"))){const n=t.changedTouches[0];if("touchstart"===e&&1===t.touches.length&&(v.touch.id=n.identifier),v.touch.id!==n.identifier)return;o||"touchstart"!==e&&"touchmove"!==e||function(t){const e=t.changedTouches[0],n=t.type;if("touchstart"===n)v.touch.x=e.clientX,v.touch.y=e.clientY,v.touch.scrollDecided=!1;else if("touchmove"===n){if(v.touch.scrollDecided)return;v.touch.scrollDecided=!0;const n=function(t){let e="auto";const n=g(t);for(let t,o=0;o<n.length;o++)if(t=n[o],t[c]){e=t[c];break}return e}(t);let o=!1;const i=Math.abs(v.touch.x-e.clientX),s=Math.abs(v.touch.y-e.clientY);t.cancelable&&("none"===n?o=!0:"pan-x"===n?o=s>i:"pan-y"===n&&(o=i>s)),o?t.preventDefault():X("track")}}(t)}const r=t[s];if(!r.skip){for(let e,n=0;n<b.length;n++)e=b[n],u[e.name]&&!r[e.name]&&e.flow&&e.flow.start.indexOf(t.type)>-1&&e.reset&&e.reset();for(let n,o=0;o<b.length;o++)n=b[o],u[n.name]&&!r[n.name]&&(r[n.name]=!0,n[e](t))}}function k(e,n,s){return!!x[n]&&(function(e,n,s){const u=x[n],r=u.deps,a=u.name;let d=e[i];d||(e[i]=d={});for(let t,n,o=0;o<r.length;o++)t=r[o],l&&h(t)&&"click"!==t||(n=d[t],n||(d[t]=n={_count:0}),0===n._count&&e.addEventListener(t,M,f(t)),n[a]=(n[a]||0)+1,n._count=(n._count||0)+1);e.addEventListener(n,s),u.touchAction&&function(e,n){o&&e instanceof HTMLElement&&t.run((()=>{e.style.touchAction=n}));e[c]=n}(e,u.touchAction)}(e,n,s),!0)}function N(t){b.push(t),t.emits.forEach((e=>{x[e]=t}))}function T(t,e,o){const i=new Event(e,{bubbles:!0,cancelable:!0,composed:!0});if(i.detail=o,n(t).dispatchEvent(i),i.defaultPrevented){const t=o.preventer||o.sourceEvent;t&&t.preventDefault&&t.preventDefault()}}function X(t){const e=function(t){for(let e,n=0;n<b.length;n++){e=b[n];for(let n,o=0;o<e.emits.length;o++)if(n=e.emits[o],n===t)return e}return null}(t);e.info&&(e.info.prevent=!0)}function Y(t,e,n,o){e&&T(e,t,{x:n.clientX,y:n.clientY,sourceEvent:n,preventer:o,prevent:t=>X(t)})}function D(t,e,n){if(t.prevent)return!1;if(t.started)return!0;const o=Math.abs(t.x-e),i=Math.abs(t.y-n);return o>=5||i>=5}function L(t,e,n){if(!e)return;const o=t.moves[t.moves.length-2],i=t.moves[t.moves.length-1],s=i.x-t.x,c=i.y-t.y;let u,r=0;o&&(u=i.x-o.x,r=i.y-o.y),T(e,"track",{state:t.state,x:n.clientX,y:n.clientY,dx:s,dy:c,ddx:u,ddy:r,sourceEvent:n,hover:()=>function(t,e){let n=document.elementFromPoint(t,e),o=n;for(;o&&o.shadowRoot&&!window.ShadyDOM;){const i=o;if(o=o.shadowRoot.elementFromPoint(t,e),i===o)break;o&&(n=o)}return n}(n.clientX,n.clientY)})}function _(t,e,n){const o=Math.abs(e.clientX-t.x),i=Math.abs(e.clientY-t.y),s=E(n||e);!s||m[s.localName]&&s.hasAttribute("disabled")||(isNaN(o)||isNaN(i)||o<=25&&i<=25||function(t){if("click"===t.type){if(0===t.detail)return!0;const e=E(t);if(!e.nodeType||e.nodeType!==Node.ELEMENT_NODE)return!0;const n=e.getBoundingClientRect(),o=t.pageX,i=t.pageY;return!(o>=n.left&&o<=n.right&&i>=n.top&&i<=n.bottom)}return!1}(e))&&(t.prevent||T(s,"tap",{x:e.clientX,y:e.clientY,sourceEvent:e,preventer:n}))}
/**
 * @license
 * Copyright (c) 2021 - 2023 Vaadin Ltd.
 * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
 */function A(t,e){const{scrollLeft:n}=t;return"rtl"!==e?n:t.scrollWidth-t.clientWidth+n}function P(t,e,n){t.scrollLeft="rtl"!==e?n:t.clientWidth-t.scrollWidth+n}N({name:"downup",deps:["mousedown","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["down","up"],info:{movefn:null,upfn:null},reset(){w(this.info)},mousedown(t){if(!p(t))return;const e=E(t),n=this;y(this.info,(t=>{p(t)||(Y("up",e,t),w(n.info))}),(t=>{p(t)&&Y("up",e,t),w(n.info)})),Y("down",e,t)},touchstart(t){Y("down",E(t),t.changedTouches[0],t)},touchend(t){Y("up",E(t),t.changedTouches[0],t)}}),N({name:"track",touchAction:"none",deps:["mousedown","touchstart","touchmove","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["track"],info:{x:0,y:0,state:"start",started:!1,moves:[],addMove(t){this.moves.length>2&&this.moves.shift(),this.moves.push(t)},movefn:null,upfn:null,prevent:!1},reset(){this.info.state="start",this.info.started=!1,this.info.moves=[],this.info.x=0,this.info.y=0,this.info.prevent=!1,w(this.info)},mousedown(t){if(!p(t))return;const e=E(t),n=this,o=t=>{const o=t.clientX,i=t.clientY;D(n.info,o,i)&&(n.info.state=n.info.started?"mouseup"===t.type?"end":"track":"start","start"===n.info.state&&X("tap"),n.info.addMove({x:o,y:i}),p(t)||(n.info.state="end",w(n.info)),e&&L(n.info,e,t),n.info.started=!0)};y(this.info,o,(t=>{n.info.started&&o(t),w(n.info)})),this.info.x=t.clientX,this.info.y=t.clientY},touchstart(t){const e=t.changedTouches[0];this.info.x=e.clientX,this.info.y=e.clientY},touchmove(t){const e=E(t),n=t.changedTouches[0],o=n.clientX,i=n.clientY;D(this.info,o,i)&&("start"===this.info.state&&X("tap"),this.info.addMove({x:o,y:i}),L(this.info,e,n),this.info.state="track",this.info.started=!0)},touchend(t){const e=E(t),n=t.changedTouches[0];this.info.started&&(this.info.state="end",this.info.addMove({x:n.clientX,y:n.clientY}),L(this.info,e,n))}}),N({name:"tap",deps:["mousedown","click","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["click","touchend"]},emits:["tap"],info:{x:NaN,y:NaN,prevent:!1},reset(){this.info.x=NaN,this.info.y=NaN,this.info.prevent=!1},mousedown(t){p(t)&&(this.info.x=t.clientX,this.info.y=t.clientY)},click(t){p(t)&&_(this.info,t)},touchstart(t){const e=t.changedTouches[0];this.info.x=e.clientX,this.info.y=e.clientY},touchend(t){_(this.info,t.changedTouches[0],t)}});export{k as a,A as g,P as s};
