Agriculture-front-end/dist/assets/element-resize-detector.d4d1cd8d.js

7 lines
17 KiB
JavaScript

import{b as xt}from"./browser-detector.d146ab9e.js";var st={exports:{}},It=st.exports={};It.forEach=function(r,i){for(var c=0;c<r.length;c++){var e=i(r[c]);if(e)return e}};var Nt=function(r){var i=r.stateHandler.getState;function c(u){var s=i(u);return s&&!!s.isDetectable}function e(u){i(u).isDetectable=!0}function l(u){return!!i(u).busy}function p(u,s){i(u).busy=!!s}return{isDetectable:c,markAsDetectable:e,isBusy:l,markBusy:p}},Pt=function(r){var i={};function c(u){var s=r.get(u);return s===void 0?[]:i[s]||[]}function e(u,s){var h=r.get(u);i[h]||(i[h]=[]),i[h].push(s)}function l(u,s){for(var h=c(u),d=0,g=h.length;d<g;++d)if(h[d]===s){h.splice(d,1);break}}function p(u){var s=c(u);!s||(s.length=0)}return{get:c,add:e,removeListener:l,removeAllListeners:p}},Mt=function(){var r=1;function i(){return r++}return{generate:i}},Wt=function(r){var i=r.idGenerator,c=r.stateHandler.getState;function e(p){var u=c(p);return u&&u.id!==void 0?u.id:null}function l(p){var u=c(p);if(!u)throw new Error("setId required the element to have a resize detection state.");var s=i.generate();return u.id=s,s}return{get:e,set:l}},Bt=function(r){function i(){}var c={log:i,warn:i,error:i};if(!r&&window.console){var e=function(l,p){l[p]=function(){var s=console[p];if(s.apply)s.apply(console,arguments);else for(var h=0;h<arguments.length;h++)s(arguments[h])}};e(c,"log"),e(c,"warn"),e(c,"error")}return c},kt={exports:{}},_t=kt.exports={};_t.getOption=Rt;function Rt(r,i,c){var e=r[i];return e==null&&c!==void 0?c:e}var bt=kt.exports,Ft=function(i){i=i||{};var c=i.reporter,e=bt.getOption(i,"async",!0),l=bt.getOption(i,"auto",!0);l&&!e&&(c&&c.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),e=!0);var p=pt(),u,s=!1;function h(w,A){!s&&l&&e&&p.size()===0&&C(),p.add(w,A)}function d(){for(s=!0;p.size();){var w=p;p=pt(),w.process()}s=!1}function g(w){s||(w===void 0&&(w=e),u&&(P(u),u=null),w?C():d())}function C(){u=k(d)}function P(w){var A=clearTimeout;return A(w)}function k(w){var A=function(M){return setTimeout(M,0)};return A(w)}return{add:h,force:g}};function pt(){var r={},i=0,c=0,e=0;function l(s,h){h||(h=s,s=0),s>c?c=s:s<e&&(e=s),r[s]||(r[s]=[]),r[s].push(h),i++}function p(){for(var s=e;s<=c;s++)for(var h=r[s],d=0;d<h.length;d++){var g=h[d];g()}}function u(){return i}return{add:l,process:p,size:u}}var dt="_erd";function qt(r){return r[dt]={},mt(r)}function mt(r){return r[dt]}function $t(r){delete r[dt]}var Ut={initState:qt,getState:mt,cleanState:$t},Z=xt.exports,Gt=function(r){r=r||{};var i=r.reporter,c=r.batchProcessor,e=r.stateHandler.getState;if(!i)throw new Error("Missing required dependency: reporter.");function l(d,g){function C(){g(d)}if(Z.isIE(8))e(d).object={proxy:C},d.attachEvent("onresize",C);else{var P=s(d);if(!P)throw new Error("Element is not detectable by this strategy.");P.contentDocument.defaultView.addEventListener("resize",C)}}function p(d){var g=r.important?" !important; ":"; ";return(d.join(g)+g).trim()}function u(d,g,C){C||(C=g,g=d,d=null),d=d||{},d.debug;function P(k,w){var A=p(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),M=!1,W=window.getComputedStyle(k),m=k.offsetWidth,D=k.offsetHeight;e(k).startSize={width:m,height:D};function o(){function t(){if(W.position==="static"){k.style.setProperty("position","relative",d.important?"important":"");var z=function(T,S,L,f){function y(j){return j.replace(/[^-\d\.]/g,"")}var I=L[f];I!=="auto"&&y(I)!=="0"&&(T.warn("An element that is positioned static has style."+f+"="+I+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+f+" will be set to 0. Element: ",S),S.style.setProperty(f,"0",d.important?"important":""))};z(i,k,W,"top"),z(i,k,W,"right"),z(i,k,W,"bottom"),z(i,k,W,"left")}}function E(){M||t();function z(S,L){if(!S.contentDocument){var f=e(S);f.checkForObjectDocumentTimeoutId&&window.clearTimeout(f.checkForObjectDocumentTimeoutId),f.checkForObjectDocumentTimeoutId=setTimeout(function(){f.checkForObjectDocumentTimeoutId=0,z(S,L)},100);return}L(S.contentDocument)}var T=this;z(T,function(L){w(k)})}W.position!==""&&(t(),M=!0);var n=document.createElement("object");n.style.cssText=A,n.tabIndex=-1,n.type="text/html",n.setAttribute("aria-hidden","true"),n.onload=E,Z.isIE()||(n.data="about:blank"),e(k)&&(k.appendChild(n),e(k).object=n,Z.isIE()&&(n.data="about:blank"))}c?c.add(o):o()}Z.isIE(8)?C(g):P(g,C)}function s(d){return e(d).object}function h(d){if(!!e(d)){var g=s(d);!g||(Z.isIE(8)?d.detachEvent("onresize",g.proxy):d.removeChild(g),e(d).checkForObjectDocumentTimeoutId&&window.clearTimeout(e(d).checkForObjectDocumentTimeoutId),delete e(d).object)}}return{makeDetectable:u,addListener:l,uninstall:h}},Jt=st.exports.forEach,Vt=function(r){r=r||{};var i=r.reporter,c=r.batchProcessor,e=r.stateHandler.getState;r.stateHandler.hasState;var l=r.idHandler;if(!c)throw new Error("Missing required dependency: batchProcessor");if(!i)throw new Error("Missing required dependency: reporter.");var p=g(),u="erd_scroll_detection_scrollbar_style",s="erd_scroll_detection_container";function h(o){C(o,u,s)}h(window.document);function d(o){var t=r.important?" !important; ":"; ";return(o.join(t)+t).trim()}function g(){var o=500,t=500,E=document.createElement("div");E.style.cssText=d(["position: absolute","width: "+o*2+"px","height: "+t*2+"px","visibility: hidden","margin: 0","padding: 0"]);var n=document.createElement("div");n.style.cssText=d(["position: absolute","width: "+o+"px","height: "+t+"px","overflow: scroll","visibility: none","top: "+-o*3+"px","left: "+-t*3+"px","visibility: hidden","margin: 0","padding: 0"]),n.appendChild(E),document.body.insertBefore(n,document.body.firstChild);var z=o-n.clientWidth,T=t-n.clientHeight;return document.body.removeChild(n),{width:z,height:T}}function C(o,t,E){function n(L,f){f=f||function(I){o.head.appendChild(I)};var y=o.createElement("style");return y.innerHTML=L,y.id=t,f(y),y}if(!o.getElementById(t)){var z=E+"_animation",T=E+"_animation_active",S=`/* Created by the element-resize-detector library. */
`;S+="."+E+" > div::-webkit-scrollbar { "+d(["display: none"])+` }
`,S+="."+T+" { "+d(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+z,"animation-name: "+z])+` }
`,S+="@-webkit-keyframes "+z+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
`,S+="@keyframes "+z+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",n(S)}}function P(o){o.className+=" "+s+"_animation_active"}function k(o,t,E){if(o.addEventListener)o.addEventListener(t,E);else if(o.attachEvent)o.attachEvent("on"+t,E);else return i.error("[scroll] Don't know how to add event listeners.")}function w(o,t,E){if(o.removeEventListener)o.removeEventListener(t,E);else if(o.detachEvent)o.detachEvent("on"+t,E);else return i.error("[scroll] Don't know how to remove event listeners.")}function A(o){return e(o).container.childNodes[0].childNodes[0].childNodes[0]}function M(o){return e(o).container.childNodes[0].childNodes[0].childNodes[1]}function W(o,t){var E=e(o).listeners;if(!E.push)throw new Error("Cannot add listener to an element that is not detectable.");e(o).listeners.push(t)}function m(o,t,E){E||(E=t,t=o,o=null),o=o||{};function n(){if(o.debug){var a=Array.prototype.slice.call(arguments);if(a.unshift(l.get(t),"Scroll: "),i.log.apply)i.log.apply(null,a);else for(var v=0;v<a.length;v++)i.log(a[v])}}function z(a){function v(x){var B=x.getRootNode&&x.getRootNode().contains(x);return x===x.ownerDocument.body||x.ownerDocument.body.contains(x)||B}return!v(a)||window.getComputedStyle(a)===null}function T(a){var v=e(a).container.childNodes[0],x=window.getComputedStyle(v);return!x.width||x.width.indexOf("px")===-1}function S(){var a=window.getComputedStyle(t),v={};return v.position=a.position,v.width=t.offsetWidth,v.height=t.offsetHeight,v.top=a.top,v.right=a.right,v.bottom=a.bottom,v.left=a.left,v.widthCSS=a.width,v.heightCSS=a.height,v}function L(){var a=S();e(t).startSize={width:a.width,height:a.height},n("Element start size",e(t).startSize)}function f(){e(t).listeners=[]}function y(){if(n("storeStyle invoked."),!e(t)){n("Aborting because element has been uninstalled");return}var a=S();e(t).style=a}function I(a,v,x){e(a).lastWidth=v,e(a).lastHeight=x}function j(a){return A(a).childNodes[0]}function U(){return 2*p.width+1}function et(){return 2*p.height+1}function rt(a){return a+10+U()}function it(a){return a+10+et()}function Dt(a){return a*2+U()}function Ct(a){return a*2+et()}function ct(a,v,x){var B=A(a),G=M(a),Y=rt(v),K=it(x),O=Dt(v),b=Ct(x);B.scrollLeft=Y,B.scrollTop=K,G.scrollLeft=O,G.scrollTop=b}function ut(){var a=e(t).container;if(!a){a=document.createElement("div"),a.className=s,a.style.cssText=d(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]),e(t).container=a,P(a),t.appendChild(a);var v=function(){e(t).onRendered&&e(t).onRendered()};k(a,"animationstart",v),e(t).onAnimationStart=v}return a}function zt(){function a(){var H=e(t).style;if(H.position==="static"){t.style.setProperty("position","relative",o.important?"important":"");var F=function(X,V,Tt,at){function jt(Ot){return Ot.replace(/[^-\d\.]/g,"")}var ot=Tt[at];ot!=="auto"&&jt(ot)!=="0"&&(X.warn("An element that is positioned static has style."+at+"="+ot+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+at+" will be set to 0. Element: ",V),V.style[at]=0)};F(i,t,H,"top"),F(i,t,H,"right"),F(i,t,H,"bottom"),F(i,t,H,"left")}}function v(H,F,X,V){return H=H?H+"px":"0",F=F?F+"px":"0",X=X?X+"px":"0",V=V?V+"px":"0",["left: "+H,"top: "+F,"right: "+V,"bottom: "+X]}if(n("Injecting elements"),!e(t)){n("Aborting because element has been uninstalled");return}a();var x=e(t).container;x||(x=ut());var B=p.width,G=p.height,Y=d(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]),K=d(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(v(-(1+B),-(1+G),-G,-B))),O=d(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),b=d(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),N=d(["position: absolute","left: 0","top: 0"]),J=d(["position: absolute","width: 200%","height: 200%"]),_=document.createElement("div"),R=document.createElement("div"),Q=document.createElement("div"),ft=document.createElement("div"),nt=document.createElement("div"),ht=document.createElement("div");_.dir="ltr",_.style.cssText=Y,_.className=s,R.className=s,R.style.cssText=K,Q.style.cssText=O,ft.style.cssText=N,nt.style.cssText=b,ht.style.cssText=J,Q.appendChild(ft),nt.appendChild(ht),R.appendChild(Q),R.appendChild(nt),_.appendChild(R),x.appendChild(_);function vt(){var H=e(t);H&&H.onExpand?H.onExpand():n("Aborting expand scroll handler: element has been uninstalled")}function gt(){var H=e(t);H&&H.onShrink?H.onShrink():n("Aborting shrink scroll handler: element has been uninstalled")}k(Q,"scroll",vt),k(nt,"scroll",gt),e(t).onExpandScroll=vt,e(t).onShrinkScroll=gt}function Ht(){function a(O,b,N){var J=j(O),_=rt(b),R=it(N);J.style.setProperty("width",_+"px",o.important?"important":""),J.style.setProperty("height",R+"px",o.important?"important":"")}function v(O){var b=t.offsetWidth,N=t.offsetHeight,J=b!==e(t).lastWidth||N!==e(t).lastHeight;n("Storing current size",b,N),I(t,b,N),c.add(0,function(){if(!!J){if(!e(t)){n("Aborting because element has been uninstalled");return}if(!x()){n("Aborting because element container has not been initialized");return}if(o.debug){var R=t.offsetWidth,Q=t.offsetHeight;(R!==b||Q!==N)&&i.warn(l.get(t),"Scroll: Size changed before updating detector elements.")}a(t,b,N)}}),c.add(1,function(){if(!e(t)){n("Aborting because element has been uninstalled");return}if(!x()){n("Aborting because element container has not been initialized");return}ct(t,b,N)}),J&&O&&c.add(2,function(){if(!e(t)){n("Aborting because element has been uninstalled");return}if(!x()){n("Aborting because element container has not been initialized");return}O()})}function x(){return!!e(t).container}function B(){function O(){return e(t).lastNotifiedWidth===void 0}n("notifyListenersIfNeeded invoked");var b=e(t);if(O()&&b.lastWidth===b.startSize.width&&b.lastHeight===b.startSize.height)return n("Not notifying: Size is the same as the start size, and there has been no notification yet.");if(b.lastWidth===b.lastNotifiedWidth&&b.lastHeight===b.lastNotifiedHeight)return n("Not notifying: Size already notified");n("Current size not notified, notifying..."),b.lastNotifiedWidth=b.lastWidth,b.lastNotifiedHeight=b.lastHeight,Jt(e(t).listeners,function(N){N(t)})}function G(){if(n("startanimation triggered."),T(t)){n("Ignoring since element is still unrendered...");return}n("Element rendered.");var O=A(t),b=M(t);(O.scrollLeft===0||O.scrollTop===0||b.scrollLeft===0||b.scrollTop===0)&&(n("Scrollbars out of sync. Updating detector elements..."),v(B))}function Y(){if(n("Scroll detected."),T(t)){n("Scroll event fired while unrendered. Ignoring...");return}v(B)}if(n("registerListenersAndPositionElements invoked."),!e(t)){n("Aborting because element has been uninstalled");return}e(t).onRendered=G,e(t).onExpand=Y,e(t).onShrink=Y;var K=e(t).style;a(t,K.width,K.height)}function Lt(){if(n("finalizeDomMutation invoked."),!e(t)){n("Aborting because element has been uninstalled");return}var a=e(t).style;I(t,a.width,a.height),ct(t,a.width,a.height)}function At(){E(t)}function lt(){n("Installing..."),f(),L(),c.add(0,y),c.add(1,zt),c.add(2,Ht),c.add(3,Lt),c.add(4,At)}n("Making detectable..."),z(t)?(n("Element is detached"),ut(),n("Waiting until element is attached..."),e(t).onRendered=function(){n("Element is now attached"),lt()}):lt()}function D(o){var t=e(o);!t||(t.onExpandScroll&&w(A(o),"scroll",t.onExpandScroll),t.onShrinkScroll&&w(M(o),"scroll",t.onShrinkScroll),t.onAnimationStart&&w(t.container,"animationstart",t.onAnimationStart),t.container&&o.removeChild(t.container))}return{makeDetectable:m,addListener:W,uninstall:D,initDocument:h}},tt=st.exports.forEach,Yt=Nt,Kt=Pt,Qt=Mt,Xt=Wt,Zt=Bt,yt=xt.exports,te=Ft,q=Ut,ee=Gt,re=Vt;function St(r){return Array.isArray(r)||r.length!==void 0}function wt(r){if(Array.isArray(r))return r;var i=[];return tt(r,function(c){i.push(c)}),i}function Et(r){return r&&r.nodeType===1}var ne=function(r){r=r||{};var i;if(r.idHandler)i={get:function(m){return r.idHandler.get(m,!0)},set:r.idHandler.set};else{var c=Qt(),e=Xt({idGenerator:c,stateHandler:q});i=e}var l=r.reporter;if(!l){var p=l===!1;l=Zt(p)}var u=$(r,"batchProcessor",te({reporter:l})),s={};s.callOnAdd=!!$(r,"callOnAdd",!0),s.debug=!!$(r,"debug",!1);var h=Kt(i),d=Yt({stateHandler:q}),g,C=$(r,"strategy","object"),P=$(r,"important",!1),k={reporter:l,batchProcessor:u,stateHandler:q,idHandler:i,important:P};if(C==="scroll"&&(yt.isLegacyOpera()?(l.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),C="object"):yt.isIE(9)&&(l.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),C="object")),C==="scroll")g=re(k);else if(C==="object")g=ee(k);else throw new Error("Invalid strategy name: "+C);var w={};function A(m,D,o){function t(L){var f=h.get(L);tt(f,function(I){I(L)})}function E(L,f,y){h.add(f,y),L&&y(f)}if(o||(o=D,D=m,m={}),!D)throw new Error("At least one element required.");if(!o)throw new Error("Listener required.");if(Et(D))D=[D];else if(St(D))D=wt(D);else return l.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");var n=0,z=$(m,"callOnAdd",s.callOnAdd),T=$(m,"onReady",function(){}),S=$(m,"debug",s.debug);tt(D,function(f){q.getState(f)||(q.initState(f),i.set(f));var y=i.get(f);if(S&&l.log("Attaching listener to element",y,f),!d.isDetectable(f)){if(S&&l.log(y,"Not detectable."),d.isBusy(f)){S&&l.log(y,"System busy making it detectable"),E(z,f,o),w[y]=w[y]||[],w[y].push(function(){n++,n===D.length&&T()});return}return S&&l.log(y,"Making detectable..."),d.markBusy(f,!0),g.makeDetectable({debug:S,important:P},f,function(j){if(S&&l.log(y,"onElementDetectable"),q.getState(j)){d.markAsDetectable(j),d.markBusy(j,!1),g.addListener(j,t),E(z,j,o);var U=q.getState(j);if(U&&U.startSize){var et=j.offsetWidth,rt=j.offsetHeight;(U.startSize.width!==et||U.startSize.height!==rt)&&t(j)}w[y]&&tt(w[y],function(it){it()})}else S&&l.log(y,"Element uninstalled before being detectable.");delete w[y],n++,n===D.length&&T()})}S&&l.log(y,"Already detecable, adding listener."),E(z,f,o),n++}),n===D.length&&T()}function M(m){if(!m)return l.error("At least one element is required.");if(Et(m))m=[m];else if(St(m))m=wt(m);else return l.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");tt(m,function(D){h.removeAllListeners(D),g.uninstall(D),q.cleanState(D)})}function W(m){g.initDocument&&g.initDocument(m)}return{listenTo:A,removeListener:h.removeListener,removeAllListeners:h.removeAllListeners,uninstall:M,initDocument:W}};function $(r,i,c){var e=r[i];return e==null&&c!==void 0?c:e}export{ne as e};