@clara.care/react 1.0.3

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.
@@ -0,0 +1,439 @@
1
+ "use strict";var Ke=Object.defineProperty;var Ye=(n,e,i)=>e in n?Ke(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var Re=(n,e,i)=>Ye(n,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsxRuntime=require("react/jsx-runtime"),React=require("react");function _interopNamespaceDefault(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const i in n)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}return e.default=n,Object.freeze(e)}const React__namespace=_interopNamespaceDefault(React),LayoutGroupContext=React.createContext({});function useConstant(n){const e=React.useRef(null);return e.current===null&&(e.current=n()),e.current}const isBrowser=typeof window<"u",useIsomorphicLayoutEffect=isBrowser?React.useLayoutEffect:React.useEffect,PresenceContext=React.createContext(null);function addUniqueItem(n,e){n.indexOf(e)===-1&&n.push(e)}function removeItem(n,e){const i=n.indexOf(e);i>-1&&n.splice(i,1)}const clamp=(n,e,i)=>i>e?e:i<n?n:i;function formatErrorMessage(n,e){return e?`${n}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:n}let warning=()=>{},invariant=()=>{};process.env.NODE_ENV!=="production"&&(warning=(n,e,i)=>{!n&&typeof console<"u"&&console.warn(formatErrorMessage(e,i))},invariant=(n,e,i)=>{if(!n)throw new Error(formatErrorMessage(e,i))});const MotionGlobalConfig={},isNumericalString=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n);function isObject(n){return typeof n=="object"&&n!==null}const isZeroValueString=n=>/^0[^.\s]+$/u.test(n);function memo(n){let e;return()=>(e===void 0&&(e=n()),e)}const noop=n=>n,combineFunctions=(n,e)=>i=>e(n(i)),pipe=(...n)=>n.reduce(combineFunctions),progress=(n,e,i)=>{const s=e-n;return s===0?1:(i-n)/s};class SubscriptionManager{constructor(){this.subscriptions=[]}add(e){return addUniqueItem(this.subscriptions,e),()=>removeItem(this.subscriptions,e)}notify(e,i,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,i,s);else for(let a=0;a<r;a++){const o=this.subscriptions[a];o&&o(e,i,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const secondsToMilliseconds=n=>n*1e3,millisecondsToSeconds=n=>n/1e3;function velocityPerSecond(n,e){return e?n*(1e3/e):0}const warned=new Set;function warnOnce(n,e,i){n||warned.has(e)||(console.warn(formatErrorMessage(e,i)),warned.add(e))}const calcBezier=(n,e,i)=>(((1-3*i+3*e)*n+(3*i-6*e))*n+3*e)*n,subdivisionPrecision=1e-7,subdivisionMaxIterations=12;function binarySubdivide(n,e,i,s,r){let a,o,l=0;do o=e+(i-e)/2,a=calcBezier(o,s,r)-n,a>0?i=o:e=o;while(Math.abs(a)>subdivisionPrecision&&++l<subdivisionMaxIterations);return o}function cubicBezier(n,e,i,s){if(n===e&&i===s)return noop;const r=a=>binarySubdivide(a,0,1,n,i);return a=>a===0||a===1?a:calcBezier(r(a),e,s)}const mirrorEasing=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,reverseEasing=n=>e=>1-n(1-e),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=n=>(n*=2)<1?.5*backIn(n):.5*(2-Math.pow(2,-10*(n-1))),circIn=n=>1-Math.sin(Math.acos(n)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=n=>Array.isArray(n)&&typeof n[0]!="number",isBezierDefinition=n=>Array.isArray(n)&&typeof n[0]=="number",easingLookup={linear:noop,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},isValidEasing=n=>typeof n=="string",easingDefinitionToFunction=n=>{if(isBezierDefinition(n)){invariant(n.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,s,r]=n;return cubicBezier(e,i,s,r)}else if(isValidEasing(n))return invariant(easingLookup[n]!==void 0,`Invalid easing type '${n}'`,"invalid-easing-type"),easingLookup[n];return n},stepsOrder=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],statsBuffer={value:null,addProjectionMetrics:null};function createRenderStep(n,e){let i=new Set,s=new Set,r=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},u=0;function c(p){o.has(p)&&(f.schedule(p),n()),u++,p(l)}const f={schedule:(p,d=!1,m=!1)=>{const T=m&&r?i:s;return d&&o.add(p),T.has(p)||T.add(p),p},cancel:p=>{s.delete(p),o.delete(p)},process:p=>{if(l=p,r){a=!0;return}r=!0,[i,s]=[s,i],i.forEach(c),e&&statsBuffer.value&&statsBuffer.value.frameloop[e].push(u),u=0,i.clear(),r=!1,a&&(a=!1,f.process(p))}};return f}const maxElapsed=40;function createRenderBatcher(n,e){let i=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},a=()=>i=!0,o=stepsOrder.reduce((g,S)=>(g[S]=createRenderStep(a,e?S:void 0),g),{}),{setup:l,read:u,resolveKeyframes:c,preUpdate:f,update:p,preRender:d,render:m,postRender:P}=o,T=()=>{const g=MotionGlobalConfig.useManualTiming?r.timestamp:performance.now();i=!1,MotionGlobalConfig.useManualTiming||(r.delta=s?1e3/60:Math.max(Math.min(g-r.timestamp,maxElapsed),1)),r.timestamp=g,r.isProcessing=!0,l.process(r),u.process(r),c.process(r),f.process(r),p.process(r),d.process(r),m.process(r),P.process(r),r.isProcessing=!1,i&&e&&(s=!1,n(T))},x=()=>{i=!0,s=!0,r.isProcessing||n(T)};return{schedule:stepsOrder.reduce((g,S)=>{const E=o[S];return g[S]=(A,M=!1,b=!1)=>(i||x(),E.schedule(A,M,b)),g},{}),cancel:g=>{for(let S=0;S<stepsOrder.length;S++)o[stepsOrder[S]].cancel(g)},state:r,steps:o}}const{schedule:frame,cancel:cancelFrame,state:frameData,steps:frameSteps}=createRenderBatcher(typeof requestAnimationFrame<"u"?requestAnimationFrame:noop,!0);let now;function clearTime(){now=void 0}const time={now:()=>(now===void 0&&time.set(frameData.isProcessing||MotionGlobalConfig.useManualTiming?frameData.timestamp:performance.now()),now),set:n=>{now=n,queueMicrotask(clearTime)}},checkStringStartsWith=n=>e=>typeof e=="string"&&e.startsWith(n),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=n=>startsAsVariableToken(n)?singleCssVariableRegex.test(n.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,number={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},alpha={...number,transform:n=>clamp(0,1,n)},scale={...number,default:1},sanitize=n=>Math.round(n*1e5)/1e5,floatRegex=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function isNullish(n){return n==null}const singleColorRegex=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,isColorString=(n,e)=>i=>!!(typeof i=="string"&&singleColorRegex.test(i)&&i.startsWith(n)||e&&!isNullish(i)&&Object.prototype.hasOwnProperty.call(i,e)),splitColor=(n,e,i)=>s=>{if(typeof s!="string")return s;const[r,a,o,l]=s.match(floatRegex);return{[n]:parseFloat(r),[e]:parseFloat(a),[i]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},clampRgbUnit=n=>clamp(0,255,n),rgbUnit={...number,transform:n=>Math.round(clampRgbUnit(n))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:n,green:e,blue:i,alpha:s=1})=>"rgba("+rgbUnit.transform(n)+", "+rgbUnit.transform(e)+", "+rgbUnit.transform(i)+", "+sanitize(alpha.transform(s))+")"};function parseHex(n){let e="",i="",s="",r="";return n.length>5?(e=n.substring(1,3),i=n.substring(3,5),s=n.substring(5,7),r=n.substring(7,9)):(e=n.substring(1,2),i=n.substring(2,3),s=n.substring(3,4),r=n.substring(4,5),e+=e,i+=i,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},createUnitType=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:n=>percent.parse(n)/100,transform:n=>percent.transform(n*100)},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:i,alpha:s=1})=>"hsla("+Math.round(n)+", "+percent.transform(sanitize(e))+", "+percent.transform(sanitize(i))+", "+sanitize(alpha.transform(s))+")"},color={test:n=>rgba.test(n)||hex.test(n)||hsla.test(n),parse:n=>rgba.test(n)?rgba.parse(n):hsla.test(n)?hsla.parse(n):hex.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?rgba.transform(n):hsla.transform(n),getAnimatableNone:n=>{const e=color.parse(n);return e.alpha=0,color.transform(e)}},colorRegex=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function test(n){var e,i;return isNaN(n)&&typeof n=="string"&&(((e=n.match(floatRegex))==null?void 0:e.length)||0)+(((i=n.match(colorRegex))==null?void 0:i.length)||0)>0}const NUMBER_TOKEN="number",COLOR_TOKEN="color",VAR_TOKEN="var",VAR_FUNCTION_TOKEN="var(",SPLIT_TOKEN="${}",complexRegex=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function analyseComplexValue(n){const e=n.toString(),i=[],s={color:[],number:[],var:[]},r=[];let a=0;const l=e.replace(complexRegex,u=>(color.test(u)?(s.color.push(a),r.push(COLOR_TOKEN),i.push(color.parse(u))):u.startsWith(VAR_FUNCTION_TOKEN)?(s.var.push(a),r.push(VAR_TOKEN),i.push(u)):(s.number.push(a),r.push(NUMBER_TOKEN),i.push(parseFloat(u))),++a,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:i,split:l,indexes:s,types:r}}function parseComplexValue(n){return analyseComplexValue(n).values}function createTransformer(n){const{split:e,types:i}=analyseComplexValue(n),s=e.length;return r=>{let a="";for(let o=0;o<s;o++)if(a+=e[o],r[o]!==void 0){const l=i[o];l===NUMBER_TOKEN?a+=sanitize(r[o]):l===COLOR_TOKEN?a+=color.transform(r[o]):a+=r[o]}return a}}const convertNumbersToZero=n=>typeof n=="number"?0:color.test(n)?color.getAnimatableNone(n):n;function getAnimatableNone$1(n){const e=parseComplexValue(n);return createTransformer(n)(e.map(convertNumbersToZero))}const complex={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1};function hueToRgb(n,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(e-n)*6*i:i<1/2?e:i<2/3?n+(e-n)*(2/3-i)*6:n}function hslaToRgba({hue:n,saturation:e,lightness:i,alpha:s}){n/=360,e/=100,i/=100;let r=0,a=0,o=0;if(!e)r=a=o=i;else{const l=i<.5?i*(1+e):i+e-i*e,u=2*i-l;r=hueToRgb(u,l,n+1/3),a=hueToRgb(u,l,n),o=hueToRgb(u,l,n-1/3)}return{red:Math.round(r*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:s}}function mixImmediate(n,e){return i=>i>0?e:n}const mixNumber$1=(n,e,i)=>n+(e-n)*i,mixLinearColor=(n,e,i)=>{const s=n*n,r=i*(e*e-s)+s;return r<0?0:Math.sqrt(r)},colorTypes=[hex,rgba,hsla],getColorType=n=>colorTypes.find(e=>e.test(n));function asRGBA(n){const e=getColorType(n);if(warning(!!e,`'${n}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let i=e.parse(n);return e===hsla&&(i=hslaToRgba(i)),i}const mixColor=(n,e)=>{const i=asRGBA(n),s=asRGBA(e);if(!i||!s)return mixImmediate(n,e);const r={...i};return a=>(r.red=mixLinearColor(i.red,s.red,a),r.green=mixLinearColor(i.green,s.green,a),r.blue=mixLinearColor(i.blue,s.blue,a),r.alpha=mixNumber$1(i.alpha,s.alpha,a),rgba.transform(r))},invisibleValues=new Set(["none","hidden"]);function mixVisibility(n,e){return invisibleValues.has(n)?i=>i<=0?n:e:i=>i>=1?e:n}function mixNumber(n,e){return i=>mixNumber$1(n,e,i)}function getMixer(n){return typeof n=="number"?mixNumber:typeof n=="string"?isCSSVariableToken(n)?mixImmediate:color.test(n)?mixColor:mixComplex:Array.isArray(n)?mixArray:typeof n=="object"?color.test(n)?mixColor:mixObject:mixImmediate}function mixArray(n,e){const i=[...n],s=i.length,r=n.map((a,o)=>getMixer(a)(a,e[o]));return a=>{for(let o=0;o<s;o++)i[o]=r[o](a);return i}}function mixObject(n,e){const i={...n,...e},s={};for(const r in i)n[r]!==void 0&&e[r]!==void 0&&(s[r]=getMixer(n[r])(n[r],e[r]));return r=>{for(const a in s)i[a]=s[a](r);return i}}function matchOrder(n,e){const i=[],s={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const a=e.types[r],o=n.indexes[a][s[a]],l=n.values[o]??0;i[r]=l,s[a]++}return i}const mixComplex=(n,e)=>{const i=complex.createTransformer(e),s=analyseComplexValue(n),r=analyseComplexValue(e);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?invisibleValues.has(n)&&!r.values.length||invisibleValues.has(e)&&!s.values.length?mixVisibility(n,e):pipe(mixArray(matchOrder(s,r),r.values),i):(warning(!0,`Complex values '${n}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),mixImmediate(n,e))};function mix(n,e,i){return typeof n=="number"&&typeof e=="number"&&typeof i=="number"?mixNumber$1(n,e,i):getMixer(n)(n,e)}const frameloopDriver=n=>{const e=({timestamp:i})=>n(i);return{start:(i=!0)=>frame.update(e,i),stop:()=>cancelFrame(e),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generateLinearEasing=(n,e,i=10)=>{let s="";const r=Math.max(Math.round(e/i),2);for(let a=0;a<r;a++)s+=Math.round(n(a/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},maxGeneratorDuration=2e4;function calcGeneratorDuration(n){let e=0;const i=50;let s=n.next(e);for(;!s.done&&e<maxGeneratorDuration;)e+=i,s=n.next(e);return e>=maxGeneratorDuration?1/0:e}function createGeneratorEasing(n,e=100,i){const s=i({...n,keyframes:[0,e]}),r=Math.min(calcGeneratorDuration(s),maxGeneratorDuration);return{type:"keyframes",ease:a=>s.next(r*a).value/e,duration:millisecondsToSeconds(r)}}const velocitySampleDuration=5;function calcGeneratorVelocity(n,e,i){const s=Math.max(e-velocitySampleDuration,0);return velocityPerSecond(i-n(s),e-s)}const springDefaults={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},safeMin=.001;function findSpring({duration:n=springDefaults.duration,bounce:e=springDefaults.bounce,velocity:i=springDefaults.velocity,mass:s=springDefaults.mass}){let r,a;warning(n<=secondsToMilliseconds(springDefaults.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=clamp(springDefaults.minDamping,springDefaults.maxDamping,o),n=clamp(springDefaults.minDuration,springDefaults.maxDuration,millisecondsToSeconds(n)),o<1?(r=c=>{const f=c*o,p=f*n,d=f-i,m=calcAngularFreq(c,o),P=Math.exp(-p);return safeMin-d/m*P},a=c=>{const p=c*o*n,d=p*i+i,m=Math.pow(o,2)*Math.pow(c,2)*n,P=Math.exp(-p),T=calcAngularFreq(Math.pow(c,2),o);return(-r(c)+safeMin>0?-1:1)*((d-m)*P)/T}):(r=c=>{const f=Math.exp(-c*n),p=(c-i)*n+1;return-safeMin+f*p},a=c=>{const f=Math.exp(-c*n),p=(i-c)*(n*n);return f*p});const l=5/n,u=approximateRoot(r,a,l);if(n=secondsToMilliseconds(n),isNaN(u))return{stiffness:springDefaults.stiffness,damping:springDefaults.damping,duration:n};{const c=Math.pow(u,2)*s;return{stiffness:c,damping:o*2*Math.sqrt(s*c),duration:n}}}const rootIterations=12;function approximateRoot(n,e,i){let s=i;for(let r=1;r<rootIterations;r++)s=s-n(s)/e(s);return s}function calcAngularFreq(n,e){return n*Math.sqrt(1-e*e)}const durationKeys=["duration","bounce"],physicsKeys=["stiffness","damping","mass"];function isSpringType(n,e){return e.some(i=>n[i]!==void 0)}function getSpringOptions(n){let e={velocity:springDefaults.velocity,stiffness:springDefaults.stiffness,damping:springDefaults.damping,mass:springDefaults.mass,isResolvedFromDuration:!1,...n};if(!isSpringType(n,physicsKeys)&&isSpringType(n,durationKeys))if(n.visualDuration){const i=n.visualDuration,s=2*Math.PI/(i*1.2),r=s*s,a=2*clamp(.05,1,1-(n.bounce||0))*Math.sqrt(r);e={...e,mass:springDefaults.mass,stiffness:r,damping:a}}else{const i=findSpring(n);e={...e,...i,mass:springDefaults.mass},e.isResolvedFromDuration=!0}return e}function spring(n=springDefaults.visualDuration,e=springDefaults.bounce){const i=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:s,restDelta:r}=i;const a=i.keyframes[0],o=i.keyframes[i.keyframes.length-1],l={done:!1,value:a},{stiffness:u,damping:c,mass:f,duration:p,velocity:d,isResolvedFromDuration:m}=getSpringOptions({...i,velocity:-millisecondsToSeconds(i.velocity||0)}),P=d||0,T=c/(2*Math.sqrt(u*f)),x=o-a,y=millisecondsToSeconds(Math.sqrt(u/f)),C=Math.abs(x)<5;s||(s=C?springDefaults.restSpeed.granular:springDefaults.restSpeed.default),r||(r=C?springDefaults.restDelta.granular:springDefaults.restDelta.default);let g;if(T<1){const E=calcAngularFreq(y,T);g=A=>{const M=Math.exp(-T*y*A);return o-M*((P+T*y*x)/E*Math.sin(E*A)+x*Math.cos(E*A))}}else if(T===1)g=E=>o-Math.exp(-y*E)*(x+(P+y*x)*E);else{const E=y*Math.sqrt(T*T-1);g=A=>{const M=Math.exp(-T*y*A),b=Math.min(E*A,300);return o-M*((P+T*y*x)*Math.sinh(b)+E*x*Math.cosh(b))/E}}const S={calculatedDuration:m&&p||null,next:E=>{const A=g(E);if(m)l.done=E>=p;else{let M=E===0?P:0;T<1&&(M=E===0?secondsToMilliseconds(P):calcGeneratorVelocity(g,E,A));const b=Math.abs(M)<=s,F=Math.abs(o-A)<=r;l.done=b&&F}return l.value=l.done?o:A,l},toString:()=>{const E=Math.min(calcGeneratorDuration(S),maxGeneratorDuration),A=generateLinearEasing(M=>S.next(E*M).value,E,30);return E+"ms "+A},toTransition:()=>{}};return S}spring.applyToOptions=n=>{const e=createGeneratorEasing(n,100,spring);return n.ease=e.ease,n.duration=secondsToMilliseconds(e.duration),n.type="keyframes",n};function inertia({keyframes:n,velocity:e=0,power:i=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:u,restDelta:c=.5,restSpeed:f}){const p=n[0],d={done:!1,value:p},m=b=>l!==void 0&&b<l||u!==void 0&&b>u,P=b=>l===void 0?u:u===void 0||Math.abs(l-b)<Math.abs(u-b)?l:u;let T=i*e;const x=p+T,y=o===void 0?x:o(x);y!==x&&(T=y-p);const C=b=>-T*Math.exp(-b/s),g=b=>y+C(b),S=b=>{const F=C(b),G=g(b);d.done=Math.abs(F)<=c,d.value=d.done?y:G};let E,A;const M=b=>{m(d.value)&&(E=b,A=spring({keyframes:[d.value,P(d.value)],velocity:calcGeneratorVelocity(g,b,d.value),damping:r,stiffness:a,restDelta:c,restSpeed:f}))};return M(0),{calculatedDuration:null,next:b=>{let F=!1;return!A&&E===void 0&&(F=!0,S(b),M(b)),E!==void 0&&b>=E?A.next(b-E):(!F&&S(b),d)}}}function createMixers(n,e,i){const s=[],r=i||MotionGlobalConfig.mix||mix,a=n.length-1;for(let o=0;o<a;o++){let l=r(n[o],n[o+1]);if(e){const u=Array.isArray(e)?e[o]||noop:e;l=pipe(u,l)}s.push(l)}return s}function interpolate(n,e,{clamp:i=!0,ease:s,mixer:r}={}){const a=n.length;if(invariant(a===e.length,"Both input and output ranges must be the same length","range-length"),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const o=n[0]===n[1];n[0]>n[a-1]&&(n=[...n].reverse(),e=[...e].reverse());const l=createMixers(e,s,r),u=l.length,c=f=>{if(o&&f<n[0])return e[0];let p=0;if(u>1)for(;p<n.length-2&&!(f<n[p+1]);p++);const d=progress(n[p],n[p+1],f);return l[p](d)};return i?f=>c(clamp(n[0],n[a-1],f)):c}function fillOffset(n,e){const i=n[n.length-1];for(let s=1;s<=e;s++){const r=progress(0,e,s);n.push(mixNumber$1(i,1,r))}}function defaultOffset(n){const e=[0];return fillOffset(e,n.length-1),e}function convertOffsetToTimes(n,e){return n.map(i=>i*e)}function defaultEasing(n,e){return n.map(()=>e||easeInOut).splice(0,n.length-1)}function keyframes({duration:n=300,keyframes:e,times:i,ease:s="easeInOut"}){const r=isEasingArray(s)?s.map(easingDefinitionToFunction):easingDefinitionToFunction(s),a={done:!1,value:e[0]},o=convertOffsetToTimes(i&&i.length===e.length?i:defaultOffset(e),n),l=interpolate(o,e,{ease:Array.isArray(r)?r:defaultEasing(e,r)});return{calculatedDuration:n,next:u=>(a.value=l(u),a.done=u>=n,a)}}const isNotNull$1=n=>n!==null;function getFinalKeyframe$1(n,{repeat:e,repeatType:i="loop"},s,r=1){const a=n.filter(isNotNull$1),l=r<0||e&&i!=="loop"&&e%2===1?0:a.length-1;return!l||s===void 0?a[l]:s}const transitionTypeMap={decay:inertia,inertia,tween:keyframes,keyframes,spring};function replaceTransitionType(n){typeof n.type=="string"&&(n.type=transitionTypeMap[n.type])}class WithPromise{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,i){return this.finished.then(e,i)}}const percentToProgress=n=>n/100;class JSAnimation extends WithPromise{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,r;const{motionValue:i}=this.options;i&&i.updatedAt!==time.now()&&this.tick(time.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(s=this.options).onStop)==null||r.call(s))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;replaceTransitionType(e);const{type:i=keyframes,repeat:s=0,repeatDelay:r=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const u=i||keyframes;process.env.NODE_ENV!=="production"&&u!==keyframes&&invariant(l.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${l}`,"spring-two-frames"),u!==keyframes&&typeof l[0]!="number"&&(this.mixKeyframes=pipe(percentToProgress,mix(l[0],l[1])),l=[0,100]);const c=u({...e,keyframes:l});a==="mirror"&&(this.mirroredGenerator=u({...e,keyframes:[...l].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=calcGeneratorDuration(c));const{calculatedDuration:f}=c;this.calculatedDuration=f,this.resolvedDuration=f+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=c}updateTime(e){const i=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=i}tick(e,i=!1){const{generator:s,totalDuration:r,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:u}=this;if(this.startTime===null)return s.next(0);const{delay:c=0,keyframes:f,repeat:p,repeatType:d,repeatDelay:m,type:P,onUpdate:T,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),i?this.currentTime=e:this.updateTime(e);const y=this.currentTime-c*(this.playbackSpeed>=0?1:-1),C=this.playbackSpeed>=0?y<0:y>r;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let g=this.currentTime,S=s;if(p){const b=Math.min(this.currentTime,r)/l;let F=Math.floor(b),G=b%1;!G&&b>=1&&(G=1),G===1&&F--,F=Math.min(F,p+1),!!(F%2)&&(d==="reverse"?(G=1-G,m&&(G-=m/l)):d==="mirror"&&(S=o)),g=clamp(0,1,G)*l}const E=C?{done:!1,value:f[0]}:S.next(g);a&&(E.value=a(E.value));let{done:A}=E;!C&&u!==null&&(A=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return M&&P!==inertia&&(E.value=getFinalKeyframe$1(f,this.options,x,this.speed)),T&&T(E.value),M&&this.finish(),E}then(e,i){return this.finished.then(e,i)}get duration(){return millisecondsToSeconds(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(this.currentTime)}set time(e){var i;e=secondsToMilliseconds(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(i=this.driver)==null||i.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(time.now());const i=this.playbackSpeed!==e;this.playbackSpeed=e,i&&(this.time=millisecondsToSeconds(this.currentTime))}play(){var r,a;if(this.isStopped)return;const{driver:e=frameloopDriver,startTime:i}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(a=(r=this.options).onPlay)==null||a.call(r);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=i??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(time.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,i;this.notifyFinished(),this.teardown(),this.state="finished",(i=(e=this.options).onComplete)==null||i.call(e)}cancel(){var e,i;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(i=(e=this.options).onCancel)==null||i.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var i;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(i=this.driver)==null||i.stop(),e.observe(this)}}function fillWildcards(n){for(let e=1;e<n.length;e++)n[e]??(n[e]=n[e-1])}const radToDeg=n=>n*180/Math.PI,rotate=n=>{const e=radToDeg(Math.atan2(n[1],n[0]));return rebaseAngle(e)},matrix2dParsers={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate,rotateZ:rotate,skewX:n=>radToDeg(Math.atan(n[1])),skewY:n=>radToDeg(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},rebaseAngle=n=>(n=n%360,n<0&&(n+=360),n),rotateZ=rotate,scaleX=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),scaleY=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),matrix3dParsers={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX,scaleY,scale:n=>(scaleX(n)+scaleY(n))/2,rotateX:n=>rebaseAngle(radToDeg(Math.atan2(n[6],n[5]))),rotateY:n=>rebaseAngle(radToDeg(Math.atan2(-n[2],n[0]))),rotateZ,rotate:rotateZ,skewX:n=>radToDeg(Math.atan(n[4])),skewY:n=>radToDeg(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function defaultTransformValue(n){return n.includes("scale")?1:0}function parseValueFromTransform(n,e){if(!n||n==="none")return defaultTransformValue(e);const i=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(i)s=matrix3dParsers,r=i;else{const l=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=matrix2dParsers,r=l}if(!r)return defaultTransformValue(e);const a=s[e],o=r[1].split(",").map(convertTransformToNumber);return typeof a=="function"?a(o):o[a]}const readTransformValue=(n,e)=>{const{transform:i="none"}=getComputedStyle(n);return parseValueFromTransform(i,e)};function convertTransformToNumber(n){return parseFloat(n.trim())}const transformPropOrder=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],transformProps=new Set(transformPropOrder),isNumOrPxType=n=>n===number||n===px,transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(n=>!transformKeys.has(n));function removeNonTranslationalTransform(n){const e=[];return nonTranslationalTransformKeys.forEach(i=>{const s=n.getValue(i);s!==void 0&&(e.push([i,s.get()]),s.set(i.startsWith("scale")?1:0))}),e}const positionalValues={width:({x:n},{paddingLeft:e="0",paddingRight:i="0"})=>n.max-n.min-parseFloat(e)-parseFloat(i),height:({y:n},{paddingTop:e="0",paddingBottom:i="0"})=>n.max-n.min-parseFloat(e)-parseFloat(i),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:(n,{transform:e})=>parseValueFromTransform(e,"x"),y:(n,{transform:e})=>parseValueFromTransform(e,"y")};positionalValues.translateX=positionalValues.x;positionalValues.translateY=positionalValues.y;const toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1,isForced=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const n=Array.from(toResolve).filter(s=>s.needsMeasurement),e=new Set(n.map(s=>s.element)),i=new Map;e.forEach(s=>{const r=removeNonTranslationalTransform(s);r.length&&(i.set(s,r),s.render())}),n.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const r=i.get(s);r&&r.forEach(([a,o])=>{var l;(l=s.getValue(a))==null||l.set(o)})}),n.forEach(s=>s.measureEndState()),n.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(n=>n.complete(isForced)),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){isForced=!0,readAllKeyframes(),measureAllKeyframes(),isForced=!1}class KeyframeResolver{constructor(e,i,s,r,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=i,this.name=s,this.motionValue=r,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(toResolve.add(this),isScheduled||(isScheduled=!0,frame.read(readAllKeyframes),frame.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:i,element:s,motionValue:r}=this;if(e[0]===null){const a=r==null?void 0:r.get(),o=e[e.length-1];if(a!==void 0)e[0]=a;else if(s&&i){const l=s.readValue(i,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),r&&a===void 0&&r.set(e[0])}fillWildcards(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),toResolve.delete(this)}cancel(){this.state==="scheduled"&&(toResolve.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const isCSSVar=n=>n.startsWith("--");function setStyle(n,e,i){isCSSVar(e)?n.style.setProperty(e,i):n.style[e]=i}const supportsScrollTimeline=memo(()=>window.ScrollTimeline!==void 0),supportsFlags={};function memoSupports(n,e){const i=memo(n);return()=>supportsFlags[e]??i()}const supportsLinearEasing=memoSupports(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),cubicBezierAsString=([n,e,i,s])=>`cubic-bezier(${n}, ${e}, ${i}, ${s})`,supportedWaapiEasing={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(n,e){if(n)return typeof n=="function"?supportsLinearEasing()?generateLinearEasing(n,e):"ease-out":isBezierDefinition(n)?cubicBezierAsString(n):Array.isArray(n)?n.map(i=>mapEasingToNativeEasing(i,e)||supportedWaapiEasing.easeOut):supportedWaapiEasing[n]}function startWaapiAnimation(n,e,i,{delay:s=0,duration:r=300,repeat:a=0,repeatType:o="loop",ease:l="easeOut",times:u}={},c=void 0){const f={[e]:i};u&&(f.offset=u);const p=mapEasingToNativeEasing(l,r);Array.isArray(p)&&(f.easing=p);const d={delay:s,duration:r,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return c&&(d.pseudoElement=c),n.animate(f,d)}function isGenerator(n){return typeof n=="function"&&"applyToOptions"in n}function applyGeneratorOptions({type:n,...e}){return isGenerator(n)&&supportsLinearEasing()?n.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class NativeAnimation extends WithPromise{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:i,name:s,keyframes:r,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:u}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,invariant(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=applyGeneratorOptions(e);this.animation=startWaapiAnimation(i,s,r,c,a),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const f=getFinalKeyframe$1(r,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(f):setStyle(i,s,f),this.animation.cancel()}u==null||u(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,i;(i=(e=this.animation).finish)==null||i.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,i;this.isPseudoElement||(i=(e=this.animation).commitStyles)==null||i.call(e)}get duration(){var i,s;const e=((s=(i=this.animation.effect)==null?void 0:i.getComputedTiming)==null?void 0:s.call(i).duration)||0;return millisecondsToSeconds(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=secondsToMilliseconds(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:i}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&supportsScrollTimeline()?(this.animation.timeline=e,noop):i(this)}}const unsupportedEasingFunctions={anticipate,backInOut,circInOut};function isUnsupportedEase(n){return n in unsupportedEasingFunctions}function replaceStringEasing(n){typeof n.ease=="string"&&isUnsupportedEase(n.ease)&&(n.ease=unsupportedEasingFunctions[n.ease])}const sampleDelta=10;class NativeAnimationExtended extends NativeAnimation{constructor(e){replaceStringEasing(e),replaceTransitionType(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:i,onUpdate:s,onComplete:r,element:a,...o}=this.options;if(!i)return;if(e!==void 0){i.set(e);return}const l=new JSAnimation({...o,autoplay:!1}),u=secondsToMilliseconds(this.finishedTime??this.time);i.setWithVelocity(l.sample(u-sampleDelta).value,l.sample(u).value,sampleDelta),l.stop()}}const isAnimatable=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(complex.test(n)||n==="0")&&!n.startsWith("url("));function hasKeyframesChanged(n){const e=n[0];if(n.length===1)return!0;for(let i=0;i<n.length;i++)if(n[i]!==e)return!0}function canAnimate(n,e,i,s){const r=n[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const a=n[n.length-1],o=isAnimatable(r,e),l=isAnimatable(a,e);return warning(o===l,`You are trying to animate ${e} from "${r}" to "${a}". "${o?a:r}" is not an animatable value.`,"value-not-animatable"),!o||!l?!1:hasKeyframesChanged(n)||(i==="spring"||isGenerator(i))&&s}function makeAnimationInstant(n){n.duration=0,n.type="keyframes"}const acceleratedValues=new Set(["opacity","clipPath","filter","transform"]),supportsWaapi=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function supportsBrowserAnimation(n){var f;const{motionValue:e,name:i,repeatDelay:s,repeatType:r,damping:a,type:o}=n;if(!(((f=e==null?void 0:e.owner)==null?void 0:f.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:c}=e.owner.getProps();return supportsWaapi()&&i&&acceleratedValues.has(i)&&(i!=="transform"||!c)&&!u&&!s&&r!=="mirror"&&a!==0&&o!=="inertia"}const MAX_RESOLVE_DELAY=40;class AsyncMotionValueAnimation extends WithPromise{constructor({autoplay:e=!0,delay:i=0,type:s="keyframes",repeat:r=0,repeatDelay:a=0,repeatType:o="loop",keyframes:l,name:u,motionValue:c,element:f,...p}){var P;super(),this.stop=()=>{var T,x;this._animation&&(this._animation.stop(),(T=this.stopTimeline)==null||T.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=time.now();const d={autoplay:e,delay:i,type:s,repeat:r,repeatDelay:a,repeatType:o,name:u,motionValue:c,element:f,...p},m=(f==null?void 0:f.KeyframeResolver)||KeyframeResolver;this.keyframeResolver=new m(l,(T,x,y)=>this.onKeyframesResolved(T,x,d,!y),u,c,f),(P=this.keyframeResolver)==null||P.scheduleResolve()}onKeyframesResolved(e,i,s,r){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:u,isHandoff:c,onUpdate:f}=s;this.resolvedAt=time.now(),canAnimate(e,a,o,l)||((MotionGlobalConfig.instantAnimations||!u)&&(f==null||f(getFinalKeyframe$1(e,s,i))),e[0]=e[e.length-1],makeAnimationInstant(s),s.repeat=0);const d={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>MAX_RESOLVE_DELAY?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:i,...s,keyframes:e},m=!c&&supportsBrowserAnimation(d)?new NativeAnimationExtended({...d,element:d.motionValue.owner.current}):new JSAnimation(d);m.finished.then(()=>this.notifyFinished()).catch(noop),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,i){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),flushKeyframeResolvers()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(n){const e=splitCSSVariableRegex.exec(n);if(!e)return[,];const[,i,s,r]=e;return[`--${i??s}`,r]}const maxDepth=4;function getVariableValue(n,e,i=1){invariant(i<=maxDepth,`Max CSS variable fallback depth detected in property "${n}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=parseCSSVariable(n);if(!s)return;const a=window.getComputedStyle(e).getPropertyValue(s);if(a){const o=a.trim();return isNumericalString(o)?parseFloat(o):o}return isCSSVariableToken(r)?getVariableValue(r,e,i+1):r}function getValueTransition(n,e){return(n==null?void 0:n[e])??(n==null?void 0:n.default)??n}const positionalKeys=new Set(["width","height","top","left","right","bottom",...transformPropOrder]),auto={test:n=>n==="auto",parse:n=>n},testValueType=n=>e=>e.test(n),dimensionValueTypes=[number,px,percent,degrees,vw,vh,auto],findDimensionValueType=n=>dimensionValueTypes.find(testValueType(n));function isNone(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||isZeroValueString(n):!0}const maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(n){const[e,i]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[s]=i.match(floatRegex)||[];if(!s)return n;const r=i.replace(s,"");let a=maxDefaults.has(e)?1:0;return s!==i&&(a*=100),e+"("+a+r+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter={...complex,getAnimatableNone:n=>{const e=n.match(functionRegex);return e?e.map(applyDefaultFilter).join(" "):n}},int={...number,transform:Math.round},transformValueTypes={rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px},numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,backgroundPositionX:px,backgroundPositionY:px,...transformValueTypes,zIndex:int,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int},defaultValueTypes={...numberValueTypes,color,backgroundColor:color,outlineColor:color,fill:color,stroke:color,borderColor:color,borderTopColor:color,borderRightColor:color,borderBottomColor:color,borderLeftColor:color,filter,WebkitFilter:filter},getDefaultValueType=n=>defaultValueTypes[n];function getAnimatableNone(n,e){let i=getDefaultValueType(n);return i!==filter&&(i=complex),i.getAnimatableNone?i.getAnimatableNone(e):void 0}const invalidTemplates=new Set(["auto","none","0"]);function makeNoneKeyframesAnimatable(n,e,i){let s=0,r;for(;s<n.length&&!r;){const a=n[s];typeof a=="string"&&!invalidTemplates.has(a)&&analyseComplexValue(a).values.length&&(r=n[s]),s++}if(r&&i)for(const a of e)n[a]=getAnimatableNone(i,r)}class DOMKeyframesResolver extends KeyframeResolver{constructor(e,i,s,r,a){super(e,i,s,r,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:i,name:s}=this;if(!i||!i.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let c=e[u];if(typeof c=="string"&&(c=c.trim(),isCSSVariableToken(c))){const f=getVariableValue(c,i.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!positionalKeys.has(s)||e.length!==2)return;const[r,a]=e,o=findDimensionValueType(r),l=findDimensionValueType(a);if(o!==l)if(isNumOrPxType(o)&&isNumOrPxType(l))for(let u=0;u<e.length;u++){const c=e[u];typeof c=="string"&&(e[u]=parseFloat(c))}else positionalValues[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:i}=this,s=[];for(let r=0;r<e.length;r++)(e[r]===null||isNone(e[r]))&&s.push(r);s.length&&makeNoneKeyframesAnimatable(e,s,i)}measureInitialState(){const{element:e,unresolvedKeyframes:i,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=positionalValues[s](e.measureViewportBox(),window.getComputedStyle(e.current)),i[0]=this.measuredOrigin;const r=i[i.length-1];r!==void 0&&e.getValue(s,r).jump(r,!1)}measureEndState(){var l;const{element:e,name:i,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const r=e.getValue(i);r&&r.jump(this.measuredOrigin,!1);const a=s.length-1,o=s[a];s[a]=positionalValues[i](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([u,c])=>{e.getValue(u).set(c)}),this.resolveNoneKeyframes()}}function resolveElements(n,e,i){if(n instanceof EventTarget)return[n];if(typeof n=="string"){const r=document.querySelectorAll(n);return r?Array.from(r):[]}return Array.from(n)}const getValueAsType=(n,e)=>e&&typeof n=="number"?e.transform(n):n;function isHTMLElement(n){return isObject(n)&&"offsetHeight"in n}const MAX_VELOCITY_DELTA=30,isFloat=n=>!isNaN(parseFloat(n));class MotionValue{constructor(e,i={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var a;const r=time.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=i.owner}setCurrent(e){this.current=e,this.updatedAt=time.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=isFloat(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&warnOnce(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,i){this.events[e]||(this.events[e]=new SubscriptionManager);const s=this.events[e].add(i);return e==="change"?()=>{s(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,i){this.passiveEffect=e,this.stopPassiveEffect=i}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,i,s){this.set(i),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,i=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>MAX_VELOCITY_DELTA)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,MAX_VELOCITY_DELTA);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(e){return this.stop(),new Promise(i=>{this.hasAnimated=!0,this.animation=e(i),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,i;(e=this.dependents)==null||e.clear(),(i=this.events.destroy)==null||i.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function motionValue(n,e){return new MotionValue(n,e)}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1),isDragging={x:!1,y:!1};function isDragActive(){return isDragging.x||isDragging.y}function setDragLock(n){return n==="x"||n==="y"?isDragging[n]?null:(isDragging[n]=!0,()=>{isDragging[n]=!1}):isDragging.x||isDragging.y?null:(isDragging.x=isDragging.y=!0,()=>{isDragging.x=isDragging.y=!1})}function setupGesture(n,e){const i=resolveElements(n),s=new AbortController,r={passive:!0,...e,signal:s.signal};return[i,r,()=>s.abort()]}function isValidHover(n){return!(n.pointerType==="touch"||isDragActive())}function hover(n,e,i={}){const[s,r,a]=setupGesture(n,i),o=l=>{if(!isValidHover(l))return;const{target:u}=l,c=e(u,l);if(typeof c!="function"||!u)return;const f=p=>{isValidHover(p)&&(c(p),u.removeEventListener("pointerleave",f))};u.addEventListener("pointerleave",f,r)};return s.forEach(l=>{l.addEventListener("pointerenter",o,r)}),a}const isNodeOrChild=(n,e)=>e?n===e?!0:isNodeOrChild(n,e.parentElement):!1,isPrimaryPointer=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,focusableElements=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function isElementKeyboardAccessible(n){return focusableElements.has(n.tagName)||n.tabIndex!==-1}const isPressing=new WeakSet;function filterEvents(n){return e=>{e.key==="Enter"&&n(e)}}function firePointerEvent(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const enableKeyboardPress=(n,e)=>{const i=n.currentTarget;if(!i)return;const s=filterEvents(()=>{if(isPressing.has(i))return;firePointerEvent(i,"down");const r=filterEvents(()=>{firePointerEvent(i,"up")}),a=()=>firePointerEvent(i,"cancel");i.addEventListener("keyup",r,e),i.addEventListener("blur",a,e)});i.addEventListener("keydown",s,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",s),e)};function isValidPressEvent(n){return isPrimaryPointer(n)&&!isDragActive()}function press(n,e,i={}){const[s,r,a]=setupGesture(n,i),o=l=>{const u=l.currentTarget;if(!isValidPressEvent(l))return;isPressing.add(u);const c=e(u,l),f=(m,P)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",d),isPressing.has(u)&&isPressing.delete(u),isValidPressEvent(m)&&typeof c=="function"&&c(m,{success:P})},p=m=>{f(m,u===window||u===document||i.useGlobalTarget||isNodeOrChild(u,m.target))},d=m=>{f(m,!1)};window.addEventListener("pointerup",p,r),window.addEventListener("pointercancel",d,r)};return s.forEach(l=>{(i.useGlobalTarget?window:l).addEventListener("pointerdown",o,r),isHTMLElement(l)&&(l.addEventListener("focus",c=>enableKeyboardPress(c,r)),!isElementKeyboardAccessible(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function isSVGElement(n){return isObject(n)&&"ownerSVGElement"in n}function isSVGSVGElement(n){return isSVGElement(n)&&n.tagName==="svg"}const isMotionValue=n=>!!(n&&n.getVelocity),valueTypes=[...dimensionValueTypes,color,complex],findValueType=n=>valueTypes.find(testValueType(n)),MotionConfigContext=React.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function setRef(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function composeRefs(...n){return e=>{let i=!1;const s=n.map(r=>{const a=setRef(r,e);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let r=0;r<s.length;r++){const a=s[r];typeof a=="function"?a():setRef(n[r],null)}}}}function useComposedRefs(...n){return React__namespace.useCallback(composeRefs(...n),n)}class PopChildMeasure extends React__namespace.Component{getSnapshotBeforeUpdate(e){const i=this.props.childRef.current;if(i&&e.isPresent&&!this.props.isPresent){const s=i.offsetParent,r=isHTMLElement(s)&&s.offsetWidth||0,a=this.props.sizeRef.current;a.height=i.offsetHeight||0,a.width=i.offsetWidth||0,a.top=i.offsetTop,a.left=i.offsetLeft,a.right=r-a.width-a.left}return null}componentDidUpdate(){}render(){return this.props.children}}function PopChild({children:n,isPresent:e,anchorX:i,root:s}){const r=React.useId(),a=React.useRef(null),o=React.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=React.useContext(MotionConfigContext),u=useComposedRefs(a,n==null?void 0:n.ref);return React.useInsertionEffect(()=>{const{width:c,height:f,top:p,left:d,right:m}=o.current;if(e||!a.current||!c||!f)return;const P=i==="left"?`left: ${d}`:`right: ${m}`;a.current.dataset.motionPopId=r;const T=document.createElement("style");l&&(T.nonce=l);const x=s??document.head;return x.appendChild(T),T.sheet&&T.sheet.insertRule(`
2
+ [data-motion-pop-id="${r}"] {
3
+ position: absolute !important;
4
+ width: ${c}px !important;
5
+ height: ${f}px !important;
6
+ ${P}px !important;
7
+ top: ${p}px !important;
8
+ }
9
+ `),()=>{x.contains(T)&&x.removeChild(T)}},[e]),jsxRuntime.jsx(PopChildMeasure,{isPresent:e,childRef:a,sizeRef:o,children:React__namespace.cloneElement(n,{ref:u})})}const PresenceChild=({children:n,initial:e,isPresent:i,onExitComplete:s,custom:r,presenceAffectsLayout:a,mode:o,anchorX:l,root:u})=>{const c=useConstant(newChildrenMap),f=React.useId();let p=!0,d=React.useMemo(()=>(p=!1,{id:f,initial:e,isPresent:i,custom:r,onExitComplete:m=>{c.set(m,!0);for(const P of c.values())if(!P)return;s&&s()},register:m=>(c.set(m,!1),()=>c.delete(m))}),[i,c,s]);return a&&p&&(d={...d}),React.useMemo(()=>{c.forEach((m,P)=>c.set(P,!1))},[i]),React__namespace.useEffect(()=>{!i&&!c.size&&s&&s()},[i]),o==="popLayout"&&(n=jsxRuntime.jsx(PopChild,{isPresent:i,anchorX:l,root:u,children:n})),jsxRuntime.jsx(PresenceContext.Provider,{value:d,children:n})};function newChildrenMap(){return new Map}function usePresence(n=!0){const e=React.useContext(PresenceContext);if(e===null)return[!0,null];const{isPresent:i,onExitComplete:s,register:r}=e,a=React.useId();React.useEffect(()=>{if(n)return r(a)},[n]);const o=React.useCallback(()=>n&&s&&s(a),[a,s,n]);return!i&&s?[!1,o]:[!0]}const getChildKey=n=>n.key||"";function onlyElements(n){const e=[];return React.Children.forEach(n,i=>{React.isValidElement(i)&&e.push(i)}),e}const AnimatePresence=({children:n,custom:e,initial:i=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:a="sync",propagate:o=!1,anchorX:l="left",root:u})=>{const[c,f]=usePresence(o),p=React.useMemo(()=>onlyElements(n),[n]),d=o&&!c?[]:p.map(getChildKey),m=React.useRef(!0),P=React.useRef(p),T=useConstant(()=>new Map),[x,y]=React.useState(p),[C,g]=React.useState(p);useIsomorphicLayoutEffect(()=>{m.current=!1,P.current=p;for(let A=0;A<C.length;A++){const M=getChildKey(C[A]);d.includes(M)?T.delete(M):T.get(M)!==!0&&T.set(M,!1)}},[C,d.length,d.join("-")]);const S=[];if(p!==x){let A=[...p];for(let M=0;M<C.length;M++){const b=C[M],F=getChildKey(b);d.includes(F)||(A.splice(M,0,b),S.push(b))}return a==="wait"&&S.length&&(A=S),g(onlyElements(A)),y(p),null}process.env.NODE_ENV!=="production"&&a==="wait"&&C.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:E}=React.useContext(LayoutGroupContext);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:C.map(A=>{const M=getChildKey(A),b=o&&!c?!1:p===C||d.includes(M),F=()=>{if(T.has(M))T.set(M,!0);else return;let G=!0;T.forEach(L=>{L||(G=!1)}),G&&(E==null||E(),g(P.current),o&&(f==null||f()),s&&s())};return jsxRuntime.jsx(PresenceChild,{isPresent:b,initial:!m.current||i?void 0:!1,custom:e,presenceAffectsLayout:r,mode:a,root:u,onExitComplete:b?void 0:F,anchorX:l,children:A},M)})})},LazyContext=React.createContext({strict:!1}),featureProps={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},featureDefinitions={};for(const n in featureProps)featureDefinitions[n]={isEnabled:e=>featureProps[n].some(i=>!!e[i])};function loadFeatures(n){for(const e in n)featureDefinitions[e]={...featureDefinitions[e],...n[e]}}const validMotionProps=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function isValidMotionProp(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||validMotionProps.has(n)}let shouldForward=n=>!isValidMotionProp(n);function loadExternalIsValidProp(n){typeof n=="function"&&(shouldForward=e=>e.startsWith("on")?!isValidMotionProp(e):n(e))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(n,e,i){const s={};for(const r in n)r==="values"&&typeof n.values=="object"||(shouldForward(r)||i===!0&&isValidMotionProp(r)||!e&&!isValidMotionProp(r)||n.draggable&&r.startsWith("onDrag"))&&(s[r]=n[r]);return s}const MotionContext=React.createContext({});function isAnimationControls(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function isVariantLabel(n){return typeof n=="string"||Array.isArray(n)}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(n){return isAnimationControls(n.animate)||variantProps.some(e=>isVariantLabel(n[e]))}function isVariantNode(n){return!!(isControllingVariants(n)||n.variants)}function getCurrentTreeVariants(n,e){if(isControllingVariants(n)){const{initial:i,animate:s}=n;return{initial:i===!1||isVariantLabel(i)?i:void 0,animate:isVariantLabel(s)?s:void 0}}return n.inherit!==!1?e:{}}function useCreateMotionContext(n){const{initial:e,animate:i}=getCurrentTreeVariants(n,React.useContext(MotionContext));return React.useMemo(()=>({initial:e,animate:i}),[variantLabelsAsDependency(e),variantLabelsAsDependency(i)])}function variantLabelsAsDependency(n){return Array.isArray(n)?n.join(" "):n}const scaleCorrectors={};function addScaleCorrector(n){for(const e in n)scaleCorrectors[e]=n[e],isCSSVariableName(e)&&(scaleCorrectors[e].isCSSVariable=!0)}function isForcedMotionValue(n,{layout:e,layoutId:i}){return transformProps.has(n)||n.startsWith("origin")||(e||i!==void 0)&&(!!scaleCorrectors[n]||n==="opacity")}const translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(n,e,i){let s="",r=!0;for(let a=0;a<numTransforms;a++){const o=transformPropOrder[a],l=n[o];if(l===void 0)continue;let u=!0;if(typeof l=="number"?u=l===(o.startsWith("scale")?1:0):u=parseFloat(l)===0,!u||i){const c=getValueAsType(l,numberValueTypes[o]);if(!u){r=!1;const f=translateAlias[o]||o;s+=`${f}(${c}) `}i&&(e[o]=c)}}return s=s.trim(),i?s=i(e,r?"":s):r&&(s="none"),s}function buildHTMLStyles(n,e,i){const{style:s,vars:r,transformOrigin:a}=n;let o=!1,l=!1;for(const u in e){const c=e[u];if(transformProps.has(u)){o=!0;continue}else if(isCSSVariableName(u)){r[u]=c;continue}else{const f=getValueAsType(c,numberValueTypes[u]);u.startsWith("origin")?(l=!0,a[u]=f):s[u]=f}}if(e.transform||(o||i?s.transform=buildTransform(e,n.transform,i):s.transform&&(s.transform="none")),l){const{originX:u="50%",originY:c="50%",originZ:f=0}=a;s.transformOrigin=`${u} ${c} ${f}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(n,e,i){for(const s in e)!isMotionValue(e[s])&&!isForcedMotionValue(s,i)&&(n[s]=e[s])}function useInitialMotionValues({transformTemplate:n},e){return React.useMemo(()=>{const i=createHtmlRenderState();return buildHTMLStyles(i,e,n),Object.assign({},i.vars,i.style)},[e])}function useStyle(n,e){const i=n.style||{},s={};return copyRawValuesOnly(s,i,n),Object.assign(s,useInitialMotionValues(n,e)),s}function useHTMLProps(n,e){const i={},s=useStyle(n,e);return n.drag&&n.dragListener!==!1&&(i.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(i.tabIndex=0),i.style=s,i}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(n,e,i=1,s=0,r=!0){n.pathLength=1;const a=r?dashKeys:camelKeys;n[a.offset]=px.transform(-s);const o=px.transform(e),l=px.transform(i);n[a.array]=`${o} ${l}`}function buildSVGAttrs(n,{attrX:e,attrY:i,attrScale:s,pathLength:r,pathSpacing:a=1,pathOffset:o=0,...l},u,c,f){if(buildHTMLStyles(n,l,c),u){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:p,style:d}=n;p.transform&&(d.transform=p.transform,delete p.transform),(d.transform||p.transformOrigin)&&(d.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),d.transform&&(d.transformBox=(f==null?void 0:f.transformBox)??"fill-box",delete p.transformBox),e!==void 0&&(p.x=e),i!==void 0&&(p.y=i),s!==void 0&&(p.scale=s),r!==void 0&&buildSVGPath(p,r,a,o,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=n=>typeof n=="string"&&n.toLowerCase()==="svg";function useSVGProps(n,e,i,s){const r=React.useMemo(()=>{const a=createSvgRenderState();return buildSVGAttrs(a,e,isSVGTag(s),n.transformTemplate,n.style),{...a.attrs,style:{...a.style}}},[e]);if(n.style){const a={};copyRawValuesOnly(a,n.style,n),r.style={...a,...r.style}}return r}const lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function isSVGComponent(n){return typeof n!="string"||n.includes("-")?!1:!!(lowercaseSVGElements.indexOf(n)>-1||/[A-Z]/u.test(n))}function useRender(n,e,i,{latestValues:s},r,a=!1){const l=(isSVGComponent(n)?useSVGProps:useHTMLProps)(e,s,r,n),u=filterProps(e,typeof n=="string",a),c=n!==React.Fragment?{...u,...l,ref:i}:{},{children:f}=e,p=React.useMemo(()=>isMotionValue(f)?f.get():f,[f]);return React.createElement(n,{...c,children:p})}function getValueState(n){const e=[{},{}];return n==null||n.values.forEach((i,s)=>{e[0][s]=i.get(),e[1][s]=i.getVelocity()}),e}function resolveVariantFromProps(n,e,i,s){if(typeof e=="function"){const[r,a]=getValueState(s);e=e(i!==void 0?i:n.custom,r,a)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[r,a]=getValueState(s);e=e(i!==void 0?i:n.custom,r,a)}return e}function resolveMotionValue(n){return isMotionValue(n)?n.get():n}function makeState({scrapeMotionValuesFromProps:n,createRenderState:e},i,s,r){return{latestValues:makeLatestValues(i,s,r,n),renderState:e()}}function makeLatestValues(n,e,i,s){const r={},a=s(n,{});for(const d in a)r[d]=resolveMotionValue(a[d]);let{initial:o,animate:l}=n;const u=isControllingVariants(n),c=isVariantNode(n);e&&c&&!u&&n.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let f=i?i.initial===!1:!1;f=f||o===!1;const p=f?l:o;if(p&&typeof p!="boolean"&&!isAnimationControls(p)){const d=Array.isArray(p)?p:[p];for(let m=0;m<d.length;m++){const P=resolveVariantFromProps(n,d[m]);if(P){const{transitionEnd:T,transition:x,...y}=P;for(const C in y){let g=y[C];if(Array.isArray(g)){const S=f?g.length-1:0;g=g[S]}g!==null&&(r[C]=g)}for(const C in T)r[C]=T[C]}}}return r}const makeUseVisualState=n=>(e,i)=>{const s=React.useContext(MotionContext),r=React.useContext(PresenceContext),a=()=>makeState(n,e,s,r);return i?a():useConstant(a)};function scrapeMotionValuesFromProps$1(n,e,i){var a;const{style:s}=n,r={};for(const o in s)(isMotionValue(s[o])||e.style&&isMotionValue(e.style[o])||isForcedMotionValue(o,n)||((a=i==null?void 0:i.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(r[o]=s[o]);return r}const useHTMLVisualState=makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState});function scrapeMotionValuesFromProps(n,e,i){const s=scrapeMotionValuesFromProps$1(n,e,i);for(const r in n)if(isMotionValue(n[r])||isMotionValue(e[r])){const a=transformPropOrder.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[a]=n[r]}return s}const useSVGVisualState=makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function isRefObject(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function useMotionRef(n,e,i){return React.useCallback(s=>{s&&n.onMount&&n.onMount(s),e&&(s?e.mount(s):e.unmount()),i&&(typeof i=="function"?i(s):isRefObject(i)&&(i.current=s))},[e])}const camelToDash=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),SwitchLayoutGroupContext=React.createContext({});function useVisualElement(n,e,i,s,r){var T,x;const{visualElement:a}=React.useContext(MotionContext),o=React.useContext(LazyContext),l=React.useContext(PresenceContext),u=React.useContext(MotionConfigContext).reducedMotion,c=React.useRef(null);s=s||o.renderer,!c.current&&s&&(c.current=s(n,{visualState:e,parent:a,props:i,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u}));const f=c.current,p=React.useContext(SwitchLayoutGroupContext);f&&!f.projection&&r&&(f.type==="html"||f.type==="svg")&&createProjectionNode$1(c.current,i,r,p);const d=React.useRef(!1);React.useInsertionEffect(()=>{f&&d.current&&f.update(i,l)});const m=i[optimizedAppearDataAttribute],P=React.useRef(!!m&&!((T=window.MotionHandoffIsComplete)!=null&&T.call(window,m))&&((x=window.MotionHasOptimisedAnimation)==null?void 0:x.call(window,m)));return useIsomorphicLayoutEffect(()=>{f&&(d.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),P.current&&f.animationState&&f.animationState.animateChanges())}),React.useEffect(()=>{f&&(!P.current&&f.animationState&&f.animationState.animateChanges(),P.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,m)}),P.current=!1),f.enteringChildren=void 0)}),f}function createProjectionNode$1(n,e,i,s){const{layoutId:r,layout:a,drag:o,dragConstraints:l,layoutScroll:u,layoutRoot:c,layoutCrossfade:f}=e;n.projection=new i(n.latestValues,e["data-framer-portal-id"]?void 0:getClosestProjectingNode(n.parent)),n.projection.setOptions({layoutId:r,layout:a,alwaysMeasureLayout:!!o||l&&isRefObject(l),visualElement:n,animationType:typeof a=="string"?a:"both",initialPromotionConfig:s,crossfade:f,layoutScroll:u,layoutRoot:c})}function getClosestProjectingNode(n){if(n)return n.options.allowProjection!==!1?n.projection:getClosestProjectingNode(n.parent)}function createMotionComponent(n,{forwardMotionProps:e=!1}={},i,s){i&&loadFeatures(i);const r=isSVGComponent(n)?useSVGVisualState:useHTMLVisualState;function a(l,u){let c;const f={...React.useContext(MotionConfigContext),...l,layoutId:useLayoutId(l)},{isStatic:p}=f,d=useCreateMotionContext(l),m=r(l,p);if(!p&&isBrowser){useStrictMode(f,i);const P=getProjectionFunctionality(f);c=P.MeasureLayout,d.visualElement=useVisualElement(n,m,f,s,P.ProjectionNode)}return jsxRuntime.jsxs(MotionContext.Provider,{value:d,children:[c&&d.visualElement?jsxRuntime.jsx(c,{visualElement:d.visualElement,...f}):null,useRender(n,l,useMotionRef(m,d.visualElement,u),m,p,e)]})}a.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const o=React.forwardRef(a);return o[motionComponentSymbol]=n,o}function useLayoutId({layoutId:n}){const e=React.useContext(LayoutGroupContext).id;return e&&n!==void 0?e+"-"+n:n}function useStrictMode(n,e){const i=React.useContext(LazyContext).strict;if(process.env.NODE_ENV!=="production"&&e&&i){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?warning(!1,s,"lazy-strict-mode"):invariant(!1,s,"lazy-strict-mode")}}function getProjectionFunctionality(n){const{drag:e,layout:i}=featureDefinitions;if(!e&&!i)return{};const s={...e,...i};return{MeasureLayout:e!=null&&e.isEnabled(n)||i!=null&&i.isEnabled(n)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function createMotionProxy(n,e){if(typeof Proxy>"u")return createMotionComponent;const i=new Map,s=(a,o)=>createMotionComponent(a,o,n,e),r=(a,o)=>(process.env.NODE_ENV!=="production"&&warnOnce(!1,"motion() is deprecated. Use motion.create() instead."),s(a,o));return new Proxy(r,{get:(a,o)=>o==="create"?s:(i.has(o)||i.set(o,createMotionComponent(o,void 0,n,e)),i.get(o))})}function convertBoundingBoxToBox({top:n,left:e,right:i,bottom:s}){return{x:{min:e,max:i},y:{min:n,max:s}}}function convertBoxToBoundingBox({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function transformBoxPoints(n,e){if(!e)return n;const i=e({x:n.left,y:n.top}),s=e({x:n.right,y:n.bottom});return{top:i.y,left:i.x,bottom:s.y,right:s.x}}function isIdentityScale(n){return n===void 0||n===1}function hasScale({scale:n,scaleX:e,scaleY:i}){return!isIdentityScale(n)||!isIdentityScale(e)||!isIdentityScale(i)}function hasTransform(n){return hasScale(n)||has2DTranslate(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function has2DTranslate(n){return is2DTranslate(n.x)||is2DTranslate(n.y)}function is2DTranslate(n){return n&&n!=="0%"}function scalePoint(n,e,i){const s=n-i,r=e*s;return i+r}function applyPointDelta(n,e,i,s,r){return r!==void 0&&(n=scalePoint(n,r,s)),scalePoint(n,i,s)+e}function applyAxisDelta(n,e=0,i=1,s,r){n.min=applyPointDelta(n.min,e,i,s,r),n.max=applyPointDelta(n.max,e,i,s,r)}function applyBoxDelta(n,{x:e,y:i}){applyAxisDelta(n.x,e.translate,e.scale,e.originPoint),applyAxisDelta(n.y,i.translate,i.scale,i.originPoint)}const TREE_SCALE_SNAP_MIN=.999999999999,TREE_SCALE_SNAP_MAX=1.0000000000001;function applyTreeDeltas(n,e,i,s=!1){const r=i.length;if(!r)return;e.x=e.y=1;let a,o;for(let l=0;l<r;l++){a=i[l],o=a.projectionDelta;const{visualElement:u}=a.options;u&&u.props.style&&u.props.style.display==="contents"||(s&&a.options.layoutScroll&&a.scroll&&a!==a.root&&transformBox(n,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,applyBoxDelta(n,o)),s&&hasTransform(a.latestValues)&&transformBox(n,a.latestValues))}e.x<TREE_SCALE_SNAP_MAX&&e.x>TREE_SCALE_SNAP_MIN&&(e.x=1),e.y<TREE_SCALE_SNAP_MAX&&e.y>TREE_SCALE_SNAP_MIN&&(e.y=1)}function translateAxis(n,e){n.min=n.min+e,n.max=n.max+e}function transformAxis(n,e,i,s,r=.5){const a=mixNumber$1(n.min,n.max,r);applyAxisDelta(n,e,i,a,s)}function transformBox(n,e){transformAxis(n.x,e.x,e.scaleX,e.scale,e.originX),transformAxis(n.y,e.y,e.scaleY,e.scale,e.originY)}function measureViewportBox(n,e){return convertBoundingBoxToBox(transformBoxPoints(n.getBoundingClientRect(),e))}function measurePageBox(n,e,i){const s=measureViewportBox(n,i),{scroll:r}=e;return r&&(translateAxis(s.x,r.offset.x),translateAxis(s.y,r.offset.y)),s}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()}),prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>prefersReducedMotion.current=n.matches;n.addEventListener("change",e),e()}else prefersReducedMotion.current=!1}const visualElementStore=new WeakMap;function updateMotionValuesFromProps(n,e,i){for(const s in e){const r=e[s],a=i[s];if(isMotionValue(r))n.addValue(s,r);else if(isMotionValue(a))n.addValue(s,motionValue(r,{owner:n}));else if(a!==r)if(n.hasValue(s)){const o=n.getValue(s);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=n.getStaticValue(s);n.addValue(s,motionValue(o!==void 0?o:r,{owner:n}))}}for(const s in i)e[s]===void 0&&n.removeValue(s);return e}const propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class VisualElement{scrapeMotionValuesFromProps(e,i,s){return{}}constructor({parent:e,props:i,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const d=time.now();this.renderScheduledAt<d&&(this.renderScheduledAt=d,frame.render(this.render,!1,!0))};const{latestValues:u,renderState:c}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=i.initial?{...u}:{},this.renderState=c,this.parent=e,this.props=i,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=isControllingVariants(i),this.isVariantNode=isVariantNode(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:f,...p}=this.scrapeMotionValuesFromProps(i,{},this);for(const d in p){const m=p[d];u[d]!==void 0&&isMotionValue(m)&&m.set(u[d])}}mount(e){var i;this.current=e,visualElementStore.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,process.env.NODE_ENV!=="production"&&warnOnce(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(i=this.parent)==null||i.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach(i=>i()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const i in this.events)this.events[i].clear();for(const i in this.features){const s=this.features[i];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,i){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const s=transformProps.has(e);s&&this.onBindTransform&&this.onBindTransform();const r=i.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&frame.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,i)),this.valueSubscriptions.set(e,()=>{r(),a&&a(),i.owner&&i.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in featureDefinitions){const i=featureDefinitions[e];if(!i)continue;const{isEnabled:s,Feature:r}=i;if(!this.features[e]&&r&&s(this.props)&&(this.features[e]=new r(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,i){this.latestValues[e]=i}update(e,i){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let s=0;s<propEventHandlers.length;s++){const r=propEventHandlers[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const a="on"+r,o=e[a];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(e),()=>i.variantChildren.delete(e)}addValue(e,i){const s=this.values.get(e);i!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,i),this.values.set(e,i),this.latestValues[e]=i.get())}removeValue(e){this.values.delete(e);const i=this.valueSubscriptions.get(e);i&&(i(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,i){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&i!==void 0&&(s=motionValue(i===null?void 0:i,{owner:this}),this.addValue(e,s)),s}readValue(e,i){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(isNumericalString(s)||isZeroValueString(s))?s=parseFloat(s):!findValueType(s)&&complex.test(i)&&(s=getAnimatableNone(e,i)),this.setBaseTarget(e,isMotionValue(s)?s.get():s)),isMotionValue(s)?s.get():s}setBaseTarget(e,i){this.baseTarget[e]=i}getBaseTarget(e){var a;const{initial:i}=this.props;let s;if(typeof i=="string"||typeof i=="object"){const o=resolveVariantFromProps(this.props,i,(a=this.presenceContext)==null?void 0:a.custom);o&&(s=o[e])}if(i&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!isMotionValue(r)?r:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,i){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(i)}notify(e,...i){this.events[e]&&this.events[e].notify(...i)}scheduleRenderMicrotask(){microtask.render(this.render)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(e,i){return e.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(e,i){return e.style?e.style[i]:void 0}removeValueFromRenderState(e,{vars:i,style:s}){delete i[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function renderHTML(n,{style:e,vars:i},s,r){const a=n.style;let o;for(o in e)a[o]=e[o];r==null||r.applyProjectionStyles(a,s);for(o in i)a.setProperty(o,i[o])}function getComputedStyle$1(n){return window.getComputedStyle(n)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html",this.renderInstance=renderHTML}readValueFromInstance(e,i){var s;if(transformProps.has(i))return(s=this.projection)!=null&&s.isProjecting?defaultTransformValue(i):readTransformValue(e,i);{const r=getComputedStyle$1(e),a=(isCSSVariableName(i)?r.getPropertyValue(i):r[i])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:i}){return measureViewportBox(e,i)}build(e,i,s){buildHTMLStyles(e,i,s.transformTemplate)}scrapeMotionValuesFromProps(e,i,s){return scrapeMotionValuesFromProps$1(e,i,s)}}const camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function renderSVG(n,e,i,s){renderHTML(n,e,void 0,s);for(const r in e.attrs)n.setAttribute(camelCaseAttributes.has(r)?r:camelToDash(r),e.attrs[r])}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=createBox}getBaseTargetFromProps(e,i){return e[i]}readValueFromInstance(e,i){if(transformProps.has(i)){const s=getDefaultValueType(i);return s&&s.default||0}return i=camelCaseAttributes.has(i)?i:camelToDash(i),e.getAttribute(i)}scrapeMotionValuesFromProps(e,i,s){return scrapeMotionValuesFromProps(e,i,s)}build(e,i,s){buildSVGAttrs(e,i,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,i,s,r){renderSVG(e,i,s,r)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}}const createDomVisualElement=(n,e)=>isSVGComponent(n)?new SVGVisualElement(e):new HTMLVisualElement(e,{allowProjection:n!==React.Fragment});function resolveVariant(n,e,i){const s=n.getProps();return resolveVariantFromProps(s,e,i!==void 0?i:s.custom,n)}const isKeyframesTarget=n=>Array.isArray(n);function setMotionValue(n,e,i){n.hasValue(e)?n.getValue(e).set(i):n.addValue(e,motionValue(i))}function resolveFinalValueInKeyframes(n){return isKeyframesTarget(n)?n[n.length-1]||0:n}function setTarget(n,e){const i=resolveVariant(n,e);let{transitionEnd:s={},transition:r={},...a}=i||{};a={...a,...s};for(const o in a){const l=resolveFinalValueInKeyframes(a[o]);setMotionValue(n,o,l)}}function isWillChangeMotionValue(n){return!!(isMotionValue(n)&&n.add)}function addValueToWillChange(n,e){const i=n.getValue("willChange");if(isWillChangeMotionValue(i))return i.add(e);if(!i&&MotionGlobalConfig.WillChange){const s=new MotionGlobalConfig.WillChange("auto");n.addValue("willChange",s),s.add(e)}}function getOptimisedAppearId(n){return n.props[optimizedAppearDataAttribute]}const isNotNull=n=>n!==null;function getFinalKeyframe(n,{repeat:e,repeatType:i="loop"},s){const r=n.filter(isNotNull),a=e&&i!=="loop"&&e%2===1?0:r.length-1;return!a||s===void 0?r[a]:s}const underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(n,{keyframes:e})=>e.length>2?keyframesTransition:transformProps.has(n)?n.startsWith("scale")?criticallyDampedSpring(e[1]):underDampedSpring:ease;function isTransitionDefined({when:n,delay:e,delayChildren:i,staggerChildren:s,staggerDirection:r,repeat:a,repeatType:o,repeatDelay:l,from:u,elapsed:c,...f}){return!!Object.keys(f).length}const animateMotionValue=(n,e,i,s={},r,a)=>o=>{const l=getValueTransition(s,n)||{},u=l.delay||s.delay||0;let{elapsed:c=0}=s;c=c-secondsToMilliseconds(u);const f={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-c,onUpdate:d=>{e.set(d),l.onUpdate&&l.onUpdate(d)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:n,motionValue:e,element:a?void 0:r};isTransitionDefined(l)||Object.assign(f,getDefaultTransition(n,f)),f.duration&&(f.duration=secondsToMilliseconds(f.duration)),f.repeatDelay&&(f.repeatDelay=secondsToMilliseconds(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let p=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(makeAnimationInstant(f),f.delay===0&&(p=!0)),(MotionGlobalConfig.instantAnimations||MotionGlobalConfig.skipAnimations)&&(p=!0,makeAnimationInstant(f),f.delay=0),f.allowFlatten=!l.type&&!l.ease,p&&!a&&e.get()!==void 0){const d=getFinalKeyframe(f.keyframes,l);if(d!==void 0){frame.update(()=>{f.onUpdate(d),f.onComplete()});return}}return l.isSync?new JSAnimation(f):new AsyncMotionValueAnimation(f)};function shouldBlockAnimation({protectedKeys:n,needsAnimating:e},i){const s=n.hasOwnProperty(i)&&e[i]!==!0;return e[i]=!1,s}function animateTarget(n,e,{delay:i=0,transitionOverride:s,type:r}={}){let{transition:a=n.getDefaultTransition(),transitionEnd:o,...l}=e;s&&(a=s);const u=[],c=r&&n.animationState&&n.animationState.getState()[r];for(const f in l){const p=n.getValue(f,n.latestValues[f]??null),d=l[f];if(d===void 0||c&&shouldBlockAnimation(c,f))continue;const m={delay:i,...getValueTransition(a||{},f)},P=p.get();if(P!==void 0&&!p.isAnimating&&!Array.isArray(d)&&d===P&&!m.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const y=getOptimisedAppearId(n);if(y){const C=window.MotionHandoffAnimation(y,f,frame);C!==null&&(m.startTime=C,T=!0)}}addValueToWillChange(n,f),p.start(animateMotionValue(f,p,d,n.shouldReduceMotion&&positionalKeys.has(f)?{type:!1}:m,n,T));const x=p.animation;x&&u.push(x)}return o&&Promise.all(u).then(()=>{frame.update(()=>{o&&setTarget(n,o)})}),u}function calcChildStagger(n,e,i,s=0,r=1){const a=Array.from(n).sort((c,f)=>c.sortNodePosition(f)).indexOf(e),o=n.size,l=(o-1)*s;return typeof i=="function"?i(a,o):r===1?a*s:l-a*s}function animateVariant(n,e,i={}){var u;const s=resolveVariant(n,e,i.type==="exit"?(u=n.presenceContext)==null?void 0:u.custom:void 0);let{transition:r=n.getDefaultTransition()||{}}=s||{};i.transitionOverride&&(r=i.transitionOverride);const a=s?()=>Promise.all(animateTarget(n,s,i)):()=>Promise.resolve(),o=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:f=0,staggerChildren:p,staggerDirection:d}=r;return animateChildren(n,e,c,f,p,d,i)}:()=>Promise.resolve(),{when:l}=r;if(l){const[c,f]=l==="beforeChildren"?[a,o]:[o,a];return c().then(()=>f())}else return Promise.all([a(),o(i.delay)])}function animateChildren(n,e,i=0,s=0,r=0,a=1,o){const l=[];for(const u of n.variantChildren)u.notify("AnimationStart",e),l.push(animateVariant(u,e,{...o,delay:i+(typeof s=="function"?0:s)+calcChildStagger(n.variantChildren,u,s,r,a)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(l)}function animateVisualElement(n,e,i={}){n.notify("AnimationStart",e);let s;if(Array.isArray(e)){const r=e.map(a=>animateVariant(n,a,i));s=Promise.all(r)}else if(typeof e=="string")s=animateVariant(n,e,i);else{const r=typeof e=="function"?resolveVariant(n,e,i.custom):e;s=Promise.all(animateTarget(n,r,i))}return s.then(()=>{n.notify("AnimationComplete",e)})}function shallowCompare(n,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==n.length)return!1;for(let s=0;s<i;s++)if(e[s]!==n[s])return!1;return!0}const numVariantProps=variantProps.length;function getVariantContext(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?getVariantContext(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const e={};for(let i=0;i<numVariantProps;i++){const s=variantProps[i],r=n.props[s];(isVariantLabel(r)||r===!1)&&(e[s]=r)}return e}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(n){return e=>Promise.all(e.map(({animation:i,options:s})=>animateVisualElement(n,i,s)))}function createAnimationState(n){let e=animateList(n),i=createState(),s=!0;const r=u=>(c,f)=>{var d;const p=resolveVariant(n,f,u==="exit"?(d=n.presenceContext)==null?void 0:d.custom:void 0);if(p){const{transition:m,transitionEnd:P,...T}=p;c={...c,...T,...P}}return c};function a(u){e=u(n)}function o(u){const{props:c}=n,f=getVariantContext(n.parent)||{},p=[],d=new Set;let m={},P=1/0;for(let x=0;x<numAnimationTypes;x++){const y=reversePriorityOrder[x],C=i[y],g=c[y]!==void 0?c[y]:f[y],S=isVariantLabel(g),E=y===u?C.isActive:null;E===!1&&(P=x);let A=g===f[y]&&g!==c[y]&&S;if(A&&s&&n.manuallyAnimateOnMount&&(A=!1),C.protectedKeys={...m},!C.isActive&&E===null||!g&&!C.prevProp||isAnimationControls(g)||typeof g=="boolean")continue;const M=checkVariantsDidChange(C.prevProp,g);let b=M||y===u&&C.isActive&&!A&&S||x>P&&S,F=!1;const G=Array.isArray(g)?g:[g];let L=G.reduce(r(y),{});E===!1&&(L={});const{prevResolvedValues:D={}}=C,U={...D,...L},z=I=>{b=!0,d.has(I)&&(F=!0,d.delete(I)),C.needsAnimating[I]=!0;const V=n.getValue(I);V&&(V.liveStyle=!1)};for(const I in U){const V=L[I],B=D[I];if(m.hasOwnProperty(I))continue;let k=!1;isKeyframesTarget(V)&&isKeyframesTarget(B)?k=!shallowCompare(V,B):k=V!==B,k?V!=null?z(I):d.add(I):V!==void 0&&d.has(I)?z(I):C.protectedKeys[I]=!0}C.prevProp=g,C.prevResolvedValues=L,C.isActive&&(m={...m,...L}),s&&n.blockInitialAnimation&&(b=!1);const O=A&&M;b&&(!O||F)&&p.push(...G.map(I=>{const V={type:y};if(typeof I=="string"&&s&&!O&&n.manuallyAnimateOnMount&&n.parent){const{parent:B}=n,k=resolveVariant(B,I);if(B.enteringChildren&&k){const{delayChildren:R}=k.transition||{};V.delay=calcChildStagger(B.enteringChildren,n,R)}}return{animation:I,options:V}}))}if(d.size){const x={};if(typeof c.initial!="boolean"){const y=resolveVariant(n,Array.isArray(c.initial)?c.initial[0]:c.initial);y&&y.transition&&(x.transition=y.transition)}d.forEach(y=>{const C=n.getBaseTarget(y),g=n.getValue(y);g&&(g.liveStyle=!0),x[y]=C??null}),p.push({animation:x})}let T=!!p.length;return s&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(T=!1),s=!1,T?e(p):Promise.resolve()}function l(u,c){var p;if(i[u].isActive===c)return Promise.resolve();(p=n.variantChildren)==null||p.forEach(d=>{var m;return(m=d.animationState)==null?void 0:m.setActive(u,c)}),i[u].isActive=c;const f=o(u);for(const d in i)i[d].protectedKeys={};return f}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>i,reset:()=>{i=createState()}}}function checkVariantsDidChange(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!shallowCompare(e,n):!1}function createTypeState(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class Feature{constructor(e){this.isMounted=!1,this.node=e}update(){}}class AnimationFeature extends Feature{constructor(e){super(e),e.animationState||(e.animationState=createAnimationState(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();isAnimationControls(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:i}=this.node.prevProps||{};e!==i&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let id$1=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$1++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:i}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;const r=this.node.animationState.setActive("exit",!e);i&&!e&&r.then(()=>{i(this.id)})}mount(){const{register:e,onExitComplete:i}=this.node.presenceContext||{};i&&i(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const animations={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}};function addDomEvent(n,e,i,s={passive:!0}){return n.addEventListener(e,i,s),()=>n.removeEventListener(e,i)}function extractEventInfo(n){return{point:{x:n.pageX,y:n.pageY}}}const addPointerInfo=n=>e=>isPrimaryPointer(e)&&n(e,extractEventInfo(e));function addPointerEvent(n,e,i,s){return addDomEvent(n,e,addPointerInfo(i),s)}const SCALE_PRECISION=1e-4,SCALE_MIN=1-SCALE_PRECISION,SCALE_MAX=1+SCALE_PRECISION,TRANSLATE_PRECISION=.01,TRANSLATE_MIN=0-TRANSLATE_PRECISION,TRANSLATE_MAX=0+TRANSLATE_PRECISION;function calcLength(n){return n.max-n.min}function isNear(n,e,i){return Math.abs(n-e)<=i}function calcAxisDelta(n,e,i,s=.5){n.origin=s,n.originPoint=mixNumber$1(e.min,e.max,n.origin),n.scale=calcLength(i)/calcLength(e),n.translate=mixNumber$1(i.min,i.max,n.origin)-n.originPoint,(n.scale>=SCALE_MIN&&n.scale<=SCALE_MAX||isNaN(n.scale))&&(n.scale=1),(n.translate>=TRANSLATE_MIN&&n.translate<=TRANSLATE_MAX||isNaN(n.translate))&&(n.translate=0)}function calcBoxDelta(n,e,i,s){calcAxisDelta(n.x,e.x,i.x,s?s.originX:void 0),calcAxisDelta(n.y,e.y,i.y,s?s.originY:void 0)}function calcRelativeAxis(n,e,i){n.min=i.min+e.min,n.max=n.min+calcLength(e)}function calcRelativeBox(n,e,i){calcRelativeAxis(n.x,e.x,i.x),calcRelativeAxis(n.y,e.y,i.y)}function calcRelativeAxisPosition(n,e,i){n.min=e.min-i.min,n.max=n.min+calcLength(e)}function calcRelativePosition(n,e,i){calcRelativeAxisPosition(n.x,e.x,i.x),calcRelativeAxisPosition(n.y,e.y,i.y)}function eachAxis(n){return[n("x"),n("y")]}const getContextWindow=({current:n})=>n?n.ownerDocument.defaultView:null,distance=(n,e)=>Math.abs(n-e);function distance2D(n,e){const i=distance(n.x,e.x),s=distance(n.y,e.y);return Math.sqrt(i**2+s**2)}class PanSession{constructor(e,i,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=getPanInfo(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,P=distance2D(d.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!P)return;const{point:T}=d,{timestamp:x}=frameData;this.history.push({...T,timestamp:x});const{onStart:y,onMove:C}=this.handlers;m||(y&&y(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,d)},this.handlePointerMove=(d,m)=>{this.lastMoveEvent=d,this.lastMoveEventInfo=transformPoint(m,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(d,m)=>{this.end();const{onEnd:P,onSessionEnd:T,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=getPanInfo(d.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(m,this.transformPagePoint),this.history);this.startEvent&&P&&P(d,y),T&&T(d,y)},!isPrimaryPointer(e))return;this.dragSnapToOrigin=a,this.handlers=i,this.transformPagePoint=s,this.distanceThreshold=o,this.contextWindow=r||window;const l=extractEventInfo(e),u=transformPoint(l,this.transformPagePoint),{point:c}=u,{timestamp:f}=frameData;this.history=[{...c,timestamp:f}];const{onSessionStart:p}=i;p&&p(e,getPanInfo(u,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(n,e){return e?{point:e(n.point)}:n}function subtractPoint(n,e){return{x:n.x-e.x,y:n.y-e.y}}function getPanInfo({point:n},e){return{point:n,delta:subtractPoint(n,lastDevicePoint(e)),offset:subtractPoint(n,startDevicePoint(e)),velocity:getVelocity(e,.1)}}function startDevicePoint(n){return n[0]}function lastDevicePoint(n){return n[n.length-1]}function getVelocity(n,e){if(n.length<2)return{x:0,y:0};let i=n.length-1,s=null;const r=lastDevicePoint(n);for(;i>=0&&(s=n[i],!(r.timestamp-s.timestamp>secondsToMilliseconds(e)));)i--;if(!s)return{x:0,y:0};const a=millisecondsToSeconds(r.timestamp-s.timestamp);if(a===0)return{x:0,y:0};const o={x:(r.x-s.x)/a,y:(r.y-s.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function applyConstraints(n,{min:e,max:i},s){return e!==void 0&&n<e?n=s?mixNumber$1(e,n,s.min):Math.max(n,e):i!==void 0&&n>i&&(n=s?mixNumber$1(i,n,s.max):Math.min(n,i)),n}function calcRelativeAxisConstraints(n,e,i){return{min:e!==void 0?n.min+e:void 0,max:i!==void 0?n.max+i-(n.max-n.min):void 0}}function calcRelativeConstraints(n,{top:e,left:i,bottom:s,right:r}){return{x:calcRelativeAxisConstraints(n.x,i,r),y:calcRelativeAxisConstraints(n.y,e,s)}}function calcViewportAxisConstraints(n,e){let i=e.min-n.min,s=e.max-n.max;return e.max-e.min<n.max-n.min&&([i,s]=[s,i]),{min:i,max:s}}function calcViewportConstraints(n,e){return{x:calcViewportAxisConstraints(n.x,e.x),y:calcViewportAxisConstraints(n.y,e.y)}}function calcOrigin(n,e){let i=.5;const s=calcLength(n),r=calcLength(e);return r>s?i=progress(e.min,e.max-s,n.min):s>r&&(i=progress(n.min,n.max-r,e.min)),clamp(0,1,i)}function rebaseAxisConstraints(n,e){const i={};return e.min!==void 0&&(i.min=e.min-n.min),e.max!==void 0&&(i.max=e.max-n.min),i}const defaultElastic=.35;function resolveDragElastic(n=defaultElastic){return n===!1?n=0:n===!0&&(n=defaultElastic),{x:resolveAxisElastic(n,"left","right"),y:resolveAxisElastic(n,"top","bottom")}}function resolveAxisElastic(n,e,i){return{min:resolvePointElastic(n,e),max:resolvePointElastic(n,i)}}function resolvePointElastic(n,e){return typeof n=="number"?n:n[e]||0}const elementDragControls=new WeakMap;class VisualElementDragControls{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:i=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const a=p=>{const{dragSnapToOrigin:d}=this.getProps();d?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(extractEventInfo(p).point)},o=(p,d)=>{const{drag:m,dragPropagation:P,onDragStart:T}=this.getProps();if(m&&!P&&(this.openDragLock&&this.openDragLock(),this.openDragLock=setDragLock(m),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(y=>{let C=this.getAxisMotionValue(y).get()||0;if(percent.test(C)){const{projection:g}=this.visualElement;if(g&&g.layout){const S=g.layout.layoutBox[y];S&&(C=calcLength(S)*(parseFloat(C)/100))}}this.originPoint[y]=C}),T&&frame.postRender(()=>T(p,d)),addValueToWillChange(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(p,d)=>{this.latestPointerEvent=p,this.latestPanInfo=d;const{dragPropagation:m,dragDirectionLock:P,onDirectionLock:T,onDrag:x}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:y}=d;if(P&&this.currentDirection===null){this.currentDirection=getCurrentDirection(y),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",d.point,y),this.updateAxis("y",d.point,y),this.visualElement.render(),x&&x(p,d)},u=(p,d)=>{this.latestPointerEvent=p,this.latestPanInfo=d,this.stop(p,d),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>eachAxis(p=>{var d;return this.getAnimationState(p)==="paused"&&((d=this.getAxisMotionValue(p).animation)==null?void 0:d.play())}),{dragSnapToOrigin:f}=this.getProps();this.panSession=new PanSession(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:u,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:s,contextWindow:getContextWindow(this.visualElement)})}stop(e,i){const s=e||this.latestPointerEvent,r=i||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!r||!s)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&frame.postRender(()=>l(s,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:i}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(e,i,s){const{drag:r}=this.getProps();if(!s||!shouldDrag(e,r,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=applyConstraints(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){var a;const{dragConstraints:e,dragElastic:i}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,r=this.constraints;e&&isRefObject(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=calcRelativeConstraints(s.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(i),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=rebaseAxisConstraints(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:i}=this.getProps();if(!e||!isRefObject(e))return!1;const s=e.current;invariant(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const a=measurePageBox(s,r.root,this.visualElement.getTransformPagePoint());let o=calcViewportConstraints(r.layout.layoutBox,a);if(i){const l=i(convertBoxToBoundingBox(o));this.hasMutatedConstraints=!!l,l&&(o=convertBoundingBoxToBox(l))}return o}startAnimation(e){const{drag:i,dragMomentum:s,dragElastic:r,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),u=this.constraints||{},c=eachAxis(f=>{if(!shouldDrag(f,i,this.currentDirection))return;let p=u&&u[f]||{};o&&(p={min:0,max:0});const d=r?200:1e6,m=r?40:1e7,P={type:"inertia",velocity:s?e[f]:0,bounceStiffness:d,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...a,...p};return this.startAxisValueAnimation(f,P)});return Promise.all(c).then(l)}startAxisValueAnimation(e,i){const s=this.getAxisMotionValue(e);return addValueToWillChange(this.visualElement,e),s.start(animateMotionValue(e,s,0,i,this.visualElement,!1))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){eachAxis(e=>{var i;return(i=this.getAxisMotionValue(e).animation)==null?void 0:i.pause()})}getAnimationState(e){var i;return(i=this.getAxisMotionValue(e).animation)==null?void 0:i.state}getAxisMotionValue(e){const i=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),r=s[i];return r||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){eachAxis(i=>{const{drag:s}=this.getProps();if(!shouldDrag(i,s,this.currentDirection))return;const{projection:r}=this.visualElement,a=this.getAxisMotionValue(i);if(r&&r.layout){const{min:o,max:l}=r.layout.layoutBox[i];a.set(e[i]-mixNumber$1(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:i}=this.getProps(),{projection:s}=this.visualElement;if(!isRefObject(i)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};eachAxis(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const u=l.get();r[o]=calcOrigin({min:u,max:u},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),eachAxis(o=>{if(!shouldDrag(o,e,null))return;const l=this.getAxisMotionValue(o),{min:u,max:c}=this.constraints[o];l.set(mixNumber$1(u,c,r[o]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const e=this.visualElement.current,i=addPointerEvent(e,"pointerdown",u=>{const{drag:c,dragListener:f=!0}=this.getProps();c&&f&&this.start(u)}),s=()=>{const{dragConstraints:u}=this.getProps();isRefObject(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,a=r.addEventListener("measure",s);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),frame.read(s);const o=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),l=r.addEventListener("didUpdate",({delta:u,hasLayoutChanged:c})=>{this.isDragging&&c&&(eachAxis(f=>{const p=this.getAxisMotionValue(f);p&&(this.originPoint[f]+=u[f].translate,p.set(p.get()+u[f].translate))}),this.visualElement.render())});return()=>{o(),i(),a(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:a=!1,dragElastic:o=defaultElastic,dragMomentum:l=!0}=e;return{...e,drag:i,dragDirectionLock:s,dragPropagation:r,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function shouldDrag(n,e,i){return(e===!0||e===n)&&(i===null||i===n)}function getCurrentDirection(n,e=10){let i=null;return Math.abs(n.y)>e?i="y":Math.abs(n.x)>e&&(i="x"),i}class DragGesture extends Feature{constructor(e){super(e),this.removeGroupControls=noop,this.removeListeners=noop,this.controls=new VisualElementDragControls(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=n=>(e,i)=>{n&&frame.postRender(()=>n(e,i))};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:i,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(i),onMove:s,onEnd:(a,o)=>{delete this.session,r&&frame.postRender(()=>r(a,o))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const correctBorderRadius={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(px.test(n))n=parseFloat(n);else return n;const i=pixelsToPercent(n,e.target.x),s=pixelsToPercent(n,e.target.y);return`${i}% ${s}%`}},correctBoxShadow={correct:(n,{treeScale:e,projectionDelta:i})=>{const s=n,r=complex.parse(n);if(r.length>5)return s;const a=complex.createTransformer(n),o=typeof r[0]!="number"?1:0,l=i.x.scale*e.x,u=i.y.scale*e.y;r[0+o]/=l,r[1+o]/=u;const c=mixNumber$1(l,u,.5);return typeof r[2+o]=="number"&&(r[2+o]/=c),typeof r[3+o]=="number"&&(r[3+o]/=c),a(r)}};let hasTakenAnySnapshot=!1;class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:s,layoutId:r}=this.props,{projection:a}=e;addScaleCorrector(defaultScaleCorrectors),a&&(i.group&&i.group.add(a),s&&s.register&&r&&s.register(a),hasTakenAnySnapshot&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:i,visualElement:s,drag:r,isPresent:a}=this.props,{projection:o}=s;return o&&(o.isPresent=a,hasTakenAnySnapshot=!0,r||e.layoutDependency!==i||i===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||frame.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),microtask.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:s}=this.props,{projection:r}=e;hasTakenAnySnapshot=!0,r&&(r.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function MeasureLayout(n){const[e,i]=usePresence(),s=React.useContext(LayoutGroupContext);return jsxRuntime.jsx(MeasureLayoutWithContext,{...n,layoutGroup:s,switchLayoutGroup:React.useContext(SwitchLayoutGroupContext),isPresent:e,safeToRemove:i})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow};function animateSingleValue(n,e,i){const s=isMotionValue(n)?n:motionValue(n);return s.start(animateMotionValue("",s,e,i)),s.animation}const compareByDepth=(n,e)=>n.depth-e.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}}function delay(n,e){const i=time.now(),s=({timestamp:r})=>{const a=r-i;a>=e&&(cancelFrame(s),n(a-e))};return frame.setup(s,!0),()=>cancelFrame(s)}const borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=n=>typeof n=="string"?parseFloat(n):n,isPx=n=>typeof n=="number"||px.test(n);function mixValues(n,e,i,s,r,a){r?(n.opacity=mixNumber$1(0,i.opacity??1,easeCrossfadeIn(s)),n.opacityExit=mixNumber$1(e.opacity??1,0,easeCrossfadeOut(s))):a&&(n.opacity=mixNumber$1(e.opacity??1,i.opacity??1,s));for(let o=0;o<numBorders;o++){const l=`border${borders[o]}Radius`;let u=getRadius(e,l),c=getRadius(i,l);if(u===void 0&&c===void 0)continue;u||(u=0),c||(c=0),u===0||c===0||isPx(u)===isPx(c)?(n[l]=Math.max(mixNumber$1(asNumber(u),asNumber(c),s),0),(percent.test(c)||percent.test(u))&&(n[l]+="%")):n[l]=c}(e.rotate||i.rotate)&&(n.rotate=mixNumber$1(e.rotate||0,i.rotate||0,s))}function getRadius(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const easeCrossfadeIn=compress(0,.5,circOut),easeCrossfadeOut=compress(.5,.95,noop);function compress(n,e,i){return s=>s<n?0:s>e?1:i(progress(n,e,s))}function copyAxisInto(n,e){n.min=e.min,n.max=e.max}function copyBoxInto(n,e){copyAxisInto(n.x,e.x),copyAxisInto(n.y,e.y)}function copyAxisDeltaInto(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}function removePointDelta(n,e,i,s,r){return n-=e,n=scalePoint(n,1/i,s),r!==void 0&&(n=scalePoint(n,1/r,s)),n}function removeAxisDelta(n,e=0,i=1,s=.5,r,a=n,o=n){if(percent.test(e)&&(e=parseFloat(e),e=mixNumber$1(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=mixNumber$1(a.min,a.max,s);n===a&&(l-=e),n.min=removePointDelta(n.min,e,i,l,r),n.max=removePointDelta(n.max,e,i,l,r)}function removeAxisTransforms(n,e,[i,s,r],a,o){removeAxisDelta(n,e[i],e[s],e[r],e.scale,a,o)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(n,e,i,s){removeAxisTransforms(n.x,e,xKeys,i?i.x:void 0,s?s.x:void 0),removeAxisTransforms(n.y,e,yKeys,i?i.y:void 0,s?s.y:void 0)}function isAxisDeltaZero(n){return n.translate===0&&n.scale===1}function isDeltaZero(n){return isAxisDeltaZero(n.x)&&isAxisDeltaZero(n.y)}function axisEquals(n,e){return n.min===e.min&&n.max===e.max}function boxEquals(n,e){return axisEquals(n.x,e.x)&&axisEquals(n.y,e.y)}function axisEqualsRounded(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function boxEqualsRounded(n,e){return axisEqualsRounded(n.x,e.x)&&axisEqualsRounded(n.y,e.y)}function aspectRatio(n){return calcLength(n.x)/calcLength(n.y)}function axisDeltaEquals(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}class NodeStack{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e),e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(e){const i=this.members.findIndex(r=>e===r);if(i===0)return!1;let s;for(let r=i;r>=0;r--){const a=this.members[r];if(a.isPresent!==!1){s=a;break}}return s?(this.promote(s),!0):!1}promote(e,i){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,i&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:i,resumingFrom:s}=e;i.onExitComplete&&i.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(n,e,i){let s="";const r=n.x.translate/e.x,a=n.y.translate/e.y,o=(i==null?void 0:i.z)||0;if((r||a||o)&&(s=`translate3d(${r}px, ${a}px, ${o}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:c,rotate:f,rotateX:p,rotateY:d,skewX:m,skewY:P}=i;c&&(s=`perspective(${c}px) ${s}`),f&&(s+=`rotate(${f}deg) `),p&&(s+=`rotateX(${p}deg) `),d&&(s+=`rotateY(${d}deg) `),m&&(s+=`skewX(${m}deg) `),P&&(s+=`skewY(${P}deg) `)}const l=n.x.scale*e.x,u=n.y.scale*e.y;return(l!==1||u!==1)&&(s+=`scale(${l}, ${u})`),s||"none"}const transformAxes=["","X","Y","Z"],animationTarget=1e3;let id=0;function resetDistortingTransform(n,e,i,s){const{latestValues:r}=e;r[n]&&(i[n]=r[n],e.setStaticValue(n,0),s&&(s[n]=0))}function cancelTreeOptimisedTransformAnimations(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const i=getOptimisedAppearId(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:r,layoutId:a}=n.options;window.MotionCancelOptimisedAnimation(i,"transform",frame,!(r||a))}const{parent:s}=n;s&&!s.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(s)}function createProjectionNode({attachResizeListener:n,defaultParent:e,measureScroll:i,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(o={},l=e==null?void 0:e()){this.id=id++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new SubscriptionManager),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const u=this.eventHandlers.get(o);u&&u.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=isSVGElement(o)&&!isSVGSVGElement(o),this.instance=o;const{layoutId:l,layout:u,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||l)&&(this.isLayoutDirty=!0),n){let f,p=0;const d=()=>this.root.updateBlockedByResize=!1;frame.read(()=>{p=window.innerWidth}),n(o,()=>{const m=window.innerWidth;m!==p&&(p=m,this.root.updateBlockedByResize=!0,f&&f(),f=delay(d,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:p,hasRelativeLayoutChanged:d,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const P=this.options.transition||c.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:T,onLayoutAnimationComplete:x}=c.getProps(),y=!this.targetLayout||!boxEqualsRounded(this.targetLayout,m),C=!p&&d;if(this.options.layoutRoot||this.resumeFrom||C||p&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const g={...getValueTransition(P,"layout"),onPlay:T,onComplete:x};(c.shouldReduceMotion||this.options.layoutRoot)&&(g.delay=0,g.type=!1),this.startAnimation(g),this.setAnimationOrigin(f,C)}else p||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const p=this.path[f];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:u}=this.options;if(l===void 0&&!u)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(clearIsLayoutDirty);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate)):this.nodes.forEach(clearIsLayoutDirty),this.clearAllSnapshots();const l=time.now();frameData.delta=clamp(0,1e3/60,l-frameData.timestamp),frameData.timestamp=l,frameData.isProcessing=!0,frameSteps.update.process(frameData),frameSteps.preRender.process(frameData),frameSteps.render.process(frameData),frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!calcLength(this.snapshot.measuredBox.x)&&!calcLength(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const u=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!isDeltaZero(this.projectionDelta),u=this.getTransformTemplate(),c=u?u(this.latestValues,""):void 0,f=c!==this.prevTransformTemplateValue;o&&this.instance&&(l||hasTransform(this.latestValues)||f)&&(r(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let u=this.removeElementScroll(l);return o&&(u=this.removeTransform(u)),roundBox(u),{animationId:this.root.animationId,measuredBox:l,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:o}=this.options;if(!o)return createBox();const l=o.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(checkNodeWasScrollRoot))){const{scroll:f}=this.root;f&&(translateAxis(l.x,f.offset.x),translateAxis(l.y,f.offset.y))}return l}removeElementScroll(o){var u;const l=createBox();if(copyBoxInto(l,o),(u=this.scroll)!=null&&u.wasRoot)return l;for(let c=0;c<this.path.length;c++){const f=this.path[c],{scroll:p,options:d}=f;f!==this.root&&p&&d.layoutScroll&&(p.wasRoot&&copyBoxInto(l,o),translateAxis(l.x,p.offset.x),translateAxis(l.y,p.offset.y))}return l}applyTransform(o,l=!1){const u=createBox();copyBoxInto(u,o);for(let c=0;c<this.path.length;c++){const f=this.path[c];!l&&f.options.layoutScroll&&f.scroll&&f!==f.root&&transformBox(u,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),hasTransform(f.latestValues)&&transformBox(u,f.latestValues)}return hasTransform(this.latestValues)&&transformBox(u,this.latestValues),u}removeTransform(o){const l=createBox();copyBoxInto(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];if(!c.instance||!hasTransform(c.latestValues))continue;hasScale(c.latestValues)&&c.updateSnapshot();const f=createBox(),p=c.measurePageBox();copyBoxInto(f,p),removeBoxTransforms(l,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,f)}return hasTransform(this.latestValues)&&removeBoxTransforms(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var m;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:p}=this.options;if(!this.layout||!(f||p))return;this.resolvedRelativeTargetAt=frameData.timestamp;const d=this.getClosestProjectingParent();d&&this.linkedParentVersion!==d.layoutVersion&&!d.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(d&&d.layout?this.createRelativeTarget(d,this.layout.layoutBox,d.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,d&&!!d.resumingFrom==!!this.resumingFrom&&!d.options.layoutScroll&&d.target&&this.animationProgress!==1?this.createRelativeTarget(d,this.target,d.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,u){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,l,u),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var P;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||(P=this.parent)!=null&&P.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(u=!1),u)return;const{layout:c,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||f))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,d=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=createBox());const{target:m}=o;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)),calcBoxDelta(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==d||!axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)||!axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=createDelta(),this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta()}setAnimationOrigin(o,l=!1){const u=this.snapshot,c=u?u.latestValues:{},f={...this.latestValues},p=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const d=createBox(),m=u?u.source:void 0,P=this.layout?this.layout.source:void 0,T=m!==P,x=this.getStack(),y=!x||x.members.length<=1,C=!!(T&&!y&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let g;this.mixTargetDelta=S=>{const E=S/1e3;mixAxisDelta(p.x,o.x,E),mixAxisDelta(p.y,o.y,E),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,d,E),g&&boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=createBox()),copyBoxInto(g,this.relativeTarget)),T&&(this.animationValues=f,mixValues(f,c,this.latestValues,E,C,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,u,c;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(c=(u=this.resumingFrom)==null?void 0:u.currentAnimation)==null||c.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=motionValue(0)),this.currentAnimation=animateSingleValue(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),o.onUpdate&&o.onUpdate(f)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:u,layout:c,latestValues:f}=o;if(!(!l||!u||!c)){if(this!==o&&this.layout&&c&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,c.layoutBox)){u=this.target||createBox();const p=calcLength(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const d=calcLength(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+d}copyBoxInto(l,u),transformBox(l,f),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,l,f)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new NodeStack),this.sharedNodes.get(o).add(l);const c=l.options.initialPromotionConfig;l.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:u}={}){const c=this.getStack();c&&c.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(l=!0),!l)return;const c={};u.z&&resetDistortingTransform("z",o,c,this.animationValues);for(let f=0;f<transformAxes.length;f++)resetDistortingTransform(`rotate${transformAxes[f]}`,o,c,this.animationValues),resetDistortingTransform(`skew${transformAxes[f]}`,o,c,this.animationValues);o.render();for(const f in c)o.setStaticValue(f,c[f]),this.animationValues&&(this.animationValues[f]=c[f]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=resolveMotionValue(l==null?void 0:l.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=resolveMotionValue(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const f=c.animationValues||c.latestValues;this.applyTransformsToTarget();let p=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,f);u&&(p=u(f,p)),o.transform=p;const{x:d,y:m}=this.projectionDelta;o.transformOrigin=`${d.origin*100}% ${m.origin*100}% 0`,c.animationValues?o.opacity=c===this?f.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:o.opacity=c===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const P in scaleCorrectors){if(f[P]===void 0)continue;const{correct:T,applyTo:x,isCSSVariable:y}=scaleCorrectors[P],C=p==="none"?f[P]:T(f[P],c);if(x){const g=x.length;for(let S=0;S<g;S++)o[x[S]]=C}else y?this.options.visualElement.renderState.vars[P]=C:o[P]=C}this.options.layoutId&&(o.pointerEvents=c===this?resolveMotionValue(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(n){n.updateLayout()}function notifyLayoutUpdate(n){var i;const e=((i=n.resumeFrom)==null?void 0:i.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=n.layout,{animationType:a}=n.options,o=e.source!==n.layout.source;a==="size"?eachAxis(p=>{const d=o?e.measuredBox[p]:e.layoutBox[p],m=calcLength(d);d.min=s[p].min,d.max=d.min+m}):shouldAnimatePositionOnly(a,e.layoutBox,s)&&eachAxis(p=>{const d=o?e.measuredBox[p]:e.layoutBox[p],m=calcLength(s[p]);d.max=d.min+m,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[p].max=n.relativeTarget[p].min+m)});const l=createDelta();calcBoxDelta(l,s,e.layoutBox);const u=createDelta();o?calcBoxDelta(u,n.applyTransform(r,!0),e.measuredBox):calcBoxDelta(u,s,e.layoutBox);const c=!isDeltaZero(l);let f=!1;if(!n.resumeFrom){const p=n.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:d,layout:m}=p;if(d&&m){const P=createBox();calcRelativePosition(P,e.layoutBox,d.layoutBox);const T=createBox();calcRelativePosition(T,s,m.layoutBox),boxEqualsRounded(P,T)||(f=!0),p.options.layoutRoot&&(n.relativeTarget=T,n.relativeTargetOrigin=P,n.relativeParent=p)}}}n.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:u,layoutDelta:l,hasLayoutChanged:c,hasRelativeLayoutChanged:f})}else if(n.isLead()){const{onExitComplete:s}=n.options;s&&s()}n.options.transition=void 0}function propagateDirtyNodes(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function cleanDirtyNodes(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function clearSnapshot(n){n.clearSnapshot()}function clearMeasurements(n){n.clearMeasurements()}function clearIsLayoutDirty(n){n.isLayoutDirty=!1}function resetTransformStyle(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function finishAnimation(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function resolveTargetDelta(n){n.resolveTargetDelta()}function calcProjection(n){n.calcProjection()}function resetSkewAndRotation(n){n.resetSkewAndRotation()}function removeLeadSnapshots(n){n.removeLeadSnapshot()}function mixAxisDelta(n,e,i){n.translate=mixNumber$1(e.translate,0,i),n.scale=mixNumber$1(e.scale,1,i),n.origin=e.origin,n.originPoint=e.originPoint}function mixAxis(n,e,i,s){n.min=mixNumber$1(e.min,i.min,s),n.max=mixNumber$1(e.max,i.max,s)}function mixBox(n,e,i,s){mixAxis(n.x,e.x,i.x,s),mixAxis(n.y,e.y,i.y,s)}function hasOpacityCrossfade(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop;function roundAxis(n){n.min=roundPoint(n.min),n.max=roundPoint(n.max)}function roundBox(n){roundAxis(n.x),roundAxis(n.y)}function shouldAnimatePositionOnly(n,e,i){return n==="position"||n==="preserve-aspect"&&!isNear(aspectRatio(e),aspectRatio(i),.2)}function checkNodeWasScrollRoot(n){var e;return n!==n.root&&((e=n.scroll)==null?void 0:e.wasRoot)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(n,e)=>addDomEvent(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const n=new DocumentProjectionNode({});n.mount(window),n.setOptions({layoutScroll:!0}),rootProjectionNode.current=n}return rootProjectionNode.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}};function handleHoverEvent(n,e,i){const{props:s}=n;n.animationState&&s.whileHover&&n.animationState.setActive("whileHover",i==="Start");const r="onHover"+i,a=s[r];a&&frame.postRender(()=>a(e,extractEventInfo(e)))}class HoverGesture extends Feature{mount(){const{current:e}=this.node;e&&(this.unmount=hover(e,(i,s)=>(handleHoverEvent(this.node,s,"Start"),r=>handleHoverEvent(this.node,r,"End"))))}unmount(){}}class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function handlePressEvent(n,e,i){const{props:s}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&s.whileTap&&n.animationState.setActive("whileTap",i==="Start");const r="onTap"+(i==="End"?"":i),a=s[r];a&&frame.postRender(()=>a(e,extractEventInfo(e)))}class PressGesture extends Feature{mount(){const{current:e}=this.node;e&&(this.unmount=press(e,(i,s)=>(handlePressEvent(this.node,s,"Start"),(r,{success:a})=>handlePressEvent(this.node,r,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=n=>{const e=observerCallbacks.get(n.target);e&&e(n)},fireAllObserverCallbacks=n=>{n.forEach(fireObserverCallback)};function initIntersectionObserver({root:n,...e}){const i=n||document;observers.has(i)||observers.set(i,{});const s=observers.get(i),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(fireAllObserverCallbacks,{root:n,...e})),s[r]}function observeIntersection(n,e,i){const s=initIntersectionObserver(e);return observerCallbacks.set(n,i),s.observe(n),()=>{observerCallbacks.delete(n),s.unobserve(n)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:i,margin:s,amount:r="some",once:a}=e,o={root:i?i.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:thresholdNames[r]},l=u=>{const{isIntersecting:c}=u;if(this.isInView===c||(this.isInView=c,a&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:f,onViewportLeave:p}=this.node.getProps(),d=c?f:p;d&&d(u)};return observeIntersection(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:i}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(e,i))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:n={}},{viewport:e={}}={}){return i=>n[i]!==e[i]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}},layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},featureBundle={...animations,...gestureAnimations,...drag,...layout},motion=createMotionProxy(featureBundle,createDomVisualElement);/**
10
+ * @license lucide-react v0.462.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ */const toKebabCase=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mergeClasses=(...n)=>n.filter((e,i,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===i).join(" ").trim();/**
15
+ * @license lucide-react v0.462.0 - ISC
16
+ *
17
+ * This source code is licensed under the ISC license.
18
+ * See the LICENSE file in the root directory of this source tree.
19
+ */var defaultAttributes={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
20
+ * @license lucide-react v0.462.0 - ISC
21
+ *
22
+ * This source code is licensed under the ISC license.
23
+ * See the LICENSE file in the root directory of this source tree.
24
+ */const Icon=React.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:s,className:r="",children:a,iconNode:o,...l},u)=>React.createElement("svg",{ref:u,...defaultAttributes,width:e,height:e,stroke:n,strokeWidth:s?Number(i)*24/Number(e):i,className:mergeClasses("lucide",r),...l},[...o.map(([c,f])=>React.createElement(c,f)),...Array.isArray(a)?a:[a]]));/**
25
+ * @license lucide-react v0.462.0 - ISC
26
+ *
27
+ * This source code is licensed under the ISC license.
28
+ * See the LICENSE file in the root directory of this source tree.
29
+ */const createLucideIcon=(n,e)=>{const i=React.forwardRef(({className:s,...r},a)=>React.createElement(Icon,{ref:a,iconNode:e,className:mergeClasses(`lucide-${toKebabCase(n)}`,s),...r}));return i.displayName=`${n}`,i};/**
30
+ * @license lucide-react v0.462.0 - ISC
31
+ *
32
+ * This source code is licensed under the ISC license.
33
+ * See the LICENSE file in the root directory of this source tree.
34
+ */const ChartColumn=createLucideIcon("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
35
+ * @license lucide-react v0.462.0 - ISC
36
+ *
37
+ * This source code is licensed under the ISC license.
38
+ * See the LICENSE file in the root directory of this source tree.
39
+ */const Check=createLucideIcon("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
40
+ * @license lucide-react v0.462.0 - ISC
41
+ *
42
+ * This source code is licensed under the ISC license.
43
+ * See the LICENSE file in the root directory of this source tree.
44
+ */const ChevronDown=createLucideIcon("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
45
+ * @license lucide-react v0.462.0 - ISC
46
+ *
47
+ * This source code is licensed under the ISC license.
48
+ * See the LICENSE file in the root directory of this source tree.
49
+ */const Download=createLucideIcon("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
50
+ * @license lucide-react v0.462.0 - ISC
51
+ *
52
+ * This source code is licensed under the ISC license.
53
+ * See the LICENSE file in the root directory of this source tree.
54
+ */const ExternalLink=createLucideIcon("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
55
+ * @license lucide-react v0.462.0 - ISC
56
+ *
57
+ * This source code is licensed under the ISC license.
58
+ * See the LICENSE file in the root directory of this source tree.
59
+ */const FileText=createLucideIcon("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
60
+ * @license lucide-react v0.462.0 - ISC
61
+ *
62
+ * This source code is licensed under the ISC license.
63
+ * See the LICENSE file in the root directory of this source tree.
64
+ */const LoaderCircle=createLucideIcon("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
65
+ * @license lucide-react v0.462.0 - ISC
66
+ *
67
+ * This source code is licensed under the ISC license.
68
+ * See the LICENSE file in the root directory of this source tree.
69
+ */const LogOut=createLucideIcon("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
70
+ * @license lucide-react v0.462.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ */const MessageSquare=createLucideIcon("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
75
+ * @license lucide-react v0.462.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */const Mic=createLucideIcon("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
80
+ * @license lucide-react v0.462.0 - ISC
81
+ *
82
+ * This source code is licensed under the ISC license.
83
+ * See the LICENSE file in the root directory of this source tree.
84
+ */const Paperclip=createLucideIcon("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
85
+ * @license lucide-react v0.462.0 - ISC
86
+ *
87
+ * This source code is licensed under the ISC license.
88
+ * See the LICENSE file in the root directory of this source tree.
89
+ */const Pause=createLucideIcon("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
90
+ * @license lucide-react v0.462.0 - ISC
91
+ *
92
+ * This source code is licensed under the ISC license.
93
+ * See the LICENSE file in the root directory of this source tree.
94
+ */const Play=createLucideIcon("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
95
+ * @license lucide-react v0.462.0 - ISC
96
+ *
97
+ * This source code is licensed under the ISC license.
98
+ * See the LICENSE file in the root directory of this source tree.
99
+ */const Radio=createLucideIcon("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
100
+ * @license lucide-react v0.462.0 - ISC
101
+ *
102
+ * This source code is licensed under the ISC license.
103
+ * See the LICENSE file in the root directory of this source tree.
104
+ */const Send=createLucideIcon("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
105
+ * @license lucide-react v0.462.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */const Settings=createLucideIcon("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
110
+ * @license lucide-react v0.462.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */const Sparkles=createLucideIcon("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
115
+ * @license lucide-react v0.462.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const Square=createLucideIcon("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
120
+ * @license lucide-react v0.462.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const TriangleAlert=createLucideIcon("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
125
+ * @license lucide-react v0.462.0 - ISC
126
+ *
127
+ * This source code is licensed under the ISC license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */const WifiOff=createLucideIcon("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
130
+ * @license lucide-react v0.462.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const Wifi=createLucideIcon("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
135
+ * @license lucide-react v0.462.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */const X=createLucideIcon("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),claraLogo="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2074%2019'%3e%3cpath%20d='M%2061.697%2019.219%20C%2060.922%2019.219%2060.192%2019.149%2059.505%2019.008%20C%2058.819%2018.885%2058.211%2018.674%2057.683%2018.374%20C%2057.155%2018.057%2056.741%2017.653%2056.442%2017.16%20C%2056.161%2016.649%2056.02%2016.024%2056.02%2015.285%20C%2056.02%2014.141%2056.337%2013.26%2056.97%2012.644%20C%2057.604%2012.011%2058.484%2011.553%2059.611%2011.271%20C%2060.755%2010.99%2062.075%2010.822%2063.572%2010.77%20C%2065.086%2010.699%2066.714%2010.664%2068.457%2010.664%20L%2068.457%209.845%20C%2068.457%209.053%2068.307%208.437%2068.008%207.997%20C%2067.708%207.539%2067.216%207.222%2066.529%207.046%20C%2065.842%206.853%2064.91%206.756%2063.73%206.756%20C%2062.727%206.756%2061.89%206.844%2061.222%207.02%20C%2060.57%207.178%2060.077%207.407%2059.743%207.707%20C%2059.408%207.988%2059.241%208.323%2059.241%208.71%20L%2059.241%209.185%20L%2056.68%209.185%20C%2056.662%209.115%2056.645%209.044%2056.627%208.974%20C%2056.627%208.886%2056.627%208.789%2056.627%208.683%20C%2056.627%207.839%2056.9%207.126%2057.446%206.545%20C%2058.009%205.946%2058.836%205.488%2059.928%205.172%20C%2061.019%204.837%2062.383%204.67%2064.021%204.67%20C%2065.57%204.67%2066.863%204.819%2067.902%205.119%20C%2068.941%205.418%2069.724%205.92%2070.252%206.624%20C%2070.78%207.31%2071.044%208.252%2071.044%209.449%20L%2071.044%2016.103%20C%2071.044%2016.455%2071.106%2016.72%2071.229%2016.896%20C%2071.352%2017.054%2071.59%2017.133%2071.942%2017.133%20L%2073.262%2017.133%20L%2073.262%2018.823%20C%2072.998%2018.911%2072.664%2018.99%2072.259%2019.061%20C%2071.872%2019.149%2071.484%2019.193%2071.097%2019.193%20C%2070.411%2019.193%2069.891%2019.087%2069.539%2018.876%20C%2069.187%2018.665%2068.941%2018.374%2068.8%2018.005%20C%2068.677%2017.635%2068.597%2017.221%2068.562%2016.764%20L%2068.377%2016.764%20C%2067.884%2017.292%2067.277%2017.741%2066.555%2018.11%20C%2065.851%2018.48%2065.077%2018.753%2064.232%2018.929%20C%2063.404%2019.122%2062.559%2019.219%2061.697%2019.219%20Z%20M%2062.199%2017.133%20C%2062.903%2017.133%2063.616%2017.054%2064.337%2016.896%20C%2065.077%2016.72%2065.754%2016.473%2066.371%2016.156%20C%2067.004%2015.839%2067.506%2015.461%2067.876%2015.021%20C%2068.263%2014.581%2068.457%2014.088%2068.457%2013.542%20L%2068.457%2012.459%20C%2066.274%2012.459%2064.452%2012.53%2062.991%2012.671%20C%2061.547%2012.794%2060.465%2013.049%2059.743%2013.437%20C%2059.021%2013.824%2058.66%2014.413%2058.66%2015.206%20C%2058.66%2015.716%2058.827%2016.112%2059.162%2016.394%20C%2059.514%2016.658%2059.963%2016.852%2060.509%2016.975%20C%2061.072%2017.08%2061.635%2017.133%2062.199%2017.133%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2047.17%2018.902%20L%2047.17%204.987%20L%2049.23%204.987%20L%2049.441%207.601%20L%2049.626%207.601%20C%2049.749%207.178%2049.969%206.747%2050.286%206.307%20C%2050.621%205.849%2051.061%205.462%2051.607%205.145%20C%2052.17%204.828%2052.839%204.67%2053.613%204.67%20C%2053.913%204.67%2054.203%204.696%2054.485%204.749%20C%2054.784%204.784%2055.048%204.837%2055.277%204.908%20L%2055.277%207.152%20L%2053.877%207.152%20C%2053.085%207.152%2052.416%207.302%2051.871%207.601%20C%2051.342%207.9%2050.92%208.287%2050.603%208.763%20C%2050.304%209.238%2050.084%209.757%2049.943%2010.321%20C%2049.82%2010.866%2049.758%2011.394%2049.758%2011.905%20L%2049.758%2018.902%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2033.52%2019.219%20C%2032.745%2019.219%2032.015%2019.149%2031.328%2019.008%20C%2030.642%2018.885%2030.034%2018.674%2029.506%2018.374%20C%2028.978%2018.057%2028.564%2017.653%2028.265%2017.16%20C%2027.984%2016.649%2027.843%2016.024%2027.843%2015.285%20C%2027.843%2014.141%2028.16%2013.26%2028.793%2012.644%20C%2029.427%2012.011%2030.307%2011.553%2031.434%2011.271%20C%2032.578%2010.99%2033.898%2010.822%2035.395%2010.77%20C%2036.909%2010.699%2038.537%2010.664%2040.28%2010.664%20L%2040.28%209.845%20C%2040.28%209.053%2040.13%208.437%2039.831%207.997%20C%2039.531%207.539%2039.039%207.222%2038.352%207.046%20C%2037.665%206.853%2036.732%206.756%2035.553%206.756%20C%2034.55%206.756%2033.713%206.844%2033.045%207.02%20C%2032.393%207.178%2031.9%207.407%2031.566%207.707%20C%2031.231%207.988%2031.064%208.323%2031.064%208.71%20L%2031.064%209.185%20L%2028.503%209.185%20C%2028.485%209.115%2028.468%209.044%2028.45%208.974%20C%2028.45%208.886%2028.45%208.789%2028.45%208.683%20C%2028.45%207.839%2028.723%207.126%2029.269%206.545%20C%2029.832%205.946%2030.659%205.488%2031.751%205.172%20C%2032.842%204.837%2034.206%204.67%2035.844%204.67%20C%2037.393%204.67%2038.686%204.819%2039.725%205.119%20C%2040.764%205.418%2041.547%205.92%2042.075%206.624%20C%2042.603%207.31%2042.867%208.252%2042.867%209.449%20L%2042.867%2016.103%20C%2042.867%2016.455%2042.929%2016.72%2043.052%2016.896%20C%2043.175%2017.054%2043.413%2017.133%2043.765%2017.133%20L%2045.085%2017.133%20L%2045.085%2018.823%20C%2044.821%2018.911%2044.487%2018.99%2044.082%2019.061%20C%2043.695%2019.149%2043.307%2019.193%2042.92%2019.193%20C%2042.234%2019.193%2041.714%2019.087%2041.362%2018.876%20C%2041.01%2018.665%2040.764%2018.374%2040.623%2018.005%20C%2040.5%2017.635%2040.42%2017.221%2040.385%2016.764%20L%2040.2%2016.764%20C%2039.707%2017.292%2039.1%2017.741%2038.378%2018.11%20C%2037.674%2018.48%2036.9%2018.753%2036.055%2018.929%20C%2035.227%2019.122%2034.382%2019.219%2033.52%2019.219%20Z%20M%2034.022%2017.133%20C%2034.726%2017.133%2035.439%2017.054%2036.16%2016.896%20C%2036.9%2016.72%2037.577%2016.473%2038.194%2016.156%20C%2038.827%2015.839%2039.329%2015.461%2039.699%2015.021%20C%2040.086%2014.581%2040.28%2014.088%2040.28%2013.542%20L%2040.28%2012.459%20C%2038.097%2012.459%2036.275%2012.53%2034.814%2012.671%20C%2033.37%2012.794%2032.288%2013.049%2031.566%2013.437%20C%2030.844%2013.824%2030.483%2014.413%2030.483%2015.206%20C%2030.483%2015.716%2030.65%2016.112%2030.985%2016.394%20C%2031.337%2016.658%2031.786%2016.852%2032.332%2016.975%20C%2032.895%2017.08%2033.458%2017.133%2034.022%2017.133%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2023.105%2018.903%20L%2023.105%20-0.215%20L%2025.692%20-0.215%20L%2025.692%2018.903%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2010.853%2019.219%20C%208.494%2019.219%206.504%2018.867%204.885%2018.163%20C%203.265%2017.441%202.042%2016.385%201.215%2014.994%20C%200.405%2013.586%200%2011.861%200%209.819%20C%200%206.826%200.933%204.52%202.799%202.901%20C%204.665%201.263%207.332%200.445%2010.8%200.445%20C%2012.824%200.445%2014.602%200.709%2016.134%201.237%20C%2017.665%201.765%2018.853%202.557%2019.698%203.614%20C%2020.561%204.652%2020.992%205.946%2020.992%207.495%20L%2018.167%207.495%20C%2018.167%206.404%2017.859%205.524%2017.243%204.855%20C%2016.626%204.168%2015.755%203.675%2014.628%203.376%20C%2013.52%203.059%2012.226%202.901%2010.747%202.901%20C%209.215%202.901%207.86%203.147%206.681%203.64%20C%205.501%204.115%204.577%204.846%203.908%205.832%20C%203.257%206.8%202.931%208.014%202.931%209.476%20L%202.931%2010.136%20C%202.931%2011.667%203.265%2012.926%203.934%2013.912%20C%204.603%2014.88%205.527%2015.602%206.707%2016.077%20C%207.904%2016.552%209.286%2016.79%2010.853%2016.79%20C%2012.349%2016.79%2013.652%2016.631%2014.761%2016.315%20C%2015.87%2015.98%2016.723%2015.478%2017.322%2014.809%20C%2017.938%2014.123%2018.246%2013.26%2018.246%2012.222%20L%2021.019%2012.222%20C%2021.019%2013.753%2020.587%2015.038%2019.725%2016.077%20C%2018.862%2017.116%2017.665%2017.899%2016.134%2018.427%20C%2014.62%2018.955%2012.859%2019.219%2010.853%2019.219%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3c/svg%3e",createStoreImpl=n=>{let e;const i=new Set,s=(c,f)=>{const p=typeof c=="function"?c(e):c;if(!Object.is(p,e)){const d=e;e=f??(typeof p!="object"||p===null)?p:Object.assign({},e,p),i.forEach(m=>m(e,d))}},r=()=>e,l={setState:s,getState:r,getInitialState:()=>u,subscribe:c=>(i.add(c),()=>i.delete(c))},u=e=n(s,r,l);return l},createStore=n=>n?createStoreImpl(n):createStoreImpl,identity=n=>n;function useStore(n,e=identity){const i=React.useSyncExternalStore(n.subscribe,React.useCallback(()=>e(n.getState()),[n,e]),React.useCallback(()=>e(n.getInitialState()),[n,e]));return React.useDebugValue(i),i}const createImpl=n=>{const e=createStore(n),i=s=>useStore(e,s);return Object.assign(i,e),i},create=n=>n?createImpl(n):createImpl,initialState={config:{apiKey:null,templateId:null,analysisId:null,primaryColor:"#8b5cf6",position:"bottom-right",autoOpen:!1,demoTemplate:"audiometria",geminiApiKey:void 0,lang:"es"},isAuthenticated:!1,accessToken:null,userProfile:null,templates:[],currentTemplate:null,currentAnalysis:null,isConnected:!1,isPaused:!1,isAutopilot:!1,speechSpeed:"fast",voiceStyle:"formal",remoteSessionActive:!1,remoteSessionInfo:null,userStreamInfo:null,analysisStreamInfo:null,isS2Connected:!1,formData:{},documentChanges:[],transcriptMessages:[],chatMessages:[],analysisTitle:"Sin título",usageStats:null},useClaraStore=create((n,e)=>({...initialState,setConfig:i=>n(s=>({config:{...s.config,...i},isAuthenticated:i.apiKey?!0:s.isAuthenticated})),setAuthenticated:i=>n({isAuthenticated:i}),setAccessToken:i=>n({accessToken:i}),setUserProfile:i=>n({userProfile:i}),setTemplates:i=>n({templates:i}),setCurrentTemplate:i=>n({currentTemplate:i}),setCurrentAnalysis:i=>n({currentAnalysis:i,config:i?{...e().config,analysisId:i.id}:e().config}),setConnected:i=>n({isConnected:i}),setPaused:i=>n({isPaused:i}),setAutopilot:i=>n({isAutopilot:i}),setSpeechSpeed:i=>n({speechSpeed:i}),setVoiceStyle:i=>n({voiceStyle:i}),setRemoteSessionActive:i=>n({remoteSessionActive:i}),setRemoteSessionInfo:i=>n({remoteSessionInfo:i}),setUserStreamInfo:i=>n({userStreamInfo:i}),setAnalysisStreamInfo:i=>n({analysisStreamInfo:i}),setS2Connected:i=>n({isS2Connected:i}),updateFormData:(i,s,r="user",a="Manual edit")=>n(o=>{const l={fieldId:i,value:s,source:r,reason:a,timestamp:new Date().toISOString()};return{formData:{...o.formData,[i]:s},documentChanges:[...o.documentChanges,l]}}),setFormData:i=>n({formData:i}),addDocumentChange:i=>n(s=>({documentChanges:[...s.documentChanges,i]})),clearDocumentChanges:()=>n({documentChanges:[]}),addTranscriptMessage:i=>n(s=>{if(i.id){const a=s.transcriptMessages.findIndex(o=>o.id===i.id);if(a!==-1){const o=[...s.transcriptMessages];return o[a]={...o[a],...i},{transcriptMessages:o}}}const r=s.transcriptMessages[s.transcriptMessages.length-1];if(r&&r.role===i.role){const a=r.content.trim().toLowerCase(),o=i.content.trim().toLowerCase();if(a===o||a.includes(o)||o.includes(a)){if(o.length>a.length){const l=[...s.transcriptMessages];return l[l.length-1]={...r,content:i.content,id:i.id},{transcriptMessages:l}}return s}}return{transcriptMessages:[...s.transcriptMessages,i]}}),clearTranscript:()=>n({transcriptMessages:[]}),addChatMessage:i=>n(s=>({chatMessages:[...s.chatMessages,i]})),clearChatMessages:()=>n({chatMessages:[]}),setAnalysisTitle:i=>n({analysisTitle:i}),setUsageStats:i=>n({usageStats:i}),clearSessionData:()=>n({formData:{},documentChanges:[],transcriptMessages:[],chatMessages:[],analysisTitle:"Sin título",currentAnalysis:null,analysisStreamInfo:null,isS2Connected:!1,usageStats:null}),reset:()=>n(initialState)})),ClaraStoreAPI={getConfig:()=>useClaraStore.getState().config,getApiKey:()=>useClaraStore.getState().config.apiKey,getTemplateId:()=>useClaraStore.getState().config.templateId,getAnalysisId:()=>useClaraStore.getState().config.analysisId,getPrimaryColor:()=>useClaraStore.getState().config.primaryColor,getUserProfile:()=>useClaraStore.getState().userProfile,getTemplates:()=>useClaraStore.getState().templates,getCurrentTemplate:()=>useClaraStore.getState().currentTemplate,getCurrentAnalysis:()=>useClaraStore.getState().currentAnalysis,isAuthenticated:()=>useClaraStore.getState().isAuthenticated,isConnected:()=>useClaraStore.getState().isConnected,isPaused:()=>useClaraStore.getState().isPaused,isAutopilot:()=>useClaraStore.getState().isAutopilot,getSpeechSpeed:()=>useClaraStore.getState().speechSpeed,getVoiceStyle:()=>useClaraStore.getState().voiceStyle,getFormData:()=>useClaraStore.getState().formData,getDocumentChanges:()=>useClaraStore.getState().documentChanges,getTranscript:()=>useClaraStore.getState().transcriptMessages,getAnalysisTitle:()=>useClaraStore.getState().analysisTitle,getUserStreamInfo:()=>useClaraStore.getState().userStreamInfo,getAnalysisStreamInfo:()=>useClaraStore.getState().analysisStreamInfo,isS2Connected:()=>useClaraStore.getState().isS2Connected,isRemoteSessionActive:()=>useClaraStore.getState().remoteSessionActive,getRemoteSessionInfo:()=>useClaraStore.getState().remoteSessionInfo,setConfig:n=>useClaraStore.getState().setConfig(n),setAuthenticated:n=>useClaraStore.getState().setAuthenticated(n),setUserProfile:n=>useClaraStore.getState().setUserProfile(n),setTemplates:n=>useClaraStore.getState().setTemplates(n),setCurrentTemplate:n=>useClaraStore.getState().setCurrentTemplate(n),setCurrentAnalysis:n=>useClaraStore.getState().setCurrentAnalysis(n),setConnected:n=>useClaraStore.getState().setConnected(n),setPaused:n=>useClaraStore.getState().setPaused(n),setAutopilot:n=>useClaraStore.getState().setAutopilot(n),setSpeechSpeed:n=>useClaraStore.getState().setSpeechSpeed(n),setVoiceStyle:n=>useClaraStore.getState().setVoiceStyle(n),setUserStreamInfo:n=>useClaraStore.getState().setUserStreamInfo(n),setAnalysisStreamInfo:n=>useClaraStore.getState().setAnalysisStreamInfo(n),setS2Connected:n=>useClaraStore.getState().setS2Connected(n),setRemoteSessionActive:n=>useClaraStore.getState().setRemoteSessionActive(n),setRemoteSessionInfo:n=>useClaraStore.getState().setRemoteSessionInfo(n),updateFormData:(n,e,i,s)=>useClaraStore.getState().updateFormData(n,e,i,s),setFormData:n=>useClaraStore.getState().setFormData(n),addDocumentChange:n=>useClaraStore.getState().addDocumentChange(n),clearDocumentChanges:()=>useClaraStore.getState().clearDocumentChanges(),addTranscriptMessage:n=>useClaraStore.getState().addTranscriptMessage(n),clearTranscript:()=>useClaraStore.getState().clearTranscript(),setAnalysisTitle:n=>useClaraStore.getState().setAnalysisTitle(n),reset:()=>useClaraStore.getState().reset(),subscribe:n=>useClaraStore.subscribe(n)};typeof window<"u"&&(window.ClaraStore=ClaraStoreAPI);const PROJECT_ID="ncifcjxnmyjfracfzwrl",API_BASE_URL$1=`https://${PROJECT_ID}.supabase.co/functions/v1/api`;class ClaraApiService{constructor(){Re(this,"apiKey",null);Re(this,"accessToken",null)}setApiKey(e){console.log("[Clara API] 🔑 setApiKey() called"),this.apiKey=e,this.accessToken=null}setAccessToken(e){console.log("[Clara API] 🎫 setAccessToken() called"),this.accessToken=e,this.apiKey=null}getApiKey(){return this.apiKey}getAccessToken(){return this.accessToken}getApiBaseUrl(){return API_BASE_URL$1}hasAuth(){return!!(this.apiKey||this.accessToken)}clearAuth(){console.log("[Clara API] 🧹 clearAuth() called"),this.apiKey=null,this.accessToken=null}getHeadersForEphemeral(){const e={"Content-Type":"application/json"};return this.apiKey?e["X-API-Key"]=this.apiKey:this.accessToken&&(e.Authorization=`Bearer ${this.accessToken}`),e}getHeaders(){const e={"Content-Type":"application/json"};return this.apiKey?e["X-API-Key"]=this.apiKey:this.accessToken?e.Authorization=`Bearer ${this.accessToken}`:console.warn("[Clara API] ⚠️ getHeaders() - no auth available!"),e}async login(e,i){var s;try{const r=`${API_BASE_URL$1}/auth/login`;console.log("[Clara API] Logging in...");const a=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:i})}),o=await a.json();if(!a.ok||o.error){const l=((s=o.error)==null?void 0:s.message)||o.error||"Error de autenticación";return console.error("[Clara API] Login failed:",l),{success:!1,error:l}}return o.data?(this.setAccessToken(o.data.accessToken),console.log("[Clara API] Login successful, user:",o.data.user.email),{success:!0,user:o.data.user}):{success:!1,error:"Respuesta inválida del servidor"}}catch(r){return console.error("[Clara API] Login error:",r),{success:!1,error:"Error de conexión"}}}async fetchUserProfile(){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const e=`${API_BASE_URL$1}/user/profile`;console.log("[Clara API] Fetching user profile from:",e);const i=await fetch(e,{method:"GET",headers:this.getHeaders()});if(!i.ok)throw i.status===401?new Error("Invalid API key"):new Error(`HTTP ${i.status}`);const s=await i.json();return console.log("[Clara API] User profile received:",s),s.data||s}catch(e){throw console.error("[Clara API] Failed to fetch user profile:",e),e}}async updateUserSettings(e){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),!1;try{const i=`${API_BASE_URL$1}/user/settings`;console.log("[Clara API] Updating user settings:",e);const s=await fetch(i,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({settings:e})});return s.ok?(console.log("[Clara API] Settings updated successfully"),!0):(console.error("[Clara API] Failed to update settings:",s.status),!1)}catch(i){return console.error("[Clara API] Failed to update user settings:",i),!1}}async fetchTemplates(){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const e=`${API_BASE_URL$1}/templates`;console.log("[Clara API] Fetching templates from:",e);const i=await fetch(e,{method:"GET",headers:this.getHeaders()});if(!i.ok)throw i.status===401?new Error("Invalid API key"):new Error(`HTTP ${i.status}`);const s=await i.json();return console.log("[Clara API] Templates received:",s),s.data||s}catch(e){throw console.error("[Clara API] Failed to fetch templates:",e),e}}async fetchTemplate(e){const i=await this.fetchTemplates();return i&&i.find(s=>s.id===e)||null}async createTemplate(e){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const i=`${API_BASE_URL$1}/templates`;console.log("[Clara API] Creating template at:",i);const s=await fetch(i,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({name:e.name,language:e.language||"es",description:e.description||"",custom_prompt:e.custom_prompt||null,structure:e.structure,webhook_config:e.webhook_config||null})});if(!s.ok)throw s.status===401?new Error("Invalid API key"):new Error(`HTTP ${s.status}`);const r=await s.json();return console.log("[Clara API] Template created:",r),r.data||r}catch(i){throw console.error("[Clara API] Failed to create template:",i),i}}async createAnalysis(e,i){var a;if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;const s={id:i.id,name:i.name,description:i.description,custom_prompt:i.custom_prompt,sections:((a=i.structure)==null?void 0:a.sections)||[]},r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);try{const o=`${API_BASE_URL$1}/analyses`;console.log("[Clara API] Creating analysis at:",o,{templateId:e,isValidUUID:r});const l=await fetch(o,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({templateId:r?e:null,source:"web_live",title:i.name||"Nueva consulta",templateSnapshot:s})});if(!l.ok)throw new Error(`HTTP ${l.status}`);const u=await l.json();return console.log("[Clara API] Analysis created:",u),u.data||u}catch(o){return console.error("[Clara API] Failed to create analysis:",o),null}}async updateFormData(e,i,s,r,a){if(!this.hasAuth()||!e)return!1;console.log("[Clara API] 📊 updateFormData called with usageStats:",a);try{const o=`${API_BASE_URL$1}/analyses/${e}`;console.log("[Clara API] Updating formData:",o);const l={formData:i};return s&&s.length>0&&(l.documentChanges=s),r&&r.length>0&&(l.chatHistory=r),a&&a.totalTokens>0?(l.usageInputTokens=a.inputTokens,l.usageOutputTokens=a.outputTokens,l.usageTotalTokens=a.totalTokens,l.usageEstimatedCost=a.estimatedCost,console.log("[Clara API] 📊 Including usage in PUT:",l.usageTotalTokens,"tokens")):console.log("[Clara API] ⚠️ No usage stats to include (zeros or undefined)"),(await fetch(o,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify(l)})).ok}catch(o){return console.error("[Clara API] Failed to update formData:",o),!1}}async updateAnalysisTitle(e,i){if(!this.hasAuth()||!e)return!1;try{const s=`${API_BASE_URL$1}/analyses/${e}`;return(await fetch(s,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({title:i})})).ok}catch(s){return console.error("[Clara API] Failed to update analysis title:",s),!1}}async syncChatHistory(e,i){if(!this.hasAuth()||!e)return!1;try{const s=`${API_BASE_URL$1}/analyses/${e}`;return fetch(s,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({chatHistory:i})}).catch(r=>console.error("[Clara API] Chat history sync failed:",r)),!0}catch(s){return console.error("[Clara API] Failed to sync chat history:",s),!1}}async syncTranscriptToDB(e,i){if(!this.hasAuth()||!e)return!1;const s=i.map((r,a)=>({id:r.id||`msg_${a}_${Date.now()}`,role:r.role,content:r.content,timestamp:r.timestamp instanceof Date?r.timestamp.toISOString():r.timestamp,isFinal:r.isFinal??!0}));try{const r=`${API_BASE_URL$1}/analyses/${e}`;return fetch(r,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({transcript:JSON.stringify(s)})}).catch(a=>console.error("[Clara API] Transcript sync failed:",a)),!0}catch(r){return console.error("[Clara API] Failed to sync transcript:",r),!1}}async completeAnalysis(e,i,s,r,a,o){if(!this.hasAuth()||!e)return!1;const l=r.map((c,f)=>({id:c.id||`msg_${f}_${Date.now()}`,role:c.role,content:c.content,timestamp:c.timestamp instanceof Date?c.timestamp.toISOString():c.timestamp,isFinal:c.isFinal??!0})),u=new Date().toISOString();try{const c=`${API_BASE_URL$1}/analyses/${e}`;console.log("[Clara API] Completing analysis:",c);const f={status:"completed",transcript:JSON.stringify(l),completedAt:u,formData:i,documentChanges:s};a&&a.length>0&&(f.chatHistory=a),o&&o.totalTokens>0&&(f.usageInputTokens=o.inputTokens,f.usageOutputTokens=o.outputTokens,f.usageTotalTokens=o.totalTokens,f.usageEstimatedCost=o.estimatedCost);const p=await fetch(c,{method:"PUT",keepalive:!0,headers:this.getHeaders(),body:JSON.stringify(f)});return p.ok&&console.log("[Clara API] Analysis completed successfully"),p.ok}catch(c){return console.error("[Clara API] Failed to complete analysis:",c),!1}}async fetchBasinToken(e={}){if(!this.hasAuth())return null;try{const i=`${API_BASE_URL$1}/s2/basin/token`;console.log("[Clara API] Fetching S2 basin token from:",i,"with body:",e);const s=await fetch(i,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if(!s.ok)throw new Error(`HTTP ${s.status}`);const r=await s.json();return console.log("[Clara API] Basin token received:",r),r.data||r}catch(i){return console.error("[Clara API] Failed to fetch basin token:",i),null}}async fetchUserStreamToken(){var i;const e=await this.fetchBasinToken({});return e?{basin:e.basin,token:e.token,id:((i=e.streams)==null?void 0:i.exact)||e.userId||""}:null}async fetchAnalysisStreamToken(e,i){const s=i||e,r=await this.fetchBasinToken({streams:[s],includeUserStream:!1,ops:["list-streams","create-stream","append","read"]});return r?{basin:r.basin,token:r.token,id:s,analysisId:e}:null}}const claraApi=new ClaraApiService,translations={"login.title":{es:"Iniciar Sesión",en:"Sign In"},"login.email":{es:"Correo electrónico",en:"Email"},"login.password":{es:"Contraseña",en:"Password"},"login.submit":{es:"Ingresar",en:"Sign In"},"login.register":{es:"Regístrate en Clara",en:"Register on Clara"},"login.error":{es:"Error al iniciar sesión",en:"Login error"},"dashboard.title":{es:"Panel de Control",en:"Dashboard"},"dashboard.newConsultation":{es:"Nueva Consulta",en:"New Consultation"},"dashboard.templates":{es:"Plantillas",en:"Templates"},"dashboard.recentSessions":{es:"Sesiones Recientes",en:"Recent Sessions"},"dashboard.noTemplate":{es:"Sin plantilla seleccionada",en:"No template selected"},"dashboard.selectTemplate":{es:"Seleccionar plantilla",en:"Select template"},"dashboard.startSession":{es:"Iniciar Sesión",en:"Start Session"},"dashboard.generate":{es:"Generar",en:"Generate"},"dashboard.logout":{es:"Cerrar Sesión",en:"Log Out"},"session.recording":{es:"Grabando...",en:"Recording..."},"session.paused":{es:"Pausado",en:"Paused"},"session.stop":{es:"Detener",en:"Stop"},"session.pause":{es:"Pausar",en:"Pause"},"session.resume":{es:"Reanudar",en:"Resume"},"session.untitled":{es:"Sin título",en:"Untitled"},"tabs.form":{es:"Formulario",en:"Form"},"tabs.transcript":{es:"Transcripción",en:"Transcript"},"tabs.chat":{es:"Chat",en:"Chat"},"tabs.report":{es:"Reporte",en:"Report"},"chat.placeholder":{es:"Escribe un mensaje...",en:"Type a message..."},"chat.send":{es:"Enviar",en:"Send"},"chat.welcome":{es:"Hola. Soy tu asistente médico con capacidad visual. Envíame imágenes o PDFs para extraer datos y generar el reporte.",en:"Hello. I am your visual medical assistant. Send me images or PDFs to extract data and generate the report."},"chat.thinking":{es:"Pensando...",en:"Thinking..."},"chat.generateSoap":{es:"Generar SOAP",en:"Generate SOAP"},"chat.summarize":{es:"Resumir consulta",en:"Summarize consultation"},"chat.clear":{es:"Limpiar chat",en:"Clear chat"},"chat.noDataToSummarize":{es:"No hay datos capturados para resumir. Complete los campos del formulario primero.",en:"No captured data to summarize. Complete the form fields first."},"form.clear":{es:"Limpiar",en:"Clear"},"form.save":{es:"Guardar",en:"Save"},"form.noTemplate":{es:"No hay plantilla cargada",en:"No template loaded"},"report.export":{es:"Exportar PDF",en:"Export PDF"},"report.fieldsCaptured":{es:"campos capturados",en:"fields captured"},"report.capturedData":{es:"Datos Capturados",en:"Captured Data"},"report.selectTemplate":{es:"Selecciona una plantilla para ver los campos",en:"Select a template to see the fields"},"report.noData":{es:"Sin datos",en:"No data"},"report.title":{es:"Reporte Médico",en:"Medical Report"},"report.generatedOn":{es:"Generado el",en:"Generated on"},"config.title":{es:"Configuración del Widget",en:"Widget Configuration"},"config.realtime":{es:"Los cambios se aplican en tiempo real",en:"Changes apply in real-time"},"config.apiKey":{es:"Clara API Key",en:"Clara API Key"},"config.apiKeyDesc":{es:"Tu clave de API para autenticación con Clara Platform.",en:"Your API key for Clara Platform authentication."},"config.templateId":{es:"Template ID (opcional)",en:"Template ID (optional)"},"config.templateIdDesc":{es:"ID del template remoto a cargar (sobrescribe el demo).",en:"Remote template ID to load (overrides demo)."},"config.primaryColor":{es:"Color Principal",en:"Primary Color"},"config.position":{es:"Posición del Widget",en:"Widget Position"},"config.positionLeft":{es:"Izquierda",en:"Left"},"config.positionCenter":{es:"Centro",en:"Center"},"config.positionRight":{es:"Derecha",en:"Right"},"config.autoOpen":{es:"Abrir Automáticamente",en:"Auto Open"},"config.autoOpenDesc":{es:"Si está activado, el widget aparecerá abierto al cargar la página.",en:"If enabled, the widget will open automatically on page load."},"config.language":{es:"Idioma",en:"Language"},"config.languageDesc":{es:"Idioma de la interfaz del widget.",en:"Widget interface language."},"config.spanish":{es:"Español",en:"Spanish"},"config.english":{es:"Inglés",en:"English"},"config.integrationCode":{es:"Código de Integración",en:"Integration Code"},"config.viewSdk":{es:"Ver SDK y documentación",en:"View SDK and documentation"},"transcript.provisional":{es:"La transcripción es provisional y puede ser corregida al finalizar.",en:"Transcription is provisional and may be corrected upon completion."},"transcript.empty":{es:"La transcripción aparecerá aquí...",en:"Transcription will appear here..."},"transcript.connecting":{es:"Conectando con el modelo de voz...",en:"Connecting to voice model..."},"transcript.listening":{es:"Escuchando conversación...",en:"Listening to conversation..."},"transcript.startSession":{es:"Inicia la sesión para ver la transcripción.",en:"Start the session to see the transcript."},"common.loading":{es:"Cargando...",en:"Loading..."},"common.error":{es:"Error",en:"Error"},"common.success":{es:"Éxito",en:"Success"},"common.cancel":{es:"Cancelar",en:"Cancel"},"common.confirm":{es:"Confirmar",en:"Confirm"},"common.close":{es:"Cerrar",en:"Close"},"generate.title":{es:"Generando Template",en:"Generating Template"},"generate.complete":{es:"Template Generado",en:"Template Generated"},"generate.analyzing":{es:"Analizando formulario...",en:"Analyzing form..."},"generate.sections":{es:"secciones",en:"sections"},"generate.fields":{es:"campos",en:"fields"}};function t(n,e="es"){const i=translations[n];return i?i[e]||i.es:(console.warn(`[Translations] Missing key: ${n}`),n)}function createTranslator(n){return e=>t(e,n)}const ClaraLogin=({onLogin:n,primaryColor:e})=>{const[i,s]=React.useState(""),[r,a]=React.useState(""),[o,l]=React.useState(!1),[u,c]=React.useState({}),{config:f,setAccessToken:p,setUserProfile:d,setAuthenticated:m}=useClaraStore(),P=f.lang||"es",T=()=>{const y={};return i?/\S+@\S+\.\S+/.test(i)||(y.email="Ingrese un correo electrónico válido"):y.email="El correo electrónico es requerido",r||(y.password="La contraseña es requerida"),c(y),Object.keys(y).length===0},x=async y=>{if(y.preventDefault(),!!T()){l(!0),c({});try{const C=await claraApi.login(i,r);if(!C.success){c({general:C.error||"Credenciales incorrectas"}),l(!1);return}const g=claraApi.getAccessToken();g&&p(g),C.user&&d({id:C.user.id,email:C.user.email,name:`${C.user.user_metadata.first_name||""} ${C.user.user_metadata.last_name||""}`.trim()}),m(!0),n()}catch(C){console.error("[Login] Error:",C),c({general:"Error de conexión"})}finally{l(!1)}}};return jsxRuntime.jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex flex-col h-full bg-card text-card-foreground px-6 py-8 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"mb-6 text-center",children:jsxRuntime.jsx("img",{src:claraLogo,alt:"Clara",className:"h-8 w-auto"})}),jsxRuntime.jsx("div",{className:"text-center mb-6",children:jsxRuntime.jsx("h2",{className:"text-lg font-bold leading-tight mb-1",style:{color:e},children:t("login.title",P)})}),jsxRuntime.jsxs("form",{onSubmit:x,className:"w-full space-y-4",noValidate:!0,children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5",children:t("login.email",P)}),jsxRuntime.jsx("input",{type:"email",value:i,onChange:y=>{s(y.target.value),u.email&&c({...u,email:void 0})},placeholder:"tu-correo@clara.care",className:`w-full px-3 py-2.5 rounded-lg border text-sm ${u.email?"border-destructive focus:ring-destructive/20":"border-border focus:ring-ring/20"} focus:outline-none focus:ring-2 focus:border-transparent text-foreground bg-background shadow-sm transition-all`}),u.email&&jsxRuntime.jsx("p",{className:"text-destructive text-[10px] mt-1",children:u.email})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5",children:t("login.password",P)}),jsxRuntime.jsx("input",{type:"password",value:r,onChange:y=>{a(y.target.value),u.password&&c({...u,password:void 0})},placeholder:"••••••••",className:`w-full px-3 py-2.5 rounded-lg border text-sm ${u.password?"border-destructive focus:ring-destructive/20":"border-border focus:ring-ring/20"} focus:outline-none focus:ring-2 focus:border-transparent text-foreground bg-background shadow-sm transition-all`}),u.password&&jsxRuntime.jsx("p",{className:"text-destructive text-[10px] mt-1",children:u.password})]}),u.general&&jsxRuntime.jsx("div",{className:"p-2 bg-destructive/10 border border-destructive/20 rounded-lg",children:jsxRuntime.jsx("p",{className:"text-destructive text-xs text-center",children:u.general})}),jsxRuntime.jsx("button",{type:"submit",disabled:o,style:{backgroundColor:e},className:"w-full text-white font-semibold py-2.5 px-4 rounded-lg transition-all shadow-button text-sm hover:brightness-110 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"w-4 h-4 animate-spin"}),t("common.loading",P)]}):t("login.submit",P)})]}),jsxRuntime.jsx("div",{className:"mt-6 pb-4 text-center",children:jsxRuntime.jsx("a",{href:"https://clara.care",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium text-xs hover:opacity-80 transition-colors",style:{color:e},children:t("login.register",P)})})]})})};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lottie$1={exports:{}};(function(module,exports){typeof document<"u"&&typeof navigator<"u"&&function(n,e){module.exports=e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(e){_useWebWorker=!!e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(e){locationHref=e},getLocationHref=function(){return locationHref};function createTag(n){return document.createElement(n)}function extendPrototype(n,e){var i,s=n.length,r;for(i=0;i<s;i+=1){r=n[i].prototype;for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e.prototype[a]=r[a])}}function getDescriptor(n,e){return Object.getOwnPropertyDescriptor(n,e)}function createProxyFunction(n){function e(){}return e.prototype=n,e}var audioControllerFactory=function(){function n(e){this.audios=[],this.audioFactory=e,this._volume=1,this._isMuted=!1}return n.prototype={addAudio:function(i){this.audios.push(i)},pause:function(){var i,s=this.audios.length;for(i=0;i<s;i+=1)this.audios[i].pause()},resume:function(){var i,s=this.audios.length;for(i=0;i<s;i+=1)this.audios[i].resume()},setRate:function(i){var s,r=this.audios.length;for(s=0;s<r;s+=1)this.audios[s].setRate(i)},createAudio:function(i){return this.audioFactory?this.audioFactory(i):window.Howl?new window.Howl({src:[i]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(i){this.audioFactory=i},setVolume:function(i){this._volume=i,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var i,s=this.audios.length;for(i=0;i<s;i+=1)this.audios[i].volume(this._volume*(this._isMuted?0:1))}},function(){return new n}}(),createTypedArray=function(){function n(i,s){var r=0,a=[],o;switch(i){case"int16":case"uint8c":o=1;break;default:o=1.1;break}for(r=0;r<s;r+=1)a.push(o);return a}function e(i,s){return i==="float32"?new Float32Array(s):i==="int16"?new Int16Array(s):i==="uint8c"?new Uint8ClampedArray(s):n(i,s)}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?e:n}();function createSizedArray(n){return Array.apply(null,{length:n})}function _typeof$6(n){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$6(n)}var subframeEnabled=!0,expressionsPlugin=null,expressionsInterfaces=null,idPrefix$1="",isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),bmPow=Math.pow,bmSqrt=Math.sqrt,bmFloor=Math.floor,bmMax=Math.max,bmMin=Math.min,BMMath={};(function(){var n=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],e,i=n.length;for(e=0;e<i;e+=1)BMMath[n[e]]=Math[n[e]]})(),BMMath.random=Math.random,BMMath.abs=function(n){var e=_typeof$6(n);if(e==="object"&&n.length){var i=createSizedArray(n.length),s,r=n.length;for(s=0;s<r;s+=1)i[s]=Math.abs(n[s]);return i}return Math.abs(n)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function styleDiv(n){n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.display="block",n.style.transformOrigin="0 0",n.style.webkitTransformOrigin="0 0",n.style.backfaceVisibility="visible",n.style.webkitBackfaceVisibility="visible",n.style.transformStyle="preserve-3d",n.style.webkitTransformStyle="preserve-3d",n.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(n,e,i,s){this.type=n,this.currentTime=e,this.totalTime=i,this.direction=s<0?-1:1}function BMCompleteEvent(n,e){this.type=n,this.direction=e<0?-1:1}function BMCompleteLoopEvent(n,e,i,s){this.type=n,this.currentLoop=i,this.totalLoops=e,this.direction=s<0?-1:1}function BMSegmentStartEvent(n,e,i){this.type=n,this.firstFrame=e,this.totalFrames=i}function BMDestroyEvent(n,e){this.type=n,this.target=e}function BMRenderFrameErrorEvent(n,e){this.type="renderFrameError",this.nativeError=n,this.currentTime=e}function BMConfigErrorEvent(n){this.type="configError",this.nativeError=n}var createElementID=function(){var n=0;return function(){return n+=1,idPrefix$1+"__lottie_element_"+n}}();function HSVtoRGB(n,e,i){var s,r,a,o,l,u,c,f;switch(o=Math.floor(n*6),l=n*6-o,u=i*(1-e),c=i*(1-l*e),f=i*(1-(1-l)*e),o%6){case 0:s=i,r=f,a=u;break;case 1:s=c,r=i,a=u;break;case 2:s=u,r=i,a=f;break;case 3:s=u,r=c,a=i;break;case 4:s=f,r=u,a=i;break;case 5:s=i,r=u,a=c;break}return[s,r,a]}function RGBtoHSV(n,e,i){var s=Math.max(n,e,i),r=Math.min(n,e,i),a=s-r,o,l=s===0?0:a/s,u=s/255;switch(s){case r:o=0;break;case n:o=e-i+a*(e<i?6:0),o/=6*a;break;case e:o=i-n+a*2,o/=6*a;break;case i:o=n-e+a*4,o/=6*a;break}return[o,l,u]}function addSaturationToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[1]+=e,i[1]>1?i[1]=1:i[1]<=0&&(i[1]=0),HSVtoRGB(i[0],i[1],i[2])}function addBrightnessToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[2]+=e,i[2]>1?i[2]=1:i[2]<0&&(i[2]=0),HSVtoRGB(i[0],i[1],i[2])}function addHueToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[0]+=e/360,i[0]>1?i[0]-=1:i[0]<0&&(i[0]+=1),HSVtoRGB(i[0],i[1],i[2])}var rgbToHex=function(){var n=[],e,i;for(e=0;e<256;e+=1)i=e.toString(16),n[e]=i.length===1?"0"+i:i;return function(s,r,a){return s<0&&(s=0),r<0&&(r=0),a<0&&(a=0),"#"+n[s]+n[r]+n[a]}}(),setSubframeEnabled=function(e){subframeEnabled=!!e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(e){expressionsPlugin=e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(e){expressionsInterfaces=e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(e){defaultCurveSegments=e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(e){idPrefix$1=e};function createNS(n){return document.createElementNS(svgNS,n)}function _typeof$5(n){"@babel/helpers - typeof";return _typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$5(n)}var dataManager=function(){var n=1,e=[],i,s,r={onmessage:function(){},postMessage:function(m){i({data:m})}},a={postMessage:function(m){r.onmessage({data:m})}};function o(d){if(window.Worker&&window.Blob&&getWebWorker()){var m=new Blob(["var _workerSelf = self; self.onmessage = ",d.toString()],{type:"text/javascript"}),P=URL.createObjectURL(m);return new Worker(P)}return i=d,r}function l(){s||(s=o(function(m){function P(){function x(O,_){var I,V,B=O.length,k,R,N,H;for(V=0;V<B;V+=1)if(I=O[V],"ks"in I&&!I.completed){if(I.completed=!0,I.hasMask){var J=I.masksProperties;for(R=J.length,k=0;k<R;k+=1)if(J[k].pt.k.i)E(J[k].pt.k);else for(H=J[k].pt.k.length,N=0;N<H;N+=1)J[k].pt.k[N].s&&E(J[k].pt.k[N].s[0]),J[k].pt.k[N].e&&E(J[k].pt.k[N].e[0])}I.ty===0?(I.layers=g(I.refId,_),x(I.layers,_)):I.ty===4?S(I.shapes):I.ty===5&&U(I)}}function y(O,_){if(O){var I=0,V=O.length;for(I=0;I<V;I+=1)O[I].t===1&&(O[I].data.layers=g(O[I].data.refId,_),x(O[I].data.layers,_))}}function C(O,_){for(var I=0,V=_.length;I<V;){if(_[I].id===O)return _[I];I+=1}return null}function g(O,_){var I=C(O,_);return I?I.layers.__used?JSON.parse(JSON.stringify(I.layers)):(I.layers.__used=!0,I.layers):null}function S(O){var _,I=O.length,V,B;for(_=I-1;_>=0;_-=1)if(O[_].ty==="sh")if(O[_].ks.k.i)E(O[_].ks.k);else for(B=O[_].ks.k.length,V=0;V<B;V+=1)O[_].ks.k[V].s&&E(O[_].ks.k[V].s[0]),O[_].ks.k[V].e&&E(O[_].ks.k[V].e[0]);else O[_].ty==="gr"&&S(O[_].it)}function E(O){var _,I=O.i.length;for(_=0;_<I;_+=1)O.i[_][0]+=O.v[_][0],O.i[_][1]+=O.v[_][1],O.o[_][0]+=O.v[_][0],O.o[_][1]+=O.v[_][1]}function A(O,_){var I=_?_.split("."):[100,100,100];return O[0]>I[0]?!0:I[0]>O[0]?!1:O[1]>I[1]?!0:I[1]>O[1]?!1:O[2]>I[2]?!0:I[2]>O[2]?!1:null}var M=function(){var O=[4,4,14];function _(V){var B=V.t.d;V.t.d={k:[{s:B,t:0}]}}function I(V){var B,k=V.length;for(B=0;B<k;B+=1)V[B].ty===5&&_(V[B])}return function(V){if(A(O,V.v)&&(I(V.layers),V.assets)){var B,k=V.assets.length;for(B=0;B<k;B+=1)V.assets[B].layers&&I(V.assets[B].layers)}}}(),b=function(){var O=[4,7,99];return function(_){if(_.chars&&!A(O,_.v)){var I,V=_.chars.length;for(I=0;I<V;I+=1){var B=_.chars[I];B.data&&B.data.shapes&&(S(B.data.shapes),B.data.ip=0,B.data.op=99999,B.data.st=0,B.data.sr=1,B.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},_.chars[I].t||(B.data.shapes.push({ty:"no"}),B.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}}(),F=function(){var O=[5,7,15];function _(V){var B=V.t.p;typeof B.a=="number"&&(B.a={a:0,k:B.a}),typeof B.p=="number"&&(B.p={a:0,k:B.p}),typeof B.r=="number"&&(B.r={a:0,k:B.r})}function I(V){var B,k=V.length;for(B=0;B<k;B+=1)V[B].ty===5&&_(V[B])}return function(V){if(A(O,V.v)&&(I(V.layers),V.assets)){var B,k=V.assets.length;for(B=0;B<k;B+=1)V.assets[B].layers&&I(V.assets[B].layers)}}}(),G=function(){var O=[4,1,9];function _(V){var B,k=V.length,R,N;for(B=0;B<k;B+=1)if(V[B].ty==="gr")_(V[B].it);else if(V[B].ty==="fl"||V[B].ty==="st")if(V[B].c.k&&V[B].c.k[0].i)for(N=V[B].c.k.length,R=0;R<N;R+=1)V[B].c.k[R].s&&(V[B].c.k[R].s[0]/=255,V[B].c.k[R].s[1]/=255,V[B].c.k[R].s[2]/=255,V[B].c.k[R].s[3]/=255),V[B].c.k[R].e&&(V[B].c.k[R].e[0]/=255,V[B].c.k[R].e[1]/=255,V[B].c.k[R].e[2]/=255,V[B].c.k[R].e[3]/=255);else V[B].c.k[0]/=255,V[B].c.k[1]/=255,V[B].c.k[2]/=255,V[B].c.k[3]/=255}function I(V){var B,k=V.length;for(B=0;B<k;B+=1)V[B].ty===4&&_(V[B].shapes)}return function(V){if(A(O,V.v)&&(I(V.layers),V.assets)){var B,k=V.assets.length;for(B=0;B<k;B+=1)V.assets[B].layers&&I(V.assets[B].layers)}}}(),L=function(){var O=[4,4,18];function _(V){var B,k=V.length,R,N;for(B=k-1;B>=0;B-=1)if(V[B].ty==="sh")if(V[B].ks.k.i)V[B].ks.k.c=V[B].closed;else for(N=V[B].ks.k.length,R=0;R<N;R+=1)V[B].ks.k[R].s&&(V[B].ks.k[R].s[0].c=V[B].closed),V[B].ks.k[R].e&&(V[B].ks.k[R].e[0].c=V[B].closed);else V[B].ty==="gr"&&_(V[B].it)}function I(V){var B,k,R=V.length,N,H,J,$;for(k=0;k<R;k+=1){if(B=V[k],B.hasMask){var W=B.masksProperties;for(H=W.length,N=0;N<H;N+=1)if(W[N].pt.k.i)W[N].pt.k.c=W[N].cl;else for($=W[N].pt.k.length,J=0;J<$;J+=1)W[N].pt.k[J].s&&(W[N].pt.k[J].s[0].c=W[N].cl),W[N].pt.k[J].e&&(W[N].pt.k[J].e[0].c=W[N].cl)}B.ty===4&&_(B.shapes)}}return function(V){if(A(O,V.v)&&(I(V.layers),V.assets)){var B,k=V.assets.length;for(B=0;B<k;B+=1)V.assets[B].layers&&I(V.assets[B].layers)}}}();function D(O){O.__complete||(G(O),M(O),b(O),F(O),L(O),x(O.layers,O.assets),y(O.chars,O.assets),O.__complete=!0)}function U(O){O.t.a.length===0&&"m"in O.t.p}var z={};return z.completeData=D,z.checkColors=G,z.checkChars=b,z.checkPathProperties=F,z.checkShapes=L,z.completeLayers=x,z}if(a.dataManager||(a.dataManager=P()),a.assetLoader||(a.assetLoader=function(){function x(C){var g=C.getResponseHeader("content-type");return g&&C.responseType==="json"&&g.indexOf("json")!==-1||C.response&&_typeof$5(C.response)==="object"?C.response:C.response&&typeof C.response=="string"?JSON.parse(C.response):C.responseText?JSON.parse(C.responseText):null}function y(C,g,S,E){var A,M=new XMLHttpRequest;try{M.responseType="json"}catch{}M.onreadystatechange=function(){if(M.readyState===4)if(M.status===200)A=x(M),S(A);else try{A=x(M),S(A)}catch(b){E&&E(b)}};try{M.open(["G","E","T"].join(""),C,!0)}catch{M.open(["G","E","T"].join(""),g+"/"+C,!0)}M.send()}return{load:y}}()),m.data.type==="loadAnimation")a.assetLoader.load(m.data.path,m.data.fullPath,function(x){a.dataManager.completeData(x),a.postMessage({id:m.data.id,payload:x,status:"success"})},function(){a.postMessage({id:m.data.id,status:"error"})});else if(m.data.type==="complete"){var T=m.data.animation;a.dataManager.completeData(T),a.postMessage({id:m.data.id,payload:T,status:"success"})}else m.data.type==="loadData"&&a.assetLoader.load(m.data.path,m.data.fullPath,function(x){a.postMessage({id:m.data.id,payload:x,status:"success"})},function(){a.postMessage({id:m.data.id,status:"error"})})}),s.onmessage=function(d){var m=d.data,P=m.id,T=e[P];e[P]=null,m.status==="success"?T.onComplete(m.payload):T.onError&&T.onError()})}function u(d,m){n+=1;var P="processId_"+n;return e[P]={onComplete:d,onError:m},P}function c(d,m,P){l();var T=u(m,P);s.postMessage({type:"loadAnimation",path:d,fullPath:window.location.origin+window.location.pathname,id:T})}function f(d,m,P){l();var T=u(m,P);s.postMessage({type:"loadData",path:d,fullPath:window.location.origin+window.location.pathname,id:T})}function p(d,m,P){l();var T=u(m,P);s.postMessage({type:"complete",animation:d,id:T})}return{loadAnimation:c,loadData:f,completeAnimation:p}}(),ImagePreloader=function(){var n=function(){var y=createTag("canvas");y.width=1,y.height=1;var C=y.getContext("2d");return C.fillStyle="rgba(0,0,0,0)",C.fillRect(0,0,1,1),y}();function e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function i(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function s(y,C,g){var S="";if(y.e)S=y.p;else if(C){var E=y.p;E.indexOf("images/")!==-1&&(E=E.split("/")[1]),S=C+E}else S=g,S+=y.u?y.u:"",S+=y.p;return S}function r(y){var C=0,g=setInterval((function(){var S=y.getBBox();(S.width||C>500)&&(this._imageLoaded(),clearInterval(g)),C+=1}).bind(this),50)}function a(y){var C=s(y,this.assetsPath,this.path),g=createNS("image");isSafari?this.testImageLoaded(g):g.addEventListener("load",this._imageLoaded,!1),g.addEventListener("error",(function(){S.img=n,this._imageLoaded()}).bind(this),!1),g.setAttributeNS("http://www.w3.org/1999/xlink","href",C),this._elementHelper.append?this._elementHelper.append(g):this._elementHelper.appendChild(g);var S={img:g,assetData:y};return S}function o(y){var C=s(y,this.assetsPath,this.path),g=createTag("img");g.crossOrigin="anonymous",g.addEventListener("load",this._imageLoaded,!1),g.addEventListener("error",(function(){S.img=n,this._imageLoaded()}).bind(this),!1),g.src=C;var S={img:g,assetData:y};return S}function l(y){var C={assetData:y},g=s(y,this.assetsPath,this.path);return dataManager.loadData(g,(function(S){C.img=S,this._footageLoaded()}).bind(this),(function(){C.img={},this._footageLoaded()}).bind(this)),C}function u(y,C){this.imagesLoadedCb=C;var g,S=y.length;for(g=0;g<S;g+=1)y[g].layers||(!y[g].t||y[g].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(y[g]))):y[g].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(y[g]))))}function c(y){this.path=y||""}function f(y){this.assetsPath=y||""}function p(y){for(var C=0,g=this.images.length;C<g;){if(this.images[C].assetData===y)return this.images[C].img;C+=1}return null}function d(){this.imagesLoadedCb=null,this.images.length=0}function m(){return this.totalImages===this.loadedAssets}function P(){return this.totalFootages===this.loadedFootagesCount}function T(y,C){y==="svg"?(this._elementHelper=C,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function x(){this._imageLoaded=e.bind(this),this._footageLoaded=i.bind(this),this.testImageLoaded=r.bind(this),this.createFootageData=l.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return x.prototype={loadAssets:u,setAssetsPath:f,setPath:c,loadedImages:m,loadedFootages:P,destroy:d,getAsset:p,createImgData:o,createImageData:a,imageLoaded:e,footageLoaded:i,setCacheType:T},x}();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(e,i){if(this._cbs[e])for(var s=this._cbs[e],r=0;r<s.length;r+=1)s[r](i)},addEventListener:function(e,i){return this._cbs[e]||(this._cbs[e]=[]),this._cbs[e].push(i),(function(){this.removeEventListener(e,i)}).bind(this)},removeEventListener:function(e,i){if(!i)this._cbs[e]=null;else if(this._cbs[e]){for(var s=0,r=this._cbs[e].length;s<r;)this._cbs[e][s]===i&&(this._cbs[e].splice(s,1),s-=1,r-=1),s+=1;this._cbs[e].length||(this._cbs[e]=null)}}};var markerParser=function(){function n(e){for(var i=e.split(`\r
140
+ `),s={},r,a=0,o=0;o<i.length;o+=1)r=i[o].split(":"),r.length===2&&(s[r[0]]=r[1].trim(),a+=1);if(a===0)throw new Error;return s}return function(e){for(var i=[],s=0;s<e.length;s+=1){var r=e[s],a={time:r.tm,duration:r.dr};try{a.payload=JSON.parse(e[s].cm)}catch{try{a.payload=n(e[s].cm)}catch{a.payload={name:e[s].cm}}}i.push(a)}return i}}(),ProjectInterface=function(){function n(e){this.compositions.push(e)}return function(){function e(i){for(var s=0,r=this.compositions.length;s<r;){if(this.compositions[s].data&&this.compositions[s].data.nm===i)return this.compositions[s].prepareFrame&&this.compositions[s].data.xt&&this.compositions[s].prepareFrame(this.currentFrame),this.compositions[s].compInterface;s+=1}return null}return e.compositions=[],e.currentFrame=0,e.registerComposition=n,e}}(),renderers={},registerRenderer=function(e,i){renderers[e]=i};function getRenderer(n){return renderers[n]}function getRegisteredRenderer(){if(renderers.canvas)return"canvas";for(var n in renderers)if(renderers[n])return n;return""}function _typeof$4(n){"@babel/helpers - typeof";return _typeof$4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$4(n)}var AnimationItem=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=createElementID(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=getSubframeEnabled(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=ProjectInterface(),this.imagePreloader=new ImagePreloader,this.audioController=audioControllerFactory(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new BMEnterFrameEvent("drawnFrame",0,0,0),this.expressionsPlugin=getExpressionsPlugin()};extendPrototype([BaseEvent],AnimationItem),AnimationItem.prototype.setParams=function(n){(n.wrapper||n.container)&&(this.wrapper=n.wrapper||n.container);var e="svg";n.animType?e=n.animType:n.renderer&&(e=n.renderer);var i=getRenderer(e);this.renderer=new i(this,n.rendererSettings),this.imagePreloader.setCacheType(e,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=e,n.loop===""||n.loop===null||n.loop===void 0||n.loop===!0?this.loop=!0:n.loop===!1?this.loop=!1:this.loop=parseInt(n.loop,10),this.autoplay="autoplay"in n?n.autoplay:!0,this.name=n.name?n.name:"",this.autoloadSegments=Object.prototype.hasOwnProperty.call(n,"autoloadSegments")?n.autoloadSegments:!0,this.assetsPath=n.assetsPath,this.initialSegment=n.initialSegment,n.audioFactory&&this.audioController.setAudioFactory(n.audioFactory),n.animationData?this.setupAnimation(n.animationData):n.path&&(n.path.lastIndexOf("\\")!==-1?this.path=n.path.substr(0,n.path.lastIndexOf("\\")+1):this.path=n.path.substr(0,n.path.lastIndexOf("/")+1),this.fileName=n.path.substr(n.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),dataManager.loadAnimation(n.path,this.configAnimation,this.onSetupError))},AnimationItem.prototype.onSetupError=function(){this.trigger("data_failed")},AnimationItem.prototype.setupAnimation=function(n){dataManager.completeAnimation(n,this.configAnimation)},AnimationItem.prototype.setData=function(n,e){e&&_typeof$4(e)!=="object"&&(e=JSON.parse(e));var i={wrapper:n,animationData:e},s=n.attributes;i.path=s.getNamedItem("data-animation-path")?s.getNamedItem("data-animation-path").value:s.getNamedItem("data-bm-path")?s.getNamedItem("data-bm-path").value:s.getNamedItem("bm-path")?s.getNamedItem("bm-path").value:"",i.animType=s.getNamedItem("data-anim-type")?s.getNamedItem("data-anim-type").value:s.getNamedItem("data-bm-type")?s.getNamedItem("data-bm-type").value:s.getNamedItem("bm-type")?s.getNamedItem("bm-type").value:s.getNamedItem("data-bm-renderer")?s.getNamedItem("data-bm-renderer").value:s.getNamedItem("bm-renderer")?s.getNamedItem("bm-renderer").value:getRegisteredRenderer()||"canvas";var r=s.getNamedItem("data-anim-loop")?s.getNamedItem("data-anim-loop").value:s.getNamedItem("data-bm-loop")?s.getNamedItem("data-bm-loop").value:s.getNamedItem("bm-loop")?s.getNamedItem("bm-loop").value:"";r==="false"?i.loop=!1:r==="true"?i.loop=!0:r!==""&&(i.loop=parseInt(r,10));var a=s.getNamedItem("data-anim-autoplay")?s.getNamedItem("data-anim-autoplay").value:s.getNamedItem("data-bm-autoplay")?s.getNamedItem("data-bm-autoplay").value:s.getNamedItem("bm-autoplay")?s.getNamedItem("bm-autoplay").value:!0;i.autoplay=a!=="false",i.name=s.getNamedItem("data-name")?s.getNamedItem("data-name").value:s.getNamedItem("data-bm-name")?s.getNamedItem("data-bm-name").value:s.getNamedItem("bm-name")?s.getNamedItem("bm-name").value:"";var o=s.getNamedItem("data-anim-prerender")?s.getNamedItem("data-anim-prerender").value:s.getNamedItem("data-bm-prerender")?s.getNamedItem("data-bm-prerender").value:s.getNamedItem("bm-prerender")?s.getNamedItem("bm-prerender").value:"";o==="false"&&(i.prerender=!1),i.path?this.setParams(i):this.trigger("destroy")},AnimationItem.prototype.includeLayers=function(n){n.op>this.animationData.op&&(this.animationData.op=n.op,this.totalFrames=Math.floor(n.op-this.animationData.ip));var e=this.animationData.layers,i,s=e.length,r=n.layers,a,o=r.length;for(a=0;a<o;a+=1)for(i=0;i<s;){if(e[i].id===r[a].id){e[i]=r[a];break}i+=1}if((n.chars||n.fonts)&&(this.renderer.globalData.fontManager.addChars(n.chars),this.renderer.globalData.fontManager.addFonts(n.fonts,this.renderer.globalData.defs)),n.assets)for(s=n.assets.length,i=0;i<s;i+=1)this.animationData.assets.push(n.assets[i]);this.animationData.__complete=!1,dataManager.completeAnimation(this.animationData,this.onSegmentComplete)},AnimationItem.prototype.onSegmentComplete=function(n){this.animationData=n;var e=getExpressionsPlugin();e&&e.initExpressions(this),this.loadNextSegment()},AnimationItem.prototype.loadNextSegment=function(){var n=this.animationData.segments;if(!n||n.length===0||!this.autoloadSegments){this.trigger("data_ready"),this.timeCompleted=this.totalFrames;return}var e=n.shift();this.timeCompleted=e.time*this.frameRate;var i=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,dataManager.loadData(i,this.includeLayers.bind(this),(function(){this.trigger("data_failed")}).bind(this))},AnimationItem.prototype.loadSegments=function(){var n=this.animationData.segments;n||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},AnimationItem.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},AnimationItem.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},AnimationItem.prototype.configAnimation=function(n){if(this.renderer)try{this.animationData=n,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(n),n.assets||(n.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(n.assets),this.markers=markerParser(n.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(e){this.triggerConfigError(e)}},AnimationItem.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},AnimationItem.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||this.renderer.rendererType!=="canvas")&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var n=getExpressionsPlugin();n&&n.initExpressions(this),this.renderer.initItems(),setTimeout((function(){this.trigger("DOMLoaded")}).bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},AnimationItem.prototype.resize=function(n,e){var i=typeof n=="number"?n:void 0,s=typeof e=="number"?e:void 0;this.renderer.updateContainerSize(i,s)},AnimationItem.prototype.setSubframe=function(n){this.isSubframeEnabled=!!n},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(n){this.triggerRenderFrameError(n)}},AnimationItem.prototype.play=function(n){n&&this.name!==n||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(n){n&&this.name!==n||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(n){n&&this.name!==n||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(n){n&&this.name!==n||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(n){for(var e,i=0;i<this.markers.length;i+=1)if(e=this.markers[i],e.payload&&e.payload.name===n)return e;return null},AnimationItem.prototype.goToAndStop=function(n,e,i){if(!(i&&this.name!==i)){var s=Number(n);if(isNaN(s)){var r=this.getMarkerData(n);r&&this.goToAndStop(r.time,!0)}else e?this.setCurrentRawFrameValue(n):this.setCurrentRawFrameValue(n*this.frameModifier);this.pause()}},AnimationItem.prototype.goToAndPlay=function(n,e,i){if(!(i&&this.name!==i)){var s=Number(n);if(isNaN(s)){var r=this.getMarkerData(n);r&&(r.duration?this.playSegments([r.time,r.time+r.duration],!0):this.goToAndStop(r.time,!0))}else this.goToAndStop(s,e,i);this.play()}},AnimationItem.prototype.advanceTime=function(n){if(!(this.isPaused===!0||this.isLoaded===!1)){var e=this.currentRawFrame+n*this.frameModifier,i=!1;e>=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(i=!0,e=this.totalFrames-1):e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(i=!0,e=0)):this.setCurrentRawFrameValue(e),i&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(n,e){this.playCount=0,n[1]<n[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=n[0]-n[1],this.timeCompleted=this.totalFrames,this.firstFrame=n[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):n[1]>n[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=n[1]-n[0],this.timeCompleted=this.totalFrames,this.firstFrame=n[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(n,e){var i=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<n?i=n:this.currentRawFrame+this.firstFrame>e&&(i=e-n)),this.firstFrame=n,this.totalFrames=e-n,this.timeCompleted=this.totalFrames,i!==-1&&this.goToAndStop(i,!0)},AnimationItem.prototype.playSegments=function(n,e){if(e&&(this.segments.length=0),_typeof$4(n[0])==="object"){var i,s=n.length;for(i=0;i<s;i+=1)this.segments.push(n[i])}else this.segments.push(n);this.segments.length&&e&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},AnimationItem.prototype.resetSegments=function(n){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),n&&this.checkSegments(0)},AnimationItem.prototype.checkSegments=function(n){return this.segments.length?(this.adjustSegment(this.segments.shift(),n),!0):!1},AnimationItem.prototype.destroy=function(n){n&&this.name!==n||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},AnimationItem.prototype.setCurrentRawFrameValue=function(n){this.currentRawFrame=n,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(n){this.playSpeed=n,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(n){this.playDirection=n<0?-1:1,this.updaFrameModifier()},AnimationItem.prototype.setLoop=function(n){this.loop=n},AnimationItem.prototype.setVolume=function(n,e){e&&this.name!==e||this.audioController.setVolume(n)},AnimationItem.prototype.getVolume=function(){return this.audioController.getVolume()},AnimationItem.prototype.mute=function(n){n&&this.name!==n||this.audioController.mute()},AnimationItem.prototype.unmute=function(n){n&&this.name!==n||this.audioController.unmute()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(n){var e="";if(n.e)e=n.p;else if(this.assetsPath){var i=n.p;i.indexOf("images/")!==-1&&(i=i.split("/")[1]),e=this.assetsPath+i}else e=this.path,e+=n.u?n.u:"",e+=n.p;return e},AnimationItem.prototype.getAssetData=function(n){for(var e=0,i=this.assets.length;e<i;){if(n===this.assets[e].id)return this.assets[e];e+=1}return null},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getDuration=function(n){return n?this.totalFrames:this.totalFrames/this.frameRate},AnimationItem.prototype.updateDocumentData=function(n,e,i){try{var s=this.renderer.getElementByPath(n);s.updateDocumentData(e,i)}catch{}},AnimationItem.prototype.trigger=function(n){if(this._cbs&&this._cbs[n])switch(n){case"enterFrame":this.triggerEvent(n,new BMEnterFrameEvent(n,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(n,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(n,new BMCompleteLoopEvent(n,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(n,new BMCompleteEvent(n,this.frameMult));break;case"segmentStart":this.triggerEvent(n,new BMSegmentStartEvent(n,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(n,new BMDestroyEvent(n,this));break;default:this.triggerEvent(n)}n==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(n,this.currentFrame,this.totalFrames,this.frameMult)),n==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(n,this.loop,this.playCount,this.frameMult)),n==="complete"&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(n,this.frameMult)),n==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(n,this.firstFrame,this.totalFrames)),n==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(n,this))},AnimationItem.prototype.triggerRenderFrameError=function(n){var e=new BMRenderFrameErrorEvent(n,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)},AnimationItem.prototype.triggerConfigError=function(n){var e=new BMConfigErrorEvent(n,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)};var animationManager=function(){var n={},e=[],i=0,s=0,r=0,a=!0,o=!1;function l(_){for(var I=0,V=_.target;I<s;)e[I].animation===V&&(e.splice(I,1),I-=1,s-=1,V.isPaused||p()),I+=1}function u(_,I){if(!_)return null;for(var V=0;V<s;){if(e[V].elem===_&&e[V].elem!==null)return e[V].animation;V+=1}var B=new AnimationItem;return d(B,_),B.setData(_,I),B}function c(){var _,I=e.length,V=[];for(_=0;_<I;_+=1)V.push(e[_].animation);return V}function f(){r+=1,G()}function p(){r-=1}function d(_,I){_.addEventListener("destroy",l),_.addEventListener("_active",f),_.addEventListener("_idle",p),e.push({elem:I,animation:_}),s+=1}function m(_){var I=new AnimationItem;return d(I,null),I.setParams(_),I}function P(_,I){var V;for(V=0;V<s;V+=1)e[V].animation.setSpeed(_,I)}function T(_,I){var V;for(V=0;V<s;V+=1)e[V].animation.setDirection(_,I)}function x(_){var I;for(I=0;I<s;I+=1)e[I].animation.play(_)}function y(_){var I=_-i,V;for(V=0;V<s;V+=1)e[V].animation.advanceTime(I);i=_,r&&!o?window.requestAnimationFrame(y):a=!0}function C(_){i=_,window.requestAnimationFrame(y)}function g(_){var I;for(I=0;I<s;I+=1)e[I].animation.pause(_)}function S(_,I,V){var B;for(B=0;B<s;B+=1)e[B].animation.goToAndStop(_,I,V)}function E(_){var I;for(I=0;I<s;I+=1)e[I].animation.stop(_)}function A(_){var I;for(I=0;I<s;I+=1)e[I].animation.togglePause(_)}function M(_){var I;for(I=s-1;I>=0;I-=1)e[I].animation.destroy(_)}function b(_,I,V){var B=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),k,R=B.length;for(k=0;k<R;k+=1)V&&B[k].setAttribute("data-bm-type",V),u(B[k],_);if(I&&R===0){V||(V="svg");var N=document.getElementsByTagName("body")[0];N.innerText="";var H=createTag("div");H.style.width="100%",H.style.height="100%",H.setAttribute("data-bm-type",V),N.appendChild(H),u(H,_)}}function F(){var _;for(_=0;_<s;_+=1)e[_].animation.resize()}function G(){!o&&r&&a&&(window.requestAnimationFrame(C),a=!1)}function L(){o=!0}function D(){o=!1,G()}function U(_,I){var V;for(V=0;V<s;V+=1)e[V].animation.setVolume(_,I)}function z(_){var I;for(I=0;I<s;I+=1)e[I].animation.mute(_)}function O(_){var I;for(I=0;I<s;I+=1)e[I].animation.unmute(_)}return n.registerAnimation=u,n.loadAnimation=m,n.setSpeed=P,n.setDirection=T,n.play=x,n.pause=g,n.stop=E,n.togglePause=A,n.searchAnimations=b,n.resize=F,n.goToAndStop=S,n.destroy=M,n.freeze=L,n.unfreeze=D,n.setVolume=U,n.mute=z,n.unmute=O,n.getRegisteredAnimations=c,n}(),BezierFactory=function(){var n={};n.getBezierEasing=i;var e={};function i(C,g,S,E,A){var M=A||("bez_"+C+"_"+g+"_"+S+"_"+E).replace(/\./g,"p");if(e[M])return e[M];var b=new y([C,g,S,E]);return e[M]=b,b}var s=4,r=.001,a=1e-7,o=10,l=11,u=1/(l-1),c=typeof Float32Array=="function";function f(C,g){return 1-3*g+3*C}function p(C,g){return 3*g-6*C}function d(C){return 3*C}function m(C,g,S){return((f(g,S)*C+p(g,S))*C+d(g))*C}function P(C,g,S){return 3*f(g,S)*C*C+2*p(g,S)*C+d(g)}function T(C,g,S,E,A){var M,b,F=0;do b=g+(S-g)/2,M=m(b,E,A)-C,M>0?S=b:g=b;while(Math.abs(M)>a&&++F<o);return b}function x(C,g,S,E){for(var A=0;A<s;++A){var M=P(g,S,E);if(M===0)return g;var b=m(g,S,E)-C;g-=b/M}return g}function y(C){this._p=C,this._mSampleValues=c?new Float32Array(l):new Array(l),this._precomputed=!1,this.get=this.get.bind(this)}return y.prototype={get:function(g){var S=this._p[0],E=this._p[1],A=this._p[2],M=this._p[3];return this._precomputed||this._precompute(),S===E&&A===M?g:g===0?0:g===1?1:m(this._getTForX(g),E,M)},_precompute:function(){var g=this._p[0],S=this._p[1],E=this._p[2],A=this._p[3];this._precomputed=!0,(g!==S||E!==A)&&this._calcSampleValues()},_calcSampleValues:function(){for(var g=this._p[0],S=this._p[2],E=0;E<l;++E)this._mSampleValues[E]=m(E*u,g,S)},_getTForX:function(g){for(var S=this._p[0],E=this._p[2],A=this._mSampleValues,M=0,b=1,F=l-1;b!==F&&A[b]<=g;++b)M+=u;--b;var G=(g-A[b])/(A[b+1]-A[b]),L=M+G*u,D=P(L,S,E);return D>=r?x(g,L,S,E):D===0?L:T(g,M,M+u,S,E)}},n}(),pooling=function(){function n(e){return e.concat(createSizedArray(e.length))}return{double:n}}(),poolFactory=function(){return function(n,e,i){var s=0,r=n,a=createSizedArray(r),o={newElement:l,release:u};function l(){var c;return s?(s-=1,c=a[s]):c=e(),c}function u(c){s===r&&(a=pooling.double(a),r*=2),i&&i(c),a[s]=c,s+=1}return o}}(),bezierLengthPool=function(){function n(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,n)}(),segmentsLengthPool=function(){function n(){return{lengths:[],totalLength:0}}function e(i){var s,r=i.lengths.length;for(s=0;s<r;s+=1)bezierLengthPool.release(i.lengths[s]);i.lengths.length=0}return poolFactory(8,n,e)}();function bezFunction(){var n=Math;function e(d,m,P,T,x,y){var C=d*T+m*x+P*y-x*T-y*d-P*m;return C>-.001&&C<.001}function i(d,m,P,T,x,y,C,g,S){if(P===0&&y===0&&S===0)return e(d,m,T,x,C,g);var E=n.sqrt(n.pow(T-d,2)+n.pow(x-m,2)+n.pow(y-P,2)),A=n.sqrt(n.pow(C-d,2)+n.pow(g-m,2)+n.pow(S-P,2)),M=n.sqrt(n.pow(C-T,2)+n.pow(g-x,2)+n.pow(S-y,2)),b;return E>A?E>M?b=E-A-M:b=M-A-E:M>A?b=M-A-E:b=A-E-M,b>-1e-4&&b<1e-4}var s=function(){return function(d,m,P,T){var x=getDefaultCurveSegments(),y,C,g,S,E,A=0,M,b=[],F=[],G=bezierLengthPool.newElement();for(g=P.length,y=0;y<x;y+=1){for(E=y/(x-1),M=0,C=0;C<g;C+=1)S=bmPow(1-E,3)*d[C]+3*bmPow(1-E,2)*E*P[C]+3*(1-E)*bmPow(E,2)*T[C]+bmPow(E,3)*m[C],b[C]=S,F[C]!==null&&(M+=bmPow(b[C]-F[C],2)),F[C]=b[C];M&&(M=bmSqrt(M),A+=M),G.percents[y]=E,G.lengths[y]=A}return G.addedLength=A,G}}();function r(d){var m=segmentsLengthPool.newElement(),P=d.c,T=d.v,x=d.o,y=d.i,C,g=d._length,S=m.lengths,E=0;for(C=0;C<g-1;C+=1)S[C]=s(T[C],T[C+1],x[C],y[C+1]),E+=S[C].addedLength;return P&&g&&(S[C]=s(T[C],T[0],x[C],y[0]),E+=S[C].addedLength),m.totalLength=E,m}function a(d){this.segmentLength=0,this.points=new Array(d)}function o(d,m){this.partialLength=d,this.point=m}var l=function(){var d={};return function(m,P,T,x){var y=(m[0]+"_"+m[1]+"_"+P[0]+"_"+P[1]+"_"+T[0]+"_"+T[1]+"_"+x[0]+"_"+x[1]).replace(/\./g,"p");if(!d[y]){var C=getDefaultCurveSegments(),g,S,E,A,M,b=0,F,G,L=null;m.length===2&&(m[0]!==P[0]||m[1]!==P[1])&&e(m[0],m[1],P[0],P[1],m[0]+T[0],m[1]+T[1])&&e(m[0],m[1],P[0],P[1],P[0]+x[0],P[1]+x[1])&&(C=2);var D=new a(C);for(E=T.length,g=0;g<C;g+=1){for(G=createSizedArray(E),M=g/(C-1),F=0,S=0;S<E;S+=1)A=bmPow(1-M,3)*m[S]+3*bmPow(1-M,2)*M*(m[S]+T[S])+3*(1-M)*bmPow(M,2)*(P[S]+x[S])+bmPow(M,3)*P[S],G[S]=A,L!==null&&(F+=bmPow(G[S]-L[S],2));F=bmSqrt(F),b+=F,D.points[g]=new o(F,G),L=G}D.segmentLength=b,d[y]=D}return d[y]}}();function u(d,m){var P=m.percents,T=m.lengths,x=P.length,y=bmFloor((x-1)*d),C=d*m.addedLength,g=0;if(y===x-1||y===0||C===T[y])return P[y];for(var S=T[y]>C?-1:1,E=!0;E;)if(T[y]<=C&&T[y+1]>C?(g=(C-T[y])/(T[y+1]-T[y]),E=!1):y+=S,y<0||y>=x-1){if(y===x-1)return P[y];E=!1}return P[y]+(P[y+1]-P[y])*g}function c(d,m,P,T,x,y){var C=u(x,y),g=1-C,S=n.round((g*g*g*d[0]+(C*g*g+g*C*g+g*g*C)*P[0]+(C*C*g+g*C*C+C*g*C)*T[0]+C*C*C*m[0])*1e3)/1e3,E=n.round((g*g*g*d[1]+(C*g*g+g*C*g+g*g*C)*P[1]+(C*C*g+g*C*C+C*g*C)*T[1]+C*C*C*m[1])*1e3)/1e3;return[S,E]}var f=createTypedArray("float32",8);function p(d,m,P,T,x,y,C){x<0?x=0:x>1&&(x=1);var g=u(x,C);y=y>1?1:y;var S=u(y,C),E,A=d.length,M=1-g,b=1-S,F=M*M*M,G=g*M*M*3,L=g*g*M*3,D=g*g*g,U=M*M*b,z=g*M*b+M*g*b+M*M*S,O=g*g*b+M*g*S+g*M*S,_=g*g*S,I=M*b*b,V=g*b*b+M*S*b+M*b*S,B=g*S*b+M*S*S+g*b*S,k=g*S*S,R=b*b*b,N=S*b*b+b*S*b+b*b*S,H=S*S*b+b*S*S+S*b*S,J=S*S*S;for(E=0;E<A;E+=1)f[E*4]=n.round((F*d[E]+G*P[E]+L*T[E]+D*m[E])*1e3)/1e3,f[E*4+1]=n.round((U*d[E]+z*P[E]+O*T[E]+_*m[E])*1e3)/1e3,f[E*4+2]=n.round((I*d[E]+V*P[E]+B*T[E]+k*m[E])*1e3)/1e3,f[E*4+3]=n.round((R*d[E]+N*P[E]+H*T[E]+J*m[E])*1e3)/1e3;return f}return{getSegmentsLength:r,getNewSegment:p,getPointInSegment:c,buildBezierData:l,pointOnLine2D:e,pointOnLine3D:i}}var bez=bezFunction(),initFrame=initialDefaultFrame,mathAbs=Math.abs;function interpolateValue(n,e){var i=this.offsetTime,s;this.propType==="multidimensional"&&(s=createTypedArray("float32",this.pv.length));for(var r=e.lastIndex,a=r,o=this.keyframes.length-1,l=!0,u,c,f;l;){if(u=this.keyframes[a],c=this.keyframes[a+1],a===o-1&&n>=c.t-i){u.h&&(u=c),r=0;break}if(c.t-i>n){r=a;break}a<o-1?a+=1:(r=0,l=!1)}f=this.keyframesMetadata[a]||{};var p,d,m,P,T,x,y=c.t-i,C=u.t-i,g;if(u.to){f.bezierData||(f.bezierData=bez.buildBezierData(u.s,c.s||u.e,u.to,u.ti));var S=f.bezierData;if(n>=y||n<C){var E=n>=y?S.points.length-1:0;for(d=S.points[E].point.length,p=0;p<d;p+=1)s[p]=S.points[E].point[p]}else{f.__fnct?x=f.__fnct:(x=BezierFactory.getBezierEasing(u.o.x,u.o.y,u.i.x,u.i.y,u.n).get,f.__fnct=x),m=x((n-C)/(y-C));var A=S.segmentLength*m,M,b=e.lastFrame<n&&e._lastKeyframeIndex===a?e._lastAddedLength:0;for(T=e.lastFrame<n&&e._lastKeyframeIndex===a?e._lastPoint:0,l=!0,P=S.points.length;l;){if(b+=S.points[T].partialLength,A===0||m===0||T===S.points.length-1){for(d=S.points[T].point.length,p=0;p<d;p+=1)s[p]=S.points[T].point[p];break}else if(A>=b&&A<b+S.points[T+1].partialLength){for(M=(A-b)/S.points[T+1].partialLength,d=S.points[T].point.length,p=0;p<d;p+=1)s[p]=S.points[T].point[p]+(S.points[T+1].point[p]-S.points[T].point[p])*M;break}T<P-1?T+=1:l=!1}e._lastPoint=T,e._lastAddedLength=b-S.points[T].partialLength,e._lastKeyframeIndex=a}}else{var F,G,L,D,U;if(o=u.s.length,g=c.s||u.e,this.sh&&u.h!==1)if(n>=y)s[0]=g[0],s[1]=g[1],s[2]=g[2];else if(n<=C)s[0]=u.s[0],s[1]=u.s[1],s[2]=u.s[2];else{var z=createQuaternion(u.s),O=createQuaternion(g),_=(n-C)/(y-C);quaternionToEuler(s,slerp(z,O,_))}else for(a=0;a<o;a+=1)u.h!==1&&(n>=y?m=1:n<C?m=0:(u.o.x.constructor===Array?(f.__fnct||(f.__fnct=[]),f.__fnct[a]?x=f.__fnct[a]:(F=u.o.x[a]===void 0?u.o.x[0]:u.o.x[a],G=u.o.y[a]===void 0?u.o.y[0]:u.o.y[a],L=u.i.x[a]===void 0?u.i.x[0]:u.i.x[a],D=u.i.y[a]===void 0?u.i.y[0]:u.i.y[a],x=BezierFactory.getBezierEasing(F,G,L,D).get,f.__fnct[a]=x)):f.__fnct?x=f.__fnct:(F=u.o.x,G=u.o.y,L=u.i.x,D=u.i.y,x=BezierFactory.getBezierEasing(F,G,L,D).get,u.keyframeMetadata=x),m=x((n-C)/(y-C)))),g=c.s||u.e,U=u.h===1?u.s[a]:u.s[a]+(g[a]-u.s[a])*m,this.propType==="multidimensional"?s[a]=U:s=U}return e.lastIndex=r,s}function slerp(n,e,i){var s=[],r=n[0],a=n[1],o=n[2],l=n[3],u=e[0],c=e[1],f=e[2],p=e[3],d,m,P,T,x;return m=r*u+a*c+o*f+l*p,m<0&&(m=-m,u=-u,c=-c,f=-f,p=-p),1-m>1e-6?(d=Math.acos(m),P=Math.sin(d),T=Math.sin((1-i)*d)/P,x=Math.sin(i*d)/P):(T=1-i,x=i),s[0]=T*r+x*u,s[1]=T*a+x*c,s[2]=T*o+x*f,s[3]=T*l+x*p,s}function quaternionToEuler(n,e){var i=e[0],s=e[1],r=e[2],a=e[3],o=Math.atan2(2*s*a-2*i*r,1-2*s*s-2*r*r),l=Math.asin(2*i*s+2*r*a),u=Math.atan2(2*i*a-2*s*r,1-2*i*i-2*r*r);n[0]=o/degToRads,n[1]=l/degToRads,n[2]=u/degToRads}function createQuaternion(n){var e=n[0]*degToRads,i=n[1]*degToRads,s=n[2]*degToRads,r=Math.cos(e/2),a=Math.cos(i/2),o=Math.cos(s/2),l=Math.sin(e/2),u=Math.sin(i/2),c=Math.sin(s/2),f=r*a*o-l*u*c,p=l*u*o+r*a*c,d=l*a*o+r*u*c,m=r*u*o-l*a*c;return[p,d,m,f]}function getValueAtCurrentTime(){var n=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,i=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(n===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=i&&n>=i||this._caching.lastFrame<e&&n<e))){this._caching.lastFrame>=n&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var s=this.interpolateValue(n,this._caching);this.pv=s}return this._caching.lastFrame=n,this.pv}function setVValue(n){var e;if(this.propType==="unidimensional")e=n*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var i=0,s=this.v.length;i<s;)e=n[i]*this.mult,mathAbs(this.v[i]-e)>1e-5&&(this.v[i]=e,this._mdf=!0),i+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var n,e=this.effectsSequence.length,i=this.kf?this.pv:this.data.k;for(n=0;n<e;n+=1)i=this.effectsSequence[n](i);this.setVValue(i),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function addEffect(n){this.effectsSequence.push(n),this.container.addDynamicProperty(this)}function ValueProperty(n,e,i,s){this.propType="unidimensional",this.mult=i||1,this.data=e,this.v=i?e.k*i:e.k,this.pv=e.k,this._mdf=!1,this.elem=n,this.container=s,this.comp=n.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function MultiDimensionalProperty(n,e,i,s){this.propType="multidimensional",this.mult=i||1,this.data=e,this._mdf=!1,this.elem=n,this.container=s,this.comp=n.comp,this.k=!1,this.kf=!1,this.frameId=-1;var r,a=e.k.length;for(this.v=createTypedArray("float32",a),this.pv=createTypedArray("float32",a),this.vel=createTypedArray("float32",a),r=0;r<a;r+=1)this.v[r]=e.k[r]*this.mult,this.pv[r]=e.k[r];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function KeyframedValueProperty(n,e,i,s){this.propType="unidimensional",this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=n.data.st,this.frameId=-1,this._caching={lastFrame:initFrame,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=e,this.mult=i||1,this.elem=n,this.container=s,this.comp=n.comp,this.v=initFrame,this.pv=initFrame,this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.addEffect=addEffect}function KeyframedMultidimensionalProperty(n,e,i,s){this.propType="multidimensional";var r,a=e.k.length,o,l,u,c;for(r=0;r<a-1;r+=1)e.k[r].to&&e.k[r].s&&e.k[r+1]&&e.k[r+1].s&&(o=e.k[r].s,l=e.k[r+1].s,u=e.k[r].to,c=e.k[r].ti,(o.length===2&&!(o[0]===l[0]&&o[1]===l[1])&&bez.pointOnLine2D(o[0],o[1],l[0],l[1],o[0]+u[0],o[1]+u[1])&&bez.pointOnLine2D(o[0],o[1],l[0],l[1],l[0]+c[0],l[1]+c[1])||o.length===3&&!(o[0]===l[0]&&o[1]===l[1]&&o[2]===l[2])&&bez.pointOnLine3D(o[0],o[1],o[2],l[0],l[1],l[2],o[0]+u[0],o[1]+u[1],o[2]+u[2])&&bez.pointOnLine3D(o[0],o[1],o[2],l[0],l[1],l[2],l[0]+c[0],l[1]+c[1],l[2]+c[2]))&&(e.k[r].to=null,e.k[r].ti=null),o[0]===l[0]&&o[1]===l[1]&&u[0]===0&&u[1]===0&&c[0]===0&&c[1]===0&&(o.length===2||o[2]===l[2]&&u[2]===0&&c[2]===0)&&(e.k[r].to=null,e.k[r].ti=null));this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.data=e,this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=n.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=i||1,this.elem=n,this.container=s,this.comp=n.comp,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.frameId=-1;var f=e.k[0].s.length;for(this.v=createTypedArray("float32",f),this.pv=createTypedArray("float32",f),r=0;r<f;r+=1)this.v[r]=initFrame,this.pv[r]=initFrame;this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray("float32",f)},this.addEffect=addEffect}var PropertyFactory=function(){function n(i,s,r,a,o){s.sid&&(s=i.globalData.slotManager.getProp(s));var l;if(!s.k.length)l=new ValueProperty(i,s,a,o);else if(typeof s.k[0]=="number")l=new MultiDimensionalProperty(i,s,a,o);else switch(r){case 0:l=new KeyframedValueProperty(i,s,a,o);break;case 1:l=new KeyframedMultidimensionalProperty(i,s,a,o);break}return l.effectsSequence.length&&o.addDynamicProperty(l),l}var e={getProp:n};return e}();function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype={addDynamicProperty:function(e){this.dynamicProperties.indexOf(e)===-1&&(this.dynamicProperties.push(e),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var e,i=this.dynamicProperties.length;for(e=0;e<i;e+=1)this.dynamicProperties[e].getValue(),this.dynamicProperties[e]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(e){this.container=e,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var pointPool=function(){function n(){return createTypedArray("float32",2)}return poolFactory(8,n)}();function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(n,e){this.c=n,this.setLength(e);for(var i=0;i<e;)this.v[i]=pointPool.newElement(),this.o[i]=pointPool.newElement(),this.i[i]=pointPool.newElement(),i+=1},ShapePath.prototype.setLength=function(n){for(;this._maxLength<n;)this.doubleArrayLength();this._length=n},ShapePath.prototype.doubleArrayLength=function(){this.v=this.v.concat(createSizedArray(this._maxLength)),this.i=this.i.concat(createSizedArray(this._maxLength)),this.o=this.o.concat(createSizedArray(this._maxLength)),this._maxLength*=2},ShapePath.prototype.setXYAt=function(n,e,i,s,r){var a;switch(this._length=Math.max(this._length,s+1),this._length>=this._maxLength&&this.doubleArrayLength(),i){case"v":a=this.v;break;case"i":a=this.i;break;case"o":a=this.o;break;default:a=[];break}(!a[s]||a[s]&&!r)&&(a[s]=pointPool.newElement()),a[s][0]=n,a[s][1]=e},ShapePath.prototype.setTripleAt=function(n,e,i,s,r,a,o,l){this.setXYAt(n,e,"v",o,l),this.setXYAt(i,s,"o",o,l),this.setXYAt(r,a,"i",o,l)},ShapePath.prototype.reverse=function(){var n=new ShapePath;n.setPathData(this.c,this._length);var e=this.v,i=this.o,s=this.i,r=0;this.c&&(n.setTripleAt(e[0][0],e[0][1],s[0][0],s[0][1],i[0][0],i[0][1],0,!1),r=1);var a=this._length-1,o=this._length,l;for(l=r;l<o;l+=1)n.setTripleAt(e[a][0],e[a][1],s[a][0],s[a][1],i[a][0],i[a][1],l,!1),a-=1;return n},ShapePath.prototype.length=function(){return this._length};var shapePool=function(){function n(){return new ShapePath}function e(r){var a=r._length,o;for(o=0;o<a;o+=1)pointPool.release(r.v[o]),pointPool.release(r.i[o]),pointPool.release(r.o[o]),r.v[o]=null,r.i[o]=null,r.o[o]=null;r._length=0,r.c=!1}function i(r){var a=s.newElement(),o,l=r._length===void 0?r.v.length:r._length;for(a.setLength(l),a.c=r.c,o=0;o<l;o+=1)a.setTripleAt(r.v[o][0],r.v[o][1],r.o[o][0],r.o[o][1],r.i[o][0],r.i[o][1],o);return a}var s=poolFactory(4,n,e);return s.clone=i,s}();function ShapeCollection(){this._length=0,this._maxLength=4,this.shapes=createSizedArray(this._maxLength)}ShapeCollection.prototype.addShape=function(n){this._length===this._maxLength&&(this.shapes=this.shapes.concat(createSizedArray(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=n,this._length+=1},ShapeCollection.prototype.releaseShapes=function(){var n;for(n=0;n<this._length;n+=1)shapePool.release(this.shapes[n]);this._length=0};var shapeCollectionPool=function(){var n={newShapeCollection:r,release:a},e=0,i=4,s=createSizedArray(i);function r(){var o;return e?(e-=1,o=s[e]):o=new ShapeCollection,o}function a(o){var l,u=o._length;for(l=0;l<u;l+=1)shapePool.release(o.shapes[l]);o._length=0,e===i&&(s=pooling.double(s),i*=2),s[e]=o,e+=1}return n}(),ShapePropertyFactory=function(){var n=-999999;function e(y,C,g){var S=g.lastIndex,E,A,M,b,F,G,L,D,U,z=this.keyframes;if(y<z[0].t-this.offsetTime)E=z[0].s[0],M=!0,S=0;else if(y>=z[z.length-1].t-this.offsetTime)E=z[z.length-1].s?z[z.length-1].s[0]:z[z.length-2].e[0],M=!0;else{for(var O=S,_=z.length-1,I=!0,V,B,k;I&&(V=z[O],B=z[O+1],!(B.t-this.offsetTime>y));)O<_-1?O+=1:I=!1;if(k=this.keyframesMetadata[O]||{},M=V.h===1,S=O,!M){if(y>=B.t-this.offsetTime)D=1;else if(y<V.t-this.offsetTime)D=0;else{var R;k.__fnct?R=k.__fnct:(R=BezierFactory.getBezierEasing(V.o.x,V.o.y,V.i.x,V.i.y).get,k.__fnct=R),D=R((y-(V.t-this.offsetTime))/(B.t-this.offsetTime-(V.t-this.offsetTime)))}A=B.s?B.s[0]:V.e[0]}E=V.s[0]}for(G=C._length,L=E.i[0].length,g.lastIndex=S,b=0;b<G;b+=1)for(F=0;F<L;F+=1)U=M?E.i[b][F]:E.i[b][F]+(A.i[b][F]-E.i[b][F])*D,C.i[b][F]=U,U=M?E.o[b][F]:E.o[b][F]+(A.o[b][F]-E.o[b][F])*D,C.o[b][F]=U,U=M?E.v[b][F]:E.v[b][F]+(A.v[b][F]-E.v[b][F])*D,C.v[b][F]=U}function i(){var y=this.comp.renderedFrame-this.offsetTime,C=this.keyframes[0].t-this.offsetTime,g=this.keyframes[this.keyframes.length-1].t-this.offsetTime,S=this._caching.lastFrame;return S!==n&&(S<C&&y<C||S>g&&y>g)||(this._caching.lastIndex=S<y?this._caching.lastIndex:0,this.interpolateShape(y,this.pv,this._caching)),this._caching.lastFrame=y,this.pv}function s(){this.paths=this.localShapeCollection}function r(y,C){if(y._length!==C._length||y.c!==C.c)return!1;var g,S=y._length;for(g=0;g<S;g+=1)if(y.v[g][0]!==C.v[g][0]||y.v[g][1]!==C.v[g][1]||y.o[g][0]!==C.o[g][0]||y.o[g][1]!==C.o[g][1]||y.i[g][0]!==C.i[g][0]||y.i[g][1]!==C.i[g][1])return!1;return!0}function a(y){r(this.v,y)||(this.v=shapePool.clone(y),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function o(){if(this.elem.globalData.frameId!==this.frameId){if(!this.effectsSequence.length){this._mdf=!1;return}if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=!1;var y;this.kf?y=this.pv:this.data.ks?y=this.data.ks.k:y=this.data.pt.k;var C,g=this.effectsSequence.length;for(C=0;C<g;C+=1)y=this.effectsSequence[C](y);this.setVValue(y),this.lock=!1,this.frameId=this.elem.globalData.frameId}}function l(y,C,g){this.propType="shape",this.comp=y.comp,this.container=y,this.elem=y,this.data=C,this.k=!1,this.kf=!1,this._mdf=!1;var S=g===3?C.pt.k:C.ks.k;this.v=shapePool.clone(S),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=s,this.effectsSequence=[]}function u(y){this.effectsSequence.push(y),this.container.addDynamicProperty(this)}l.prototype.interpolateShape=e,l.prototype.getValue=o,l.prototype.setVValue=a,l.prototype.addEffect=u;function c(y,C,g){this.propType="shape",this.comp=y.comp,this.elem=y,this.container=y,this.offsetTime=y.data.st,this.keyframes=g===3?C.pt.k:C.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var S=this.keyframes[0].s[0].i.length;this.v=shapePool.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,S),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=n,this.reset=s,this._caching={lastFrame:n,lastIndex:0},this.effectsSequence=[i.bind(this)]}c.prototype.getValue=o,c.prototype.interpolateShape=e,c.prototype.setVValue=a,c.prototype.addEffect=u;var f=function(){var y=roundCorner;function C(g,S){this.v=shapePool.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=S.d,this.elem=g,this.comp=g.comp,this.frameId=-1,this.initDynamicPropertyContainer(g),this.p=PropertyFactory.getProp(g,S.p,1,0,this),this.s=PropertyFactory.getProp(g,S.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return C.prototype={reset:s,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var S=this.p.v[0],E=this.p.v[1],A=this.s.v[0]/2,M=this.s.v[1]/2,b=this.d!==3,F=this.v;F.v[0][0]=S,F.v[0][1]=E-M,F.v[1][0]=b?S+A:S-A,F.v[1][1]=E,F.v[2][0]=S,F.v[2][1]=E+M,F.v[3][0]=b?S-A:S+A,F.v[3][1]=E,F.i[0][0]=b?S-A*y:S+A*y,F.i[0][1]=E-M,F.i[1][0]=b?S+A:S-A,F.i[1][1]=E-M*y,F.i[2][0]=b?S+A*y:S-A*y,F.i[2][1]=E+M,F.i[3][0]=b?S-A:S+A,F.i[3][1]=E+M*y,F.o[0][0]=b?S+A*y:S-A*y,F.o[0][1]=E-M,F.o[1][0]=b?S+A:S-A,F.o[1][1]=E+M*y,F.o[2][0]=b?S-A*y:S+A*y,F.o[2][1]=E+M,F.o[3][0]=b?S-A:S+A,F.o[3][1]=E-M*y}},extendPrototype([DynamicPropertyContainer],C),C}(),p=function(){function y(C,g){this.v=shapePool.newElement(),this.v.setPathData(!0,0),this.elem=C,this.comp=C.comp,this.data=g,this.frameId=-1,this.d=g.d,this.initDynamicPropertyContainer(C),g.sy===1?(this.ir=PropertyFactory.getProp(C,g.ir,0,0,this),this.is=PropertyFactory.getProp(C,g.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=PropertyFactory.getProp(C,g.pt,0,0,this),this.p=PropertyFactory.getProp(C,g.p,1,0,this),this.r=PropertyFactory.getProp(C,g.r,0,degToRads,this),this.or=PropertyFactory.getProp(C,g.or,0,0,this),this.os=PropertyFactory.getProp(C,g.os,0,.01,this),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return y.prototype={reset:s,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var g=Math.floor(this.pt.v)*2,S=Math.PI*2/g,E=!0,A=this.or.v,M=this.ir.v,b=this.os.v,F=this.is.v,G=2*Math.PI*A/(g*2),L=2*Math.PI*M/(g*2),D,U,z,O,_=-Math.PI/2;_+=this.r.v;var I=this.data.d===3?-1:1;for(this.v._length=0,D=0;D<g;D+=1){U=E?A:M,z=E?b:F,O=E?G:L;var V=U*Math.cos(_),B=U*Math.sin(_),k=V===0&&B===0?0:B/Math.sqrt(V*V+B*B),R=V===0&&B===0?0:-V/Math.sqrt(V*V+B*B);V+=+this.p.v[0],B+=+this.p.v[1],this.v.setTripleAt(V,B,V-k*O*z*I,B-R*O*z*I,V+k*O*z*I,B+R*O*z*I,D,!0),E=!E,_+=S*I}},convertPolygonToPath:function(){var g=Math.floor(this.pt.v),S=Math.PI*2/g,E=this.or.v,A=this.os.v,M=2*Math.PI*E/(g*4),b,F=-Math.PI*.5,G=this.data.d===3?-1:1;for(F+=this.r.v,this.v._length=0,b=0;b<g;b+=1){var L=E*Math.cos(F),D=E*Math.sin(F),U=L===0&&D===0?0:D/Math.sqrt(L*L+D*D),z=L===0&&D===0?0:-L/Math.sqrt(L*L+D*D);L+=+this.p.v[0],D+=+this.p.v[1],this.v.setTripleAt(L,D,L-U*M*A*G,D-z*M*A*G,L+U*M*A*G,D+z*M*A*G,b,!0),F+=S*G}this.paths.length=0,this.paths[0]=this.v}},extendPrototype([DynamicPropertyContainer],y),y}(),d=function(){function y(C,g){this.v=shapePool.newElement(),this.v.c=!0,this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=C,this.comp=C.comp,this.frameId=-1,this.d=g.d,this.initDynamicPropertyContainer(C),this.p=PropertyFactory.getProp(C,g.p,1,0,this),this.s=PropertyFactory.getProp(C,g.s,1,0,this),this.r=PropertyFactory.getProp(C,g.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return y.prototype={convertRectToPath:function(){var g=this.p.v[0],S=this.p.v[1],E=this.s.v[0]/2,A=this.s.v[1]/2,M=bmMin(E,A,this.r.v),b=M*(1-roundCorner);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(g+E,S-A+M,g+E,S-A+M,g+E,S-A+b,0,!0),this.v.setTripleAt(g+E,S+A-M,g+E,S+A-b,g+E,S+A-M,1,!0),M!==0?(this.v.setTripleAt(g+E-M,S+A,g+E-M,S+A,g+E-b,S+A,2,!0),this.v.setTripleAt(g-E+M,S+A,g-E+b,S+A,g-E+M,S+A,3,!0),this.v.setTripleAt(g-E,S+A-M,g-E,S+A-M,g-E,S+A-b,4,!0),this.v.setTripleAt(g-E,S-A+M,g-E,S-A+b,g-E,S-A+M,5,!0),this.v.setTripleAt(g-E+M,S-A,g-E+M,S-A,g-E+b,S-A,6,!0),this.v.setTripleAt(g+E-M,S-A,g+E-b,S-A,g+E-M,S-A,7,!0)):(this.v.setTripleAt(g-E,S+A,g-E+b,S+A,g-E,S+A,2),this.v.setTripleAt(g-E,S-A,g-E,S-A+b,g-E,S-A,3))):(this.v.setTripleAt(g+E,S-A+M,g+E,S-A+b,g+E,S-A+M,0,!0),M!==0?(this.v.setTripleAt(g+E-M,S-A,g+E-M,S-A,g+E-b,S-A,1,!0),this.v.setTripleAt(g-E+M,S-A,g-E+b,S-A,g-E+M,S-A,2,!0),this.v.setTripleAt(g-E,S-A+M,g-E,S-A+M,g-E,S-A+b,3,!0),this.v.setTripleAt(g-E,S+A-M,g-E,S+A-b,g-E,S+A-M,4,!0),this.v.setTripleAt(g-E+M,S+A,g-E+M,S+A,g-E+b,S+A,5,!0),this.v.setTripleAt(g+E-M,S+A,g+E-b,S+A,g+E-M,S+A,6,!0),this.v.setTripleAt(g+E,S+A-M,g+E,S+A-M,g+E,S+A-b,7,!0)):(this.v.setTripleAt(g-E,S-A,g-E+b,S-A,g-E,S-A,1,!0),this.v.setTripleAt(g-E,S+A,g-E,S+A-b,g-E,S+A,2,!0),this.v.setTripleAt(g+E,S+A,g+E-b,S+A,g+E,S+A,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:s},extendPrototype([DynamicPropertyContainer],y),y}();function m(y,C,g){var S;if(g===3||g===4){var E=g===3?C.pt:C.ks,A=E.k;A.length?S=new c(y,C,g):S=new l(y,C,g)}else g===5?S=new d(y,C):g===6?S=new f(y,C):g===7&&(S=new p(y,C));return S.k&&y.addDynamicProperty(S),S}function P(){return l}function T(){return c}var x={};return x.getShapeProp=m,x.getConstructorFunction=P,x.getKeyframedConstructorFunction=T,x}();/*!
141
+ Transformation Matrix v2.0
142
+ (c) Epistemex 2014-2015
143
+ www.epistemex.com
144
+ By Ken Fyrstenberg
145
+ Contributions by leeoniya.
146
+ License: MIT, header required.
147
+ */var Matrix=function(){var n=Math.cos,e=Math.sin,i=Math.tan,s=Math.round;function r(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function a(V){if(V===0)return this;var B=n(V),k=e(V);return this._t(B,-k,0,0,k,B,0,0,0,0,1,0,0,0,0,1)}function o(V){if(V===0)return this;var B=n(V),k=e(V);return this._t(1,0,0,0,0,B,-k,0,0,k,B,0,0,0,0,1)}function l(V){if(V===0)return this;var B=n(V),k=e(V);return this._t(B,0,k,0,0,1,0,0,-k,0,B,0,0,0,0,1)}function u(V){if(V===0)return this;var B=n(V),k=e(V);return this._t(B,-k,0,0,k,B,0,0,0,0,1,0,0,0,0,1)}function c(V,B){return this._t(1,B,V,1,0,0)}function f(V,B){return this.shear(i(V),i(B))}function p(V,B){var k=n(B),R=e(B);return this._t(k,R,0,0,-R,k,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,i(V),1,0,0,0,0,1,0,0,0,0,1)._t(k,-R,0,0,R,k,0,0,0,0,1,0,0,0,0,1)}function d(V,B,k){return!k&&k!==0&&(k=1),V===1&&B===1&&k===1?this:this._t(V,0,0,0,0,B,0,0,0,0,k,0,0,0,0,1)}function m(V,B,k,R,N,H,J,$,W,Z,ie,ge,ve,ce,Te,ne){return this.props[0]=V,this.props[1]=B,this.props[2]=k,this.props[3]=R,this.props[4]=N,this.props[5]=H,this.props[6]=J,this.props[7]=$,this.props[8]=W,this.props[9]=Z,this.props[10]=ie,this.props[11]=ge,this.props[12]=ve,this.props[13]=ce,this.props[14]=Te,this.props[15]=ne,this}function P(V,B,k){return k=k||0,V!==0||B!==0||k!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,V,B,k,1):this}function T(V,B,k,R,N,H,J,$,W,Z,ie,ge,ve,ce,Te,ne){var K=this.props;if(V===1&&B===0&&k===0&&R===0&&N===0&&H===1&&J===0&&$===0&&W===0&&Z===0&&ie===1&&ge===0)return K[12]=K[12]*V+K[15]*ve,K[13]=K[13]*H+K[15]*ce,K[14]=K[14]*ie+K[15]*Te,K[15]*=ne,this._identityCalculated=!1,this;var he=K[0],ee=K[1],Q=K[2],te=K[3],ye=K[4],le=K[5],fe=K[6],Se=K[7],de=K[8],Ve=K[9],Pe=K[10],oe=K[11],Me=K[12],Le=K[13],Ie=K[14],ke=K[15];return K[0]=he*V+ee*N+Q*W+te*ve,K[1]=he*B+ee*H+Q*Z+te*ce,K[2]=he*k+ee*J+Q*ie+te*Te,K[3]=he*R+ee*$+Q*ge+te*ne,K[4]=ye*V+le*N+fe*W+Se*ve,K[5]=ye*B+le*H+fe*Z+Se*ce,K[6]=ye*k+le*J+fe*ie+Se*Te,K[7]=ye*R+le*$+fe*ge+Se*ne,K[8]=de*V+Ve*N+Pe*W+oe*ve,K[9]=de*B+Ve*H+Pe*Z+oe*ce,K[10]=de*k+Ve*J+Pe*ie+oe*Te,K[11]=de*R+Ve*$+Pe*ge+oe*ne,K[12]=Me*V+Le*N+Ie*W+ke*ve,K[13]=Me*B+Le*H+Ie*Z+ke*ce,K[14]=Me*k+Le*J+Ie*ie+ke*Te,K[15]=Me*R+Le*$+Ie*ge+ke*ne,this._identityCalculated=!1,this}function x(V){var B=V.props;return this.transform(B[0],B[1],B[2],B[3],B[4],B[5],B[6],B[7],B[8],B[9],B[10],B[11],B[12],B[13],B[14],B[15])}function y(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function C(V){for(var B=0;B<16;){if(V.props[B]!==this.props[B])return!1;B+=1}return!0}function g(V){var B;for(B=0;B<16;B+=1)V.props[B]=this.props[B];return V}function S(V){var B;for(B=0;B<16;B+=1)this.props[B]=V[B]}function E(V,B,k){return{x:V*this.props[0]+B*this.props[4]+k*this.props[8]+this.props[12],y:V*this.props[1]+B*this.props[5]+k*this.props[9]+this.props[13],z:V*this.props[2]+B*this.props[6]+k*this.props[10]+this.props[14]}}function A(V,B,k){return V*this.props[0]+B*this.props[4]+k*this.props[8]+this.props[12]}function M(V,B,k){return V*this.props[1]+B*this.props[5]+k*this.props[9]+this.props[13]}function b(V,B,k){return V*this.props[2]+B*this.props[6]+k*this.props[10]+this.props[14]}function F(){var V=this.props[0]*this.props[5]-this.props[1]*this.props[4],B=this.props[5]/V,k=-this.props[1]/V,R=-this.props[4]/V,N=this.props[0]/V,H=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/V,J=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/V,$=new Matrix;return $.props[0]=B,$.props[1]=k,$.props[4]=R,$.props[5]=N,$.props[12]=H,$.props[13]=J,$}function G(V){var B=this.getInverseMatrix();return B.applyToPointArray(V[0],V[1],V[2]||0)}function L(V){var B,k=V.length,R=[];for(B=0;B<k;B+=1)R[B]=G(V[B]);return R}function D(V,B,k){var R=createTypedArray("float32",6);if(this.isIdentity())R[0]=V[0],R[1]=V[1],R[2]=B[0],R[3]=B[1],R[4]=k[0],R[5]=k[1];else{var N=this.props[0],H=this.props[1],J=this.props[4],$=this.props[5],W=this.props[12],Z=this.props[13];R[0]=V[0]*N+V[1]*J+W,R[1]=V[0]*H+V[1]*$+Z,R[2]=B[0]*N+B[1]*J+W,R[3]=B[0]*H+B[1]*$+Z,R[4]=k[0]*N+k[1]*J+W,R[5]=k[0]*H+k[1]*$+Z}return R}function U(V,B,k){var R;return this.isIdentity()?R=[V,B,k]:R=[V*this.props[0]+B*this.props[4]+k*this.props[8]+this.props[12],V*this.props[1]+B*this.props[5]+k*this.props[9]+this.props[13],V*this.props[2]+B*this.props[6]+k*this.props[10]+this.props[14]],R}function z(V,B){if(this.isIdentity())return V+","+B;var k=this.props;return Math.round((V*k[0]+B*k[4]+k[12])*100)/100+","+Math.round((V*k[1]+B*k[5]+k[13])*100)/100}function O(){for(var V=0,B=this.props,k="matrix3d(",R=1e4;V<16;)k+=s(B[V]*R)/R,k+=V===15?")":",",V+=1;return k}function _(V){var B=1e4;return V<1e-6&&V>0||V>-1e-6&&V<0?s(V*B)/B:V}function I(){var V=this.props,B=_(V[0]),k=_(V[1]),R=_(V[4]),N=_(V[5]),H=_(V[12]),J=_(V[13]);return"matrix("+B+","+k+","+R+","+N+","+H+","+J+")"}return function(){this.reset=r,this.rotate=a,this.rotateX=o,this.rotateY=l,this.rotateZ=u,this.skew=f,this.skewFromAxis=p,this.shear=c,this.scale=d,this.setTransform=m,this.translate=P,this.transform=T,this.multiply=x,this.applyToPoint=E,this.applyToX=A,this.applyToY=M,this.applyToZ=b,this.applyToPointArray=U,this.applyToTriplePoints=D,this.applyToPointStringified=z,this.toCSS=O,this.to2dCSS=I,this.clone=g,this.cloneFromProps=S,this.equals=C,this.inversePoints=L,this.inversePoint=G,this.getInverseMatrix=F,this._t=this.transform,this.isIdentity=y,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(n){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$3(n)}var lottie={};function setLocation(n){setLocationHref(n)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(n){setSubframeEnabled(n)}function setPrefix(n){setIdPrefix(n)}function loadAnimation(n){return animationManager.loadAnimation(n)}function setQuality(n){if(typeof n=="string")switch(n){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(n)&&n>1&&setDefaultCurveSegments(n)}function inBrowser(){return typeof navigator<"u"}function installPlugin(n,e){n==="expressions"&&setExpressionsPlugin(e)}function getFactory(n){switch(n){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.13.0";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(n){for(var e=queryString.split("&"),i=0;i<e.length;i+=1){var s=e[i].split("=");if(decodeURIComponent(s[0])==n)return decodeURIComponent(s[1])}return null}var queryString="";{var scripts=document.getElementsByTagName("script"),index=scripts.length-1,myScript=scripts[index]||{src:""};queryString=myScript.src?myScript.src.replace(/^[^\?]+\??/,""):"",getQueryVariable("renderer")}var readyStateCheckInterval=setInterval(checkReady,100);try{_typeof$3(exports)!=="object"&&(window.bodymovin=lottie)}catch(n){}var ShapeModifiers=function(){var n={},e={};n.registerModifier=i,n.getModifier=s;function i(r,a){e[r]||(e[r]=a)}function s(r,a,o){return new e[r](a,o)}return n}();function ShapeModifier(){}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(n){if(!this.closed){n.sh.container.addDynamicProperty(n.sh);var e={shape:n.sh,data:n,localShapeCollection:shapeCollectionPool.newShapeCollection()};this.shapes.push(e),this.addShapeToModifier(e),this._isAnimated&&n.setAsAnimated()}},ShapeModifier.prototype.init=function(n,e){this.shapes=[],this.elem=n,this.initDynamicPropertyContainer(n),this.initModifierProperties(n,e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier);function TrimModifier(){}extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(n,e){this.s=PropertyFactory.getProp(n,e.s,0,.01,this),this.e=PropertyFactory.getProp(n,e.e,0,.01,this),this.o=PropertyFactory.getProp(n,e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(n){n.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(n,e,i,s,r){var a=[];e<=1?a.push({s:n,e}):n>=1?a.push({s:n-1,e:e-1}):(a.push({s:n,e:1}),a.push({s:0,e:e-1}));var o=[],l,u=a.length,c;for(l=0;l<u;l+=1)if(c=a[l],!(c.e*r<s||c.s*r>s+i)){var f,p;c.s*r<=s?f=0:f=(c.s*r-s)/i,c.e*r>=s+i?p=1:p=(c.e*r-s)/i,o.push([f,p])}return o.length||o.push([0,0]),o},TrimModifier.prototype.releasePathsData=function(n){var e,i=n.length;for(e=0;e<i;e+=1)segmentsLengthPool.release(n[e]);return n.length=0,n},TrimModifier.prototype.processShapes=function(n){var e,i;if(this._mdf||n){var s=this.o.v%360/360;if(s<0&&(s+=1),this.s.v>1?e=1+s:this.s.v<0?e=0+s:e=this.s.v+s,this.e.v>1?i=1+s:this.e.v<0?i=0+s:i=this.e.v+s,e>i){var r=e;e=i,i=r}e=Math.round(e*1e4)*1e-4,i=Math.round(i*1e4)*1e-4,this.sValue=e,this.eValue=i}else e=this.sValue,i=this.eValue;var a,o,l=this.shapes.length,u,c,f,p,d,m=0;if(i===e)for(o=0;o<l;o+=1)this.shapes[o].localShapeCollection.releaseShapes(),this.shapes[o].shape._mdf=!0,this.shapes[o].shape.paths=this.shapes[o].localShapeCollection,this._mdf&&(this.shapes[o].pathsData.length=0);else if(i===1&&e===0||i===0&&e===1){if(this._mdf)for(o=0;o<l;o+=1)this.shapes[o].pathsData.length=0,this.shapes[o].shape._mdf=!0}else{var P=[],T,x;for(o=0;o<l;o+=1)if(T=this.shapes[o],!T.shape._mdf&&!this._mdf&&!n&&this.m!==2)T.shape.paths=T.localShapeCollection;else{if(a=T.shape.paths,c=a._length,d=0,!T.shape._mdf&&T.pathsData.length)d=T.totalShapeLength;else{for(f=this.releasePathsData(T.pathsData),u=0;u<c;u+=1)p=bez.getSegmentsLength(a.shapes[u]),f.push(p),d+=p.totalLength;T.totalShapeLength=d,T.pathsData=f}m+=d,T.shape._mdf=!0}var y=e,C=i,g=0,S;for(o=l-1;o>=0;o-=1)if(T=this.shapes[o],T.shape._mdf){for(x=T.localShapeCollection,x.releaseShapes(),this.m===2&&l>1?(S=this.calculateShapeEdges(e,i,T.totalShapeLength,g,m),g+=T.totalShapeLength):S=[[y,C]],c=S.length,u=0;u<c;u+=1){y=S[u][0],C=S[u][1],P.length=0,C<=1?P.push({s:T.totalShapeLength*y,e:T.totalShapeLength*C}):y>=1?P.push({s:T.totalShapeLength*(y-1),e:T.totalShapeLength*(C-1)}):(P.push({s:T.totalShapeLength*y,e:T.totalShapeLength}),P.push({s:0,e:T.totalShapeLength*(C-1)}));var E=this.addShapes(T,P[0]);if(P[0].s!==P[0].e){if(P.length>1){var A=T.shape.paths.shapes[T.shape.paths._length-1];if(A.c){var M=E.pop();this.addPaths(E,x),E=this.addShapes(T,P[1],M)}else this.addPaths(E,x),E=this.addShapes(T,P[1])}this.addPaths(E,x)}}T.shape.paths=x}}},TrimModifier.prototype.addPaths=function(n,e){var i,s=n.length;for(i=0;i<s;i+=1)e.addShape(n[i])},TrimModifier.prototype.addSegment=function(n,e,i,s,r,a,o){r.setXYAt(e[0],e[1],"o",a),r.setXYAt(i[0],i[1],"i",a+1),o&&r.setXYAt(n[0],n[1],"v",a),r.setXYAt(s[0],s[1],"v",a+1)},TrimModifier.prototype.addSegmentFromArray=function(n,e,i,s){e.setXYAt(n[1],n[5],"o",i),e.setXYAt(n[2],n[6],"i",i+1),s&&e.setXYAt(n[0],n[4],"v",i),e.setXYAt(n[3],n[7],"v",i+1)},TrimModifier.prototype.addShapes=function(n,e,i){var s=n.pathsData,r=n.shape.paths.shapes,a,o=n.shape.paths._length,l,u,c=0,f,p,d,m,P=[],T,x=!0;for(i?(p=i._length,T=i._length):(i=shapePool.newElement(),p=0,T=0),P.push(i),a=0;a<o;a+=1){for(d=s[a].lengths,i.c=r[a].c,u=r[a].c?d.length:d.length+1,l=1;l<u;l+=1)if(f=d[l-1],c+f.addedLength<e.s)c+=f.addedLength,i.c=!1;else if(c>e.e){i.c=!1;break}else e.s<=c&&e.e>=c+f.addedLength?(this.addSegment(r[a].v[l-1],r[a].o[l-1],r[a].i[l],r[a].v[l],i,p,x),x=!1):(m=bez.getNewSegment(r[a].v[l-1],r[a].v[l],r[a].o[l-1],r[a].i[l],(e.s-c)/f.addedLength,(e.e-c)/f.addedLength,d[l-1]),this.addSegmentFromArray(m,i,p,x),x=!1,i.c=!1),c+=f.addedLength,p+=1;if(r[a].c&&d.length){if(f=d[l-1],c<=e.e){var y=d[l-1].addedLength;e.s<=c&&e.e>=c+y?(this.addSegment(r[a].v[l-1],r[a].o[l-1],r[a].i[0],r[a].v[0],i,p,x),x=!1):(m=bez.getNewSegment(r[a].v[l-1],r[a].v[0],r[a].o[l-1],r[a].i[0],(e.s-c)/y,(e.e-c)/y,d[l-1]),this.addSegmentFromArray(m,i,p,x),x=!1,i.c=!1)}else i.c=!1;c+=f.addedLength,p+=1}if(i._length&&(i.setXYAt(i.v[T][0],i.v[T][1],"i",T),i.setXYAt(i.v[i._length-1][0],i.v[i._length-1][1],"o",i._length-1)),c>e.e)break;a<o-1&&(i=shapePool.newElement(),x=!0,P.push(i),p=0)}return P};function PuckerAndBloatModifier(){}extendPrototype([ShapeModifier],PuckerAndBloatModifier),PuckerAndBloatModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(n,e.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},PuckerAndBloatModifier.prototype.processPath=function(n,e){var i=e/100,s=[0,0],r=n._length,a=0;for(a=0;a<r;a+=1)s[0]+=n.v[a][0],s[1]+=n.v[a][1];s[0]/=r,s[1]/=r;var o=shapePool.newElement();o.c=n.c;var l,u,c,f,p,d;for(a=0;a<r;a+=1)l=n.v[a][0]+(s[0]-n.v[a][0])*i,u=n.v[a][1]+(s[1]-n.v[a][1])*i,c=n.o[a][0]+(s[0]-n.o[a][0])*-i,f=n.o[a][1]+(s[1]-n.o[a][1])*-i,p=n.i[a][0]+(s[0]-n.i[a][0])*-i,d=n.i[a][1]+(s[1]-n.i[a][1])*-i,o.setTripleAt(l,u,c,f,p,d,a);return o},PuckerAndBloatModifier.prototype.processShapes=function(n){var e,i,s=this.shapes.length,r,a,o=this.amount.v;if(o!==0){var l,u;for(i=0;i<s;i+=1){if(l=this.shapes[i],u=l.localShapeCollection,!(!l.shape._mdf&&!this._mdf&&!n))for(u.releaseShapes(),l.shape._mdf=!0,e=l.shape.paths.shapes,a=l.shape.paths._length,r=0;r<a;r+=1)u.addShape(this.processPath(e[r],o));l.shape.paths=l.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};var TransformPropertyFactory=function(){var n=[0,0];function e(u){var c=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||c,this.a&&u.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&u.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&u.skewFromAxis(-this.sk.v,this.sa.v),this.r?u.rotate(-this.r.v):u.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?u.translate(this.px.v,this.py.v,-this.pz.v):u.translate(this.px.v,this.py.v,0):u.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}function i(u){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||u){var c;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var f,p;if(c=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(f=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/c,0),p=this.p.getValueAtTime(this.p.keyframes[0].t/c,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(f=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/c,0),p=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/c,0)):(f=this.p.pv,p=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/c,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){f=[],p=[];var d=this.px,m=this.py;d._caching.lastFrame+d.offsetTime<=d.keyframes[0].t?(f[0]=d.getValueAtTime((d.keyframes[0].t+.01)/c,0),f[1]=m.getValueAtTime((m.keyframes[0].t+.01)/c,0),p[0]=d.getValueAtTime(d.keyframes[0].t/c,0),p[1]=m.getValueAtTime(m.keyframes[0].t/c,0)):d._caching.lastFrame+d.offsetTime>=d.keyframes[d.keyframes.length-1].t?(f[0]=d.getValueAtTime(d.keyframes[d.keyframes.length-1].t/c,0),f[1]=m.getValueAtTime(m.keyframes[m.keyframes.length-1].t/c,0),p[0]=d.getValueAtTime((d.keyframes[d.keyframes.length-1].t-.01)/c,0),p[1]=m.getValueAtTime((m.keyframes[m.keyframes.length-1].t-.01)/c,0)):(f=[d.pv,m.pv],p[0]=d.getValueAtTime((d._caching.lastFrame+d.offsetTime-.01)/c,d.offsetTime),p[1]=m.getValueAtTime((m._caching.lastFrame+m.offsetTime-.01)/c,m.offsetTime))}else p=n,f=p;this.v.rotate(-Math.atan2(f[1]-p[1],f[0]-p[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function s(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function r(){}function a(u){this._addDynamicProperty(u),this.elem.addDynamicProperty(u),this._isDirty=!0}function o(u,c,f){if(this.elem=u,this.frameId=-1,this.propType="transform",this.data=c,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(f||u),c.p&&c.p.s?(this.px=PropertyFactory.getProp(u,c.p.x,0,0,this),this.py=PropertyFactory.getProp(u,c.p.y,0,0,this),c.p.z&&(this.pz=PropertyFactory.getProp(u,c.p.z,0,0,this))):this.p=PropertyFactory.getProp(u,c.p||{k:[0,0,0]},1,0,this),c.rx){if(this.rx=PropertyFactory.getProp(u,c.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(u,c.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(u,c.rz,0,degToRads,this),c.or.k[0].ti){var p,d=c.or.k.length;for(p=0;p<d;p+=1)c.or.k[p].to=null,c.or.k[p].ti=null}this.or=PropertyFactory.getProp(u,c.or,1,degToRads,this),this.or.sh=!0}else this.r=PropertyFactory.getProp(u,c.r||{k:0},0,degToRads,this);c.sk&&(this.sk=PropertyFactory.getProp(u,c.sk,0,degToRads,this),this.sa=PropertyFactory.getProp(u,c.sa,0,degToRads,this)),this.a=PropertyFactory.getProp(u,c.a||{k:[0,0,0]},1,0,this),this.s=PropertyFactory.getProp(u,c.s||{k:[100,100,100]},1,.01,this),c.o?this.o=PropertyFactory.getProp(u,c.o,0,.01,u):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}o.prototype={applyToMatrix:e,getValue:i,precalculateMatrix:s,autoOrient:r},extendPrototype([DynamicPropertyContainer],o),o.prototype.addDynamicProperty=a,o.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty;function l(u,c,f){return new o(u,c,f)}return{getTransformProperty:l}}();function RepeaterModifier(){}extendPrototype([ShapeModifier],RepeaterModifier),RepeaterModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.c=PropertyFactory.getProp(n,e.c,0,null,this),this.o=PropertyFactory.getProp(n,e.o,0,null,this),this.tr=TransformPropertyFactory.getTransformProperty(n,e.tr,this),this.so=PropertyFactory.getProp(n,e.tr.so,0,.01,this),this.eo=PropertyFactory.getProp(n,e.tr.eo,0,.01,this),this.data=e,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Matrix,this.rMatrix=new Matrix,this.sMatrix=new Matrix,this.tMatrix=new Matrix,this.matrix=new Matrix},RepeaterModifier.prototype.applyTransforms=function(n,e,i,s,r,a){var o=a?-1:1,l=s.s.v[0]+(1-s.s.v[0])*(1-r),u=s.s.v[1]+(1-s.s.v[1])*(1-r);n.translate(s.p.v[0]*o*r,s.p.v[1]*o*r,s.p.v[2]),e.translate(-s.a.v[0],-s.a.v[1],s.a.v[2]),e.rotate(-s.r.v*o*r),e.translate(s.a.v[0],s.a.v[1],s.a.v[2]),i.translate(-s.a.v[0],-s.a.v[1],s.a.v[2]),i.scale(a?1/l:l,a?1/u:u),i.translate(s.a.v[0],s.a.v[1],s.a.v[2])},RepeaterModifier.prototype.init=function(n,e,i,s){for(this.elem=n,this.arr=e,this.pos=i,this.elemsData=s,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(n),this.initModifierProperties(n,e[i]);i>0;)i-=1,this._elements.unshift(e[i]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e]._processed=!1,n[e].ty==="gr"&&this.resetElements(n[e].it)},RepeaterModifier.prototype.cloneElements=function(n){var e=JSON.parse(JSON.stringify(n));return this.resetElements(e),e},RepeaterModifier.prototype.changeGroupRender=function(n,e){var i,s=n.length;for(i=0;i<s;i+=1)n[i]._render=e,n[i].ty==="gr"&&this.changeGroupRender(n[i].it,e)},RepeaterModifier.prototype.processShapes=function(n){var e,i,s,r,a,o=!1;if(this._mdf||n){var l=Math.ceil(this.c.v);if(this._groups.length<l){for(;this._groups.length<l;){var u={it:this.cloneElements(this._elements),ty:"gr"};u.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,u),this._groups.splice(0,0,u),this._currentCopies+=1}this.elem.reloadShapes(),o=!0}a=0;var c;for(s=0;s<=this._groups.length-1;s+=1){if(c=a<l,this._groups[s]._render=c,this.changeGroupRender(this._groups[s].it,c),!c){var f=this.elemsData[s].it,p=f[f.length-1];p.transform.op.v!==0?(p.transform.op._mdf=!0,p.transform.op.v=0):p.transform.op._mdf=!1}a+=1}this._currentCopies=l;var d=this.o.v,m=d%1,P=d>0?Math.floor(d):Math.ceil(d),T=this.pMatrix.props,x=this.rMatrix.props,y=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var C=0;if(d>0){for(;C<P;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),C+=1;m&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,m,!1),C+=m)}else if(d<0){for(;C>P;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),C-=1;m&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-m,!0),C-=m)}s=this.data.m===1?0:this._currentCopies-1,r=this.data.m===1?1:-1,a=this._currentCopies;for(var g,S;a;){if(e=this.elemsData[s].it,i=e[e.length-1].transform.mProps.v.props,S=i.length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(s/(this._currentCopies-1)),C!==0){for((s!==0&&r===1||s!==this._currentCopies-1&&r===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]),this.matrix.transform(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],y[8],y[9],y[10],y[11],y[12],y[13],y[14],y[15]),this.matrix.transform(T[0],T[1],T[2],T[3],T[4],T[5],T[6],T[7],T[8],T[9],T[10],T[11],T[12],T[13],T[14],T[15]),g=0;g<S;g+=1)i[g]=this.matrix.props[g];this.matrix.reset()}else for(this.matrix.reset(),g=0;g<S;g+=1)i[g]=this.matrix.props[g];C+=1,a-=1,s+=r}}else for(a=this._currentCopies,s=0,r=1;a;)e=this.elemsData[s].it,i=e[e.length-1].transform.mProps.v.props,e[e.length-1].transform.mProps._mdf=!1,e[e.length-1].transform.op._mdf=!1,a-=1,s+=r;return o},RepeaterModifier.prototype.addShape=function(){};function RoundCornersModifier(){}extendPrototype([ShapeModifier],RoundCornersModifier),RoundCornersModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.rd=PropertyFactory.getProp(n,e.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},RoundCornersModifier.prototype.processPath=function(n,e){var i=shapePool.newElement();i.c=n.c;var s,r=n._length,a,o,l,u,c,f,p=0,d,m,P,T,x,y;for(s=0;s<r;s+=1)a=n.v[s],l=n.o[s],o=n.i[s],a[0]===l[0]&&a[1]===l[1]&&a[0]===o[0]&&a[1]===o[1]?(s===0||s===r-1)&&!n.c?(i.setTripleAt(a[0],a[1],l[0],l[1],o[0],o[1],p),p+=1):(s===0?u=n.v[r-1]:u=n.v[s-1],c=Math.sqrt(Math.pow(a[0]-u[0],2)+Math.pow(a[1]-u[1],2)),f=c?Math.min(c/2,e)/c:0,x=a[0]+(u[0]-a[0])*f,d=x,y=a[1]-(a[1]-u[1])*f,m=y,P=d-(d-a[0])*roundCorner,T=m-(m-a[1])*roundCorner,i.setTripleAt(d,m,P,T,x,y,p),p+=1,s===r-1?u=n.v[0]:u=n.v[s+1],c=Math.sqrt(Math.pow(a[0]-u[0],2)+Math.pow(a[1]-u[1],2)),f=c?Math.min(c/2,e)/c:0,P=a[0]+(u[0]-a[0])*f,d=P,T=a[1]+(u[1]-a[1])*f,m=T,x=d-(d-a[0])*roundCorner,y=m-(m-a[1])*roundCorner,i.setTripleAt(d,m,P,T,x,y,p),p+=1):(i.setTripleAt(n.v[s][0],n.v[s][1],n.o[s][0],n.o[s][1],n.i[s][0],n.i[s][1],p),p+=1);return i},RoundCornersModifier.prototype.processShapes=function(n){var e,i,s=this.shapes.length,r,a,o=this.rd.v;if(o!==0){var l,u;for(i=0;i<s;i+=1){if(l=this.shapes[i],u=l.localShapeCollection,!(!l.shape._mdf&&!this._mdf&&!n))for(u.releaseShapes(),l.shape._mdf=!0,e=l.shape.paths.shapes,a=l.shape.paths._length,r=0;r<a;r+=1)u.addShape(this.processPath(e[r],o));l.shape.paths=l.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function floatEqual(n,e){return Math.abs(n-e)*1e5<=Math.min(Math.abs(n),Math.abs(e))}function floatZero(n){return Math.abs(n)<=1e-5}function lerp(n,e,i){return n*(1-i)+e*i}function lerpPoint(n,e,i){return[lerp(n[0],e[0],i),lerp(n[1],e[1],i)]}function quadRoots(n,e,i){if(n===0)return[];var s=e*e-4*n*i;if(s<0)return[];var r=-e/(2*n);if(s===0)return[r];var a=Math.sqrt(s)/(2*n);return[r-a,r+a]}function polynomialCoefficients(n,e,i,s){return[-n+3*e-3*i+s,3*n-6*e+3*i,-3*n+3*e,n]}function singlePoint(n){return new PolynomialBezier(n,n,n,n,!1)}function PolynomialBezier(n,e,i,s,r){r&&pointEqual(n,e)&&(e=lerpPoint(n,s,1/3)),r&&pointEqual(i,s)&&(i=lerpPoint(n,s,2/3));var a=polynomialCoefficients(n[0],e[0],i[0],s[0]),o=polynomialCoefficients(n[1],e[1],i[1],s[1]);this.a=[a[0],o[0]],this.b=[a[1],o[1]],this.c=[a[2],o[2]],this.d=[a[3],o[3]],this.points=[n,e,i,s]}PolynomialBezier.prototype.point=function(n){return[((this.a[0]*n+this.b[0])*n+this.c[0])*n+this.d[0],((this.a[1]*n+this.b[1])*n+this.c[1])*n+this.d[1]]},PolynomialBezier.prototype.derivative=function(n){return[(3*n*this.a[0]+2*this.b[0])*n+this.c[0],(3*n*this.a[1]+2*this.b[1])*n+this.c[1]]},PolynomialBezier.prototype.tangentAngle=function(n){var e=this.derivative(n);return Math.atan2(e[1],e[0])},PolynomialBezier.prototype.normalAngle=function(n){var e=this.derivative(n);return Math.atan2(e[0],e[1])},PolynomialBezier.prototype.inflectionPoints=function(){var n=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(floatZero(n))return[];var e=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/n,i=e*e-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/n;if(i<0)return[];var s=Math.sqrt(i);return floatZero(s)?s>0&&s<1?[e]:[]:[e-s,e+s].filter(function(r){return r>0&&r<1})},PolynomialBezier.prototype.split=function(n){if(n<=0)return[singlePoint(this.points[0]),this];if(n>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],n),i=lerpPoint(this.points[1],this.points[2],n),s=lerpPoint(this.points[2],this.points[3],n),r=lerpPoint(e,i,n),a=lerpPoint(i,s,n),o=lerpPoint(r,a,n);return[new PolynomialBezier(this.points[0],e,r,o,!0),new PolynomialBezier(o,a,s,this.points[3],!0)]};function extrema(n,e){var i=n.points[0][e],s=n.points[n.points.length-1][e];if(i>s){var r=s;s=i,i=r}for(var a=quadRoots(3*n.a[e],2*n.b[e],n.c[e]),o=0;o<a.length;o+=1)if(a[o]>0&&a[o]<1){var l=n.point(a[o])[e];l<i?i=l:l>s&&(s=l)}return{min:i,max:s}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var n=this.bounds();return{left:n.x.min,right:n.x.max,top:n.y.min,bottom:n.y.max,width:n.x.max-n.x.min,height:n.y.max-n.y.min,cx:(n.x.max+n.x.min)/2,cy:(n.y.max+n.y.min)/2}};function intersectData(n,e,i){var s=n.boundingBox();return{cx:s.cx,cy:s.cy,width:s.width,height:s.height,bez:n,t:(e+i)/2,t1:e,t2:i}}function splitData(n){var e=n.bez.split(.5);return[intersectData(e[0],n.t1,n.t),intersectData(e[1],n.t,n.t2)]}function boxIntersect(n,e){return Math.abs(n.cx-e.cx)*2<n.width+e.width&&Math.abs(n.cy-e.cy)*2<n.height+e.height}function intersectsImpl(n,e,i,s,r,a){if(boxIntersect(n,e)){if(i>=a||n.width<=s&&n.height<=s&&e.width<=s&&e.height<=s){r.push([n.t,e.t]);return}var o=splitData(n),l=splitData(e);intersectsImpl(o[0],l[0],i+1,s,r,a),intersectsImpl(o[0],l[1],i+1,s,r,a),intersectsImpl(o[1],l[0],i+1,s,r,a),intersectsImpl(o[1],l[1],i+1,s,r,a)}}PolynomialBezier.prototype.intersections=function(n,e,i){e===void 0&&(e=2),i===void 0&&(i=7);var s=[];return intersectsImpl(intersectData(this,0,1),intersectData(n,0,1),0,e,s,i),s},PolynomialBezier.shapeSegment=function(n,e){var i=(e+1)%n.length();return new PolynomialBezier(n.v[e],n.o[e],n.i[i],n.v[i],!0)},PolynomialBezier.shapeSegmentInverted=function(n,e){var i=(e+1)%n.length();return new PolynomialBezier(n.v[i],n.i[i],n.o[e],n.v[e],!0)};function crossProduct(n,e){return[n[1]*e[2]-n[2]*e[1],n[2]*e[0]-n[0]*e[2],n[0]*e[1]-n[1]*e[0]]}function lineIntersection(n,e,i,s){var r=[n[0],n[1],1],a=[e[0],e[1],1],o=[i[0],i[1],1],l=[s[0],s[1],1],u=crossProduct(crossProduct(r,a),crossProduct(o,l));return floatZero(u[2])?null:[u[0]/u[2],u[1]/u[2]]}function polarOffset(n,e,i){return[n[0]+Math.cos(e)*i,n[1]-Math.sin(e)*i]}function pointDistance(n,e){return Math.hypot(n[0]-e[0],n[1]-e[1])}function pointEqual(n,e){return floatEqual(n[0],e[0])&&floatEqual(n[1],e[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(n,e.s,0,null,this),this.frequency=PropertyFactory.getProp(n,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(n,e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(n,e,i,s,r,a,o){var l=i-Math.PI/2,u=i+Math.PI/2,c=e[0]+Math.cos(i)*s*r,f=e[1]-Math.sin(i)*s*r;n.setTripleAt(c,f,c+Math.cos(l)*a,f-Math.sin(l)*a,c+Math.cos(u)*o,f-Math.sin(u)*o,n.length())}function getPerpendicularVector(n,e){var i=[e[0]-n[0],e[1]-n[1]],s=-Math.PI*.5,r=[Math.cos(s)*i[0]-Math.sin(s)*i[1],Math.sin(s)*i[0]+Math.cos(s)*i[1]];return r}function getProjectingAngle(n,e){var i=e===0?n.length()-1:e-1,s=(e+1)%n.length(),r=n.v[i],a=n.v[s],o=getPerpendicularVector(r,a);return Math.atan2(0,1)-Math.atan2(o[1],o[0])}function zigZagCorner(n,e,i,s,r,a,o){var l=getProjectingAngle(e,i),u=e.v[i%e._length],c=e.v[i===0?e._length-1:i-1],f=e.v[(i+1)%e._length],p=a===2?Math.sqrt(Math.pow(u[0]-c[0],2)+Math.pow(u[1]-c[1],2)):0,d=a===2?Math.sqrt(Math.pow(u[0]-f[0],2)+Math.pow(u[1]-f[1],2)):0;setPoint(n,e.v[i%e._length],l,o,s,d/((r+1)*2),p/((r+1)*2))}function zigZagSegment(n,e,i,s,r,a){for(var o=0;o<s;o+=1){var l=(o+1)/(s+1),u=r===2?Math.sqrt(Math.pow(e.points[3][0]-e.points[0][0],2)+Math.pow(e.points[3][1]-e.points[0][1],2)):0,c=e.normalAngle(l),f=e.point(l);setPoint(n,f,c,a,i,u/((s+1)*2),u/((s+1)*2)),a=-a}return a}ZigZagModifier.prototype.processPath=function(n,e,i,s){var r=n._length,a=shapePool.newElement();if(a.c=n.c,n.c||(r-=1),r===0)return a;var o=-1,l=PolynomialBezier.shapeSegment(n,0);zigZagCorner(a,n,0,e,i,s,o);for(var u=0;u<r;u+=1)o=zigZagSegment(a,l,e,i,s,-o),u===r-1&&!n.c?l=null:l=PolynomialBezier.shapeSegment(n,(u+1)%r),zigZagCorner(a,n,u+1,e,i,s,o);return a},ZigZagModifier.prototype.processShapes=function(n){var e,i,s=this.shapes.length,r,a,o=this.amplitude.v,l=Math.max(0,Math.round(this.frequency.v)),u=this.pointsType.v;if(o!==0){var c,f;for(i=0;i<s;i+=1){if(c=this.shapes[i],f=c.localShapeCollection,!(!c.shape._mdf&&!this._mdf&&!n))for(f.releaseShapes(),c.shape._mdf=!0,e=c.shape.paths.shapes,a=c.shape.paths._length,r=0;r<a;r+=1)f.addShape(this.processPath(e[r],o,l,u));c.shape.paths=c.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function linearOffset(n,e,i){var s=Math.atan2(e[0]-n[0],e[1]-n[1]);return[polarOffset(n,s,i),polarOffset(e,s,i)]}function offsetSegment(n,e){var i,s,r,a,o,l,u;u=linearOffset(n.points[0],n.points[1],e),i=u[0],s=u[1],u=linearOffset(n.points[1],n.points[2],e),r=u[0],a=u[1],u=linearOffset(n.points[2],n.points[3],e),o=u[0],l=u[1];var c=lineIntersection(i,s,r,a);c===null&&(c=s);var f=lineIntersection(o,l,r,a);return f===null&&(f=o),new PolynomialBezier(i,c,f,l)}function joinLines(n,e,i,s,r){var a=e.points[3],o=i.points[0];if(s===3||pointEqual(a,o))return a;if(s===2){var l=-e.tangentAngle(1),u=-i.tangentAngle(0)+Math.PI,c=lineIntersection(a,polarOffset(a,l+Math.PI/2,100),o,polarOffset(o,l+Math.PI/2,100)),f=c?pointDistance(c,a):pointDistance(a,o)/2,p=polarOffset(a,l,2*f*roundCorner);return n.setXYAt(p[0],p[1],"o",n.length()-1),p=polarOffset(o,u,2*f*roundCorner),n.setTripleAt(o[0],o[1],o[0],o[1],p[0],p[1],n.length()),o}var d=pointEqual(a,e.points[2])?e.points[0]:e.points[2],m=pointEqual(o,i.points[1])?i.points[3]:i.points[1],P=lineIntersection(d,a,o,m);return P&&pointDistance(P,a)<r?(n.setTripleAt(P[0],P[1],P[0],P[1],P[0],P[1],n.length()),P):a}function getIntersection(n,e){var i=n.intersections(e);return i.length&&floatEqual(i[0][0],1)&&i.shift(),i.length?i[0]:null}function pruneSegmentIntersection(n,e){var i=n.slice(),s=e.slice(),r=getIntersection(n[n.length-1],e[0]);return r&&(i[n.length-1]=n[n.length-1].split(r[0])[0],s[0]=e[0].split(r[1])[1]),n.length>1&&e.length>1&&(r=getIntersection(n[0],e[e.length-1]),r)?[[n[0].split(r[0])[0]],[e[e.length-1].split(r[1])[1]]]:[i,s]}function pruneIntersections(n){for(var e,i=1;i<n.length;i+=1)e=pruneSegmentIntersection(n[i-1],n[i]),n[i-1]=e[0],n[i]=e[1];return n.length>1&&(e=pruneSegmentIntersection(n[n.length-1],n[0]),n[n.length-1]=e[0],n[0]=e[1]),n}function offsetSegmentSplit(n,e){var i=n.inflectionPoints(),s,r,a,o;if(i.length===0)return[offsetSegment(n,e)];if(i.length===1||floatEqual(i[1],1))return a=n.split(i[0]),s=a[0],r=a[1],[offsetSegment(s,e),offsetSegment(r,e)];a=n.split(i[0]),s=a[0];var l=(i[1]-i[0])/(1-i[0]);return a=a[1].split(l),o=a[0],r=a[1],[offsetSegment(s,e),offsetSegment(o,e),offsetSegment(r,e)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(n,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(n,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(n,e,i,s){var r=shapePool.newElement();r.c=n.c;var a=n.length();n.c||(a-=1);var o,l,u,c=[];for(o=0;o<a;o+=1)u=PolynomialBezier.shapeSegment(n,o),c.push(offsetSegmentSplit(u,e));if(!n.c)for(o=a-1;o>=0;o-=1)u=PolynomialBezier.shapeSegmentInverted(n,o),c.push(offsetSegmentSplit(u,e));c=pruneIntersections(c);var f=null,p=null;for(o=0;o<c.length;o+=1){var d=c[o];for(p&&(f=joinLines(r,p,d[0],i,s)),p=d[d.length-1],l=0;l<d.length;l+=1)u=d[l],f&&pointEqual(u.points[0],f)?r.setXYAt(u.points[1][0],u.points[1][1],"o",r.length()-1):r.setTripleAt(u.points[0][0],u.points[0][1],u.points[1][0],u.points[1][1],u.points[0][0],u.points[0][1],r.length()),r.setTripleAt(u.points[3][0],u.points[3][1],u.points[3][0],u.points[3][1],u.points[2][0],u.points[2][1],r.length()),f=u.points[3]}return c.length&&joinLines(r,p,c[0][0],i,s),r},OffsetPathModifier.prototype.processShapes=function(n){var e,i,s=this.shapes.length,r,a,o=this.amount.v,l=this.miterLimit.v,u=this.lineJoin;if(o!==0){var c,f;for(i=0;i<s;i+=1){if(c=this.shapes[i],f=c.localShapeCollection,!(!c.shape._mdf&&!this._mdf&&!n))for(f.releaseShapes(),c.shape._mdf=!0,e=c.shape.paths.shapes,a=c.shape.paths._length,r=0;r<a;r+=1)f.addShape(this.processPath(e[r],o,u,l));c.shape.paths=c.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function getFontProperties(n){for(var e=n.fStyle?n.fStyle.split(" "):[],i="normal",s="normal",r=e.length,a,o=0;o<r;o+=1)switch(a=e[o].toLowerCase(),a){case"italic":s="italic";break;case"bold":i="700";break;case"black":i="900";break;case"medium":i="500";break;case"regular":case"normal":i="400";break;case"light":case"thin":i="200";break}return{style:s,weight:n.fWeight||i}}var FontManager=function(){var n=5e3,e={w:0,size:0,shapes:[],data:{shapes:[]}},i=[];i=i.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var s=127988,r=917631,a=917601,o=917626,l=65039,u=8205,c=127462,f=127487,p=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function d(_){var I=_.split(","),V,B=I.length,k=[];for(V=0;V<B;V+=1)I[V]!=="sans-serif"&&I[V]!=="monospace"&&k.push(I[V]);return k.join(",")}function m(_,I){var V=createTag("span");V.setAttribute("aria-hidden",!0),V.style.fontFamily=I;var B=createTag("span");B.innerText="giItT1WQy@!-/#",V.style.position="absolute",V.style.left="-10000px",V.style.top="-10000px",V.style.fontSize="300px",V.style.fontVariant="normal",V.style.fontStyle="normal",V.style.fontWeight="normal",V.style.letterSpacing="0",V.appendChild(B),document.body.appendChild(V);var k=B.offsetWidth;return B.style.fontFamily=d(_)+", "+I,{node:B,w:k,parent:V}}function P(){var _,I=this.fonts.length,V,B,k=I;for(_=0;_<I;_+=1)this.fonts[_].loaded?k-=1:this.fonts[_].fOrigin==="n"||this.fonts[_].origin===0?this.fonts[_].loaded=!0:(V=this.fonts[_].monoCase.node,B=this.fonts[_].monoCase.w,V.offsetWidth!==B?(k-=1,this.fonts[_].loaded=!0):(V=this.fonts[_].sansCase.node,B=this.fonts[_].sansCase.w,V.offsetWidth!==B&&(k-=1,this.fonts[_].loaded=!0)),this.fonts[_].loaded&&(this.fonts[_].sansCase.parent.parentNode.removeChild(this.fonts[_].sansCase.parent),this.fonts[_].monoCase.parent.parentNode.removeChild(this.fonts[_].monoCase.parent)));k!==0&&Date.now()-this.initTime<n?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)}function T(_,I){var V=document.body&&I?"svg":"canvas",B,k=getFontProperties(_);if(V==="svg"){var R=createNS("text");R.style.fontSize="100px",R.setAttribute("font-family",_.fFamily),R.setAttribute("font-style",k.style),R.setAttribute("font-weight",k.weight),R.textContent="1",_.fClass?(R.style.fontFamily="inherit",R.setAttribute("class",_.fClass)):R.style.fontFamily=_.fFamily,I.appendChild(R),B=R}else{var N=new OffscreenCanvas(500,500).getContext("2d");N.font=k.style+" "+k.weight+" 100px "+_.fFamily,B=N}function H(J){return V==="svg"?(B.textContent=J,B.getComputedTextLength()):B.measureText(J).width}return{measureText:H}}function x(_,I){if(!_){this.isLoaded=!0;return}if(this.chars){this.isLoaded=!0,this.fonts=_.list;return}if(!document.body){this.isLoaded=!0,_.list.forEach(function(ie){ie.helper=T(ie),ie.cache={}}),this.fonts=_.list;return}var V=_.list,B,k=V.length,R=k;for(B=0;B<k;B+=1){var N=!0,H,J;if(V[B].loaded=!1,V[B].monoCase=m(V[B].fFamily,"monospace"),V[B].sansCase=m(V[B].fFamily,"sans-serif"),!V[B].fPath)V[B].loaded=!0,R-=1;else if(V[B].fOrigin==="p"||V[B].origin===3){if(H=document.querySelectorAll('style[f-forigin="p"][f-family="'+V[B].fFamily+'"], style[f-origin="3"][f-family="'+V[B].fFamily+'"]'),H.length>0&&(N=!1),N){var $=createTag("style");$.setAttribute("f-forigin",V[B].fOrigin),$.setAttribute("f-origin",V[B].origin),$.setAttribute("f-family",V[B].fFamily),$.type="text/css",$.innerText="@font-face {font-family: "+V[B].fFamily+"; font-style: normal; src: url('"+V[B].fPath+"');}",I.appendChild($)}}else if(V[B].fOrigin==="g"||V[B].origin===1){for(H=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),J=0;J<H.length;J+=1)H[J].href.indexOf(V[B].fPath)!==-1&&(N=!1);if(N){var W=createTag("link");W.setAttribute("f-forigin",V[B].fOrigin),W.setAttribute("f-origin",V[B].origin),W.type="text/css",W.rel="stylesheet",W.href=V[B].fPath,document.body.appendChild(W)}}else if(V[B].fOrigin==="t"||V[B].origin===2){for(H=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),J=0;J<H.length;J+=1)V[B].fPath===H[J].src&&(N=!1);if(N){var Z=createTag("link");Z.setAttribute("f-forigin",V[B].fOrigin),Z.setAttribute("f-origin",V[B].origin),Z.setAttribute("rel","stylesheet"),Z.setAttribute("href",V[B].fPath),I.appendChild(Z)}}V[B].helper=T(V[B],I),V[B].cache={},this.fonts.push(V[B])}R===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}function y(_){if(_){this.chars||(this.chars=[]);var I,V=_.length,B,k=this.chars.length,R;for(I=0;I<V;I+=1){for(B=0,R=!1;B<k;)this.chars[B].style===_[I].style&&this.chars[B].fFamily===_[I].fFamily&&this.chars[B].ch===_[I].ch&&(R=!0),B+=1;R||(this.chars.push(_[I]),k+=1)}}}function C(_,I,V){for(var B=0,k=this.chars.length;B<k;){if(this.chars[B].ch===_&&this.chars[B].style===I&&this.chars[B].fFamily===V)return this.chars[B];B+=1}return(typeof _=="string"&&_.charCodeAt(0)!==13||!_)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",_,I,V)),e}function g(_,I,V){var B=this.getFontByName(I),k=_;if(!B.cache[k]){var R=B.helper;if(_===" "){var N=R.measureText("|"+_+"|"),H=R.measureText("||");B.cache[k]=(N-H)/100}else B.cache[k]=R.measureText(_)/100}return B.cache[k]*V}function S(_){for(var I=0,V=this.fonts.length;I<V;){if(this.fonts[I].fName===_)return this.fonts[I];I+=1}return this.fonts[0]}function E(_){var I=0,V=_.charCodeAt(0);if(V>=55296&&V<=56319){var B=_.charCodeAt(1);B>=56320&&B<=57343&&(I=(V-55296)*1024+B-56320+65536)}return I}function A(_,I){var V=_.toString(16)+I.toString(16);return p.indexOf(V)!==-1}function M(_){return _===u}function b(_){return _===l}function F(_){var I=E(_);return I>=c&&I<=f}function G(_){return F(_.substr(0,2))&&F(_.substr(2,2))}function L(_){return i.indexOf(_)!==-1}function D(_,I){var V=E(_.substr(I,2));if(V!==s)return!1;var B=0;for(I+=2;B<5;){if(V=E(_.substr(I,2)),V<a||V>o)return!1;B+=1,I+=2}return E(_.substr(I,2))===r}function U(){this.isLoaded=!0}var z=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};z.isModifier=A,z.isZeroWidthJoiner=M,z.isFlagEmoji=G,z.isRegionalCode=F,z.isCombinedCharacter=L,z.isRegionalFlag=D,z.isVariationSelector=b,z.BLACK_FLAG_CODE_POINT=s;var O={addChars:y,addFonts:x,getCharData:C,getFontByName:S,measureText:g,checkLoadedFonts:P,setIsLoaded:U};return z.prototype=O,z}();function SlotManager(n){this.animationData=n}SlotManager.prototype.getProp=function(n){return this.animationData.slots&&this.animationData.slots[n.sid]?Object.assign(n,this.animationData.slots[n.sid].p):n};function slotFactory(n){return new SlotManager(n)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,i=this.renderableComponents.length;for(e=0;e<i;e+=1)this.renderableComponents[e].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return this.data.ty===5?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var getBlendMode=function(){var n={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"};return function(e){return n[e]||""}}();function SliderEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function AngleEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function ColorEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,1,0,i)}function PointEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,1,0,i)}function LayerIndexEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function MaskIndexEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function CheckboxEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function NoValueEffect(){this.p={}}function EffectsManager(n,e){var i=n.ef||[];this.effectElements=[];var s,r=i.length,a;for(s=0;s<r;s+=1)a=new GroupEffect(i[s],e),this.effectElements.push(a)}function GroupEffect(n,e){this.init(n,e)}extendPrototype([DynamicPropertyContainer],GroupEffect),GroupEffect.prototype.getValue=GroupEffect.prototype.iterateDynamicProperties,GroupEffect.prototype.init=function(n,e){this.data=n,this.effectElements=[],this.initDynamicPropertyContainer(e);var i,s=this.data.ef.length,r,a=this.data.ef;for(i=0;i<s;i+=1){switch(r=null,a[i].ty){case 0:r=new SliderEffect(a[i],e,this);break;case 1:r=new AngleEffect(a[i],e,this);break;case 2:r=new ColorEffect(a[i],e,this);break;case 3:r=new PointEffect(a[i],e,this);break;case 4:case 7:r=new CheckboxEffect(a[i],e,this);break;case 10:r=new LayerIndexEffect(a[i],e,this);break;case 11:r=new MaskIndexEffect(a[i],e,this);break;case 5:r=new EffectsManager(a[i],e);break;default:r=new NoValueEffect(a[i]);break}r&&this.effectElements.push(r)}};function BaseElement(){}BaseElement.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var e=0,i=this.data.masksProperties.length;e<i;){if(this.data.masksProperties[e].mode!=="n"&&this.data.masksProperties[e].cl!==!1)return!0;e+=1}return!1},initExpressions:function(){var e=getExpressionInterfaces();if(e){var i=e("layer"),s=e("effects"),r=e("shape"),a=e("text"),o=e("comp");this.layerInterface=i(this),this.data.hasMask&&this.maskManager&&this.layerInterface.registerMaskInterface(this.maskManager);var l=s.createEffectsInterface(this,this.layerInterface);this.layerInterface.registerEffectsInterface(l),this.data.ty===0||this.data.xt?this.compInterface=o(this):this.data.ty===4?(this.layerInterface.shapeInterface=r(this.shapesData,this.itemsData,this.layerInterface),this.layerInterface.content=this.layerInterface.shapeInterface):this.data.ty===5&&(this.layerInterface.textInterface=a(this),this.layerInterface.text=this.layerInterface.textInterface)}},setBlendMode:function(){var e=getBlendMode(this.data.bm),i=this.baseElement||this.layerElement;i.style["mix-blend-mode"]=e},initBaseData:function(e,i,s){this.globalData=i,this.comp=s,this.data=e,this.layerId=createElementID(),this.data.sr||(this.data.sr=1),this.effectsManager=new EffectsManager(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}};function FrameElement(){}FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(e,i){var s,r=this.dynamicProperties.length;for(s=0;s<r;s+=1)(i||this._isParent&&this.dynamicProperties[s].propType==="transform")&&(this.dynamicProperties[s].getValue(),this.dynamicProperties[s]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(e){this.dynamicProperties.indexOf(e)===-1&&this.dynamicProperties.push(e)}};function FootageElement(n,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(n.refId),this.footageData=e.imageLoader.getAsset(this.assetData),this.initBaseData(n,e,i)}FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){var n=getExpressionInterfaces();if(n){var e=n("footage");this.layerInterface=e(this)}},FootageElement.prototype.getFootageData=function(){return this.footageData};function AudioElement(n,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(n.refId),this.initBaseData(n,e,i),this._isPlaying=!1,this._canPlay=!1;var s=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(s),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0},this.lv=PropertyFactory.getProp(this,n.au&&n.au.lv?n.au.lv:{k:[100]},1,.01,this)}AudioElement.prototype.prepareFrame=function(n){if(this.prepareRenderableFrame(n,!0),this.prepareProperties(n,!0),this.tm._placeholder)this._currentTime=n/this.data.sr;else{var e=this.tm.v;this._currentTime=e}this._volume=this.lv.v[0];var i=this._volume*this._volumeMultiplier;this._previousVolume!==i&&(this._previousVolume=i,this.audio.volume(i))},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(n){this.audio.rate(n)},AudioElement.prototype.volume=function(n){this._volumeMultiplier=n,this._previousVolume=n*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(n){var e,i=this.layers.length,s;for(this.completeLayers=!0,e=i-1;e>=0;e-=1)this.elements[e]||(s=this.layers[e],s.ip-s.st<=n-this.layers[e].st&&s.op-s.st>n-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(n){switch(n.ty){case 2:return this.createImage(n);case 0:return this.createComp(n);case 1:return this.createSolid(n);case 3:return this.createNull(n);case 4:return this.createShape(n);case 5:return this.createText(n);case 6:return this.createAudio(n);case 13:return this.createCamera(n);case 15:return this.createFootage(n);default:return this.createNull(n)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(n){return new AudioElement(n,this.globalData,this)},BaseRenderer.prototype.createFootage=function(n){return new FootageElement(n,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)this.buildItem(n);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(n){this.completeLayers=!1;var e,i=n.length,s,r=this.layers.length;for(e=0;e<i;e+=1)for(s=0;s<r;){if(this.layers[s].id===n[e].id){this.layers[s]=n[e];break}s+=1}},BaseRenderer.prototype.setProjectInterface=function(n){this.globalData.projectInterface=n},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(n,e,i){for(var s=this.elements,r=this.layers,a=0,o=r.length;a<o;)r[a].ind==e&&(!s[a]||s[a]===!0?(this.buildItem(a),this.addPendingElement(n)):(i.push(s[a]),s[a].setAsParent(),r[a].parent!==void 0?this.buildElementParenting(n,r[a].parent,i):n.setHierarchy(i))),a+=1},BaseRenderer.prototype.addPendingElement=function(n){this.pendingElements.push(n)},BaseRenderer.prototype.searchExtraCompositions=function(n){var e,i=n.length;for(e=0;e<i;e+=1)if(n[e].xt){var s=this.createComp(n[e]);s.initExpressions(),this.globalData.projectInterface.registerComposition(s)}},BaseRenderer.prototype.getElementById=function(n){var e,i=this.elements.length;for(e=0;e<i;e+=1)if(this.elements[e].data.ind===n)return this.elements[e];return null},BaseRenderer.prototype.getElementByPath=function(n){var e=n.shift(),i;if(typeof e=="number")i=this.elements[e];else{var s,r=this.elements.length;for(s=0;s<r;s+=1)if(this.elements[s].data.nm===e){i=this.elements[s];break}}return n.length===0?i:i.getElementByPath(n)},BaseRenderer.prototype.setupGlobalData=function(n,e){this.globalData.fontManager=new FontManager,this.globalData.slotManager=slotFactory(n),this.globalData.fontManager.addChars(n.chars),this.globalData.fontManager.addFonts(n.fonts,e),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=n.fr,this.globalData.nm=n.nm,this.globalData.compSize={w:n.w,h:n.h}};var effectTypes={TRANSFORM_EFFECT:"transformEFfect"};function TransformElement(){}TransformElement.prototype={initTransform:function(){var e=new Matrix;this.finalTransform={mProp:this.data.ks?TransformPropertyFactory.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:e,localMat:e,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var e,i=this.finalTransform.mat,s=0,r=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;s<r;){if(this.hierarchy[s].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}s+=1}if(this.finalTransform._matMdf)for(e=this.finalTransform.mProp.v.props,i.cloneFromProps(e),s=0;s<r;s+=1)i.multiply(this.hierarchy[s].finalTransform.mProp.v)}(!this.localTransforms||this.finalTransform._matMdf)&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var e=0,i=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;e<i;)this.localTransforms[e]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[e]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),e+=1;if(this.finalTransform._localMatMdf){var s=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(s),e=1;e<i;e+=1){var r=this.localTransforms[e].matrix;s.multiply(r)}s.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var a=this.finalTransform.localOpacity;for(e=0;e<i;e+=1)a*=this.localTransforms[e].opacity*.01;this.finalTransform.localOpacity=a}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var e=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);if(e.length){this.localTransforms=[],this.finalTransform.localMat=new Matrix;var i=0,s=e.length;for(i=0;i<s;i+=1)this.localTransforms.push(e[i])}}},globalToLocal:function(e){var i=[];i.push(this.finalTransform);for(var s=!0,r=this.comp;s;)r.finalTransform?(r.data.hasMask&&i.splice(0,0,r.finalTransform),r=r.comp):s=!1;var a,o=i.length,l;for(a=0;a<o;a+=1)l=i[a].mat.applyToPointArray(0,0,0),e=[e[0]-l[0],e[1]-l[1],0];return e},mHelper:new Matrix};function MaskElement(n,e,i){this.data=n,this.element=e,this.globalData=i,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var s=this.globalData.defs,r,a=this.masksProperties?this.masksProperties.length:0;this.viewData=createSizedArray(a),this.solidPath="";var o,l=this.masksProperties,u=0,c=[],f,p,d=createElementID(),m,P,T,x,y="clipPath",C="clip-path";for(r=0;r<a;r+=1)if((l[r].mode!=="a"&&l[r].mode!=="n"||l[r].inv||l[r].o.k!==100||l[r].o.x)&&(y="mask",C="mask"),(l[r].mode==="s"||l[r].mode==="i")&&u===0?(m=createNS("rect"),m.setAttribute("fill","#ffffff"),m.setAttribute("width",this.element.comp.data.w||0),m.setAttribute("height",this.element.comp.data.h||0),c.push(m)):m=null,o=createNS("path"),l[r].mode==="n")this.viewData[r]={op:PropertyFactory.getProp(this.element,l[r].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,l[r],3),elem:o,lastPath:""},s.appendChild(o);else{u+=1,o.setAttribute("fill",l[r].mode==="s"?"#000000":"#ffffff"),o.setAttribute("clip-rule","nonzero");var g;if(l[r].x.k!==0?(y="mask",C="mask",x=PropertyFactory.getProp(this.element,l[r].x,0,null,this.element),g=createElementID(),P=createNS("filter"),P.setAttribute("id",g),T=createNS("feMorphology"),T.setAttribute("operator","erode"),T.setAttribute("in","SourceGraphic"),T.setAttribute("radius","0"),P.appendChild(T),s.appendChild(P),o.setAttribute("stroke",l[r].mode==="s"?"#000000":"#ffffff")):(T=null,x=null),this.storedData[r]={elem:o,x,expan:T,lastPath:"",lastOperator:"",filterId:g,lastRadius:0},l[r].mode==="i"){p=c.length;var S=createNS("g");for(f=0;f<p;f+=1)S.appendChild(c[f]);var E=createNS("mask");E.setAttribute("mask-type","alpha"),E.setAttribute("id",d+"_"+u),E.appendChild(o),s.appendChild(E),S.setAttribute("mask","url("+getLocationHref()+"#"+d+"_"+u+")"),c.length=0,c.push(S)}else c.push(o);l[r].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[r]={elem:o,lastPath:"",op:PropertyFactory.getProp(this.element,l[r].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,l[r],3),invRect:m},this.viewData[r].prop.k||this.drawPath(l[r],this.viewData[r].prop.v,this.viewData[r])}for(this.maskElement=createNS(y),a=c.length,r=0;r<a;r+=1)this.maskElement.appendChild(c[r]);u>0&&(this.maskElement.setAttribute("id",d),this.element.maskedElement.setAttribute(C,"url("+getLocationHref()+"#"+d+")"),s.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(n){return this.viewData[n].prop},MaskElement.prototype.renderFrame=function(n){var e=this.element.finalTransform.mat,i,s=this.masksProperties.length;for(i=0;i<s;i+=1)if((this.viewData[i].prop._mdf||n)&&this.drawPath(this.masksProperties[i],this.viewData[i].prop.v,this.viewData[i]),(this.viewData[i].op._mdf||n)&&this.viewData[i].elem.setAttribute("fill-opacity",this.viewData[i].op.v),this.masksProperties[i].mode!=="n"&&(this.viewData[i].invRect&&(this.element.finalTransform.mProp._mdf||n)&&this.viewData[i].invRect.setAttribute("transform",e.getInverseMatrix().to2dCSS()),this.storedData[i].x&&(this.storedData[i].x._mdf||n))){var r=this.storedData[i].expan;this.storedData[i].x.v<0?(this.storedData[i].lastOperator!=="erode"&&(this.storedData[i].lastOperator="erode",this.storedData[i].elem.setAttribute("filter","url("+getLocationHref()+"#"+this.storedData[i].filterId+")")),r.setAttribute("radius",-this.storedData[i].x.v)):(this.storedData[i].lastOperator!=="dilate"&&(this.storedData[i].lastOperator="dilate",this.storedData[i].elem.setAttribute("filter",null)),this.storedData[i].elem.setAttribute("stroke-width",this.storedData[i].x.v*2))}},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var n="M0,0 ";return n+=" h"+this.globalData.compSize.w,n+=" v"+this.globalData.compSize.h,n+=" h-"+this.globalData.compSize.w,n+=" v-"+this.globalData.compSize.h+" ",n},MaskElement.prototype.drawPath=function(n,e,i){var s=" M"+e.v[0][0]+","+e.v[0][1],r,a;for(a=e._length,r=1;r<a;r+=1)s+=" C"+e.o[r-1][0]+","+e.o[r-1][1]+" "+e.i[r][0]+","+e.i[r][1]+" "+e.v[r][0]+","+e.v[r][1];if(e.c&&a>1&&(s+=" C"+e.o[r-1][0]+","+e.o[r-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),i.lastPath!==s){var o="";i.elem&&(e.c&&(o=n.inv?this.solidPath+s:s),i.elem.setAttribute("d",o)),i.lastPath=s}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var n={};n.createFilter=e,n.createAlphaToLuminanceFilter=i;function e(s,r){var a=createNS("filter");return a.setAttribute("id",s),r!==!0&&(a.setAttribute("filterUnits","objectBoundingBox"),a.setAttribute("x","0%"),a.setAttribute("y","0%"),a.setAttribute("width","100%"),a.setAttribute("height","100%")),a}function i(){var s=createNS("feColorMatrix");return s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),s}return n}(),featureSupport=function(){var n={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(n.maskType=!1),/firefox/i.test(navigator.userAgent)&&(n.svgLumaHidden=!1),n}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(n){var e,i="SourceGraphic",s=n.data.ef?n.data.ef.length:0,r=createElementID(),a=filtersFactory.createFilter(r,!0),o=0;this.filters=[];var l;for(e=0;e<s;e+=1){l=null;var u=n.data.ef[e].ty;if(registeredEffects$1[u]){var c=registeredEffects$1[u].effect;l=new c(a,n.effectsManager.effectElements[e],n,idPrefix+o,i),i=idPrefix+o,registeredEffects$1[u].countsAsEffect&&(o+=1)}l&&this.filters.push(l)}o&&(n.globalData.defs.appendChild(a),n.layerElement.setAttribute("filter","url("+getLocationHref()+"#"+r+")")),this.filters.length&&n.addRenderableComponent(this)}SVGEffects.prototype.renderFrame=function(n){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(n)},SVGEffects.prototype.getEffects=function(n){var e,i=this.filters.length,s=[];for(e=0;e<i;e+=1)this.filters[e].type===n&&s.push(this.filters[e]);return s};function registerEffect$1(n,e,i){registeredEffects$1[n]={effect:e,countsAsEffect:i}}function SVGBaseElement(){}SVGBaseElement.prototype={initRendererElement:function(){this.layerElement=createNS("g")},createContainerElements:function(){this.matteElement=createNS("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var e=null;if(this.data.td){this.matteMasks={};var i=createNS("g");i.setAttribute("id",this.layerId),i.appendChild(this.layerElement),e=i,this.globalData.defs.appendChild(i)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),e=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.ty===0&&!this.data.hd){var s=createNS("clipPath"),r=createNS("path");r.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var a=createElementID();if(s.setAttribute("id",a),s.appendChild(r),this.globalData.defs.appendChild(s),this.checkMasks()){var o=createNS("g");o.setAttribute("clip-path","url("+getLocationHref()+"#"+a+")"),o.appendChild(this.layerElement),this.transformedElement=o,e?e.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+a+")")}this.data.bm!==0&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData),this.renderableEffectsManager=new SVGEffects(this),this.searchEffectTransforms()},getMatte:function(e){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[e]){var i=this.layerId+"_"+e,s,r,a,o;if(e===1||e===3){var l=createNS("mask");l.setAttribute("id",i),l.setAttribute("mask-type",e===3?"luminance":"alpha"),a=createNS("use"),a.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),l.appendChild(a),this.globalData.defs.appendChild(l),!featureSupport.maskType&&e===1&&(l.setAttribute("mask-type","luminance"),s=createElementID(),r=filtersFactory.createFilter(s),this.globalData.defs.appendChild(r),r.appendChild(filtersFactory.createAlphaToLuminanceFilter()),o=createNS("g"),o.appendChild(a),l.appendChild(o),o.setAttribute("filter","url("+getLocationHref()+"#"+s+")"))}else if(e===2){var u=createNS("mask");u.setAttribute("id",i),u.setAttribute("mask-type","alpha");var c=createNS("g");u.appendChild(c),s=createElementID(),r=filtersFactory.createFilter(s);var f=createNS("feComponentTransfer");f.setAttribute("in","SourceGraphic"),r.appendChild(f);var p=createNS("feFuncA");p.setAttribute("type","table"),p.setAttribute("tableValues","1.0 0.0"),f.appendChild(p),this.globalData.defs.appendChild(r);var d=createNS("rect");d.setAttribute("width",this.comp.data.w),d.setAttribute("height",this.comp.data.h),d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("fill","#ffffff"),d.setAttribute("opacity","0"),c.setAttribute("filter","url("+getLocationHref()+"#"+s+")"),c.appendChild(d),a=createNS("use"),a.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),c.appendChild(a),featureSupport.maskType||(u.setAttribute("mask-type","luminance"),r.appendChild(filtersFactory.createAlphaToLuminanceFilter()),o=createNS("g"),c.appendChild(d),o.appendChild(this.layerElement),c.appendChild(o)),this.globalData.defs.appendChild(u)}this.matteMasks[e]=i}return this.matteMasks[e]},setMatte:function(e){this.matteElement&&this.matteElement.setAttribute("mask","url("+getLocationHref()+"#"+e+")")}};function HierarchyElement(){}HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(e){this.hierarchy=e},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}};function RenderableDOMElement(){}(function(){var n={initElement:function(i,s,r){this.initFrame(),this.initBaseData(i,s,r),this.initTransform(i,s,r),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){if(!this.hidden&&(!this.isInRange||this.isTransparent)){var i=this.baseElement||this.layerElement;i.style.display="none",this.hidden=!0}},show:function(){if(this.isInRange&&!this.isTransparent){if(!this.data.hd){var i=this.baseElement||this.layerElement;i.style.display="block"}this.hidden=!1,this._isFirstFrame=!0}},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(i){this._mdf=!1,this.prepareRenderableFrame(i),this.prepareProperties(i,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}};extendPrototype([RenderableElement,createProxyFunction(n)],RenderableDOMElement)})();function IImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.assetData&&this.assetData.sid&&(this.assetData=e.slotManager.getProp(this.assetData)),this.initElement(n,e,i),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],IImageElement),IImageElement.prototype.createContent=function(){var n=this.globalData.getAssetsPath(this.assetData);this.innerElem=createNS("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this.layerElement.appendChild(this.innerElem)},IImageElement.prototype.sourceRectAtTime=function(){return this.sourceRect};function ProcessedElement(n,e){this.elem=n,this.pos=e}function IShapeElement(){}IShapeElement.prototype={addShapeToModifiers:function(e){var i,s=this.shapeModifiers.length;for(i=0;i<s;i+=1)this.shapeModifiers[i].addShape(e)},isShapeInAnimatedModifiers:function(e){for(var i=0,s=this.shapeModifiers.length;i<s;)if(this.shapeModifiers[i].isAnimatedWithShape(e))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var e,i=this.shapes.length;for(e=0;e<i;e+=1)this.shapes[e].sh.reset();i=this.shapeModifiers.length;var s;for(e=i-1;e>=0&&(s=this.shapeModifiers[e].processShapes(this._isFirstFrame),!s);e-=1);}},searchProcessedElement:function(e){for(var i=this.processedElements,s=0,r=i.length;s<r;){if(i[s].elem===e)return i[s].pos;s+=1}return 0},addProcessedElement:function(e,i){for(var s=this.processedElements,r=s.length;r;)if(r-=1,s[r].elem===e){s[r].pos=i;return}s.push(new ProcessedElement(e,i))},prepareFrame:function(e){this.prepareRenderableFrame(e),this.prepareProperties(e,this.isInRange)}};var lineCapEnum={1:"butt",2:"round",3:"square"},lineJoinEnum={1:"miter",2:"round",3:"bevel"};function SVGShapeData(n,e,i){this.caches=[],this.styles=[],this.transformers=n,this.lStr="",this.sh=i,this.lvl=e,this._isAnimated=!!i.k;for(var s=0,r=n.length;s<r;){if(n[s].mProps.dynamicProperties.length){this._isAnimated=!0;break}s+=1}}SVGShapeData.prototype.setAsAnimated=function(){this._isAnimated=!0};function SVGStyleData(n,e){this.data=n,this.type=n.ty,this.d="",this.lvl=e,this._mdf=!1,this.closed=n.hd===!0,this.pElem=createNS("path"),this.msElem=null}SVGStyleData.prototype.reset=function(){this.d="",this._mdf=!1};function DashProperty(n,e,i,s){this.elem=n,this.frameId=-1,this.dataProps=createSizedArray(e.length),this.renderer=i,this.k=!1,this.dashStr="",this.dashArray=createTypedArray("float32",e.length?e.length-1:0),this.dashoffset=createTypedArray("float32",1),this.initDynamicPropertyContainer(s);var r,a=e.length||0,o;for(r=0;r<a;r+=1)o=PropertyFactory.getProp(n,e[r].v,0,0,this),this.k=o.k||this.k,this.dataProps[r]={n:e[r].n,p:o};this.k||this.getValue(!0),this._isAnimated=this.k}DashProperty.prototype.getValue=function(n){if(!(this.elem.globalData.frameId===this.frameId&&!n)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||n,this._mdf)){var e=0,i=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),e=0;e<i;e+=1)this.dataProps[e].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[e].p.v:this.dashArray[e]=this.dataProps[e].p.v:this.dashoffset[0]=this.dataProps[e].p.v}},extendPrototype([DynamicPropertyContainer],DashProperty);function SVGStrokeStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.w=PropertyFactory.getProp(n,e.w,0,null,this),this.d=new DashProperty(n,e.d||{},"svg",this),this.c=PropertyFactory.getProp(n,e.c,1,255,this),this.style=i,this._isAnimated=!!this._isAnimated}extendPrototype([DynamicPropertyContainer],SVGStrokeStyleData);function SVGFillStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.c=PropertyFactory.getProp(n,e.c,1,255,this),this.style=i}extendPrototype([DynamicPropertyContainer],SVGFillStyleData);function SVGNoStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.style=i}extendPrototype([DynamicPropertyContainer],SVGNoStyleData);function GradientProperty(n,e,i){this.data=e,this.c=createTypedArray("uint8c",e.p*4);var s=e.k.k[0].s?e.k.k[0].s.length-e.p*4:e.k.k.length-e.p*4;this.o=createTypedArray("float32",s),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=s,this.initDynamicPropertyContainer(i),this.prop=PropertyFactory.getProp(n,e.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}GradientProperty.prototype.comparePoints=function(n,e){for(var i=0,s=this.o.length/2,r;i<s;){if(r=Math.abs(n[i*4]-n[e*4+i*2]),r>.01)return!1;i+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var n=0,e=this.data.k.k.length;n<e;){if(!this.comparePoints(this.data.k.k[n].s,this.data.p))return!1;n+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},GradientProperty.prototype.getValue=function(n){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||n){var e,i=this.data.p*4,s,r;for(e=0;e<i;e+=1)s=e%4===0?100:255,r=Math.round(this.prop.v[e]*s),this.c[e]!==r&&(this.c[e]=r,this._cmdf=!n);if(this.o.length)for(i=this.prop.v.length,e=this.data.p*4;e<i;e+=1)s=e%2===0?100:1,r=e%2===0?Math.round(this.prop.v[e]*100):this.prop.v[e],this.o[e-this.data.p*4]!==r&&(this.o[e-this.data.p*4]=r,this._omdf=!n);this._mdf=!n}},extendPrototype([DynamicPropertyContainer],GradientProperty);function SVGGradientFillStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.initGradientData(n,e,i)}SVGGradientFillStyleData.prototype.initGradientData=function(n,e,i){this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.s=PropertyFactory.getProp(n,e.s,1,null,this),this.e=PropertyFactory.getProp(n,e.e,1,null,this),this.h=PropertyFactory.getProp(n,e.h||{k:0},0,.01,this),this.a=PropertyFactory.getProp(n,e.a||{k:0},0,degToRads,this),this.g=new GradientProperty(n,e.g,this),this.style=i,this.stops=[],this.setGradientData(i.pElem,e),this.setGradientOpacity(e,i),this._isAnimated=!!this._isAnimated},SVGGradientFillStyleData.prototype.setGradientData=function(n,e){var i=createElementID(),s=createNS(e.t===1?"linearGradient":"radialGradient");s.setAttribute("id",i),s.setAttribute("spreadMethod","pad"),s.setAttribute("gradientUnits","userSpaceOnUse");var r=[],a,o,l;for(l=e.g.p*4,o=0;o<l;o+=4)a=createNS("stop"),s.appendChild(a),r.push(a);n.setAttribute(e.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+i+")"),this.gf=s,this.cst=r},SVGGradientFillStyleData.prototype.setGradientOpacity=function(n,e){if(this.g._hasOpacity&&!this.g._collapsable){var i,s,r,a=createNS("mask"),o=createNS("path");a.appendChild(o);var l=createElementID(),u=createElementID();a.setAttribute("id",u);var c=createNS(n.t===1?"linearGradient":"radialGradient");c.setAttribute("id",l),c.setAttribute("spreadMethod","pad"),c.setAttribute("gradientUnits","userSpaceOnUse"),r=n.g.k.k[0].s?n.g.k.k[0].s.length:n.g.k.k.length;var f=this.stops;for(s=n.g.p*4;s<r;s+=2)i=createNS("stop"),i.setAttribute("stop-color","rgb(255,255,255)"),c.appendChild(i),f.push(i);o.setAttribute(n.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+l+")"),n.ty==="gs"&&(o.setAttribute("stroke-linecap",lineCapEnum[n.lc||2]),o.setAttribute("stroke-linejoin",lineJoinEnum[n.lj||2]),n.lj===1&&o.setAttribute("stroke-miterlimit",n.ml)),this.of=c,this.ms=a,this.ost=f,this.maskId=u,e.msElem=o}},extendPrototype([DynamicPropertyContainer],SVGGradientFillStyleData);function SVGGradientStrokeStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.w=PropertyFactory.getProp(n,e.w,0,null,this),this.d=new DashProperty(n,e.d||{},"svg",this),this.initGradientData(n,e,i),this._isAnimated=!!this._isAnimated}extendPrototype([SVGGradientFillStyleData,DynamicPropertyContainer],SVGGradientStrokeStyleData);function ShapeGroupData(){this.it=[],this.prevViewData=[],this.gr=createNS("g")}function SVGTransformData(n,e,i){this.transform={mProps:n,op:e,container:i},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}var buildShapeString=function(e,i,s,r){if(i===0)return"";var a=e.o,o=e.i,l=e.v,u,c=" M"+r.applyToPointStringified(l[0][0],l[0][1]);for(u=1;u<i;u+=1)c+=" C"+r.applyToPointStringified(a[u-1][0],a[u-1][1])+" "+r.applyToPointStringified(o[u][0],o[u][1])+" "+r.applyToPointStringified(l[u][0],l[u][1]);return s&&i&&(c+=" C"+r.applyToPointStringified(a[u-1][0],a[u-1][1])+" "+r.applyToPointStringified(o[0][0],o[0][1])+" "+r.applyToPointStringified(l[0][0],l[0][1]),c+="z"),c},SVGElementsRenderer=function(){var n=new Matrix,e=new Matrix,i={createRenderFunction:s};function s(p){switch(p.ty){case"fl":return l;case"gf":return c;case"gs":return u;case"st":return f;case"sh":case"el":case"rc":case"sr":return o;case"tr":return r;case"no":return a;default:return null}}function r(p,d,m){(m||d.transform.op._mdf)&&d.transform.container.setAttribute("opacity",d.transform.op.v),(m||d.transform.mProps._mdf)&&d.transform.container.setAttribute("transform",d.transform.mProps.v.to2dCSS())}function a(){}function o(p,d,m){var P,T,x,y,C,g,S=d.styles.length,E=d.lvl,A,M,b,F;for(g=0;g<S;g+=1){if(y=d.sh._mdf||m,d.styles[g].lvl<E){for(M=e.reset(),b=E-d.styles[g].lvl,F=d.transformers.length-1;!y&&b>0;)y=d.transformers[F].mProps._mdf||y,b-=1,F-=1;if(y)for(b=E-d.styles[g].lvl,F=d.transformers.length-1;b>0;)M.multiply(d.transformers[F].mProps.v),b-=1,F-=1}else M=n;if(A=d.sh.paths,T=A._length,y){for(x="",P=0;P<T;P+=1)C=A.shapes[P],C&&C._length&&(x+=buildShapeString(C,C._length,C.c,M));d.caches[g]=x}else x=d.caches[g];d.styles[g].d+=p.hd===!0?"":x,d.styles[g]._mdf=y||d.styles[g]._mdf}}function l(p,d,m){var P=d.style;(d.c._mdf||m)&&P.pElem.setAttribute("fill","rgb("+bmFloor(d.c.v[0])+","+bmFloor(d.c.v[1])+","+bmFloor(d.c.v[2])+")"),(d.o._mdf||m)&&P.pElem.setAttribute("fill-opacity",d.o.v)}function u(p,d,m){c(p,d,m),f(p,d,m)}function c(p,d,m){var P=d.gf,T=d.g._hasOpacity,x=d.s.v,y=d.e.v;if(d.o._mdf||m){var C=p.ty==="gf"?"fill-opacity":"stroke-opacity";d.style.pElem.setAttribute(C,d.o.v)}if(d.s._mdf||m){var g=p.t===1?"x1":"cx",S=g==="x1"?"y1":"cy";P.setAttribute(g,x[0]),P.setAttribute(S,x[1]),T&&!d.g._collapsable&&(d.of.setAttribute(g,x[0]),d.of.setAttribute(S,x[1]))}var E,A,M,b;if(d.g._cmdf||m){E=d.cst;var F=d.g.c;for(M=E.length,A=0;A<M;A+=1)b=E[A],b.setAttribute("offset",F[A*4]+"%"),b.setAttribute("stop-color","rgb("+F[A*4+1]+","+F[A*4+2]+","+F[A*4+3]+")")}if(T&&(d.g._omdf||m)){var G=d.g.o;for(d.g._collapsable?E=d.cst:E=d.ost,M=E.length,A=0;A<M;A+=1)b=E[A],d.g._collapsable||b.setAttribute("offset",G[A*2]+"%"),b.setAttribute("stop-opacity",G[A*2+1])}if(p.t===1)(d.e._mdf||m)&&(P.setAttribute("x2",y[0]),P.setAttribute("y2",y[1]),T&&!d.g._collapsable&&(d.of.setAttribute("x2",y[0]),d.of.setAttribute("y2",y[1])));else{var L;if((d.s._mdf||d.e._mdf||m)&&(L=Math.sqrt(Math.pow(x[0]-y[0],2)+Math.pow(x[1]-y[1],2)),P.setAttribute("r",L),T&&!d.g._collapsable&&d.of.setAttribute("r",L)),d.s._mdf||d.e._mdf||d.h._mdf||d.a._mdf||m){L||(L=Math.sqrt(Math.pow(x[0]-y[0],2)+Math.pow(x[1]-y[1],2)));var D=Math.atan2(y[1]-x[1],y[0]-x[0]),U=d.h.v;U>=1?U=.99:U<=-1&&(U=-.99);var z=L*U,O=Math.cos(D+d.a.v)*z+x[0],_=Math.sin(D+d.a.v)*z+x[1];P.setAttribute("fx",O),P.setAttribute("fy",_),T&&!d.g._collapsable&&(d.of.setAttribute("fx",O),d.of.setAttribute("fy",_))}}}function f(p,d,m){var P=d.style,T=d.d;T&&(T._mdf||m)&&T.dashStr&&(P.pElem.setAttribute("stroke-dasharray",T.dashStr),P.pElem.setAttribute("stroke-dashoffset",T.dashoffset[0])),d.c&&(d.c._mdf||m)&&P.pElem.setAttribute("stroke","rgb("+bmFloor(d.c.v[0])+","+bmFloor(d.c.v[1])+","+bmFloor(d.c.v[2])+")"),(d.o._mdf||m)&&P.pElem.setAttribute("stroke-opacity",d.o.v),(d.w._mdf||m)&&(P.pElem.setAttribute("stroke-width",d.w.v),P.msElem&&P.msElem.setAttribute("stroke-width",d.w.v))}return i}();function SVGShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(n,e,i),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var n,e=this.shapes.length,i,s,r=this.stylesList.length,a,o=[],l=!1;for(s=0;s<r;s+=1){for(a=this.stylesList[s],l=!1,o.length=0,n=0;n<e;n+=1)i=this.shapes[n],i.styles.indexOf(a)!==-1&&(o.push(i),l=i._isAnimated||l);o.length>1&&l&&this.setShapesAsAnimated(o)}},SVGShapeElement.prototype.setShapesAsAnimated=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e].setAsAnimated()},SVGShapeElement.prototype.createStyleElement=function(n,e){var i,s=new SVGStyleData(n,e),r=s.pElem;if(n.ty==="st")i=new SVGStrokeStyleData(this,n,s);else if(n.ty==="fl")i=new SVGFillStyleData(this,n,s);else if(n.ty==="gf"||n.ty==="gs"){var a=n.ty==="gf"?SVGGradientFillStyleData:SVGGradientStrokeStyleData;i=new a(this,n,s),this.globalData.defs.appendChild(i.gf),i.maskId&&(this.globalData.defs.appendChild(i.ms),this.globalData.defs.appendChild(i.of),r.setAttribute("mask","url("+getLocationHref()+"#"+i.maskId+")"))}else n.ty==="no"&&(i=new SVGNoStyleData(this,n,s));return(n.ty==="st"||n.ty==="gs")&&(r.setAttribute("stroke-linecap",lineCapEnum[n.lc||2]),r.setAttribute("stroke-linejoin",lineJoinEnum[n.lj||2]),r.setAttribute("fill-opacity","0"),n.lj===1&&r.setAttribute("stroke-miterlimit",n.ml)),n.r===2&&r.setAttribute("fill-rule","evenodd"),n.ln&&r.setAttribute("id",n.ln),n.cl&&r.setAttribute("class",n.cl),n.bm&&(r.style["mix-blend-mode"]=getBlendMode(n.bm)),this.stylesList.push(s),this.addToAnimatedContents(n,i),i},SVGShapeElement.prototype.createGroupElement=function(n){var e=new ShapeGroupData;return n.ln&&e.gr.setAttribute("id",n.ln),n.cl&&e.gr.setAttribute("class",n.cl),n.bm&&(e.gr.style["mix-blend-mode"]=getBlendMode(n.bm)),e},SVGShapeElement.prototype.createTransformElement=function(n,e){var i=TransformPropertyFactory.getTransformProperty(this,n,this),s=new SVGTransformData(i,i.o,e);return this.addToAnimatedContents(n,s),s},SVGShapeElement.prototype.createShapeElement=function(n,e,i){var s=4;n.ty==="rc"?s=5:n.ty==="el"?s=6:n.ty==="sr"&&(s=7);var r=ShapePropertyFactory.getShapeProp(this,n,s,this),a=new SVGShapeData(e,i,r);return this.shapes.push(a),this.addShapeToModifiers(a),this.addToAnimatedContents(n,a),a},SVGShapeElement.prototype.addToAnimatedContents=function(n,e){for(var i=0,s=this.animatedContents.length;i<s;){if(this.animatedContents[i].element===e)return;i+=1}this.animatedContents.push({fn:SVGElementsRenderer.createRenderFunction(n),element:e,data:n})},SVGShapeElement.prototype.setElementStyles=function(n){var e=n.styles,i,s=this.stylesList.length;for(i=0;i<s;i+=1)e.indexOf(this.stylesList[i])===-1&&!this.stylesList[i].closed&&e.push(this.stylesList[i])},SVGShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var n,e=this.itemsData.length;for(n=0;n<e;n+=1)this.prevViewData[n]=this.itemsData[n];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),e=this.dynamicProperties.length,n=0;n<e;n+=1)this.dynamicProperties[n].getValue();this.renderModifiers()},SVGShapeElement.prototype.searchShapes=function(n,e,i,s,r,a,o){var l=[].concat(a),u,c=n.length-1,f,p,d=[],m=[],P,T,x;for(u=c;u>=0;u-=1){if(x=this.searchProcessedElement(n[u]),x?e[u]=i[x-1]:n[u]._render=o,n[u].ty==="fl"||n[u].ty==="st"||n[u].ty==="gf"||n[u].ty==="gs"||n[u].ty==="no")x?e[u].style.closed=n[u].hd:e[u]=this.createStyleElement(n[u],r),n[u]._render&&e[u].style.pElem.parentNode!==s&&s.appendChild(e[u].style.pElem),d.push(e[u].style);else if(n[u].ty==="gr"){if(!x)e[u]=this.createGroupElement(n[u]);else for(p=e[u].it.length,f=0;f<p;f+=1)e[u].prevViewData[f]=e[u].it[f];this.searchShapes(n[u].it,e[u].it,e[u].prevViewData,e[u].gr,r+1,l,o),n[u]._render&&e[u].gr.parentNode!==s&&s.appendChild(e[u].gr)}else n[u].ty==="tr"?(x||(e[u]=this.createTransformElement(n[u],s)),P=e[u].transform,l.push(P)):n[u].ty==="sh"||n[u].ty==="rc"||n[u].ty==="el"||n[u].ty==="sr"?(x||(e[u]=this.createShapeElement(n[u],l,r)),this.setElementStyles(e[u])):n[u].ty==="tm"||n[u].ty==="rd"||n[u].ty==="ms"||n[u].ty==="pb"||n[u].ty==="zz"||n[u].ty==="op"?(x?(T=e[u],T.closed=!1):(T=ShapeModifiers.getModifier(n[u].ty),T.init(this,n[u]),e[u]=T,this.shapeModifiers.push(T)),m.push(T)):n[u].ty==="rp"&&(x?(T=e[u],T.closed=!0):(T=ShapeModifiers.getModifier(n[u].ty),e[u]=T,T.init(this,n,u,e),this.shapeModifiers.push(T),o=!1),m.push(T));this.addProcessedElement(n[u],u+1)}for(c=d.length,u=0;u<c;u+=1)d[u].closed=!0;for(c=m.length,u=0;u<c;u+=1)m[u].closed=!0},SVGShapeElement.prototype.renderInnerContent=function(){this.renderModifiers();var n,e=this.stylesList.length;for(n=0;n<e;n+=1)this.stylesList[n].reset();for(this.renderShape(),n=0;n<e;n+=1)(this.stylesList[n]._mdf||this._isFirstFrame)&&(this.stylesList[n].msElem&&(this.stylesList[n].msElem.setAttribute("d",this.stylesList[n].d),this.stylesList[n].d="M0 0"+this.stylesList[n].d),this.stylesList[n].pElem.setAttribute("d",this.stylesList[n].d||"M0 0"))},SVGShapeElement.prototype.renderShape=function(){var n,e=this.animatedContents.length,i;for(n=0;n<e;n+=1)i=this.animatedContents[n],(this._isFirstFrame||i.element._isAnimated)&&i.data!==!0&&i.fn(i.data,i.element,this._isFirstFrame)},SVGShapeElement.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null};function LetterProps(n,e,i,s,r,a){this.o=n,this.sw=e,this.sc=i,this.fc=s,this.m=r,this.p=a,this._mdf={o:!0,sw:!!e,sc:!!i,fc:!!s,m:!0,p:!0}}LetterProps.prototype.update=function(n,e,i,s,r,a){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var o=!1;return this.o!==n&&(this.o=n,this._mdf.o=!0,o=!0),this.sw!==e&&(this.sw=e,this._mdf.sw=!0,o=!0),this.sc!==i&&(this.sc=i,this._mdf.sc=!0,o=!0),this.fc!==s&&(this.fc=s,this._mdf.fc=!0,o=!0),this.m!==r&&(this.m=r,this._mdf.m=!0,o=!0),a.length&&(this.p[0]!==a[0]||this.p[1]!==a[1]||this.p[4]!==a[4]||this.p[5]!==a[5]||this.p[12]!==a[12]||this.p[13]!==a[13])&&(this.p=a,this._mdf.p=!0,o=!0),o};function TextProperty(n,e){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,e.d&&e.d.sid&&(e.d=n.globalData.slotManager.getProp(e.d)),this.data=e,this.elem=n,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}TextProperty.prototype.defaultBoxWidth=[0,0],TextProperty.prototype.copyData=function(n,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},TextProperty.prototype.setCurrentData=function(n){n.__complete||this.completeTextData(n),this.currentData=n,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},TextProperty.prototype.searchProperty=function(){return this.searchKeyframes()},TextProperty.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(n){this.effectsSequence.push(n),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(n){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!n)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,i=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var s,r=this.effectsSequence.length,a=n||this.data.d.k[this.keysIndex].s;for(s=0;s<r;s+=1)i!==this.keysIndex?a=this.effectsSequence[s](a,a.t):a=this.effectsSequence[s](this.currentData,a.t);e!==a&&this.setCurrentData(a),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}},TextProperty.prototype.getKeyframeValue=function(){for(var n=this.data.d.k,e=this.elem.comp.renderedFrame,i=0,s=n.length;i<=s-1&&!(i===s-1||n[i+1].t>e);)i+=1;return this.keysIndex!==i&&(this.keysIndex=i),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(n){for(var e=[],i=0,s=n.length,r,a,o=!1,l=!1,u="";i<s;)o=l,l=!1,r=n.charCodeAt(i),u=n.charAt(i),FontManager.isCombinedCharacter(r)?o=!0:r>=55296&&r<=56319?FontManager.isRegionalFlag(n,i)?u=n.substr(i,14):(a=n.charCodeAt(i+1),a>=56320&&a<=57343&&(FontManager.isModifier(r,a)?(u=n.substr(i,2),o=!0):FontManager.isFlagEmoji(n.substr(i,4))?u=n.substr(i,4):u=n.substr(i,2))):r>56319?(a=n.charCodeAt(i+1),FontManager.isVariationSelector(r)&&(o=!0)):FontManager.isZeroWidthJoiner(r)&&(o=!0,l=!0),o?(e[e.length-1]+=u,o=!1):e.push(u),i+=u.length;return e},TextProperty.prototype.completeTextData=function(n){n.__complete=!0;var e=this.elem.globalData.fontManager,i=this.data,s=[],r,a,o,l=0,u,c=i.m.g,f=0,p=0,d=0,m=[],P=0,T=0,x,y,C=e.getFontByName(n.f),g,S=0,E=getFontProperties(C);n.fWeight=E.weight,n.fStyle=E.style,n.finalSize=n.s,n.finalText=this.buildFinalText(n.t),a=n.finalText.length,n.finalLineHeight=n.lh;var A=n.tr/1e3*n.finalSize,M;if(n.sz)for(var b=!0,F=n.sz[0],G=n.sz[1],L,D;b;){D=this.buildFinalText(n.t),L=0,P=0,a=D.length,A=n.tr/1e3*n.finalSize;var U=-1;for(r=0;r<a;r+=1)M=D[r].charCodeAt(0),o=!1,D[r]===" "?U=r:(M===13||M===3)&&(P=0,o=!0,L+=n.finalLineHeight||n.finalSize*1.2),e.chars?(g=e.getCharData(D[r],C.fStyle,C.fFamily),S=o?0:g.w*n.finalSize/100):S=e.measureText(D[r],n.f,n.finalSize),P+S>F&&D[r]!==" "?(U===-1?a+=1:r=U,L+=n.finalLineHeight||n.finalSize*1.2,D.splice(r,U===r?1:0,"\r"),U=-1,P=0):(P+=S,P+=A);L+=C.ascent*n.finalSize/100,this.canResize&&n.finalSize>this.minimumFontSize&&G<L?(n.finalSize-=1,n.finalLineHeight=n.finalSize*n.lh/n.s):(n.finalText=D,a=n.finalText.length,b=!1)}P=-A,S=0;var z=0,O;for(r=0;r<a;r+=1)if(o=!1,O=n.finalText[r],M=O.charCodeAt(0),M===13||M===3?(z=0,m.push(P),T=P>T?P:T,P=-2*A,u="",o=!0,d+=1):u=O,e.chars?(g=e.getCharData(O,C.fStyle,e.getFontByName(n.f).fFamily),S=o?0:g.w*n.finalSize/100):S=e.measureText(u,n.f,n.finalSize),O===" "?z+=S+A:(P+=S+A+z,z=0),s.push({l:S,an:S,add:f,n:o,anIndexes:[],val:u,line:d,animatorJustifyOffset:0}),c==2){if(f+=S,u===""||u===" "||r===a-1){for((u===""||u===" ")&&(f-=S);p<=r;)s[p].an=f,s[p].ind=l,s[p].extra=S,p+=1;l+=1,f=0}}else if(c==3){if(f+=S,u===""||r===a-1){for(u===""&&(f-=S);p<=r;)s[p].an=f,s[p].ind=l,s[p].extra=S,p+=1;f=0,l+=1}}else s[l].ind=l,s[l].extra=0,l+=1;if(n.l=s,T=P>T?P:T,m.push(P),n.sz)n.boxWidth=n.sz[0],n.justifyOffset=0;else switch(n.boxWidth=T,n.j){case 1:n.justifyOffset=-n.boxWidth;break;case 2:n.justifyOffset=-n.boxWidth/2;break;default:n.justifyOffset=0}n.lineWidths=m;var _=i.a,I,V;y=_.length;var B,k,R=[];for(x=0;x<y;x+=1){for(I=_[x],I.a.sc&&(n.strokeColorAnim=!0),I.a.sw&&(n.strokeWidthAnim=!0),(I.a.fc||I.a.fh||I.a.fs||I.a.fb)&&(n.fillColorAnim=!0),k=0,B=I.s.b,r=0;r<a;r+=1)V=s[r],V.anIndexes[x]=k,(B==1&&V.val!==""||B==2&&V.val!==""&&V.val!==" "||B==3&&(V.n||V.val==" "||r==a-1)||B==4&&(V.n||r==a-1))&&(I.s.rn===1&&R.push(k),k+=1);i.a[x].s.totalChars=k;var N=-1,H;if(I.s.rn===1)for(r=0;r<a;r+=1)V=s[r],N!=V.anIndexes[x]&&(N=V.anIndexes[x],H=R.splice(Math.floor(Math.random()*R.length),1)[0]),V.anIndexes[x]=H}n.yOffset=n.finalLineHeight||n.finalSize*1.2,n.ls=n.ls||0,n.ascent=C.ascent*n.finalSize/100},TextProperty.prototype.updateDocumentData=function(n,e){e=e===void 0?this.keysIndex:e;var i=this.copyData({},this.data.d.k[e].s);i=this.copyData(i,n),this.data.d.k[e].s=i,this.recalculate(e),this.setCurrentData(i),this.elem.addDynamicProperty(this)},TextProperty.prototype.recalculate=function(n){var e=this.data.d.k[n].s;e.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(e)},TextProperty.prototype.canResizeFont=function(n){this.canResize=n,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},TextProperty.prototype.setMinimumFontSize=function(n){this.minimumFontSize=Math.floor(n)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var TextSelectorProp=function(){var n=Math.max,e=Math.min,i=Math.floor;function s(a,o){this._currentTextLength=-1,this.k=!1,this.data=o,this.elem=a,this.comp=a.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(a),this.s=PropertyFactory.getProp(a,o.s||{k:0},0,0,this),"e"in o?this.e=PropertyFactory.getProp(a,o.e,0,0,this):this.e={v:100},this.o=PropertyFactory.getProp(a,o.o||{k:0},0,0,this),this.xe=PropertyFactory.getProp(a,o.xe||{k:0},0,0,this),this.ne=PropertyFactory.getProp(a,o.ne||{k:0},0,0,this),this.sm=PropertyFactory.getProp(a,o.sm||{k:100},0,0,this),this.a=PropertyFactory.getProp(a,o.a,0,.01,this),this.dynamicProperties.length||this.getValue()}s.prototype={getMult:function(o){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var l=0,u=0,c=1,f=1;this.ne.v>0?l=this.ne.v/100:u=-this.ne.v/100,this.xe.v>0?c=1-this.xe.v/100:f=1+this.xe.v/100;var p=BezierFactory.getBezierEasing(l,u,c,f).get,d=0,m=this.finalS,P=this.finalE,T=this.data.sh;if(T===2)P===m?d=o>=P?1:0:d=n(0,e(.5/(P-m)+(o-m)/(P-m),1)),d=p(d);else if(T===3)P===m?d=o>=P?0:1:d=1-n(0,e(.5/(P-m)+(o-m)/(P-m),1)),d=p(d);else if(T===4)P===m?d=0:(d=n(0,e(.5/(P-m)+(o-m)/(P-m),1)),d<.5?d*=2:d=1-2*(d-.5)),d=p(d);else if(T===5){if(P===m)d=0;else{var x=P-m;o=e(n(0,o+.5-m),P-m);var y=-x/2+o,C=x/2;d=Math.sqrt(1-y*y/(C*C))}d=p(d)}else T===6?(P===m?d=0:(o=e(n(0,o+.5-m),P-m),d=(1+Math.cos(Math.PI+Math.PI*2*o/(P-m)))/2),d=p(d)):(o>=i(m)&&(o-m<0?d=n(0,e(e(P,1)-(m-o),1)):d=n(0,e(P-o,1))),d=p(d));if(this.sm.v!==100){var g=this.sm.v*.01;g===0&&(g=1e-8);var S=.5-g*.5;d<S?d=0:(d=(d-S)/g,d>1&&(d=1))}return d*this.a.v},getValue:function(o){this.iterateDynamicProperties(),this._mdf=o||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,o&&this.data.r===2&&(this.e.v=this._currentTextLength);var l=this.data.r===2?1:100/this.data.totalChars,u=this.o.v/l,c=this.s.v/l+u,f=this.e.v/l+u;if(c>f){var p=c;c=f,f=p}this.finalS=c,this.finalE=f}},extendPrototype([DynamicPropertyContainer],s);function r(a,o,l){return new s(a,o)}return{getTextSelectorProp:r}}();function TextAnimatorDataProperty(n,e,i){var s={propType:!1},r=PropertyFactory.getProp,a=e.a;this.a={r:a.r?r(n,a.r,0,degToRads,i):s,rx:a.rx?r(n,a.rx,0,degToRads,i):s,ry:a.ry?r(n,a.ry,0,degToRads,i):s,sk:a.sk?r(n,a.sk,0,degToRads,i):s,sa:a.sa?r(n,a.sa,0,degToRads,i):s,s:a.s?r(n,a.s,1,.01,i):s,a:a.a?r(n,a.a,1,0,i):s,o:a.o?r(n,a.o,0,.01,i):s,p:a.p?r(n,a.p,1,0,i):s,sw:a.sw?r(n,a.sw,0,0,i):s,sc:a.sc?r(n,a.sc,1,0,i):s,fc:a.fc?r(n,a.fc,1,0,i):s,fh:a.fh?r(n,a.fh,0,0,i):s,fs:a.fs?r(n,a.fs,0,.01,i):s,fb:a.fb?r(n,a.fb,0,.01,i):s,t:a.t?r(n,a.t,0,0,i):s},this.s=TextSelectorProp.getTextSelectorProp(n,e.s,i),this.s.t=e.s.t}function TextAnimatorProperty(n,e,i){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=n,this._renderType=e,this._elem=i,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(i)}TextAnimatorProperty.prototype.searchProperties=function(){var n,e=this._textData.a.length,i,s=PropertyFactory.getProp;for(n=0;n<e;n+=1)i=this._textData.a[n],this._animatorsData[n]=new TextAnimatorDataProperty(this._elem,i,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:s(this._elem,this._textData.p.a,0,0,this),f:s(this._elem,this._textData.p.f,0,0,this),l:s(this._elem,this._textData.p.l,0,0,this),r:s(this._elem,this._textData.p.r,0,0,this),p:s(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=s(this._elem,this._textData.m.a,1,0,this)},TextAnimatorProperty.prototype.getMeasures=function(n,e){if(this.lettersChangedFlag=e,!(!this._mdf&&!this._isFirstFrame&&!e&&(!this._hasMaskedPath||!this._pathData.m._mdf))){this._isFirstFrame=!1;var i=this._moreOptions.alignment.v,s=this._animatorsData,r=this._textData,a=this.mHelper,o=this._renderType,l=this.renderedLetters.length,u,c,f,p,d=n.l,m,P,T,x,y,C,g,S,E,A,M,b,F,G,L;if(this._hasMaskedPath){if(L=this._pathData.m,!this._pathData.n||this._pathData._mdf){var D=L.v;this._pathData.r.v&&(D=D.reverse()),m={tLength:0,segments:[]},p=D._length-1;var U;for(b=0,f=0;f<p;f+=1)U=bez.buildBezierData(D.v[f],D.v[f+1],[D.o[f][0]-D.v[f][0],D.o[f][1]-D.v[f][1]],[D.i[f+1][0]-D.v[f+1][0],D.i[f+1][1]-D.v[f+1][1]]),m.tLength+=U.segmentLength,m.segments.push(U),b+=U.segmentLength;f=p,L.v.c&&(U=bez.buildBezierData(D.v[f],D.v[0],[D.o[f][0]-D.v[f][0],D.o[f][1]-D.v[f][1]],[D.i[0][0]-D.v[0][0],D.i[0][1]-D.v[0][1]]),m.tLength+=U.segmentLength,m.segments.push(U),b+=U.segmentLength),this._pathData.pi=m}if(m=this._pathData.pi,P=this._pathData.f.v,g=0,C=1,x=0,y=!0,A=m.segments,P<0&&L.v.c)for(m.tLength<Math.abs(P)&&(P=-Math.abs(P)%m.tLength),g=A.length-1,E=A[g].points,C=E.length-1;P<0;)P+=E[C].partialLength,C-=1,C<0&&(g-=1,E=A[g].points,C=E.length-1);E=A[g].points,S=E[C-1],T=E[C],M=T.partialLength}p=d.length,u=0,c=0;var z=n.finalSize*1.2*.714,O=!0,_,I,V,B,k;B=s.length;var R,N=-1,H,J,$,W=P,Z=g,ie=C,ge=-1,ve,ce,Te,ne,K,he,ee,Q,te="",ye=this.defaultPropsArray,le;if(n.j===2||n.j===1){var fe=0,Se=0,de=n.j===2?-.5:-1,Ve=0,Pe=!0;for(f=0;f<p;f+=1)if(d[f].n){for(fe&&(fe+=Se);Ve<f;)d[Ve].animatorJustifyOffset=fe,Ve+=1;fe=0,Pe=!0}else{for(V=0;V<B;V+=1)_=s[V].a,_.t.propType&&(Pe&&n.j===2&&(Se+=_.t.v*de),I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),R.length?fe+=_.t.v*R[0]*de:fe+=_.t.v*R*de);Pe=!1}for(fe&&(fe+=Se);Ve<f;)d[Ve].animatorJustifyOffset=fe,Ve+=1}for(f=0;f<p;f+=1){if(a.reset(),ve=1,d[f].n)u=0,c+=n.yOffset,c+=O?1:0,P=W,O=!1,this._hasMaskedPath&&(g=Z,C=ie,E=A[g].points,S=E[C-1],T=E[C],M=T.partialLength,x=0),te="",Q="",he="",le="",ye=this.defaultPropsArray;else{if(this._hasMaskedPath){if(ge!==d[f].line){switch(n.j){case 1:P+=b-n.lineWidths[d[f].line];break;case 2:P+=(b-n.lineWidths[d[f].line])/2;break}ge=d[f].line}N!==d[f].ind&&(d[N]&&(P+=d[N].extra),P+=d[f].an/2,N=d[f].ind),P+=i[0]*d[f].an*.005;var oe=0;for(V=0;V<B;V+=1)_=s[V].a,_.p.propType&&(I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),R.length?oe+=_.p.v[0]*R[0]:oe+=_.p.v[0]*R),_.a.propType&&(I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),R.length?oe+=_.a.v[0]*R[0]:oe+=_.a.v[0]*R);for(y=!0,this._pathData.a.v&&(P=d[0].an*.5+(b-this._pathData.f.v-d[0].an*.5-d[d.length-1].an*.5)*N/(p-1),P+=this._pathData.f.v);y;)x+M>=P+oe||!E?(F=(P+oe-x)/T.partialLength,J=S.point[0]+(T.point[0]-S.point[0])*F,$=S.point[1]+(T.point[1]-S.point[1])*F,a.translate(-i[0]*d[f].an*.005,-(i[1]*z)*.01),y=!1):E&&(x+=T.partialLength,C+=1,C>=E.length&&(C=0,g+=1,A[g]?E=A[g].points:L.v.c?(C=0,g=0,E=A[g].points):(x-=T.partialLength,E=null)),E&&(S=T,T=E[C],M=T.partialLength));H=d[f].an/2-d[f].add,a.translate(-H,0,0)}else H=d[f].an/2-d[f].add,a.translate(-H,0,0),a.translate(-i[0]*d[f].an*.005,-i[1]*z*.01,0);for(V=0;V<B;V+=1)_=s[V].a,_.t.propType&&(I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),(u!==0||n.j!==0)&&(this._hasMaskedPath?R.length?P+=_.t.v*R[0]:P+=_.t.v*R:R.length?u+=_.t.v*R[0]:u+=_.t.v*R));for(n.strokeWidthAnim&&(Te=n.sw||0),n.strokeColorAnim&&(n.sc?ce=[n.sc[0],n.sc[1],n.sc[2]]:ce=[0,0,0]),n.fillColorAnim&&n.fc&&(ne=[n.fc[0],n.fc[1],n.fc[2]]),V=0;V<B;V+=1)_=s[V].a,_.a.propType&&(I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),R.length?a.translate(-_.a.v[0]*R[0],-_.a.v[1]*R[1],_.a.v[2]*R[2]):a.translate(-_.a.v[0]*R,-_.a.v[1]*R,_.a.v[2]*R));for(V=0;V<B;V+=1)_=s[V].a,_.s.propType&&(I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),R.length?a.scale(1+(_.s.v[0]-1)*R[0],1+(_.s.v[1]-1)*R[1],1):a.scale(1+(_.s.v[0]-1)*R,1+(_.s.v[1]-1)*R,1));for(V=0;V<B;V+=1){if(_=s[V].a,I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),_.sk.propType&&(R.length?a.skewFromAxis(-_.sk.v*R[0],_.sa.v*R[1]):a.skewFromAxis(-_.sk.v*R,_.sa.v*R)),_.r.propType&&(R.length?a.rotateZ(-_.r.v*R[2]):a.rotateZ(-_.r.v*R)),_.ry.propType&&(R.length?a.rotateY(_.ry.v*R[1]):a.rotateY(_.ry.v*R)),_.rx.propType&&(R.length?a.rotateX(_.rx.v*R[0]):a.rotateX(_.rx.v*R)),_.o.propType&&(R.length?ve+=(_.o.v*R[0]-ve)*R[0]:ve+=(_.o.v*R-ve)*R),n.strokeWidthAnim&&_.sw.propType&&(R.length?Te+=_.sw.v*R[0]:Te+=_.sw.v*R),n.strokeColorAnim&&_.sc.propType)for(K=0;K<3;K+=1)R.length?ce[K]+=(_.sc.v[K]-ce[K])*R[0]:ce[K]+=(_.sc.v[K]-ce[K])*R;if(n.fillColorAnim&&n.fc){if(_.fc.propType)for(K=0;K<3;K+=1)R.length?ne[K]+=(_.fc.v[K]-ne[K])*R[0]:ne[K]+=(_.fc.v[K]-ne[K])*R;_.fh.propType&&(R.length?ne=addHueToRGB(ne,_.fh.v*R[0]):ne=addHueToRGB(ne,_.fh.v*R)),_.fs.propType&&(R.length?ne=addSaturationToRGB(ne,_.fs.v*R[0]):ne=addSaturationToRGB(ne,_.fs.v*R)),_.fb.propType&&(R.length?ne=addBrightnessToRGB(ne,_.fb.v*R[0]):ne=addBrightnessToRGB(ne,_.fb.v*R))}}for(V=0;V<B;V+=1)_=s[V].a,_.p.propType&&(I=s[V].s,R=I.getMult(d[f].anIndexes[V],r.a[V].s.totalChars),this._hasMaskedPath?R.length?a.translate(0,_.p.v[1]*R[0],-_.p.v[2]*R[1]):a.translate(0,_.p.v[1]*R,-_.p.v[2]*R):R.length?a.translate(_.p.v[0]*R[0],_.p.v[1]*R[1],-_.p.v[2]*R[2]):a.translate(_.p.v[0]*R,_.p.v[1]*R,-_.p.v[2]*R));if(n.strokeWidthAnim&&(he=Te<0?0:Te),n.strokeColorAnim&&(ee="rgb("+Math.round(ce[0]*255)+","+Math.round(ce[1]*255)+","+Math.round(ce[2]*255)+")"),n.fillColorAnim&&n.fc&&(Q="rgb("+Math.round(ne[0]*255)+","+Math.round(ne[1]*255)+","+Math.round(ne[2]*255)+")"),this._hasMaskedPath){if(a.translate(0,-n.ls),a.translate(0,i[1]*z*.01+c,0),this._pathData.p.v){G=(T.point[1]-S.point[1])/(T.point[0]-S.point[0]);var Me=Math.atan(G)*180/Math.PI;T.point[0]<S.point[0]&&(Me+=180),a.rotate(-Me*Math.PI/180)}a.translate(J,$,0),P-=i[0]*d[f].an*.005,d[f+1]&&N!==d[f+1].ind&&(P+=d[f].an/2,P+=n.tr*.001*n.finalSize)}else{switch(a.translate(u,c,0),n.ps&&a.translate(n.ps[0],n.ps[1]+n.ascent,0),n.j){case 1:a.translate(d[f].animatorJustifyOffset+n.justifyOffset+(n.boxWidth-n.lineWidths[d[f].line]),0,0);break;case 2:a.translate(d[f].animatorJustifyOffset+n.justifyOffset+(n.boxWidth-n.lineWidths[d[f].line])/2,0,0);break}a.translate(0,-n.ls),a.translate(H,0,0),a.translate(i[0]*d[f].an*.005,i[1]*z*.01,0),u+=d[f].l+n.tr*.001*n.finalSize}o==="html"?te=a.toCSS():o==="svg"?te=a.to2dCSS():ye=[a.props[0],a.props[1],a.props[2],a.props[3],a.props[4],a.props[5],a.props[6],a.props[7],a.props[8],a.props[9],a.props[10],a.props[11],a.props[12],a.props[13],a.props[14],a.props[15]],le=ve}l<=f?(k=new LetterProps(le,he,ee,Q,te,ye),this.renderedLetters.push(k),l+=1,this.lettersChangedFlag=!0):(k=this.renderedLetters[f],this.lettersChangedFlag=k.update(le,he,ee,Q,te,ye)||this.lettersChangedFlag)}}},TextAnimatorProperty.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},TextAnimatorProperty.prototype.mHelper=new Matrix,TextAnimatorProperty.prototype.defaultPropsArray=[],extendPrototype([DynamicPropertyContainer],TextAnimatorProperty);function ITextElement(){}ITextElement.prototype.initElement=function(n,e,i){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(n,e,i),this.textProperty=new TextProperty(this,n.t,this.dynamicProperties),this.textAnimator=new TextAnimatorProperty(n.t,this.renderType,this),this.initTransform(n,e,i),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(n){this._mdf=!1,this.prepareRenderableFrame(n),this.prepareProperties(n,this.isInRange)},ITextElement.prototype.createPathShape=function(n,e){var i,s=e.length,r,a="";for(i=0;i<s;i+=1)e[i].ty==="sh"&&(r=e[i].ks.k,a+=buildShapeString(r,r.i.length,!0,n));return a},ITextElement.prototype.updateDocumentData=function(n,e){this.textProperty.updateDocumentData(n,e)},ITextElement.prototype.canResizeFont=function(n){this.textProperty.canResizeFont(n)},ITextElement.prototype.setMinimumFontSize=function(n){this.textProperty.setMinimumFontSize(n)},ITextElement.prototype.applyTextPropertiesToMatrix=function(n,e,i,s,r){switch(n.ps&&e.translate(n.ps[0],n.ps[1]+n.ascent,0),e.translate(0,-n.ls,0),n.j){case 1:e.translate(n.justifyOffset+(n.boxWidth-n.lineWidths[i]),0,0);break;case 2:e.translate(n.justifyOffset+(n.boxWidth-n.lineWidths[i])/2,0,0);break}e.translate(s,r,0)},ITextElement.prototype.buildColor=function(n){return"rgb("+Math.round(n[0]*255)+","+Math.round(n[1]*255)+","+Math.round(n[2]*255)+")"},ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){},ITextElement.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var emptyShapeData={shapes:[]};function SVGTextLottieElement(n,e,i){this.textSpans=[],this.renderType="svg",this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],SVGTextLottieElement),SVGTextLottieElement.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=createNS("text"))},SVGTextLottieElement.prototype.buildTextContents=function(n){for(var e=0,i=n.length,s=[],r="";e<i;)n[e]==="\r"||n[e]===""?(s.push(r),r=""):r+=n[e],e+=1;return s.push(r),s},SVGTextLottieElement.prototype.buildShapeData=function(n,e){if(n.shapes&&n.shapes.length){var i=n.shapes[0];if(i.it){var s=i.it[i.it.length-1];s.s&&(s.s.k[0]=e,s.s.k[1]=e)}}return n},SVGTextLottieElement.prototype.buildNewText=function(){this.addDynamicProperty(this);var n,e,i=this.textProperty.currentData;this.renderedLetters=createSizedArray(i?i.l.length:0),i.fc?this.layerElement.setAttribute("fill",this.buildColor(i.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),i.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(i.sc)),this.layerElement.setAttribute("stroke-width",i.sw)),this.layerElement.setAttribute("font-size",i.finalSize);var s=this.globalData.fontManager.getFontByName(i.f);if(s.fClass)this.layerElement.setAttribute("class",s.fClass);else{this.layerElement.setAttribute("font-family",s.fFamily);var r=i.fWeight,a=i.fStyle;this.layerElement.setAttribute("font-style",a),this.layerElement.setAttribute("font-weight",r)}this.layerElement.setAttribute("aria-label",i.t);var o=i.l||[],l=!!this.globalData.fontManager.chars;e=o.length;var u,c=this.mHelper,f="",p=this.data.singleShape,d=0,m=0,P=!0,T=i.tr*.001*i.finalSize;if(p&&!l&&!i.sz){var x=this.textContainer,y="start";switch(i.j){case 1:y="end";break;case 2:y="middle";break;default:y="start";break}x.setAttribute("text-anchor",y),x.setAttribute("letter-spacing",T);var C=this.buildTextContents(i.finalText);for(e=C.length,m=i.ps?i.ps[1]+i.ascent:0,n=0;n<e;n+=1)u=this.textSpans[n].span||createNS("tspan"),u.textContent=C[n],u.setAttribute("x",0),u.setAttribute("y",m),u.style.display="inherit",x.appendChild(u),this.textSpans[n]||(this.textSpans[n]={span:null,glyph:null}),this.textSpans[n].span=u,m+=i.finalLineHeight;this.layerElement.appendChild(x)}else{var g=this.textSpans.length,S;for(n=0;n<e;n+=1){if(this.textSpans[n]||(this.textSpans[n]={span:null,childSpan:null,glyph:null}),!l||!p||n===0){if(u=g>n?this.textSpans[n].span:createNS(l?"g":"text"),g<=n){if(u.setAttribute("stroke-linecap","butt"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit","4"),this.textSpans[n].span=u,l){var E=createNS("g");u.appendChild(E),this.textSpans[n].childSpan=E}this.textSpans[n].span=u,this.layerElement.appendChild(u)}u.style.display="inherit"}if(c.reset(),p&&(o[n].n&&(d=-T,m+=i.yOffset,m+=P?1:0,P=!1),this.applyTextPropertiesToMatrix(i,c,o[n].line,d,m),d+=o[n].l||0,d+=T),l){S=this.globalData.fontManager.getCharData(i.finalText[n],s.fStyle,this.globalData.fontManager.getFontByName(i.f).fFamily);var A;if(S.t===1)A=new SVGCompElement(S.data,this.globalData,this);else{var M=emptyShapeData;S.data&&S.data.shapes&&(M=this.buildShapeData(S.data,i.finalSize)),A=new SVGShapeElement(M,this.globalData,this)}if(this.textSpans[n].glyph){var b=this.textSpans[n].glyph;this.textSpans[n].childSpan.removeChild(b.layerElement),b.destroy()}this.textSpans[n].glyph=A,A._debug=!0,A.prepareFrame(0),A.renderFrame(),this.textSpans[n].childSpan.appendChild(A.layerElement),S.t===1&&this.textSpans[n].childSpan.setAttribute("transform","scale("+i.finalSize/100+","+i.finalSize/100+")")}else p&&u.setAttribute("transform","translate("+c.props[12]+","+c.props[13]+")"),u.textContent=o[n].val,u.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}p&&u&&u.setAttribute("d",f)}for(;n<this.textSpans.length;)this.textSpans[n].span.style.display="none",n+=1;this._sizeChanged=!0},SVGTextLottieElement.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var n=this.layerElement.getBBox();this.bbox={top:n.y,left:n.x,width:n.width,height:n.height}}return this.bbox},SVGTextLottieElement.prototype.getValue=function(){var n,e=this.textSpans.length,i;for(this.renderedFrame=this.comp.renderedFrame,n=0;n<e;n+=1)i=this.textSpans[n].glyph,i&&(i.prepareFrame(this.comp.renderedFrame-this.data.st),i._mdf&&(this._mdf=!0))},SVGTextLottieElement.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){this._sizeChanged=!0;var n,e,i=this.textAnimator.renderedLetters,s=this.textProperty.currentData.l;e=s.length;var r,a,o;for(n=0;n<e;n+=1)s[n].n||(r=i[n],a=this.textSpans[n].span,o=this.textSpans[n].glyph,o&&o.renderFrame(),r._mdf.m&&a.setAttribute("transform",r.m),r._mdf.o&&a.setAttribute("opacity",r.o),r._mdf.sw&&a.setAttribute("stroke-width",r.sw),r._mdf.sc&&a.setAttribute("stroke",r.sc),r._mdf.fc&&a.setAttribute("fill",r.fc))}};function ISolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([IImageElement],ISolidElement),ISolidElement.prototype.createContent=function(){var n=createNS("rect");n.setAttribute("width",this.data.sw),n.setAttribute("height",this.data.sh),n.setAttribute("fill",this.data.sc),this.layerElement.appendChild(n)};function NullElement(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initFrame(),this.initTransform(n,e,i),this.initHierarchy()}NullElement.prototype.prepareFrame=function(n){this.prepareProperties(n,!0)},NullElement.prototype.renderFrame=function(){},NullElement.prototype.getBaseElement=function(){return null},NullElement.prototype.destroy=function(){},NullElement.prototype.sourceRectAtTime=function(){},NullElement.prototype.hide=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement],NullElement);function SVGRendererBase(){}extendPrototype([BaseRenderer],SVGRendererBase),SVGRendererBase.prototype.createNull=function(n){return new NullElement(n,this.globalData,this)},SVGRendererBase.prototype.createShape=function(n){return new SVGShapeElement(n,this.globalData,this)},SVGRendererBase.prototype.createText=function(n){return new SVGTextLottieElement(n,this.globalData,this)},SVGRendererBase.prototype.createImage=function(n){return new IImageElement(n,this.globalData,this)},SVGRendererBase.prototype.createSolid=function(n){return new ISolidElement(n,this.globalData,this)},SVGRendererBase.prototype.configAnimation=function(n){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+n.w+" "+n.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",n.w),this.svgElement.setAttribute("height",n.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),this.renderConfig.focusable!==void 0&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var e=this.globalData.defs;this.setupGlobalData(n,e),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=n;var i=createNS("clipPath"),s=createNS("rect");s.setAttribute("width",n.w),s.setAttribute("height",n.h),s.setAttribute("x",0),s.setAttribute("y",0);var r=createElementID();i.setAttribute("id",r),i.appendChild(s),this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+r+")"),e.appendChild(i),this.layers=n.layers,this.elements=createSizedArray(n.layers.length)},SVGRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var n,e=this.layers?this.layers.length:0;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},SVGRendererBase.prototype.updateContainerSize=function(){},SVGRendererBase.prototype.findIndexByInd=function(n){var e=0,i=this.layers.length;for(e=0;e<i;e+=1)if(this.layers[e].ind===n)return e;return-1},SVGRendererBase.prototype.buildItem=function(n){var e=this.elements;if(!(e[n]||this.layers[n].ty===99)){e[n]=!0;var i=this.createItem(this.layers[n]);if(e[n]=i,getExpressionsPlugin()&&(this.layers[n].ty===0&&this.globalData.projectInterface.registerComposition(i),i.initExpressions()),this.appendElementInPos(i,n),this.layers[n].tt){var s="tp"in this.layers[n]?this.findIndexByInd(this.layers[n].tp):n-1;if(s===-1)return;if(!this.elements[s]||this.elements[s]===!0)this.buildItem(s),this.addPendingElement(i);else{var r=e[s],a=r.getMatte(this.layers[n].tt);i.setMatte(a)}}}},SVGRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();if(n.checkParenting(),n.data.tt)for(var e=0,i=this.elements.length;e<i;){if(this.elements[e]===n){var s="tp"in n.data?this.findIndexByInd(n.data.tp):e-1,r=this.elements[s],a=r.getMatte(this.layers[e].tt);n.setMatte(a);break}e+=1}}},SVGRendererBase.prototype.renderFrame=function(n){if(!(this.renderedFrame===n||this.destroyed)){n===null?n=this.renderedFrame:this.renderedFrame=n,this.globalData.frameNum=n,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=n,this.globalData._mdf=!1;var e,i=this.layers.length;for(this.completeLayers||this.checkLayers(n),e=i-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(n-this.layers[e].st);if(this.globalData._mdf)for(e=0;e<i;e+=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()}},SVGRendererBase.prototype.appendElementInPos=function(n,e){var i=n.getBaseElement();if(i){for(var s=0,r;s<e;)this.elements[s]&&this.elements[s]!==!0&&this.elements[s].getBaseElement()&&(r=this.elements[s].getBaseElement()),s+=1;r?this.layerElement.insertBefore(i,r):this.layerElement.appendChild(i)}},SVGRendererBase.prototype.hide=function(){this.layerElement.style.display="none"},SVGRendererBase.prototype.show=function(){this.layerElement.style.display="block"};function ICompElement(){}extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement,RenderableDOMElement],ICompElement),ICompElement.prototype.initElement=function(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initTransform(n,e,i),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),(this.data.xt||!e.progressiveLoad)&&this.buildAllItems(),this.hide()},ICompElement.prototype.prepareFrame=function(n){if(this._mdf=!1,this.prepareRenderableFrame(n),this.prepareProperties(n,this.isInRange),!(!this.isInRange&&!this.data.xt)){if(this.tm._placeholder)this.renderedFrame=n/this.data.sr;else{var e=this.tm.v;e===this.data.op&&(e=this.data.op-1),this.renderedFrame=e}var i,s=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),i=s-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&(this.elements[i].prepareFrame(this.renderedFrame-this.layers[i].st),this.elements[i]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)(this.completeLayers||this.elements[n])&&this.elements[n].renderFrame()},ICompElement.prototype.setElements=function(n){this.elements=n},ICompElement.prototype.getElements=function(){return this.elements},ICompElement.prototype.destroyElements=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy()},ICompElement.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()};function SVGCompElement(n,e,i){this.layers=n.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([SVGRendererBase,ICompElement,SVGBaseElement],SVGCompElement),SVGCompElement.prototype.createComp=function(n){return new SVGCompElement(n,this.globalData,this)};function SVGRenderer(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.svgElement=createNS("svg");var i="";if(e&&e.title){var s=createNS("title"),r=createElementID();s.setAttribute("id",r),s.textContent=e.title,this.svgElement.appendChild(s),i+=r}if(e&&e.description){var a=createNS("desc"),o=createElementID();a.setAttribute("id",o),a.textContent=e.description,this.svgElement.appendChild(a),i+=" "+o}i&&this.svgElement.setAttribute("aria-labelledby",i);var l=createNS("defs");this.svgElement.appendChild(l);var u=createNS("g");this.svgElement.appendChild(u),this.layerElement=u,this.renderConfig={preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",progressiveLoad:e&&e.progressiveLoad||!1,hideOnTransparent:!(e&&e.hideOnTransparent===!1),viewBoxOnly:e&&e.viewBoxOnly||!1,viewBoxSize:e&&e.viewBoxSize||!1,className:e&&e.className||"",id:e&&e.id||"",focusable:e&&e.focusable,filterSize:{width:e&&e.filterSize&&e.filterSize.width||"100%",height:e&&e.filterSize&&e.filterSize.height||"100%",x:e&&e.filterSize&&e.filterSize.x||"0%",y:e&&e.filterSize&&e.filterSize.y||"0%"},width:e&&e.width,height:e&&e.height,runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:l,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}extendPrototype([SVGRendererBase],SVGRenderer),SVGRenderer.prototype.createComp=function(n){return new SVGCompElement(n,this.globalData,this)};function ShapeTransformManager(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}ShapeTransformManager.prototype={addTransformSequence:function(e){var i,s=e.length,r="_";for(i=0;i<s;i+=1)r+=e[i].transform.key+"_";var a=this.sequences[r];return a||(a={transforms:[].concat(e),finalTransform:new Matrix,_mdf:!1},this.sequences[r]=a,this.sequenceList.push(a)),a},processSequence:function(e,i){for(var s=0,r=e.transforms.length,a=i;s<r&&!i;){if(e.transforms[s].transform.mProps._mdf){a=!0;break}s+=1}if(a)for(e.finalTransform.reset(),s=r-1;s>=0;s-=1)e.finalTransform.multiply(e.transforms[s].transform.mProps.v);e._mdf=a},processSequences:function(e){var i,s=this.sequenceList.length;for(i=0;i<s;i+=1)this.processSequence(this.sequenceList[i],e)},getNewKey:function(){return this.transform_key_count+=1,"_"+this.transform_key_count}};var lumaLoader=function(){var e="__lottie_element_luma_buffer",i=null,s=null,r=null;function a(){var u=createNS("svg"),c=createNS("filter"),f=createNS("feColorMatrix");return c.setAttribute("id",e),f.setAttribute("type","matrix"),f.setAttribute("color-interpolation-filters","sRGB"),f.setAttribute("values","0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0"),c.appendChild(f),u.appendChild(c),u.setAttribute("id",e+"_svg"),featureSupport.svgLumaHidden&&(u.style.display="none"),u}function o(){i||(r=a(),document.body.appendChild(r),i=createTag("canvas"),s=i.getContext("2d"),s.filter="url(#"+e+")",s.fillStyle="rgba(0,0,0,0)",s.fillRect(0,0,1,1))}function l(u){return i||o(),i.width=u.width,i.height=u.height,s.filter="url(#"+e+")",i}return{load:o,get:l}};function createCanvas(n,e){if(featureSupport.offscreenCanvas)return new OffscreenCanvas(n,e);var i=createTag("canvas");return i.width=n,i.height=e,i}var assetLoader=function(){return{loadLumaCanvas:lumaLoader.load,getLumaCanvas:lumaLoader.get,createCanvas}}(),registeredEffects={};function CVEffects(n){var e,i=n.data.ef?n.data.ef.length:0;this.filters=[];var s;for(e=0;e<i;e+=1){s=null;var r=n.data.ef[e].ty;if(registeredEffects[r]){var a=registeredEffects[r].effect;s=new a(n.effectsManager.effectElements[e],n)}s&&this.filters.push(s)}this.filters.length&&n.addRenderableComponent(this)}CVEffects.prototype.renderFrame=function(n){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(n)},CVEffects.prototype.getEffects=function(n){var e,i=this.filters.length,s=[];for(e=0;e<i;e+=1)this.filters[e].type===n&&s.push(this.filters[e]);return s};function registerEffect(n,e){registeredEffects[n]={effect:e}}function CVMaskElement(n,e){this.data=n,this.element=e,this.masksProperties=this.data.masksProperties||[],this.viewData=createSizedArray(this.masksProperties.length);var i,s=this.masksProperties.length,r=!1;for(i=0;i<s;i+=1)this.masksProperties[i].mode!=="n"&&(r=!0),this.viewData[i]=ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[i],3);this.hasMasks=r,r&&this.element.addRenderableComponent(this)}CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var n=this.element.finalTransform.mat,e=this.element.canvasContext,i,s=this.masksProperties.length,r,a,o;for(e.beginPath(),i=0;i<s;i+=1)if(this.masksProperties[i].mode!=="n"){this.masksProperties[i].inv&&(e.moveTo(0,0),e.lineTo(this.element.globalData.compSize.w,0),e.lineTo(this.element.globalData.compSize.w,this.element.globalData.compSize.h),e.lineTo(0,this.element.globalData.compSize.h),e.lineTo(0,0)),o=this.viewData[i].v,r=n.applyToPointArray(o.v[0][0],o.v[0][1],0),e.moveTo(r[0],r[1]);var l,u=o._length;for(l=1;l<u;l+=1)a=n.applyToTriplePoints(o.o[l-1],o.i[l],o.v[l]),e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);a=n.applyToTriplePoints(o.o[l-1],o.i[0],o.v[0]),e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5])}this.element.globalData.renderer.save(!0),e.clip()}},CVMaskElement.prototype.getMaskProperty=MaskElement.prototype.getMaskProperty,CVMaskElement.prototype.destroy=function(){this.element=null};function CVBaseElement(){}var operationsMap={1:"source-in",2:"source-out",3:"source-in",4:"source-out"};CVBaseElement.prototype={createElements:function(){},initRendererElement:function(){},createContainerElements:function(){if(this.data.tt>=1){this.buffers=[];var e=this.globalData.canvasContext,i=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(i);var s=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(s),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var i=getBlendMode(this.data.bm);e.canvasContext.globalCompositeOperation=i}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var s=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(s.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var r=assetLoader.getLumaCanvas(this.canvasContext.canvas),a=r.getContext("2d");a.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(r,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var i=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(i),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(i),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(n,e,i,s){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var r=4;e.ty==="rc"?r=5:e.ty==="el"?r=6:e.ty==="sr"&&(r=7),this.sh=ShapePropertyFactory.getShapeProp(n,e,r,n);var a,o=i.length,l;for(a=0;a<o;a+=1)i[a].closed||(l={transforms:s.addTransformSequence(i[a].transforms),trNodes:[]},this.styledShapes.push(l),i[a].elements.push(l))}CVShapeData.prototype.setAsAnimated=SVGShapeData.prototype.setAsAnimated;function CVShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.itemsData=[],this.prevViewData=[],this.shapeModifiers=[],this.processedElements=[],this.transformsManager=new ShapeTransformManager,this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement],CVShapeElement),CVShapeElement.prototype.initElement=RenderableDOMElement.prototype.initElement,CVShapeElement.prototype.transformHelper={opacity:1,_opMdf:!1},CVShapeElement.prototype.dashResetter=[],CVShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[])},CVShapeElement.prototype.createStyleElement=function(n,e){var i={data:n,type:n.ty,preTransforms:this.transformsManager.addTransformSequence(e),transforms:[],elements:[],closed:n.hd===!0},s={};if(n.ty==="fl"||n.ty==="st"?(s.c=PropertyFactory.getProp(this,n.c,1,255,this),s.c.k||(i.co="rgb("+bmFloor(s.c.v[0])+","+bmFloor(s.c.v[1])+","+bmFloor(s.c.v[2])+")")):(n.ty==="gf"||n.ty==="gs")&&(s.s=PropertyFactory.getProp(this,n.s,1,null,this),s.e=PropertyFactory.getProp(this,n.e,1,null,this),s.h=PropertyFactory.getProp(this,n.h||{k:0},0,.01,this),s.a=PropertyFactory.getProp(this,n.a||{k:0},0,degToRads,this),s.g=new GradientProperty(this,n.g,this)),s.o=PropertyFactory.getProp(this,n.o,0,.01,this),n.ty==="st"||n.ty==="gs"){if(i.lc=lineCapEnum[n.lc||2],i.lj=lineJoinEnum[n.lj||2],n.lj==1&&(i.ml=n.ml),s.w=PropertyFactory.getProp(this,n.w,0,null,this),s.w.k||(i.wi=s.w.v),n.d){var r=new DashProperty(this,n.d,"canvas",this);s.d=r,s.d.k||(i.da=s.d.dashArray,i.do=s.d.dashoffset[0])}}else i.r=n.r===2?"evenodd":"nonzero";return this.stylesList.push(i),s.style=i,s},CVShapeElement.prototype.createGroupElement=function(){var n={it:[],prevViewData:[]};return n},CVShapeElement.prototype.createTransformElement=function(n){var e={transform:{opacity:1,_opMdf:!1,key:this.transformsManager.getNewKey(),op:PropertyFactory.getProp(this,n.o,0,.01,this),mProps:TransformPropertyFactory.getTransformProperty(this,n,this)}};return e},CVShapeElement.prototype.createShapeElement=function(n){var e=new CVShapeData(this,n,this.stylesList,this.transformsManager);return this.shapes.push(e),this.addShapeToModifiers(e),e},CVShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var n,e=this.itemsData.length;for(n=0;n<e;n+=1)this.prevViewData[n]=this.itemsData[n];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[]),e=this.dynamicProperties.length,n=0;n<e;n+=1)this.dynamicProperties[n].getValue();this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame)},CVShapeElement.prototype.addTransformToStyleList=function(n){var e,i=this.stylesList.length;for(e=0;e<i;e+=1)this.stylesList[e].closed||this.stylesList[e].transforms.push(n)},CVShapeElement.prototype.removeTransformFromStyleList=function(){var n,e=this.stylesList.length;for(n=0;n<e;n+=1)this.stylesList[n].closed||this.stylesList[n].transforms.pop()},CVShapeElement.prototype.closeStyles=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e].closed=!0},CVShapeElement.prototype.searchShapes=function(n,e,i,s,r){var a,o=n.length-1,l,u,c=[],f=[],p,d,m,P=[].concat(r);for(a=o;a>=0;a-=1){if(p=this.searchProcessedElement(n[a]),p?e[a]=i[p-1]:n[a]._shouldRender=s,n[a].ty==="fl"||n[a].ty==="st"||n[a].ty==="gf"||n[a].ty==="gs")p?e[a].style.closed=!1:e[a]=this.createStyleElement(n[a],P),c.push(e[a].style);else if(n[a].ty==="gr"){if(!p)e[a]=this.createGroupElement(n[a]);else for(u=e[a].it.length,l=0;l<u;l+=1)e[a].prevViewData[l]=e[a].it[l];this.searchShapes(n[a].it,e[a].it,e[a].prevViewData,s,P)}else n[a].ty==="tr"?(p||(m=this.createTransformElement(n[a]),e[a]=m),P.push(e[a]),this.addTransformToStyleList(e[a])):n[a].ty==="sh"||n[a].ty==="rc"||n[a].ty==="el"||n[a].ty==="sr"?p||(e[a]=this.createShapeElement(n[a])):n[a].ty==="tm"||n[a].ty==="rd"||n[a].ty==="pb"||n[a].ty==="zz"||n[a].ty==="op"?(p?(d=e[a],d.closed=!1):(d=ShapeModifiers.getModifier(n[a].ty),d.init(this,n[a]),e[a]=d,this.shapeModifiers.push(d)),f.push(d)):n[a].ty==="rp"&&(p?(d=e[a],d.closed=!0):(d=ShapeModifiers.getModifier(n[a].ty),e[a]=d,d.init(this,n,a,e),this.shapeModifiers.push(d),s=!1),f.push(d));this.addProcessedElement(n[a],a+1)}for(this.removeTransformFromStyleList(),this.closeStyles(c),o=f.length,a=0;a<o;a+=1)f[a].closed=!0},CVShapeElement.prototype.renderInnerContent=function(){this.transformHelper.opacity=1,this.transformHelper._opMdf=!1,this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame),this.renderShape(this.transformHelper,this.shapesData,this.itemsData,!0)},CVShapeElement.prototype.renderShapeTransform=function(n,e){(n._opMdf||e.op._mdf||this._isFirstFrame)&&(e.opacity=n.opacity,e.opacity*=e.op.v,e._opMdf=!0)},CVShapeElement.prototype.drawLayer=function(){var n,e=this.stylesList.length,i,s,r,a,o,l,u=this.globalData.renderer,c=this.globalData.canvasContext,f,p;for(n=0;n<e;n+=1)if(p=this.stylesList[n],f=p.type,!((f==="st"||f==="gs")&&p.wi===0||!p.data._shouldRender||p.coOp===0||this.globalData.currentGlobalAlpha===0)){for(u.save(),o=p.elements,f==="st"||f==="gs"?(u.ctxStrokeStyle(f==="st"?p.co:p.grd),u.ctxLineWidth(p.wi),u.ctxLineCap(p.lc),u.ctxLineJoin(p.lj),u.ctxMiterLimit(p.ml||0)):u.ctxFillStyle(f==="fl"?p.co:p.grd),u.ctxOpacity(p.coOp),f!=="st"&&f!=="gs"&&c.beginPath(),u.ctxTransform(p.preTransforms.finalTransform.props),s=o.length,i=0;i<s;i+=1){for((f==="st"||f==="gs")&&(c.beginPath(),p.da&&(c.setLineDash(p.da),c.lineDashOffset=p.do)),l=o[i].trNodes,a=l.length,r=0;r<a;r+=1)l[r].t==="m"?c.moveTo(l[r].p[0],l[r].p[1]):l[r].t==="c"?c.bezierCurveTo(l[r].pts[0],l[r].pts[1],l[r].pts[2],l[r].pts[3],l[r].pts[4],l[r].pts[5]):c.closePath();(f==="st"||f==="gs")&&(u.ctxStroke(),p.da&&c.setLineDash(this.dashResetter))}f!=="st"&&f!=="gs"&&this.globalData.renderer.ctxFill(p.r),u.restore()}},CVShapeElement.prototype.renderShape=function(n,e,i,s){var r,a=e.length-1,o;for(o=n,r=a;r>=0;r-=1)e[r].ty==="tr"?(o=i[r].transform,this.renderShapeTransform(n,o)):e[r].ty==="sh"||e[r].ty==="el"||e[r].ty==="rc"||e[r].ty==="sr"?this.renderPath(e[r],i[r]):e[r].ty==="fl"?this.renderFill(e[r],i[r],o):e[r].ty==="st"?this.renderStroke(e[r],i[r],o):e[r].ty==="gf"||e[r].ty==="gs"?this.renderGradientFill(e[r],i[r],o):e[r].ty==="gr"?this.renderShape(o,e[r].it,i[r].it):e[r].ty;s&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(n,e){if(this._isFirstFrame||e._mdf||n.transforms._mdf){var i=n.trNodes,s=e.paths,r,a,o,l=s._length;i.length=0;var u=n.transforms.finalTransform;for(o=0;o<l;o+=1){var c=s.shapes[o];if(c&&c.v){for(a=c._length,r=1;r<a;r+=1)r===1&&i.push({t:"m",p:u.applyToPointArray(c.v[0][0],c.v[0][1],0)}),i.push({t:"c",pts:u.applyToTriplePoints(c.o[r-1],c.i[r],c.v[r])});a===1&&i.push({t:"m",p:u.applyToPointArray(c.v[0][0],c.v[0][1],0)}),c.c&&a&&(i.push({t:"c",pts:u.applyToTriplePoints(c.o[r-1],c.i[0],c.v[0])}),i.push({t:"z"}))}}n.trNodes=i}},CVShapeElement.prototype.renderPath=function(n,e){if(n.hd!==!0&&n._shouldRender){var i,s=e.styledShapes.length;for(i=0;i<s;i+=1)this.renderStyledShape(e.styledShapes[i],e.sh)}},CVShapeElement.prototype.renderFill=function(n,e,i){var s=e.style;(e.c._mdf||this._isFirstFrame)&&(s.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(s.coOp=e.o.v*i.opacity)},CVShapeElement.prototype.renderGradientFill=function(n,e,i){var s=e.style,r;if(!s.grd||e.g._mdf||e.s._mdf||e.e._mdf||n.t!==1&&(e.h._mdf||e.a._mdf)){var a=this.globalData.canvasContext,o=e.s.v,l=e.e.v;if(n.t===1)r=a.createLinearGradient(o[0],o[1],l[0],l[1]);else{var u=Math.sqrt(Math.pow(o[0]-l[0],2)+Math.pow(o[1]-l[1],2)),c=Math.atan2(l[1]-o[1],l[0]-o[0]),f=e.h.v;f>=1?f=.99:f<=-1&&(f=-.99);var p=u*f,d=Math.cos(c+e.a.v)*p+o[0],m=Math.sin(c+e.a.v)*p+o[1];r=a.createRadialGradient(d,m,0,o[0],o[1],u)}var P,T=n.g.p,x=e.g.c,y=1;for(P=0;P<T;P+=1)e.g._hasOpacity&&e.g._collapsable&&(y=e.g.o[P*2+1]),r.addColorStop(x[P*4]/100,"rgba("+x[P*4+1]+","+x[P*4+2]+","+x[P*4+3]+","+y+")");s.grd=r}s.coOp=e.o.v*i.opacity},CVShapeElement.prototype.renderStroke=function(n,e,i){var s=e.style,r=e.d;r&&(r._mdf||this._isFirstFrame)&&(s.da=r.dashArray,s.do=r.dashoffset[0]),(e.c._mdf||this._isFirstFrame)&&(s.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(s.coOp=e.o.v*i.opacity),(e.w._mdf||this._isFirstFrame)&&(s.wi=e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemsData.length=0};function CVTextElement(n,e,i){this.textSpans=[],this.yOffset=0,this.fillColorAnim=!1,this.strokeColorAnim=!1,this.strokeWidthAnim=!1,this.stroke=!1,this.fill=!1,this.justifyOffset=0,this.currentRender=null,this.renderType="canvas",this.values={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",sWidth:0,fValue:""},this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement],CVTextElement),CVTextElement.prototype.tHelper=createTag("canvas").getContext("2d"),CVTextElement.prototype.buildNewText=function(){var n=this.textProperty.currentData;this.renderedLetters=createSizedArray(n.l?n.l.length:0);var e=!1;n.fc?(e=!0,this.values.fill=this.buildColor(n.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=e;var i=!1;n.sc&&(i=!0,this.values.stroke=this.buildColor(n.sc),this.values.sWidth=n.sw);var s=this.globalData.fontManager.getFontByName(n.f),r,a,o=n.l,l=this.mHelper;this.stroke=i,this.values.fValue=n.finalSize+"px "+this.globalData.fontManager.getFontByName(n.f).fFamily,a=n.finalText.length;var u,c,f,p,d,m,P,T,x,y,C=this.data.singleShape,g=n.tr*.001*n.finalSize,S=0,E=0,A=!0,M=0;for(r=0;r<a;r+=1){u=this.globalData.fontManager.getCharData(n.finalText[r],s.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily),c=u&&u.data||{},l.reset(),C&&o[r].n&&(S=-g,E+=n.yOffset,E+=A?1:0,A=!1),d=c.shapes?c.shapes[0].it:[],P=d.length,l.scale(n.finalSize/100,n.finalSize/100),C&&this.applyTextPropertiesToMatrix(n,l,o[r].line,S,E),x=createSizedArray(P-1);var b=0;for(m=0;m<P;m+=1)if(d[m].ty==="sh"){for(p=d[m].ks.k.i.length,T=d[m].ks.k,y=[],f=1;f<p;f+=1)f===1&&y.push(l.applyToX(T.v[0][0],T.v[0][1],0),l.applyToY(T.v[0][0],T.v[0][1],0)),y.push(l.applyToX(T.o[f-1][0],T.o[f-1][1],0),l.applyToY(T.o[f-1][0],T.o[f-1][1],0),l.applyToX(T.i[f][0],T.i[f][1],0),l.applyToY(T.i[f][0],T.i[f][1],0),l.applyToX(T.v[f][0],T.v[f][1],0),l.applyToY(T.v[f][0],T.v[f][1],0));y.push(l.applyToX(T.o[f-1][0],T.o[f-1][1],0),l.applyToY(T.o[f-1][0],T.o[f-1][1],0),l.applyToX(T.i[0][0],T.i[0][1],0),l.applyToY(T.i[0][0],T.i[0][1],0),l.applyToX(T.v[0][0],T.v[0][1],0),l.applyToY(T.v[0][0],T.v[0][1],0)),x[b]=y,b+=1}C&&(S+=o[r].l,S+=g),this.textSpans[M]?this.textSpans[M].elem=x:this.textSpans[M]={elem:x},M+=1}},CVTextElement.prototype.renderInnerContent=function(){this.validateText();var n=this.canvasContext;n.font=this.values.fValue,this.globalData.renderer.ctxLineCap("butt"),this.globalData.renderer.ctxLineJoin("miter"),this.globalData.renderer.ctxMiterLimit(4),this.data.singleShape||this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag);var e,i,s,r,a,o,l=this.textAnimator.renderedLetters,u=this.textProperty.currentData.l;i=u.length;var c,f=null,p=null,d=null,m,P,T=this.globalData.renderer;for(e=0;e<i;e+=1)if(!u[e].n){if(c=l[e],c&&(T.save(),T.ctxTransform(c.p),T.ctxOpacity(c.o)),this.fill){for(c&&c.fc?f!==c.fc&&(T.ctxFillStyle(c.fc),f=c.fc):f!==this.values.fill&&(f=this.values.fill,T.ctxFillStyle(this.values.fill)),m=this.textSpans[e].elem,r=m.length,this.globalData.canvasContext.beginPath(),s=0;s<r;s+=1)for(P=m[s],o=P.length,this.globalData.canvasContext.moveTo(P[0],P[1]),a=2;a<o;a+=6)this.globalData.canvasContext.bezierCurveTo(P[a],P[a+1],P[a+2],P[a+3],P[a+4],P[a+5]);this.globalData.canvasContext.closePath(),T.ctxFill()}if(this.stroke){for(c&&c.sw?d!==c.sw&&(d=c.sw,T.ctxLineWidth(c.sw)):d!==this.values.sWidth&&(d=this.values.sWidth,T.ctxLineWidth(this.values.sWidth)),c&&c.sc?p!==c.sc&&(p=c.sc,T.ctxStrokeStyle(c.sc)):p!==this.values.stroke&&(p=this.values.stroke,T.ctxStrokeStyle(this.values.stroke)),m=this.textSpans[e].elem,r=m.length,this.globalData.canvasContext.beginPath(),s=0;s<r;s+=1)for(P=m[s],o=P.length,this.globalData.canvasContext.moveTo(P[0],P[1]),a=2;a<o;a+=6)this.globalData.canvasContext.bezierCurveTo(P[a],P[a+1],P[a+2],P[a+3],P[a+4],P[a+5]);this.globalData.canvasContext.closePath(),T.ctxStroke()}c&&this.globalData.renderer.restore()}};function CVImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.img=e.imageLoader.getAsset(this.assetData),this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVImageElement),CVImageElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVImageElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVImageElement.prototype.createContent=function(){if(this.img.width&&(this.assetData.w!==this.img.width||this.assetData.h!==this.img.height)){var n=createTag("canvas");n.width=this.assetData.w,n.height=this.assetData.h;var e=n.getContext("2d"),i=this.img.width,s=this.img.height,r=i/s,a=this.assetData.w/this.assetData.h,o,l,u=this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio;r>a&&u==="xMidYMid slice"||r<a&&u!=="xMidYMid slice"?(l=s,o=l*a):(o=i,l=o/a),e.drawImage(this.img,(i-o)/2,(s-l)/2,o,l,0,0,this.assetData.w,this.assetData.h),this.img=n}},CVImageElement.prototype.renderInnerContent=function(){this.canvasContext.drawImage(this.img,0,0)},CVImageElement.prototype.destroy=function(){this.img=null};function CVSolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVSolidElement),CVSolidElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVSolidElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVSolidElement.prototype.renderInnerContent=function(){this.globalData.renderer.ctxFillStyle(this.data.sc),this.globalData.renderer.ctxFillRect(0,0,this.data.sw,this.data.sh)};function CanvasRendererBase(){}extendPrototype([BaseRenderer],CanvasRendererBase),CanvasRendererBase.prototype.createShape=function(n){return new CVShapeElement(n,this.globalData,this)},CanvasRendererBase.prototype.createText=function(n){return new CVTextElement(n,this.globalData,this)},CanvasRendererBase.prototype.createImage=function(n){return new CVImageElement(n,this.globalData,this)},CanvasRendererBase.prototype.createSolid=function(n){return new CVSolidElement(n,this.globalData,this)},CanvasRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,CanvasRendererBase.prototype.ctxTransform=function(n){n[0]===1&&n[1]===0&&n[4]===0&&n[5]===1&&n[12]===0&&n[13]===0||this.canvasContext.transform(n[0],n[1],n[4],n[5],n[12],n[13])},CanvasRendererBase.prototype.ctxOpacity=function(n){this.canvasContext.globalAlpha*=n<0?0:n},CanvasRendererBase.prototype.ctxFillStyle=function(n){this.canvasContext.fillStyle=n},CanvasRendererBase.prototype.ctxStrokeStyle=function(n){this.canvasContext.strokeStyle=n},CanvasRendererBase.prototype.ctxLineWidth=function(n){this.canvasContext.lineWidth=n},CanvasRendererBase.prototype.ctxLineCap=function(n){this.canvasContext.lineCap=n},CanvasRendererBase.prototype.ctxLineJoin=function(n){this.canvasContext.lineJoin=n},CanvasRendererBase.prototype.ctxMiterLimit=function(n){this.canvasContext.miterLimit=n},CanvasRendererBase.prototype.ctxFill=function(n){this.canvasContext.fill(n)},CanvasRendererBase.prototype.ctxFillRect=function(n,e,i,s){this.canvasContext.fillRect(n,e,i,s)},CanvasRendererBase.prototype.ctxStroke=function(){this.canvasContext.stroke()},CanvasRendererBase.prototype.reset=function(){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}this.contextData.reset()},CanvasRendererBase.prototype.save=function(){this.canvasContext.save()},CanvasRendererBase.prototype.restore=function(n){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}n&&(this.globalData.blendMode="source-over"),this.contextData.restore(n)},CanvasRendererBase.prototype.configAnimation=function(n){if(this.animationItem.wrapper){this.animationItem.container=createTag("canvas");var e=this.animationItem.container.style;e.width="100%",e.height="100%";var i="0px 0px 0px";e.transformOrigin=i,e.mozTransformOrigin=i,e.webkitTransformOrigin=i,e["-webkit-transform"]=i,e.contentVisibility=this.renderConfig.contentVisibility,this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d"),this.renderConfig.className&&this.animationItem.container.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.animationItem.container.setAttribute("id",this.renderConfig.id)}else this.canvasContext=this.renderConfig.context;this.contextData.setContext(this.canvasContext),this.data=n,this.layers=n.layers,this.transformCanvas={w:n.w,h:n.h,sx:0,sy:0,tx:0,ty:0},this.setupGlobalData(n,document.body),this.globalData.canvasContext=this.canvasContext,this.globalData.renderer=this,this.globalData.isDashed=!1,this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.globalData.transformCanvas=this.transformCanvas,this.elements=createSizedArray(n.layers.length),this.updateContainerSize()},CanvasRendererBase.prototype.updateContainerSize=function(n,e){this.reset();var i,s;n?(i=n,s=e,this.canvasContext.canvas.width=i,this.canvasContext.canvas.height=s):(this.animationItem.wrapper&&this.animationItem.container?(i=this.animationItem.wrapper.offsetWidth,s=this.animationItem.wrapper.offsetHeight):(i=this.canvasContext.canvas.width,s=this.canvasContext.canvas.height),this.canvasContext.canvas.width=i*this.renderConfig.dpr,this.canvasContext.canvas.height=s*this.renderConfig.dpr);var r,a;if(this.renderConfig.preserveAspectRatio.indexOf("meet")!==-1||this.renderConfig.preserveAspectRatio.indexOf("slice")!==-1){var o=this.renderConfig.preserveAspectRatio.split(" "),l=o[1]||"meet",u=o[0]||"xMidYMid",c=u.substr(0,4),f=u.substr(4);r=i/s,a=this.transformCanvas.w/this.transformCanvas.h,a>r&&l==="meet"||a<r&&l==="slice"?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=i/(this.transformCanvas.w/this.renderConfig.dpr)):(this.transformCanvas.sx=s/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.sy=s/(this.transformCanvas.h/this.renderConfig.dpr)),c==="xMid"&&(a<r&&l==="meet"||a>r&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(s/this.transformCanvas.h))/2*this.renderConfig.dpr:c==="xMax"&&(a<r&&l==="meet"||a>r&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(s/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,f==="YMid"&&(a>r&&l==="meet"||a<r&&l==="slice")?this.transformCanvas.ty=(s-this.transformCanvas.h*(i/this.transformCanvas.w))/2*this.renderConfig.dpr:f==="YMax"&&(a>r&&l==="meet"||a<r&&l==="slice")?this.transformCanvas.ty=(s-this.transformCanvas.h*(i/this.transformCanvas.w))*this.renderConfig.dpr:this.transformCanvas.ty=0}else this.renderConfig.preserveAspectRatio==="none"?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=s/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.tx=0,this.transformCanvas.ty=0):(this.transformCanvas.sx=this.renderConfig.dpr,this.transformCanvas.sy=this.renderConfig.dpr,this.transformCanvas.tx=0,this.transformCanvas.ty=0);this.transformCanvas.props=[this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1],this.ctxTransform(this.transformCanvas.props),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.closePath(),this.canvasContext.clip(),this.renderFrame(this.renderedFrame,!0)},CanvasRendererBase.prototype.destroy=function(){this.renderConfig.clearCanvas&&this.animationItem.wrapper&&(this.animationItem.wrapper.innerText="");var n,e=this.layers?this.layers.length:0;for(n=e-1;n>=0;n-=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(n,e){if(!(this.renderedFrame===n&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||n===-1)){this.renderedFrame=n,this.globalData.frameNum=n-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=n;var i,s=this.layers.length;for(this.completeLayers||this.checkLayers(n),i=s-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].prepareFrame(n-this.layers[i].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),i=s-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(n){var e=this.elements;if(!(e[n]||this.layers[n].ty===99)){var i=this.createItem(this.layers[n],this,this.globalData);e[n]=i,i.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();n.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var n,e=15;for(n=0;n<e;n+=1){var i=new CanvasContext;this.stack[n]=i}this._length=e,this.nativeContext=null,this.transformMat=new Matrix,this.currentOpacity=1,this.currentFillStyle="",this.appliedFillStyle="",this.currentStrokeStyle="",this.appliedStrokeStyle="",this.currentLineWidth="",this.appliedLineWidth="",this.currentLineCap="",this.appliedLineCap="",this.currentLineJoin="",this.appliedLineJoin="",this.appliedMiterLimit="",this.currentMiterLimit=""}CVContextData.prototype.duplicate=function(){var n=this._length*2,e=0;for(e=this._length;e<n;e+=1)this.stack[e]=new CanvasContext;this._length=n},CVContextData.prototype.reset=function(){this.cArrPos=0,this.cTr.reset(),this.stack[this.cArrPos].opacity=1},CVContextData.prototype.restore=function(n){this.cArrPos-=1;var e=this.stack[this.cArrPos],i=e.transform,s,r=this.cTr.props;for(s=0;s<16;s+=1)r[s]=i[s];if(n){this.nativeContext.restore();var a=this.stack[this.cArrPos+1];this.appliedFillStyle=a.fillStyle,this.appliedStrokeStyle=a.strokeStyle,this.appliedLineWidth=a.lineWidth,this.appliedLineCap=a.lineCap,this.appliedLineJoin=a.lineJoin,this.appliedMiterLimit=a.miterLimit}this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13]),(n||e.opacity!==-1&&this.currentOpacity!==e.opacity)&&(this.nativeContext.globalAlpha=e.opacity,this.currentOpacity=e.opacity),this.currentFillStyle=e.fillStyle,this.currentStrokeStyle=e.strokeStyle,this.currentLineWidth=e.lineWidth,this.currentLineCap=e.lineCap,this.currentLineJoin=e.lineJoin,this.currentMiterLimit=e.miterLimit},CVContextData.prototype.save=function(n){n&&this.nativeContext.save();var e=this.cTr.props;this._length<=this.cArrPos&&this.duplicate();var i=this.stack[this.cArrPos],s;for(s=0;s<16;s+=1)i.transform[s]=e[s];this.cArrPos+=1;var r=this.stack[this.cArrPos];r.opacity=i.opacity,r.fillStyle=i.fillStyle,r.strokeStyle=i.strokeStyle,r.lineWidth=i.lineWidth,r.lineCap=i.lineCap,r.lineJoin=i.lineJoin,r.miterLimit=i.miterLimit},CVContextData.prototype.setOpacity=function(n){this.stack[this.cArrPos].opacity=n},CVContextData.prototype.setContext=function(n){this.nativeContext=n},CVContextData.prototype.fillStyle=function(n){this.stack[this.cArrPos].fillStyle!==n&&(this.currentFillStyle=n,this.stack[this.cArrPos].fillStyle=n)},CVContextData.prototype.strokeStyle=function(n){this.stack[this.cArrPos].strokeStyle!==n&&(this.currentStrokeStyle=n,this.stack[this.cArrPos].strokeStyle=n)},CVContextData.prototype.lineWidth=function(n){this.stack[this.cArrPos].lineWidth!==n&&(this.currentLineWidth=n,this.stack[this.cArrPos].lineWidth=n)},CVContextData.prototype.lineCap=function(n){this.stack[this.cArrPos].lineCap!==n&&(this.currentLineCap=n,this.stack[this.cArrPos].lineCap=n)},CVContextData.prototype.lineJoin=function(n){this.stack[this.cArrPos].lineJoin!==n&&(this.currentLineJoin=n,this.stack[this.cArrPos].lineJoin=n)},CVContextData.prototype.miterLimit=function(n){this.stack[this.cArrPos].miterLimit!==n&&(this.currentMiterLimit=n,this.stack[this.cArrPos].miterLimit=n)},CVContextData.prototype.transform=function(n){this.transformMat.cloneFromProps(n);var e=this.cTr;this.transformMat.multiply(e),e.cloneFromProps(this.transformMat.props);var i=e.props;this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13])},CVContextData.prototype.opacity=function(n){var e=this.stack[this.cArrPos].opacity;e*=n<0?0:n,this.stack[this.cArrPos].opacity!==e&&(this.currentOpacity!==n&&(this.nativeContext.globalAlpha=n,this.currentOpacity=n),this.stack[this.cArrPos].opacity=e)},CVContextData.prototype.fill=function(n){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fill(n)},CVContextData.prototype.fillRect=function(n,e,i,s){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fillRect(n,e,i,s)},CVContextData.prototype.stroke=function(){this.appliedStrokeStyle!==this.currentStrokeStyle&&(this.appliedStrokeStyle=this.currentStrokeStyle,this.nativeContext.strokeStyle=this.appliedStrokeStyle),this.appliedLineWidth!==this.currentLineWidth&&(this.appliedLineWidth=this.currentLineWidth,this.nativeContext.lineWidth=this.appliedLineWidth),this.appliedLineCap!==this.currentLineCap&&(this.appliedLineCap=this.currentLineCap,this.nativeContext.lineCap=this.appliedLineCap),this.appliedLineJoin!==this.currentLineJoin&&(this.appliedLineJoin=this.currentLineJoin,this.nativeContext.lineJoin=this.appliedLineJoin),this.appliedMiterLimit!==this.currentMiterLimit&&(this.appliedMiterLimit=this.currentMiterLimit,this.nativeContext.miterLimit=this.appliedMiterLimit),this.nativeContext.stroke()};function CVCompElement(n,e,i){this.completeLayers=!1,this.layers=n.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([CanvasRendererBase,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var n=this.canvasContext;n.beginPath(),n.moveTo(0,0),n.lineTo(this.data.w,0),n.lineTo(this.data.w,this.data.h),n.lineTo(0,this.data.h),n.lineTo(0,0),n.clip();var e,i=this.layers.length;for(e=i-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()},CVCompElement.prototype.destroy=function(){var n,e=this.layers.length;for(n=e-1;n>=0;n-=1)this.elements[n]&&this.elements[n].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(n){return new CVCompElement(n,this.globalData,this)};function CanvasRenderer(n,e){this.animationItem=n,this.renderConfig={clearCanvas:e&&e.clearCanvas!==void 0?e.clearCanvas:!0,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(n){return new CVCompElement(n,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var i=this.finalTransform.mat.toCSS();e.transform=i,e.webkitTransform=i}this.finalTransform._opMdf&&(e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var n;this.data.hasMask?(n=createNS("rect"),n.setAttribute("width",this.data.sw),n.setAttribute("height",this.data.sh),n.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(n=createTag("div"),n.style.width=this.data.sw+"px",n.style.height=this.data.sh+"px",n.style.backgroundColor=this.data.sc),this.layerElement.appendChild(n)};function HShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(n,e,i),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var n;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),n=this.svgElement;else{n=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;n.setAttribute("width",e.w),n.setAttribute("height",e.h),n.appendChild(this.shapesContainer),this.layerElement.appendChild(n)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=n},HShapeElement.prototype.getTransformedPoint=function(n,e){var i,s=n.length;for(i=0;i<s;i+=1)e=n[i].mProps.v.applyToPointArray(e[0],e[1],0);return e},HShapeElement.prototype.calculateShapeBoundingBox=function(n,e){var i=n.sh.v,s=n.transformers,r,a=i._length,o,l,u,c;if(!(a<=1)){for(r=0;r<a-1;r+=1)o=this.getTransformedPoint(s,i.v[r]),l=this.getTransformedPoint(s,i.o[r]),u=this.getTransformedPoint(s,i.i[r+1]),c=this.getTransformedPoint(s,i.v[r+1]),this.checkBounds(o,l,u,c,e);i.c&&(o=this.getTransformedPoint(s,i.v[r]),l=this.getTransformedPoint(s,i.o[r]),u=this.getTransformedPoint(s,i.i[0]),c=this.getTransformedPoint(s,i.v[0]),this.checkBounds(o,l,u,c,e))}},HShapeElement.prototype.checkBounds=function(n,e,i,s,r){this.getBoundsOfCurve(n,e,i,s);var a=this.shapeBoundingBox;r.x=bmMin(a.left,r.x),r.xMax=bmMax(a.right,r.xMax),r.y=bmMin(a.top,r.y),r.yMax=bmMax(a.bottom,r.yMax)},HShapeElement.prototype.shapeBoundingBox={left:0,right:0,top:0,bottom:0},HShapeElement.prototype.tempBoundingBox={x:0,xMax:0,y:0,yMax:0,width:0,height:0},HShapeElement.prototype.getBoundsOfCurve=function(n,e,i,s){for(var r=[[n[0],s[0]],[n[1],s[1]]],a,o,l,u,c,f,p,d=0;d<2;++d)o=6*n[d]-12*e[d]+6*i[d],a=-3*n[d]+9*e[d]-9*i[d]+3*s[d],l=3*e[d]-3*n[d],o|=0,a|=0,l|=0,a===0&&o===0||(a===0?(u=-l/o,u>0&&u<1&&r[d].push(this.calculateF(u,n,e,i,s,d))):(c=o*o-4*l*a,c>=0&&(f=(-o+bmSqrt(c))/(2*a),f>0&&f<1&&r[d].push(this.calculateF(f,n,e,i,s,d)),p=(-o-bmSqrt(c))/(2*a),p>0&&p<1&&r[d].push(this.calculateF(p,n,e,i,s,d)))));this.shapeBoundingBox.left=bmMin.apply(null,r[0]),this.shapeBoundingBox.top=bmMin.apply(null,r[1]),this.shapeBoundingBox.right=bmMax.apply(null,r[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,r[1])},HShapeElement.prototype.calculateF=function(n,e,i,s,r,a){return bmPow(1-n,3)*e[a]+3*bmPow(1-n,2)*n*i[a]+3*(1-n)*bmPow(n,2)*s[a]+bmPow(n,3)*r[a]},HShapeElement.prototype.calculateBoundingBox=function(n,e){var i,s=n.length;for(i=0;i<s;i+=1)n[i]&&n[i].sh?this.calculateShapeBoundingBox(n[i],e):n[i]&&n[i].it?this.calculateBoundingBox(n[i].it,e):n[i]&&n[i].style&&n[i].w&&this.expandStrokeBoundingBox(n[i].w,e)},HShapeElement.prototype.expandStrokeBoundingBox=function(n,e){var i=0;if(n.keyframes){for(var s=0;s<n.keyframes.length;s+=1){var r=n.keyframes[s].s;r>i&&(i=r)}i*=n.mult}else i=n.v*n.mult;e.x-=i,e.xMax+=i,e.y-=i,e.yMax+=i},HShapeElement.prototype.currentBoxContains=function(n){return this.currentBBox.x<=n.x&&this.currentBBox.y<=n.y&&this.currentBBox.width+this.currentBBox.x>=n.x+n.width&&this.currentBBox.height+this.currentBBox.y>=n.y+n.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var n=this.tempBoundingBox,e=999999;if(n.x=e,n.xMax=-e,n.y=e,n.yMax=-e,this.calculateBoundingBox(this.itemsData,n),n.width=n.xMax<n.x?0:n.xMax-n.x,n.height=n.yMax<n.y?0:n.yMax-n.y,this.currentBoxContains(n))return;var i=!1;if(this.currentBBox.w!==n.width&&(this.currentBBox.w=n.width,this.shapeCont.setAttribute("width",n.width),i=!0),this.currentBBox.h!==n.height&&(this.currentBBox.h=n.height,this.shapeCont.setAttribute("height",n.height),i=!0),i||this.currentBBox.x!==n.x||this.currentBBox.y!==n.y){this.currentBBox.w=n.width,this.currentBBox.h=n.height,this.currentBBox.x=n.x,this.currentBBox.y=n.y,this.shapeCont.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h);var s=this.shapeCont.style,r="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";s.transform=r,s.webkitTransform=r}}};function HTextElement(n,e,i){this.textSpans=[],this.textPaths=[],this.currentBBox={x:999999,y:-999999,h:0,w:0},this.renderType="svg",this.isMasked=!1,this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],HTextElement),HTextElement.prototype.createContent=function(){if(this.isMasked=this.checkMasks(),this.isMasked){this.renderType="svg",this.compW=this.comp.data.w,this.compH=this.comp.data.h,this.svgElement.setAttribute("width",this.compW),this.svgElement.setAttribute("height",this.compH);var n=createNS("g");this.maskedElement.appendChild(n),this.innerElem=n}else this.renderType="html",this.innerElem=this.layerElement;this.checkParenting()},HTextElement.prototype.buildNewText=function(){var n=this.textProperty.currentData;this.renderedLetters=createSizedArray(n.l?n.l.length:0);var e=this.innerElem.style,i=n.fc?this.buildColor(n.fc):"rgba(0,0,0,0)";e.fill=i,e.color=i,n.sc&&(e.stroke=this.buildColor(n.sc),e.strokeWidth=n.sw+"px");var s=this.globalData.fontManager.getFontByName(n.f);if(!this.globalData.fontManager.chars)if(e.fontSize=n.finalSize+"px",e.lineHeight=n.finalSize+"px",s.fClass)this.innerElem.className=s.fClass;else{e.fontFamily=s.fFamily;var r=n.fWeight,a=n.fStyle;e.fontStyle=a,e.fontWeight=r}var o,l,u=n.l;l=u.length;var c,f,p,d=this.mHelper,m,P="",T=0;for(o=0;o<l;o+=1){if(this.globalData.fontManager.chars?(this.textPaths[T]?c=this.textPaths[T]:(c=createNS("path"),c.setAttribute("stroke-linecap",lineCapEnum[1]),c.setAttribute("stroke-linejoin",lineJoinEnum[2]),c.setAttribute("stroke-miterlimit","4")),this.isMasked||(this.textSpans[T]?(f=this.textSpans[T],p=f.children[0]):(f=createTag("div"),f.style.lineHeight=0,p=createNS("svg"),p.appendChild(c),styleDiv(f)))):this.isMasked?c=this.textPaths[T]?this.textPaths[T]:createNS("text"):this.textSpans[T]?(f=this.textSpans[T],c=this.textPaths[T]):(f=createTag("span"),styleDiv(f),c=createTag("span"),styleDiv(c),f.appendChild(c)),this.globalData.fontManager.chars){var x=this.globalData.fontManager.getCharData(n.finalText[o],s.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily),y;if(x?y=x.data:y=null,d.reset(),y&&y.shapes&&y.shapes.length&&(m=y.shapes[0].it,d.scale(n.finalSize/100,n.finalSize/100),P=this.createPathShape(d,m),c.setAttribute("d",P)),this.isMasked)this.innerElem.appendChild(c);else{if(this.innerElem.appendChild(f),y&&y.shapes){document.body.appendChild(p);var C=p.getBBox();p.setAttribute("width",C.width+2),p.setAttribute("height",C.height+2),p.setAttribute("viewBox",C.x-1+" "+(C.y-1)+" "+(C.width+2)+" "+(C.height+2));var g=p.style,S="translate("+(C.x-1)+"px,"+(C.y-1)+"px)";g.transform=S,g.webkitTransform=S,u[o].yOffset=C.y-1}else p.setAttribute("width",1),p.setAttribute("height",1);f.appendChild(p)}}else if(c.textContent=u[o].val,c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),this.isMasked)this.innerElem.appendChild(c);else{this.innerElem.appendChild(f);var E=c.style,A="translate3d(0,"+-n.finalSize/1.2+"px,0)";E.transform=A,E.webkitTransform=A}this.isMasked?this.textSpans[T]=c:this.textSpans[T]=f,this.textSpans[T].style.display="block",this.textPaths[T]=c,T+=1}for(;T<this.textSpans.length;)this.textSpans[T].style.display="none",T+=1},HTextElement.prototype.renderInnerContent=function(){this.validateText();var n;if(this.data.singleShape){if(!this._isFirstFrame&&!this.lettersChangedFlag)return;if(this.isMasked&&this.finalTransform._matMdf){this.svgElement.setAttribute("viewBox",-this.finalTransform.mProp.p.v[0]+" "+-this.finalTransform.mProp.p.v[1]+" "+this.compW+" "+this.compH),n=this.svgElement.style;var e="translate("+-this.finalTransform.mProp.p.v[0]+"px,"+-this.finalTransform.mProp.p.v[1]+"px)";n.transform=e,n.webkitTransform=e}}if(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),!(!this.lettersChangedFlag&&!this.textAnimator.lettersChangedFlag)){var i,s,r=0,a=this.textAnimator.renderedLetters,o=this.textProperty.currentData.l;s=o.length;var l,u,c;for(i=0;i<s;i+=1)o[i].n?r+=1:(u=this.textSpans[i],c=this.textPaths[i],l=a[r],r+=1,l._mdf.m&&(this.isMasked?u.setAttribute("transform",l.m):(u.style.webkitTransform=l.m,u.style.transform=l.m)),u.style.opacity=l.o,l.sw&&l._mdf.sw&&c.setAttribute("stroke-width",l.sw),l.sc&&l._mdf.sc&&c.setAttribute("stroke",l.sc),l.fc&&l._mdf.fc&&(c.setAttribute("fill",l.fc),c.style.color=l.fc));if(this.innerElem.getBBox&&!this.hidden&&(this._isFirstFrame||this._mdf)){var f=this.innerElem.getBBox();this.currentBBox.w!==f.width&&(this.currentBBox.w=f.width,this.svgElement.setAttribute("width",f.width)),this.currentBBox.h!==f.height&&(this.currentBBox.h=f.height,this.svgElement.setAttribute("height",f.height));var p=1;if(this.currentBBox.w!==f.width+p*2||this.currentBBox.h!==f.height+p*2||this.currentBBox.x!==f.x-p||this.currentBBox.y!==f.y-p){this.currentBBox.w=f.width+p*2,this.currentBBox.h=f.height+p*2,this.currentBBox.x=f.x-p,this.currentBBox.y=f.y-p,this.svgElement.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),n=this.svgElement.style;var d="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";n.transform=d,n.webkitTransform=d}}}};function HCameraElement(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initHierarchy();var s=PropertyFactory.getProp;if(this.pe=s(this,n.pe,0,0,this),n.ks.p.s?(this.px=s(this,n.ks.p.x,1,0,this),this.py=s(this,n.ks.p.y,1,0,this),this.pz=s(this,n.ks.p.z,1,0,this)):this.p=s(this,n.ks.p,1,0,this),n.ks.a&&(this.a=s(this,n.ks.a,1,0,this)),n.ks.or.k.length&&n.ks.or.k[0].to){var r,a=n.ks.or.k.length;for(r=0;r<a;r+=1)n.ks.or.k[r].to=null,n.ks.or.k[r].ti=null}this.or=s(this,n.ks.or,1,degToRads,this),this.or.sh=!0,this.rx=s(this,n.ks.rx,0,degToRads,this),this.ry=s(this,n.ks.ry,0,degToRads,this),this.rz=s(this,n.ks.rz,0,degToRads,this),this.mat=new Matrix,this._prevMat=new Matrix,this._isFirstFrame=!0,this.finalTransform={mProp:this}}extendPrototype([BaseElement,FrameElement,HierarchyElement],HCameraElement),HCameraElement.prototype.setup=function(){var n,e=this.comp.threeDElements.length,i,s,r;for(n=0;n<e;n+=1)if(i=this.comp.threeDElements[n],i.type==="3d"){s=i.perspectiveElem.style,r=i.container.style;var a=this.pe.v+"px",o="0px 0px 0px",l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";s.perspective=a,s.webkitPerspective=a,r.transformOrigin=o,r.mozTransformOrigin=o,r.webkitTransformOrigin=o,s.transform=l,s.webkitTransform=l}},HCameraElement.prototype.createElements=function(){},HCameraElement.prototype.hide=function(){},HCameraElement.prototype.renderFrame=function(){var n=this._isFirstFrame,e,i;if(this.hierarchy)for(i=this.hierarchy.length,e=0;e<i;e+=1)n=this.hierarchy[e].finalTransform.mProp._mdf||n;if(n||this.pe._mdf||this.p&&this.p._mdf||this.px&&(this.px._mdf||this.py._mdf||this.pz._mdf)||this.rx._mdf||this.ry._mdf||this.rz._mdf||this.or._mdf||this.a&&this.a._mdf){if(this.mat.reset(),this.hierarchy)for(i=this.hierarchy.length-1,e=i;e>=0;e-=1){var s=this.hierarchy[e].finalTransform.mProp;this.mat.translate(-s.p.v[0],-s.p.v[1],s.p.v[2]),this.mat.rotateX(-s.or.v[0]).rotateY(-s.or.v[1]).rotateZ(s.or.v[2]),this.mat.rotateX(-s.rx.v).rotateY(-s.ry.v).rotateZ(s.rz.v),this.mat.scale(1/s.s.v[0],1/s.s.v[1],1/s.s.v[2]),this.mat.translate(s.a.v[0],s.a.v[1],s.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var r;this.p?r=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:r=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var a=Math.sqrt(Math.pow(r[0],2)+Math.pow(r[1],2)+Math.pow(r[2],2)),o=[r[0]/a,r[1]/a,r[2]/a],l=Math.sqrt(o[2]*o[2]+o[0]*o[0]),u=Math.atan2(o[1],l),c=Math.atan2(o[0],-o[2]);this.mat.rotateY(c).rotateX(-u)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var f=!this._prevMat.equals(this.mat);if((f||this.pe._mdf)&&this.comp.threeDElements){i=this.comp.threeDElements.length;var p,d,m;for(e=0;e<i;e+=1)if(p=this.comp.threeDElements[e],p.type==="3d"){if(f){var P=this.mat.toCSS();m=p.container.style,m.transform=P,m.webkitTransform=P}this.pe._mdf&&(d=p.perspectiveElem.style,d.perspective=this.pe.v+"px",d.webkitPerspective=this.pe.v+"px")}this.mat.clone(this._prevMat)}}this._isFirstFrame=!1},HCameraElement.prototype.prepareFrame=function(n){this.prepareProperties(n,!0)},HCameraElement.prototype.destroy=function(){},HCameraElement.prototype.getBaseElement=function(){return null};function HImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement],HImageElement),HImageElement.prototype.createContent=function(){var n=this.globalData.getAssetsPath(this.assetData),e=new Image;this.data.hasMask?(this.imageElem=createNS("image"),this.imageElem.setAttribute("width",this.assetData.w+"px"),this.imageElem.setAttribute("height",this.assetData.h+"px"),this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this.layerElement.appendChild(this.imageElem),this.baseElement.setAttribute("width",this.assetData.w),this.baseElement.setAttribute("height",this.assetData.h)):this.layerElement.appendChild(e),e.crossOrigin="anonymous",e.src=n,this.data.ln&&this.baseElement.setAttribute("id",this.data.ln)};function HybridRendererBase(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"}},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([BaseRenderer],HybridRendererBase),HybridRendererBase.prototype.buildItem=SVGRenderer.prototype.buildItem,HybridRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();n.checkParenting()}},HybridRendererBase.prototype.appendElementInPos=function(n,e){var i=n.getBaseElement();if(i){var s=this.layers[e];if(!s.ddd||!this.supports3d)if(this.threeDElements)this.addTo3dContainer(i,e);else{for(var r=0,a,o,l;r<e;)this.elements[r]&&this.elements[r]!==!0&&this.elements[r].getBaseElement&&(o=this.elements[r],l=this.layers[r].ddd?this.getThreeDContainerByPos(r):o.getBaseElement(),a=l||a),r+=1;a?(!s.ddd||!this.supports3d)&&this.layerElement.insertBefore(i,a):(!s.ddd||!this.supports3d)&&this.layerElement.appendChild(i)}else this.addTo3dContainer(i,e)}},HybridRendererBase.prototype.createShape=function(n){return this.supports3d?new HShapeElement(n,this.globalData,this):new SVGShapeElement(n,this.globalData,this)},HybridRendererBase.prototype.createText=function(n){return this.supports3d?new HTextElement(n,this.globalData,this):new SVGTextLottieElement(n,this.globalData,this)},HybridRendererBase.prototype.createCamera=function(n){return this.camera=new HCameraElement(n,this.globalData,this),this.camera},HybridRendererBase.prototype.createImage=function(n){return this.supports3d?new HImageElement(n,this.globalData,this):new IImageElement(n,this.globalData,this)},HybridRendererBase.prototype.createSolid=function(n){return this.supports3d?new HSolidElement(n,this.globalData,this):new ISolidElement(n,this.globalData,this)},HybridRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,HybridRendererBase.prototype.getThreeDContainerByPos=function(n){for(var e=0,i=this.threeDElements.length;e<i;){if(this.threeDElements[e].startPos<=n&&this.threeDElements[e].endPos>=n)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(n,e){var i=createTag("div"),s,r;styleDiv(i);var a=createTag("div");if(styleDiv(a),e==="3d"){s=i.style,s.width=this.globalData.compSize.w+"px",s.height=this.globalData.compSize.h+"px";var o="50% 50%";s.webkitTransformOrigin=o,s.mozTransformOrigin=o,s.transformOrigin=o,r=a.style;var l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";r.transform=l,r.webkitTransform=l}i.appendChild(a);var u={container:a,perspectiveElem:i,startPos:n,endPos:n,type:e};return this.threeDElements.push(u),u},HybridRendererBase.prototype.build3dContainers=function(){var n,e=this.layers.length,i,s="";for(n=0;n<e;n+=1)this.layers[n].ddd&&this.layers[n].ty!==3?(s!=="3d"&&(s="3d",i=this.createThreeDContainer(n,"3d")),i.endPos=Math.max(i.endPos,n)):(s!=="2d"&&(s="2d",i=this.createThreeDContainer(n,"2d")),i.endPos=Math.max(i.endPos,n));for(e=this.threeDElements.length,n=e-1;n>=0;n-=1)this.resizerElem.appendChild(this.threeDElements[n].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(n,e){for(var i=0,s=this.threeDElements.length;i<s;){if(e<=this.threeDElements[i].endPos){for(var r=this.threeDElements[i].startPos,a;r<e;)this.elements[r]&&this.elements[r].getBaseElement&&(a=this.elements[r].getBaseElement()),r+=1;a?this.threeDElements[i].container.insertBefore(n,a):this.threeDElements[i].container.appendChild(n);break}i+=1}},HybridRendererBase.prototype.configAnimation=function(n){var e=createTag("div"),i=this.animationItem.wrapper,s=e.style;s.width=n.w+"px",s.height=n.h+"px",this.resizerElem=e,styleDiv(e),s.transformStyle="flat",s.mozTransformStyle="flat",s.webkitTransformStyle="flat",this.renderConfig.className&&e.setAttribute("class",this.renderConfig.className),i.appendChild(e),s.overflow="hidden";var r=createNS("svg");r.setAttribute("width","1"),r.setAttribute("height","1"),styleDiv(r),this.resizerElem.appendChild(r);var a=createNS("defs");r.appendChild(a),this.data=n,this.setupGlobalData(n,r),this.globalData.defs=a,this.layers=n.layers,this.layerElement=this.resizerElem,this.build3dContainers(),this.updateContainerSize()},HybridRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.animationItem.container=null,this.globalData.defs=null;var n,e=this.layers?this.layers.length:0;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},HybridRendererBase.prototype.updateContainerSize=function(){var n=this.animationItem.wrapper.offsetWidth,e=this.animationItem.wrapper.offsetHeight,i=n/e,s=this.globalData.compSize.w/this.globalData.compSize.h,r,a,o,l;s>i?(r=n/this.globalData.compSize.w,a=n/this.globalData.compSize.w,o=0,l=(e-this.globalData.compSize.h*(n/this.globalData.compSize.w))/2):(r=e/this.globalData.compSize.h,a=e/this.globalData.compSize.h,o=(n-this.globalData.compSize.w*(e/this.globalData.compSize.h))/2,l=0);var u=this.resizerElem.style;u.webkitTransform="matrix3d("+r+",0,0,0,0,"+a+",0,0,0,0,1,0,"+o+","+l+",0,1)",u.transform=u.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var n=this.globalData.compSize.w,e=this.globalData.compSize.h,i,s=this.threeDElements.length;for(i=0;i<s;i+=1){var r=this.threeDElements[i].perspectiveElem.style;r.webkitPerspective=Math.sqrt(Math.pow(n,2)+Math.pow(e,2))+"px",r.perspective=r.webkitPerspective}}},HybridRendererBase.prototype.searchExtraCompositions=function(n){var e,i=n.length,s=createTag("div");for(e=0;e<i;e+=1)if(n[e].xt){var r=this.createComp(n[e],s,this.globalData.comp,null);r.initExpressions(),this.globalData.projectInterface.registerComposition(r)}};function HCompElement(n,e,i){this.layers=n.layers,this.supports3d=!n.hasMask,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([HybridRendererBase,ICompElement,HBaseElement],HCompElement),HCompElement.prototype._createBaseContainerElements=HCompElement.prototype.createContainerElements,HCompElement.prototype.createContainerElements=function(){this._createBaseContainerElements(),this.data.hasMask?(this.svgElement.setAttribute("width",this.data.w),this.svgElement.setAttribute("height",this.data.h),this.transformedElement=this.baseElement):this.transformedElement=this.layerElement},HCompElement.prototype.addTo3dContainer=function(n,e){for(var i=0,s;i<e;)this.elements[i]&&this.elements[i].getBaseElement&&(s=this.elements[i].getBaseElement()),i+=1;s?this.layerElement.insertBefore(n,s):this.layerElement.appendChild(n)},HCompElement.prototype.createComp=function(n){return this.supports3d?new HCompElement(n,this.globalData,this):new SVGCompElement(n,this.globalData,this)};function HybridRenderer(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"},runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([HybridRendererBase],HybridRenderer),HybridRenderer.prototype.createComp=function(n){return this.supports3d?new HCompElement(n,this.globalData,this):new SVGCompElement(n,this.globalData,this)};var CompExpressionInterface=function(){return function(n){function e(i){for(var s=0,r=n.layers.length;s<r;){if(n.layers[s].nm===i||n.layers[s].ind===i)return n.elements[s].layerInterface;s+=1}return null}return Object.defineProperty(e,"_name",{value:n.data.nm}),e.layer=e,e.pixelAspect=1,e.height=n.data.h||n.globalData.compSize.h,e.width=n.data.w||n.globalData.compSize.w,e.pixelAspect=1,e.frameDuration=1/n.globalData.frameRate,e.displayStartTime=0,e.numLayers=n.layers.length,e}}();function _typeof$2(n){"@babel/helpers - typeof";return _typeof$2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$2(n)}function seedRandom(n,e){var i=this,s=256,r=6,a=52,o="random",l=e.pow(s,r),u=e.pow(2,a),c=u*2,f=s-1,p;function d(g,S,E){var A=[];S=S===!0?{entropy:!0}:S||{};var M=x(T(S.entropy?[g,C(n)]:g===null?y():g,3),A),b=new m(A),F=function(){for(var L=b.g(r),D=l,U=0;L<u;)L=(L+U)*s,D*=s,U=b.g(1);for(;L>=c;)L/=2,D/=2,U>>>=1;return(L+U)/D};return F.int32=function(){return b.g(4)|0},F.quick=function(){return b.g(4)/4294967296},F.double=F,x(C(b.S),n),(S.pass||E||function(G,L,D,U){return U&&(U.S&&P(U,b),G.state=function(){return P(b,{})}),D?(e[o]=G,L):G})(F,M,"global"in S?S.global:this==e,S.state)}e["seed"+o]=d;function m(g){var S,E=g.length,A=this,M=0,b=A.i=A.j=0,F=A.S=[];for(E||(g=[E++]);M<s;)F[M]=M++;for(M=0;M<s;M++)F[M]=F[b=f&b+g[M%E]+(S=F[M])],F[b]=S;A.g=function(G){for(var L,D=0,U=A.i,z=A.j,O=A.S;G--;)L=O[U=f&U+1],D=D*s+O[f&(O[U]=O[z=f&z+L])+(O[z]=L)];return A.i=U,A.j=z,D}}function P(g,S){return S.i=g.i,S.j=g.j,S.S=g.S.slice(),S}function T(g,S){var E=[],A=_typeof$2(g),M;if(S&&A=="object")for(M in g)try{E.push(T(g[M],S-1))}catch{}return E.length?E:A=="string"?g:g+"\0"}function x(g,S){for(var E=g+"",A,M=0;M<E.length;)S[f&M]=f&(A^=S[f&M]*19)+E.charCodeAt(M++);return C(S)}function y(){try{var g=new Uint8Array(s);return(i.crypto||i.msCrypto).getRandomValues(g),C(g)}catch{var S=i.navigator,E=S&&S.plugins;return[+new Date,i,E,i.screen,C(n)]}}function C(g){return String.fromCharCode.apply(0,g)}x(e.random(),n)}function initialize$2(n){seedRandom([],n)}var propTypes={SHAPE:"shape"};function _typeof$1(n){"@babel/helpers - typeof";return _typeof$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$1(n)}var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null,_lottieGlobal={};initialize$2(BMMath);function resetFrame(){_lottieGlobal={}}function $bm_isInstanceOfArray(n){return n.constructor===Array||n.constructor===Float32Array}function isNumerable(n,e){return n==="number"||e instanceof Number||n==="boolean"||n==="string"}function $bm_neg(n){var e=_typeof$1(n);if(e==="number"||n instanceof Number||e==="boolean")return-n;if($bm_isInstanceOfArray(n)){var i,s=n.length,r=[];for(i=0;i<s;i+=1)r[i]=-n[i];return r}return n.propType?n.v:-n}var easeInBez=BezierFactory.getBezierEasing(.333,0,.833,.833,"easeIn").get,easeOutBez=BezierFactory.getBezierEasing(.167,.167,.667,1,"easeOut").get,easeInOutBez=BezierFactory.getBezierEasing(.33,0,.667,1,"easeInOut").get;function sum(n,e){var i=_typeof$1(n),s=_typeof$1(e);if(isNumerable(i,n)&&isNumerable(s,e)||i==="string"||s==="string")return n+e;if($bm_isInstanceOfArray(n)&&isNumerable(s,e))return n=n.slice(0),n[0]+=e,n;if(isNumerable(i,n)&&$bm_isInstanceOfArray(e))return e=e.slice(0),e[0]=n+e[0],e;if($bm_isInstanceOfArray(n)&&$bm_isInstanceOfArray(e)){for(var r=0,a=n.length,o=e.length,l=[];r<a||r<o;)(typeof n[r]=="number"||n[r]instanceof Number)&&(typeof e[r]=="number"||e[r]instanceof Number)?l[r]=n[r]+e[r]:l[r]=e[r]===void 0?n[r]:n[r]||e[r],r+=1;return l}return 0}var add=sum;function sub(n,e){var i=_typeof$1(n),s=_typeof$1(e);if(isNumerable(i,n)&&isNumerable(s,e))return i==="string"&&(n=parseInt(n,10)),s==="string"&&(e=parseInt(e,10)),n-e;if($bm_isInstanceOfArray(n)&&isNumerable(s,e))return n=n.slice(0),n[0]-=e,n;if(isNumerable(i,n)&&$bm_isInstanceOfArray(e))return e=e.slice(0),e[0]=n-e[0],e;if($bm_isInstanceOfArray(n)&&$bm_isInstanceOfArray(e)){for(var r=0,a=n.length,o=e.length,l=[];r<a||r<o;)(typeof n[r]=="number"||n[r]instanceof Number)&&(typeof e[r]=="number"||e[r]instanceof Number)?l[r]=n[r]-e[r]:l[r]=e[r]===void 0?n[r]:n[r]||e[r],r+=1;return l}return 0}function mul(n,e){var i=_typeof$1(n),s=_typeof$1(e),r;if(isNumerable(i,n)&&isNumerable(s,e))return n*e;var a,o;if($bm_isInstanceOfArray(n)&&isNumerable(s,e)){for(o=n.length,r=createTypedArray("float32",o),a=0;a<o;a+=1)r[a]=n[a]*e;return r}if(isNumerable(i,n)&&$bm_isInstanceOfArray(e)){for(o=e.length,r=createTypedArray("float32",o),a=0;a<o;a+=1)r[a]=n*e[a];return r}return 0}function div(n,e){var i=_typeof$1(n),s=_typeof$1(e),r;if(isNumerable(i,n)&&isNumerable(s,e))return n/e;var a,o;if($bm_isInstanceOfArray(n)&&isNumerable(s,e)){for(o=n.length,r=createTypedArray("float32",o),a=0;a<o;a+=1)r[a]=n[a]/e;return r}if(isNumerable(i,n)&&$bm_isInstanceOfArray(e)){for(o=e.length,r=createTypedArray("float32",o),a=0;a<o;a+=1)r[a]=n/e[a];return r}return 0}function mod(n,e){return typeof n=="string"&&(n=parseInt(n,10)),typeof e=="string"&&(e=parseInt(e,10)),n%e}var $bm_sum=sum,$bm_sub=sub,$bm_mul=mul,$bm_div=div,$bm_mod=mod;function clamp(n,e,i){if(e>i){var s=i;i=e,e=s}return Math.min(Math.max(n,e),i)}function radiansToDegrees(n){return n/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(n){return n*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(n,e){if(typeof n=="number"||n instanceof Number)return e=e||0,Math.abs(n-e);e||(e=helperLengthArray);var i,s=Math.min(n.length,e.length),r=0;for(i=0;i<s;i+=1)r+=Math.pow(e[i]-n[i],2);return Math.sqrt(r)}function normalize(n){return div(n,length(n))}function rgbToHsl(n){var e=n[0],i=n[1],s=n[2],r=Math.max(e,i,s),a=Math.min(e,i,s),o,l,u=(r+a)/2;if(r===a)o=0,l=0;else{var c=r-a;switch(l=u>.5?c/(2-r-a):c/(r+a),r){case e:o=(i-s)/c+(i<s?6:0);break;case i:o=(s-e)/c+2;break;case s:o=(e-i)/c+4;break}o/=6}return[o,l,u,n[3]]}function hue2rgb(n,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(e-n)*6*i:i<1/2?e:i<2/3?n+(e-n)*(2/3-i)*6:n}function hslToRgb(n){var e=n[0],i=n[1],s=n[2],r,a,o;if(i===0)r=s,o=s,a=s;else{var l=s<.5?s*(1+i):s+i-s*i,u=2*s-l;r=hue2rgb(u,l,e+1/3),a=hue2rgb(u,l,e),o=hue2rgb(u,l,e-1/3)}return[r,a,o,n[3]]}function linear(n,e,i,s,r){if((s===void 0||r===void 0)&&(s=e,r=i,e=0,i=1),i<e){var a=i;i=e,e=a}if(n<=e)return s;if(n>=i)return r;var o=i===e?0:(n-e)/(i-e);if(!s.length)return s+(r-s)*o;var l,u=s.length,c=createTypedArray("float32",u);for(l=0;l<u;l+=1)c[l]=s[l]+(r[l]-s[l])*o;return c}function random(n,e){if(e===void 0&&(n===void 0?(n=0,e=1):(e=n,n=void 0)),e.length){var i,s=e.length;n||(n=createTypedArray("float32",s));var r=createTypedArray("float32",s),a=BMMath.random();for(i=0;i<s;i+=1)r[i]=n[i]+a*(e[i]-n[i]);return r}n===void 0&&(n=0);var o=BMMath.random();return n+o*(e-n)}function createPath(n,e,i,s){var r,a=n.length,o=shapePool.newElement();o.setPathData(!!s,a);var l=[0,0],u,c;for(r=0;r<a;r+=1)u=e&&e[r]?e[r]:l,c=i&&i[r]?i[r]:l,o.setTripleAt(n[r][0],n[r][1],c[0]+n[r][0],c[1]+n[r][1],u[0]+n[r][0],u[1]+n[r][1],r,!0);return o}function initiateExpression(elem,data,property){function noOp(n){return n}if(!elem.globalData.renderConfig.runExpressions)return noOp;var val=data.x,needsVelocity=/velocity(?![\w\d])/.test(val),_needsRandom=val.indexOf("random")!==-1,elemType=elem.data.ty,transform,$bm_transform,content,effect,thisProperty=property;thisProperty._name=elem.data.nm,thisProperty.valueAtTime=thisProperty.getValueAtTime,Object.defineProperty(thisProperty,"value",{get:function(){return thisProperty.v}}),elem.comp.frameDuration=1/elem.comp.globalData.frameRate,elem.comp.displayStartTime=0;var inPoint=elem.data.ip/elem.comp.globalData.frameRate,outPoint=elem.data.op/elem.comp.globalData.frameRate,width=elem.data.sw?elem.data.sw:0,height=elem.data.sh?elem.data.sh:0,name=elem.data.nm,loopIn,loop_in,loopOut,loop_out,smooth,toWorld,fromWorld,fromComp,toComp,fromCompToSurface,position,rotation,anchorPoint,scale,thisLayer,thisComp,mask,valueAtTime,velocityAtTime,scoped_bm_rt,expression_function=eval("[function _expression_function(){"+val+";scoped_bm_rt=$bm_rt}]")[0],numKeys=property.kf?data.k.length:0,active=!this.data||this.data.hd!==!0,wiggle=(function n(e,i){var s,r,a=this.pv.length?this.pv.length:1,o=createTypedArray("float32",a);e=5;var l=Math.floor(time*e);for(s=0,r=0;s<l;){for(r=0;r<a;r+=1)o[r]+=-i+i*2*BMMath.random();s+=1}var u=time*e,c=u-Math.floor(u),f=createTypedArray("float32",a);if(a>1){for(r=0;r<a;r+=1)f[r]=this.pv[r]+o[r]+(-i+i*2*BMMath.random())*c;return f}return this.pv+o[0]+(-i+i*2*BMMath.random())*c}).bind(this);thisProperty.loopIn&&(loopIn=thisProperty.loopIn.bind(thisProperty),loop_in=loopIn),thisProperty.loopOut&&(loopOut=thisProperty.loopOut.bind(thisProperty),loop_out=loopOut),thisProperty.smooth&&(smooth=thisProperty.smooth.bind(thisProperty));function loopInDuration(n,e){return loopIn(n,e,!0)}function loopOutDuration(n,e){return loopOut(n,e,!0)}this.getValueAtTime&&(valueAtTime=this.getValueAtTime.bind(this)),this.getVelocityAtTime&&(velocityAtTime=this.getVelocityAtTime.bind(this));var comp=elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);function lookAt(n,e){var i=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],s=Math.atan2(i[0],Math.sqrt(i[1]*i[1]+i[2]*i[2]))/degToRads,r=-Math.atan2(i[1],i[2])/degToRads;return[r,s,0]}function easeOut(n,e,i,s,r){return applyEase(easeOutBez,n,e,i,s,r)}function easeIn(n,e,i,s,r){return applyEase(easeInBez,n,e,i,s,r)}function ease(n,e,i,s,r){return applyEase(easeInOutBez,n,e,i,s,r)}function applyEase(n,e,i,s,r,a){r===void 0?(r=i,a=s):e=(e-i)/(s-i),e>1?e=1:e<0&&(e=0);var o=n(e);if($bm_isInstanceOfArray(r)){var l,u=r.length,c=createTypedArray("float32",u);for(l=0;l<u;l+=1)c[l]=(a[l]-r[l])*o+r[l];return c}return(a-r)*o+r}function nearestKey(n){var e,i=data.k.length,s,r;if(!data.k.length||typeof data.k[0]=="number")s=0,r=0;else if(s=-1,n*=elem.comp.globalData.frameRate,n<data.k[0].t)s=1,r=data.k[0].t;else{for(e=0;e<i-1;e+=1)if(n===data.k[e].t){s=e+1,r=data.k[e].t;break}else if(n>data.k[e].t&&n<data.k[e+1].t){n-data.k[e].t>data.k[e+1].t-n?(s=e+2,r=data.k[e+1].t):(s=e+1,r=data.k[e].t);break}s===-1&&(s=e+1,r=data.k[e].t)}var a={};return a.index=s,a.time=r/elem.comp.globalData.frameRate,a}function key(n){var e,i,s;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+n);n-=1,e={time:data.k[n].t/elem.comp.globalData.frameRate,value:[]};var r=Object.prototype.hasOwnProperty.call(data.k[n],"s")?data.k[n].s:data.k[n-1].e;for(s=r.length,i=0;i<s;i+=1)e[i]=r[i],e.value[i]=r[i];return e}function framesToTime(n,e){return e||(e=elem.comp.globalData.frameRate),n/e}function timeToFrames(n,e){return!n&&n!==0&&(n=time),e||(e=elem.comp.globalData.frameRate),n*e}function seedRandom(n){BMMath.seedrandom(randSeed+n)}function sourceRectAtTime(){return elem.sourceRectAtTime()}function substring(n,e){return typeof value=="string"?e===void 0?value.substring(n):value.substring(n,e):""}function substr(n,e){return typeof value=="string"?e===void 0?value.substr(n):value.substr(n,e):""}function posterizeTime(n){time=n===0?0:Math.floor(time*n)/n,value=valueAtTime(time)}var time,velocity,value,text,textIndex,textTotal,selectorValue,index=elem.data.ind,hasParent=!!(elem.hierarchy&&elem.hierarchy.length),parent,randSeed=Math.floor(Math.random()*1e6),globalData=elem.globalData;function executeExpression(n){return value=n,this.frameExpressionId===elem.globalData.frameId&&this.propType!=="textSelector"?value:(this.propType==="textSelector"&&(textIndex=this.textIndex,textTotal=this.textTotal,selectorValue=this.selectorValue),thisLayer||(text=elem.layerInterface.text,thisLayer=elem.layerInterface,thisComp=elem.comp.compInterface,toWorld=thisLayer.toWorld.bind(thisLayer),fromWorld=thisLayer.fromWorld.bind(thisLayer),fromComp=thisLayer.fromComp.bind(thisLayer),toComp=thisLayer.toComp.bind(thisLayer),mask=thisLayer.mask?thisLayer.mask.bind(thisLayer):null,fromCompToSurface=fromComp),transform||(transform=elem.layerInterface("ADBE Transform Group"),$bm_transform=transform,transform&&(anchorPoint=transform.anchorPoint)),elemType===4&&!content&&(content=thisLayer("ADBE Root Vectors Group")),effect||(effect=thisLayer(4)),hasParent=!!(elem.hierarchy&&elem.hierarchy.length),hasParent&&!parent&&(parent=elem.hierarchy[0].layerInterface),time=this.comp.renderedFrame/this.comp.globalData.frameRate,_needsRandom&&seedRandom(randSeed+time),needsVelocity&&(velocity=velocityAtTime(time)),expression_function(),this.frameExpressionId=elem.globalData.frameId,scoped_bm_rt=scoped_bm_rt.propType===propTypes.SHAPE?scoped_bm_rt.v:scoped_bm_rt,scoped_bm_rt)}return executeExpression.__preventDeadCodeRemoval=[$bm_transform,anchorPoint,time,velocity,inPoint,outPoint,width,height,name,loop_in,loop_out,smooth,toComp,fromCompToSurface,toWorld,fromWorld,mask,position,rotation,scale,thisComp,numKeys,active,wiggle,loopInDuration,loopOutDuration,comp,lookAt,easeOut,easeIn,ease,nearestKey,key,text,textIndex,textTotal,selectorValue,framesToTime,timeToFrames,sourceRectAtTime,substring,substr,posterizeTime,index,globalData],executeExpression}return ob.initiateExpression=initiateExpression,ob.__preventDeadCodeRemoval=[window,document,XMLHttpRequest,fetch,frames,$bm_neg,add,$bm_sum,$bm_sub,$bm_mul,$bm_div,$bm_mod,clamp,radians_to_degrees,degreesToRadians,degrees_to_radians,normalize,rgbToHsl,hslToRgb,linear,random,createPath,_lottieGlobal],ob.resetFrame=resetFrame,ob}(),Expressions=function(){var n={};n.initExpressions=e,n.resetFrame=ExpressionManager.resetFrame;function e(i){var s=0,r=[];function a(){s+=1}function o(){s-=1,s===0&&u()}function l(c){r.indexOf(c)===-1&&r.push(c)}function u(){var c,f=r.length;for(c=0;c<f;c+=1)r[c].release();r.length=0}i.renderer.compInterface=CompExpressionInterface(i.renderer),i.renderer.globalData.projectInterface.registerComposition(i.renderer),i.renderer.globalData.pushExpression=a,i.renderer.globalData.popExpression=o,i.renderer.globalData.registerExpressionProperty=l}return n}(),MaskManagerInterface=function(){function n(i,s){this._mask=i,this._data=s}Object.defineProperty(n.prototype,"maskPath",{get:function(){return this._mask.prop.k&&this._mask.prop.getValue(),this._mask.prop}}),Object.defineProperty(n.prototype,"maskOpacity",{get:function(){return this._mask.op.k&&this._mask.op.getValue(),this._mask.op.v*100}});var e=function(s){var r=createSizedArray(s.viewData.length),a,o=s.viewData.length;for(a=0;a<o;a+=1)r[a]=new n(s.viewData[a],s.masksProperties[a]);var l=function(c){for(a=0;a<o;){if(s.masksProperties[a].nm===c)return r[a];a+=1}return null};return l};return e}(),ExpressionPropertyInterface=function(){var n={pv:0,v:0,mult:1},e={pv:[0,0,0],v:[0,0,0],mult:1};function i(o,l,u){Object.defineProperty(o,"velocity",{get:function(){return l.getVelocityAtTime(l.comp.currentFrame)}}),o.numKeys=l.keyframes?l.keyframes.length:0,o.key=function(c){if(!o.numKeys)return 0;var f="";"s"in l.keyframes[c-1]?f=l.keyframes[c-1].s:"e"in l.keyframes[c-2]?f=l.keyframes[c-2].e:f=l.keyframes[c-2].s;var p=u==="unidimensional"?new Number(f):Object.assign({},f);return p.time=l.keyframes[c-1].t/l.elem.comp.globalData.frameRate,p.value=u==="unidimensional"?f[0]:f,p},o.valueAtTime=l.getValueAtTime,o.speedAtTime=l.getSpeedAtTime,o.velocityAtTime=l.getVelocityAtTime,o.propertyGroup=l.propertyGroup}function s(o){(!o||!("pv"in o))&&(o=n);var l=1/o.mult,u=o.pv*l,c=new Number(u);return c.value=u,i(c,o,"unidimensional"),function(){return o.k&&o.getValue(),u=o.v*l,c.value!==u&&(c=new Number(u),c.value=u,c[0]=u,i(c,o,"unidimensional")),c}}function r(o){(!o||!("pv"in o))&&(o=e);var l=1/o.mult,u=o.data&&o.data.l||o.pv.length,c=createTypedArray("float32",u),f=createTypedArray("float32",u);return c.value=f,i(c,o,"multidimensional"),function(){o.k&&o.getValue();for(var p=0;p<u;p+=1)f[p]=o.v[p]*l,c[p]=f[p];return c}}function a(){return n}return function(o){return o?o.propType==="unidimensional"?s(o):r(o):a}}(),TransformExpressionInterface=function(){return function(n){function e(o){switch(o){case"scale":case"Scale":case"ADBE Scale":case 6:return e.scale;case"rotation":case"Rotation":case"ADBE Rotation":case"ADBE Rotate Z":case 10:return e.rotation;case"ADBE Rotate X":return e.xRotation;case"ADBE Rotate Y":return e.yRotation;case"position":case"Position":case"ADBE Position":case 2:return e.position;case"ADBE Position_0":return e.xPosition;case"ADBE Position_1":return e.yPosition;case"ADBE Position_2":return e.zPosition;case"anchorPoint":case"AnchorPoint":case"Anchor Point":case"ADBE AnchorPoint":case 1:return e.anchorPoint;case"opacity":case"Opacity":case 11:return e.opacity;default:return null}}Object.defineProperty(e,"rotation",{get:ExpressionPropertyInterface(n.r||n.rz)}),Object.defineProperty(e,"zRotation",{get:ExpressionPropertyInterface(n.rz||n.r)}),Object.defineProperty(e,"xRotation",{get:ExpressionPropertyInterface(n.rx)}),Object.defineProperty(e,"yRotation",{get:ExpressionPropertyInterface(n.ry)}),Object.defineProperty(e,"scale",{get:ExpressionPropertyInterface(n.s)});var i,s,r,a;return n.p?a=ExpressionPropertyInterface(n.p):(i=ExpressionPropertyInterface(n.px),s=ExpressionPropertyInterface(n.py),n.pz&&(r=ExpressionPropertyInterface(n.pz))),Object.defineProperty(e,"position",{get:function(){return n.p?a():[i(),s(),r?r():0]}}),Object.defineProperty(e,"xPosition",{get:ExpressionPropertyInterface(n.px)}),Object.defineProperty(e,"yPosition",{get:ExpressionPropertyInterface(n.py)}),Object.defineProperty(e,"zPosition",{get:ExpressionPropertyInterface(n.pz)}),Object.defineProperty(e,"anchorPoint",{get:ExpressionPropertyInterface(n.a)}),Object.defineProperty(e,"opacity",{get:ExpressionPropertyInterface(n.o)}),Object.defineProperty(e,"skew",{get:ExpressionPropertyInterface(n.sk)}),Object.defineProperty(e,"skewAxis",{get:ExpressionPropertyInterface(n.sa)}),Object.defineProperty(e,"orientation",{get:ExpressionPropertyInterface(n.or)}),e}}(),LayerExpressionInterface=function(){function n(c){var f=new Matrix;if(c!==void 0){var p=this._elem.finalTransform.mProp.getValueAtTime(c);p.clone(f)}else{var d=this._elem.finalTransform.mProp;d.applyToMatrix(f)}return f}function e(c,f){var p=this.getMatrix(f);return p.props[12]=0,p.props[13]=0,p.props[14]=0,this.applyPoint(p,c)}function i(c,f){var p=this.getMatrix(f);return this.applyPoint(p,c)}function s(c,f){var p=this.getMatrix(f);return p.props[12]=0,p.props[13]=0,p.props[14]=0,this.invertPoint(p,c)}function r(c,f){var p=this.getMatrix(f);return this.invertPoint(p,c)}function a(c,f){if(this._elem.hierarchy&&this._elem.hierarchy.length){var p,d=this._elem.hierarchy.length;for(p=0;p<d;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(c)}return c.applyToPointArray(f[0],f[1],f[2]||0)}function o(c,f){if(this._elem.hierarchy&&this._elem.hierarchy.length){var p,d=this._elem.hierarchy.length;for(p=0;p<d;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(c)}return c.inversePoint(f)}function l(c){var f=new Matrix;if(f.reset(),this._elem.finalTransform.mProp.applyToMatrix(f),this._elem.hierarchy&&this._elem.hierarchy.length){var p,d=this._elem.hierarchy.length;for(p=0;p<d;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(f);return f.inversePoint(c)}return f.inversePoint(c)}function u(){return[1,1,1,1]}return function(c){var f;function p(T){m.mask=new MaskManagerInterface(T,c)}function d(T){m.effect=T}function m(T){switch(T){case"ADBE Root Vectors Group":case"Contents":case 2:return m.shapeInterface;case 1:case 6:case"Transform":case"transform":case"ADBE Transform Group":return f;case 4:case"ADBE Effect Parade":case"effects":case"Effects":return m.effect;case"ADBE Text Properties":return m.textInterface;default:return null}}m.getMatrix=n,m.invertPoint=o,m.applyPoint=a,m.toWorld=i,m.toWorldVec=e,m.fromWorld=r,m.fromWorldVec=s,m.toComp=i,m.fromComp=l,m.sampleImage=u,m.sourceRectAtTime=c.sourceRectAtTime.bind(c),m._elem=c,f=TransformExpressionInterface(c.finalTransform.mProp);var P=getDescriptor(f,"anchorPoint");return Object.defineProperties(m,{hasParent:{get:function(){return c.hierarchy.length}},parent:{get:function(){return c.hierarchy[0].layerInterface}},rotation:getDescriptor(f,"rotation"),scale:getDescriptor(f,"scale"),position:getDescriptor(f,"position"),opacity:getDescriptor(f,"opacity"),anchorPoint:P,anchor_point:P,transform:{get:function(){return f}},active:{get:function(){return c.isInRange}}}),m.startTime=c.data.st,m.index=c.data.ind,m.source=c.data.refId,m.height=c.data.ty===0?c.data.h:100,m.width=c.data.ty===0?c.data.w:100,m.inPoint=c.data.ip/c.comp.globalData.frameRate,m.outPoint=c.data.op/c.comp.globalData.frameRate,m._name=c.data.nm,m.registerMaskInterface=p,m.registerEffectsInterface=d,m}}(),propertyGroupFactory=function(){return function(n,e){return function(i){return i=i===void 0?1:i,i<=0?n:e(i-1)}}}(),PropertyInterface=function(){return function(n,e){var i={_name:n};function s(r){return r=r===void 0?1:r,r<=0?i:e(r-1)}return s}}(),EffectsExpressionInterface=function(){var n={createEffectsInterface:e};function e(r,a){if(r.effectsManager){var o=[],l=r.data.ef,u,c=r.effectsManager.effectElements.length;for(u=0;u<c;u+=1)o.push(i(l[u],r.effectsManager.effectElements[u],a,r));var f=r.data.ef||[],p=function(m){for(u=0,c=f.length;u<c;){if(m===f[u].nm||m===f[u].mn||m===f[u].ix)return o[u];u+=1}return null};return Object.defineProperty(p,"numProperties",{get:function(){return f.length}}),p}return null}function i(r,a,o,l){function u(m){for(var P=r.ef,T=0,x=P.length;T<x;){if(m===P[T].nm||m===P[T].mn||m===P[T].ix)return P[T].ty===5?f[T]:f[T]();T+=1}throw new Error}var c=propertyGroupFactory(u,o),f=[],p,d=r.ef.length;for(p=0;p<d;p+=1)r.ef[p].ty===5?f.push(i(r.ef[p],a.effectElements[p],a.effectElements[p].propertyGroup,l)):f.push(s(a.effectElements[p],r.ef[p].ty,l,c));return r.mn==="ADBE Color Control"&&Object.defineProperty(u,"color",{get:function(){return f[0]()}}),Object.defineProperties(u,{numProperties:{get:function(){return r.np}},_name:{value:r.nm},propertyGroup:{value:c}}),u.enabled=r.en!==0,u.active=u.enabled,u}function s(r,a,o,l){var u=ExpressionPropertyInterface(r.p);function c(){return a===10?o.comp.compInterface(r.p.v):u()}return r.p.setGroupProperty&&r.p.setGroupProperty(PropertyInterface("",l)),c}return n}(),ShapePathInterface=function(){return function(e,i,s){var r=i.sh;function a(l){return l==="Shape"||l==="shape"||l==="Path"||l==="path"||l==="ADBE Vector Shape"||l===2?a.path:null}var o=propertyGroupFactory(a,s);return r.setGroupProperty(PropertyInterface("Path",o)),Object.defineProperties(a,{path:{get:function(){return r.k&&r.getValue(),r}},shape:{get:function(){return r.k&&r.getValue(),r}},_name:{value:e.nm},ix:{value:e.ix},propertyIndex:{value:e.ix},mn:{value:e.mn},propertyGroup:{value:s}}),a}}(),ShapeExpressionInterface=function(){function n(P,T,x){var y=[],C,g=P?P.length:0;for(C=0;C<g;C+=1)P[C].ty==="gr"?y.push(i(P[C],T[C],x)):P[C].ty==="fl"?y.push(s(P[C],T[C],x)):P[C].ty==="st"?y.push(o(P[C],T[C],x)):P[C].ty==="tm"?y.push(l(P[C],T[C],x)):P[C].ty==="tr"||(P[C].ty==="el"?y.push(c(P[C],T[C],x)):P[C].ty==="sr"?y.push(f(P[C],T[C],x)):P[C].ty==="sh"?y.push(ShapePathInterface(P[C],T[C],x)):P[C].ty==="rc"?y.push(p(P[C],T[C],x)):P[C].ty==="rd"?y.push(d(P[C],T[C],x)):P[C].ty==="rp"?y.push(m(P[C],T[C],x)):P[C].ty==="gf"?y.push(r(P[C],T[C],x)):y.push(a(P[C],T[C])));return y}function e(P,T,x){var y,C=function(E){for(var A=0,M=y.length;A<M;){if(y[A]._name===E||y[A].mn===E||y[A].propertyIndex===E||y[A].ix===E||y[A].ind===E)return y[A];A+=1}return typeof E=="number"?y[E-1]:null};C.propertyGroup=propertyGroupFactory(C,x),y=n(P.it,T.it,C.propertyGroup),C.numProperties=y.length;var g=u(P.it[P.it.length-1],T.it[T.it.length-1],C.propertyGroup);return C.transform=g,C.propertyIndex=P.cix,C._name=P.nm,C}function i(P,T,x){var y=function(E){switch(E){case"ADBE Vectors Group":case"Contents":case 2:return y.content;default:return y.transform}};y.propertyGroup=propertyGroupFactory(y,x);var C=e(P,T,y.propertyGroup),g=u(P.it[P.it.length-1],T.it[T.it.length-1],y.propertyGroup);return y.content=C,y.transform=g,Object.defineProperty(y,"_name",{get:function(){return P.nm}}),y.numProperties=P.np,y.propertyIndex=P.ix,y.nm=P.nm,y.mn=P.mn,y}function s(P,T,x){function y(C){return C==="Color"||C==="color"?y.color:C==="Opacity"||C==="opacity"?y.opacity:null}return Object.defineProperties(y,{color:{get:ExpressionPropertyInterface(T.c)},opacity:{get:ExpressionPropertyInterface(T.o)},_name:{value:P.nm},mn:{value:P.mn}}),T.c.setGroupProperty(PropertyInterface("Color",x)),T.o.setGroupProperty(PropertyInterface("Opacity",x)),y}function r(P,T,x){function y(C){return C==="Start Point"||C==="start point"?y.startPoint:C==="End Point"||C==="end point"?y.endPoint:C==="Opacity"||C==="opacity"?y.opacity:null}return Object.defineProperties(y,{startPoint:{get:ExpressionPropertyInterface(T.s)},endPoint:{get:ExpressionPropertyInterface(T.e)},opacity:{get:ExpressionPropertyInterface(T.o)},type:{get:function(){return"a"}},_name:{value:P.nm},mn:{value:P.mn}}),T.s.setGroupProperty(PropertyInterface("Start Point",x)),T.e.setGroupProperty(PropertyInterface("End Point",x)),T.o.setGroupProperty(PropertyInterface("Opacity",x)),y}function a(){function P(){return null}return P}function o(P,T,x){var y=propertyGroupFactory(M,x),C=propertyGroupFactory(A,y);function g(b){Object.defineProperty(A,P.d[b].nm,{get:ExpressionPropertyInterface(T.d.dataProps[b].p)})}var S,E=P.d?P.d.length:0,A={};for(S=0;S<E;S+=1)g(S),T.d.dataProps[S].p.setGroupProperty(C);function M(b){return b==="Color"||b==="color"?M.color:b==="Opacity"||b==="opacity"?M.opacity:b==="Stroke Width"||b==="stroke width"?M.strokeWidth:null}return Object.defineProperties(M,{color:{get:ExpressionPropertyInterface(T.c)},opacity:{get:ExpressionPropertyInterface(T.o)},strokeWidth:{get:ExpressionPropertyInterface(T.w)},dash:{get:function(){return A}},_name:{value:P.nm},mn:{value:P.mn}}),T.c.setGroupProperty(PropertyInterface("Color",y)),T.o.setGroupProperty(PropertyInterface("Opacity",y)),T.w.setGroupProperty(PropertyInterface("Stroke Width",y)),M}function l(P,T,x){function y(g){return g===P.e.ix||g==="End"||g==="end"?y.end:g===P.s.ix?y.start:g===P.o.ix?y.offset:null}var C=propertyGroupFactory(y,x);return y.propertyIndex=P.ix,T.s.setGroupProperty(PropertyInterface("Start",C)),T.e.setGroupProperty(PropertyInterface("End",C)),T.o.setGroupProperty(PropertyInterface("Offset",C)),y.propertyIndex=P.ix,y.propertyGroup=x,Object.defineProperties(y,{start:{get:ExpressionPropertyInterface(T.s)},end:{get:ExpressionPropertyInterface(T.e)},offset:{get:ExpressionPropertyInterface(T.o)},_name:{value:P.nm}}),y.mn=P.mn,y}function u(P,T,x){function y(g){return P.a.ix===g||g==="Anchor Point"?y.anchorPoint:P.o.ix===g||g==="Opacity"?y.opacity:P.p.ix===g||g==="Position"?y.position:P.r.ix===g||g==="Rotation"||g==="ADBE Vector Rotation"?y.rotation:P.s.ix===g||g==="Scale"?y.scale:P.sk&&P.sk.ix===g||g==="Skew"?y.skew:P.sa&&P.sa.ix===g||g==="Skew Axis"?y.skewAxis:null}var C=propertyGroupFactory(y,x);return T.transform.mProps.o.setGroupProperty(PropertyInterface("Opacity",C)),T.transform.mProps.p.setGroupProperty(PropertyInterface("Position",C)),T.transform.mProps.a.setGroupProperty(PropertyInterface("Anchor Point",C)),T.transform.mProps.s.setGroupProperty(PropertyInterface("Scale",C)),T.transform.mProps.r.setGroupProperty(PropertyInterface("Rotation",C)),T.transform.mProps.sk&&(T.transform.mProps.sk.setGroupProperty(PropertyInterface("Skew",C)),T.transform.mProps.sa.setGroupProperty(PropertyInterface("Skew Angle",C))),T.transform.op.setGroupProperty(PropertyInterface("Opacity",C)),Object.defineProperties(y,{opacity:{get:ExpressionPropertyInterface(T.transform.mProps.o)},position:{get:ExpressionPropertyInterface(T.transform.mProps.p)},anchorPoint:{get:ExpressionPropertyInterface(T.transform.mProps.a)},scale:{get:ExpressionPropertyInterface(T.transform.mProps.s)},rotation:{get:ExpressionPropertyInterface(T.transform.mProps.r)},skew:{get:ExpressionPropertyInterface(T.transform.mProps.sk)},skewAxis:{get:ExpressionPropertyInterface(T.transform.mProps.sa)},_name:{value:P.nm}}),y.ty="tr",y.mn=P.mn,y.propertyGroup=x,y}function c(P,T,x){function y(S){return P.p.ix===S?y.position:P.s.ix===S?y.size:null}var C=propertyGroupFactory(y,x);y.propertyIndex=P.ix;var g=T.sh.ty==="tm"?T.sh.prop:T.sh;return g.s.setGroupProperty(PropertyInterface("Size",C)),g.p.setGroupProperty(PropertyInterface("Position",C)),Object.defineProperties(y,{size:{get:ExpressionPropertyInterface(g.s)},position:{get:ExpressionPropertyInterface(g.p)},_name:{value:P.nm}}),y.mn=P.mn,y}function f(P,T,x){function y(S){return P.p.ix===S?y.position:P.r.ix===S?y.rotation:P.pt.ix===S?y.points:P.or.ix===S||S==="ADBE Vector Star Outer Radius"?y.outerRadius:P.os.ix===S?y.outerRoundness:P.ir&&(P.ir.ix===S||S==="ADBE Vector Star Inner Radius")?y.innerRadius:P.is&&P.is.ix===S?y.innerRoundness:null}var C=propertyGroupFactory(y,x),g=T.sh.ty==="tm"?T.sh.prop:T.sh;return y.propertyIndex=P.ix,g.or.setGroupProperty(PropertyInterface("Outer Radius",C)),g.os.setGroupProperty(PropertyInterface("Outer Roundness",C)),g.pt.setGroupProperty(PropertyInterface("Points",C)),g.p.setGroupProperty(PropertyInterface("Position",C)),g.r.setGroupProperty(PropertyInterface("Rotation",C)),P.ir&&(g.ir.setGroupProperty(PropertyInterface("Inner Radius",C)),g.is.setGroupProperty(PropertyInterface("Inner Roundness",C))),Object.defineProperties(y,{position:{get:ExpressionPropertyInterface(g.p)},rotation:{get:ExpressionPropertyInterface(g.r)},points:{get:ExpressionPropertyInterface(g.pt)},outerRadius:{get:ExpressionPropertyInterface(g.or)},outerRoundness:{get:ExpressionPropertyInterface(g.os)},innerRadius:{get:ExpressionPropertyInterface(g.ir)},innerRoundness:{get:ExpressionPropertyInterface(g.is)},_name:{value:P.nm}}),y.mn=P.mn,y}function p(P,T,x){function y(S){return P.p.ix===S?y.position:P.r.ix===S?y.roundness:P.s.ix===S||S==="Size"||S==="ADBE Vector Rect Size"?y.size:null}var C=propertyGroupFactory(y,x),g=T.sh.ty==="tm"?T.sh.prop:T.sh;return y.propertyIndex=P.ix,g.p.setGroupProperty(PropertyInterface("Position",C)),g.s.setGroupProperty(PropertyInterface("Size",C)),g.r.setGroupProperty(PropertyInterface("Rotation",C)),Object.defineProperties(y,{position:{get:ExpressionPropertyInterface(g.p)},roundness:{get:ExpressionPropertyInterface(g.r)},size:{get:ExpressionPropertyInterface(g.s)},_name:{value:P.nm}}),y.mn=P.mn,y}function d(P,T,x){function y(S){return P.r.ix===S||S==="Round Corners 1"?y.radius:null}var C=propertyGroupFactory(y,x),g=T;return y.propertyIndex=P.ix,g.rd.setGroupProperty(PropertyInterface("Radius",C)),Object.defineProperties(y,{radius:{get:ExpressionPropertyInterface(g.rd)},_name:{value:P.nm}}),y.mn=P.mn,y}function m(P,T,x){function y(S){return P.c.ix===S||S==="Copies"?y.copies:P.o.ix===S||S==="Offset"?y.offset:null}var C=propertyGroupFactory(y,x),g=T;return y.propertyIndex=P.ix,g.c.setGroupProperty(PropertyInterface("Copies",C)),g.o.setGroupProperty(PropertyInterface("Offset",C)),Object.defineProperties(y,{copies:{get:ExpressionPropertyInterface(g.c)},offset:{get:ExpressionPropertyInterface(g.o)},_name:{value:P.nm}}),y.mn=P.mn,y}return function(P,T,x){var y;function C(S){if(typeof S=="number")return S=S===void 0?1:S,S===0?x:y[S-1];for(var E=0,A=y.length;E<A;){if(y[E]._name===S)return y[E];E+=1}return null}function g(){return x}return C.propertyGroup=propertyGroupFactory(C,g),y=n(P,T,C.propertyGroup),C.numProperties=y.length,C._name="Contents",C}}(),TextExpressionInterface=function(){return function(n){var e;function i(s){switch(s){case"ADBE Text Document":return i.sourceText;default:return null}}return Object.defineProperty(i,"sourceText",{get:function(){n.textProperty.getValue();var r=n.textProperty.currentData.t;return(!e||r!==e.value)&&(e=new String(r),e.value=r||new String(r),Object.defineProperty(e,"style",{get:function(){return{fillColor:n.textProperty.currentData.fc}}})),e}}),i}}();function _typeof(n){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(n)}var FootageInterface=function(){var n=function(s){var r="",a=s.getFootageData();function o(){return r="",a=s.getFootageData(),l}function l(u){if(a[u])return r=u,a=a[u],_typeof(a)==="object"?l:a;var c=u.indexOf(r);if(c!==-1){var f=parseInt(u.substr(c+r.length),10);return a=a[f],_typeof(a)==="object"?l:a}return""}return o},e=function(s){function r(a){return a==="Outline"?r.outlineInterface():null}return r._name="Outline",r.outlineInterface=n(s),r};return function(i){function s(r){return r==="Data"?s.dataInterface:null}return s._name="Data",s.dataInterface=e(i),s}}(),interfaces={layer:LayerExpressionInterface,effects:EffectsExpressionInterface,comp:CompExpressionInterface,shape:ShapeExpressionInterface,text:TextExpressionInterface,footage:FootageInterface};function getInterface(n){return interfaces[n]||null}var expressionHelpers=function(){function n(o,l,u){l.x&&(u.k=!0,u.x=!0,u.initiateExpression=ExpressionManager.initiateExpression,u.effectsSequence.push(u.initiateExpression(o,l,u).bind(u)))}function e(o){return o*=this.elem.globalData.frameRate,o-=this.offsetTime,o!==this._cachingAtTime.lastFrame&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastFrame<o?this._cachingAtTime.lastIndex:0,this._cachingAtTime.value=this.interpolateValue(o,this._cachingAtTime),this._cachingAtTime.lastFrame=o),this._cachingAtTime.value}function i(o){var l=-.01,u=this.getValueAtTime(o),c=this.getValueAtTime(o+l),f=0;if(u.length){var p;for(p=0;p<u.length;p+=1)f+=Math.pow(c[p]-u[p],2);f=Math.sqrt(f)*100}else f=0;return f}function s(o){if(this.vel!==void 0)return this.vel;var l=-.001,u=this.getValueAtTime(o),c=this.getValueAtTime(o+l),f;if(u.length){f=createTypedArray("float32",u.length);var p;for(p=0;p<u.length;p+=1)f[p]=(c[p]-u[p])/l}else f=(c-u)/l;return f}function r(){return this.pv}function a(o){this.propertyGroup=o}return{searchExpressions:n,getSpeedAtTime:i,getVelocityAtTime:s,getValueAtTime:e,getStaticValueAtTime:r,setGroupProperty:a}}();function addPropertyDecorator(){function n(d,m,P){if(!this.k||!this.keyframes)return this.pv;d=d?d.toLowerCase():"";var T=this.comp.renderedFrame,x=this.keyframes,y=x[x.length-1].t;if(T<=y)return this.pv;var C,g;P?(m?C=Math.abs(y-this.elem.comp.globalData.frameRate*m):C=Math.max(0,y-this.elem.data.ip),g=y-C):((!m||m>x.length-1)&&(m=x.length-1),g=x[x.length-1-m].t,C=y-g);var S,E,A;if(d==="pingpong"){var M=Math.floor((T-g)/C);if(M%2!==0)return this.getValueAtTime((C-(T-g)%C+g)/this.comp.globalData.frameRate,0)}else if(d==="offset"){var b=this.getValueAtTime(g/this.comp.globalData.frameRate,0),F=this.getValueAtTime(y/this.comp.globalData.frameRate,0),G=this.getValueAtTime(((T-g)%C+g)/this.comp.globalData.frameRate,0),L=Math.floor((T-g)/C);if(this.pv.length){for(A=new Array(b.length),E=A.length,S=0;S<E;S+=1)A[S]=(F[S]-b[S])*L+G[S];return A}return(F-b)*L+G}else if(d==="continue"){var D=this.getValueAtTime(y/this.comp.globalData.frameRate,0),U=this.getValueAtTime((y-.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(A=new Array(D.length),E=A.length,S=0;S<E;S+=1)A[S]=D[S]+(D[S]-U[S])*((T-y)/this.comp.globalData.frameRate)/5e-4;return A}return D+(D-U)*((T-y)/.001)}return this.getValueAtTime(((T-g)%C+g)/this.comp.globalData.frameRate,0)}function e(d,m,P){if(!this.k)return this.pv;d=d?d.toLowerCase():"";var T=this.comp.renderedFrame,x=this.keyframes,y=x[0].t;if(T>=y)return this.pv;var C,g;P?(m?C=Math.abs(this.elem.comp.globalData.frameRate*m):C=Math.max(0,this.elem.data.op-y),g=y+C):((!m||m>x.length-1)&&(m=x.length-1),g=x[m].t,C=g-y);var S,E,A;if(d==="pingpong"){var M=Math.floor((y-T)/C);if(M%2===0)return this.getValueAtTime(((y-T)%C+y)/this.comp.globalData.frameRate,0)}else if(d==="offset"){var b=this.getValueAtTime(y/this.comp.globalData.frameRate,0),F=this.getValueAtTime(g/this.comp.globalData.frameRate,0),G=this.getValueAtTime((C-(y-T)%C+y)/this.comp.globalData.frameRate,0),L=Math.floor((y-T)/C)+1;if(this.pv.length){for(A=new Array(b.length),E=A.length,S=0;S<E;S+=1)A[S]=G[S]-(F[S]-b[S])*L;return A}return G-(F-b)*L}else if(d==="continue"){var D=this.getValueAtTime(y/this.comp.globalData.frameRate,0),U=this.getValueAtTime((y+.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(A=new Array(D.length),E=A.length,S=0;S<E;S+=1)A[S]=D[S]+(D[S]-U[S])*(y-T)/.001;return A}return D+(D-U)*(y-T)/.001}return this.getValueAtTime((C-((y-T)%C+y))/this.comp.globalData.frameRate,0)}function i(d,m){if(!this.k)return this.pv;if(d=(d||.4)*.5,m=Math.floor(m||5),m<=1)return this.pv;var P=this.comp.renderedFrame/this.comp.globalData.frameRate,T=P-d,x=P+d,y=m>1?(x-T)/(m-1):1,C=0,g=0,S;this.pv.length?S=createTypedArray("float32",this.pv.length):S=0;for(var E;C<m;){if(E=this.getValueAtTime(T+C*y),this.pv.length)for(g=0;g<this.pv.length;g+=1)S[g]+=E[g];else S+=E;C+=1}if(this.pv.length)for(g=0;g<this.pv.length;g+=1)S[g]/=m;else S/=m;return S}function s(d){this._transformCachingAtTime||(this._transformCachingAtTime={v:new Matrix});var m=this._transformCachingAtTime.v;if(m.cloneFromProps(this.pre.props),this.appliedTransformations<1){var P=this.a.getValueAtTime(d);m.translate(-P[0]*this.a.mult,-P[1]*this.a.mult,P[2]*this.a.mult)}if(this.appliedTransformations<2){var T=this.s.getValueAtTime(d);m.scale(T[0]*this.s.mult,T[1]*this.s.mult,T[2]*this.s.mult)}if(this.sk&&this.appliedTransformations<3){var x=this.sk.getValueAtTime(d),y=this.sa.getValueAtTime(d);m.skewFromAxis(-x*this.sk.mult,y*this.sa.mult)}if(this.r&&this.appliedTransformations<4){var C=this.r.getValueAtTime(d);m.rotate(-C*this.r.mult)}else if(!this.r&&this.appliedTransformations<4){var g=this.rz.getValueAtTime(d),S=this.ry.getValueAtTime(d),E=this.rx.getValueAtTime(d),A=this.or.getValueAtTime(d);m.rotateZ(-g*this.rz.mult).rotateY(S*this.ry.mult).rotateX(E*this.rx.mult).rotateZ(-A[2]*this.or.mult).rotateY(A[1]*this.or.mult).rotateX(A[0]*this.or.mult)}if(this.data.p&&this.data.p.s){var M=this.px.getValueAtTime(d),b=this.py.getValueAtTime(d);if(this.data.p.z){var F=this.pz.getValueAtTime(d);m.translate(M*this.px.mult,b*this.py.mult,-F*this.pz.mult)}else m.translate(M*this.px.mult,b*this.py.mult,0)}else{var G=this.p.getValueAtTime(d);m.translate(G[0]*this.p.mult,G[1]*this.p.mult,-G[2]*this.p.mult)}return m}function r(){return this.v.clone(new Matrix)}var a=TransformPropertyFactory.getTransformProperty;TransformPropertyFactory.getTransformProperty=function(d,m,P){var T=a(d,m,P);return T.dynamicProperties.length?T.getValueAtTime=s.bind(T):T.getValueAtTime=r.bind(T),T.setGroupProperty=expressionHelpers.setGroupProperty,T};var o=PropertyFactory.getProp;PropertyFactory.getProp=function(d,m,P,T,x){var y=o(d,m,P,T,x);y.kf?y.getValueAtTime=expressionHelpers.getValueAtTime.bind(y):y.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(y),y.setGroupProperty=expressionHelpers.setGroupProperty,y.loopOut=n,y.loopIn=e,y.smooth=i,y.getVelocityAtTime=expressionHelpers.getVelocityAtTime.bind(y),y.getSpeedAtTime=expressionHelpers.getSpeedAtTime.bind(y),y.numKeys=m.a===1?m.k.length:0,y.propertyIndex=m.ix;var C=0;return P!==0&&(C=createTypedArray("float32",m.a===1?m.k[0].s.length:m.k.length)),y._cachingAtTime={lastFrame:initialDefaultFrame,lastIndex:0,value:C},expressionHelpers.searchExpressions(d,m,y),y.k&&x.addDynamicProperty(y),y};function l(d){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),d*=this.elem.globalData.frameRate,d-=this.offsetTime,d!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime<d?this._caching.lastIndex:0,this._cachingAtTime.lastTime=d,this.interpolateShape(d,this._cachingAtTime.shapeValue,this._cachingAtTime)),this._cachingAtTime.shapeValue}var u=ShapePropertyFactory.getConstructorFunction(),c=ShapePropertyFactory.getKeyframedConstructorFunction();function f(){}f.prototype={vertices:function(m,P){this.k&&this.getValue();var T=this.v;P!==void 0&&(T=this.getValueAtTime(P,0));var x,y=T._length,C=T[m],g=T.v,S=createSizedArray(y);for(x=0;x<y;x+=1)m==="i"||m==="o"?S[x]=[C[x][0]-g[x][0],C[x][1]-g[x][1]]:S[x]=[C[x][0],C[x][1]];return S},points:function(m){return this.vertices("v",m)},inTangents:function(m){return this.vertices("i",m)},outTangents:function(m){return this.vertices("o",m)},isClosed:function(){return this.v.c},pointOnPath:function(m,P){var T=this.v;P!==void 0&&(T=this.getValueAtTime(P,0)),this._segmentsLength||(this._segmentsLength=bez.getSegmentsLength(T));for(var x=this._segmentsLength,y=x.lengths,C=x.totalLength*m,g=0,S=y.length,E=0,A;g<S;){if(E+y[g].addedLength>C){var M=g,b=T.c&&g===S-1?0:g+1,F=(C-E)/y[g].addedLength;A=bez.getPointInSegment(T.v[M],T.v[b],T.o[M],T.i[b],F,y[g]);break}else E+=y[g].addedLength;g+=1}return A||(A=T.c?[T.v[0][0],T.v[0][1]]:[T.v[T._length-1][0],T.v[T._length-1][1]]),A},vectorOnPath:function(m,P,T){m==1?m=this.v.c:m==0&&(m=.999);var x=this.pointOnPath(m,P),y=this.pointOnPath(m+.001,P),C=y[0]-x[0],g=y[1]-x[1],S=Math.sqrt(Math.pow(C,2)+Math.pow(g,2));if(S===0)return[0,0];var E=T==="tangent"?[C/S,g/S]:[-g/S,C/S];return E},tangentOnPath:function(m,P){return this.vectorOnPath(m,P,"tangent")},normalOnPath:function(m,P){return this.vectorOnPath(m,P,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([f],u),extendPrototype([f],c),c.prototype.getValueAtTime=l,c.prototype.initiateExpression=ExpressionManager.initiateExpression;var p=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(d,m,P,T,x){var y=p(d,m,P,T,x);return y.propertyIndex=m.ix,y.lock=!1,P===3?expressionHelpers.searchExpressions(d,m.pt,y):P===4&&expressionHelpers.searchExpressions(d,m.ks,y),y.k&&d.addDynamicProperty(y),y}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function n(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(e,i){var s=this.calculateExpression(i);if(e.t!==s){var r={};return this.copyData(r,e),r.t=s.toString(),r.__complete=!1,r}return e},TextProperty.prototype.searchProperty=function(){var e=this.searchKeyframes(),i=this.searchExpressions();return this.kf=e||i,this.kf},TextProperty.prototype.searchExpressions=n}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function n(e,i){var s=createNS("feMerge");s.setAttribute("result",e);var r,a;for(a=0;a<i.length;a+=1)r=createNS("feMergeNode"),r.setAttribute("in",i[a]),s.appendChild(r),s.appendChild(r);return s}};var linearFilterValue="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0";function SVGTintFilter(n,e,i,s,r){this.filterManager=e;var a=createNS("feColorMatrix");a.setAttribute("type","matrix"),a.setAttribute("color-interpolation-filters","linearRGB"),a.setAttribute("values",linearFilterValue+" 1 0"),this.linearFilter=a,a.setAttribute("result",s+"_tint_1"),n.appendChild(a),a=createNS("feColorMatrix"),a.setAttribute("type","matrix"),a.setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),a.setAttribute("result",s+"_tint_2"),n.appendChild(a),this.matrixFilter=a;var o=this.createMergeNode(s,[r,s+"_tint_1",s+"_tint_2"]);n.appendChild(o)}extendPrototype([SVGComposableEffect],SVGTintFilter),SVGTintFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,s=this.filterManager.effectElements[2].p.v/100;this.linearFilter.setAttribute("values",linearFilterValue+" "+s+" 0"),this.matrixFilter.setAttribute("values",i[0]-e[0]+" 0 0 0 "+e[0]+" "+(i[1]-e[1])+" 0 0 0 "+e[1]+" "+(i[2]-e[2])+" 0 0 0 "+e[2]+" 0 0 0 1 0")}};function SVGFillFilter(n,e,i,s){this.filterManager=e;var r=createNS("feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),r.setAttribute("result",s),n.appendChild(r),this.matrixFilter=r}SVGFillFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[2].p.v,i=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+e[0]+" 0 0 0 0 "+e[1]+" 0 0 0 0 "+e[2]+" 0 0 0 "+i+" 0")}};function SVGStrokeEffect(n,e,i){this.initialized=!1,this.filterManager=e,this.elem=i,this.paths=[]}SVGStrokeEffect.prototype.initialize=function(){var n=this.elem.layerElement.children||this.elem.layerElement.childNodes,e,i,s,r;for(this.filterManager.effectElements[1].p.v===1?(r=this.elem.maskManager.masksProperties.length,s=0):(s=this.filterManager.effectElements[0].p.v-1,r=s+1),i=createNS("g"),i.setAttribute("fill","none"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-dashoffset",1),s;s<r;s+=1)e=createNS("path"),i.appendChild(e),this.paths.push({p:e,m:s});if(this.filterManager.effectElements[10].p.v===3){var a=createNS("mask"),o=createElementID();a.setAttribute("id",o),a.setAttribute("mask-type","alpha"),a.appendChild(i),this.elem.globalData.defs.appendChild(a);var l=createNS("g");for(l.setAttribute("mask","url("+getLocationHref()+"#"+o+")");n[0];)l.appendChild(n[0]);this.elem.layerElement.appendChild(l),this.masker=a,i.setAttribute("stroke","#fff")}else if(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2){if(this.filterManager.effectElements[10].p.v===2)for(n=this.elem.layerElement.children||this.elem.layerElement.childNodes;n.length;)this.elem.layerElement.removeChild(n[0]);this.elem.layerElement.appendChild(i),this.elem.layerElement.removeAttribute("mask"),i.setAttribute("stroke","#fff")}this.initialized=!0,this.pathMasker=i},SVGStrokeEffect.prototype.renderFrame=function(n){this.initialized||this.initialize();var e,i=this.paths.length,s,r;for(e=0;e<i;e+=1)if(this.paths[e].m!==-1&&(s=this.elem.maskManager.viewData[this.paths[e].m],r=this.paths[e].p,(n||this.filterManager._mdf||s.prop._mdf)&&r.setAttribute("d",s.lastPath),n||this.filterManager.effectElements[9].p._mdf||this.filterManager.effectElements[4].p._mdf||this.filterManager.effectElements[7].p._mdf||this.filterManager.effectElements[8].p._mdf||s.prop._mdf)){var a;if(this.filterManager.effectElements[7].p.v!==0||this.filterManager.effectElements[8].p.v!==100){var o=Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,l=Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,u=r.getTotalLength();a="0 0 0 "+u*o+" ";var c=u*(l-o),f=1+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01,p=Math.floor(c/f),d;for(d=0;d<p;d+=1)a+="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01+" ";a+="0 "+u*10+" 0 0"}else a="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01;r.setAttribute("stroke-dasharray",a)}if((n||this.filterManager.effectElements[4].p._mdf)&&this.pathMasker.setAttribute("stroke-width",this.filterManager.effectElements[4].p.v*2),(n||this.filterManager.effectElements[6].p._mdf)&&this.pathMasker.setAttribute("opacity",this.filterManager.effectElements[6].p.v),(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2)&&(n||this.filterManager.effectElements[3].p._mdf)){var m=this.filterManager.effectElements[3].p.v;this.pathMasker.setAttribute("stroke","rgb("+bmFloor(m[0]*255)+","+bmFloor(m[1]*255)+","+bmFloor(m[2]*255)+")")}};function SVGTritoneFilter(n,e,i,s){this.filterManager=e;var r=createNS("feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","linearRGB"),r.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),n.appendChild(r);var a=createNS("feComponentTransfer");a.setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("result",s),this.matrixFilter=a;var o=createNS("feFuncR");o.setAttribute("type","table"),a.appendChild(o),this.feFuncR=o;var l=createNS("feFuncG");l.setAttribute("type","table"),a.appendChild(l),this.feFuncG=l;var u=createNS("feFuncB");u.setAttribute("type","table"),a.appendChild(u),this.feFuncB=u,n.appendChild(a)}SVGTritoneFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,s=this.filterManager.effectElements[2].p.v,r=s[0]+" "+i[0]+" "+e[0],a=s[1]+" "+i[1]+" "+e[1],o=s[2]+" "+i[2]+" "+e[2];this.feFuncR.setAttribute("tableValues",r),this.feFuncG.setAttribute("tableValues",a),this.feFuncB.setAttribute("tableValues",o)}};function SVGProLevelsFilter(n,e,i,s){this.filterManager=e;var r=this.filterManager.effectElements,a=createNS("feComponentTransfer");(r[10].p.k||r[10].p.v!==0||r[11].p.k||r[11].p.v!==1||r[12].p.k||r[12].p.v!==1||r[13].p.k||r[13].p.v!==0||r[14].p.k||r[14].p.v!==1)&&(this.feFuncR=this.createFeFunc("feFuncR",a)),(r[17].p.k||r[17].p.v!==0||r[18].p.k||r[18].p.v!==1||r[19].p.k||r[19].p.v!==1||r[20].p.k||r[20].p.v!==0||r[21].p.k||r[21].p.v!==1)&&(this.feFuncG=this.createFeFunc("feFuncG",a)),(r[24].p.k||r[24].p.v!==0||r[25].p.k||r[25].p.v!==1||r[26].p.k||r[26].p.v!==1||r[27].p.k||r[27].p.v!==0||r[28].p.k||r[28].p.v!==1)&&(this.feFuncB=this.createFeFunc("feFuncB",a)),(r[31].p.k||r[31].p.v!==0||r[32].p.k||r[32].p.v!==1||r[33].p.k||r[33].p.v!==1||r[34].p.k||r[34].p.v!==0||r[35].p.k||r[35].p.v!==1)&&(this.feFuncA=this.createFeFunc("feFuncA",a)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(a.setAttribute("color-interpolation-filters","sRGB"),n.appendChild(a)),(r[3].p.k||r[3].p.v!==0||r[4].p.k||r[4].p.v!==1||r[5].p.k||r[5].p.v!==1||r[6].p.k||r[6].p.v!==0||r[7].p.k||r[7].p.v!==1)&&(a=createNS("feComponentTransfer"),a.setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("result",s),n.appendChild(a),this.feFuncRComposed=this.createFeFunc("feFuncR",a),this.feFuncGComposed=this.createFeFunc("feFuncG",a),this.feFuncBComposed=this.createFeFunc("feFuncB",a))}SVGProLevelsFilter.prototype.createFeFunc=function(n,e){var i=createNS(n);return i.setAttribute("type","table"),e.appendChild(i),i},SVGProLevelsFilter.prototype.getTableValue=function(n,e,i,s,r){for(var a=0,o=256,l,u=Math.min(n,e),c=Math.max(n,e),f=Array.call(null,{length:o}),p,d=0,m=r-s,P=e-n;a<=256;)l=a/256,l<=u?p=P<0?r:s:l>=c?p=P<0?s:r:p=s+m*Math.pow((l-n)/P,1/i),f[d]=p,d+=1,a+=256/(o-1);return f.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e,i=this.filterManager.effectElements;this.feFuncRComposed&&(n||i[3].p._mdf||i[4].p._mdf||i[5].p._mdf||i[6].p._mdf||i[7].p._mdf)&&(e=this.getTableValue(i[3].p.v,i[4].p.v,i[5].p.v,i[6].p.v,i[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(n||i[10].p._mdf||i[11].p._mdf||i[12].p._mdf||i[13].p._mdf||i[14].p._mdf)&&(e=this.getTableValue(i[10].p.v,i[11].p.v,i[12].p.v,i[13].p.v,i[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(n||i[17].p._mdf||i[18].p._mdf||i[19].p._mdf||i[20].p._mdf||i[21].p._mdf)&&(e=this.getTableValue(i[17].p.v,i[18].p.v,i[19].p.v,i[20].p.v,i[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(n||i[24].p._mdf||i[25].p._mdf||i[26].p._mdf||i[27].p._mdf||i[28].p._mdf)&&(e=this.getTableValue(i[24].p.v,i[25].p.v,i[26].p.v,i[27].p.v,i[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(n||i[31].p._mdf||i[32].p._mdf||i[33].p._mdf||i[34].p._mdf||i[35].p._mdf)&&(e=this.getTableValue(i[31].p.v,i[32].p.v,i[33].p.v,i[34].p.v,i[35].p.v),this.feFuncA.setAttribute("tableValues",e))}};function SVGDropShadowEffect(n,e,i,s,r){var a=e.container.globalData.renderConfig.filterSize,o=e.data.fs||a;n.setAttribute("x",o.x||a.x),n.setAttribute("y",o.y||a.y),n.setAttribute("width",o.width||a.width),n.setAttribute("height",o.height||a.height),this.filterManager=e;var l=createNS("feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("result",s+"_drop_shadow_1"),l.setAttribute("stdDeviation","0"),this.feGaussianBlur=l,n.appendChild(l);var u=createNS("feOffset");u.setAttribute("dx","25"),u.setAttribute("dy","0"),u.setAttribute("in",s+"_drop_shadow_1"),u.setAttribute("result",s+"_drop_shadow_2"),this.feOffset=u,n.appendChild(u);var c=createNS("feFlood");c.setAttribute("flood-color","#00ff00"),c.setAttribute("flood-opacity","1"),c.setAttribute("result",s+"_drop_shadow_3"),this.feFlood=c,n.appendChild(c);var f=createNS("feComposite");f.setAttribute("in",s+"_drop_shadow_3"),f.setAttribute("in2",s+"_drop_shadow_2"),f.setAttribute("operator","in"),f.setAttribute("result",s+"_drop_shadow_4"),n.appendChild(f);var p=this.createMergeNode(s,[s+"_drop_shadow_4",r]);n.appendChild(p)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){if((n||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),n||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)))}if((n||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),n||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var i=this.filterManager.effectElements[3].p.v,s=(this.filterManager.effectElements[2].p.v-90)*degToRads,r=i*Math.cos(s),a=i*Math.sin(s);this.feOffset.setAttribute("dx",r),this.feOffset.setAttribute("dy",a)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(n,e,i){this.initialized=!1,this.filterManager=e,this.filterElem=n,this.elem=i,i.matteElement=createNS("g"),i.matteElement.appendChild(i.layerElement),i.matteElement.appendChild(i.transformedElement),i.baseElement=i.matteElement}SVGMatte3Effect.prototype.findSymbol=function(n){for(var e=0,i=_svgMatteSymbols.length;e<i;){if(_svgMatteSymbols[e]===n)return _svgMatteSymbols[e];e+=1}return null},SVGMatte3Effect.prototype.replaceInParent=function(n,e){var i=n.layerElement.parentNode;if(i){for(var s=i.children,r=0,a=s.length;r<a&&s[r]!==n.layerElement;)r+=1;var o;r<=a-2&&(o=s[r+1]);var l=createNS("use");l.setAttribute("href","#"+e),o?i.insertBefore(l,o):i.appendChild(l)}},SVGMatte3Effect.prototype.setElementAsMask=function(n,e){if(!this.findSymbol(e)){var i=createElementID(),s=createNS("mask");s.setAttribute("id",e.layerId),s.setAttribute("mask-type","alpha"),_svgMatteSymbols.push(e);var r=n.globalData.defs;r.appendChild(s);var a=createNS("symbol");a.setAttribute("id",i),this.replaceInParent(e,i),a.appendChild(e.layerElement),r.appendChild(a);var o=createNS("use");o.setAttribute("href","#"+i),s.appendChild(o),e.data.hd=!1,e.show()}n.setMatte(e.layerId)},SVGMatte3Effect.prototype.initialize=function(){for(var n=this.filterManager.effectElements[0].p.v,e=this.elem.comp.elements,i=0,s=e.length;i<s;)e[i]&&e[i].data.ind===n&&this.setElementAsMask(this.elem,e[i]),i+=1;this.initialized=!0},SVGMatte3Effect.prototype.renderFrame=function(){this.initialized||this.initialize()};function SVGGaussianBlurEffect(n,e,i,s){n.setAttribute("x","-100%"),n.setAttribute("y","-100%"),n.setAttribute("width","300%"),n.setAttribute("height","300%"),this.filterManager=e;var r=createNS("feGaussianBlur");r.setAttribute("result",s),n.appendChild(r),this.feGaussianBlur=r}SVGGaussianBlurEffect.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=.3,i=this.filterManager.effectElements[0].p.v*e,s=this.filterManager.effectElements[1].p.v,r=s==3?0:i,a=s==2?0:i;this.feGaussianBlur.setAttribute("stdDeviation",r+" "+a);var o=this.filterManager.effectElements[2].p.v==1?"wrap":"duplicate";this.feGaussianBlur.setAttribute("edgeMode",o)}};function TransformEffect(){}TransformEffect.prototype.init=function(n){this.effectsManager=n,this.type=effectTypes.TRANSFORM_EFFECT,this.matrix=new Matrix,this.opacity=-1,this._mdf=!1,this._opMdf=!1},TransformEffect.prototype.renderFrame=function(n){if(this._opMdf=!1,this._mdf=!1,n||this.effectsManager._mdf){var e=this.effectsManager.effectElements,i=e[0].p.v,s=e[1].p.v,r=e[2].p.v===1,a=e[3].p.v,o=r?a:e[4].p.v,l=e[5].p.v,u=e[6].p.v,c=e[7].p.v;this.matrix.reset(),this.matrix.translate(-i[0],-i[1],i[2]),this.matrix.scale(o*.01,a*.01,1),this.matrix.rotate(-c*degToRads),this.matrix.skewFromAxis(-l*degToRads,(u+90)*degToRads),this.matrix.translate(s[0],s[1],0),this._mdf=!0,this.opacity!==e[8].p.v&&(this.opacity=e[8].p.v,this._opMdf=!0)}};function SVGTransformEffect(n,e){this.init(e)}extendPrototype([TransformEffect],SVGTransformEffect);function CVTransformEffect(n){this.init(n)}return extendPrototype([TransformEffect],CVTransformEffect),registerRenderer("canvas",CanvasRenderer),registerRenderer("html",HybridRenderer),registerRenderer("svg",SVGRenderer),ShapeModifiers.registerModifier("tm",TrimModifier),ShapeModifiers.registerModifier("pb",PuckerAndBloatModifier),ShapeModifiers.registerModifier("rp",RepeaterModifier),ShapeModifiers.registerModifier("rd",RoundCornersModifier),ShapeModifiers.registerModifier("zz",ZigZagModifier),ShapeModifiers.registerModifier("op",OffsetPathModifier),setExpressionsPlugin(Expressions),setExpressionInterfaces(getInterface),initialize$1(),initialize(),registerEffect$1(20,SVGTintFilter,!0),registerEffect$1(21,SVGFillFilter,!0),registerEffect$1(22,SVGStrokeEffect,!1),registerEffect$1(23,SVGTritoneFilter,!0),registerEffect$1(24,SVGProLevelsFilter,!0),registerEffect$1(25,SVGDropShadowEffect,!0),registerEffect$1(28,SVGMatte3Effect,!1),registerEffect$1(29,SVGGaussianBlurEffect,!0),registerEffect$1(35,SVGTransformEffect,!1),registerEffect(35,CVTransformEffect),lottie})})(lottie$1,lottie$1.exports);var lottieExports=lottie$1.exports;const lottie=getDefaultExportFromCjs(lottieExports);function _arrayLikeToArray(n,e){(e==null||e>n.length)&&(e=n.length);for(var i=0,s=Array(e);i<e;i++)s[i]=n[i];return s}function _arrayWithHoles(n){if(Array.isArray(n))return n}function _defineProperty(n,e,i){return(e=_toPropertyKey(e))in n?Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[e]=i,n}function _iterableToArrayLimit(n,e){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var s,r,a,o,l=[],u=!0,c=!1;try{if(a=(i=i.call(n)).next,e!==0)for(;!(u=(s=a.call(i)).done)&&(l.push(s.value),l.length!==e);u=!0);}catch(f){c=!0,r=f}finally{try{if(!u&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return l}}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
148
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ownKeys(n,e){var i=Object.keys(n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),i.push.apply(i,s)}return i}function _objectSpread2(n){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach(function(s){_defineProperty(n,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(s){Object.defineProperty(n,s,Object.getOwnPropertyDescriptor(i,s))})}return n}function _objectWithoutProperties(n,e){if(n==null)return{};var i,s,r=_objectWithoutPropertiesLoose(n,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(s=0;s<a.length;s++)i=a[s],e.includes(i)||{}.propertyIsEnumerable.call(n,i)&&(r[i]=n[i])}return r}function _objectWithoutPropertiesLoose(n,e){if(n==null)return{};var i={};for(var s in n)if({}.hasOwnProperty.call(n,s)){if(e.includes(s))continue;i[s]=n[s]}return i}function _slicedToArray(n,e){return _arrayWithHoles(n)||_iterableToArrayLimit(n,e)||_unsupportedIterableToArray(n,e)||_nonIterableRest()}function _toPrimitive(n,e){if(typeof n!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var s=i.call(n,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _toPropertyKey(n){var e=_toPrimitive(n,"string");return typeof e=="symbol"?e:e+""}function _unsupportedIterableToArray(n,e){if(n){if(typeof n=="string")return _arrayLikeToArray(n,e);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(n,e):void 0}}var _excluded$1=["animationData","loop","autoplay","initialSegment","onComplete","onLoopComplete","onEnterFrame","onSegmentStart","onConfigReady","onDataReady","onDataFailed","onLoadedImages","onDOMLoaded","onDestroy","lottieRef","renderer","name","assetsPath","rendererSettings"],useLottie=function n(e,i){var s=e.animationData,r=e.loop,a=e.autoplay,o=e.initialSegment,l=e.onComplete,u=e.onLoopComplete,c=e.onEnterFrame,f=e.onSegmentStart,p=e.onConfigReady,d=e.onDataReady,m=e.onDataFailed,P=e.onLoadedImages,T=e.onDOMLoaded,x=e.onDestroy;e.lottieRef,e.renderer,e.name,e.assetsPath,e.rendererSettings;var y=_objectWithoutProperties(e,_excluded$1),C=React.useState(!1),g=_slicedToArray(C,2),S=g[0],E=g[1],A=React.useRef(),M=React.useRef(null),b=function(){var N;(N=A.current)===null||N===void 0||N.play()},F=function(){var N;(N=A.current)===null||N===void 0||N.stop()},G=function(){var N;(N=A.current)===null||N===void 0||N.pause()},L=function(N){var H;(H=A.current)===null||H===void 0||H.setSpeed(N)},D=function(N,H){var J;(J=A.current)===null||J===void 0||J.goToAndPlay(N,H)},U=function(N,H){var J;(J=A.current)===null||J===void 0||J.goToAndStop(N,H)},z=function(N){var H;(H=A.current)===null||H===void 0||H.setDirection(N)},O=function(N,H){var J;(J=A.current)===null||J===void 0||J.playSegments(N,H)},_=function(N){var H;(H=A.current)===null||H===void 0||H.setSubframe(N)},I=function(N){var H;return(H=A.current)===null||H===void 0?void 0:H.getDuration(N)},V=function(){var N;(N=A.current)===null||N===void 0||N.destroy(),A.current=void 0},B=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},H;if(M.current){(H=A.current)===null||H===void 0||H.destroy();var J=_objectSpread2(_objectSpread2(_objectSpread2({},e),N),{},{container:M.current});return A.current=lottie.loadAnimation(J),E(!!A.current),function(){var $;($=A.current)===null||$===void 0||$.destroy(),A.current=void 0}}};React.useEffect(function(){var R=B();return function(){return R==null?void 0:R()}},[s,r]),React.useEffect(function(){A.current&&(A.current.autoplay=!!a)},[a]),React.useEffect(function(){if(A.current){if(!o){A.current.resetSegments(!0);return}!Array.isArray(o)||!o.length||((A.current.currentRawFrame<o[0]||A.current.currentRawFrame>o[1])&&(A.current.currentRawFrame=o[0]),A.current.setSegment(o[0],o[1]))}},[o]),React.useEffect(function(){var R=[{name:"complete",handler:l},{name:"loopComplete",handler:u},{name:"enterFrame",handler:c},{name:"segmentStart",handler:f},{name:"config_ready",handler:p},{name:"data_ready",handler:d},{name:"data_failed",handler:m},{name:"loaded_images",handler:P},{name:"DOMLoaded",handler:T},{name:"destroy",handler:x}],N=R.filter(function(J){return J.handler!=null});if(N.length){var H=N.map(function(J){var $;return($=A.current)===null||$===void 0||$.addEventListener(J.name,J.handler),function(){var W;(W=A.current)===null||W===void 0||W.removeEventListener(J.name,J.handler)}});return function(){H.forEach(function(J){return J()})}}},[l,u,c,f,p,d,m,P,T,x]);var k=React.createElement("div",_objectSpread2({style:i,ref:M},y));return{View:k,play:b,stop:F,pause:G,setSpeed:L,goToAndStop:U,goToAndPlay:D,setDirection:z,playSegments:O,setSubframe:_,getDuration:I,destroy:V,animationContainerRef:M,animationLoaded:S,animationItem:A.current}};function getContainerVisibility(n){var e=n.getBoundingClientRect(),i=e.top,s=e.height,r=window.innerHeight-i,a=window.innerHeight+s;return r/a}function getContainerCursorPosition(n,e,i){var s=n.getBoundingClientRect(),r=s.top,a=s.left,o=s.width,l=s.height,u=(e-a)/o,c=(i-r)/l;return{x:u,y:c}}var useInitInteractivity=function n(e){var i=e.wrapperRef,s=e.animationItem,r=e.mode,a=e.actions;React.useEffect(function(){var o=i.current;if(!(!o||!s||!a.length)){s.stop();var l=function(){var f=null,p=function(){var m=getContainerVisibility(o),P=a.find(function(x){var y=x.visibility;return y&&m>=y[0]&&m<=y[1]});if(P){if(P.type==="seek"&&P.visibility&&P.frames.length===2){var T=P.frames[0]+Math.ceil((m-P.visibility[0])/(P.visibility[1]-P.visibility[0])*P.frames[1]);//! goToAndStop must be relative to the start of the current segment
149
+ s.goToAndStop(T-s.firstFrame-1,!0)}P.type==="loop"&&(f===null||f!==P.frames||s.isPaused)&&(s.playSegments(P.frames,!0),f=P.frames),P.type==="play"&&s.isPaused&&(s.resetSegments(!0),s.play()),P.type==="stop"&&s.goToAndStop(P.frames[0]-s.firstFrame-1,!0)}};return document.addEventListener("scroll",p),function(){document.removeEventListener("scroll",p)}},u=function(){var f=function(P,T){var x=P,y=T;if(x!==-1&&y!==-1){var C=getContainerCursorPosition(o,x,y);x=C.x,y=C.y}var g=a.find(function(A){var M=A.position;return M&&Array.isArray(M.x)&&Array.isArray(M.y)?x>=M.x[0]&&x<=M.x[1]&&y>=M.y[0]&&y<=M.y[1]:M&&!Number.isNaN(M.x)&&!Number.isNaN(M.y)?x===M.x&&y===M.y:!1});if(g){if(g.type==="seek"&&g.position&&Array.isArray(g.position.x)&&Array.isArray(g.position.y)&&g.frames.length===2){var S=(x-g.position.x[0])/(g.position.x[1]-g.position.x[0]),E=(y-g.position.y[0])/(g.position.y[1]-g.position.y[0]);s.playSegments(g.frames,!0),s.goToAndStop(Math.ceil((S+E)/2*(g.frames[1]-g.frames[0])),!0)}g.type==="loop"&&s.playSegments(g.frames,!0),g.type==="play"&&(s.isPaused&&s.resetSegments(!1),s.playSegments(g.frames)),g.type==="stop"&&s.goToAndStop(g.frames[0],!0)}},p=function(P){f(P.clientX,P.clientY)},d=function(){f(-1,-1)};return o.addEventListener("mousemove",p),o.addEventListener("mouseout",d),function(){o.removeEventListener("mousemove",p),o.removeEventListener("mouseout",d)}};switch(r){case"scroll":return l();case"cursor":return u()}}},[r,s])},useLottieInteractivity=function n(e){var i=e.actions,s=e.mode,r=e.lottieObj,a=r.animationItem,o=r.View,l=r.animationContainerRef;return useInitInteractivity({actions:i,animationItem:a,mode:s,wrapperRef:l}),o},_excluded=["style","interactivity"],Lottie=function n(e){var i,s,r,a=e.style,o=e.interactivity,l=_objectWithoutProperties(e,_excluded),u=useLottie(l,a),c=u.View,f=u.play,p=u.stop,d=u.pause,m=u.setSpeed,P=u.goToAndStop,T=u.goToAndPlay,x=u.setDirection,y=u.playSegments,C=u.setSubframe,g=u.getDuration,S=u.destroy,E=u.animationContainerRef,A=u.animationLoaded,M=u.animationItem;return React.useEffect(function(){e.lottieRef&&(e.lottieRef.current={play:f,stop:p,pause:d,setSpeed:m,goToAndPlay:T,goToAndStop:P,setDirection:x,playSegments:y,setSubframe:C,getDuration:g,destroy:S,animationContainerRef:E,animationLoaded:A,animationItem:M})},[(i=e.lottieRef)===null||i===void 0?void 0:i.current]),useLottieInteractivity({lottieObj:{View:c,play:f,stop:p,pause:d,setSpeed:m,goToAndStop:P,goToAndPlay:T,setDirection:x,playSegments:y,setSubframe:C,getDuration:g,destroy:S,animationContainerRef:E,animationLoaded:A,animationItem:M},actions:(s=o==null?void 0:o.actions)!==null&&s!==void 0?s:[],mode:(r=o==null?void 0:o.mode)!==null&&r!==void 0?r:"scroll"})};const v="5.7.4",fr=30,ip=0,op=90,w=200,h=200,nm="AI Generating",ddd=0,assets=[],layers=[{ddd:0,ind:1,ty:4,nm:"Circle 1",sr:1,ks:{o:{a:1,k:[{t:0,s:[100],e:[30]},{t:45,s:[30],e:[100]},{t:90,s:[100]}]},r:{a:1,k:[{t:0,s:[0],e:[360]},{t:90,s:[360]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:1,k:[{t:0,s:[100,100],e:[120,120]},{t:45,s:[120,120],e:[100,100]},{t:90,s:[100,100]}]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,0]},s:{a:0,k:[60,60]},nm:"Ellipse"},{ty:"st",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},w:{a:0,k:4},lc:2,lj:2,nm:"Stroke"},{ty:"tr",p:{a:0,k:[0,-40]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]},r:{a:0,k:0},o:{a:0,k:100}}]},{ddd:0,ind:2,ty:4,nm:"Circle 2",sr:1,ks:{o:{a:1,k:[{t:0,s:[30],e:[100]},{t:45,s:[100],e:[30]},{t:90,s:[30]}]},r:{a:1,k:[{t:0,s:[120],e:[480]},{t:90,s:[480]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:1,k:[{t:0,s:[80,80],e:[100,100]},{t:45,s:[100,100],e:[80,80]},{t:90,s:[80,80]}]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,0]},s:{a:0,k:[50,50]},nm:"Ellipse"},{ty:"st",c:{a:0,k:[.42,.275,.776,1]},o:{a:0,k:100},w:{a:0,k:3},lc:2,lj:2,nm:"Stroke"},{ty:"tr",p:{a:0,k:[0,-35]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]},r:{a:0,k:0},o:{a:0,k:100}}]},{ddd:0,ind:3,ty:4,nm:"Circle 3",sr:1,ks:{o:{a:1,k:[{t:0,s:[60],e:[100]},{t:30,s:[100],e:[60]},{t:60,s:[60],e:[100]},{t:90,s:[100]}]},r:{a:1,k:[{t:0,s:[240],e:[600]},{t:90,s:[600]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,0]},s:{a:0,k:[40,40]},nm:"Ellipse"},{ty:"st",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},w:{a:0,k:2},lc:2,lj:2,nm:"Stroke"},{ty:"tr",p:{a:0,k:[0,-30]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]},r:{a:0,k:0},o:{a:0,k:100}}]},{ddd:0,ind:4,ty:4,nm:"Center Sparkle",sr:1,ks:{o:{a:1,k:[{t:0,s:[100],e:[50]},{t:15,s:[50],e:[100]},{t:30,s:[100],e:[50]},{t:45,s:[50],e:[100]},{t:60,s:[100],e:[50]},{t:75,s:[50],e:[100]},{t:90,s:[100]}]},r:{a:1,k:[{t:0,s:[0],e:[180]},{t:90,s:[180]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:1,k:[{t:0,s:[100,100],e:[130,130]},{t:22,s:[130,130],e:[90,90]},{t:45,s:[90,90],e:[120,120]},{t:67,s:[120,120],e:[100,100]},{t:90,s:[100,100]}]}},ao:0,shapes:[{ty:"sr",sy:1,d:1,pt:{a:0,k:4},p:{a:0,k:[0,0]},r:{a:0,k:0},ir:{a:0,k:8},is:{a:0,k:0},or:{a:0,k:20},os:{a:0,k:0},nm:"Star"},{ty:"fl",c:{a:0,k:[.42,.275,.776,1]},o:{a:0,k:100},r:1,nm:"Fill"}]},{ddd:0,ind:5,ty:4,nm:"Dots",sr:1,ks:{o:{a:0,k:100},r:{a:1,k:[{t:0,s:[0],e:[-360]},{t:90,s:[-360]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,-50]},s:{a:1,k:[{t:0,s:[8,8],e:[12,12]},{t:22,s:[12,12],e:[6,6]},{t:45,s:[6,6],e:[10,10]},{t:67,s:[10,10],e:[8,8]},{t:90,s:[8,8]}]},nm:"Dot 1"},{ty:"fl",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},r:1,nm:"Fill"},{ty:"el",p:{a:0,k:[43,25]},s:{a:1,k:[{t:0,s:[6,6],e:[10,10]},{t:30,s:[10,10],e:[6,6]},{t:60,s:[6,6],e:[8,8]},{t:90,s:[8,8]}]},nm:"Dot 2"},{ty:"fl",c:{a:0,k:[.42,.275,.776,1]},o:{a:0,k:100},r:1,nm:"Fill 2"},{ty:"el",p:{a:0,k:[-43,25]},s:{a:1,k:[{t:0,s:[10,10],e:[6,6]},{t:45,s:[6,6],e:[12,12]},{t:90,s:[12,12]}]},nm:"Dot 3"},{ty:"fl",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},r:1,nm:"Fill 3"}]}],aiGeneratingAnimation={v,fr,ip,op,w,h,nm,ddd,assets,layers};async function sendToS2(n,e){if(!(n!=null&&n.basin)||!(n!=null&&n.token)||!(n!=null&&n.id))return console.warn("[S2] Cannot send: Missing stream info"),!1;const{basin:i,token:s,id:r}=n,a=`https://${i}.b.aws.s2.dev/v1/streams/${r}/records`,o={origin:"web_client",timestamp:new Date().toISOString(),...e};try{const l=await fetch(a,{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify({records:[{body:JSON.stringify(o)}]})});return l.ok?(console.log("[S2] ✅ Sent:",e.action),!0):(console.error("[S2] Send failed:",l.status),!1)}catch(l){return console.error("[S2] Send error:",l),!1}}async function notifyUserStream(n,e,i=!1){if(!(n!=null&&n.basin)||!(n!=null&&n.token)||!(n!=null&&n.id))return console.warn("[S2] ⚠️ Cannot notify user stream: Missing info"),!1;const{basin:s,token:r,id:a}=n,o=`https://${s}.b.aws.s2.dev/v1/streams/${a}/records`;console.log("[S2] 📡 Notifying User Stream:",e);try{return await fetch(o,{method:"POST",keepalive:i,headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify({records:[{body:JSON.stringify({...e,timestamp:Date.now()})}]})}),!0}catch(l){return console.error("[S2] Failed to notify user stream:",l),!1}}class S2StreamListener{constructor(e,i){Re(this,"streamInfo");Re(this,"callbacks");Re(this,"abortController",null);Re(this,"isRunning",!1);this.streamInfo=e,this.callbacks=i}async start(){var o,l,u,c,f,p,d;if(this.isRunning)return;const{basin:e,token:i,id:s}=this.streamInfo;if(!e||!i||!s){console.error("[S2] Cannot start listener: Missing stream info");return}const a=`${`https://${e}.b.aws.s2.dev/v1/streams/${s}/records`}?clamp=true&tail_offset=0`;console.log("[S2] 🎧 Starting SSE listener:",a),this.abortController=new AbortController,this.isRunning=!0;try{const m=await fetch(a,{headers:{Authorization:`Bearer ${i}`,Accept:"text/event-stream"},signal:this.abortController.signal});if(!m.ok){console.error("[S2] SSE connection failed:",m.status),(l=(o=this.callbacks).onError)==null||l.call(o,new Error(`SSE connection failed: ${m.status}`));return}const P=(u=m.body)==null?void 0:u.getReader();if(!P){console.error("[S2] No response body reader");return}const T=new TextDecoder;let x="",y=null,C="";for(;this.isRunning&&!this.abortController.signal.aborted;){const{done:g,value:S}=await P.read();if(g){console.log("[S2] SSE stream ended");break}const E=T.decode(S,{stream:!0});x+=E;const A=x.split(`
150
+ `);if(x=A.pop()||"",x&&x.trim().startsWith("{")&&x.trim().endsWith("}"))try{JSON.parse(x),A.push(x),x=""}catch{}for(const M of A){const b=M.trim();if(!b){C&&this.processSSEMessage(y,C),y=null,C="";continue}if(b.startsWith("{")&&b.endsWith("}")){this.processSSEMessage("batch",b);continue}if(b.startsWith("event:"))y=b.slice(6).trim();else if(b.startsWith("data:"))C+=b.slice(5).trim();else if(!b.startsWith("id:")){if(M.includes("batch{")){const F=M.indexOf("{");F!==-1&&this.processSSEMessage("batch",M.substring(F))}else if(M.includes("ping{")){const F=M.indexOf("{");F!==-1&&this.processSSEMessage("ping",M.substring(F))}}}}}catch(m){m.name==="AbortError"?console.log("[S2] SSE connection aborted"):(console.error("[S2] SSE error:",m),(f=(c=this.callbacks).onError)==null||f.call(c,m))}finally{this.isRunning=!1,(d=(p=this.callbacks).onDisconnect)==null||d.call(p)}}processSSEMessage(e,i){var r,a;const s=e||"batch";try{const o=JSON.parse(i);if(s==="batch"&&o.records){console.log("[S2] 📦 Processing batch with",o.records.length,"records");for(const l of o.records)try{const u=typeof l.body=="string"?JSON.parse(l.body):l.body;console.log("[S2] 📨 Record:",u),this.handleRecord(u)}catch(u){console.error("[S2] ❌ Error processing record:",u)}}else s==="ping"&&(console.log("[S2] 💓 Ping"),(a=(r=this.callbacks).onPing)==null||a.call(r))}catch(o){console.error("[S2] ❌ Error parsing SSE JSON:",o,"Raw:",i)}}handleRecord(e){var i,s,r,a,o,l,u,c,f,p,d,m,P,T;switch(e.action){case"fill":e.fieldId!==void 0&&e.value!==void 0&&((s=(i=this.callbacks).onFill)==null||s.call(i,e.fieldId,e.value,e.sectionKey));break;case"fillMultiple":e.fields&&Array.isArray(e.fields)&&((a=(r=this.callbacks).onFillMultiple)==null||a.call(r,e.fields));break;case"odontogram":e.payload&&((l=(o=this.callbacks).onOdontogram)==null||l.call(o,e.payload));break;case"transcript":e.messages&&((c=(u=this.callbacks).onTranscript)==null||c.call(u,e.messages));break;case"chat":case"assistant_chat":case"chat_history":case"chat_message":e.messages&&Array.isArray(e.messages)?e.messages.forEach(x=>{var y,C;(C=(y=this.callbacks).onChatMessage)==null||C.call(y,{role:x.role==="assistant"?"model":x.role,content:x.text||x.content,timestamp:x.timestamp||new Date().toISOString()})}):e.message&&((p=(f=this.callbacks).onChatMessage)==null||p.call(f,e.message));break;case"set_title":e.title&&((m=(d=this.callbacks).onTitleUpdate)==null||m.call(d,e.title));break;case"session_status":e.status&&e.analysisId&&(console.log("[S2] 📡 Session status update:",e.status,e.analysisId),(T=(P=this.callbacks).onSessionStatus)==null||T.call(P,{status:e.status,analysisId:e.analysisId,isPaused:e.isPaused,isConnected:e.isConnected,templateName:e.templateName,formDataCount:e.formDataCount,transcriptCount:e.transcriptCount}));break;default:console.log("[S2] Unhandled action:",e.action)}}stop(){var e;console.log("[S2] Stopping SSE listener"),this.isRunning=!1,(e=this.abortController)==null||e.abort(),this.abortController=null}isActive(){return this.isRunning}}async function sendTranscript(n,e){const i={type:"transcript",action:"transcript",messages:e};return console.log("[S2] Sending transcript:",e.length,"messages"),sendToS2(n,i)}async function sendAIFill(n,e,i,s,r){return sendToS2(n,{action:"fill",fieldId:i,value:s,sectionKey:r,editorSource:"clara",source:"web_client",analysisId:e})}async function sendTitleUpdate(n,e){return sendToS2(n,{action:"set_title",title:e,source:"ai_tool"})}async function sendChatToS2(n,e,i="chat"){const s=e.map(a=>({role:a.role==="assistant"?"model":a.role,text:a.text,timestamp:a.timestamp||new Date().toISOString(),id:a.id||Date.now().toString()})),r={action:i,messages:s,source:"widget",origin:"remote"};return console.log("[S2] Sending chat:",i,s.length,"messages"),sendToS2(n,r)}async function sendSessionStatus(n,e){const i={action:"session_status",...e,timestamp:new Date().toISOString(),source:"widget",origin:"remote"};return console.log("[S2] Sending session status:",e.status),sendToS2(n,i)}const ClaraChat=({primaryColor:n})=>{const{config:e,currentAnalysis:i,chatMessages:s,addChatMessage:r,clearChatMessages:a,analysisStreamInfo:o,currentTemplate:l,formData:u}=useClaraStore(),c=e.lang||"es",[f,p]=React.useState(""),[d,m]=React.useState(!1),[P,T]=React.useState(!1),[x,y]=React.useState([]),[C,g]=React.useState(!1),S=React.useRef(null),E=React.useRef(null);React.useRef(null);const A=React.useRef(null),M=React.useRef([]);React.useEffect(()=>{S.current&&(S.current.scrollTop=S.current.scrollHeight)},[s,d,x]),React.useEffect(()=>{const _=I=>{I.target.closest(".actions-menu-container")||T(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]),React.useEffect(()=>{if(!(i!=null&&i.id)||s.length===0)return;const I=setTimeout(async()=>{try{const V=s.map(B=>({id:B.id||Date.now().toString(),role:B.role,text:B.content}));await claraApi.syncChatHistory(i.id,V),console.log("[ClaraChat] Chat history synced:",V.length,"messages")}catch(V){console.error("[ClaraChat] Failed to sync chat history:",V)}},2e3);return()=>clearTimeout(I)},[s,i==null?void 0:i.id]);const b=async _=>{if(_.target.files&&_.target.files.length>0){const I=_.target.files[0],V=new FileReader;V.onload=()=>{const B=V.result.split(",")[1],k=I.type.startsWith("image/"),R=I.type==="application/pdf";if(!k&&!R)return;const N={id:Date.now().toString(),file:I,base64:B,type:R?"pdf":"image",previewUrl:k?URL.createObjectURL(I):void 0};y(H=>[...H,N])},V.readAsDataURL(I)}E.current&&(E.current.value="")},F=_=>{y(I=>I.filter(V=>V.id!==_))},G=async()=>{try{const _=await navigator.mediaDevices.getUserMedia({audio:!0}),I=new MediaRecorder(_);A.current=I,M.current=[],I.ondataavailable=V=>{V.data.size>0&&M.current.push(V.data)},I.start(),g(!0)}catch(_){console.error("Error accessing microphone:",_),r({role:"model",content:"No se pudo acceder al micrófono.",timestamp:new Date})}},L=()=>{A.current&&C&&(A.current.stop(),A.current.onstop=async()=>{var V;const _=new Blob(M.current,{type:"audio/webm"}),I=new FileReader;I.onloadend=()=>{const B=I.result.split(",")[1];D("",[{id:Date.now().toString(),file:new File([_],"voice_note.webm",{type:"audio/webm"}),base64:B,type:"audio"}])},I.readAsDataURL(_),(V=A.current)==null||V.stream.getTracks().forEach(B=>B.stop()),g(!1)})},D=async(_,I)=>{const V=_!==void 0?_:f,B=I||x;if(!V.trim()&&B.length===0)return;let k=V;if(!k){const N=B.some($=>$.type==="audio"),H=B.some($=>$.type==="image"),J=B.some($=>$.type==="pdf");N?k="🎤 Nota de voz enviada":H?k="📷 Imagen enviada para análisis":J&&(k="📄 Documento PDF enviado")}r({role:"user",content:k,timestamp:new Date}),p(""),y([]),m(!0),T(!1);try{o&&await sendChatToS2(o,[{role:"user",text:V||k,timestamp:new Date().toISOString(),id:Date.now().toString()}],"chat"),setTimeout(async()=>{const N={role:"model",content:"Entendido. He recibido tu mensaje. ¿En qué más puedo ayudarte?",timestamp:new Date};r(N),m(!1),o&&await sendChatToS2(o,[{role:"model",text:N.content,timestamp:new Date().toISOString(),id:Date.now().toString()}],"assistant_chat")},1e3)}catch(N){console.error("[ClaraChat] Error sending message:",N),m(!1)}},U=()=>{const _={S:[],O:[],A:[],P:[]},I={chiefComplaint:"S",presentIllness:"S",symptoms:"S",painLevel:"S",pastMedicalHistory:"S",surgicalHistory:"S",medications:"S",allergies:"S",familyHistory:"S",socialHistory:"S",reviewOfSystems:"S",bp:"O",hr:"O",rr:"O",temp:"O",height:"O",weight:"O",bmi:"O",vitalSigns:"O",physicalExam:"O",generalAppearance:"O",cardiovascular:"O",respiratory:"O",neurological:"O",musculoskeletal:"O",skin:"O",diagnosis:"A",impression:"A",findings:"A",plan:"P",treatment:"P",followUp:"P",restrictions:"P",recommendations:"P",referrals:"P",fitnessForDuty:"P"};Object.entries(u).forEach(([B,k])=>{var H,J;if(!k||typeof k=="string"&&!k.trim())return;let R="O";for(const[$,W]of Object.entries(I))if(B.toLowerCase().includes($.toLowerCase())){R=W;break}let N=B;if((H=l==null?void 0:l.structure)!=null&&H.sections)for(const $ of l.structure.sections){const W=(J=$.fields)==null?void 0:J.find(Z=>Z.id===B||Z.htmlFieldId===B);if(W){N=W.label||B;break}}_[R].push(`**${N}:** ${k}`)});const V=[_.S.length>0?`**SUBJETIVO (S)**
151
+ ${_.S.join(`
152
+ `)}`:null,_.O.length>0?`**OBJETIVO (O)**
153
+ ${_.O.join(`
154
+ `)}`:null,_.A.length>0?`**EVALUACIÓN (A)**
155
+ ${_.A.join(`
156
+ `)}`:null,_.P.length>0?`**PLAN (P)**
157
+ ${_.P.join(`
158
+ `)}`:null].filter(Boolean).join(`
159
+
160
+ `);return V?`📋 **REPORTE SOAP**
161
+
162
+ ${V}`:"No hay datos suficientes para generar el reporte SOAP. Complete los campos del formulario primero."},z=()=>{const _=[],I=[],V=["fullName","name","dob","age","gender","idNumber"];if(Object.entries(u).forEach(([k,R])=>{var H,J;if(!R||typeof R=="string"&&!R.trim())return;let N=k;if((H=l==null?void 0:l.structure)!=null&&H.sections)for(const $ of l.structure.sections){const W=(J=$.fields)==null?void 0:J.find(Z=>Z.id===k||Z.htmlFieldId===k);if(W){N=W.label||k;break}}V.some($=>k.toLowerCase().includes($.toLowerCase()))?_.push(`• ${N}: ${R}`):I.push(`• ${N}: ${R}`)}),_.length===0&&I.length===0)return t("chat.noDataToSummarize",c);let B=`📄 **RESUMEN DE CONSULTA**
163
+
164
+ `;return _.length>0&&(B+=`**Información del Paciente:**
165
+ ${_.join(`
166
+ `)}
167
+
168
+ `),I.length>0&&(B+=`**Datos Clínicos:**
169
+ ${I.slice(0,10).join(`
170
+ `)}`,I.length>10&&(B+=`
171
+ ... y ${I.length-10} campos más`)),B},O=[{id:"soap",label:t("chat.generateSoap",c),icon:"📋",action:()=>{T(!1),r({role:"user",content:"Genera un reporte SOAP",timestamp:new Date}),m(!0),setTimeout(()=>{const _=U();r({role:"model",content:_,timestamp:new Date}),m(!1)},500)}},{id:"summary",label:t("chat.summarize",c),icon:"📄",action:()=>{T(!1),r({role:"user",content:"Resume la consulta",timestamp:new Date}),m(!0),setTimeout(()=>{const _=z();r({role:"model",content:_,timestamp:new Date}),m(!1)},500)}},{id:"clear",label:t("chat.clear",c),icon:"🗑️",action:()=>{a(),T(!1)}}];return jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-clara-surface relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",ref:S,children:[s.length===0&&jsxRuntime.jsx("div",{className:"flex justify-start",children:jsxRuntime.jsx("div",{className:"max-w-[85%] p-3 rounded-2xl text-sm shadow-sm leading-relaxed text-white rounded-bl-none",style:{backgroundColor:n},children:t("chat.welcome",c)})}),s.map((_,I)=>jsxRuntime.jsx("div",{className:`flex ${_.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsx("div",{className:`max-w-[85%] p-3 rounded-2xl text-sm shadow-sm leading-relaxed ${_.role==="user"?"text-white rounded-br-none":"bg-card text-foreground border border-border rounded-bl-none"}`,style:_.role==="user"?{backgroundColor:n}:{},children:_.role==="model"?jsxRuntime.jsx("div",{className:"whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:_.content.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\n- /g,"<br/>• ").replace(/\n/g,"<br/>")}}):_.content})},I)),d&&jsxRuntime.jsx("div",{className:"flex justify-start",children:jsxRuntime.jsxs("div",{className:"bg-card border border-border p-3 rounded-2xl rounded-bl-none shadow-sm flex items-center gap-1",children:[jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce"}),jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce [animation-delay:75ms]"}),jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce [animation-delay:150ms]"}),jsxRuntime.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t("chat.thinking",c)})]})})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2 bg-card border-t border-border w-full z-20",children:[x.length>0&&jsxRuntime.jsx("div",{className:"flex gap-2 mb-2 overflow-x-auto pb-2",children:x.map(_=>jsxRuntime.jsxs("div",{className:"relative group flex-shrink-0",children:[jsxRuntime.jsxs("div",{className:"w-16 h-16 rounded-lg border border-border bg-secondary flex flex-col items-center justify-center overflow-hidden",children:[_.type==="image"&&_.previewUrl?jsxRuntime.jsx("img",{src:_.previewUrl,alt:"preview",className:"w-full h-full object-cover"}):jsxRuntime.jsx("span",{className:"text-2xl",children:_.type==="pdf"?"📄":"🎤"}),_.type==="pdf"&&jsxRuntime.jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full px-1 text-center",children:_.file.name})]}),jsxRuntime.jsx("button",{onClick:()=>F(_.id),className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full w-4 h-4 flex items-center justify-center text-[10px] shadow-sm hover:brightness-110",children:jsxRuntime.jsx(X,{className:"w-2.5 h-2.5"})})]},_.id))}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 relative",children:[jsxRuntime.jsxs("div",{className:"relative actions-menu-container",children:[jsxRuntime.jsx(AnimatePresence,{children:P&&jsxRuntime.jsx(motion.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute bottom-full mb-2 left-0 w-48 bg-card rounded-xl shadow-xl border border-border overflow-hidden",children:jsxRuntime.jsx("div",{className:"p-1",children:O.map(_=>jsxRuntime.jsxs("button",{onClick:()=>_.action(),className:"w-full text-left px-3 py-2 text-sm hover:bg-secondary text-foreground rounded-lg flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx("span",{children:_.icon}),_.label]},_.id))})})}),jsxRuntime.jsx("button",{onClick:()=>T(!P),className:`h-11 w-11 flex items-center justify-center rounded-xl transition-colors ${P?"bg-accent text-accent-foreground":"bg-secondary text-muted-foreground hover:bg-secondary/80"}`,title:"Acciones rápidas",children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})})]}),jsxRuntime.jsx("input",{type:"file",ref:E,className:"hidden",accept:"image/*,application/pdf",onChange:b}),jsxRuntime.jsx("button",{onClick:()=>{var _;return(_=E.current)==null?void 0:_.click()},className:"h-11 w-11 flex items-center justify-center bg-secondary text-muted-foreground rounded-xl hover:bg-secondary/80 transition-colors",title:"Adjuntar imagen o PDF",children:jsxRuntime.jsx(Paperclip,{className:"w-5 h-5"})}),jsxRuntime.jsx("input",{type:"text",value:f,onChange:_=>p(_.target.value),onKeyDown:_=>_.key==="Enter"&&D(),placeholder:t("chat.placeholder",c),disabled:C,className:"flex-1 h-11 py-2.5 px-4 bg-secondary border-transparent focus:bg-card focus:border-ring focus:ring-2 focus:ring-ring/20 rounded-xl text-sm transition-all outline-none text-foreground placeholder-muted-foreground"}),f.trim()||x.length>0?jsxRuntime.jsx("button",{onClick:()=>D(),disabled:d,className:"h-11 w-11 text-white rounded-xl hover:brightness-110 transition-colors shadow-md disabled:opacity-50 flex items-center justify-center",style:{backgroundColor:n},children:jsxRuntime.jsx(Send,{className:"w-5 h-5"})}):jsxRuntime.jsx("button",{onMouseDown:G,onMouseUp:L,onTouchStart:G,onTouchEnd:L,className:`h-11 w-11 rounded-xl transition-all shadow-md flex items-center justify-center ${C?"bg-destructive text-destructive-foreground scale-110 ring-4 ring-destructive/30":"bg-secondary text-muted-foreground hover:bg-secondary/80"}`,title:"Mantén presionado para hablar",children:C?jsxRuntime.jsx("div",{className:"w-5 h-5 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-2 h-2 bg-white rounded-full animate-ping"})}):jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})})]})]})]})};/**
172
+ * @license
173
+ * Copyright 2025 Google LLC
174
+ * SPDX-License-Identifier: Apache-2.0
175
+ */let _defaultBaseGeminiUrl,_defaultBaseVertexUrl;function getDefaultBaseUrls(){return{geminiUrl:_defaultBaseGeminiUrl,vertexUrl:_defaultBaseVertexUrl}}function getBaseUrl(n,e,i,s){var r,a;if(!(n!=null&&n.baseUrl)){const o=getDefaultBaseUrls();return e?(r=o.vertexUrl)!==null&&r!==void 0?r:i:(a=o.geminiUrl)!==null&&a!==void 0?a:s}return n.baseUrl}/**
176
+ * @license
177
+ * Copyright 2025 Google LLC
178
+ * SPDX-License-Identifier: Apache-2.0
179
+ */class BaseModule{}function formatMap(n,e){const i=/\{([^}]+)\}/g;return n.replace(i,(s,r)=>{if(Object.prototype.hasOwnProperty.call(e,r)){const a=e[r];return a!=null?String(a):""}else throw new Error(`Key '${r}' not found in valueMap.`)})}function setValueByPath(n,e,i){for(let a=0;a<e.length-1;a++){const o=e[a];if(o.endsWith("[]")){const l=o.slice(0,-2);if(!(l in n))if(Array.isArray(i))n[l]=Array.from({length:i.length},()=>({}));else throw new Error(`Value must be a list given an array path ${o}`);if(Array.isArray(n[l])){const u=n[l];if(Array.isArray(i))for(let c=0;c<u.length;c++){const f=u[c];setValueByPath(f,e.slice(a+1),i[c])}else for(const c of u)setValueByPath(c,e.slice(a+1),i)}return}else if(o.endsWith("[0]")){const l=o.slice(0,-3);l in n||(n[l]=[{}]);const u=n[l];setValueByPath(u[0],e.slice(a+1),i);return}(!n[o]||typeof n[o]!="object")&&(n[o]={}),n=n[o]}const s=e[e.length-1],r=n[s];if(r!==void 0){if(!i||typeof i=="object"&&Object.keys(i).length===0||i===r)return;if(typeof r=="object"&&typeof i=="object"&&r!==null&&i!==null)Object.assign(r,i);else throw new Error(`Cannot set value for an existing key. Key: ${s}`)}else s==="_self"&&typeof i=="object"&&i!==null&&!Array.isArray(i)?Object.assign(n,i):n[s]=i}function getValueByPath(n,e,i=void 0){try{if(e.length===1&&e[0]==="_self")return n;for(let s=0;s<e.length;s++){if(typeof n!="object"||n===null)return i;const r=e[s];if(r.endsWith("[]")){const a=r.slice(0,-2);if(a in n){const o=n[a];return Array.isArray(o)?o.map(l=>getValueByPath(l,e.slice(s+1),i)):i}else return i}else n=n[r]}return n}catch(s){if(s instanceof TypeError)return i;throw s}}function moveValueByPath(n,e){for(const[i,s]of Object.entries(e)){const r=i.split("."),a=s.split("."),o=new Set;let l=-1;for(let u=0;u<r.length;u++)if(r[u]==="*"){l=u;break}if(l!==-1&&a.length>l)for(let u=l;u<a.length;u++){const c=a[u];c!=="*"&&!c.endsWith("[]")&&!c.endsWith("[0]")&&o.add(c)}_moveValueRecursive(n,r,a,0,o)}}function _moveValueRecursive(n,e,i,s,r){if(s>=e.length||typeof n!="object"||n===null)return;const a=e[s];if(a.endsWith("[]")){const o=a.slice(0,-2),l=n;if(o in l&&Array.isArray(l[o]))for(const u of l[o])_moveValueRecursive(u,e,i,s+1,r)}else if(a==="*"){if(typeof n=="object"&&n!==null&&!Array.isArray(n)){const o=n,l=Object.keys(o).filter(c=>!c.startsWith("_")&&!r.has(c)),u={};for(const c of l)u[c]=o[c];for(const[c,f]of Object.entries(u)){const p=[];for(const d of i.slice(s))d==="*"?p.push(c):p.push(d);setValueByPath(o,p,f)}for(const c of l)delete o[c]}}else{const o=n;a in o&&_moveValueRecursive(o[a],e,i,s+1,r)}}/**
180
+ * @license
181
+ * Copyright 2025 Google LLC
182
+ * SPDX-License-Identifier: Apache-2.0
183
+ */function tBytes$1(n){if(typeof n!="string")throw new Error("fromImageBytes must be a string");return n}/**
184
+ * @license
185
+ * Copyright 2025 Google LLC
186
+ * SPDX-License-Identifier: Apache-2.0
187
+ */function fetchPredictOperationParametersToVertex(n){const e={},i=getValueByPath(n,["operationName"]);i!=null&&setValueByPath(e,["operationName"],i);const s=getValueByPath(n,["resourceName"]);return s!=null&&setValueByPath(e,["_url","resourceName"],s),e}function generateVideosOperationFromMldev$1(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata"]);s!=null&&setValueByPath(e,["metadata"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["response","generateVideoResponse"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromMldev$1(o)),e}function generateVideosOperationFromVertex$1(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata"]);s!=null&&setValueByPath(e,["metadata"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["response"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromVertex$1(o)),e}function generateVideosResponseFromMldev$1(n){const e={},i=getValueByPath(n,["generatedSamples"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(o=>generatedVideoFromMldev$1(o))),setValueByPath(e,["generatedVideos"],a)}const s=getValueByPath(n,["raiMediaFilteredCount"]);s!=null&&setValueByPath(e,["raiMediaFilteredCount"],s);const r=getValueByPath(n,["raiMediaFilteredReasons"]);return r!=null&&setValueByPath(e,["raiMediaFilteredReasons"],r),e}function generateVideosResponseFromVertex$1(n){const e={},i=getValueByPath(n,["videos"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(o=>generatedVideoFromVertex$1(o))),setValueByPath(e,["generatedVideos"],a)}const s=getValueByPath(n,["raiMediaFilteredCount"]);s!=null&&setValueByPath(e,["raiMediaFilteredCount"],s);const r=getValueByPath(n,["raiMediaFilteredReasons"]);return r!=null&&setValueByPath(e,["raiMediaFilteredReasons"],r),e}function generatedVideoFromMldev$1(n){const e={},i=getValueByPath(n,["video"]);return i!=null&&setValueByPath(e,["video"],videoFromMldev$1(i)),e}function generatedVideoFromVertex$1(n){const e={},i=getValueByPath(n,["_self"]);return i!=null&&setValueByPath(e,["video"],videoFromVertex$1(i)),e}function getOperationParametersToMldev(n){const e={},i=getValueByPath(n,["operationName"]);return i!=null&&setValueByPath(e,["_url","operationName"],i),e}function getOperationParametersToVertex(n){const e={},i=getValueByPath(n,["operationName"]);return i!=null&&setValueByPath(e,["_url","operationName"],i),e}function importFileOperationFromMldev$1(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata"]);s!=null&&setValueByPath(e,["metadata"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["response"]);return o!=null&&setValueByPath(e,["response"],importFileResponseFromMldev$1(o)),e}function importFileResponseFromMldev$1(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["parent"]);s!=null&&setValueByPath(e,["parent"],s);const r=getValueByPath(n,["documentName"]);return r!=null&&setValueByPath(e,["documentName"],r),e}function uploadToFileSearchStoreOperationFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata"]);s!=null&&setValueByPath(e,["metadata"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["response"]);return o!=null&&setValueByPath(e,["response"],uploadToFileSearchStoreResponseFromMldev(o)),e}function uploadToFileSearchStoreResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["parent"]);s!=null&&setValueByPath(e,["parent"],s);const r=getValueByPath(n,["documentName"]);return r!=null&&setValueByPath(e,["documentName"],r),e}function videoFromMldev$1(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["uri"],i);const s=getValueByPath(n,["encodedVideo"]);s!=null&&setValueByPath(e,["videoBytes"],tBytes$1(s));const r=getValueByPath(n,["encoding"]);return r!=null&&setValueByPath(e,["mimeType"],r),e}function videoFromVertex$1(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["uri"],i);const s=getValueByPath(n,["bytesBase64Encoded"]);s!=null&&setValueByPath(e,["videoBytes"],tBytes$1(s));const r=getValueByPath(n,["mimeType"]);return r!=null&&setValueByPath(e,["mimeType"],r),e}/**
188
+ * @license
189
+ * Copyright 2025 Google LLC
190
+ * SPDX-License-Identifier: Apache-2.0
191
+ */var Outcome;(function(n){n.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",n.OUTCOME_OK="OUTCOME_OK",n.OUTCOME_FAILED="OUTCOME_FAILED",n.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(Outcome||(Outcome={}));var Language;(function(n){n.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",n.PYTHON="PYTHON"})(Language||(Language={}));var FunctionResponseScheduling;(function(n){n.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",n.SILENT="SILENT",n.WHEN_IDLE="WHEN_IDLE",n.INTERRUPT="INTERRUPT"})(FunctionResponseScheduling||(FunctionResponseScheduling={}));var Type;(function(n){n.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",n.STRING="STRING",n.NUMBER="NUMBER",n.INTEGER="INTEGER",n.BOOLEAN="BOOLEAN",n.ARRAY="ARRAY",n.OBJECT="OBJECT",n.NULL="NULL"})(Type||(Type={}));var Mode;(function(n){n.MODE_UNSPECIFIED="MODE_UNSPECIFIED",n.MODE_DYNAMIC="MODE_DYNAMIC"})(Mode||(Mode={}));var ApiSpec;(function(n){n.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",n.SIMPLE_SEARCH="SIMPLE_SEARCH",n.ELASTIC_SEARCH="ELASTIC_SEARCH"})(ApiSpec||(ApiSpec={}));var AuthType;(function(n){n.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",n.NO_AUTH="NO_AUTH",n.API_KEY_AUTH="API_KEY_AUTH",n.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",n.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",n.OAUTH="OAUTH",n.OIDC_AUTH="OIDC_AUTH"})(AuthType||(AuthType={}));var HttpElementLocation;(function(n){n.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",n.HTTP_IN_QUERY="HTTP_IN_QUERY",n.HTTP_IN_HEADER="HTTP_IN_HEADER",n.HTTP_IN_PATH="HTTP_IN_PATH",n.HTTP_IN_BODY="HTTP_IN_BODY",n.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(HttpElementLocation||(HttpElementLocation={}));var PhishBlockThreshold;(function(n){n.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",n.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",n.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",n.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",n.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",n.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",n.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(PhishBlockThreshold||(PhishBlockThreshold={}));var ThinkingLevel;(function(n){n.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",n.LOW="LOW",n.HIGH="HIGH"})(ThinkingLevel||(ThinkingLevel={}));var HarmCategory;(function(n){n.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",n.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",n.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",n.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",n.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",n.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",n.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",n.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",n.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",n.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",n.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(HarmCategory||(HarmCategory={}));var HarmBlockMethod;(function(n){n.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",n.SEVERITY="SEVERITY",n.PROBABILITY="PROBABILITY"})(HarmBlockMethod||(HarmBlockMethod={}));var HarmBlockThreshold;(function(n){n.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",n.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",n.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",n.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",n.BLOCK_NONE="BLOCK_NONE",n.OFF="OFF"})(HarmBlockThreshold||(HarmBlockThreshold={}));var FinishReason;(function(n){n.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",n.STOP="STOP",n.MAX_TOKENS="MAX_TOKENS",n.SAFETY="SAFETY",n.RECITATION="RECITATION",n.LANGUAGE="LANGUAGE",n.OTHER="OTHER",n.BLOCKLIST="BLOCKLIST",n.PROHIBITED_CONTENT="PROHIBITED_CONTENT",n.SPII="SPII",n.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",n.IMAGE_SAFETY="IMAGE_SAFETY",n.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",n.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",n.NO_IMAGE="NO_IMAGE"})(FinishReason||(FinishReason={}));var HarmProbability;(function(n){n.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",n.NEGLIGIBLE="NEGLIGIBLE",n.LOW="LOW",n.MEDIUM="MEDIUM",n.HIGH="HIGH"})(HarmProbability||(HarmProbability={}));var HarmSeverity;(function(n){n.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",n.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",n.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",n.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",n.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(HarmSeverity||(HarmSeverity={}));var UrlRetrievalStatus;(function(n){n.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",n.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",n.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",n.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",n.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(UrlRetrievalStatus||(UrlRetrievalStatus={}));var BlockedReason;(function(n){n.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",n.SAFETY="SAFETY",n.OTHER="OTHER",n.BLOCKLIST="BLOCKLIST",n.PROHIBITED_CONTENT="PROHIBITED_CONTENT",n.IMAGE_SAFETY="IMAGE_SAFETY",n.MODEL_ARMOR="MODEL_ARMOR",n.JAILBREAK="JAILBREAK"})(BlockedReason||(BlockedReason={}));var TrafficType;(function(n){n.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",n.ON_DEMAND="ON_DEMAND",n.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(TrafficType||(TrafficType={}));var Modality;(function(n){n.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",n.TEXT="TEXT",n.IMAGE="IMAGE",n.AUDIO="AUDIO"})(Modality||(Modality={}));var MediaResolution;(function(n){n.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",n.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",n.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",n.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(MediaResolution||(MediaResolution={}));var TuningMode;(function(n){n.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",n.TUNING_MODE_FULL="TUNING_MODE_FULL",n.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(TuningMode||(TuningMode={}));var AdapterSize;(function(n){n.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",n.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",n.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",n.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",n.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",n.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",n.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(AdapterSize||(AdapterSize={}));var JobState;(function(n){n.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",n.JOB_STATE_QUEUED="JOB_STATE_QUEUED",n.JOB_STATE_PENDING="JOB_STATE_PENDING",n.JOB_STATE_RUNNING="JOB_STATE_RUNNING",n.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",n.JOB_STATE_FAILED="JOB_STATE_FAILED",n.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",n.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",n.JOB_STATE_PAUSED="JOB_STATE_PAUSED",n.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",n.JOB_STATE_UPDATING="JOB_STATE_UPDATING",n.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(JobState||(JobState={}));var TuningTask;(function(n){n.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",n.TUNING_TASK_I2V="TUNING_TASK_I2V",n.TUNING_TASK_T2V="TUNING_TASK_T2V",n.TUNING_TASK_R2V="TUNING_TASK_R2V"})(TuningTask||(TuningTask={}));var PartMediaResolutionLevel;(function(n){n.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",n.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",n.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",n.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(PartMediaResolutionLevel||(PartMediaResolutionLevel={}));var FeatureSelectionPreference;(function(n){n.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",n.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",n.BALANCED="BALANCED",n.PRIORITIZE_COST="PRIORITIZE_COST"})(FeatureSelectionPreference||(FeatureSelectionPreference={}));var Behavior;(function(n){n.UNSPECIFIED="UNSPECIFIED",n.BLOCKING="BLOCKING",n.NON_BLOCKING="NON_BLOCKING"})(Behavior||(Behavior={}));var DynamicRetrievalConfigMode;(function(n){n.MODE_UNSPECIFIED="MODE_UNSPECIFIED",n.MODE_DYNAMIC="MODE_DYNAMIC"})(DynamicRetrievalConfigMode||(DynamicRetrievalConfigMode={}));var Environment;(function(n){n.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",n.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(Environment||(Environment={}));var FunctionCallingConfigMode;(function(n){n.MODE_UNSPECIFIED="MODE_UNSPECIFIED",n.AUTO="AUTO",n.ANY="ANY",n.NONE="NONE",n.VALIDATED="VALIDATED"})(FunctionCallingConfigMode||(FunctionCallingConfigMode={}));var SafetyFilterLevel;(function(n){n.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",n.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",n.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",n.BLOCK_NONE="BLOCK_NONE"})(SafetyFilterLevel||(SafetyFilterLevel={}));var PersonGeneration;(function(n){n.DONT_ALLOW="DONT_ALLOW",n.ALLOW_ADULT="ALLOW_ADULT",n.ALLOW_ALL="ALLOW_ALL"})(PersonGeneration||(PersonGeneration={}));var ImagePromptLanguage;(function(n){n.auto="auto",n.en="en",n.ja="ja",n.ko="ko",n.hi="hi",n.zh="zh",n.pt="pt",n.es="es"})(ImagePromptLanguage||(ImagePromptLanguage={}));var MaskReferenceMode;(function(n){n.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",n.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",n.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",n.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",n.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(MaskReferenceMode||(MaskReferenceMode={}));var ControlReferenceType;(function(n){n.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",n.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",n.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",n.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(ControlReferenceType||(ControlReferenceType={}));var SubjectReferenceType;(function(n){n.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",n.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",n.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",n.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(SubjectReferenceType||(SubjectReferenceType={}));var EditMode;(function(n){n.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",n.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",n.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",n.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",n.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",n.EDIT_MODE_STYLE="EDIT_MODE_STYLE",n.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",n.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(EditMode||(EditMode={}));var SegmentMode;(function(n){n.FOREGROUND="FOREGROUND",n.BACKGROUND="BACKGROUND",n.PROMPT="PROMPT",n.SEMANTIC="SEMANTIC",n.INTERACTIVE="INTERACTIVE"})(SegmentMode||(SegmentMode={}));var VideoGenerationReferenceType;(function(n){n.ASSET="ASSET",n.STYLE="STYLE"})(VideoGenerationReferenceType||(VideoGenerationReferenceType={}));var VideoGenerationMaskMode;(function(n){n.INSERT="INSERT",n.REMOVE="REMOVE",n.REMOVE_STATIC="REMOVE_STATIC",n.OUTPAINT="OUTPAINT"})(VideoGenerationMaskMode||(VideoGenerationMaskMode={}));var VideoCompressionQuality;(function(n){n.OPTIMIZED="OPTIMIZED",n.LOSSLESS="LOSSLESS"})(VideoCompressionQuality||(VideoCompressionQuality={}));var TuningMethod;(function(n){n.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",n.PREFERENCE_TUNING="PREFERENCE_TUNING"})(TuningMethod||(TuningMethod={}));var DocumentState;(function(n){n.STATE_UNSPECIFIED="STATE_UNSPECIFIED",n.STATE_PENDING="STATE_PENDING",n.STATE_ACTIVE="STATE_ACTIVE",n.STATE_FAILED="STATE_FAILED"})(DocumentState||(DocumentState={}));var FileState;(function(n){n.STATE_UNSPECIFIED="STATE_UNSPECIFIED",n.PROCESSING="PROCESSING",n.ACTIVE="ACTIVE",n.FAILED="FAILED"})(FileState||(FileState={}));var FileSource;(function(n){n.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",n.UPLOADED="UPLOADED",n.GENERATED="GENERATED"})(FileSource||(FileSource={}));var TurnCompleteReason;(function(n){n.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",n.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",n.RESPONSE_REJECTED="RESPONSE_REJECTED",n.NEED_MORE_INPUT="NEED_MORE_INPUT"})(TurnCompleteReason||(TurnCompleteReason={}));var MediaModality;(function(n){n.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",n.TEXT="TEXT",n.IMAGE="IMAGE",n.VIDEO="VIDEO",n.AUDIO="AUDIO",n.DOCUMENT="DOCUMENT"})(MediaModality||(MediaModality={}));var StartSensitivity;(function(n){n.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",n.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",n.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(StartSensitivity||(StartSensitivity={}));var EndSensitivity;(function(n){n.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",n.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",n.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(EndSensitivity||(EndSensitivity={}));var ActivityHandling;(function(n){n.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",n.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",n.NO_INTERRUPTION="NO_INTERRUPTION"})(ActivityHandling||(ActivityHandling={}));var TurnCoverage;(function(n){n.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",n.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",n.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(TurnCoverage||(TurnCoverage={}));var Scale;(function(n){n.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",n.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",n.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",n.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",n.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",n.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",n.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",n.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",n.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",n.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",n.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",n.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",n.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})(Scale||(Scale={}));var MusicGenerationMode;(function(n){n.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",n.QUALITY="QUALITY",n.DIVERSITY="DIVERSITY",n.VOCALIZATION="VOCALIZATION"})(MusicGenerationMode||(MusicGenerationMode={}));var LiveMusicPlaybackControl;(function(n){n.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",n.PLAY="PLAY",n.PAUSE="PAUSE",n.STOP="STOP",n.RESET_CONTEXT="RESET_CONTEXT"})(LiveMusicPlaybackControl||(LiveMusicPlaybackControl={}));class HttpResponse{constructor(e){const i={};for(const s of e.headers.entries())i[s[0]]=s[1];this.headers=i,this.responseInternal=e}json(){return this.responseInternal.json()}}class GenerateContentResponse{get text(){var e,i,s,r,a,o,l,u;if(((r=(s=(i=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||r===void 0?void 0:r.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning text from the first one.");let c="",f=!1;const p=[];for(const d of(u=(l=(o=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||o===void 0?void 0:o.content)===null||l===void 0?void 0:l.parts)!==null&&u!==void 0?u:[]){for(const[m,P]of Object.entries(d))m!=="text"&&m!=="thought"&&m!=="thoughtSignature"&&(P!==null||P!==void 0)&&p.push(m);if(typeof d.text=="string"){if(typeof d.thought=="boolean"&&d.thought)continue;f=!0,c+=d.text}}return p.length>0&&console.warn(`there are non-text parts ${p} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),f?c:void 0}get data(){var e,i,s,r,a,o,l,u;if(((r=(s=(i=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||r===void 0?void 0:r.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning data from the first one.");let c="";const f=[];for(const p of(u=(l=(o=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||o===void 0?void 0:o.content)===null||l===void 0?void 0:l.parts)!==null&&u!==void 0?u:[]){for(const[d,m]of Object.entries(p))d!=="inlineData"&&(m!==null||m!==void 0)&&f.push(d);p.inlineData&&typeof p.inlineData.data=="string"&&(c+=atob(p.inlineData.data))}return f.length>0&&console.warn(`there are non-data parts ${f} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),c.length>0?btoa(c):void 0}get functionCalls(){var e,i,s,r,a,o,l,u;if(((r=(s=(i=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||r===void 0?void 0:r.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");const c=(u=(l=(o=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||o===void 0?void 0:o.content)===null||l===void 0?void 0:l.parts)===null||u===void 0?void 0:u.filter(f=>f.functionCall).map(f=>f.functionCall).filter(f=>f!==void 0);if((c==null?void 0:c.length)!==0)return c}get executableCode(){var e,i,s,r,a,o,l,u,c;if(((r=(s=(i=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||r===void 0?void 0:r.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning executable code from the first one.");const f=(u=(l=(o=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||o===void 0?void 0:o.content)===null||l===void 0?void 0:l.parts)===null||u===void 0?void 0:u.filter(p=>p.executableCode).map(p=>p.executableCode).filter(p=>p!==void 0);if((f==null?void 0:f.length)!==0)return(c=f==null?void 0:f[0])===null||c===void 0?void 0:c.code}get codeExecutionResult(){var e,i,s,r,a,o,l,u,c;if(((r=(s=(i=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||r===void 0?void 0:r.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning code execution result from the first one.");const f=(u=(l=(o=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||o===void 0?void 0:o.content)===null||l===void 0?void 0:l.parts)===null||u===void 0?void 0:u.filter(p=>p.codeExecutionResult).map(p=>p.codeExecutionResult).filter(p=>p!==void 0);if((f==null?void 0:f.length)!==0)return(c=f==null?void 0:f[0])===null||c===void 0?void 0:c.output}}class EmbedContentResponse{}class GenerateImagesResponse{}class EditImageResponse{}class UpscaleImageResponse{}class RecontextImageResponse{}class SegmentImageResponse{}class ListModelsResponse{}class DeleteModelResponse{}class CountTokensResponse{}class ComputeTokensResponse{}class GenerateVideosOperation{_fromAPIResponse({apiResponse:e,_isVertexAI:i}){const s=new GenerateVideosOperation;let r;const a=e;return i?r=generateVideosOperationFromVertex$1(a):r=generateVideosOperationFromMldev$1(a),Object.assign(s,r),s}}class ListTuningJobsResponse{}class CancelTuningJobResponse{}class DeleteCachedContentResponse{}class ListCachedContentsResponse{}class ListDocumentsResponse{}class ListFileSearchStoresResponse{}class UploadToFileSearchStoreResumableResponse{}class ImportFileOperation{_fromAPIResponse({apiResponse:e,_isVertexAI:i}){const s=new ImportFileOperation,a=importFileOperationFromMldev$1(e);return Object.assign(s,a),s}}class ListFilesResponse{}class CreateFileResponse{}class DeleteFileResponse{}class ListBatchJobsResponse{}class LiveServerMessage{get text(){var e,i,s;let r="",a=!1;const o=[];for(const l of(s=(i=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||i===void 0?void 0:i.parts)!==null&&s!==void 0?s:[]){for(const[u,c]of Object.entries(l))u!=="text"&&u!=="thought"&&c!==null&&o.push(u);if(typeof l.text=="string"){if(typeof l.thought=="boolean"&&l.thought)continue;a=!0,r+=l.text}}return o.length>0&&console.warn(`there are non-text parts ${o} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),a?r:void 0}get data(){var e,i,s;let r="";const a=[];for(const o of(s=(i=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||i===void 0?void 0:i.parts)!==null&&s!==void 0?s:[]){for(const[l,u]of Object.entries(o))l!=="inlineData"&&u!==null&&a.push(l);o.inlineData&&typeof o.inlineData.data=="string"&&(r+=atob(o.inlineData.data))}return a.length>0&&console.warn(`there are non-data parts ${a} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),r.length>0?btoa(r):void 0}}class LiveMusicServerMessage{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class UploadToFileSearchStoreOperation{_fromAPIResponse({apiResponse:e,_isVertexAI:i}){const s=new UploadToFileSearchStoreOperation,a=uploadToFileSearchStoreOperationFromMldev(e);return Object.assign(s,a),s}}/**
192
+ * @license
193
+ * Copyright 2025 Google LLC
194
+ * SPDX-License-Identifier: Apache-2.0
195
+ */function tModel(n,e){if(!e||typeof e!="string")throw new Error("model is required and must be a string");if(e.includes("..")||e.includes("?")||e.includes("&"))throw new Error("invalid model parameter");if(n.isVertexAI()){if(e.startsWith("publishers/")||e.startsWith("projects/")||e.startsWith("models/"))return e;if(e.indexOf("/")>=0){const i=e.split("/",2);return`publishers/${i[0]}/models/${i[1]}`}else return`publishers/google/models/${e}`}else return e.startsWith("models/")||e.startsWith("tunedModels/")?e:`models/${e}`}function tCachesModel(n,e){const i=tModel(n,e);return i?i.startsWith("publishers/")&&n.isVertexAI()?`projects/${n.getProject()}/locations/${n.getLocation()}/${i}`:i.startsWith("models/")&&n.isVertexAI()?`projects/${n.getProject()}/locations/${n.getLocation()}/publishers/google/${i}`:i:""}function tBlobs(n){return Array.isArray(n)?n.map(e=>tBlob(e)):[tBlob(n)]}function tBlob(n){if(typeof n=="object"&&n!==null)return n;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof n}`)}function tImageBlob(n){const e=tBlob(n);if(e.mimeType&&e.mimeType.startsWith("image/"))return e;throw new Error(`Unsupported mime type: ${e.mimeType}`)}function tAudioBlob(n){const e=tBlob(n);if(e.mimeType&&e.mimeType.startsWith("audio/"))return e;throw new Error(`Unsupported mime type: ${e.mimeType}`)}function tPart(n){if(n==null)throw new Error("PartUnion is required");if(typeof n=="object")return n;if(typeof n=="string")return{text:n};throw new Error(`Unsupported part type: ${typeof n}`)}function tParts(n){if(n==null||Array.isArray(n)&&n.length===0)throw new Error("PartListUnion is required");return Array.isArray(n)?n.map(e=>tPart(e)):[tPart(n)]}function _isContent(n){return n!=null&&typeof n=="object"&&"parts"in n&&Array.isArray(n.parts)}function _isFunctionCallPart(n){return n!=null&&typeof n=="object"&&"functionCall"in n}function _isFunctionResponsePart(n){return n!=null&&typeof n=="object"&&"functionResponse"in n}function tContent(n){if(n==null)throw new Error("ContentUnion is required");return _isContent(n)?n:{role:"user",parts:tParts(n)}}function tContentsForEmbed(n,e){if(!e)return[];if(n.isVertexAI()&&Array.isArray(e))return e.flatMap(i=>{const s=tContent(i);return s.parts&&s.parts.length>0&&s.parts[0].text!==void 0?[s.parts[0].text]:[]});if(n.isVertexAI()){const i=tContent(e);return i.parts&&i.parts.length>0&&i.parts[0].text!==void 0?[i.parts[0].text]:[]}return Array.isArray(e)?e.map(i=>tContent(i)):[tContent(e)]}function tContents(n){if(n==null||Array.isArray(n)&&n.length===0)throw new Error("contents are required");if(!Array.isArray(n)){if(_isFunctionCallPart(n)||_isFunctionResponsePart(n))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[tContent(n)]}const e=[],i=[],s=_isContent(n[0]);for(const r of n){const a=_isContent(r);if(a!=s)throw new Error("Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them");if(a)e.push(r);else{if(_isFunctionCallPart(r)||_isFunctionResponsePart(r))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");i.push(r)}}return s||e.push({role:"user",parts:tParts(i)}),e}function flattenTypeArrayToAnyOf(n,e){n.includes("null")&&(e.nullable=!0);const i=n.filter(s=>s!=="null");if(i.length===1)e.type=Object.values(Type).includes(i[0].toUpperCase())?i[0].toUpperCase():Type.TYPE_UNSPECIFIED;else{e.anyOf=[];for(const s of i)e.anyOf.push({type:Object.values(Type).includes(s.toUpperCase())?s.toUpperCase():Type.TYPE_UNSPECIFIED})}}function processJsonSchema(n){const e={},i=["items"],s=["anyOf"],r=["properties"];if(n.type&&n.anyOf)throw new Error("type and anyOf cannot be both populated.");const a=n.anyOf;a!=null&&a.length==2&&(a[0].type==="null"?(e.nullable=!0,n=a[1]):a[1].type==="null"&&(e.nullable=!0,n=a[0])),n.type instanceof Array&&flattenTypeArrayToAnyOf(n.type,e);for(const[o,l]of Object.entries(n))if(l!=null)if(o=="type"){if(l==="null")throw new Error("type: null can not be the only possible type for the field.");if(l instanceof Array)continue;e.type=Object.values(Type).includes(l.toUpperCase())?l.toUpperCase():Type.TYPE_UNSPECIFIED}else if(i.includes(o))e[o]=processJsonSchema(l);else if(s.includes(o)){const u=[];for(const c of l){if(c.type=="null"){e.nullable=!0;continue}u.push(processJsonSchema(c))}e[o]=u}else if(r.includes(o)){const u={};for(const[c,f]of Object.entries(l))u[c]=processJsonSchema(f);e[o]=u}else{if(o==="additionalProperties")continue;e[o]=l}return e}function tSchema(n){return processJsonSchema(n)}function tSpeechConfig(n){if(typeof n=="object")return n;if(typeof n=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:n}}};throw new Error(`Unsupported speechConfig type: ${typeof n}`)}function tLiveSpeechConfig(n){if("multiSpeakerVoiceConfig"in n)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return n}function tTool(n){if(n.functionDeclarations)for(const e of n.functionDeclarations)e.parameters&&(Object.keys(e.parameters).includes("$schema")?e.parametersJsonSchema||(e.parametersJsonSchema=e.parameters,delete e.parameters):e.parameters=processJsonSchema(e.parameters)),e.response&&(Object.keys(e.response).includes("$schema")?e.responseJsonSchema||(e.responseJsonSchema=e.response,delete e.response):e.response=processJsonSchema(e.response));return n}function tTools(n){if(n==null)throw new Error("tools is required");if(!Array.isArray(n))throw new Error("tools is required and must be an array of Tools");const e=[];for(const i of n)e.push(i);return e}function resourceName(n,e,i,s=1){const r=!e.startsWith(`${i}/`)&&e.split("/").length===s;return n.isVertexAI()?e.startsWith("projects/")?e:e.startsWith("locations/")?`projects/${n.getProject()}/${e}`:e.startsWith(`${i}/`)?`projects/${n.getProject()}/locations/${n.getLocation()}/${e}`:r?`projects/${n.getProject()}/locations/${n.getLocation()}/${i}/${e}`:e:r?`${i}/${e}`:e}function tCachedContentName(n,e){if(typeof e!="string")throw new Error("name must be a string");return resourceName(n,e,"cachedContents")}function tTuningJobStatus(n){switch(n){case"STATE_UNSPECIFIED":return"JOB_STATE_UNSPECIFIED";case"CREATING":return"JOB_STATE_RUNNING";case"ACTIVE":return"JOB_STATE_SUCCEEDED";case"FAILED":return"JOB_STATE_FAILED";default:return n}}function tBytes(n){return tBytes$1(n)}function _isFile(n){return n!=null&&typeof n=="object"&&"name"in n}function isGeneratedVideo(n){return n!=null&&typeof n=="object"&&"video"in n}function isVideo(n){return n!=null&&typeof n=="object"&&"uri"in n}function tFileName(n){var e;let i;if(_isFile(n)&&(i=n.name),!(isVideo(n)&&(i=n.uri,i===void 0))&&!(isGeneratedVideo(n)&&(i=(e=n.video)===null||e===void 0?void 0:e.uri,i===void 0))){if(typeof n=="string"&&(i=n),i===void 0)throw new Error("Could not extract file name from the provided input.");if(i.startsWith("https://")){const r=i.split("files/")[1].match(/[a-z0-9]+/);if(r===null)throw new Error(`Could not extract file name from URI ${i}`);i=r[0]}else i.startsWith("files/")&&(i=i.split("files/")[1]);return i}}function tModelsUrl(n,e){let i;return n.isVertexAI()?i=e?"publishers/google/models":"models":i=e?"models":"tunedModels",i}function tExtractModels(n){for(const e of["models","tunedModels","publisherModels"])if(hasField(n,e))return n[e];return[]}function hasField(n,e){return n!==null&&typeof n=="object"&&e in n}function mcpToGeminiTool(n,e={}){const i=n,s={name:i.name,description:i.description,parametersJsonSchema:i.inputSchema};return i.outputSchema&&(s.responseJsonSchema=i.outputSchema),e.behavior&&(s.behavior=e.behavior),{functionDeclarations:[s]}}function mcpToolsToGeminiTool(n,e={}){const i=[],s=new Set;for(const r of n){const a=r.name;if(s.has(a))throw new Error(`Duplicate function name ${a} found in MCP tools. Please ensure function names are unique.`);s.add(a);const o=mcpToGeminiTool(r,e);o.functionDeclarations&&i.push(...o.functionDeclarations)}return{functionDeclarations:i}}function tBatchJobSource(n,e){let i;if(typeof e=="string")if(n.isVertexAI())if(e.startsWith("gs://"))i={format:"jsonl",gcsUri:[e]};else if(e.startsWith("bq://"))i={format:"bigquery",bigqueryUri:e};else throw new Error(`Unsupported string source for Vertex AI: ${e}`);else if(e.startsWith("files/"))i={fileName:e};else throw new Error(`Unsupported string source for Gemini API: ${e}`);else if(Array.isArray(e)){if(n.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");i={inlinedRequests:e}}else i=e;const s=[i.gcsUri,i.bigqueryUri].filter(Boolean).length,r=[i.inlinedRequests,i.fileName].filter(Boolean).length;if(n.isVertexAI()){if(r>0||s!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(s>0||r!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return i}function tBatchJobDestination(n){if(typeof n!="string")return n;const e=n;if(e.startsWith("gs://"))return{format:"jsonl",gcsUri:e};if(e.startsWith("bq://"))return{format:"bigquery",bigqueryUri:e};throw new Error(`Unsupported destination: ${e}`)}function tRecvBatchJobDestination(n){if(typeof n!="object"||n===null)return{};const e=n,i=e.inlinedResponses;if(typeof i!="object"||i===null)return n;const r=i.inlinedResponses;if(!Array.isArray(r)||r.length===0)return n;let a=!1;for(const o of r){if(typeof o!="object"||o===null)continue;const u=o.response;if(typeof u!="object"||u===null)continue;if(u.embedding!==void 0){a=!0;break}}return a&&(e.inlinedEmbedContentResponses=e.inlinedResponses,delete e.inlinedResponses),n}function tBatchJobName(n,e){const i=e;if(!n.isVertexAI()){if(/batches\/[^/]+$/.test(i))return i.split("/").pop();throw new Error(`Invalid batch job name: ${i}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(i))return i.split("/").pop();if(/^\d+$/.test(i))return i;throw new Error(`Invalid batch job name: ${i}.`)}function tJobState(n){const e=n;return e==="BATCH_STATE_UNSPECIFIED"?"JOB_STATE_UNSPECIFIED":e==="BATCH_STATE_PENDING"?"JOB_STATE_PENDING":e==="BATCH_STATE_RUNNING"?"JOB_STATE_RUNNING":e==="BATCH_STATE_SUCCEEDED"?"JOB_STATE_SUCCEEDED":e==="BATCH_STATE_FAILED"?"JOB_STATE_FAILED":e==="BATCH_STATE_CANCELLED"?"JOB_STATE_CANCELLED":e==="BATCH_STATE_EXPIRED"?"JOB_STATE_EXPIRED":e}/**
196
+ * @license
197
+ * Copyright 2025 Google LLC
198
+ * SPDX-License-Identifier: Apache-2.0
199
+ */function batchJobDestinationFromMldev(n){const e={},i=getValueByPath(n,["responsesFile"]);i!=null&&setValueByPath(e,["fileName"],i);const s=getValueByPath(n,["inlinedResponses","inlinedResponses"]);if(s!=null){let a=s;Array.isArray(a)&&(a=a.map(o=>inlinedResponseFromMldev(o))),setValueByPath(e,["inlinedResponses"],a)}const r=getValueByPath(n,["inlinedEmbedContentResponses","inlinedResponses"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["inlinedEmbedContentResponses"],a)}return e}function batchJobDestinationFromVertex(n){const e={},i=getValueByPath(n,["predictionsFormat"]);i!=null&&setValueByPath(e,["format"],i);const s=getValueByPath(n,["gcsDestination","outputUriPrefix"]);s!=null&&setValueByPath(e,["gcsUri"],s);const r=getValueByPath(n,["bigqueryDestination","outputUri"]);return r!=null&&setValueByPath(e,["bigqueryUri"],r),e}function batchJobDestinationToVertex(n){const e={},i=getValueByPath(n,["format"]);i!=null&&setValueByPath(e,["predictionsFormat"],i);const s=getValueByPath(n,["gcsUri"]);s!=null&&setValueByPath(e,["gcsDestination","outputUriPrefix"],s);const r=getValueByPath(n,["bigqueryUri"]);if(r!=null&&setValueByPath(e,["bigqueryDestination","outputUri"],r),getValueByPath(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return e}function batchJobFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata","displayName"]);s!=null&&setValueByPath(e,["displayName"],s);const r=getValueByPath(n,["metadata","state"]);r!=null&&setValueByPath(e,["state"],tJobState(r));const a=getValueByPath(n,["metadata","createTime"]);a!=null&&setValueByPath(e,["createTime"],a);const o=getValueByPath(n,["metadata","endTime"]);o!=null&&setValueByPath(e,["endTime"],o);const l=getValueByPath(n,["metadata","updateTime"]);l!=null&&setValueByPath(e,["updateTime"],l);const u=getValueByPath(n,["metadata","model"]);u!=null&&setValueByPath(e,["model"],u);const c=getValueByPath(n,["metadata","output"]);return c!=null&&setValueByPath(e,["dest"],batchJobDestinationFromMldev(tRecvBatchJobDestination(c))),e}function batchJobFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["displayName"]);s!=null&&setValueByPath(e,["displayName"],s);const r=getValueByPath(n,["state"]);r!=null&&setValueByPath(e,["state"],tJobState(r));const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(e,["createTime"],o);const l=getValueByPath(n,["startTime"]);l!=null&&setValueByPath(e,["startTime"],l);const u=getValueByPath(n,["endTime"]);u!=null&&setValueByPath(e,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(e,["updateTime"],c);const f=getValueByPath(n,["model"]);f!=null&&setValueByPath(e,["model"],f);const p=getValueByPath(n,["inputConfig"]);p!=null&&setValueByPath(e,["src"],batchJobSourceFromVertex(p));const d=getValueByPath(n,["outputConfig"]);d!=null&&setValueByPath(e,["dest"],batchJobDestinationFromVertex(tRecvBatchJobDestination(d)));const m=getValueByPath(n,["completionStats"]);return m!=null&&setValueByPath(e,["completionStats"],m),e}function batchJobSourceFromVertex(n){const e={},i=getValueByPath(n,["instancesFormat"]);i!=null&&setValueByPath(e,["format"],i);const s=getValueByPath(n,["gcsSource","uris"]);s!=null&&setValueByPath(e,["gcsUri"],s);const r=getValueByPath(n,["bigquerySource","inputUri"]);return r!=null&&setValueByPath(e,["bigqueryUri"],r),e}function batchJobSourceToMldev(n,e){const i={};if(getValueByPath(e,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(getValueByPath(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(getValueByPath(e,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const s=getValueByPath(e,["fileName"]);s!=null&&setValueByPath(i,["fileName"],s);const r=getValueByPath(e,["inlinedRequests"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>inlinedRequestToMldev(n,o))),setValueByPath(i,["requests","requests"],a)}return i}function batchJobSourceToVertex(n){const e={},i=getValueByPath(n,["format"]);i!=null&&setValueByPath(e,["instancesFormat"],i);const s=getValueByPath(n,["gcsUri"]);s!=null&&setValueByPath(e,["gcsSource","uris"],s);const r=getValueByPath(n,["bigqueryUri"]);if(r!=null&&setValueByPath(e,["bigquerySource","inputUri"],r),getValueByPath(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return e}function blobToMldev$4(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function cancelBatchJobParametersToMldev(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,s)),i}function cancelBatchJobParametersToVertex(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,s)),i}function candidateFromMldev$1(n){const e={},i=getValueByPath(n,["content"]);i!=null&&setValueByPath(e,["content"],i);const s=getValueByPath(n,["citationMetadata"]);s!=null&&setValueByPath(e,["citationMetadata"],citationMetadataFromMldev$1(s));const r=getValueByPath(n,["tokenCount"]);r!=null&&setValueByPath(e,["tokenCount"],r);const a=getValueByPath(n,["finishReason"]);a!=null&&setValueByPath(e,["finishReason"],a);const o=getValueByPath(n,["avgLogprobs"]);o!=null&&setValueByPath(e,["avgLogprobs"],o);const l=getValueByPath(n,["groundingMetadata"]);l!=null&&setValueByPath(e,["groundingMetadata"],l);const u=getValueByPath(n,["index"]);u!=null&&setValueByPath(e,["index"],u);const c=getValueByPath(n,["logprobsResult"]);c!=null&&setValueByPath(e,["logprobsResult"],c);const f=getValueByPath(n,["safetyRatings"]);if(f!=null){let d=f;Array.isArray(d)&&(d=d.map(m=>m)),setValueByPath(e,["safetyRatings"],d)}const p=getValueByPath(n,["urlContextMetadata"]);return p!=null&&setValueByPath(e,["urlContextMetadata"],p),e}function citationMetadataFromMldev$1(n){const e={},i=getValueByPath(n,["citationSources"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(e,["citations"],s)}return e}function contentToMldev$4(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(a=>partToMldev$4(a))),setValueByPath(e,["parts"],r)}const s=getValueByPath(n,["role"]);return s!=null&&setValueByPath(e,["role"],s),e}function createBatchJobConfigToMldev(n,e){const i={},s=getValueByPath(n,["displayName"]);if(e!==void 0&&s!=null&&setValueByPath(e,["batch","displayName"],s),getValueByPath(n,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return i}function createBatchJobConfigToVertex(n,e){const i={},s=getValueByPath(n,["displayName"]);e!==void 0&&s!=null&&setValueByPath(e,["displayName"],s);const r=getValueByPath(n,["dest"]);return e!==void 0&&r!=null&&setValueByPath(e,["outputConfig"],batchJobDestinationToVertex(tBatchJobDestination(r))),i}function createBatchJobParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["src"]);r!=null&&setValueByPath(i,["batch","inputConfig"],batchJobSourceToMldev(n,tBatchJobSource(n,r)));const a=getValueByPath(e,["config"]);return a!=null&&createBatchJobConfigToMldev(a,i),i}function createBatchJobParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["model"],tModel(n,s));const r=getValueByPath(e,["src"]);r!=null&&setValueByPath(i,["inputConfig"],batchJobSourceToVertex(tBatchJobSource(n,r)));const a=getValueByPath(e,["config"]);return a!=null&&createBatchJobConfigToVertex(a,i),i}function createEmbeddingsBatchJobConfigToMldev(n,e){const i={},s=getValueByPath(n,["displayName"]);return e!==void 0&&s!=null&&setValueByPath(e,["batch","displayName"],s),i}function createEmbeddingsBatchJobParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["src"]);r!=null&&setValueByPath(i,["batch","inputConfig"],embeddingsBatchJobSourceToMldev(n,r));const a=getValueByPath(e,["config"]);return a!=null&&createEmbeddingsBatchJobConfigToMldev(a,i),i}function deleteBatchJobParametersToMldev(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,s)),i}function deleteBatchJobParametersToVertex(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,s)),i}function deleteResourceJobFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(e,["name"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);return a!=null&&setValueByPath(e,["error"],a),e}function deleteResourceJobFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(e,["name"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);return a!=null&&setValueByPath(e,["error"],a),e}function embedContentBatchToMldev(n,e){const i={},s=getValueByPath(e,["contents"]);if(s!=null){let a=tContentsForEmbed(n,s);Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(i,["requests[]","request","content"],a)}const r=getValueByPath(e,["config"]);return r!=null&&(setValueByPath(i,["_self"],embedContentConfigToMldev$1(r,i)),moveValueByPath(i,{"requests[].*":"requests[].request.*"})),i}function embedContentConfigToMldev$1(n,e){const i={},s=getValueByPath(n,["taskType"]);e!==void 0&&s!=null&&setValueByPath(e,["requests[]","taskType"],s);const r=getValueByPath(n,["title"]);e!==void 0&&r!=null&&setValueByPath(e,["requests[]","title"],r);const a=getValueByPath(n,["outputDimensionality"]);if(e!==void 0&&a!=null&&setValueByPath(e,["requests[]","outputDimensionality"],a),getValueByPath(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return i}function embeddingsBatchJobSourceToMldev(n,e){const i={},s=getValueByPath(e,["fileName"]);s!=null&&setValueByPath(i,["file_name"],s);const r=getValueByPath(e,["inlinedRequests"]);return r!=null&&setValueByPath(i,["requests"],embedContentBatchToMldev(n,r)),i}function fileDataToMldev$4(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function functionCallToMldev$4(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const s=getValueByPath(n,["args"]);s!=null&&setValueByPath(e,["args"],s);const r=getValueByPath(n,["name"]);if(r!=null&&setValueByPath(e,["name"],r),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionCallingConfigToMldev$2(n){const e={},i=getValueByPath(n,["mode"]);i!=null&&setValueByPath(e,["mode"],i);const s=getValueByPath(n,["allowedFunctionNames"]);if(s!=null&&setValueByPath(e,["allowedFunctionNames"],s),getValueByPath(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function generateContentConfigToMldev$1(n,e,i){const s={},r=getValueByPath(e,["systemInstruction"]);i!==void 0&&r!=null&&setValueByPath(i,["systemInstruction"],contentToMldev$4(tContent(r)));const a=getValueByPath(e,["temperature"]);a!=null&&setValueByPath(s,["temperature"],a);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(s,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(s,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(s,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(s,["maxOutputTokens"],c);const f=getValueByPath(e,["stopSequences"]);f!=null&&setValueByPath(s,["stopSequences"],f);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(s,["responseLogprobs"],p);const d=getValueByPath(e,["logprobs"]);d!=null&&setValueByPath(s,["logprobs"],d);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(s,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(s,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(s,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(s,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(s,["responseSchema"],tSchema(y));const C=getValueByPath(e,["responseJsonSchema"]);if(C!=null&&setValueByPath(s,["responseJsonSchema"],C),getValueByPath(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(getValueByPath(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const g=getValueByPath(e,["safetySettings"]);if(i!==void 0&&g!=null){let D=g;Array.isArray(D)&&(D=D.map(U=>safetySettingToMldev$1(U))),setValueByPath(i,["safetySettings"],D)}const S=getValueByPath(e,["tools"]);if(i!==void 0&&S!=null){let D=tTools(S);Array.isArray(D)&&(D=D.map(U=>toolToMldev$4(tTool(U)))),setValueByPath(i,["tools"],D)}const E=getValueByPath(e,["toolConfig"]);if(i!==void 0&&E!=null&&setValueByPath(i,["toolConfig"],toolConfigToMldev$2(E)),getValueByPath(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const A=getValueByPath(e,["cachedContent"]);i!==void 0&&A!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,A));const M=getValueByPath(e,["responseModalities"]);M!=null&&setValueByPath(s,["responseModalities"],M);const b=getValueByPath(e,["mediaResolution"]);b!=null&&setValueByPath(s,["mediaResolution"],b);const F=getValueByPath(e,["speechConfig"]);if(F!=null&&setValueByPath(s,["speechConfig"],tSpeechConfig(F)),getValueByPath(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const G=getValueByPath(e,["thinkingConfig"]);G!=null&&setValueByPath(s,["thinkingConfig"],G);const L=getValueByPath(e,["imageConfig"]);return L!=null&&setValueByPath(s,["imageConfig"],imageConfigToMldev$1(L)),s}function generateContentResponseFromMldev$1(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["candidates"]);if(s!=null){let u=s;Array.isArray(u)&&(u=u.map(c=>candidateFromMldev$1(c))),setValueByPath(e,["candidates"],u)}const r=getValueByPath(n,["modelVersion"]);r!=null&&setValueByPath(e,["modelVersion"],r);const a=getValueByPath(n,["promptFeedback"]);a!=null&&setValueByPath(e,["promptFeedback"],a);const o=getValueByPath(n,["responseId"]);o!=null&&setValueByPath(e,["responseId"],o);const l=getValueByPath(n,["usageMetadata"]);return l!=null&&setValueByPath(e,["usageMetadata"],l),e}function getBatchJobParametersToMldev(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,s)),i}function getBatchJobParametersToVertex(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,s)),i}function googleMapsToMldev$4(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$4(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function imageConfigToMldev$1(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const s=getValueByPath(n,["imageSize"]);if(s!=null&&setValueByPath(e,["imageSize"],s),getValueByPath(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function inlinedRequestToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["request","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let l=tContents(r);Array.isArray(l)&&(l=l.map(u=>contentToMldev$4(u))),setValueByPath(i,["request","contents"],l)}const a=getValueByPath(e,["metadata"]);a!=null&&setValueByPath(i,["metadata"],a);const o=getValueByPath(e,["config"]);return o!=null&&setValueByPath(i,["request","generationConfig"],generateContentConfigToMldev$1(n,o,getValueByPath(i,["request"],{}))),i}function inlinedResponseFromMldev(n){const e={},i=getValueByPath(n,["response"]);i!=null&&setValueByPath(e,["response"],generateContentResponseFromMldev$1(i));const s=getValueByPath(n,["error"]);return s!=null&&setValueByPath(e,["error"],s),e}function listBatchJobsConfigToMldev(n,e){const i={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);if(e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r),getValueByPath(n,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return i}function listBatchJobsConfigToVertex(n,e){const i={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r);const a=getValueByPath(n,["filter"]);return e!==void 0&&a!=null&&setValueByPath(e,["_query","filter"],a),i}function listBatchJobsParametersToMldev(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listBatchJobsConfigToMldev(i,e),e}function listBatchJobsParametersToVertex(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listBatchJobsConfigToVertex(i,e),e}function listBatchJobsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["operations"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>batchJobFromMldev(o))),setValueByPath(e,["batchJobs"],a)}return e}function listBatchJobsResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["batchPredictionJobs"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>batchJobFromVertex(o))),setValueByPath(e,["batchJobs"],a)}return e}function partToMldev$4(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const s=getValueByPath(n,["codeExecutionResult"]);s!=null&&setValueByPath(e,["codeExecutionResult"],s);const r=getValueByPath(n,["executableCode"]);r!=null&&setValueByPath(e,["executableCode"],r);const a=getValueByPath(n,["fileData"]);a!=null&&setValueByPath(e,["fileData"],fileDataToMldev$4(a));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$4(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$4(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const f=getValueByPath(n,["thought"]);f!=null&&setValueByPath(e,["thought"],f);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const d=getValueByPath(n,["videoMetadata"]);return d!=null&&setValueByPath(e,["videoMetadata"],d),e}function safetySettingToMldev$1(n){const e={},i=getValueByPath(n,["category"]);if(i!=null&&setValueByPath(e,["category"],i),getValueByPath(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const s=getValueByPath(n,["threshold"]);return s!=null&&setValueByPath(e,["threshold"],s),e}function toolConfigToMldev$2(n){const e={},i=getValueByPath(n,["functionCallingConfig"]);i!=null&&setValueByPath(e,["functionCallingConfig"],functionCallingConfigToMldev$2(i));const s=getValueByPath(n,["retrievalConfig"]);return s!=null&&setValueByPath(e,["retrievalConfig"],s),e}function toolToMldev$4(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let f=i;Array.isArray(f)&&(f=f.map(p=>p)),setValueByPath(e,["functionDeclarations"],f)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const s=getValueByPath(n,["googleSearchRetrieval"]);s!=null&&setValueByPath(e,["googleSearchRetrieval"],s);const r=getValueByPath(n,["computerUse"]);r!=null&&setValueByPath(e,["computerUse"],r);const a=getValueByPath(n,["fileSearch"]);a!=null&&setValueByPath(e,["fileSearch"],a);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$4(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$4(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}/**
200
+ * @license
201
+ * Copyright 2025 Google LLC
202
+ * SPDX-License-Identifier: Apache-2.0
203
+ */var PagedItem;(function(n){n.PAGED_ITEM_BATCH_JOBS="batchJobs",n.PAGED_ITEM_MODELS="models",n.PAGED_ITEM_TUNING_JOBS="tuningJobs",n.PAGED_ITEM_FILES="files",n.PAGED_ITEM_CACHED_CONTENTS="cachedContents",n.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",n.PAGED_ITEM_DOCUMENTS="documents"})(PagedItem||(PagedItem={}));class Pager{constructor(e,i,s,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=i,this.init(e,s,r)}init(e,i,s){var r,a;this.nameInternal=e,this.pageInternal=i[this.nameInternal]||[],this.sdkHttpResponseInternal=i==null?void 0:i.sdkHttpResponse,this.idxInternal=0;let o={config:{}};!s||Object.keys(s).length===0?o={config:{}}:typeof s=="object"?o=Object.assign({},s):o=s,o.config&&(o.config.pageToken=i.nextPageToken),this.paramsInternal=o,this.pageInternalSize=(a=(r=o.config)===null||r===void 0?void 0:r.pageSize)!==null&&a!==void 0?a:this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};const e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");const e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){var e;return((e=this.params.config)===null||e===void 0?void 0:e.pageToken)!==void 0}}/**
204
+ * @license
205
+ * Copyright 2025 Google LLC
206
+ * SPDX-License-Identifier: Apache-2.0
207
+ */class Batches extends BaseModule{constructor(e){super(),this.apiClient=e,this.list=async(i={})=>new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS,s=>this.listInternal(s),await this.listInternal(i),i),this.create=async i=>(this.apiClient.isVertexAI()&&(i.config=this.formatDestination(i.src,i.config)),this.createInternal(i)),this.createEmbeddings=async i=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Vertex AI does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(i)}}createInlinedGenerateContentRequest(e){const i=createBatchJobParametersToMldev(this.apiClient,e),s=i._url,r=formatMap("{model}:batchGenerateContent",s),l=i.batch.inputConfig.requests,u=l.requests,c=[];for(const f of u){const p=Object.assign({},f);if(p.systemInstruction){const d=p.systemInstruction;delete p.systemInstruction;const m=p.request;m.systemInstruction=d,p.request=m}c.push(p)}return l.requests=c,delete i.config,delete i._url,delete i._query,{path:r,body:i}}getGcsUri(e){if(typeof e=="string")return e.startsWith("gs://")?e:void 0;if(!Array.isArray(e)&&e.gcsUri&&e.gcsUri.length>0)return e.gcsUri[0]}getBigqueryUri(e){if(typeof e=="string")return e.startsWith("bq://")?e:void 0;if(!Array.isArray(e))return e.bigqueryUri}formatDestination(e,i){const s=i?Object.assign({},i):{},r=Date.now().toString();if(s.displayName||(s.displayName=`genaiBatchJob_${r}`),s.dest===void 0){const a=this.getGcsUri(e),o=this.getBigqueryUri(e);if(a)a.endsWith(".jsonl")?s.dest=`${a.slice(0,-6)}/dest`:s.dest=`${a}_dest_${r}`;else if(o)s.dest=`${o}_dest_${r}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return s}async createInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=createBatchJobParametersToVertex(this.apiClient,e);return l=formatMap("batchPredictionJobs",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>batchJobFromVertex(f))}else{const c=createBatchJobParametersToMldev(this.apiClient,e);return l=formatMap("{model}:batchGenerateContent",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>batchJobFromMldev(f))}}async createEmbeddingsInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=createEmbeddingsBatchJobParametersToMldev(this.apiClient,e);return a=formatMap("{model}:asyncBatchEmbedContent",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>batchJobFromMldev(u))}}async get(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=getBatchJobParametersToVertex(this.apiClient,e);return l=formatMap("batchPredictionJobs/{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>batchJobFromVertex(f))}else{const c=getBatchJobParametersToMldev(this.apiClient,e);return l=formatMap("batches/{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>batchJobFromMldev(f))}}async cancel(e){var i,s,r,a;let o="",l={};if(this.apiClient.isVertexAI()){const u=cancelBatchJobParametersToVertex(this.apiClient,e);o=formatMap("batchPredictionJobs/{name}:cancel",u._url),l=u._query,delete u._url,delete u._query,await this.apiClient.request({path:o,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal})}else{const u=cancelBatchJobParametersToMldev(this.apiClient,e);o=formatMap("batches/{name}:cancel",u._url),l=u._query,delete u._url,delete u._query,await this.apiClient.request({path:o,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=listBatchJobsParametersToVertex(e);return l=formatMap("batchPredictionJobs",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listBatchJobsResponseFromVertex(f),d=new ListBatchJobsResponse;return Object.assign(d,p),d})}else{const c=listBatchJobsParametersToMldev(e);return l=formatMap("batches",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listBatchJobsResponseFromMldev(f),d=new ListBatchJobsResponse;return Object.assign(d,p),d})}}async delete(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=deleteBatchJobParametersToVertex(this.apiClient,e);return l=formatMap("batchPredictionJobs/{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>deleteResourceJobFromVertex(f))}else{const c=deleteBatchJobParametersToMldev(this.apiClient,e);return l=formatMap("batches/{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>deleteResourceJobFromMldev(f))}}}/**
208
+ * @license
209
+ * Copyright 2025 Google LLC
210
+ * SPDX-License-Identifier: Apache-2.0
211
+ */function blobToMldev$3(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function contentToMldev$3(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(a=>partToMldev$3(a))),setValueByPath(e,["parts"],r)}const s=getValueByPath(n,["role"]);return s!=null&&setValueByPath(e,["role"],s),e}function createCachedContentConfigToMldev(n,e){const i={},s=getValueByPath(n,["ttl"]);e!==void 0&&s!=null&&setValueByPath(e,["ttl"],s);const r=getValueByPath(n,["expireTime"]);e!==void 0&&r!=null&&setValueByPath(e,["expireTime"],r);const a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const o=getValueByPath(n,["contents"]);if(e!==void 0&&o!=null){let f=tContents(o);Array.isArray(f)&&(f=f.map(p=>contentToMldev$3(p))),setValueByPath(e,["contents"],f)}const l=getValueByPath(n,["systemInstruction"]);e!==void 0&&l!=null&&setValueByPath(e,["systemInstruction"],contentToMldev$3(tContent(l)));const u=getValueByPath(n,["tools"]);if(e!==void 0&&u!=null){let f=u;Array.isArray(f)&&(f=f.map(p=>toolToMldev$3(p))),setValueByPath(e,["tools"],f)}const c=getValueByPath(n,["toolConfig"]);if(e!==void 0&&c!=null&&setValueByPath(e,["toolConfig"],toolConfigToMldev$1(c)),getValueByPath(n,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return i}function createCachedContentConfigToVertex(n,e){const i={},s=getValueByPath(n,["ttl"]);e!==void 0&&s!=null&&setValueByPath(e,["ttl"],s);const r=getValueByPath(n,["expireTime"]);e!==void 0&&r!=null&&setValueByPath(e,["expireTime"],r);const a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const o=getValueByPath(n,["contents"]);if(e!==void 0&&o!=null){let p=tContents(o);Array.isArray(p)&&(p=p.map(d=>d)),setValueByPath(e,["contents"],p)}const l=getValueByPath(n,["systemInstruction"]);e!==void 0&&l!=null&&setValueByPath(e,["systemInstruction"],tContent(l));const u=getValueByPath(n,["tools"]);if(e!==void 0&&u!=null){let p=u;Array.isArray(p)&&(p=p.map(d=>toolToVertex$2(d))),setValueByPath(e,["tools"],p)}const c=getValueByPath(n,["toolConfig"]);e!==void 0&&c!=null&&setValueByPath(e,["toolConfig"],c);const f=getValueByPath(n,["kmsKeyName"]);return e!==void 0&&f!=null&&setValueByPath(e,["encryption_spec","kmsKeyName"],f),i}function createCachedContentParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["model"],tCachesModel(n,s));const r=getValueByPath(e,["config"]);return r!=null&&createCachedContentConfigToMldev(r,i),i}function createCachedContentParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["model"],tCachesModel(n,s));const r=getValueByPath(e,["config"]);return r!=null&&createCachedContentConfigToVertex(r,i),i}function deleteCachedContentParametersToMldev(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tCachedContentName(n,s)),i}function deleteCachedContentParametersToVertex(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tCachedContentName(n,s)),i}function deleteCachedContentResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function deleteCachedContentResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function fileDataToMldev$3(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function functionCallToMldev$3(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const s=getValueByPath(n,["args"]);s!=null&&setValueByPath(e,["args"],s);const r=getValueByPath(n,["name"]);if(r!=null&&setValueByPath(e,["name"],r),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionCallingConfigToMldev$1(n){const e={},i=getValueByPath(n,["mode"]);i!=null&&setValueByPath(e,["mode"],i);const s=getValueByPath(n,["allowedFunctionNames"]);if(s!=null&&setValueByPath(e,["allowedFunctionNames"],s),getValueByPath(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function functionDeclarationToVertex$2(n){const e={};if(getValueByPath(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const i=getValueByPath(n,["description"]);i!=null&&setValueByPath(e,["description"],i);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(e,["name"],s);const r=getValueByPath(n,["parameters"]);r!=null&&setValueByPath(e,["parameters"],r);const a=getValueByPath(n,["parametersJsonSchema"]);a!=null&&setValueByPath(e,["parametersJsonSchema"],a);const o=getValueByPath(n,["response"]);o!=null&&setValueByPath(e,["response"],o);const l=getValueByPath(n,["responseJsonSchema"]);return l!=null&&setValueByPath(e,["responseJsonSchema"],l),e}function getCachedContentParametersToMldev(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tCachedContentName(n,s)),i}function getCachedContentParametersToVertex(n,e){const i={},s=getValueByPath(e,["name"]);return s!=null&&setValueByPath(i,["_url","name"],tCachedContentName(n,s)),i}function googleMapsToMldev$3(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$3(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function listCachedContentsConfigToMldev(n,e){const i={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);return e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r),i}function listCachedContentsConfigToVertex(n,e){const i={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);return e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r),i}function listCachedContentsParametersToMldev(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listCachedContentsConfigToMldev(i,e),e}function listCachedContentsParametersToVertex(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listCachedContentsConfigToVertex(i,e),e}function listCachedContentsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["cachedContents"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["cachedContents"],a)}return e}function listCachedContentsResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["cachedContents"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["cachedContents"],a)}return e}function partToMldev$3(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const s=getValueByPath(n,["codeExecutionResult"]);s!=null&&setValueByPath(e,["codeExecutionResult"],s);const r=getValueByPath(n,["executableCode"]);r!=null&&setValueByPath(e,["executableCode"],r);const a=getValueByPath(n,["fileData"]);a!=null&&setValueByPath(e,["fileData"],fileDataToMldev$3(a));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$3(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$3(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const f=getValueByPath(n,["thought"]);f!=null&&setValueByPath(e,["thought"],f);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const d=getValueByPath(n,["videoMetadata"]);return d!=null&&setValueByPath(e,["videoMetadata"],d),e}function toolConfigToMldev$1(n){const e={},i=getValueByPath(n,["functionCallingConfig"]);i!=null&&setValueByPath(e,["functionCallingConfig"],functionCallingConfigToMldev$1(i));const s=getValueByPath(n,["retrievalConfig"]);return s!=null&&setValueByPath(e,["retrievalConfig"],s),e}function toolToMldev$3(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let f=i;Array.isArray(f)&&(f=f.map(p=>p)),setValueByPath(e,["functionDeclarations"],f)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const s=getValueByPath(n,["googleSearchRetrieval"]);s!=null&&setValueByPath(e,["googleSearchRetrieval"],s);const r=getValueByPath(n,["computerUse"]);r!=null&&setValueByPath(e,["computerUse"],r);const a=getValueByPath(n,["fileSearch"]);a!=null&&setValueByPath(e,["fileSearch"],a);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$3(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$3(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}function toolToVertex$2(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let p=i;Array.isArray(p)&&(p=p.map(d=>functionDeclarationToVertex$2(d))),setValueByPath(e,["functionDeclarations"],p)}const s=getValueByPath(n,["retrieval"]);s!=null&&setValueByPath(e,["retrieval"],s);const r=getValueByPath(n,["googleSearchRetrieval"]);r!=null&&setValueByPath(e,["googleSearchRetrieval"],r);const a=getValueByPath(n,["computerUse"]);if(a!=null&&setValueByPath(e,["computerUse"],a),getValueByPath(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=getValueByPath(n,["codeExecution"]);o!=null&&setValueByPath(e,["codeExecution"],o);const l=getValueByPath(n,["enterpriseWebSearch"]);l!=null&&setValueByPath(e,["enterpriseWebSearch"],l);const u=getValueByPath(n,["googleMaps"]);u!=null&&setValueByPath(e,["googleMaps"],u);const c=getValueByPath(n,["googleSearch"]);c!=null&&setValueByPath(e,["googleSearch"],c);const f=getValueByPath(n,["urlContext"]);return f!=null&&setValueByPath(e,["urlContext"],f),e}function updateCachedContentConfigToMldev(n,e){const i={},s=getValueByPath(n,["ttl"]);e!==void 0&&s!=null&&setValueByPath(e,["ttl"],s);const r=getValueByPath(n,["expireTime"]);return e!==void 0&&r!=null&&setValueByPath(e,["expireTime"],r),i}function updateCachedContentConfigToVertex(n,e){const i={},s=getValueByPath(n,["ttl"]);e!==void 0&&s!=null&&setValueByPath(e,["ttl"],s);const r=getValueByPath(n,["expireTime"]);return e!==void 0&&r!=null&&setValueByPath(e,["expireTime"],r),i}function updateCachedContentParametersToMldev(n,e){const i={},s=getValueByPath(e,["name"]);s!=null&&setValueByPath(i,["_url","name"],tCachedContentName(n,s));const r=getValueByPath(e,["config"]);return r!=null&&updateCachedContentConfigToMldev(r,i),i}function updateCachedContentParametersToVertex(n,e){const i={},s=getValueByPath(e,["name"]);s!=null&&setValueByPath(i,["_url","name"],tCachedContentName(n,s));const r=getValueByPath(e,["config"]);return r!=null&&updateCachedContentConfigToVertex(r,i),i}/**
212
+ * @license
213
+ * Copyright 2025 Google LLC
214
+ * SPDX-License-Identifier: Apache-2.0
215
+ */class Caches extends BaseModule{constructor(e){super(),this.apiClient=e,this.list=async(i={})=>new Pager(PagedItem.PAGED_ITEM_CACHED_CONTENTS,s=>this.listInternal(s),await this.listInternal(i),i)}async create(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=createCachedContentParametersToVertex(this.apiClient,e);return l=formatMap("cachedContents",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>f)}else{const c=createCachedContentParametersToMldev(this.apiClient,e);return l=formatMap("cachedContents",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>f)}}async get(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=getCachedContentParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>f)}else{const c=getCachedContentParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>f)}}async delete(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=deleteCachedContentParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=deleteCachedContentResponseFromVertex(f),d=new DeleteCachedContentResponse;return Object.assign(d,p),d})}else{const c=deleteCachedContentParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=deleteCachedContentResponseFromMldev(f),d=new DeleteCachedContentResponse;return Object.assign(d,p),d})}}async update(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=updateCachedContentParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>f)}else{const c=updateCachedContentParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>f)}}async listInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=listCachedContentsParametersToVertex(e);return l=formatMap("cachedContents",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listCachedContentsResponseFromVertex(f),d=new ListCachedContentsResponse;return Object.assign(d,p),d})}else{const c=listCachedContentsParametersToMldev(e);return l=formatMap("cachedContents",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listCachedContentsResponseFromMldev(f),d=new ListCachedContentsResponse;return Object.assign(d,p),d})}}}function __values(n){var e=typeof Symbol=="function"&&Symbol.iterator,i=e&&n[e],s=0;if(i)return i.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&s>=n.length&&(n=void 0),{value:n&&n[s++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function __await(n){return this instanceof __await?(this.v=n,this):new __await(n)}function __asyncGenerator(n,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=i.apply(n,e||[]),r,a=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),r[Symbol.asyncIterator]=function(){return this},r;function o(m){return function(P){return Promise.resolve(P).then(m,p)}}function l(m,P){s[m]&&(r[m]=function(T){return new Promise(function(x,y){a.push([m,T,x,y])>1||u(m,T)})},P&&(r[m]=P(r[m])))}function u(m,P){try{c(s[m](P))}catch(T){d(a[0][3],T)}}function c(m){m.value instanceof __await?Promise.resolve(m.value.v).then(f,p):d(a[0][2],m)}function f(m){u("next",m)}function p(m){u("throw",m)}function d(m,P){m(P),a.shift(),a.length&&u(a[0][0],a[0][1])}}function __asyncValues(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],i;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i);function s(a){i[a]=n[a]&&function(o){return new Promise(function(l,u){o=n[a](o),r(l,u,o.done,o.value)})}}function r(a,o,l,u){Promise.resolve(u).then(function(c){a({value:c,done:l})},o)}}typeof SuppressedError=="function"&&SuppressedError;/**
216
+ * @license
217
+ * Copyright 2025 Google LLC
218
+ * SPDX-License-Identifier: Apache-2.0
219
+ */function isValidResponse(n){var e;if(n.candidates==null||n.candidates.length===0)return!1;const i=(e=n.candidates[0])===null||e===void 0?void 0:e.content;return i===void 0?!1:isValidContent(i)}function isValidContent(n){if(n.parts===void 0||n.parts.length===0)return!1;for(const e of n.parts)if(e===void 0||Object.keys(e).length===0)return!1;return!0}function validateHistory(n){if(n.length!==0){for(const e of n)if(e.role!=="user"&&e.role!=="model")throw new Error(`Role must be user or model, but got ${e.role}.`)}}function extractCuratedHistory(n){if(n===void 0||n.length===0)return[];const e=[],i=n.length;let s=0;for(;s<i;)if(n[s].role==="user")e.push(n[s]),s++;else{const r=[];let a=!0;for(;s<i&&n[s].role==="model";)r.push(n[s]),a&&!isValidContent(n[s])&&(a=!1),s++;a?e.push(...r):e.pop()}return e}class Chats{constructor(e,i){this.modelsModule=e,this.apiClient=i}create(e){return new Chat(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}}class Chat{constructor(e,i,s,r={},a=[]){this.apiClient=e,this.modelsModule=i,this.model=s,this.config=r,this.history=a,this.sendPromise=Promise.resolve(),validateHistory(a)}async sendMessage(e){var i;await this.sendPromise;const s=tContent(e.message),r=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(s),config:(i=e.config)!==null&&i!==void 0?i:this.config});return this.sendPromise=(async()=>{var a,o,l;const u=await r,c=(o=(a=u.candidates)===null||a===void 0?void 0:a[0])===null||o===void 0?void 0:o.content,f=u.automaticFunctionCallingHistory,p=this.getHistory(!0).length;let d=[];f!=null&&(d=(l=f.slice(p))!==null&&l!==void 0?l:[]);const m=c?[c]:[];this.recordHistory(s,m,d)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),r}async sendMessageStream(e){var i;await this.sendPromise;const s=tContent(e.message),r=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(s),config:(i=e.config)!==null&&i!==void 0?i:this.config});this.sendPromise=r.then(()=>{}).catch(()=>{});const a=await r;return this.processStreamResponse(a,s)}getHistory(e=!1){const i=e?extractCuratedHistory(this.history):this.history;return structuredClone(i)}processStreamResponse(e,i){var s,r;return __asyncGenerator(this,arguments,function*(){var o,l,u,c;const f=[];try{for(var p=!0,d=__asyncValues(e),m;m=yield __await(d.next()),o=m.done,!o;p=!0){c=m.value,p=!1;const P=c;if(isValidResponse(P)){const T=(r=(s=P.candidates)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.content;T!==void 0&&f.push(T)}yield yield __await(P)}}catch(P){l={error:P}}finally{try{!p&&!o&&(u=d.return)&&(yield __await(u.call(d)))}finally{if(l)throw l.error}}this.recordHistory(i,f)})}recordHistory(e,i,s){let r=[];i.length>0&&i.every(a=>a.role!==void 0)?r=i:r.push({role:"model",parts:[]}),s&&s.length>0?this.history.push(...extractCuratedHistory(s)):this.history.push(e),this.history.push(...r)}}/**
220
+ * @license
221
+ * Copyright 2025 Google LLC
222
+ * SPDX-License-Identifier: Apache-2.0
223
+ */class ApiError extends Error{constructor(e){super(e.message),this.name="ApiError",this.status=e.status,Object.setPrototypeOf(this,ApiError.prototype)}}/**
224
+ * @license
225
+ * Copyright 2025 Google LLC
226
+ * SPDX-License-Identifier: Apache-2.0
227
+ */function createFileParametersToMldev(n){const e={},i=getValueByPath(n,["file"]);return i!=null&&setValueByPath(e,["file"],i),e}function createFileResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function deleteFileParametersToMldev(n){const e={},i=getValueByPath(n,["name"]);return i!=null&&setValueByPath(e,["_url","file"],tFileName(i)),e}function deleteFileResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function getFileParametersToMldev(n){const e={},i=getValueByPath(n,["name"]);return i!=null&&setValueByPath(e,["_url","file"],tFileName(i)),e}function listFilesConfigToMldev(n,e){const i={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);return e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r),i}function listFilesParametersToMldev(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listFilesConfigToMldev(i,e),e}function listFilesResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["files"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["files"],a)}return e}/**
228
+ * @license
229
+ * Copyright 2025 Google LLC
230
+ * SPDX-License-Identifier: Apache-2.0
231
+ */class Files extends BaseModule{constructor(e){super(),this.apiClient=e,this.list=async(i={})=>new Pager(PagedItem.PAGED_ITEM_FILES,s=>this.listInternal(s),await this.listInternal(i),i)}async upload(e){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(e.file,e.config).then(i=>i)}async download(e){await this.apiClient.downloadFile(e)}async listInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=listFilesParametersToMldev(e);return a=formatMap("files",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(c=>{const f=c;return f.sdkHttpResponse={headers:u.headers},f})),r.then(u=>{const c=listFilesResponseFromMldev(u),f=new ListFilesResponse;return Object.assign(f,c),f})}}async createInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=createFileParametersToMldev(e);return a=formatMap("upload/v1beta/files",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const c=createFileResponseFromMldev(u),f=new CreateFileResponse;return Object.assign(f,c),f})}}async get(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=getFileParametersToMldev(e);return a=formatMap("files/{file}",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>u)}}async delete(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=deleteFileParametersToMldev(e);return a=formatMap("files/{file}",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(c=>{const f=c;return f.sdkHttpResponse={headers:u.headers},f})),r.then(u=>{const c=deleteFileResponseFromMldev(u),f=new DeleteFileResponse;return Object.assign(f,c),f})}}}/**
232
+ * @license
233
+ * Copyright 2025 Google LLC
234
+ * SPDX-License-Identifier: Apache-2.0
235
+ */function blobToMldev$2(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function contentToMldev$2(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(a=>partToMldev$2(a))),setValueByPath(e,["parts"],r)}const s=getValueByPath(n,["role"]);return s!=null&&setValueByPath(e,["role"],s),e}function fileDataToMldev$2(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function functionCallToMldev$2(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const s=getValueByPath(n,["args"]);s!=null&&setValueByPath(e,["args"],s);const r=getValueByPath(n,["name"]);if(r!=null&&setValueByPath(e,["name"],r),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionDeclarationToVertex$1(n){const e={};if(getValueByPath(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const i=getValueByPath(n,["description"]);i!=null&&setValueByPath(e,["description"],i);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(e,["name"],s);const r=getValueByPath(n,["parameters"]);r!=null&&setValueByPath(e,["parameters"],r);const a=getValueByPath(n,["parametersJsonSchema"]);a!=null&&setValueByPath(e,["parametersJsonSchema"],a);const o=getValueByPath(n,["response"]);o!=null&&setValueByPath(e,["response"],o);const l=getValueByPath(n,["responseJsonSchema"]);return l!=null&&setValueByPath(e,["responseJsonSchema"],l),e}function generationConfigToVertex$1(n){const e={},i=getValueByPath(n,["modelSelectionConfig"]);i!=null&&setValueByPath(e,["modelConfig"],i);const s=getValueByPath(n,["responseJsonSchema"]);s!=null&&setValueByPath(e,["responseJsonSchema"],s);const r=getValueByPath(n,["audioTimestamp"]);r!=null&&setValueByPath(e,["audioTimestamp"],r);const a=getValueByPath(n,["candidateCount"]);a!=null&&setValueByPath(e,["candidateCount"],a);const o=getValueByPath(n,["enableAffectiveDialog"]);o!=null&&setValueByPath(e,["enableAffectiveDialog"],o);const l=getValueByPath(n,["frequencyPenalty"]);l!=null&&setValueByPath(e,["frequencyPenalty"],l);const u=getValueByPath(n,["logprobs"]);u!=null&&setValueByPath(e,["logprobs"],u);const c=getValueByPath(n,["maxOutputTokens"]);c!=null&&setValueByPath(e,["maxOutputTokens"],c);const f=getValueByPath(n,["mediaResolution"]);f!=null&&setValueByPath(e,["mediaResolution"],f);const p=getValueByPath(n,["presencePenalty"]);p!=null&&setValueByPath(e,["presencePenalty"],p);const d=getValueByPath(n,["responseLogprobs"]);d!=null&&setValueByPath(e,["responseLogprobs"],d);const m=getValueByPath(n,["responseMimeType"]);m!=null&&setValueByPath(e,["responseMimeType"],m);const P=getValueByPath(n,["responseModalities"]);P!=null&&setValueByPath(e,["responseModalities"],P);const T=getValueByPath(n,["responseSchema"]);T!=null&&setValueByPath(e,["responseSchema"],T);const x=getValueByPath(n,["routingConfig"]);x!=null&&setValueByPath(e,["routingConfig"],x);const y=getValueByPath(n,["seed"]);y!=null&&setValueByPath(e,["seed"],y);const C=getValueByPath(n,["speechConfig"]);C!=null&&setValueByPath(e,["speechConfig"],speechConfigToVertex$1(C));const g=getValueByPath(n,["stopSequences"]);g!=null&&setValueByPath(e,["stopSequences"],g);const S=getValueByPath(n,["temperature"]);S!=null&&setValueByPath(e,["temperature"],S);const E=getValueByPath(n,["thinkingConfig"]);E!=null&&setValueByPath(e,["thinkingConfig"],E);const A=getValueByPath(n,["topK"]);A!=null&&setValueByPath(e,["topK"],A);const M=getValueByPath(n,["topP"]);if(M!=null&&setValueByPath(e,["topP"],M),getValueByPath(n,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}function googleMapsToMldev$2(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$2(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function liveConnectConfigToMldev$1(n,e){const i={},s=getValueByPath(n,["generationConfig"]);e!==void 0&&s!=null&&setValueByPath(e,["setup","generationConfig"],s);const r=getValueByPath(n,["responseModalities"]);e!==void 0&&r!=null&&setValueByPath(e,["setup","generationConfig","responseModalities"],r);const a=getValueByPath(n,["temperature"]);e!==void 0&&a!=null&&setValueByPath(e,["setup","generationConfig","temperature"],a);const o=getValueByPath(n,["topP"]);e!==void 0&&o!=null&&setValueByPath(e,["setup","generationConfig","topP"],o);const l=getValueByPath(n,["topK"]);e!==void 0&&l!=null&&setValueByPath(e,["setup","generationConfig","topK"],l);const u=getValueByPath(n,["maxOutputTokens"]);e!==void 0&&u!=null&&setValueByPath(e,["setup","generationConfig","maxOutputTokens"],u);const c=getValueByPath(n,["mediaResolution"]);e!==void 0&&c!=null&&setValueByPath(e,["setup","generationConfig","mediaResolution"],c);const f=getValueByPath(n,["seed"]);e!==void 0&&f!=null&&setValueByPath(e,["setup","generationConfig","seed"],f);const p=getValueByPath(n,["speechConfig"]);e!==void 0&&p!=null&&setValueByPath(e,["setup","generationConfig","speechConfig"],tLiveSpeechConfig(p));const d=getValueByPath(n,["thinkingConfig"]);e!==void 0&&d!=null&&setValueByPath(e,["setup","generationConfig","thinkingConfig"],d);const m=getValueByPath(n,["enableAffectiveDialog"]);e!==void 0&&m!=null&&setValueByPath(e,["setup","generationConfig","enableAffectiveDialog"],m);const P=getValueByPath(n,["systemInstruction"]);e!==void 0&&P!=null&&setValueByPath(e,["setup","systemInstruction"],contentToMldev$2(tContent(P)));const T=getValueByPath(n,["tools"]);if(e!==void 0&&T!=null){let A=tTools(T);Array.isArray(A)&&(A=A.map(M=>toolToMldev$2(tTool(M)))),setValueByPath(e,["setup","tools"],A)}const x=getValueByPath(n,["sessionResumption"]);e!==void 0&&x!=null&&setValueByPath(e,["setup","sessionResumption"],sessionResumptionConfigToMldev$1(x));const y=getValueByPath(n,["inputAudioTranscription"]);e!==void 0&&y!=null&&setValueByPath(e,["setup","inputAudioTranscription"],y);const C=getValueByPath(n,["outputAudioTranscription"]);e!==void 0&&C!=null&&setValueByPath(e,["setup","outputAudioTranscription"],C);const g=getValueByPath(n,["realtimeInputConfig"]);e!==void 0&&g!=null&&setValueByPath(e,["setup","realtimeInputConfig"],g);const S=getValueByPath(n,["contextWindowCompression"]);e!==void 0&&S!=null&&setValueByPath(e,["setup","contextWindowCompression"],S);const E=getValueByPath(n,["proactivity"]);return e!==void 0&&E!=null&&setValueByPath(e,["setup","proactivity"],E),i}function liveConnectConfigToVertex(n,e){const i={},s=getValueByPath(n,["generationConfig"]);e!==void 0&&s!=null&&setValueByPath(e,["setup","generationConfig"],generationConfigToVertex$1(s));const r=getValueByPath(n,["responseModalities"]);e!==void 0&&r!=null&&setValueByPath(e,["setup","generationConfig","responseModalities"],r);const a=getValueByPath(n,["temperature"]);e!==void 0&&a!=null&&setValueByPath(e,["setup","generationConfig","temperature"],a);const o=getValueByPath(n,["topP"]);e!==void 0&&o!=null&&setValueByPath(e,["setup","generationConfig","topP"],o);const l=getValueByPath(n,["topK"]);e!==void 0&&l!=null&&setValueByPath(e,["setup","generationConfig","topK"],l);const u=getValueByPath(n,["maxOutputTokens"]);e!==void 0&&u!=null&&setValueByPath(e,["setup","generationConfig","maxOutputTokens"],u);const c=getValueByPath(n,["mediaResolution"]);e!==void 0&&c!=null&&setValueByPath(e,["setup","generationConfig","mediaResolution"],c);const f=getValueByPath(n,["seed"]);e!==void 0&&f!=null&&setValueByPath(e,["setup","generationConfig","seed"],f);const p=getValueByPath(n,["speechConfig"]);e!==void 0&&p!=null&&setValueByPath(e,["setup","generationConfig","speechConfig"],speechConfigToVertex$1(tLiveSpeechConfig(p)));const d=getValueByPath(n,["thinkingConfig"]);e!==void 0&&d!=null&&setValueByPath(e,["setup","generationConfig","thinkingConfig"],d);const m=getValueByPath(n,["enableAffectiveDialog"]);e!==void 0&&m!=null&&setValueByPath(e,["setup","generationConfig","enableAffectiveDialog"],m);const P=getValueByPath(n,["systemInstruction"]);e!==void 0&&P!=null&&setValueByPath(e,["setup","systemInstruction"],tContent(P));const T=getValueByPath(n,["tools"]);if(e!==void 0&&T!=null){let A=tTools(T);Array.isArray(A)&&(A=A.map(M=>toolToVertex$1(tTool(M)))),setValueByPath(e,["setup","tools"],A)}const x=getValueByPath(n,["sessionResumption"]);e!==void 0&&x!=null&&setValueByPath(e,["setup","sessionResumption"],x);const y=getValueByPath(n,["inputAudioTranscription"]);e!==void 0&&y!=null&&setValueByPath(e,["setup","inputAudioTranscription"],y);const C=getValueByPath(n,["outputAudioTranscription"]);e!==void 0&&C!=null&&setValueByPath(e,["setup","outputAudioTranscription"],C);const g=getValueByPath(n,["realtimeInputConfig"]);e!==void 0&&g!=null&&setValueByPath(e,["setup","realtimeInputConfig"],g);const S=getValueByPath(n,["contextWindowCompression"]);e!==void 0&&S!=null&&setValueByPath(e,["setup","contextWindowCompression"],S);const E=getValueByPath(n,["proactivity"]);return e!==void 0&&E!=null&&setValueByPath(e,["setup","proactivity"],E),i}function liveConnectParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["setup","model"],tModel(n,s));const r=getValueByPath(e,["config"]);return r!=null&&setValueByPath(i,["config"],liveConnectConfigToMldev$1(r,i)),i}function liveConnectParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["setup","model"],tModel(n,s));const r=getValueByPath(e,["config"]);return r!=null&&setValueByPath(i,["config"],liveConnectConfigToVertex(r,i)),i}function liveMusicSetConfigParametersToMldev(n){const e={},i=getValueByPath(n,["musicGenerationConfig"]);return i!=null&&setValueByPath(e,["musicGenerationConfig"],i),e}function liveMusicSetWeightedPromptsParametersToMldev(n){const e={},i=getValueByPath(n,["weightedPrompts"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(e,["weightedPrompts"],s)}return e}function liveSendRealtimeInputParametersToMldev(n){const e={},i=getValueByPath(n,["media"]);if(i!=null){let c=tBlobs(i);Array.isArray(c)&&(c=c.map(f=>blobToMldev$2(f))),setValueByPath(e,["mediaChunks"],c)}const s=getValueByPath(n,["audio"]);s!=null&&setValueByPath(e,["audio"],blobToMldev$2(tAudioBlob(s)));const r=getValueByPath(n,["audioStreamEnd"]);r!=null&&setValueByPath(e,["audioStreamEnd"],r);const a=getValueByPath(n,["video"]);a!=null&&setValueByPath(e,["video"],blobToMldev$2(tImageBlob(a)));const o=getValueByPath(n,["text"]);o!=null&&setValueByPath(e,["text"],o);const l=getValueByPath(n,["activityStart"]);l!=null&&setValueByPath(e,["activityStart"],l);const u=getValueByPath(n,["activityEnd"]);return u!=null&&setValueByPath(e,["activityEnd"],u),e}function liveSendRealtimeInputParametersToVertex(n){const e={},i=getValueByPath(n,["media"]);if(i!=null){let c=tBlobs(i);Array.isArray(c)&&(c=c.map(f=>f)),setValueByPath(e,["mediaChunks"],c)}const s=getValueByPath(n,["audio"]);s!=null&&setValueByPath(e,["audio"],tAudioBlob(s));const r=getValueByPath(n,["audioStreamEnd"]);r!=null&&setValueByPath(e,["audioStreamEnd"],r);const a=getValueByPath(n,["video"]);a!=null&&setValueByPath(e,["video"],tImageBlob(a));const o=getValueByPath(n,["text"]);o!=null&&setValueByPath(e,["text"],o);const l=getValueByPath(n,["activityStart"]);l!=null&&setValueByPath(e,["activityStart"],l);const u=getValueByPath(n,["activityEnd"]);return u!=null&&setValueByPath(e,["activityEnd"],u),e}function liveServerMessageFromVertex(n){const e={},i=getValueByPath(n,["setupComplete"]);i!=null&&setValueByPath(e,["setupComplete"],i);const s=getValueByPath(n,["serverContent"]);s!=null&&setValueByPath(e,["serverContent"],s);const r=getValueByPath(n,["toolCall"]);r!=null&&setValueByPath(e,["toolCall"],r);const a=getValueByPath(n,["toolCallCancellation"]);a!=null&&setValueByPath(e,["toolCallCancellation"],a);const o=getValueByPath(n,["usageMetadata"]);o!=null&&setValueByPath(e,["usageMetadata"],usageMetadataFromVertex(o));const l=getValueByPath(n,["goAway"]);l!=null&&setValueByPath(e,["goAway"],l);const u=getValueByPath(n,["sessionResumptionUpdate"]);return u!=null&&setValueByPath(e,["sessionResumptionUpdate"],u),e}function partToMldev$2(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const s=getValueByPath(n,["codeExecutionResult"]);s!=null&&setValueByPath(e,["codeExecutionResult"],s);const r=getValueByPath(n,["executableCode"]);r!=null&&setValueByPath(e,["executableCode"],r);const a=getValueByPath(n,["fileData"]);a!=null&&setValueByPath(e,["fileData"],fileDataToMldev$2(a));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$2(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$2(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const f=getValueByPath(n,["thought"]);f!=null&&setValueByPath(e,["thought"],f);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const d=getValueByPath(n,["videoMetadata"]);return d!=null&&setValueByPath(e,["videoMetadata"],d),e}function sessionResumptionConfigToMldev$1(n){const e={},i=getValueByPath(n,["handle"]);if(i!=null&&setValueByPath(e,["handle"],i),getValueByPath(n,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return e}function speechConfigToVertex$1(n){const e={},i=getValueByPath(n,["languageCode"]);i!=null&&setValueByPath(e,["languageCode"],i);const s=getValueByPath(n,["voiceConfig"]);if(s!=null&&setValueByPath(e,["voiceConfig"],s),getValueByPath(n,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");return e}function toolToMldev$2(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let f=i;Array.isArray(f)&&(f=f.map(p=>p)),setValueByPath(e,["functionDeclarations"],f)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const s=getValueByPath(n,["googleSearchRetrieval"]);s!=null&&setValueByPath(e,["googleSearchRetrieval"],s);const r=getValueByPath(n,["computerUse"]);r!=null&&setValueByPath(e,["computerUse"],r);const a=getValueByPath(n,["fileSearch"]);a!=null&&setValueByPath(e,["fileSearch"],a);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$2(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$2(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}function toolToVertex$1(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let p=i;Array.isArray(p)&&(p=p.map(d=>functionDeclarationToVertex$1(d))),setValueByPath(e,["functionDeclarations"],p)}const s=getValueByPath(n,["retrieval"]);s!=null&&setValueByPath(e,["retrieval"],s);const r=getValueByPath(n,["googleSearchRetrieval"]);r!=null&&setValueByPath(e,["googleSearchRetrieval"],r);const a=getValueByPath(n,["computerUse"]);if(a!=null&&setValueByPath(e,["computerUse"],a),getValueByPath(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=getValueByPath(n,["codeExecution"]);o!=null&&setValueByPath(e,["codeExecution"],o);const l=getValueByPath(n,["enterpriseWebSearch"]);l!=null&&setValueByPath(e,["enterpriseWebSearch"],l);const u=getValueByPath(n,["googleMaps"]);u!=null&&setValueByPath(e,["googleMaps"],u);const c=getValueByPath(n,["googleSearch"]);c!=null&&setValueByPath(e,["googleSearch"],c);const f=getValueByPath(n,["urlContext"]);return f!=null&&setValueByPath(e,["urlContext"],f),e}function usageMetadataFromVertex(n){const e={},i=getValueByPath(n,["promptTokenCount"]);i!=null&&setValueByPath(e,["promptTokenCount"],i);const s=getValueByPath(n,["cachedContentTokenCount"]);s!=null&&setValueByPath(e,["cachedContentTokenCount"],s);const r=getValueByPath(n,["candidatesTokenCount"]);r!=null&&setValueByPath(e,["responseTokenCount"],r);const a=getValueByPath(n,["toolUsePromptTokenCount"]);a!=null&&setValueByPath(e,["toolUsePromptTokenCount"],a);const o=getValueByPath(n,["thoughtsTokenCount"]);o!=null&&setValueByPath(e,["thoughtsTokenCount"],o);const l=getValueByPath(n,["totalTokenCount"]);l!=null&&setValueByPath(e,["totalTokenCount"],l);const u=getValueByPath(n,["promptTokensDetails"]);if(u!=null){let m=u;Array.isArray(m)&&(m=m.map(P=>P)),setValueByPath(e,["promptTokensDetails"],m)}const c=getValueByPath(n,["cacheTokensDetails"]);if(c!=null){let m=c;Array.isArray(m)&&(m=m.map(P=>P)),setValueByPath(e,["cacheTokensDetails"],m)}const f=getValueByPath(n,["candidatesTokensDetails"]);if(f!=null){let m=f;Array.isArray(m)&&(m=m.map(P=>P)),setValueByPath(e,["responseTokensDetails"],m)}const p=getValueByPath(n,["toolUsePromptTokensDetails"]);if(p!=null){let m=p;Array.isArray(m)&&(m=m.map(P=>P)),setValueByPath(e,["toolUsePromptTokensDetails"],m)}const d=getValueByPath(n,["trafficType"]);return d!=null&&setValueByPath(e,["trafficType"],d),e}/**
236
+ * @license
237
+ * Copyright 2025 Google LLC
238
+ * SPDX-License-Identifier: Apache-2.0
239
+ */function blobToMldev$1(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function candidateFromMldev(n){const e={},i=getValueByPath(n,["content"]);i!=null&&setValueByPath(e,["content"],i);const s=getValueByPath(n,["citationMetadata"]);s!=null&&setValueByPath(e,["citationMetadata"],citationMetadataFromMldev(s));const r=getValueByPath(n,["tokenCount"]);r!=null&&setValueByPath(e,["tokenCount"],r);const a=getValueByPath(n,["finishReason"]);a!=null&&setValueByPath(e,["finishReason"],a);const o=getValueByPath(n,["avgLogprobs"]);o!=null&&setValueByPath(e,["avgLogprobs"],o);const l=getValueByPath(n,["groundingMetadata"]);l!=null&&setValueByPath(e,["groundingMetadata"],l);const u=getValueByPath(n,["index"]);u!=null&&setValueByPath(e,["index"],u);const c=getValueByPath(n,["logprobsResult"]);c!=null&&setValueByPath(e,["logprobsResult"],c);const f=getValueByPath(n,["safetyRatings"]);if(f!=null){let d=f;Array.isArray(d)&&(d=d.map(m=>m)),setValueByPath(e,["safetyRatings"],d)}const p=getValueByPath(n,["urlContextMetadata"]);return p!=null&&setValueByPath(e,["urlContextMetadata"],p),e}function citationMetadataFromMldev(n){const e={},i=getValueByPath(n,["citationSources"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(e,["citations"],s)}return e}function computeTokensParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let a=tContents(r);Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(i,["contents"],a)}return i}function computeTokensResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["tokensInfo"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>a)),setValueByPath(e,["tokensInfo"],r)}return e}function contentEmbeddingFromVertex(n){const e={},i=getValueByPath(n,["values"]);i!=null&&setValueByPath(e,["values"],i);const s=getValueByPath(n,["statistics"]);return s!=null&&setValueByPath(e,["statistics"],contentEmbeddingStatisticsFromVertex(s)),e}function contentEmbeddingStatisticsFromVertex(n){const e={},i=getValueByPath(n,["truncated"]);i!=null&&setValueByPath(e,["truncated"],i);const s=getValueByPath(n,["token_count"]);return s!=null&&setValueByPath(e,["tokenCount"],s),e}function contentToMldev$1(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(a=>partToMldev$1(a))),setValueByPath(e,["parts"],r)}const s=getValueByPath(n,["role"]);return s!=null&&setValueByPath(e,["role"],s),e}function controlReferenceConfigToVertex(n){const e={},i=getValueByPath(n,["controlType"]);i!=null&&setValueByPath(e,["controlType"],i);const s=getValueByPath(n,["enableControlImageComputation"]);return s!=null&&setValueByPath(e,["computeControl"],s),e}function countTokensConfigToMldev(n){const e={};if(getValueByPath(n,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(getValueByPath(n,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(getValueByPath(n,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return e}function countTokensConfigToVertex(n,e){const i={},s=getValueByPath(n,["systemInstruction"]);e!==void 0&&s!=null&&setValueByPath(e,["systemInstruction"],tContent(s));const r=getValueByPath(n,["tools"]);if(e!==void 0&&r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>toolToVertex(l))),setValueByPath(e,["tools"],o)}const a=getValueByPath(n,["generationConfig"]);return e!==void 0&&a!=null&&setValueByPath(e,["generationConfig"],generationConfigToVertex(a)),i}function countTokensParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let o=tContents(r);Array.isArray(o)&&(o=o.map(l=>contentToMldev$1(l))),setValueByPath(i,["contents"],o)}const a=getValueByPath(e,["config"]);return a!=null&&countTokensConfigToMldev(a),i}function countTokensParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let o=tContents(r);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["contents"],o)}const a=getValueByPath(e,["config"]);return a!=null&&countTokensConfigToVertex(a,i),i}function countTokensResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["totalTokens"]);s!=null&&setValueByPath(e,["totalTokens"],s);const r=getValueByPath(n,["cachedContentTokenCount"]);return r!=null&&setValueByPath(e,["cachedContentTokenCount"],r),e}function countTokensResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["totalTokens"]);return s!=null&&setValueByPath(e,["totalTokens"],s),e}function deleteModelParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);return s!=null&&setValueByPath(i,["_url","name"],tModel(n,s)),i}function deleteModelParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);return s!=null&&setValueByPath(i,["_url","name"],tModel(n,s)),i}function deleteModelResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function deleteModelResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function editImageConfigToVertex(n,e){const i={},s=getValueByPath(n,["outputGcsUri"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","storageUri"],s);const r=getValueByPath(n,["negativePrompt"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","negativePrompt"],r);const a=getValueByPath(n,["numberOfImages"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const o=getValueByPath(n,["aspectRatio"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","aspectRatio"],o);const l=getValueByPath(n,["guidanceScale"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","guidanceScale"],l);const u=getValueByPath(n,["seed"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","seed"],u);const c=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","safetySetting"],c);const f=getValueByPath(n,["personGeneration"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","personGeneration"],f);const p=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],p);const d=getValueByPath(n,["includeRaiReason"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","includeRaiReason"],d);const m=getValueByPath(n,["language"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","language"],m);const P=getValueByPath(n,["outputMimeType"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],P);const T=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&T!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],T);const x=getValueByPath(n,["addWatermark"]);e!==void 0&&x!=null&&setValueByPath(e,["parameters","addWatermark"],x);const y=getValueByPath(n,["labels"]);e!==void 0&&y!=null&&setValueByPath(e,["labels"],y);const C=getValueByPath(n,["editMode"]);e!==void 0&&C!=null&&setValueByPath(e,["parameters","editMode"],C);const g=getValueByPath(n,["baseSteps"]);return e!==void 0&&g!=null&&setValueByPath(e,["parameters","editConfig","baseSteps"],g),i}function editImageParametersInternalToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["prompt"]);r!=null&&setValueByPath(i,["instances[0]","prompt"],r);const a=getValueByPath(e,["referenceImages"]);if(a!=null){let l=a;Array.isArray(l)&&(l=l.map(u=>referenceImageAPIInternalToVertex(u))),setValueByPath(i,["instances[0]","referenceImages"],l)}const o=getValueByPath(e,["config"]);return o!=null&&editImageConfigToVertex(o,i),i}function editImageResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["predictions"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>generatedImageFromVertex(a))),setValueByPath(e,["generatedImages"],r)}return e}function embedContentConfigToMldev(n,e){const i={},s=getValueByPath(n,["taskType"]);e!==void 0&&s!=null&&setValueByPath(e,["requests[]","taskType"],s);const r=getValueByPath(n,["title"]);e!==void 0&&r!=null&&setValueByPath(e,["requests[]","title"],r);const a=getValueByPath(n,["outputDimensionality"]);if(e!==void 0&&a!=null&&setValueByPath(e,["requests[]","outputDimensionality"],a),getValueByPath(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return i}function embedContentConfigToVertex(n,e){const i={},s=getValueByPath(n,["taskType"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[]","task_type"],s);const r=getValueByPath(n,["title"]);e!==void 0&&r!=null&&setValueByPath(e,["instances[]","title"],r);const a=getValueByPath(n,["outputDimensionality"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","outputDimensionality"],a);const o=getValueByPath(n,["mimeType"]);e!==void 0&&o!=null&&setValueByPath(e,["instances[]","mimeType"],o);const l=getValueByPath(n,["autoTruncate"]);return e!==void 0&&l!=null&&setValueByPath(e,["parameters","autoTruncate"],l),i}function embedContentParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let l=tContentsForEmbed(n,r);Array.isArray(l)&&(l=l.map(u=>u)),setValueByPath(i,["requests[]","content"],l)}const a=getValueByPath(e,["config"]);a!=null&&embedContentConfigToMldev(a,i);const o=getValueByPath(e,["model"]);return o!==void 0&&setValueByPath(i,["requests[]","model"],tModel(n,o)),i}function embedContentParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let o=tContentsForEmbed(n,r);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["instances[]","content"],o)}const a=getValueByPath(e,["config"]);return a!=null&&embedContentConfigToVertex(a,i),i}function embedContentResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["embeddings"]);if(s!=null){let a=s;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["embeddings"],a)}const r=getValueByPath(n,["metadata"]);return r!=null&&setValueByPath(e,["metadata"],r),e}function embedContentResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["predictions[]","embeddings"]);if(s!=null){let a=s;Array.isArray(a)&&(a=a.map(o=>contentEmbeddingFromVertex(o))),setValueByPath(e,["embeddings"],a)}const r=getValueByPath(n,["metadata"]);return r!=null&&setValueByPath(e,["metadata"],r),e}function endpointFromVertex(n){const e={},i=getValueByPath(n,["endpoint"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["deployedModelId"]);return s!=null&&setValueByPath(e,["deployedModelId"],s),e}function fileDataToMldev$1(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function functionCallToMldev$1(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const s=getValueByPath(n,["args"]);s!=null&&setValueByPath(e,["args"],s);const r=getValueByPath(n,["name"]);if(r!=null&&setValueByPath(e,["name"],r),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionCallingConfigToMldev(n){const e={},i=getValueByPath(n,["mode"]);i!=null&&setValueByPath(e,["mode"],i);const s=getValueByPath(n,["allowedFunctionNames"]);if(s!=null&&setValueByPath(e,["allowedFunctionNames"],s),getValueByPath(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function functionDeclarationToVertex(n){const e={};if(getValueByPath(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const i=getValueByPath(n,["description"]);i!=null&&setValueByPath(e,["description"],i);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(e,["name"],s);const r=getValueByPath(n,["parameters"]);r!=null&&setValueByPath(e,["parameters"],r);const a=getValueByPath(n,["parametersJsonSchema"]);a!=null&&setValueByPath(e,["parametersJsonSchema"],a);const o=getValueByPath(n,["response"]);o!=null&&setValueByPath(e,["response"],o);const l=getValueByPath(n,["responseJsonSchema"]);return l!=null&&setValueByPath(e,["responseJsonSchema"],l),e}function generateContentConfigToMldev(n,e,i){const s={},r=getValueByPath(e,["systemInstruction"]);i!==void 0&&r!=null&&setValueByPath(i,["systemInstruction"],contentToMldev$1(tContent(r)));const a=getValueByPath(e,["temperature"]);a!=null&&setValueByPath(s,["temperature"],a);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(s,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(s,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(s,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(s,["maxOutputTokens"],c);const f=getValueByPath(e,["stopSequences"]);f!=null&&setValueByPath(s,["stopSequences"],f);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(s,["responseLogprobs"],p);const d=getValueByPath(e,["logprobs"]);d!=null&&setValueByPath(s,["logprobs"],d);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(s,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(s,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(s,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(s,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(s,["responseSchema"],tSchema(y));const C=getValueByPath(e,["responseJsonSchema"]);if(C!=null&&setValueByPath(s,["responseJsonSchema"],C),getValueByPath(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(getValueByPath(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const g=getValueByPath(e,["safetySettings"]);if(i!==void 0&&g!=null){let D=g;Array.isArray(D)&&(D=D.map(U=>safetySettingToMldev(U))),setValueByPath(i,["safetySettings"],D)}const S=getValueByPath(e,["tools"]);if(i!==void 0&&S!=null){let D=tTools(S);Array.isArray(D)&&(D=D.map(U=>toolToMldev$1(tTool(U)))),setValueByPath(i,["tools"],D)}const E=getValueByPath(e,["toolConfig"]);if(i!==void 0&&E!=null&&setValueByPath(i,["toolConfig"],toolConfigToMldev(E)),getValueByPath(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const A=getValueByPath(e,["cachedContent"]);i!==void 0&&A!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,A));const M=getValueByPath(e,["responseModalities"]);M!=null&&setValueByPath(s,["responseModalities"],M);const b=getValueByPath(e,["mediaResolution"]);b!=null&&setValueByPath(s,["mediaResolution"],b);const F=getValueByPath(e,["speechConfig"]);if(F!=null&&setValueByPath(s,["speechConfig"],tSpeechConfig(F)),getValueByPath(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const G=getValueByPath(e,["thinkingConfig"]);G!=null&&setValueByPath(s,["thinkingConfig"],G);const L=getValueByPath(e,["imageConfig"]);return L!=null&&setValueByPath(s,["imageConfig"],imageConfigToMldev(L)),s}function generateContentConfigToVertex(n,e,i){const s={},r=getValueByPath(e,["systemInstruction"]);i!==void 0&&r!=null&&setValueByPath(i,["systemInstruction"],tContent(r));const a=getValueByPath(e,["temperature"]);a!=null&&setValueByPath(s,["temperature"],a);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(s,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(s,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(s,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(s,["maxOutputTokens"],c);const f=getValueByPath(e,["stopSequences"]);f!=null&&setValueByPath(s,["stopSequences"],f);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(s,["responseLogprobs"],p);const d=getValueByPath(e,["logprobs"]);d!=null&&setValueByPath(s,["logprobs"],d);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(s,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(s,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(s,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(s,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(s,["responseSchema"],tSchema(y));const C=getValueByPath(e,["responseJsonSchema"]);C!=null&&setValueByPath(s,["responseJsonSchema"],C);const g=getValueByPath(e,["routingConfig"]);g!=null&&setValueByPath(s,["routingConfig"],g);const S=getValueByPath(e,["modelSelectionConfig"]);S!=null&&setValueByPath(s,["modelConfig"],S);const E=getValueByPath(e,["safetySettings"]);if(i!==void 0&&E!=null){let _=E;Array.isArray(_)&&(_=_.map(I=>I)),setValueByPath(i,["safetySettings"],_)}const A=getValueByPath(e,["tools"]);if(i!==void 0&&A!=null){let _=tTools(A);Array.isArray(_)&&(_=_.map(I=>toolToVertex(tTool(I)))),setValueByPath(i,["tools"],_)}const M=getValueByPath(e,["toolConfig"]);i!==void 0&&M!=null&&setValueByPath(i,["toolConfig"],M);const b=getValueByPath(e,["labels"]);i!==void 0&&b!=null&&setValueByPath(i,["labels"],b);const F=getValueByPath(e,["cachedContent"]);i!==void 0&&F!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,F));const G=getValueByPath(e,["responseModalities"]);G!=null&&setValueByPath(s,["responseModalities"],G);const L=getValueByPath(e,["mediaResolution"]);L!=null&&setValueByPath(s,["mediaResolution"],L);const D=getValueByPath(e,["speechConfig"]);D!=null&&setValueByPath(s,["speechConfig"],speechConfigToVertex(tSpeechConfig(D)));const U=getValueByPath(e,["audioTimestamp"]);U!=null&&setValueByPath(s,["audioTimestamp"],U);const z=getValueByPath(e,["thinkingConfig"]);z!=null&&setValueByPath(s,["thinkingConfig"],z);const O=getValueByPath(e,["imageConfig"]);return O!=null&&setValueByPath(s,["imageConfig"],imageConfigToVertex(O)),s}function generateContentParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let o=tContents(r);Array.isArray(o)&&(o=o.map(l=>contentToMldev$1(l))),setValueByPath(i,["contents"],o)}const a=getValueByPath(e,["config"]);return a!=null&&setValueByPath(i,["generationConfig"],generateContentConfigToMldev(n,a,i)),i}function generateContentParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["contents"]);if(r!=null){let o=tContents(r);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["contents"],o)}const a=getValueByPath(e,["config"]);return a!=null&&setValueByPath(i,["generationConfig"],generateContentConfigToVertex(n,a,i)),i}function generateContentResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["candidates"]);if(s!=null){let u=s;Array.isArray(u)&&(u=u.map(c=>candidateFromMldev(c))),setValueByPath(e,["candidates"],u)}const r=getValueByPath(n,["modelVersion"]);r!=null&&setValueByPath(e,["modelVersion"],r);const a=getValueByPath(n,["promptFeedback"]);a!=null&&setValueByPath(e,["promptFeedback"],a);const o=getValueByPath(n,["responseId"]);o!=null&&setValueByPath(e,["responseId"],o);const l=getValueByPath(n,["usageMetadata"]);return l!=null&&setValueByPath(e,["usageMetadata"],l),e}function generateContentResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["candidates"]);if(s!=null){let c=s;Array.isArray(c)&&(c=c.map(f=>f)),setValueByPath(e,["candidates"],c)}const r=getValueByPath(n,["createTime"]);r!=null&&setValueByPath(e,["createTime"],r);const a=getValueByPath(n,["modelVersion"]);a!=null&&setValueByPath(e,["modelVersion"],a);const o=getValueByPath(n,["promptFeedback"]);o!=null&&setValueByPath(e,["promptFeedback"],o);const l=getValueByPath(n,["responseId"]);l!=null&&setValueByPath(e,["responseId"],l);const u=getValueByPath(n,["usageMetadata"]);return u!=null&&setValueByPath(e,["usageMetadata"],u),e}function generateImagesConfigToMldev(n,e){const i={};if(getValueByPath(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const s=getValueByPath(n,["numberOfImages"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","sampleCount"],s);const r=getValueByPath(n,["aspectRatio"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","aspectRatio"],r);const a=getValueByPath(n,["guidanceScale"]);if(e!==void 0&&a!=null&&setValueByPath(e,["parameters","guidanceScale"],a),getValueByPath(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const o=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","safetySetting"],o);const l=getValueByPath(n,["personGeneration"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","personGeneration"],l);const u=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],u);const c=getValueByPath(n,["includeRaiReason"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","includeRaiReason"],c);const f=getValueByPath(n,["language"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","language"],f);const p=getValueByPath(n,["outputMimeType"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],p);const d=getValueByPath(n,["outputCompressionQuality"]);if(e!==void 0&&d!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],d),getValueByPath(n,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(getValueByPath(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const m=getValueByPath(n,["imageSize"]);if(e!==void 0&&m!=null&&setValueByPath(e,["parameters","sampleImageSize"],m),getValueByPath(n,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return i}function generateImagesConfigToVertex(n,e){const i={},s=getValueByPath(n,["outputGcsUri"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","storageUri"],s);const r=getValueByPath(n,["negativePrompt"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","negativePrompt"],r);const a=getValueByPath(n,["numberOfImages"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const o=getValueByPath(n,["aspectRatio"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","aspectRatio"],o);const l=getValueByPath(n,["guidanceScale"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","guidanceScale"],l);const u=getValueByPath(n,["seed"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","seed"],u);const c=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","safetySetting"],c);const f=getValueByPath(n,["personGeneration"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","personGeneration"],f);const p=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],p);const d=getValueByPath(n,["includeRaiReason"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","includeRaiReason"],d);const m=getValueByPath(n,["language"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","language"],m);const P=getValueByPath(n,["outputMimeType"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],P);const T=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&T!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],T);const x=getValueByPath(n,["addWatermark"]);e!==void 0&&x!=null&&setValueByPath(e,["parameters","addWatermark"],x);const y=getValueByPath(n,["labels"]);e!==void 0&&y!=null&&setValueByPath(e,["labels"],y);const C=getValueByPath(n,["imageSize"]);e!==void 0&&C!=null&&setValueByPath(e,["parameters","sampleImageSize"],C);const g=getValueByPath(n,["enhancePrompt"]);return e!==void 0&&g!=null&&setValueByPath(e,["parameters","enhancePrompt"],g),i}function generateImagesParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["prompt"]);r!=null&&setValueByPath(i,["instances[0]","prompt"],r);const a=getValueByPath(e,["config"]);return a!=null&&generateImagesConfigToMldev(a,i),i}function generateImagesParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["prompt"]);r!=null&&setValueByPath(i,["instances[0]","prompt"],r);const a=getValueByPath(e,["config"]);return a!=null&&generateImagesConfigToVertex(a,i),i}function generateImagesResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["predictions"]);if(s!=null){let a=s;Array.isArray(a)&&(a=a.map(o=>generatedImageFromMldev(o))),setValueByPath(e,["generatedImages"],a)}const r=getValueByPath(n,["positivePromptSafetyAttributes"]);return r!=null&&setValueByPath(e,["positivePromptSafetyAttributes"],safetyAttributesFromMldev(r)),e}function generateImagesResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["predictions"]);if(s!=null){let a=s;Array.isArray(a)&&(a=a.map(o=>generatedImageFromVertex(o))),setValueByPath(e,["generatedImages"],a)}const r=getValueByPath(n,["positivePromptSafetyAttributes"]);return r!=null&&setValueByPath(e,["positivePromptSafetyAttributes"],safetyAttributesFromVertex(r)),e}function generateVideosConfigToMldev(n,e){const i={},s=getValueByPath(n,["numberOfVideos"]);if(e!==void 0&&s!=null&&setValueByPath(e,["parameters","sampleCount"],s),getValueByPath(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const r=getValueByPath(n,["durationSeconds"]);if(e!==void 0&&r!=null&&setValueByPath(e,["parameters","durationSeconds"],r),getValueByPath(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const a=getValueByPath(n,["aspectRatio"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","aspectRatio"],a);const o=getValueByPath(n,["resolution"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","resolution"],o);const l=getValueByPath(n,["personGeneration"]);if(e!==void 0&&l!=null&&setValueByPath(e,["parameters","personGeneration"],l),getValueByPath(n,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const u=getValueByPath(n,["negativePrompt"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","negativePrompt"],u);const c=getValueByPath(n,["enhancePrompt"]);if(e!==void 0&&c!=null&&setValueByPath(e,["parameters","enhancePrompt"],c),getValueByPath(n,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const f=getValueByPath(n,["lastFrame"]);e!==void 0&&f!=null&&setValueByPath(e,["instances[0]","lastFrame"],imageToMldev(f));const p=getValueByPath(n,["referenceImages"]);if(e!==void 0&&p!=null){let d=p;Array.isArray(d)&&(d=d.map(m=>videoGenerationReferenceImageToMldev(m))),setValueByPath(e,["instances[0]","referenceImages"],d)}if(getValueByPath(n,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(getValueByPath(n,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return i}function generateVideosConfigToVertex(n,e){const i={},s=getValueByPath(n,["numberOfVideos"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","sampleCount"],s);const r=getValueByPath(n,["outputGcsUri"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","storageUri"],r);const a=getValueByPath(n,["fps"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","fps"],a);const o=getValueByPath(n,["durationSeconds"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","durationSeconds"],o);const l=getValueByPath(n,["seed"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","seed"],l);const u=getValueByPath(n,["aspectRatio"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","aspectRatio"],u);const c=getValueByPath(n,["resolution"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","resolution"],c);const f=getValueByPath(n,["personGeneration"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","personGeneration"],f);const p=getValueByPath(n,["pubsubTopic"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","pubsubTopic"],p);const d=getValueByPath(n,["negativePrompt"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","negativePrompt"],d);const m=getValueByPath(n,["enhancePrompt"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","enhancePrompt"],m);const P=getValueByPath(n,["generateAudio"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","generateAudio"],P);const T=getValueByPath(n,["lastFrame"]);e!==void 0&&T!=null&&setValueByPath(e,["instances[0]","lastFrame"],imageToVertex(T));const x=getValueByPath(n,["referenceImages"]);if(e!==void 0&&x!=null){let g=x;Array.isArray(g)&&(g=g.map(S=>videoGenerationReferenceImageToVertex(S))),setValueByPath(e,["instances[0]","referenceImages"],g)}const y=getValueByPath(n,["mask"]);e!==void 0&&y!=null&&setValueByPath(e,["instances[0]","mask"],videoGenerationMaskToVertex(y));const C=getValueByPath(n,["compressionQuality"]);return e!==void 0&&C!=null&&setValueByPath(e,["parameters","compressionQuality"],C),i}function generateVideosOperationFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata"]);s!=null&&setValueByPath(e,["metadata"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["response","generateVideoResponse"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromMldev(o)),e}function generateVideosOperationFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata"]);s!=null&&setValueByPath(e,["metadata"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["response"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromVertex(o)),e}function generateVideosParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["prompt"]);r!=null&&setValueByPath(i,["instances[0]","prompt"],r);const a=getValueByPath(e,["image"]);a!=null&&setValueByPath(i,["instances[0]","image"],imageToMldev(a));const o=getValueByPath(e,["video"]);o!=null&&setValueByPath(i,["instances[0]","video"],videoToMldev(o));const l=getValueByPath(e,["source"]);l!=null&&generateVideosSourceToMldev(l,i);const u=getValueByPath(e,["config"]);return u!=null&&generateVideosConfigToMldev(u,i),i}function generateVideosParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["prompt"]);r!=null&&setValueByPath(i,["instances[0]","prompt"],r);const a=getValueByPath(e,["image"]);a!=null&&setValueByPath(i,["instances[0]","image"],imageToVertex(a));const o=getValueByPath(e,["video"]);o!=null&&setValueByPath(i,["instances[0]","video"],videoToVertex(o));const l=getValueByPath(e,["source"]);l!=null&&generateVideosSourceToVertex(l,i);const u=getValueByPath(e,["config"]);return u!=null&&generateVideosConfigToVertex(u,i),i}function generateVideosResponseFromMldev(n){const e={},i=getValueByPath(n,["generatedSamples"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(o=>generatedVideoFromMldev(o))),setValueByPath(e,["generatedVideos"],a)}const s=getValueByPath(n,["raiMediaFilteredCount"]);s!=null&&setValueByPath(e,["raiMediaFilteredCount"],s);const r=getValueByPath(n,["raiMediaFilteredReasons"]);return r!=null&&setValueByPath(e,["raiMediaFilteredReasons"],r),e}function generateVideosResponseFromVertex(n){const e={},i=getValueByPath(n,["videos"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(o=>generatedVideoFromVertex(o))),setValueByPath(e,["generatedVideos"],a)}const s=getValueByPath(n,["raiMediaFilteredCount"]);s!=null&&setValueByPath(e,["raiMediaFilteredCount"],s);const r=getValueByPath(n,["raiMediaFilteredReasons"]);return r!=null&&setValueByPath(e,["raiMediaFilteredReasons"],r),e}function generateVideosSourceToMldev(n,e){const i={},s=getValueByPath(n,["prompt"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","prompt"],s);const r=getValueByPath(n,["image"]);e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","image"],imageToMldev(r));const a=getValueByPath(n,["video"]);return e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","video"],videoToMldev(a)),i}function generateVideosSourceToVertex(n,e){const i={},s=getValueByPath(n,["prompt"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","prompt"],s);const r=getValueByPath(n,["image"]);e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","image"],imageToVertex(r));const a=getValueByPath(n,["video"]);return e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","video"],videoToVertex(a)),i}function generatedImageFromMldev(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["image"],imageFromMldev(i));const s=getValueByPath(n,["raiFilteredReason"]);s!=null&&setValueByPath(e,["raiFilteredReason"],s);const r=getValueByPath(n,["_self"]);return r!=null&&setValueByPath(e,["safetyAttributes"],safetyAttributesFromMldev(r)),e}function generatedImageFromVertex(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["image"],imageFromVertex(i));const s=getValueByPath(n,["raiFilteredReason"]);s!=null&&setValueByPath(e,["raiFilteredReason"],s);const r=getValueByPath(n,["_self"]);r!=null&&setValueByPath(e,["safetyAttributes"],safetyAttributesFromVertex(r));const a=getValueByPath(n,["prompt"]);return a!=null&&setValueByPath(e,["enhancedPrompt"],a),e}function generatedImageMaskFromVertex(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["mask"],imageFromVertex(i));const s=getValueByPath(n,["labels"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>a)),setValueByPath(e,["labels"],r)}return e}function generatedVideoFromMldev(n){const e={},i=getValueByPath(n,["video"]);return i!=null&&setValueByPath(e,["video"],videoFromMldev(i)),e}function generatedVideoFromVertex(n){const e={},i=getValueByPath(n,["_self"]);return i!=null&&setValueByPath(e,["video"],videoFromVertex(i)),e}function generationConfigToVertex(n){const e={},i=getValueByPath(n,["modelSelectionConfig"]);i!=null&&setValueByPath(e,["modelConfig"],i);const s=getValueByPath(n,["responseJsonSchema"]);s!=null&&setValueByPath(e,["responseJsonSchema"],s);const r=getValueByPath(n,["audioTimestamp"]);r!=null&&setValueByPath(e,["audioTimestamp"],r);const a=getValueByPath(n,["candidateCount"]);a!=null&&setValueByPath(e,["candidateCount"],a);const o=getValueByPath(n,["enableAffectiveDialog"]);o!=null&&setValueByPath(e,["enableAffectiveDialog"],o);const l=getValueByPath(n,["frequencyPenalty"]);l!=null&&setValueByPath(e,["frequencyPenalty"],l);const u=getValueByPath(n,["logprobs"]);u!=null&&setValueByPath(e,["logprobs"],u);const c=getValueByPath(n,["maxOutputTokens"]);c!=null&&setValueByPath(e,["maxOutputTokens"],c);const f=getValueByPath(n,["mediaResolution"]);f!=null&&setValueByPath(e,["mediaResolution"],f);const p=getValueByPath(n,["presencePenalty"]);p!=null&&setValueByPath(e,["presencePenalty"],p);const d=getValueByPath(n,["responseLogprobs"]);d!=null&&setValueByPath(e,["responseLogprobs"],d);const m=getValueByPath(n,["responseMimeType"]);m!=null&&setValueByPath(e,["responseMimeType"],m);const P=getValueByPath(n,["responseModalities"]);P!=null&&setValueByPath(e,["responseModalities"],P);const T=getValueByPath(n,["responseSchema"]);T!=null&&setValueByPath(e,["responseSchema"],T);const x=getValueByPath(n,["routingConfig"]);x!=null&&setValueByPath(e,["routingConfig"],x);const y=getValueByPath(n,["seed"]);y!=null&&setValueByPath(e,["seed"],y);const C=getValueByPath(n,["speechConfig"]);C!=null&&setValueByPath(e,["speechConfig"],speechConfigToVertex(C));const g=getValueByPath(n,["stopSequences"]);g!=null&&setValueByPath(e,["stopSequences"],g);const S=getValueByPath(n,["temperature"]);S!=null&&setValueByPath(e,["temperature"],S);const E=getValueByPath(n,["thinkingConfig"]);E!=null&&setValueByPath(e,["thinkingConfig"],E);const A=getValueByPath(n,["topK"]);A!=null&&setValueByPath(e,["topK"],A);const M=getValueByPath(n,["topP"]);if(M!=null&&setValueByPath(e,["topP"],M),getValueByPath(n,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}function getModelParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);return s!=null&&setValueByPath(i,["_url","name"],tModel(n,s)),i}function getModelParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);return s!=null&&setValueByPath(i,["_url","name"],tModel(n,s)),i}function googleMapsToMldev$1(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$1(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function imageConfigToMldev(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const s=getValueByPath(n,["imageSize"]);if(s!=null&&setValueByPath(e,["imageSize"],s),getValueByPath(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function imageConfigToVertex(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const s=getValueByPath(n,["imageSize"]);s!=null&&setValueByPath(e,["imageSize"],s);const r=getValueByPath(n,["outputMimeType"]);r!=null&&setValueByPath(e,["imageOutputOptions","mimeType"],r);const a=getValueByPath(n,["outputCompressionQuality"]);return a!=null&&setValueByPath(e,["imageOutputOptions","compressionQuality"],a),e}function imageFromMldev(n){const e={},i=getValueByPath(n,["bytesBase64Encoded"]);i!=null&&setValueByPath(e,["imageBytes"],tBytes(i));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function imageFromVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const s=getValueByPath(n,["bytesBase64Encoded"]);s!=null&&setValueByPath(e,["imageBytes"],tBytes(s));const r=getValueByPath(n,["mimeType"]);return r!=null&&setValueByPath(e,["mimeType"],r),e}function imageToMldev(n){const e={};if(getValueByPath(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const i=getValueByPath(n,["imageBytes"]);i!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(i));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function imageToVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const s=getValueByPath(n,["imageBytes"]);s!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(s));const r=getValueByPath(n,["mimeType"]);return r!=null&&setValueByPath(e,["mimeType"],r),e}function listModelsConfigToMldev(n,e,i){const s={},r=getValueByPath(e,["pageSize"]);i!==void 0&&r!=null&&setValueByPath(i,["_query","pageSize"],r);const a=getValueByPath(e,["pageToken"]);i!==void 0&&a!=null&&setValueByPath(i,["_query","pageToken"],a);const o=getValueByPath(e,["filter"]);i!==void 0&&o!=null&&setValueByPath(i,["_query","filter"],o);const l=getValueByPath(e,["queryBase"]);return i!==void 0&&l!=null&&setValueByPath(i,["_url","models_url"],tModelsUrl(n,l)),s}function listModelsConfigToVertex(n,e,i){const s={},r=getValueByPath(e,["pageSize"]);i!==void 0&&r!=null&&setValueByPath(i,["_query","pageSize"],r);const a=getValueByPath(e,["pageToken"]);i!==void 0&&a!=null&&setValueByPath(i,["_query","pageToken"],a);const o=getValueByPath(e,["filter"]);i!==void 0&&o!=null&&setValueByPath(i,["_query","filter"],o);const l=getValueByPath(e,["queryBase"]);return i!==void 0&&l!=null&&setValueByPath(i,["_url","models_url"],tModelsUrl(n,l)),s}function listModelsParametersToMldev(n,e){const i={},s=getValueByPath(e,["config"]);return s!=null&&listModelsConfigToMldev(n,s,i),i}function listModelsParametersToVertex(n,e){const i={},s=getValueByPath(e,["config"]);return s!=null&&listModelsConfigToVertex(n,s,i),i}function listModelsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["_self"]);if(r!=null){let a=tExtractModels(r);Array.isArray(a)&&(a=a.map(o=>modelFromMldev(o))),setValueByPath(e,["models"],a)}return e}function listModelsResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["_self"]);if(r!=null){let a=tExtractModels(r);Array.isArray(a)&&(a=a.map(o=>modelFromVertex(o))),setValueByPath(e,["models"],a)}return e}function maskReferenceConfigToVertex(n){const e={},i=getValueByPath(n,["maskMode"]);i!=null&&setValueByPath(e,["maskMode"],i);const s=getValueByPath(n,["segmentationClasses"]);s!=null&&setValueByPath(e,["maskClasses"],s);const r=getValueByPath(n,["maskDilation"]);return r!=null&&setValueByPath(e,["dilation"],r),e}function modelFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["displayName"]);s!=null&&setValueByPath(e,["displayName"],s);const r=getValueByPath(n,["description"]);r!=null&&setValueByPath(e,["description"],r);const a=getValueByPath(n,["version"]);a!=null&&setValueByPath(e,["version"],a);const o=getValueByPath(n,["_self"]);o!=null&&setValueByPath(e,["tunedModelInfo"],tunedModelInfoFromMldev(o));const l=getValueByPath(n,["inputTokenLimit"]);l!=null&&setValueByPath(e,["inputTokenLimit"],l);const u=getValueByPath(n,["outputTokenLimit"]);u!=null&&setValueByPath(e,["outputTokenLimit"],u);const c=getValueByPath(n,["supportedGenerationMethods"]);c!=null&&setValueByPath(e,["supportedActions"],c);const f=getValueByPath(n,["temperature"]);f!=null&&setValueByPath(e,["temperature"],f);const p=getValueByPath(n,["maxTemperature"]);p!=null&&setValueByPath(e,["maxTemperature"],p);const d=getValueByPath(n,["topP"]);d!=null&&setValueByPath(e,["topP"],d);const m=getValueByPath(n,["topK"]);m!=null&&setValueByPath(e,["topK"],m);const P=getValueByPath(n,["thinking"]);return P!=null&&setValueByPath(e,["thinking"],P),e}function modelFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["displayName"]);s!=null&&setValueByPath(e,["displayName"],s);const r=getValueByPath(n,["description"]);r!=null&&setValueByPath(e,["description"],r);const a=getValueByPath(n,["versionId"]);a!=null&&setValueByPath(e,["version"],a);const o=getValueByPath(n,["deployedModels"]);if(o!=null){let p=o;Array.isArray(p)&&(p=p.map(d=>endpointFromVertex(d))),setValueByPath(e,["endpoints"],p)}const l=getValueByPath(n,["labels"]);l!=null&&setValueByPath(e,["labels"],l);const u=getValueByPath(n,["_self"]);u!=null&&setValueByPath(e,["tunedModelInfo"],tunedModelInfoFromVertex(u));const c=getValueByPath(n,["defaultCheckpointId"]);c!=null&&setValueByPath(e,["defaultCheckpointId"],c);const f=getValueByPath(n,["checkpoints"]);if(f!=null){let p=f;Array.isArray(p)&&(p=p.map(d=>d)),setValueByPath(e,["checkpoints"],p)}return e}function partToMldev$1(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const s=getValueByPath(n,["codeExecutionResult"]);s!=null&&setValueByPath(e,["codeExecutionResult"],s);const r=getValueByPath(n,["executableCode"]);r!=null&&setValueByPath(e,["executableCode"],r);const a=getValueByPath(n,["fileData"]);a!=null&&setValueByPath(e,["fileData"],fileDataToMldev$1(a));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$1(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$1(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const f=getValueByPath(n,["thought"]);f!=null&&setValueByPath(e,["thought"],f);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const d=getValueByPath(n,["videoMetadata"]);return d!=null&&setValueByPath(e,["videoMetadata"],d),e}function productImageToVertex(n){const e={},i=getValueByPath(n,["productImage"]);return i!=null&&setValueByPath(e,["image"],imageToVertex(i)),e}function recontextImageConfigToVertex(n,e){const i={},s=getValueByPath(n,["numberOfImages"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","sampleCount"],s);const r=getValueByPath(n,["baseSteps"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","baseSteps"],r);const a=getValueByPath(n,["outputGcsUri"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","storageUri"],a);const o=getValueByPath(n,["seed"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","seed"],o);const l=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","safetySetting"],l);const u=getValueByPath(n,["personGeneration"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","personGeneration"],u);const c=getValueByPath(n,["addWatermark"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","addWatermark"],c);const f=getValueByPath(n,["outputMimeType"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],f);const p=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],p);const d=getValueByPath(n,["enhancePrompt"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","enhancePrompt"],d);const m=getValueByPath(n,["labels"]);return e!==void 0&&m!=null&&setValueByPath(e,["labels"],m),i}function recontextImageParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["source"]);r!=null&&recontextImageSourceToVertex(r,i);const a=getValueByPath(e,["config"]);return a!=null&&recontextImageConfigToVertex(a,i),i}function recontextImageResponseFromVertex(n){const e={},i=getValueByPath(n,["predictions"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>generatedImageFromVertex(r))),setValueByPath(e,["generatedImages"],s)}return e}function recontextImageSourceToVertex(n,e){const i={},s=getValueByPath(n,["prompt"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","prompt"],s);const r=getValueByPath(n,["personImage"]);e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","personImage","image"],imageToVertex(r));const a=getValueByPath(n,["productImages"]);if(e!==void 0&&a!=null){let o=a;Array.isArray(o)&&(o=o.map(l=>productImageToVertex(l))),setValueByPath(e,["instances[0]","productImages"],o)}return i}function referenceImageAPIInternalToVertex(n){const e={},i=getValueByPath(n,["referenceImage"]);i!=null&&setValueByPath(e,["referenceImage"],imageToVertex(i));const s=getValueByPath(n,["referenceId"]);s!=null&&setValueByPath(e,["referenceId"],s);const r=getValueByPath(n,["referenceType"]);r!=null&&setValueByPath(e,["referenceType"],r);const a=getValueByPath(n,["maskImageConfig"]);a!=null&&setValueByPath(e,["maskImageConfig"],maskReferenceConfigToVertex(a));const o=getValueByPath(n,["controlImageConfig"]);o!=null&&setValueByPath(e,["controlImageConfig"],controlReferenceConfigToVertex(o));const l=getValueByPath(n,["styleImageConfig"]);l!=null&&setValueByPath(e,["styleImageConfig"],l);const u=getValueByPath(n,["subjectImageConfig"]);return u!=null&&setValueByPath(e,["subjectImageConfig"],u),e}function safetyAttributesFromMldev(n){const e={},i=getValueByPath(n,["safetyAttributes","categories"]);i!=null&&setValueByPath(e,["categories"],i);const s=getValueByPath(n,["safetyAttributes","scores"]);s!=null&&setValueByPath(e,["scores"],s);const r=getValueByPath(n,["contentType"]);return r!=null&&setValueByPath(e,["contentType"],r),e}function safetyAttributesFromVertex(n){const e={},i=getValueByPath(n,["safetyAttributes","categories"]);i!=null&&setValueByPath(e,["categories"],i);const s=getValueByPath(n,["safetyAttributes","scores"]);s!=null&&setValueByPath(e,["scores"],s);const r=getValueByPath(n,["contentType"]);return r!=null&&setValueByPath(e,["contentType"],r),e}function safetySettingToMldev(n){const e={},i=getValueByPath(n,["category"]);if(i!=null&&setValueByPath(e,["category"],i),getValueByPath(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const s=getValueByPath(n,["threshold"]);return s!=null&&setValueByPath(e,["threshold"],s),e}function scribbleImageToVertex(n){const e={},i=getValueByPath(n,["image"]);return i!=null&&setValueByPath(e,["image"],imageToVertex(i)),e}function segmentImageConfigToVertex(n,e){const i={},s=getValueByPath(n,["mode"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","mode"],s);const r=getValueByPath(n,["maxPredictions"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","maxPredictions"],r);const a=getValueByPath(n,["confidenceThreshold"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","confidenceThreshold"],a);const o=getValueByPath(n,["maskDilation"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","maskDilation"],o);const l=getValueByPath(n,["binaryColorThreshold"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","binaryColorThreshold"],l);const u=getValueByPath(n,["labels"]);return e!==void 0&&u!=null&&setValueByPath(e,["labels"],u),i}function segmentImageParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["source"]);r!=null&&segmentImageSourceToVertex(r,i);const a=getValueByPath(e,["config"]);return a!=null&&segmentImageConfigToVertex(a,i),i}function segmentImageResponseFromVertex(n){const e={},i=getValueByPath(n,["predictions"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>generatedImageMaskFromVertex(r))),setValueByPath(e,["generatedMasks"],s)}return e}function segmentImageSourceToVertex(n,e){const i={},s=getValueByPath(n,["prompt"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","prompt"],s);const r=getValueByPath(n,["image"]);e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","image"],imageToVertex(r));const a=getValueByPath(n,["scribbleImage"]);return e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","scribble"],scribbleImageToVertex(a)),i}function speechConfigToVertex(n){const e={},i=getValueByPath(n,["languageCode"]);i!=null&&setValueByPath(e,["languageCode"],i);const s=getValueByPath(n,["voiceConfig"]);if(s!=null&&setValueByPath(e,["voiceConfig"],s),getValueByPath(n,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");return e}function toolConfigToMldev(n){const e={},i=getValueByPath(n,["functionCallingConfig"]);i!=null&&setValueByPath(e,["functionCallingConfig"],functionCallingConfigToMldev(i));const s=getValueByPath(n,["retrievalConfig"]);return s!=null&&setValueByPath(e,["retrievalConfig"],s),e}function toolToMldev$1(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let f=i;Array.isArray(f)&&(f=f.map(p=>p)),setValueByPath(e,["functionDeclarations"],f)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const s=getValueByPath(n,["googleSearchRetrieval"]);s!=null&&setValueByPath(e,["googleSearchRetrieval"],s);const r=getValueByPath(n,["computerUse"]);r!=null&&setValueByPath(e,["computerUse"],r);const a=getValueByPath(n,["fileSearch"]);a!=null&&setValueByPath(e,["fileSearch"],a);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$1(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$1(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}function toolToVertex(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let p=i;Array.isArray(p)&&(p=p.map(d=>functionDeclarationToVertex(d))),setValueByPath(e,["functionDeclarations"],p)}const s=getValueByPath(n,["retrieval"]);s!=null&&setValueByPath(e,["retrieval"],s);const r=getValueByPath(n,["googleSearchRetrieval"]);r!=null&&setValueByPath(e,["googleSearchRetrieval"],r);const a=getValueByPath(n,["computerUse"]);if(a!=null&&setValueByPath(e,["computerUse"],a),getValueByPath(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=getValueByPath(n,["codeExecution"]);o!=null&&setValueByPath(e,["codeExecution"],o);const l=getValueByPath(n,["enterpriseWebSearch"]);l!=null&&setValueByPath(e,["enterpriseWebSearch"],l);const u=getValueByPath(n,["googleMaps"]);u!=null&&setValueByPath(e,["googleMaps"],u);const c=getValueByPath(n,["googleSearch"]);c!=null&&setValueByPath(e,["googleSearch"],c);const f=getValueByPath(n,["urlContext"]);return f!=null&&setValueByPath(e,["urlContext"],f),e}function tunedModelInfoFromMldev(n){const e={},i=getValueByPath(n,["baseModel"]);i!=null&&setValueByPath(e,["baseModel"],i);const s=getValueByPath(n,["createTime"]);s!=null&&setValueByPath(e,["createTime"],s);const r=getValueByPath(n,["updateTime"]);return r!=null&&setValueByPath(e,["updateTime"],r),e}function tunedModelInfoFromVertex(n){const e={},i=getValueByPath(n,["labels","google-vertex-llm-tuning-base-model-id"]);i!=null&&setValueByPath(e,["baseModel"],i);const s=getValueByPath(n,["createTime"]);s!=null&&setValueByPath(e,["createTime"],s);const r=getValueByPath(n,["updateTime"]);return r!=null&&setValueByPath(e,["updateTime"],r),e}function updateModelConfigToMldev(n,e){const i={},s=getValueByPath(n,["displayName"]);e!==void 0&&s!=null&&setValueByPath(e,["displayName"],s);const r=getValueByPath(n,["description"]);e!==void 0&&r!=null&&setValueByPath(e,["description"],r);const a=getValueByPath(n,["defaultCheckpointId"]);return e!==void 0&&a!=null&&setValueByPath(e,["defaultCheckpointId"],a),i}function updateModelConfigToVertex(n,e){const i={},s=getValueByPath(n,["displayName"]);e!==void 0&&s!=null&&setValueByPath(e,["displayName"],s);const r=getValueByPath(n,["description"]);e!==void 0&&r!=null&&setValueByPath(e,["description"],r);const a=getValueByPath(n,["defaultCheckpointId"]);return e!==void 0&&a!=null&&setValueByPath(e,["defaultCheckpointId"],a),i}function updateModelParametersToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","name"],tModel(n,s));const r=getValueByPath(e,["config"]);return r!=null&&updateModelConfigToMldev(r,i),i}function updateModelParametersToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["config"]);return r!=null&&updateModelConfigToVertex(r,i),i}function upscaleImageAPIConfigInternalToVertex(n,e){const i={},s=getValueByPath(n,["outputGcsUri"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","storageUri"],s);const r=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","safetySetting"],r);const a=getValueByPath(n,["personGeneration"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","personGeneration"],a);const o=getValueByPath(n,["includeRaiReason"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","includeRaiReason"],o);const l=getValueByPath(n,["outputMimeType"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],l);const u=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],u);const c=getValueByPath(n,["enhanceInputImage"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","upscaleConfig","enhanceInputImage"],c);const f=getValueByPath(n,["imagePreservationFactor"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","upscaleConfig","imagePreservationFactor"],f);const p=getValueByPath(n,["labels"]);e!==void 0&&p!=null&&setValueByPath(e,["labels"],p);const d=getValueByPath(n,["numberOfImages"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","sampleCount"],d);const m=getValueByPath(n,["mode"]);return e!==void 0&&m!=null&&setValueByPath(e,["parameters","mode"],m),i}function upscaleImageAPIParametersInternalToVertex(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["_url","model"],tModel(n,s));const r=getValueByPath(e,["image"]);r!=null&&setValueByPath(i,["instances[0]","image"],imageToVertex(r));const a=getValueByPath(e,["upscaleFactor"]);a!=null&&setValueByPath(i,["parameters","upscaleConfig","upscaleFactor"],a);const o=getValueByPath(e,["config"]);return o!=null&&upscaleImageAPIConfigInternalToVertex(o,i),i}function upscaleImageResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["predictions"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>generatedImageFromVertex(a))),setValueByPath(e,["generatedImages"],r)}return e}function videoFromMldev(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["uri"],i);const s=getValueByPath(n,["encodedVideo"]);s!=null&&setValueByPath(e,["videoBytes"],tBytes(s));const r=getValueByPath(n,["encoding"]);return r!=null&&setValueByPath(e,["mimeType"],r),e}function videoFromVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["uri"],i);const s=getValueByPath(n,["bytesBase64Encoded"]);s!=null&&setValueByPath(e,["videoBytes"],tBytes(s));const r=getValueByPath(n,["mimeType"]);return r!=null&&setValueByPath(e,["mimeType"],r),e}function videoGenerationMaskToVertex(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["_self"],imageToVertex(i));const s=getValueByPath(n,["maskMode"]);return s!=null&&setValueByPath(e,["maskMode"],s),e}function videoGenerationReferenceImageToMldev(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["image"],imageToMldev(i));const s=getValueByPath(n,["referenceType"]);return s!=null&&setValueByPath(e,["referenceType"],s),e}function videoGenerationReferenceImageToVertex(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["image"],imageToVertex(i));const s=getValueByPath(n,["referenceType"]);return s!=null&&setValueByPath(e,["referenceType"],s),e}function videoToMldev(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["uri"],i);const s=getValueByPath(n,["videoBytes"]);s!=null&&setValueByPath(e,["encodedVideo"],tBytes(s));const r=getValueByPath(n,["mimeType"]);return r!=null&&setValueByPath(e,["encoding"],r),e}function videoToVertex(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const s=getValueByPath(n,["videoBytes"]);s!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(s));const r=getValueByPath(n,["mimeType"]);return r!=null&&setValueByPath(e,["mimeType"],r),e}/**
240
+ * @license
241
+ * Copyright 2025 Google LLC
242
+ * SPDX-License-Identifier: Apache-2.0
243
+ */function createFileSearchStoreConfigToMldev(n,e){const i={},s=getValueByPath(n,["displayName"]);return e!==void 0&&s!=null&&setValueByPath(e,["displayName"],s),i}function createFileSearchStoreParametersToMldev(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&createFileSearchStoreConfigToMldev(i,e),e}function deleteFileSearchStoreConfigToMldev(n,e){const i={},s=getValueByPath(n,["force"]);return e!==void 0&&s!=null&&setValueByPath(e,["_query","force"],s),i}function deleteFileSearchStoreParametersToMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["_url","name"],i);const s=getValueByPath(n,["config"]);return s!=null&&deleteFileSearchStoreConfigToMldev(s,e),e}function getFileSearchStoreParametersToMldev(n){const e={},i=getValueByPath(n,["name"]);return i!=null&&setValueByPath(e,["_url","name"],i),e}function importFileConfigToMldev(n,e){const i={},s=getValueByPath(n,["customMetadata"]);if(e!==void 0&&s!=null){let a=s;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["customMetadata"],a)}const r=getValueByPath(n,["chunkingConfig"]);return e!==void 0&&r!=null&&setValueByPath(e,["chunkingConfig"],r),i}function importFileOperationFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const s=getValueByPath(n,["metadata"]);s!=null&&setValueByPath(e,["metadata"],s);const r=getValueByPath(n,["done"]);r!=null&&setValueByPath(e,["done"],r);const a=getValueByPath(n,["error"]);a!=null&&setValueByPath(e,["error"],a);const o=getValueByPath(n,["response"]);return o!=null&&setValueByPath(e,["response"],importFileResponseFromMldev(o)),e}function importFileParametersToMldev(n){const e={},i=getValueByPath(n,["fileSearchStoreName"]);i!=null&&setValueByPath(e,["_url","file_search_store_name"],i);const s=getValueByPath(n,["fileName"]);s!=null&&setValueByPath(e,["fileName"],s);const r=getValueByPath(n,["config"]);return r!=null&&importFileConfigToMldev(r,e),e}function importFileResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["parent"]);s!=null&&setValueByPath(e,["parent"],s);const r=getValueByPath(n,["documentName"]);return r!=null&&setValueByPath(e,["documentName"],r),e}function listFileSearchStoresConfigToMldev(n,e){const i={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);return e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r),i}function listFileSearchStoresParametersToMldev(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listFileSearchStoresConfigToMldev(i,e),e}function listFileSearchStoresResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["fileSearchStores"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["fileSearchStores"],a)}return e}function uploadToFileSearchStoreConfigToMldev(n,e){const i={},s=getValueByPath(n,["mimeType"]);e!==void 0&&s!=null&&setValueByPath(e,["mimeType"],s);const r=getValueByPath(n,["displayName"]);e!==void 0&&r!=null&&setValueByPath(e,["displayName"],r);const a=getValueByPath(n,["customMetadata"]);if(e!==void 0&&a!=null){let l=a;Array.isArray(l)&&(l=l.map(u=>u)),setValueByPath(e,["customMetadata"],l)}const o=getValueByPath(n,["chunkingConfig"]);return e!==void 0&&o!=null&&setValueByPath(e,["chunkingConfig"],o),i}function uploadToFileSearchStoreParametersToMldev(n){const e={},i=getValueByPath(n,["fileSearchStoreName"]);i!=null&&setValueByPath(e,["_url","file_search_store_name"],i);const s=getValueByPath(n,["config"]);return s!=null&&uploadToFileSearchStoreConfigToMldev(s,e),e}function uploadToFileSearchStoreResumableResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}/**
244
+ * @license
245
+ * Copyright 2025 Google LLC
246
+ * SPDX-License-Identifier: Apache-2.0
247
+ */const CONTENT_TYPE_HEADER="Content-Type",SERVER_TIMEOUT_HEADER="X-Server-Timeout",USER_AGENT_HEADER="User-Agent",GOOGLE_API_CLIENT_HEADER="x-goog-api-client",SDK_VERSION="1.31.0",LIBRARY_LABEL=`google-genai-sdk/${SDK_VERSION}`,VERTEX_AI_API_DEFAULT_VERSION="v1beta1",GOOGLE_AI_API_DEFAULT_VERSION="v1beta",responseLineRE=/^\s*data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;class ApiClient{constructor(e){var i,s;this.clientOptions=Object.assign(Object.assign({},e),{project:e.project,location:e.location,apiKey:e.apiKey,vertexai:e.vertexai});const r={};this.clientOptions.vertexai?(r.apiVersion=(i=this.clientOptions.apiVersion)!==null&&i!==void 0?i:VERTEX_AI_API_DEFAULT_VERSION,r.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(r.apiVersion=(s=this.clientOptions.apiVersion)!==null&&s!==void 0?s:GOOGLE_AI_API_DEFAULT_VERSION,r.baseUrl="https://generativelanguage.googleapis.com/"),r.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=r,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(r,e.httpOptions))}baseUrlFromProjectLocation(){return this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location!=="global"?`https://${this.clientOptions.location}-aiplatform.googleapis.com/`:"https://aiplatform.googleapis.com/"}normalizeAuthParameters(){if(this.clientOptions.project&&this.clientOptions.location){this.clientOptions.apiKey=void 0;return}this.clientOptions.project=void 0,this.clientOptions.location=void 0}isVertexAI(){var e;return(e=this.clientOptions.vertexai)!==null&&e!==void 0?e:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");const s=[e.baseUrl.endsWith("/")?e.baseUrl.slice(0,-1):e.baseUrl];return e.apiVersion&&e.apiVersion!==""&&s.push(e.apiVersion),s.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const e=this.getBaseUrl(),i=new URL(e);return i.protocol=i.protocol=="http:"?"ws":"wss",i.toString()}setBaseUrl(e){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=e;else throw new Error("HTTP options are not correctly set.")}constructUrl(e,i,s){const r=[this.getRequestUrlInternal(i)];return s&&r.push(this.getBaseResourcePath()),e!==""&&r.push(e),new URL(`${r.join("/")}`)}shouldPrependVertexProjectPath(e){return!(this.clientOptions.apiKey||!this.clientOptions.vertexai||e.path.startsWith("projects/")||e.httpMethod==="GET"&&e.path.startsWith("publishers/google/models"))}async request(e){let i=this.clientOptions.httpOptions;e.httpOptions&&(i=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));const s=this.shouldPrependVertexProjectPath(e),r=this.constructUrl(e.path,i,s);if(e.queryParams)for(const[o,l]of Object.entries(e.queryParams))r.searchParams.append(o,String(l));let a={};if(e.httpMethod==="GET"){if(e.body&&e.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else a.body=e.body;return a=await this.includeExtraHttpOptionsToRequestInit(a,i,r.toString(),e.abortSignal),this.unaryApiCall(r,a,e.httpMethod)}patchHttpOptions(e,i){const s=JSON.parse(JSON.stringify(e));for(const[r,a]of Object.entries(i))typeof a=="object"?s[r]=Object.assign(Object.assign({},s[r]),a):a!==void 0&&(s[r]=a);return s}async requestStream(e){let i=this.clientOptions.httpOptions;e.httpOptions&&(i=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));const s=this.shouldPrependVertexProjectPath(e),r=this.constructUrl(e.path,i,s);(!r.searchParams.has("alt")||r.searchParams.get("alt")!=="sse")&&r.searchParams.set("alt","sse");let a={};return a.body=e.body,a=await this.includeExtraHttpOptionsToRequestInit(a,i,r.toString(),e.abortSignal),this.streamApiCall(r,a,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,i,s,r){if(i&&i.timeout||r){const a=new AbortController,o=a.signal;if(i.timeout&&(i==null?void 0:i.timeout)>0){const l=setTimeout(()=>a.abort(),i.timeout);l&&typeof l.unref=="function"&&l.unref()}r&&r.addEventListener("abort",()=>{a.abort()}),e.signal=o}return i&&i.extraBody!==null&&includeExtraBodyToRequestInit(e,i.extraBody),e.headers=await this.getHeadersInternal(i,s),e}async unaryApiCall(e,i,s){return this.apiCall(e.toString(),Object.assign(Object.assign({},i),{method:s})).then(async r=>(await throwErrorIfNotOK(r),new HttpResponse(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}async streamApiCall(e,i,s){return this.apiCall(e.toString(),Object.assign(Object.assign({},i),{method:s})).then(async r=>(await throwErrorIfNotOK(r),this.processStreamResponse(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}processStreamResponse(e){var i;return __asyncGenerator(this,arguments,function*(){const r=(i=e==null?void 0:e.body)===null||i===void 0?void 0:i.getReader(),a=new TextDecoder("utf-8");if(!r)throw new Error("Response body is empty");try{let o="";for(;;){const{done:l,value:u}=yield __await(r.read());if(l){if(o.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const c=a.decode(u,{stream:!0});try{const p=JSON.parse(c);if("error"in p){const d=JSON.parse(JSON.stringify(p.error)),m=d.status,P=d.code,T=`got status: ${m}. ${JSON.stringify(p)}`;if(P>=400&&P<600)throw new ApiError({message:T,status:P})}}catch(p){if(p.name==="ApiError")throw p}o+=c;let f=o.match(responseLineRE);for(;f;){const p=f[1];try{const d=new Response(p,{headers:e==null?void 0:e.headers,status:e==null?void 0:e.status,statusText:e==null?void 0:e.statusText});yield yield __await(new HttpResponse(d)),o=o.slice(f[0].length),f=o.match(responseLineRE)}catch(d){throw new Error(`exception parsing stream chunk ${p}. ${d}`)}}}}finally{r.releaseLock()}})}async apiCall(e,i){return fetch(e,i).catch(s=>{throw new Error(`exception ${s} sending request`)})}getDefaultHeaders(){const e={},i=LIBRARY_LABEL+" "+this.clientOptions.userAgentExtra;return e[USER_AGENT_HEADER]=i,e[GOOGLE_API_CLIENT_HEADER]=i,e[CONTENT_TYPE_HEADER]="application/json",e}async getHeadersInternal(e,i){const s=new Headers;if(e&&e.headers){for(const[r,a]of Object.entries(e.headers))s.append(r,a);e.timeout&&e.timeout>0&&s.append(SERVER_TIMEOUT_HEADER,String(Math.ceil(e.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(s,i),s}getFileName(e){var i;let s="";return typeof e=="string"&&(s=e.replace(/[/\\]+$/,""),s=(i=s.split(/[/\\]/).pop())!==null&&i!==void 0?i:""),s}async uploadFile(e,i){var s;const r={};i!=null&&(r.mimeType=i.mimeType,r.name=i.name,r.displayName=i.displayName),r.name&&!r.name.startsWith("files/")&&(r.name=`files/${r.name}`);const a=this.clientOptions.uploader,o=await a.stat(e);r.sizeBytes=String(o.size);const l=(s=i==null?void 0:i.mimeType)!==null&&s!==void 0?s:o.type;if(l===void 0||l==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");r.mimeType=l;const u={file:r},c=this.getFileName(e),f=formatMap("upload/v1beta/files",u._url),p=await this.fetchUploadUrl(f,r.sizeBytes,r.mimeType,c,u,i==null?void 0:i.httpOptions);return a.upload(e,p,this)}async uploadFileToFileSearchStore(e,i,s){var r;const a=this.clientOptions.uploader,o=await a.stat(i),l=String(o.size),u=(r=s==null?void 0:s.mimeType)!==null&&r!==void 0?r:o.type;if(u===void 0||u==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const c=`upload/v1beta/${e}:uploadToFileSearchStore`,f=this.getFileName(i),p={};s!=null&&uploadToFileSearchStoreConfigToMldev(s,p);const d=await this.fetchUploadUrl(c,l,u,f,p,s==null?void 0:s.httpOptions);return a.uploadToFileSearchStore(i,d,this)}async downloadFile(e){await this.clientOptions.downloader.download(e,this)}async fetchUploadUrl(e,i,s,r,a,o){var l;let u={};o?u=o:u={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${i}`,"X-Goog-Upload-Header-Content-Type":`${s}`},r?{"X-Goog-Upload-File-Name":r}:{})};const c=await this.request({path:e,body:JSON.stringify(a),httpMethod:"POST",httpOptions:u});if(!c||!(c!=null&&c.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const f=(l=c==null?void 0:c.headers)===null||l===void 0?void 0:l["x-goog-upload-url"];if(f===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return f}}async function throwErrorIfNotOK(n){var e;if(n===void 0)throw new Error("response is undefined");if(!n.ok){const i=n.status;let s;!((e=n.headers.get("content-type"))===null||e===void 0)&&e.includes("application/json")?s=await n.json():s={error:{message:await n.text(),code:n.status,status:n.statusText}};const r=JSON.stringify(s);throw i>=400&&i<600?new ApiError({message:r,status:i}):new Error(r)}}function includeExtraBodyToRequestInit(n,e){if(!e||Object.keys(e).length===0)return;if(n.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let i={};if(typeof n.body=="string"&&n.body.length>0)try{const a=JSON.parse(n.body);if(typeof a=="object"&&a!==null&&!Array.isArray(a))i=a;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function s(a,o){const l=Object.assign({},a);for(const u in o)if(Object.prototype.hasOwnProperty.call(o,u)){const c=o[u],f=l[u];c&&typeof c=="object"&&!Array.isArray(c)&&f&&typeof f=="object"&&!Array.isArray(f)?l[u]=s(f,c):(f&&c&&typeof f!=typeof c&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${u}". Original type: ${typeof f}, New type: ${typeof c}. Overwriting.`),l[u]=c)}return l}const r=s(i,e);n.body=JSON.stringify(r)}/**
248
+ * @license
249
+ * Copyright 2025 Google LLC
250
+ * SPDX-License-Identifier: Apache-2.0
251
+ */const MCP_LABEL="mcp_used/unknown";let hasMcpToolUsageFromMcpToTool=!1;function hasMcpToolUsage(n){for(const e of n)if(isMcpCallableTool(e)||typeof e=="object"&&"inputSchema"in e)return!0;return hasMcpToolUsageFromMcpToTool}function setMcpUsageHeader(n){var e;const i=(e=n[GOOGLE_API_CLIENT_HEADER])!==null&&e!==void 0?e:"";n[GOOGLE_API_CLIENT_HEADER]=(i+` ${MCP_LABEL}`).trimStart()}function isMcpCallableTool(n){return n!==null&&typeof n=="object"&&n instanceof McpCallableTool}function listAllTools(n,e=100){return __asyncGenerator(this,arguments,function*(){let s,r=0;for(;r<e;){const a=yield __await(n.listTools({cursor:s}));for(const o of a.tools)yield yield __await(o),r++;if(!a.nextCursor)break;s=a.nextCursor}})}class McpCallableTool{constructor(e=[],i){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=e,this.config=i}static create(e,i){return new McpCallableTool(e,i)}async initialize(){var e,i,s,r;if(this.mcpTools.length>0)return;const a={},o=[];for(const f of this.mcpClients)try{for(var l=!0,u=(i=void 0,__asyncValues(listAllTools(f))),c;c=await u.next(),e=c.done,!e;l=!0){r=c.value,l=!1;const p=r;o.push(p);const d=p.name;if(a[d])throw new Error(`Duplicate function name ${d} found in MCP tools. Please ensure function names are unique.`);a[d]=f}}catch(p){i={error:p}}finally{try{!l&&!e&&(s=u.return)&&await s.call(u)}finally{if(i)throw i.error}}this.mcpTools=o,this.functionNameToMcpClient=a}async tool(){return await this.initialize(),mcpToolsToGeminiTool(this.mcpTools,this.config)}async callTool(e){await this.initialize();const i=[];for(const s of e)if(s.name in this.functionNameToMcpClient){const r=this.functionNameToMcpClient[s.name];let a;this.config.timeout&&(a={timeout:this.config.timeout});const o=await r.callTool({name:s.name,arguments:s.args},void 0,a);i.push({functionResponse:{name:s.name,response:o.isError?{error:o}:o}})}return i}}/**
252
+ * @license
253
+ * Copyright 2025 Google LLC
254
+ * SPDX-License-Identifier: Apache-2.0
255
+ */async function handleWebSocketMessage$1(n,e,i){const s=new LiveMusicServerMessage;let r;i.data instanceof Blob?r=JSON.parse(await i.data.text()):r=JSON.parse(i.data),Object.assign(s,r),e(s)}class LiveMusic{constructor(e,i,s){this.apiClient=e,this.auth=i,this.webSocketFactory=s}async connect(e){var i,s;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");const r=this.apiClient.getWebsocketBaseUrl(),a=this.apiClient.getApiVersion(),o=mapToHeaders$1(this.apiClient.getDefaultHeaders()),l=this.apiClient.getApiKey(),u=`${r}/ws/google.ai.generativelanguage.${a}.GenerativeService.BidiGenerateMusic?key=${l}`;let c=()=>{};const f=new Promise(g=>{c=g}),p=e.callbacks,d=function(){c({})},m=this.apiClient,P={onopen:d,onmessage:g=>{handleWebSocketMessage$1(m,p.onmessage,g)},onerror:(i=p==null?void 0:p.onerror)!==null&&i!==void 0?i:function(g){},onclose:(s=p==null?void 0:p.onclose)!==null&&s!==void 0?s:function(g){}},T=this.webSocketFactory.create(u,headersToMap$1(o),P);T.connect(),await f;const C={setup:{model:tModel(this.apiClient,e.model)}};return T.send(JSON.stringify(C)),new LiveMusicSession(T,this.apiClient)}}class LiveMusicSession{constructor(e,i){this.conn=e,this.apiClient=i}async setWeightedPrompts(e){if(!e.weightedPrompts||Object.keys(e.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");const i=liveMusicSetWeightedPromptsParametersToMldev(e);this.conn.send(JSON.stringify({clientContent:i}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||(e.musicGenerationConfig={});const i=liveMusicSetConfigParametersToMldev(e);this.conn.send(JSON.stringify(i))}sendPlaybackControl(e){const i={playbackControl:e};this.conn.send(JSON.stringify(i))}play(){this.sendPlaybackControl(LiveMusicPlaybackControl.PLAY)}pause(){this.sendPlaybackControl(LiveMusicPlaybackControl.PAUSE)}stop(){this.sendPlaybackControl(LiveMusicPlaybackControl.STOP)}resetContext(){this.sendPlaybackControl(LiveMusicPlaybackControl.RESET_CONTEXT)}close(){this.conn.close()}}function headersToMap$1(n){const e={};return n.forEach((i,s)=>{e[s]=i}),e}function mapToHeaders$1(n){const e=new Headers;for(const[i,s]of Object.entries(n))e.append(i,s);return e}/**
256
+ * @license
257
+ * Copyright 2025 Google LLC
258
+ * SPDX-License-Identifier: Apache-2.0
259
+ */const FUNCTION_RESPONSE_REQUIRES_ID="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function handleWebSocketMessage(n,e,i){const s=new LiveServerMessage;let r;i.data instanceof Blob?r=await i.data.text():i.data instanceof ArrayBuffer?r=new TextDecoder().decode(i.data):r=i.data;const a=JSON.parse(r);if(n.isVertexAI()){const o=liveServerMessageFromVertex(a);Object.assign(s,o)}else Object.assign(s,a);e(s)}class Live{constructor(e,i,s){this.apiClient=e,this.auth=i,this.webSocketFactory=s,this.music=new LiveMusic(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var i,s,r,a,o,l;if(e.config&&e.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const u=this.apiClient.getWebsocketBaseUrl(),c=this.apiClient.getApiVersion();let f;const p=this.apiClient.getHeaders();e.config&&e.config.tools&&hasMcpToolUsage(e.config.tools)&&setMcpUsageHeader(p);const d=mapToHeaders(p);if(this.apiClient.isVertexAI())f=`${u}/ws/google.cloud.aiplatform.${c}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(d,f);else{const F=this.apiClient.getApiKey();let G="BidiGenerateContent",L="key";F!=null&&F.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),c!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),G="BidiGenerateContentConstrained",L="access_token"),f=`${u}/ws/google.ai.generativelanguage.${c}.GenerativeService.${G}?${L}=${F}`}let m=()=>{};const P=new Promise(F=>{m=F}),T=e.callbacks,x=function(){var F;(F=T==null?void 0:T.onopen)===null||F===void 0||F.call(T),m({})},y=this.apiClient,C={onopen:x,onmessage:F=>{handleWebSocketMessage(y,T.onmessage,F)},onerror:(i=T==null?void 0:T.onerror)!==null&&i!==void 0?i:function(F){},onclose:(s=T==null?void 0:T.onclose)!==null&&s!==void 0?s:function(F){}},g=this.webSocketFactory.create(f,headersToMap(d),C);g.connect(),await P;let S=tModel(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&S.startsWith("publishers/")){const F=this.apiClient.getProject(),G=this.apiClient.getLocation();S=`projects/${F}/locations/${G}/`+S}let E={};this.apiClient.isVertexAI()&&((r=e.config)===null||r===void 0?void 0:r.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[Modality.AUDIO]}:e.config.responseModalities=[Modality.AUDIO]),!((a=e.config)===null||a===void 0)&&a.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");const A=(l=(o=e.config)===null||o===void 0?void 0:o.tools)!==null&&l!==void 0?l:[],M=[];for(const F of A)if(this.isCallableTool(F)){const G=F;M.push(await G.tool())}else M.push(F);M.length>0&&(e.config.tools=M);const b={model:S,config:e.config,callbacks:e.callbacks};return this.apiClient.isVertexAI()?E=liveConnectParametersToVertex(this.apiClient,b):E=liveConnectParametersToMldev(this.apiClient,b),delete E.config,g.send(JSON.stringify(E)),new Session(g,this.apiClient)}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}}const defaultLiveSendClientContentParamerters={turnComplete:!0};class Session{constructor(e,i){this.conn=e,this.apiClient=i}tLiveClientContent(e,i){if(i.turns!==null&&i.turns!==void 0){let s=[];try{s=tContents(i.turns),e.isVertexAI()||(s=s.map(r=>contentToMldev$1(r)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof i.turns}'`)}return{clientContent:{turns:s,turnComplete:i.turnComplete}}}return{clientContent:{turnComplete:i.turnComplete}}}tLiveClienttToolResponse(e,i){let s=[];if(i.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(i.functionResponses)?s=i.functionResponses:s=[i.functionResponses],s.length===0)throw new Error("functionResponses is required.");for(const a of s){if(typeof a!="object"||a===null||!("name"in a)||!("response"in a))throw new Error(`Could not parse function response, type '${typeof a}'.`);if(!e.isVertexAI()&&!("id"in a))throw new Error(FUNCTION_RESPONSE_REQUIRES_ID)}return{toolResponse:{functionResponses:s}}}sendClientContent(e){e=Object.assign(Object.assign({},defaultLiveSendClientContentParamerters),e);const i=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(i))}sendRealtimeInput(e){let i={};this.apiClient.isVertexAI()?i={realtimeInput:liveSendRealtimeInputParametersToVertex(e)}:i={realtimeInput:liveSendRealtimeInputParametersToMldev(e)},this.conn.send(JSON.stringify(i))}sendToolResponse(e){if(e.functionResponses==null)throw new Error("Tool response parameters are required.");const i=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(i))}close(){this.conn.close()}}function headersToMap(n){const e={};return n.forEach((i,s)=>{e[s]=i}),e}function mapToHeaders(n){const e=new Headers;for(const[i,s]of Object.entries(n))e.append(i,s);return e}/**
260
+ * @license
261
+ * Copyright 2025 Google LLC
262
+ * SPDX-License-Identifier: Apache-2.0
263
+ */const DEFAULT_MAX_REMOTE_CALLS=10;function shouldDisableAfc(n){var e,i,s;if(!((e=n==null?void 0:n.automaticFunctionCalling)===null||e===void 0)&&e.disable)return!0;let r=!1;for(const o of(i=n==null?void 0:n.tools)!==null&&i!==void 0?i:[])if(isCallableTool(o)){r=!0;break}if(!r)return!0;const a=(s=n==null?void 0:n.automaticFunctionCalling)===null||s===void 0?void 0:s.maximumRemoteCalls;return a&&(a<0||!Number.isInteger(a))||a==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",a),!0):!1}function isCallableTool(n){return"callTool"in n&&typeof n.callTool=="function"}function hasCallableTools(n){var e,i,s;return(s=(i=(e=n.config)===null||e===void 0?void 0:e.tools)===null||i===void 0?void 0:i.some(r=>isCallableTool(r)))!==null&&s!==void 0?s:!1}function findAfcIncompatibleToolIndexes(n){var e;const i=[];return!((e=n==null?void 0:n.config)===null||e===void 0)&&e.tools&&n.config.tools.forEach((s,r)=>{if(isCallableTool(s))return;const a=s;a.functionDeclarations&&a.functionDeclarations.length>0&&i.push(r)}),i}function shouldAppendAfcHistory(n){var e;return!(!((e=n==null?void 0:n.automaticFunctionCalling)===null||e===void 0)&&e.ignoreCallHistory)}/**
264
+ * @license
265
+ * Copyright 2025 Google LLC
266
+ * SPDX-License-Identifier: Apache-2.0
267
+ */class Models extends BaseModule{constructor(e){super(),this.apiClient=e,this.generateContent=async i=>{var s,r,a,o,l;const u=await this.processParamsMaybeAddMcpUsage(i);if(this.maybeMoveToResponseJsonSchem(i),!hasCallableTools(i)||shouldDisableAfc(i.config))return await this.generateContentInternal(u);const c=findAfcIncompatibleToolIndexes(i);if(c.length>0){const T=c.map(x=>`tools[${x}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${T}.`)}let f,p;const d=tContents(u.contents),m=(a=(r=(s=u.config)===null||s===void 0?void 0:s.automaticFunctionCalling)===null||r===void 0?void 0:r.maximumRemoteCalls)!==null&&a!==void 0?a:DEFAULT_MAX_REMOTE_CALLS;let P=0;for(;P<m&&(f=await this.generateContentInternal(u),!(!f.functionCalls||f.functionCalls.length===0));){const T=f.candidates[0].content,x=[];for(const y of(l=(o=i.config)===null||o===void 0?void 0:o.tools)!==null&&l!==void 0?l:[])if(isCallableTool(y)){const g=await y.callTool(f.functionCalls);x.push(...g)}P++,p={role:"user",parts:x},u.contents=tContents(u.contents),u.contents.push(T),u.contents.push(p),shouldAppendAfcHistory(u.config)&&(d.push(T),d.push(p))}return shouldAppendAfcHistory(u.config)&&(f.automaticFunctionCallingHistory=d),f},this.generateContentStream=async i=>{var s,r,a,o,l;if(this.maybeMoveToResponseJsonSchem(i),shouldDisableAfc(i.config)){const p=await this.processParamsMaybeAddMcpUsage(i);return await this.generateContentStreamInternal(p)}const u=findAfcIncompatibleToolIndexes(i);if(u.length>0){const p=u.map(d=>`tools[${d}]`).join(", ");throw new Error(`Incompatible tools found at ${p}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const c=(a=(r=(s=i==null?void 0:i.config)===null||s===void 0?void 0:s.toolConfig)===null||r===void 0?void 0:r.functionCallingConfig)===null||a===void 0?void 0:a.streamFunctionCallArguments,f=(l=(o=i==null?void 0:i.config)===null||o===void 0?void 0:o.automaticFunctionCalling)===null||l===void 0?void 0:l.disable;if(c&&!f)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(i)},this.generateImages=async i=>await this.generateImagesInternal(i).then(s=>{var r;let a;const o=[];if(s!=null&&s.generatedImages)for(const u of s.generatedImages)u&&(u!=null&&u.safetyAttributes)&&((r=u==null?void 0:u.safetyAttributes)===null||r===void 0?void 0:r.contentType)==="Positive Prompt"?a=u==null?void 0:u.safetyAttributes:o.push(u);let l;return a?l={generatedImages:o,positivePromptSafetyAttributes:a,sdkHttpResponse:s.sdkHttpResponse}:l={generatedImages:o,sdkHttpResponse:s.sdkHttpResponse},l}),this.list=async i=>{var s;const o={config:Object.assign(Object.assign({},{queryBase:!0}),i==null?void 0:i.config)};if(this.apiClient.isVertexAI()&&!o.config.queryBase){if(!((s=o.config)===null||s===void 0)&&s.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");o.config.filter="labels.tune-type:*"}return new Pager(PagedItem.PAGED_ITEM_MODELS,l=>this.listInternal(l),await this.listInternal(o),o)},this.editImage=async i=>{const s={model:i.model,prompt:i.prompt,referenceImages:[],config:i.config};return i.referenceImages&&i.referenceImages&&(s.referenceImages=i.referenceImages.map(r=>r.toReferenceImageAPI())),await this.editImageInternal(s)},this.upscaleImage=async i=>{let s={numberOfImages:1,mode:"upscale"};i.config&&(s=Object.assign(Object.assign({},s),i.config));const r={model:i.model,image:i.image,upscaleFactor:i.upscaleFactor,config:s};return await this.upscaleImageInternal(r)},this.generateVideos=async i=>{var s,r,a,o,l,u;if((i.prompt||i.image||i.video)&&i.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((s=i.video)===null||s===void 0)&&s.uri&&(!((r=i.video)===null||r===void 0)&&r.videoBytes)?i.video={uri:i.video.uri,mimeType:i.video.mimeType}:!((o=(a=i.source)===null||a===void 0?void 0:a.video)===null||o===void 0)&&o.uri&&(!((u=(l=i.source)===null||l===void 0?void 0:l.video)===null||u===void 0)&&u.videoBytes)&&(i.source.video={uri:i.source.video.uri,mimeType:i.source.video.mimeType})),await this.generateVideosInternal(i)}}maybeMoveToResponseJsonSchem(e){e.config&&e.config.responseSchema&&(e.config.responseJsonSchema||Object.keys(e.config.responseSchema).includes("$schema")&&(e.config.responseJsonSchema=e.config.responseSchema,delete e.config.responseSchema))}async processParamsMaybeAddMcpUsage(e){var i,s,r;const a=(i=e.config)===null||i===void 0?void 0:i.tools;if(!a)return e;const o=await Promise.all(a.map(async u=>isCallableTool(u)?await u.tool():u)),l={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:o})};if(l.config.tools=o,e.config&&e.config.tools&&hasMcpToolUsage(e.config.tools)){const u=(r=(s=e.config.httpOptions)===null||s===void 0?void 0:s.headers)!==null&&r!==void 0?r:{};let c=Object.assign({},u);Object.keys(c).length===0&&(c=this.apiClient.getDefaultHeaders()),setMcpUsageHeader(c),l.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:c})}return l}async initAfcToolsMap(e){var i,s,r;const a=new Map;for(const o of(s=(i=e.config)===null||i===void 0?void 0:i.tools)!==null&&s!==void 0?s:[])if(isCallableTool(o)){const l=o,u=await l.tool();for(const c of(r=u.functionDeclarations)!==null&&r!==void 0?r:[]){if(!c.name)throw new Error("Function declaration name is required.");if(a.has(c.name))throw new Error(`Duplicate tool declaration name: ${c.name}`);a.set(c.name,l)}}return a}async processAfcStream(e){var i,s,r;const a=(r=(s=(i=e.config)===null||i===void 0?void 0:i.automaticFunctionCalling)===null||s===void 0?void 0:s.maximumRemoteCalls)!==null&&r!==void 0?r:DEFAULT_MAX_REMOTE_CALLS;let o=!1,l=0;const u=await this.initAfcToolsMap(e);return function(c,f,p){var d,m;return __asyncGenerator(this,arguments,function*(){for(var P,T,x,y;l<a;){o&&(l++,o=!1);const E=yield __await(c.processParamsMaybeAddMcpUsage(p)),A=yield __await(c.generateContentStreamInternal(E)),M=[],b=[];try{for(var C=!0,g=(T=void 0,__asyncValues(A)),S;S=yield __await(g.next()),P=S.done,!P;C=!0){y=S.value,C=!1;const F=y;if(yield yield __await(F),F.candidates&&(!((d=F.candidates[0])===null||d===void 0)&&d.content)){b.push(F.candidates[0].content);for(const G of(m=F.candidates[0].content.parts)!==null&&m!==void 0?m:[])if(l<a&&G.functionCall){if(!G.functionCall.name)throw new Error("Function call name was not returned by the model.");if(f.has(G.functionCall.name)){const L=yield __await(f.get(G.functionCall.name).callTool([G.functionCall]));M.push(...L)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${f.keys()}, mising tool: ${G.functionCall.name}`)}}}}catch(F){T={error:F}}finally{try{!C&&!P&&(x=g.return)&&(yield __await(x.call(g)))}finally{if(T)throw T.error}}if(M.length>0){o=!0;const F=new GenerateContentResponse;F.candidates=[{content:{role:"user",parts:M}}],yield yield __await(F);const G=[];G.push(...b),G.push({role:"user",parts:M});const L=tContents(p.contents).concat(G);p.contents=L}else break}})}(this,u,e)}async generateContentInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:generateContent",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=generateContentResponseFromVertex(f),d=new GenerateContentResponse;return Object.assign(d,p),d})}else{const c=generateContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:generateContent",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=generateContentResponseFromMldev(f),d=new GenerateContentResponse;return Object.assign(d,p),d})}}async generateContentStreamInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:streamGenerateContent?alt=sse",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.requestStream({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}),o.then(function(p){return __asyncGenerator(this,arguments,function*(){var d,m,P,T;try{for(var x=!0,y=__asyncValues(p),C;C=yield __await(y.next()),d=C.done,!d;x=!0){T=C.value,x=!1;const g=T,S=generateContentResponseFromVertex(yield __await(g.json()));S.sdkHttpResponse={headers:g.headers};const E=new GenerateContentResponse;Object.assign(E,S),yield yield __await(E)}}catch(g){m={error:g}}finally{try{!x&&!d&&(P=y.return)&&(yield __await(P.call(y)))}finally{if(m)throw m.error}}})})}else{const c=generateContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:streamGenerateContent?alt=sse",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.requestStream({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}),o.then(function(p){return __asyncGenerator(this,arguments,function*(){var d,m,P,T;try{for(var x=!0,y=__asyncValues(p),C;C=yield __await(y.next()),d=C.done,!d;x=!0){T=C.value,x=!1;const g=T,S=generateContentResponseFromMldev(yield __await(g.json()));S.sdkHttpResponse={headers:g.headers};const E=new GenerateContentResponse;Object.assign(E,S),yield yield __await(E)}}catch(g){m={error:g}}finally{try{!x&&!d&&(P=y.return)&&(yield __await(P.call(y)))}finally{if(m)throw m.error}}})})}}async embedContent(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=embedContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=embedContentResponseFromVertex(f),d=new EmbedContentResponse;return Object.assign(d,p),d})}else{const c=embedContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:batchEmbedContents",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=embedContentResponseFromMldev(f),d=new EmbedContentResponse;return Object.assign(d,p),d})}}async generateImagesInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateImagesParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=generateImagesResponseFromVertex(f),d=new GenerateImagesResponse;return Object.assign(d,p),d})}else{const c=generateImagesParametersToMldev(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=generateImagesResponseFromMldev(f),d=new GenerateImagesResponse;return Object.assign(d,p),d})}}async editImageInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI()){const l=editImageParametersInternalToVertex(this.apiClient,e);return a=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(c=>{const f=c;return f.sdkHttpResponse={headers:u.headers},f})),r.then(u=>{const c=editImageResponseFromVertex(u),f=new EditImageResponse;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI()){const l=upscaleImageAPIParametersInternalToVertex(this.apiClient,e);return a=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(c=>{const f=c;return f.sdkHttpResponse={headers:u.headers},f})),r.then(u=>{const c=upscaleImageResponseFromVertex(u),f=new UpscaleImageResponse;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI()){const l=recontextImageParametersToVertex(this.apiClient,e);return a=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const c=recontextImageResponseFromVertex(u),f=new RecontextImageResponse;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI()){const l=segmentImageParametersToVertex(this.apiClient,e);return a=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const c=segmentImageResponseFromVertex(u),f=new SegmentImageResponse;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async get(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=getModelParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>modelFromVertex(f))}else{const c=getModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>modelFromMldev(f))}}async listInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=listModelsParametersToVertex(this.apiClient,e);return l=formatMap("{models_url}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listModelsResponseFromVertex(f),d=new ListModelsResponse;return Object.assign(d,p),d})}else{const c=listModelsParametersToMldev(this.apiClient,e);return l=formatMap("{models_url}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listModelsResponseFromMldev(f),d=new ListModelsResponse;return Object.assign(d,p),d})}}async update(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=updateModelParametersToVertex(this.apiClient,e);return l=formatMap("{model}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>modelFromVertex(f))}else{const c=updateModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>modelFromMldev(f))}}async delete(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=deleteModelParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=deleteModelResponseFromVertex(f),d=new DeleteModelResponse;return Object.assign(d,p),d})}else{const c=deleteModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=deleteModelResponseFromMldev(f),d=new DeleteModelResponse;return Object.assign(d,p),d})}}async countTokens(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=countTokensParametersToVertex(this.apiClient,e);return l=formatMap("{model}:countTokens",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=countTokensResponseFromVertex(f),d=new CountTokensResponse;return Object.assign(d,p),d})}else{const c=countTokensParametersToMldev(this.apiClient,e);return l=formatMap("{model}:countTokens",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=countTokensResponseFromMldev(f),d=new CountTokensResponse;return Object.assign(d,p),d})}}async computeTokens(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI()){const l=computeTokensParametersToVertex(this.apiClient,e);return a=formatMap("{model}:computeTokens",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(c=>{const f=c;return f.sdkHttpResponse={headers:u.headers},f})),r.then(u=>{const c=computeTokensResponseFromVertex(u),f=new ComputeTokensResponse;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateVideosParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predictLongRunning",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o.then(f=>{const p=generateVideosOperationFromVertex(f),d=new GenerateVideosOperation;return Object.assign(d,p),d})}else{const c=generateVideosParametersToMldev(this.apiClient,e);return l=formatMap("{model}:predictLongRunning",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o.then(f=>{const p=generateVideosOperationFromMldev(f),d=new GenerateVideosOperation;return Object.assign(d,p),d})}}}/**
268
+ * @license
269
+ * Copyright 2025 Google LLC
270
+ * SPDX-License-Identifier: Apache-2.0
271
+ */class Operations extends BaseModule{constructor(e){super(),this.apiClient=e}async getVideosOperation(e){const i=e.operation,s=e.config;if(i.name===void 0||i.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=i.name.split("/operations/")[0];let a;s&&"httpOptions"in s&&(a=s.httpOptions);const o=await this.fetchPredictVideosOperationInternal({operationName:i.name,resourceName:r,config:{httpOptions:a}});return i._fromAPIResponse({apiResponse:o,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:i.name,config:s});return i._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async get(e){const i=e.operation,s=e.config;if(i.name===void 0||i.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=i.name.split("/operations/")[0];let a;s&&"httpOptions"in s&&(a=s.httpOptions);const o=await this.fetchPredictVideosOperationInternal({operationName:i.name,resourceName:r,config:{httpOptions:a}});return i._fromAPIResponse({apiResponse:o,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:i.name,config:s});return i._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async getVideosOperationInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=getOperationParametersToVertex(e);return l=formatMap("{operationName}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json()),o}else{const c=getOperationParametersToMldev(e);return l=formatMap("{operationName}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),o}}async fetchPredictVideosOperationInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI()){const l=fetchPredictOperationParametersToVertex(e);return a=formatMap("{resourceName}:fetchPredictOperation",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r}else throw new Error("This method is only supported by the Vertex AI.")}}/**
272
+ * @license
273
+ * Copyright 2025 Google LLC
274
+ * SPDX-License-Identifier: Apache-2.0
275
+ */function blobToMldev(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function contentToMldev(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(a=>partToMldev(a))),setValueByPath(e,["parts"],r)}const s=getValueByPath(n,["role"]);return s!=null&&setValueByPath(e,["role"],s),e}function createAuthTokenConfigToMldev(n,e,i){const s={},r=getValueByPath(e,["expireTime"]);i!==void 0&&r!=null&&setValueByPath(i,["expireTime"],r);const a=getValueByPath(e,["newSessionExpireTime"]);i!==void 0&&a!=null&&setValueByPath(i,["newSessionExpireTime"],a);const o=getValueByPath(e,["uses"]);i!==void 0&&o!=null&&setValueByPath(i,["uses"],o);const l=getValueByPath(e,["liveConnectConstraints"]);i!==void 0&&l!=null&&setValueByPath(i,["bidiGenerateContentSetup"],liveConnectConstraintsToMldev(n,l));const u=getValueByPath(e,["lockAdditionalFields"]);return i!==void 0&&u!=null&&setValueByPath(i,["fieldMask"],u),s}function createAuthTokenParametersToMldev(n,e){const i={},s=getValueByPath(e,["config"]);return s!=null&&setValueByPath(i,["config"],createAuthTokenConfigToMldev(n,s,i)),i}function fileDataToMldev(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function functionCallToMldev(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const s=getValueByPath(n,["args"]);s!=null&&setValueByPath(e,["args"],s);const r=getValueByPath(n,["name"]);if(r!=null&&setValueByPath(e,["name"],r),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function googleMapsToMldev(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function liveConnectConfigToMldev(n,e){const i={},s=getValueByPath(n,["generationConfig"]);e!==void 0&&s!=null&&setValueByPath(e,["setup","generationConfig"],s);const r=getValueByPath(n,["responseModalities"]);e!==void 0&&r!=null&&setValueByPath(e,["setup","generationConfig","responseModalities"],r);const a=getValueByPath(n,["temperature"]);e!==void 0&&a!=null&&setValueByPath(e,["setup","generationConfig","temperature"],a);const o=getValueByPath(n,["topP"]);e!==void 0&&o!=null&&setValueByPath(e,["setup","generationConfig","topP"],o);const l=getValueByPath(n,["topK"]);e!==void 0&&l!=null&&setValueByPath(e,["setup","generationConfig","topK"],l);const u=getValueByPath(n,["maxOutputTokens"]);e!==void 0&&u!=null&&setValueByPath(e,["setup","generationConfig","maxOutputTokens"],u);const c=getValueByPath(n,["mediaResolution"]);e!==void 0&&c!=null&&setValueByPath(e,["setup","generationConfig","mediaResolution"],c);const f=getValueByPath(n,["seed"]);e!==void 0&&f!=null&&setValueByPath(e,["setup","generationConfig","seed"],f);const p=getValueByPath(n,["speechConfig"]);e!==void 0&&p!=null&&setValueByPath(e,["setup","generationConfig","speechConfig"],tLiveSpeechConfig(p));const d=getValueByPath(n,["thinkingConfig"]);e!==void 0&&d!=null&&setValueByPath(e,["setup","generationConfig","thinkingConfig"],d);const m=getValueByPath(n,["enableAffectiveDialog"]);e!==void 0&&m!=null&&setValueByPath(e,["setup","generationConfig","enableAffectiveDialog"],m);const P=getValueByPath(n,["systemInstruction"]);e!==void 0&&P!=null&&setValueByPath(e,["setup","systemInstruction"],contentToMldev(tContent(P)));const T=getValueByPath(n,["tools"]);if(e!==void 0&&T!=null){let A=tTools(T);Array.isArray(A)&&(A=A.map(M=>toolToMldev(tTool(M)))),setValueByPath(e,["setup","tools"],A)}const x=getValueByPath(n,["sessionResumption"]);e!==void 0&&x!=null&&setValueByPath(e,["setup","sessionResumption"],sessionResumptionConfigToMldev(x));const y=getValueByPath(n,["inputAudioTranscription"]);e!==void 0&&y!=null&&setValueByPath(e,["setup","inputAudioTranscription"],y);const C=getValueByPath(n,["outputAudioTranscription"]);e!==void 0&&C!=null&&setValueByPath(e,["setup","outputAudioTranscription"],C);const g=getValueByPath(n,["realtimeInputConfig"]);e!==void 0&&g!=null&&setValueByPath(e,["setup","realtimeInputConfig"],g);const S=getValueByPath(n,["contextWindowCompression"]);e!==void 0&&S!=null&&setValueByPath(e,["setup","contextWindowCompression"],S);const E=getValueByPath(n,["proactivity"]);return e!==void 0&&E!=null&&setValueByPath(e,["setup","proactivity"],E),i}function liveConnectConstraintsToMldev(n,e){const i={},s=getValueByPath(e,["model"]);s!=null&&setValueByPath(i,["setup","model"],tModel(n,s));const r=getValueByPath(e,["config"]);return r!=null&&setValueByPath(i,["config"],liveConnectConfigToMldev(r,i)),i}function partToMldev(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const s=getValueByPath(n,["codeExecutionResult"]);s!=null&&setValueByPath(e,["codeExecutionResult"],s);const r=getValueByPath(n,["executableCode"]);r!=null&&setValueByPath(e,["executableCode"],r);const a=getValueByPath(n,["fileData"]);a!=null&&setValueByPath(e,["fileData"],fileDataToMldev(a));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const f=getValueByPath(n,["thought"]);f!=null&&setValueByPath(e,["thought"],f);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const d=getValueByPath(n,["videoMetadata"]);return d!=null&&setValueByPath(e,["videoMetadata"],d),e}function sessionResumptionConfigToMldev(n){const e={},i=getValueByPath(n,["handle"]);if(i!=null&&setValueByPath(e,["handle"],i),getValueByPath(n,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return e}function toolToMldev(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let f=i;Array.isArray(f)&&(f=f.map(p=>p)),setValueByPath(e,["functionDeclarations"],f)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const s=getValueByPath(n,["googleSearchRetrieval"]);s!=null&&setValueByPath(e,["googleSearchRetrieval"],s);const r=getValueByPath(n,["computerUse"]);r!=null&&setValueByPath(e,["computerUse"],r);const a=getValueByPath(n,["fileSearch"]);a!=null&&setValueByPath(e,["fileSearch"],a);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}/**
276
+ * @license
277
+ * Copyright 2025 Google LLC
278
+ * SPDX-License-Identifier: Apache-2.0
279
+ */function getFieldMasks(n){const e=[];for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const s=n[i];if(typeof s=="object"&&s!=null&&Object.keys(s).length>0){const r=Object.keys(s).map(a=>`${i}.${a}`);e.push(...r)}else e.push(i)}return e.join(",")}function convertBidiSetupToTokenSetup(n,e){let i=null;const s=n.bidiGenerateContentSetup;if(typeof s=="object"&&s!==null&&"setup"in s){const a=s.setup;typeof a=="object"&&a!==null?(n.bidiGenerateContentSetup=a,i=a):delete n.bidiGenerateContentSetup}else s!==void 0&&delete n.bidiGenerateContentSetup;const r=n.fieldMask;if(i){const a=getFieldMasks(i);if(Array.isArray(e==null?void 0:e.lockAdditionalFields)&&(e==null?void 0:e.lockAdditionalFields.length)===0)a?n.fieldMask=a:delete n.fieldMask;else if(e!=null&&e.lockAdditionalFields&&e.lockAdditionalFields.length>0&&r!==null&&Array.isArray(r)&&r.length>0){const o=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let l=[];r.length>0&&(l=r.map(c=>o.includes(c)?`generationConfig.${c}`:c));const u=[];a&&u.push(a),l.length>0&&u.push(...l),u.length>0?n.fieldMask=u.join(","):delete n.fieldMask}else delete n.fieldMask}else r!==null&&Array.isArray(r)&&r.length>0?n.fieldMask=r.join(","):delete n.fieldMask;return n}class Tokens extends BaseModule{constructor(e){super(),this.apiClient=e}async create(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const l=createAuthTokenParametersToMldev(this.apiClient,e);a=formatMap("auth_tokens",l._url),o=l._query,delete l.config,delete l._url,delete l._query;const u=convertBidiSetupToTokenSetup(l,e.config);return r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(c=>c.json()),r.then(c=>c)}}}/**
280
+ * @license
281
+ * Copyright 2025 Google LLC
282
+ * SPDX-License-Identifier: Apache-2.0
283
+ */function deleteDocumentConfigToMldev(n,e){const i={},s=getValueByPath(n,["force"]);return e!==void 0&&s!=null&&setValueByPath(e,["_query","force"],s),i}function deleteDocumentParametersToMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["_url","name"],i);const s=getValueByPath(n,["config"]);return s!=null&&deleteDocumentConfigToMldev(s,e),e}function getDocumentParametersToMldev(n){const e={},i=getValueByPath(n,["name"]);return i!=null&&setValueByPath(e,["_url","name"],i),e}function listDocumentsConfigToMldev(n,e){const i={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);return e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r),i}function listDocumentsParametersToMldev(n){const e={},i=getValueByPath(n,["parent"]);i!=null&&setValueByPath(e,["_url","parent"],i);const s=getValueByPath(n,["config"]);return s!=null&&listDocumentsConfigToMldev(s,e),e}function listDocumentsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(e,["nextPageToken"],s);const r=getValueByPath(n,["documents"]);if(r!=null){let a=r;Array.isArray(a)&&(a=a.map(o=>o)),setValueByPath(e,["documents"],a)}return e}/**
284
+ * @license
285
+ * Copyright 2025 Google LLC
286
+ * SPDX-License-Identifier: Apache-2.0
287
+ */class Documents extends BaseModule{constructor(e){super(),this.apiClient=e,this.list=async i=>new Pager(PagedItem.PAGED_ITEM_DOCUMENTS,s=>this.listInternal({parent:i.parent,config:s.config}),await this.listInternal(i),i)}async get(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=getDocumentParametersToMldev(e);return a=formatMap("{name}",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>u)}}async delete(e){var i,s;let r="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const o=deleteDocumentParametersToMldev(e);r=formatMap("{name}",o._url),a=o._query,delete o._url,delete o._query,await this.apiClient.request({path:r,queryParams:a,body:JSON.stringify(o),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal})}}async listInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=listDocumentsParametersToMldev(e);return a=formatMap("{parent}/documents",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const c=listDocumentsResponseFromMldev(u),f=new ListDocumentsResponse;return Object.assign(f,c),f})}}}/**
288
+ * @license
289
+ * Copyright 2025 Google LLC
290
+ * SPDX-License-Identifier: Apache-2.0
291
+ */class FileSearchStores extends BaseModule{constructor(e,i=new Documents(e)){super(),this.apiClient=e,this.documents=i,this.list=async(s={})=>new Pager(PagedItem.PAGED_ITEM_FILE_SEARCH_STORES,r=>this.listInternal(r),await this.listInternal(s),s)}async uploadToFileSearchStore(e){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(e.fileSearchStoreName,e.file,e.config)}async create(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=createFileSearchStoreParametersToMldev(e);return a=formatMap("fileSearchStores",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>u)}}async get(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=getFileSearchStoreParametersToMldev(e);return a=formatMap("{name}",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>u)}}async delete(e){var i,s;let r="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const o=deleteFileSearchStoreParametersToMldev(e);r=formatMap("{name}",o._url),a=o._query,delete o._url,delete o._query,await this.apiClient.request({path:r,queryParams:a,body:JSON.stringify(o),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal})}}async listInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=listFileSearchStoresParametersToMldev(e);return a=formatMap("fileSearchStores",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const c=listFileSearchStoresResponseFromMldev(u),f=new ListFileSearchStoresResponse;return Object.assign(f,c),f})}}async uploadToFileSearchStoreInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=uploadToFileSearchStoreParametersToMldev(e);return a=formatMap("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const c=uploadToFileSearchStoreResumableResponseFromMldev(u),f=new UploadToFileSearchStoreResumableResponse;return Object.assign(f,c),f})}}async importFile(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=importFileParametersToMldev(e);return a=formatMap("{file_search_store_name}:importFile",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json()),r.then(u=>{const c=importFileOperationFromMldev(u),f=new ImportFileOperation;return Object.assign(f,c),f})}}}/**
292
+ * @license
293
+ * Copyright 2025 Google LLC
294
+ * SPDX-License-Identifier: Apache-2.0
295
+ */function cancelTuningJobParametersToMldev(n,e){const i={},s=getValueByPath(n,["name"]);return s!=null&&setValueByPath(i,["_url","name"],s),i}function cancelTuningJobParametersToVertex(n,e){const i={},s=getValueByPath(n,["name"]);return s!=null&&setValueByPath(i,["_url","name"],s),i}function cancelTuningJobResponseFromMldev(n,e){const i={},s=getValueByPath(n,["sdkHttpResponse"]);return s!=null&&setValueByPath(i,["sdkHttpResponse"],s),i}function cancelTuningJobResponseFromVertex(n,e){const i={},s=getValueByPath(n,["sdkHttpResponse"]);return s!=null&&setValueByPath(i,["sdkHttpResponse"],s),i}function createTuningJobConfigToMldev(n,e,i){const s={};if(getValueByPath(n,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const r=getValueByPath(n,["tunedModelDisplayName"]);if(e!==void 0&&r!=null&&setValueByPath(e,["displayName"],r),getValueByPath(n,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const a=getValueByPath(n,["epochCount"]);e!==void 0&&a!=null&&setValueByPath(e,["tuningTask","hyperparameters","epochCount"],a);const o=getValueByPath(n,["learningRateMultiplier"]);if(o!=null&&setValueByPath(s,["tuningTask","hyperparameters","learningRateMultiplier"],o),getValueByPath(n,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(getValueByPath(n,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(getValueByPath(n,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const l=getValueByPath(n,["batchSize"]);e!==void 0&&l!=null&&setValueByPath(e,["tuningTask","hyperparameters","batchSize"],l);const u=getValueByPath(n,["learningRate"]);if(e!==void 0&&u!=null&&setValueByPath(e,["tuningTask","hyperparameters","learningRate"],u),getValueByPath(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(getValueByPath(n,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return s}function createTuningJobConfigToVertex(n,e,i){const s={};let r=getValueByPath(i,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["validationDataset"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec"],tuningValidationDatasetToVertex(m))}else if(r==="PREFERENCE_TUNING"){const m=getValueByPath(n,["validationDataset"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec"],tuningValidationDatasetToVertex(m))}const a=getValueByPath(n,["tunedModelDisplayName"]);e!==void 0&&a!=null&&setValueByPath(e,["tunedModelDisplayName"],a);const o=getValueByPath(n,["description"]);e!==void 0&&o!=null&&setValueByPath(e,["description"],o);let l=getValueByPath(i,["config","method"]);if(l===void 0&&(l="SUPERVISED_FINE_TUNING"),l==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["epochCount"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","epochCount"],m)}else if(l==="PREFERENCE_TUNING"){const m=getValueByPath(n,["epochCount"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","epochCount"],m)}let u=getValueByPath(i,["config","method"]);if(u===void 0&&(u="SUPERVISED_FINE_TUNING"),u==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["learningRateMultiplier"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],m)}else if(u==="PREFERENCE_TUNING"){const m=getValueByPath(n,["learningRateMultiplier"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],m)}let c=getValueByPath(i,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["exportLastCheckpointOnly"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","exportLastCheckpointOnly"],m)}else if(c==="PREFERENCE_TUNING"){const m=getValueByPath(n,["exportLastCheckpointOnly"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","exportLastCheckpointOnly"],m)}let f=getValueByPath(i,["config","method"]);if(f===void 0&&(f="SUPERVISED_FINE_TUNING"),f==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["adapterSize"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","adapterSize"],m)}else if(f==="PREFERENCE_TUNING"){const m=getValueByPath(n,["adapterSize"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","adapterSize"],m)}if(getValueByPath(n,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(getValueByPath(n,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const p=getValueByPath(n,["labels"]);e!==void 0&&p!=null&&setValueByPath(e,["labels"],p);const d=getValueByPath(n,["beta"]);return e!==void 0&&d!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","beta"],d),s}function createTuningJobParametersPrivateToMldev(n,e){const i={},s=getValueByPath(n,["baseModel"]);s!=null&&setValueByPath(i,["baseModel"],s);const r=getValueByPath(n,["preTunedModel"]);r!=null&&setValueByPath(i,["preTunedModel"],r);const a=getValueByPath(n,["trainingDataset"]);a!=null&&tuningDatasetToMldev(a);const o=getValueByPath(n,["config"]);return o!=null&&createTuningJobConfigToMldev(o,i),i}function createTuningJobParametersPrivateToVertex(n,e){const i={},s=getValueByPath(n,["baseModel"]);s!=null&&setValueByPath(i,["baseModel"],s);const r=getValueByPath(n,["preTunedModel"]);r!=null&&setValueByPath(i,["preTunedModel"],r);const a=getValueByPath(n,["trainingDataset"]);a!=null&&tuningDatasetToVertex(a,i,e);const o=getValueByPath(n,["config"]);return o!=null&&createTuningJobConfigToVertex(o,i,e),i}function getTuningJobParametersToMldev(n,e){const i={},s=getValueByPath(n,["name"]);return s!=null&&setValueByPath(i,["_url","name"],s),i}function getTuningJobParametersToVertex(n,e){const i={},s=getValueByPath(n,["name"]);return s!=null&&setValueByPath(i,["_url","name"],s),i}function listTuningJobsConfigToMldev(n,e,i){const s={},r=getValueByPath(n,["pageSize"]);e!==void 0&&r!=null&&setValueByPath(e,["_query","pageSize"],r);const a=getValueByPath(n,["pageToken"]);e!==void 0&&a!=null&&setValueByPath(e,["_query","pageToken"],a);const o=getValueByPath(n,["filter"]);return e!==void 0&&o!=null&&setValueByPath(e,["_query","filter"],o),s}function listTuningJobsConfigToVertex(n,e,i){const s={},r=getValueByPath(n,["pageSize"]);e!==void 0&&r!=null&&setValueByPath(e,["_query","pageSize"],r);const a=getValueByPath(n,["pageToken"]);e!==void 0&&a!=null&&setValueByPath(e,["_query","pageToken"],a);const o=getValueByPath(n,["filter"]);return e!==void 0&&o!=null&&setValueByPath(e,["_query","filter"],o),s}function listTuningJobsParametersToMldev(n,e){const i={},s=getValueByPath(n,["config"]);return s!=null&&listTuningJobsConfigToMldev(s,i),i}function listTuningJobsParametersToVertex(n,e){const i={},s=getValueByPath(n,["config"]);return s!=null&&listTuningJobsConfigToVertex(s,i),i}function listTuningJobsResponseFromMldev(n,e){const i={},s=getValueByPath(n,["sdkHttpResponse"]);s!=null&&setValueByPath(i,["sdkHttpResponse"],s);const r=getValueByPath(n,["nextPageToken"]);r!=null&&setValueByPath(i,["nextPageToken"],r);const a=getValueByPath(n,["tunedModels"]);if(a!=null){let o=a;Array.isArray(o)&&(o=o.map(l=>tuningJobFromMldev(l))),setValueByPath(i,["tuningJobs"],o)}return i}function listTuningJobsResponseFromVertex(n,e){const i={},s=getValueByPath(n,["sdkHttpResponse"]);s!=null&&setValueByPath(i,["sdkHttpResponse"],s);const r=getValueByPath(n,["nextPageToken"]);r!=null&&setValueByPath(i,["nextPageToken"],r);const a=getValueByPath(n,["tuningJobs"]);if(a!=null){let o=a;Array.isArray(o)&&(o=o.map(l=>tuningJobFromVertex(l))),setValueByPath(i,["tuningJobs"],o)}return i}function tunedModelFromMldev(n,e){const i={},s=getValueByPath(n,["name"]);s!=null&&setValueByPath(i,["model"],s);const r=getValueByPath(n,["name"]);return r!=null&&setValueByPath(i,["endpoint"],r),i}function tuningDatasetToMldev(n,e){const i={};if(getValueByPath(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const s=getValueByPath(n,["examples"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(a=>a)),setValueByPath(i,["examples","examples"],r)}return i}function tuningDatasetToVertex(n,e,i){const s={};let r=getValueByPath(i,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const o=getValueByPath(n,["gcsUri"]);e!==void 0&&o!=null&&setValueByPath(e,["supervisedTuningSpec","trainingDatasetUri"],o)}else if(r==="PREFERENCE_TUNING"){const o=getValueByPath(n,["gcsUri"]);e!==void 0&&o!=null&&setValueByPath(e,["preferenceOptimizationSpec","trainingDatasetUri"],o)}let a=getValueByPath(i,["config","method"]);if(a===void 0&&(a="SUPERVISED_FINE_TUNING"),a==="SUPERVISED_FINE_TUNING"){const o=getValueByPath(n,["vertexDatasetResource"]);e!==void 0&&o!=null&&setValueByPath(e,["supervisedTuningSpec","trainingDatasetUri"],o)}else if(a==="PREFERENCE_TUNING"){const o=getValueByPath(n,["vertexDatasetResource"]);e!==void 0&&o!=null&&setValueByPath(e,["preferenceOptimizationSpec","trainingDatasetUri"],o)}if(getValueByPath(n,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return s}function tuningJobFromMldev(n,e){const i={},s=getValueByPath(n,["sdkHttpResponse"]);s!=null&&setValueByPath(i,["sdkHttpResponse"],s);const r=getValueByPath(n,["name"]);r!=null&&setValueByPath(i,["name"],r);const a=getValueByPath(n,["state"]);a!=null&&setValueByPath(i,["state"],tTuningJobStatus(a));const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(i,["createTime"],o);const l=getValueByPath(n,["tuningTask","startTime"]);l!=null&&setValueByPath(i,["startTime"],l);const u=getValueByPath(n,["tuningTask","completeTime"]);u!=null&&setValueByPath(i,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(i,["updateTime"],c);const f=getValueByPath(n,["description"]);f!=null&&setValueByPath(i,["description"],f);const p=getValueByPath(n,["baseModel"]);p!=null&&setValueByPath(i,["baseModel"],p);const d=getValueByPath(n,["_self"]);return d!=null&&setValueByPath(i,["tunedModel"],tunedModelFromMldev(d)),i}function tuningJobFromVertex(n,e){const i={},s=getValueByPath(n,["sdkHttpResponse"]);s!=null&&setValueByPath(i,["sdkHttpResponse"],s);const r=getValueByPath(n,["name"]);r!=null&&setValueByPath(i,["name"],r);const a=getValueByPath(n,["state"]);a!=null&&setValueByPath(i,["state"],tTuningJobStatus(a));const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(i,["createTime"],o);const l=getValueByPath(n,["startTime"]);l!=null&&setValueByPath(i,["startTime"],l);const u=getValueByPath(n,["endTime"]);u!=null&&setValueByPath(i,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(i,["updateTime"],c);const f=getValueByPath(n,["error"]);f!=null&&setValueByPath(i,["error"],f);const p=getValueByPath(n,["description"]);p!=null&&setValueByPath(i,["description"],p);const d=getValueByPath(n,["baseModel"]);d!=null&&setValueByPath(i,["baseModel"],d);const m=getValueByPath(n,["tunedModel"]);m!=null&&setValueByPath(i,["tunedModel"],m);const P=getValueByPath(n,["preTunedModel"]);P!=null&&setValueByPath(i,["preTunedModel"],P);const T=getValueByPath(n,["supervisedTuningSpec"]);T!=null&&setValueByPath(i,["supervisedTuningSpec"],T);const x=getValueByPath(n,["preferenceOptimizationSpec"]);x!=null&&setValueByPath(i,["preferenceOptimizationSpec"],x);const y=getValueByPath(n,["tuningDataStats"]);y!=null&&setValueByPath(i,["tuningDataStats"],y);const C=getValueByPath(n,["encryptionSpec"]);C!=null&&setValueByPath(i,["encryptionSpec"],C);const g=getValueByPath(n,["partnerModelTuningSpec"]);g!=null&&setValueByPath(i,["partnerModelTuningSpec"],g);const S=getValueByPath(n,["customBaseModel"]);S!=null&&setValueByPath(i,["customBaseModel"],S);const E=getValueByPath(n,["experiment"]);E!=null&&setValueByPath(i,["experiment"],E);const A=getValueByPath(n,["labels"]);A!=null&&setValueByPath(i,["labels"],A);const M=getValueByPath(n,["outputUri"]);M!=null&&setValueByPath(i,["outputUri"],M);const b=getValueByPath(n,["pipelineJob"]);b!=null&&setValueByPath(i,["pipelineJob"],b);const F=getValueByPath(n,["serviceAccount"]);F!=null&&setValueByPath(i,["serviceAccount"],F);const G=getValueByPath(n,["tunedModelDisplayName"]);G!=null&&setValueByPath(i,["tunedModelDisplayName"],G);const L=getValueByPath(n,["veoTuningSpec"]);return L!=null&&setValueByPath(i,["veoTuningSpec"],L),i}function tuningOperationFromMldev(n,e){const i={},s=getValueByPath(n,["sdkHttpResponse"]);s!=null&&setValueByPath(i,["sdkHttpResponse"],s);const r=getValueByPath(n,["name"]);r!=null&&setValueByPath(i,["name"],r);const a=getValueByPath(n,["metadata"]);a!=null&&setValueByPath(i,["metadata"],a);const o=getValueByPath(n,["done"]);o!=null&&setValueByPath(i,["done"],o);const l=getValueByPath(n,["error"]);return l!=null&&setValueByPath(i,["error"],l),i}function tuningValidationDatasetToVertex(n,e){const i={},s=getValueByPath(n,["gcsUri"]);s!=null&&setValueByPath(i,["validationDatasetUri"],s);const r=getValueByPath(n,["vertexDatasetResource"]);return r!=null&&setValueByPath(i,["validationDatasetUri"],r),i}/**
296
+ * @license
297
+ * Copyright 2025 Google LLC
298
+ * SPDX-License-Identifier: Apache-2.0
299
+ */class Tunings extends BaseModule{constructor(e){super(),this.apiClient=e,this.list=async(i={})=>new Pager(PagedItem.PAGED_ITEM_TUNING_JOBS,s=>this.listInternal(s),await this.listInternal(i),i),this.get=async i=>await this.getInternal(i),this.tune=async i=>{var s;if(this.apiClient.isVertexAI())if(i.baseModel.startsWith("projects/")){const r={tunedModelName:i.baseModel};!((s=i.config)===null||s===void 0)&&s.preTunedModelCheckpointId&&(r.checkpointId=i.config.preTunedModelCheckpointId);const a=Object.assign(Object.assign({},i),{preTunedModel:r});return a.baseModel=void 0,await this.tuneInternal(a)}else{const r=Object.assign({},i);return await this.tuneInternal(r)}else{const r=Object.assign({},i),a=await this.tuneMldevInternal(r);let o="";return a.metadata!==void 0&&a.metadata.tunedModel!==void 0?o=a.metadata.tunedModel:a.name!==void 0&&a.name.includes("/operations/")&&(o=a.name.split("/operations/")[0]),{name:o,state:JobState.JOB_STATE_QUEUED}}}}async getInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=getTuningJobParametersToVertex(e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>tuningJobFromVertex(f))}else{const c=getTuningJobParametersToMldev(e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>tuningJobFromMldev(f))}}async listInternal(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=listTuningJobsParametersToVertex(e);return l=formatMap("tuningJobs",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listTuningJobsResponseFromVertex(f),d=new ListTuningJobsResponse;return Object.assign(d,p),d})}else{const c=listTuningJobsParametersToMldev(e);return l=formatMap("tunedModels",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=listTuningJobsResponseFromMldev(f),d=new ListTuningJobsResponse;return Object.assign(d,p),d})}}async cancel(e){var i,s,r,a;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=cancelTuningJobParametersToVertex(e);return l=formatMap("{name}:cancel",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=cancelTuningJobResponseFromVertex(f),d=new CancelTuningJobResponse;return Object.assign(d,p),d})}else{const c=cancelTuningJobParametersToMldev(e);return l=formatMap("{name}:cancel",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json().then(p=>{const d=p;return d.sdkHttpResponse={headers:f.headers},d})),o.then(f=>{const p=cancelTuningJobResponseFromMldev(f),d=new CancelTuningJobResponse;return Object.assign(d,p),d})}}async tuneInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI()){const l=createTuningJobParametersPrivateToVertex(e,e);return a=formatMap("tuningJobs",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(c=>{const f=c;return f.sdkHttpResponse={headers:u.headers},f})),r.then(u=>tuningJobFromVertex(u))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(e){var i,s;let r,a="",o={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const l=createTuningJobParametersPrivateToMldev(e);return a=formatMap("tunedModels",l._url),o=l._query,delete l._url,delete l._query,r=this.apiClient.request({path:a,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(u=>u.json().then(c=>{const f=c;return f.sdkHttpResponse={headers:u.headers},f})),r.then(u=>tuningOperationFromMldev(u))}}}/**
300
+ * @license
301
+ * Copyright 2025 Google LLC
302
+ * SPDX-License-Identifier: Apache-2.0
303
+ */class BrowserDownloader{async download(e,i){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an <a> tag.")}}const MAX_CHUNK_SIZE=1024*1024*8,MAX_RETRY_COUNT=3,INITIAL_RETRY_DELAY_MS=1e3,DELAY_MULTIPLIER=2,X_GOOG_UPLOAD_STATUS_HEADER_FIELD="x-goog-upload-status";async function uploadBlob(n,e,i){var s;const r=await uploadBlobInternal(n,e,i),a=await(r==null?void 0:r.json());if(((s=r==null?void 0:r.headers)===null||s===void 0?void 0:s[X_GOOG_UPLOAD_STATUS_HEADER_FIELD])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return a.file}async function uploadBlobToFileSearchStore(n,e,i){var s;const r=await uploadBlobInternal(n,e,i),a=await(r==null?void 0:r.json());if(((s=r==null?void 0:r.headers)===null||s===void 0?void 0:s[X_GOOG_UPLOAD_STATUS_HEADER_FIELD])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const o=uploadToFileSearchStoreOperationFromMldev(a),l=new UploadToFileSearchStoreOperation;return Object.assign(l,o),l}async function uploadBlobInternal(n,e,i){var s,r;let a=0,o=0,l=new HttpResponse(new Response),u="upload";for(a=n.size;o<a;){const c=Math.min(MAX_CHUNK_SIZE,a-o),f=n.slice(o,o+c);o+c>=a&&(u+=", finalize");let p=0,d=INITIAL_RETRY_DELAY_MS;for(;p<MAX_RETRY_COUNT&&(l=await i.request({path:"",body:f,httpMethod:"POST",httpOptions:{apiVersion:"",baseUrl:e,headers:{"X-Goog-Upload-Command":u,"X-Goog-Upload-Offset":String(o),"Content-Length":String(c)}}}),!(!((s=l==null?void 0:l.headers)===null||s===void 0)&&s[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]));)p++,await sleep(d),d=d*DELAY_MULTIPLIER;if(o+=c,((r=l==null?void 0:l.headers)===null||r===void 0?void 0:r[X_GOOG_UPLOAD_STATUS_HEADER_FIELD])!=="active")break;if(a<=o)throw new Error("All content has been uploaded, but the upload status is not finalized.")}return l}async function getBlobStat(n){return{size:n.size,type:n.type}}function sleep(n){return new Promise(e=>setTimeout(e,n))}class BrowserUploader{async upload(e,i,s){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await uploadBlob(e,i,s)}async uploadToFileSearchStore(e,i,s){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await uploadBlobToFileSearchStore(e,i,s)}async stat(e){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await getBlobStat(e)}}/**
304
+ * @license
305
+ * Copyright 2025 Google LLC
306
+ * SPDX-License-Identifier: Apache-2.0
307
+ */class BrowserWebSocketFactory{create(e,i,s){return new BrowserWebSocket(e,i,s)}}class BrowserWebSocket{constructor(e,i,s){this.url=e,this.headers=i,this.callbacks=s}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(e){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(e)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}}/**
308
+ * @license
309
+ * Copyright 2025 Google LLC
310
+ * SPDX-License-Identifier: Apache-2.0
311
+ */const GOOGLE_API_KEY_HEADER="x-goog-api-key";class WebAuth{constructor(e){this.apiKey=e}async addAuthHeaders(e,i){if(e.get(GOOGLE_API_KEY_HEADER)===null){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");if(!this.apiKey)throw new Error("API key is missing. Please provide a valid API key.");e.append(GOOGLE_API_KEY_HEADER,this.apiKey)}}}/**
312
+ * @license
313
+ * Copyright 2025 Google LLC
314
+ * SPDX-License-Identifier: Apache-2.0
315
+ */const LANGUAGE_LABEL_PREFIX="gl-node/";class GoogleGenAI{constructor(e){var i;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(i=e.vertexai)!==null&&i!==void 0?i:!1,this.apiKey=e.apiKey;const s=getBaseUrl(e.httpOptions,e.vertexai,void 0,void 0);s&&(e.httpOptions?e.httpOptions.baseUrl=s:e.httpOptions={baseUrl:s}),this.apiVersion=e.apiVersion,this.httpOptions=e.httpOptions;const r=new WebAuth(this.apiKey);this.apiClient=new ApiClient({auth:r,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:LANGUAGE_LABEL_PREFIX+"web",uploader:new BrowserUploader,downloader:new BrowserDownloader}),this.models=new Models(this.apiClient),this.live=new Live(this.apiClient,r,new BrowserWebSocketFactory),this.batches=new Batches(this.apiClient),this.chats=new Chats(this.models,this.apiClient),this.caches=new Caches(this.apiClient),this.files=new Files(this.apiClient),this.operations=new Operations(this.apiClient),this.authTokens=new Tokens(this.apiClient),this.tunings=new Tunings(this.apiClient),this.fileSearchStores=new FileSearchStores(this.apiClient)}}class GeminiTokenManager{constructor(){Re(this,"geminiToken",null);Re(this,"expiresAt",null);Re(this,"refreshTimer",null);Re(this,"isInitializing",!1);Re(this,"REFRESH_MARGIN_MS",5*60*1e3)}async initialize(){if(console.log("[GeminiToken] 🚀 initialize() called"),this.isInitializing)return console.log("[GeminiToken] ⚠️ Already initializing, skipping..."),!1;if(!claraApi.hasAuth())return console.error("[GeminiToken] ❌ No Clara auth credentials available"),!1;this.isInitializing=!0,console.log("[GeminiToken] 📡 Fetching Gemini token from Clara API...");try{const e=await this.fetchGeminiToken();return e?(this.setToken(e),this.scheduleRefresh(),console.log("[GeminiToken] ✅ Initialization complete"),this.isInitializing=!1,!0):(console.error("[GeminiToken] ❌ Failed to fetch initial token"),this.isInitializing=!1,!1)}catch(e){return console.error("[GeminiToken] ❌ Initialization error:",e),this.isInitializing=!1,!1}}async fetchGeminiToken(){console.log("[GeminiToken] 📡 fetchGeminiToken() - calling POST /auth/ai/token");try{const e=claraApi.getHeadersForEphemeral(),i=await fetch(claraApi.getApiBaseUrl()+"/auth/ai/token",{method:"POST",headers:e});if(console.log("[GeminiToken] 📥 Response status:",i.status),!i.ok){const o=await i.text();return console.error("[GeminiToken] ❌ API error:",i.status,o),null}const s=await i.json(),r=s.data||s;console.log("[GeminiToken] 📥 Response data:",{hasToken:!!r.token,expireTime:r.expireTime});let a=r.expireTime;return typeof a=="string"&&(a=new Date(a).getTime()),{token:r.token,expireTime:a,newSessionExpireTime:r.newSessionExpireTime,raw:r}}catch(e){return console.error("[GeminiToken] ❌ Fetch error:",e),null}}setToken(e){console.log("[GeminiToken] 💾 setToken() - storing Gemini token (internal only)"),this.geminiToken=e.token,this.expiresAt=e.expireTime;const i=this.expiresAt-Date.now(),s=Math.round(i/1e3/60);console.log("[GeminiToken] ⏰ Gemini token expires in",s,"minutes")}scheduleRefresh(){if(console.log("[GeminiToken] ⏲️ scheduleRefresh() called"),this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),!this.expiresAt){console.warn("[GeminiToken] ⚠️ No expiration time set, cannot schedule refresh");return}const e=this.expiresAt-this.REFRESH_MARGIN_MS,i=Math.max(0,e-Date.now()),s=Math.round(i/1e3/60);console.log("[GeminiToken] ⏲️ Scheduling refresh in",s,"minutes"),this.refreshTimer=setTimeout(()=>{console.log("[GeminiToken] ⏰ Refresh timer fired!"),this.refresh()},i)}async refresh(){console.log("[GeminiToken] 🔄 refresh() called");try{const e=await this.fetchGeminiToken();return e?(this.setToken(e),this.scheduleRefresh(),console.log("[GeminiToken] ✅ Token refreshed successfully"),!0):(console.error("[GeminiToken] ❌ Failed to refresh token"),this.refreshTimer=setTimeout(()=>this.refresh(),60*1e3),!1)}catch(e){return console.error("[GeminiToken] ❌ Refresh error:",e),this.refreshTimer=setTimeout(()=>this.refresh(),60*1e3),!1}}getToken(){return this.geminiToken}isValid(){return!!(this.geminiToken&&this.expiresAt&&Date.now()<this.expiresAt)}destroy(){console.log("[GeminiToken] 🧹 destroy() - cleaning up"),this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.geminiToken=null,this.expiresAt=null,this.isInitializing=!1,console.log("[GeminiToken] ✅ Cleanup complete")}}const ephemeralTokenManager=new GeminiTokenManager,getApiKey=async()=>{let n=ephemeralTokenManager.getToken();return n||await ephemeralTokenManager.initialize()&&(n=ephemeralTokenManager.getToken()),n||(console.error("[TemplateGenerator] No Gemini token available"),null)};function extractFormElementsFromDocument(n,e=""){const i=[],s=[];try{const r=["input","select","textarea",'[contenteditable="true"]','[role="textbox"]','[role="combobox"]','[role="listbox"]','[role="checkbox"]','[role="radio"]',"[data-field]","[data-input]",'[class*="input"]','[class*="field"]','[class*="form-control"]','[class*="campo"]','[class*="MuiInput"]','[class*="MuiSelect"]','[class*="MuiTextField"]','[class*="ant-input"]','[class*="ant-select"]'].join(", "),a=n.querySelectorAll(r),o=n.querySelectorAll('label, [class*="label"], [class*="Label"]'),l=new Map;o.forEach(d=>{var T;const m=d.htmlFor,P=((T=d.textContent)==null?void 0:T.trim())||"";m&&P&&l.set(m,P)});const u=new Set;a.forEach(d=>{var M,b;const m=d.tagName.toLowerCase();let P=d.id||"";const T=d.name||"",x=d.type||d.getAttribute("type")||m,y=d.placeholder||d.getAttribute("placeholder")||"",C=d.getAttribute("data-field")||d.getAttribute("data-name")||"";if(x==="hidden"||x==="submit"||x==="button"||x==="reset"||(!P&&T&&(P=T),!P&&C&&(P=C),!P||u.has(P)))return;u.add(P);let g=l.get(P)||"";if(g||(g=d.getAttribute("aria-label")||""),g||(g=d.getAttribute("title")||""),g||(g=y),!g){const F=d.closest("div, td, li, span, p, .form-group, .field-wrapper");if(F){const G=F.querySelector('label, span.label, .field-label, [class*="label"]');G&&G!==d&&(g=((M=G.textContent)==null?void 0:M.trim())||"")}}if(!g){const F=d.previousElementSibling;F&&(F.tagName==="LABEL"||F.classList.contains("label"))&&(g=((b=F.textContent)==null?void 0:b.trim())||"")}let S="text";m==="select"||d.getAttribute("role")==="combobox"||d.getAttribute("role")==="listbox"?S="select":m==="textarea"||d.getAttribute("role")==="textbox"?S="textarea":(x==="checkbox"||d.getAttribute("role")==="checkbox"||x==="radio"||d.getAttribute("role")==="radio")&&(S="checkbox");let E=[];if(m==="select"){const F=d.options;E=Array.from(F).map(G=>{var L;return((L=G.textContent)==null?void 0:L.trim())||G.value}).filter(Boolean)}const A=E.length>0?` options=[${E.slice(0,20).join("|")}]`:"";i.push(`${e}${S.toUpperCase()}[id="${P}" label="${g}"${A}]`)}),n.querySelectorAll('[id*="campo"], [id*="input"], [id*="field"], [id*="pl_"], [id*="txt"], [id*="sel"], [id*="chk"]').forEach(d=>{var x;const m=d.id;if(!m||u.has(m))return;const P=d.tagName.toLowerCase();if(!["input","select","textarea"].includes(P)&&!d.hasAttribute("contenteditable")&&!d.getAttribute("role"))return;u.add(m);let T=d.getAttribute("aria-label")||d.getAttribute("title")||"";if(!T){const y=d.closest("div, td");if(y){const C=y.querySelector("label");C&&(T=((x=C.textContent)==null?void 0:x.trim())||"")}}i.push(`TEXT[id="${m}" label="${T}"]`)}),n.querySelectorAll('h1, h2, h3, h4, h5, h6, legend, .section-title, .section-header, [class*="section"], [class*="header"], [class*="titulo"], [class*="seccion"]').forEach(d=>{var P;const m=(P=d.textContent)==null?void 0:P.trim();m&&m.length>2&&m.length<150&&(s.includes(m)||s.push(m))}),n.querySelectorAll("fieldset").forEach(d=>{var P;const m=d.querySelector("legend");if(m){const T=(P=m.textContent)==null?void 0:P.trim();T&&!s.includes(T)&&s.push(T)}})}catch(r){console.error("[TemplateGenerator] Error extracting from document:",r)}return{formData:i,sectionHints:s}}function extractFormInputsFromHTML(){const n=[],e=[];try{const i=extractFormElementsFromDocument(document,"");n.push(...i.formData),e.push(...i.sectionHints),document.querySelectorAll("iframe").forEach((r,a)=>{var o;try{const l=r.contentDocument||((o=r.contentWindow)==null?void 0:o.document);if(l){const u=extractFormElementsFromDocument(l,`[iframe-${a}] `);n.push(...u.formData),e.push(...u.sectionHints)}}catch{console.log(`[TemplateGenerator] Cannot access iframe ${a} (cross-origin)`)}});try{if(window.parent!==window){const r=window.parent.document,a=extractFormElementsFromDocument(r,"[parent] ");n.push(...a.formData),e.push(...a.sectionHints)}}catch{}return console.log(`[TemplateGenerator] Total extracted: ${n.length} fields, ${e.length} section hints`),`
316
+ DETECTED FORM ELEMENTS (${n.length} campos encontrados):
317
+ ${n.join(`
318
+ `)}
319
+
320
+ SECTION HINTS (${e.length} secciones detectadas):
321
+ ${e.map(r=>`- ${r}`).join(`
322
+ `)}
323
+ `.trim()}catch(i){return console.error("[TemplateGenerator] Error extracting HTML:",i),"Could not extract form elements"}}async function generateTemplateFromPage(n){var e;try{n({phase:"analyzing",percentage:10,message:"Analizando estructura de la página..."});const i=extractFormInputsFromHTML();console.log("[TemplateGenerator] Extracted form elements:",i);const s=!i.includes("0 campos encontrados"),r=i.includes("secciones detectadas")&&!i.includes("0 secciones");if(!s&&!r)return n({phase:"error",percentage:0,message:"No se encontraron campos ni secciones en la página"}),null;n({phase:"extracting",percentage:30,message:"Extrayendo campos del formulario..."});const a=await getApiKey();if(!a)return n({phase:"error",percentage:0,message:"No se pudo obtener token de Gemini. Verifica tu autenticación."}),null;const o=new GoogleGenAI({apiKey:a}),l=`Eres un experto en formularios médicos ocupacionales. Tu tarea es generar un template JSON COMPLETO para Clara, un asistente de voz médico que llena formularios automáticamente.
324
+
325
+ CONTEXTO:
326
+ - Los formularios médicos ocupacionales típicamente incluyen secciones como: datos del paciente, tipo de examen, antecedentes médicos, examen físico, diagnósticos, etc.
327
+ - Cada campo del formulario tiene un ID HTML único que Clara usa para llenarlo automáticamente.
328
+
329
+ REGLAS ABSOLUTAS:
330
+ 1. GENERA CAMPOS PARA CADA SECCIÓN: Aunque no detectemos todos los campos HTML, DEBES generar campos típicos para cada sección detectada.
331
+ 2. El "htmlFieldId" debe ser el ID exacto del HTML cuando esté disponible, o un ID inferido basado en el patrón del formulario.
332
+ 3. ANALIZA LOS PATRONES DE IDs: Si ves IDs como "pl_plantilla_11_campo...", genera más campos siguiendo ese patrón.
333
+ 4. SECCIONES COMPLETAS: Para cada SECTION HINT, genera entre 3-10 campos relevantes típicos de esa sección médica.
334
+
335
+ CAMPOS TÍPICOS POR SECCIÓN (úsalos como guía):
336
+ - "Datos del paciente": nombre, documento, fecha nacimiento, género, dirección, teléfono, email
337
+ - "Datos de la empresa": nombre empresa, cargo, área, antigüedad, jefe inmediato
338
+ - "Tipo de examen": tipo (select), fecha, audiometría confirmatoria (checkbox)
339
+ - "Antecedentes Ocupacionales": empresas anteriores, cargos, exposición a ruido, tiempo exposición, EPP usado
340
+ - "Antecedentes auditivos": pérdida auditiva, uso de audífonos, cirugías, infecciones, tinnitus, vértigo
341
+ - "Antecedentes Médicos": diabetes, hipertensión, medicamentos ototóxicos, trauma craneal, otros
342
+ - "Otoscopia": oído derecho, oído izquierdo, observaciones
343
+ - "Diagnóstico": diagnóstico principal, diagnósticos secundarios, CIE-10
344
+ - "Recomendaciones": recomendaciones, remisiones, controles
345
+
346
+ TIPOS DE CAMPOS:
347
+ - "text": campos de texto simple (nombres, fechas, números)
348
+ - "select": listas desplegables (incluye array de options típicas)
349
+ - "textarea": texto largo (observaciones, descripciones)
350
+ - "checkbox": campos de sí/no
351
+
352
+ ESTRUCTURA JSON:
353
+ {
354
+ "templateName": "Nombre del formulario",
355
+ "templateDescription": "Descripción",
356
+ "sections": [
357
+ {
358
+ "key": "identificador_seccion",
359
+ "label": "Nombre Sección",
360
+ "enabled": true,
361
+ "fields": [
362
+ {
363
+ "id": "nombre_campo",
364
+ "htmlFieldId": "ID_HTML_EXACTO_O_INFERIDO",
365
+ "label": "Etiqueta visible",
366
+ "type": "text|select|textarea|checkbox",
367
+ "options": ["op1", "op2"] // solo para select
368
+ }
369
+ ]
370
+ }
371
+ ]
372
+ }
373
+
374
+ IMPORTANTE:
375
+ - Responde SOLO con JSON válido
376
+ - NO uses markdown ni explicaciones
377
+ - GENERA TODAS las secciones del SECTION HINTS
378
+ - CADA sección debe tener MÚLTIPLES campos relevantes`,u=`FORMULARIO A ANALIZAR:
379
+
380
+ ${i}
381
+
382
+ INSTRUCCIONES:
383
+ 1. Crea UNA SECCIÓN para CADA "SECTION HINT" detectado (excepto duplicados o irrelevantes)
384
+ 2. Para cada sección, genera TODOS los campos que típicamente tendría un formulario médico ocupacional de ese tipo
385
+ 3. Si detectaste campos HTML con IDs, úsalos. Si no, genera IDs siguiendo el patrón que observes.
386
+ 4. El formulario es de AUDIOMETRÍA OCUPACIONAL - incluye campos específicos de audición y ruido laboral.
387
+ 5. Genera un template COMPLETO y PROFESIONAL.
388
+
389
+ GENERA EL JSON AHORA:`;n({phase:"generating",percentage:50,message:"Generando template completo con IA..."});const f=(await o.models.generateContent({model:"gemini-2.5-pro",contents:l+`
390
+
391
+ `+u,config:{temperature:.2,maxOutputTokens:16384}})).text||"";console.log("[TemplateGenerator] AI Response length:",f.length),console.log("[TemplateGenerator] AI Response:",f),n({phase:"generating",percentage:70,message:"Procesando respuesta..."});let p=null;try{p=JSON.parse(f)}catch{const C=f.match(/```(?:json)?\s*([\s\S]*?)\s*```/);if(C&&C[1])p=JSON.parse(C[1]);else{const g=f.match(/\{[\s\S]*\}/);g&&(p=JSON.parse(g[0]))}}if(!p)throw new Error("No se pudo parsear la respuesta de la IA");console.log("[TemplateGenerator] Parsed response:",p);const d=((e=p.structure)==null?void 0:e.sections)||p.sections||[],m=p.name||p.templateName||p.formName||"Template Generado",P=p.description||p.templateDescription||"Generado automáticamente",T=d.map(C=>{var g;return{key:C.key||((g=C.label)==null?void 0:g.toLowerCase().replace(/\s+/g,"_"))||"section",label:C.label||"Sección",enabled:C.enabled!==!1,fields:(C.fields||[]).map(S=>({id:S.id||S.htmlFieldId,htmlFieldId:S.htmlFieldId||S.id,label:S.label||S.id||"Campo",type:S.type||"text",...S.options&&{options:S.options}}))}}),x=T.reduce((C,g)=>{var S;return C+(((S=g.fields)==null?void 0:S.length)||0)},0),y={name:m,description:P,structure:{sections:T}};return console.log("[TemplateGenerator] Final template:",{name:y.name,sectionsCount:y.structure.sections.length,fieldsCount:x}),n({phase:"complete",percentage:100,message:`Template generado: ${y.structure.sections.length} secciones, ${x} campos`}),y}catch(i){return console.error("[TemplateGenerator] Error:",i),n({phase:"error",percentage:0,message:i instanceof Error?i.message:"Error desconocido"}),null}}const DEMO_TEMPLATE_IDS={audiometria:"a0785251-eb3a-4d6c-8224-10a8c6acfd12",odontologia:"fe2085fd-5f19-44e9-b04c-92e0f0ab7769"},API_BASE_URL="https://ncifcjxnmyjfracfzwrl.supabase.co/functions/v1/api";let demoTemplatesCache={};function getAuthHeaders(n,e){const i={"Content-Type":"application/json"};return n?i["X-API-Key"]=n:e?i.Authorization=`Bearer ${e}`:claraApi.getApiKey()?i["X-API-Key"]=claraApi.getApiKey():claraApi.getAccessToken()&&(i.Authorization=`Bearer ${claraApi.getAccessToken()}`),i}async function fetchTemplateById(n,e,i){try{const s=getAuthHeaders(e,i);if(!(s["X-API-Key"]||s.Authorization))return console.log("[DemoTemplates] No authentication available yet, skipping fetch"),null;const a=`${API_BASE_URL}/templates`;console.log("[DemoTemplates] Fetching templates to find:",n);const o=await fetch(a,{method:"GET",headers:s});if(!o.ok)return console.error("[DemoTemplates] Failed to fetch templates:",o.status),null;const l=await o.json(),c=(l.data||l).find(f=>f.id===n);return c?(console.log("[DemoTemplates] Found template:",c.name),c):(console.warn("[DemoTemplates] Template not found:",n),null)}catch(s){return console.error("[DemoTemplates] Error fetching template:",s),null}}async function getDemoTemplate(n,e,i){if(demoTemplatesCache[n])return console.log("[DemoTemplates] Returning cached template:",n),demoTemplatesCache[n];const s=DEMO_TEMPLATE_IDS[n],r=await fetchTemplateById(s,e,i);return r&&(demoTemplatesCache[n]=r,console.log("[DemoTemplates] Cached template:",n,r.name)),r}function dispatchClaraEvent(n,e){console.log(`[Clara Event] ${n}`,e),window.dispatchEvent(new CustomEvent(n,{detail:e}))}function emitFieldFilled(n,e,i){dispatchClaraEvent("clara:field-filled",{fieldName:n,value:e,sectionKey:i,timestamp:new Date().toISOString()})}function emitFormDataUpdated(n,e,i){dispatchClaraEvent("clara:formdata-updated",{formData:{...n},changedField:e,changedFields:i,timestamp:new Date().toISOString()})}function emitTranscriptUpdated(n,e,i){dispatchClaraEvent("clara:transcript-updated",{role:n,content:e,messages:i,timestamp:new Date().toISOString()})}function emitTitleUpdated(n,e){dispatchClaraEvent("clara:title-updated",{title:n,analysisId:e,timestamp:new Date().toISOString()})}function emitTemplateChanged(n,e,i){dispatchClaraEvent("clara:template-changed",{templateId:n,templateName:e,sections:i,timestamp:new Date().toISOString()})}function emitSessionStarted(n){dispatchClaraEvent("clara:session-started",{analysisId:n,timestamp:new Date().toISOString()})}function emitSessionStopped(n){dispatchClaraEvent("clara:session-stopped",{analysisId:n,timestamp:new Date().toISOString()})}const ClaraDashboard=({onStartSession:n,onLogout:e,primaryColor:i})=>{const{config:s,accessToken:r,templates:a,currentTemplate:o,formData:l,userProfile:u,remoteSessionActive:c,remoteSessionInfo:f,setTemplates:p,setCurrentTemplate:d,setUserProfile:m}=useClaraStore(),P=s.lang||"es",T=!!s.templateId,[x,y]=React.useState("consulta"),[C,g]=React.useState(!1),[S,E]=React.useState(!1),[A,M]=React.useState(!1),[b,F]=React.useState(!1),[G,L]=React.useState(!1),[D,U]=React.useState(null),[z,O]=React.useState(null);o!=null&&o.name||s.templateId||t("dashboard.selectTemplate",P),React.useEffect(()=>{(async()=>{var R,N,H,J;if(!claraApi.hasAuth())if(s.apiKey)claraApi.setApiKey(s.apiKey);else if(r)claraApi.setAccessToken(r);else{console.log("[Dashboard] No auth available, loading demo template from API"),M(!0);try{const $=await getDemoTemplate(s.demoTemplate,s.apiKey||void 0,r||void 0);$&&(d($),console.log("[Dashboard] Loaded demo template:",$.name))}catch($){console.error("[Dashboard] Error loading demo template:",$)}finally{M(!1)}return}M(!0);try{const $=await claraApi.fetchUserProfile();console.log("[Dashboard] Raw profile response:",JSON.stringify($,null,2)),$&&(m($),console.log("[Dashboard] User profile settings:",$.settings));const W=await claraApi.fetchTemplates();if(W&&W.length>0){p(W),console.log("[Dashboard] Templates loaded:",W.length);const Z=s.templateId||((R=$==null?void 0:$.settings)==null?void 0:R.selectedTemplateId);if(console.log("[Dashboard] Template selection - config:",s.templateId,"settings:",(N=$==null?void 0:$.settings)==null?void 0:N.selectedTemplateId,"using:",Z),Z){const ie=W.find(ge=>ge.id===Z);if(ie)d(ie),console.log("[Dashboard] Selected template:",ie.name);else{console.log("[Dashboard] Template not found:",Z,"loading demo template from API");const ge=await getDemoTemplate(s.demoTemplate,s.apiKey||void 0,r||void 0);ge&&d(ge)}}else{const ie=await getDemoTemplate(s.demoTemplate,s.apiKey||void 0,r||void 0);ie&&(d(ie),console.log("[Dashboard] No template configured, using demo:",ie.name))}}else{console.log("[Dashboard] No templates from API, loading demo template");const Z=await getDemoTemplate(s.demoTemplate,s.apiKey||void 0,r||void 0);Z&&d(Z)}}catch($){console.error("[Dashboard] Error loading data:",$),((H=$==null?void 0:$.message)!=null&&H.includes("401")||(J=$==null?void 0:$.message)!=null&&J.toLowerCase().includes("invalid api key"))&&F(!0),console.log("[Dashboard] Falling back to demo template due to error");try{const W=await getDemoTemplate(s.demoTemplate,s.apiKey||void 0,r||void 0);W&&d(W)}catch(W){console.error("[Dashboard] Failed to load fallback demo template:",W)}}finally{M(!1)}})()},[s.apiKey,s.templateId,s.demoTemplate,r,p,d,m]),React.useEffect(()=>{!s.templateId&&!s.apiKey&&(async()=>{M(!0);try{const R=await getDemoTemplate(s.demoTemplate);R&&(d(R),console.log("[Dashboard] Demo template changed to:",R.name))}catch(R){console.error("[Dashboard] Error loading demo template:",R)}finally{M(!1)}})()},[s.demoTemplate]);const _=async()=>{L(!0),O(null),U({phase:"analyzing",percentage:0,message:"Iniciando..."});const k=await generateTemplateFromPage(R=>{U(R)});k&&(O(k),await I(k))},I=async k=>{console.log("[Dashboard] Saving generated template:",k),U({phase:"saving",percentage:90,message:"Guardando template..."});try{const R={name:k.name||"Template Generado",description:k.description||"Generado automáticamente desde la página",structure:k.structure};console.log("[Dashboard] Template payload:",R);const N=await claraApi.createTemplate(R);if(console.log("[Dashboard] Saved template response:",N),N)p([...a,N]),d(N),U({phase:"complete",percentage:100,message:"Template guardado exitosamente"}),setTimeout(()=>{L(!1),U(null),O(null)},1500);else throw new Error("No se pudo guardar el template")}catch(R){console.error("[Dashboard] Error saving template:",R),U({phase:"error",percentage:0,message:R instanceof Error?R.message:"Error al guardar"})}},V=()=>{switch(x){case"consulta":const k=A,R=!k&&!!o&&!c;return jsxRuntime.jsxs(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:[c&&f&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-4 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 w-full max-w-xs",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[jsxRuntime.jsx(Radio,{className:"w-4 h-4 animate-pulse"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:"Consulta en proceso"})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-amber-600/80 mt-1",children:f.templateName||"Otra sesión está activa"})]}),jsxRuntime.jsx("div",{className:"mb-5 relative",children:jsxRuntime.jsxs("div",{className:"w-24 h-24 rounded-full bg-secondary flex items-center justify-center shadow-inner relative",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center z-10 opacity-10",style:{backgroundColor:i}}),jsxRuntime.jsx("div",{className:"absolute z-20",children:jsxRuntime.jsx(Mic,{className:"w-8 h-8",style:{color:c?"#d97706":i}})}),jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse-ring opacity-20",style:{backgroundColor:c?"#d97706":i}})]})}),jsxRuntime.jsx("h3",{className:"text-foreground text-base font-semibold mb-1",children:t(c?"session.recording":"dashboard.newConsultation",P)}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-xs mb-6 px-4",children:k?t("common.loading",P):c?t("session.recording",P):""}),jsxRuntime.jsxs("button",{onClick:n,disabled:!R,className:`w-full max-w-xs font-medium py-3 px-5 rounded-xl shadow-button flex items-center justify-center gap-2.5 transition-all mb-5 text-sm ${R?"text-white bg-clara-dark hover:brightness-110 active:scale-95":"bg-clara-dark/60 text-white/80 cursor-not-allowed"}`,children:[k?jsxRuntime.jsx(LoaderCircle,{className:"w-4 h-4 animate-spin"}):c?jsxRuntime.jsx(Radio,{className:"w-4 h-4"}):jsxRuntime.jsx(Mic,{className:"w-4 h-4"}),t(c?"session.recording":"dashboard.startSession",P)]}),!T&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>!k&&E(!0),disabled:k,className:`group flex items-center gap-2.5 bg-card border border-border px-3 py-2 rounded-lg shadow-sm transition-all ${k?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-accent"}`,children:[jsxRuntime.jsx("div",{className:"p-1 rounded-md",style:{backgroundColor:`${i}1A`,color:i},children:k?jsxRuntime.jsx(LoaderCircle,{className:"w-3.5 h-3.5 animate-spin"}):jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"text-left",children:[jsxRuntime.jsx("p",{className:"text-[9px] uppercase text-muted-foreground font-bold tracking-wider",children:t("dashboard.templates",P)}),jsxRuntime.jsx("p",{className:"text-xs font-medium text-foreground truncate max-w-[100px]",children:k?t("common.loading",P):(o==null?void 0:o.name)||t("dashboard.selectTemplate",P)})]}),!k&&jsxRuntime.jsx(ChevronDown,{className:"w-3.5 h-3.5 text-muted-foreground"})]})})]});case"chat":return jsxRuntime.jsx(ClaraChat,{primaryColor:i})}},B=[{id:"consulta",label:t("dashboard.newConsultation",P),icon:Mic},{id:"chat",label:t("tabs.chat",P),icon:MessageSquare}];return jsxRuntime.jsxs("div",{className:"flex flex-col h-full bg-card relative",children:[jsxRuntime.jsxs("div",{className:"px-4 py-4 border-b border-border flex items-center justify-between bg-card z-10",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("img",{src:claraLogo,alt:"Clara",className:"h-5 w-auto"}),jsxRuntime.jsx("span",{className:"text-[9px] text-muted-foreground font-medium uppercase tracking-wider ml-1",children:"CLARA FORM v1.0.3"})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:()=>g(!C),className:"text-muted-foreground hover:text-foreground p-1 rounded-full hover:bg-secondary transition-colors",children:jsxRuntime.jsx(Settings,{className:"w-4 h-4"})}),jsxRuntime.jsx(AnimatePresence,{children:C&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},className:"absolute right-0 mt-2 w-44 bg-card rounded-lg shadow-widget border border-border py-1 z-50",children:[!T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>{E(!0),g(!1)},className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"}),t("dashboard.templates",P)]}),jsxRuntime.jsxs("button",{onClick:()=>{_(),g(!1)},className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(Sparkles,{className:"w-3.5 h-3.5"}),t("dashboard.generate",P)]})]}),jsxRuntime.jsxs("a",{href:"https://clara.care",target:"_blank",rel:"noreferrer",className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(ExternalLink,{className:"w-3.5 h-3.5"}),"Ir a Clara.care"]}),jsxRuntime.jsx("div",{className:"border-t border-border my-1"}),jsxRuntime.jsxs("button",{onClick:e,className:"w-full text-left px-3 py-2 text-xs text-destructive hover:bg-destructive/10 flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(LogOut,{className:"w-3.5 h-3.5"}),t("dashboard.logout",P)]})]})})]})]}),x!=="consulta"&&jsxRuntime.jsx("div",{className:"px-3 mt-4 mb-2",children:jsxRuntime.jsx("div",{className:"bg-clara-dark text-white p-0.5 rounded-lg flex items-center justify-between shadow-lg",children:B.map(k=>jsxRuntime.jsxs("button",{onClick:()=>y(k.id),className:`flex-1 py-1.5 text-xs font-medium rounded-md flex items-center justify-center gap-1.5 transition-all ${x===k.id?"bg-card text-foreground shadow-sm":"text-gray-400 hover:text-white"}`,children:[jsxRuntime.jsx(k.icon,{className:"w-3.5 h-3.5"}),k.label]},k.id))})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:V()}),jsxRuntime.jsx(AnimatePresence,{children:S&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-3",children:jsxRuntime.jsxs(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full h-[80%] flex flex-col shadow-widget overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"p-3 border-b border-border flex justify-between items-center bg-secondary",children:[jsxRuntime.jsx("h3",{className:"font-bold text-sm text-foreground",children:t("dashboard.templates",P)}),jsxRuntime.jsx("button",{onClick:()=>E(!1),className:"p-1 rounded-full hover:bg-muted text-muted-foreground transition-colors",children:jsxRuntime.jsx(X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:A?jsxRuntime.jsx("div",{className:"flex items-center justify-center py-8",children:jsxRuntime.jsx(LoaderCircle,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):a.length===0?jsxRuntime.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"No hay plantillas disponibles"}):a.map(k=>{const R=(o==null?void 0:o.id)===k.id;return jsxRuntime.jsxs("button",{onClick:async()=>{var N;d(k),emitTemplateChanged(k.id,k.name,((N=k.structure)==null?void 0:N.sections)||[]),E(!1),await claraApi.updateUserSettings({selectedTemplateId:k.id})},className:`w-full p-3 border rounded-lg cursor-pointer transition-all flex justify-between items-center ${R?"shadow-sm":"border-border hover:bg-secondary"}`,style:R?{borderColor:i,backgroundColor:`${i}0D`}:{},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center ${R?"text-white":"bg-secondary text-muted-foreground"}`,style:R?{backgroundColor:i}:{},children:jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"text-left",children:[jsxRuntime.jsx("span",{className:`font-medium text-xs block ${R?"":"text-foreground"}`,style:R?{color:i}:{},children:k.name}),k.description&&jsxRuntime.jsx("span",{className:"text-[10px] text-muted-foreground line-clamp-1",children:k.description})]})]}),R&&jsxRuntime.jsx(Check,{className:"w-4 h-4",style:{color:i}})]},k.id)})})]})})}),jsxRuntime.jsx(AnimatePresence,{children:b&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-4",children:jsxRuntime.jsx(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full max-w-xs shadow-widget overflow-hidden",children:jsxRuntime.jsxs("div",{className:"p-5 flex flex-col items-center text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center mb-4",children:jsxRuntime.jsx(TriangleAlert,{className:"w-6 h-6 text-destructive"})}),jsxRuntime.jsx("h3",{className:"font-bold text-base text-foreground mb-2",children:"API Key Inválida"}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm mb-5",children:"La API Key proporcionada no es válida o ha expirado. Por favor verifica tu configuración."}),jsxRuntime.jsx("button",{onClick:()=>{F(!1),e()},className:"w-full py-2.5 px-4 rounded-lg bg-destructive text-white font-medium text-sm hover:brightness-110 transition-all",children:"Cerrar y Reintentar"})]})})})}),jsxRuntime.jsx(AnimatePresence,{children:G&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-4",children:jsxRuntime.jsxs(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full max-w-xs shadow-widget overflow-hidden relative",children:[jsxRuntime.jsx("button",{onClick:()=>{L(!1),U(null),O(null)},className:"absolute top-3 right-3 p-1 rounded-full hover:bg-secondary text-muted-foreground transition-colors z-10",children:jsxRuntime.jsx(X,{className:"w-4 h-4"})}),jsxRuntime.jsxs("div",{className:"p-5 flex flex-col items-center text-center",children:[(D==null?void 0:D.phase)==="complete"?jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-4",style:{backgroundColor:`${i}20`},children:jsxRuntime.jsx(Check,{className:"w-8 h-8",style:{color:i}})}):(D==null?void 0:D.phase)==="error"?jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-destructive/20",children:jsxRuntime.jsx(TriangleAlert,{className:"w-8 h-8 text-destructive"})}):jsxRuntime.jsx("div",{className:"w-24 h-24 mb-2",children:jsxRuntime.jsx(Lottie,{animationData:aiGeneratingAnimation,loop:!0,style:{width:"100%",height:"100%"}})}),jsxRuntime.jsx("h3",{className:"font-bold text-base text-foreground mb-2",children:(D==null?void 0:D.phase)==="complete"?t("generate.complete",P):(D==null?void 0:D.phase)==="error"?t("common.error",P):t("generate.title",P)}),D&&D.phase!=="error"&&jsxRuntime.jsxs("div",{className:"w-full mb-3",children:[jsxRuntime.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:jsxRuntime.jsx(motion.div,{className:"h-full rounded-full",style:{backgroundColor:i},initial:{width:0},animate:{width:`${D.percentage}%`},transition:{duration:.3}})}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[D.percentage,"%"]})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:(D==null?void 0:D.message)||t("generate.analyzing",P)}),z&&(D==null?void 0:D.phase)!=="saving"&&(D==null?void 0:D.phase)!=="complete"&&jsxRuntime.jsxs("div",{className:"w-full text-left mb-4 p-3 bg-secondary rounded-lg",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-foreground mb-1",children:z.name}),jsxRuntime.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[z.structure.sections.length," ",t("generate.sections",P),", "," ",z.structure.sections.reduce((k,R)=>k+R.fields.length,0)," ",t("generate.fields",P)]})]}),jsxRuntime.jsx("div",{className:"flex gap-2 w-full",children:(D==null?void 0:D.phase)==="error"?jsxRuntime.jsx("button",{onClick:()=>{L(!1),U(null),O(null)},className:"w-full py-2.5 px-4 rounded-lg bg-secondary text-foreground font-medium text-sm hover:bg-muted transition-all",children:t("common.close",P)}):(D==null?void 0:D.phase)==="complete"||(D==null?void 0:D.phase)==="saving"?null:jsxRuntime.jsx("button",{onClick:()=>{L(!1),U(null),O(null)},className:"w-full py-2.5 px-4 rounded-lg bg-secondary text-foreground font-medium text-sm hover:bg-muted transition-all",children:t("common.cancel",P)})})]})]})})})]})};var ViewState=(n=>(n.LOGIN="login",n.DASHBOARD="dashboard",n.SESSION="session",n))(ViewState||{}),SessionStatus=(n=>(n.CONNECTING="connecting",n.ACTIVE="active",n.PAUSED="paused",n.DISCONNECTED="disconnected",n.ERROR="error",n))(SessionStatus||{});function floatTo16BitPCM(n){const e=new ArrayBuffer(n.length*2),i=new DataView(e);let s=0;for(let r=0;r<n.length;r++,s+=2){let a=Math.max(-1,Math.min(1,n[r]));i.setInt16(s,a<0?a*32768:a*32767,!0)}return e}function arrayBufferToBase64(n){let e="";const i=new Uint8Array(n),s=i.byteLength;for(let r=0;r<s;r++)e+=String.fromCharCode(i[r]);return btoa(e)}function float32To16BitPCMBase64(n){return arrayBufferToBase64(floatTo16BitPCM(n))}function downsampleBuffer(n,e,i=16e3){if(e===i||e<i)return n;const s=e/i,r=Math.floor(n.length/s),a=new Float32Array(r);let o=0,l=0;for(;o<a.length;){const u=Math.round((o+1)*s);let c=0,f=0;for(let p=Math.round(l);p<u&&p<n.length;p++)c+=n[p],f++;a[o]=f>0?c/f:0,o++,l=u}return a}const extractJson=n=>{if(n!==null&&typeof n=="object")return n;if(typeof n!="string"||!n.trim())return null;const e=n.trim();try{return JSON.parse(e)}catch{}try{const i=e.replace(/^```(?:json)?\s*/i,"").replace(/\s*```$/i,"").trim();if(i!==e)return JSON.parse(i)}catch{}try{const i=e.match(/\{[\s\S]*\}/);if(i)return JSON.parse(i[0])}catch{}try{const i=e.match(/\[[\s\S]*\]/);if(i)return JSON.parse(i[0])}catch{}try{const i=e.replace(/\\"/g,'"').replace(/\\n/g,`
392
+ `);if(i!==e)return JSON.parse(i)}catch{}try{const i=e.match(/(?:updates\s*:\s*)(\[[\s\S]*\])/i);if(i&&i[1])return JSON.parse(i[1])}catch{}return null},WORKLET_CODE=`
393
+ class PCMProcessor extends AudioWorkletProcessor {
394
+ process(inputs, outputs, parameters) {
395
+ const input = inputs[0];
396
+ if (input && input.length > 0 && input[0].length > 0) {
397
+ const float32Tensor = input[0];
398
+ this.port.postMessage(float32Tensor.slice());
399
+ }
400
+ return true;
401
+ }
402
+ }
403
+ registerProcessor('pcm-processor', PCMProcessor);
404
+ `,useGeminiLive=({geminiApiKey:n,onDataExtracted:e,onTranscriptUpdate:i,onTitleUpdate:s,onUsageUpdate:r,selectedMicId:a,isAutopilot:o=!1,voiceName:l="Kore",style:u="formal",speechSpeed:c="normal",sections:f=[],pricingConfig:p={inputCostPer1M:.075,outputCostPer1M:.3}})=>{const[d,m]=React.useState(!1),[P,T]=React.useState(!1),[x,y]=React.useState(!1),[C,g]=React.useState(null),[S,E]=React.useState(0),[A,M]=React.useState(!1),{setConnected:b}=useClaraStore(),F=React.useRef(null),G=React.useRef(null),L=React.useRef(null),D=React.useRef(null),U=React.useRef([]),z=React.useRef(0),O=4096,_=React.useRef(null),I=React.useRef(null),V=React.useRef(!1),B=React.useRef({inputTokens:0,outputTokens:0,totalTokens:0,estimatedCost:0}),k=React.useRef(f),R=React.useRef(e),N=React.useRef(i),H=React.useRef(s),J=React.useRef(r);React.useEffect(()=>{k.current=f,R.current=e,N.current=i,H.current=s,J.current=r},[f,e,i,s,r]);const $=React.useCallback((ee,Q)=>{const te=ee/1e6*p.inputCostPer1M,ye=Q/1e6*p.outputCostPer1M;return te+ye},[p]),W=React.useRef(!1),Z=React.useRef(!1),ie=React.useCallback(async()=>{var ee,Q;if(!W.current){if(W.current=!0,Z.current=!1,console.log("[Gemini Live] Cleaning up..."),L.current){L.current.port.onmessage=null;try{L.current.disconnect()}catch{}L.current=null}if(D.current){try{D.current.disconnect()}catch{}D.current=null}if(G.current&&(G.current.getTracks().forEach(te=>te.stop()),G.current=null),U.current=[],z.current=0,I.current=null,B.current={inputTokens:0,outputTokens:0,totalTokens:0,estimatedCost:0},_.current){const te=_.current;_.current=null;try{await te.close()}catch(ye){console.warn("[Gemini Live] Session close error",ye)}}if(((ee=F.current)==null?void 0:ee.state)!=="closed")try{await((Q=F.current)==null?void 0:Q.close())}catch{}F.current=null,T(!1),b(!1),E(0),W.current=!1}},[b]),ge=React.useCallback(ee=>{var de,Ve,Pe;if(!Z.current||V.current)return;let Q=0;for(let oe=0;oe<ee.length;oe++)Q+=ee[oe]*ee[oe];const te=Math.sqrt(Q/ee.length);E(Math.min(1,te*8));const ye=((de=F.current)==null?void 0:de.sampleRate)||16e3;let le=ee;ye!==16e3&&(le=downsampleBuffer(ee,ye,16e3));const fe=float32To16BitPCMBase64(le),Se=_.current;if(Se)try{Se.sendRealtimeInput({media:{mimeType:"audio/pcm;rate=16000",data:fe}})}catch(oe){((Ve=oe.message)!=null&&Ve.includes("CLOSING")||(Pe=oe.message)!=null&&Pe.includes("CLOSED"))&&(console.warn("[Gemini Live] 🛑 Socket closed while sending. Stopping loop."),Z.current=!1)}},[]),ve=React.useCallback(async()=>{var ee,Q;if(!x){y(!0),g(null),await ie();try{console.log("[Gemini Live] 🔐 Getting Gemini token from ephemeralTokenManager...");let te=ephemeralTokenManager.getToken();if(te||(console.log("[Gemini Live] ⚠️ No Gemini token, attempting to initialize..."),await ephemeralTokenManager.initialize()&&(te=ephemeralTokenManager.getToken())),!te&&n&&(console.log("[Gemini Live] ⚠️ Using geminiApiKey prop as fallback"),te=n),!te)throw new Error("No se pudo obtener credenciales de Gemini. Verifica tu autenticación.");console.log("[Gemini Live] ✅ Gemini token obtained"),console.log("[Gemini Live] Connecting with lazy-loading schema strategy...");const ye=window.AudioContext||window.webkitAudioContext,le=new ye({sampleRate:16e3});le.state==="suspended"&&await le.resume(),F.current=le;const fe=new GoogleGenAI({apiKey:te}),Se=k.current.map(q=>{const j=q.fields.slice(0,8).map(pe=>pe.label||pe.id).join(", "),Y=q.fields.length>8?"...":"";return`- "${q.key}" (${q.label}): ${j}${Y}`}).join(`
405
+ `);let de="";switch(u){case"empathetic":de="Empático y cálido.";break;case"direct":de="Directo y conciso.";break;case"formal":default:de="Profesional y clínico.";break}const Pe=`
406
+ Eres Clara, asistente médica silenciosa. ${o?"Modo autopilot: puedes hacer preguntas breves.":"NO HABLES NUNCA."}
407
+ ${de} ${c==="fast"?"Habla rápido.":c==="slow"?"Habla lento.":""}
408
+
409
+ SECCIONES: ${Se}
410
+
411
+ REGLA ABSOLUTA: ${o?"Solo habla para preguntar datos que faltan. Máximo 5 palabras.":"NO EMITAS NINGÚN SONIDO. SILENCIO TOTAL. Solo usa herramientas."}
412
+
413
+ COMPORTAMIENTO:
414
+ - NUNCA saludes, NUNCA anuncies acciones, NUNCA confirmes, NUNCA agradezcas.
415
+ - Si escuchas datos, llama getSectionDetails y updateReport SILENCIOSAMENTE.
416
+ - setAnalysisTitle: úsala cuando tengas contexto.
417
+
418
+ FLUJO: Escuchar → getSectionDetails → updateReport. TODO EN SILENCIO.
419
+ `.trim();console.log(`[Gemini Live] SYSTEM INSTRUCTION (Length: ${Pe.length})`);const oe=[{functionDeclarations:[{name:"getSectionDetails",description:"Get detailed fields for a form section. Call this before updating fields in that section.",parameters:{type:Type.OBJECT,properties:{sectionId:{type:Type.STRING,description:"Section ID from available sections."}},required:["sectionId"]}},{name:"updateReport",description:"Update fields in the medical report. Use exact fieldId from getSectionDetails.",parameters:{type:Type.OBJECT,properties:{updates:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{fieldId:{type:Type.STRING,description:"Exact htmlFieldId from schema."},value:{type:Type.STRING,description:"Value to set."},reason:{type:Type.STRING,description:"Quote from conversation."}},required:["fieldId","value"]}}},required:["updates"]}},{name:"setAnalysisTitle",description:"Set the analysis title.",parameters:{type:Type.OBJECT,properties:{title:{type:Type.STRING,description:"Title for the analysis."}},required:["title"]}}]}],Me=await fe.live.connect({model:"gemini-2.5-flash-native-audio-preview-09-2025",config:{responseModalities:[Modality.AUDIO],systemInstruction:{parts:[{text:Pe}]},tools:oe,inputAudioTranscription:{},outputAudioTranscription:{}},callbacks:{onopen:()=>{console.log("[Gemini Live] ✅ Session opened (Handshake complete)"),T(!0),b(!0),y(!1),Z.current=!0},onmessage:async q=>{var xe,me,we,Ge,Fe,se,be,Ce,He,qe,$e,ze,Je,We;console.log("[Gemini Live] 📨 Full message:",JSON.stringify(q,null,2)),q.toolCallCancellation&&console.error("[Gemini Live] ❌ Tool call CANCELLED");const j=q.usageMetadata||((xe=q.serverContent)==null?void 0:xe.usageMetadata)||((we=(me=q.serverContent)==null?void 0:me.modelTurn)==null?void 0:we.usageMetadata);if((q.usageMetadata||(Ge=q.serverContent)!=null&&Ge.usageMetadata)&&console.log("[Gemini Live] 📊 Message keys:",Object.keys(q)),j){console.log("[Gemini Live] 📊 Usage metadata found:",j);const Be=j.promptTokenCount||0,De=j.totalTokenCount||0,ae=j.candidatesTokenCount||Math.max(0,De-Be);De>0&&De>=B.current.totalTokens&&(B.current.inputTokens=Be,B.current.outputTokens=ae,B.current.totalTokens=De,B.current.estimatedCost=$(Be,ae),console.log("[Gemini Live] 📊 Session usage UPDATED:",B.current),J.current&&setTimeout(()=>{var Ee;return(Ee=J.current)==null?void 0:Ee.call(J,{...B.current})},0))}const Y=(se=(Fe=q.serverContent)==null?void 0:Fe.inputTranscription)==null?void 0:se.text,pe=(Ce=(be=q.serverContent)==null?void 0:be.outputTranscription)==null?void 0:Ce.text;if(Y||pe){const Be=Y?"user":"model",De=Y||pe||"",ae=I.current&&I.current.role===Be;let Ee="",re="";if(ae&&I.current?(I.current.content+=De,re=I.current.content,Ee=I.current.id):(Ee=Date.now().toString(),re=De,I.current={role:Be,content:re,timestamp:new Date,id:Ee}),N.current){const Ae={role:Be,content:re,timestamp:((He=I.current)==null?void 0:He.timestamp)||new Date,id:Ee};setTimeout(()=>{var ue;(ue=N.current)==null||ue.call(N,Ae)},0)}}if(((qe=q.serverContent)!=null&&qe.turnComplete||($e=q.serverContent)!=null&&$e.interrupted)&&(I.current=null),q.toolCall){const Be=[],De=q.toolCall.functionCalls||[];for(const ae of De)if(ae.name==="getSectionDetails"){const Ee=(ze=ae.args)==null?void 0:ze.sectionId,re=k.current.find(Ae=>Ae.key===Ee);if(re){console.log(`[Gemini Live] 📥 Loading section schema: ${Ee}`);const Ae={id:re.key,title:re.label,description:re.description||"",keywords:re.keywords||[],fields:re.fields.map(ue=>{const _e={id:ue.id,htmlFieldId:ue.htmlFieldId||ue.id,label:ue.label,type:ue.type,description:ue.description||"",keywords:ue.keywords||[]};return ue.type==="select"&&ue.options&&(_e.options=ue.options,_e.instruction='MUST use EXACT value from options list. Normalize variants (e.g., "pre ingreso" → "PREINGRESO").'),ue.type==="checkbox"&&(_e.instruction='Set "true" only if EXPLICITLY mentioned. Otherwise leave empty. NEVER assume.'),_e}),CRITICAL:"NEVER invent or assume information. Only fill fields with data EXPLICITLY stated in the conversation. If not mentioned, DO NOT fill.",note:"SELECT: use EXACT option value. CHECKBOX: 'true' only if explicitly confirmed, otherwise leave empty."};console.log({id:ae.id,name:ae.name,response:{result:JSON.stringify(Ae)}}),Be.push({id:ae.id,name:ae.name,response:{result:JSON.stringify(Ae)}})}else console.warn(`[Gemini Live] ⚠️ Section not found: ${Ee}`),Be.push({id:ae.id,name:ae.name,response:{result:"Section not found. Check available sections."}})}else if(ae.name==="setAnalysisTitle"){const Ee=(Je=ae.args)==null?void 0:Je.title;Ee&&H.current&&setTimeout(()=>{var re;return(re=H.current)==null?void 0:re.call(H,Ee)},0),Be.push({id:ae.id,name:ae.name,response:{result:"Title updated"}})}else if(ae.name==="updateReport"){let Ee=(We=ae.args)==null?void 0:We.updates;console.log("[Gemini Live] 🔧 updateReport raw args:",JSON.stringify(ae.args));const re=extractJson(Ee);console.log("[Gemini Live] 🔧 updateReport parsed:",JSON.stringify(re));const Ae=[];if(Array.isArray(re))for(const ue of re){const _e=extractJson(ue)||ue;console.log("[Gemini Live] 🔧 Processing item:",JSON.stringify(_e)),_e&&typeof _e=="object"&&_e.fieldId&&_e.value!==void 0?Ae.push({fieldId:String(_e.fieldId),value:_e.value,confidence:.9,source:"audio_live",reason:_e.reason||"Extracted from conversation"}):console.warn("[Gemini Live] ⚠️ Invalid item (missing fieldId/value):",JSON.stringify(_e))}else re&&typeof re=="object"?(console.log("[Gemini Live] 🔧 Single object update:",JSON.stringify(re)),re.fieldId&&re.value!==void 0?Ae.push({fieldId:String(re.fieldId),value:re.value,confidence:.9,source:"audio_live",reason:re.reason||"Extracted from conversation"}):console.warn("[Gemini Live] ⚠️ Invalid object (missing fieldId/value):",JSON.stringify(re))):console.warn("[Gemini Live] ⚠️ parsedUpdates is not array or object:",typeof re);Ae.length>0&&R.current?(console.log(`[Gemini Live] 📝 Updating ${Ae.length} fields:`,Ae.map(ue=>`${ue.fieldId}=${ue.value}`).join(", ")),setTimeout(()=>{var ue;return(ue=R.current)==null?void 0:ue.call(R,Ae)},0)):console.warn("[Gemini Live] ⚠️ No valid updates extracted from updateReport call"),Be.push({id:ae.id,name:ae.name,response:{result:"Fields updated",count:Ae.length}})}else Be.push({id:ae.id,name:ae.name,response:{result:"Acknowledged"}});if(_.current&&Be.length>0)try{_.current.sendToolResponse({functionResponses:Be})}catch(ae){console.error("[Gemini Live] ❌ Error sending tool responses:",ae)}}},onclose:q=>{W.current||(console.log("[Gemini Live] Session closed unexpectedly",q),T(!1),b(!1),y(!1),q.code===1011&&g("Payload too large. Contact support."))},onerror:q=>{var j,Y;console.error("[Gemini Live] ❌ SESSION ERROR:",q),((j=q.message)!=null&&j.includes("Fatal")||(Y=q.message)!=null&&Y.includes("Close"))&&(g("Connection error"),T(!1),b(!1))}}});_.current=Me,console.log("[Gemini Live] Session created, waiting for onopen...");const Le=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:16e3,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0,deviceId:a?{exact:a}:void 0}});G.current=Le;const Ie=new Blob([WORKLET_CODE],{type:"application/javascript"}),ke=URL.createObjectURL(Ie);try{await le.audioWorklet.addModule(ke)}catch{throw new Error("Failed to load audio processor")}finally{URL.revokeObjectURL(ke)}const Ue=le.createMediaStreamSource(Le),Ne=new AudioWorkletNode(le,"pcm-processor");Ne.port.onmessage=q=>{if(!Z.current)return;const j=q.data;if(U.current.push(j),z.current+=j.length,z.current>=O){if(!Z.current){U.current=[],z.current=0;return}const Y=new Float32Array(z.current);let pe=0;for(const xe of U.current)Y.set(xe,pe),pe+=xe.length;ge(Y),U.current=[],z.current=0}},Ue.connect(Ne);const Oe=le.createGain();Oe.gain.value=0,Ne.connect(Oe),Oe.connect(le.destination),D.current=Ue,L.current=Ne}catch(te){console.error("[Gemini Live] Connection failed",te),y(!1),T(!1),b(!1),(ee=te.message)!=null&&ee.includes("401")||(Q=te.message)!=null&&Q.includes("API Key")?(g("Invalid API Key"),m(!1)):g("Connection failed")}}},[ie,ge,x,n,a,o,u,c,b]);React.useEffect(()=>{let ee;return d&&!P&&!x&&(ee=setTimeout(()=>{ve()},500)),()=>{ee&&clearTimeout(ee)}},[d,P,x,ve]);const ce=React.useCallback(()=>{m(!0)},[]),Te=React.useCallback(()=>{m(!1),ie()},[ie]),ne=React.useCallback(()=>{M(ee=>{const Q=!ee;return V.current=Q,G.current&&G.current.getAudioTracks().forEach(te=>{te.enabled=!Q}),Q&&E(0),Q})},[]),K=React.useCallback(ee=>{if(_.current)try{_.current.sendRealtimeInput({clientContent:{turns:[{parts:[{text:ee}],role:"user"}],turnComplete:!0}})}catch(Q){console.error("[Gemini Live] Failed to send text",Q)}},[]),he=React.useCallback(()=>({...B.current}),[]);return{isRecording:d,isConnected:P,isConnecting:x,isPaused:A,error:C,audioLevel:S,startRecording:ce,stopRecording:Te,togglePause:ne,sendText:K,getSessionUsage:he}};function useDebouncedFormDataSync(n,e=500,i){const s=React.useRef(null),r=React.useRef(null),a=React.useRef(!1);React.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const o=React.useCallback(async()=>{if(r.current&&(clearTimeout(r.current),r.current=null),s.current&&n&&!a.current){a.current=!0;const u=s.current;s.current=null;try{console.log("[DebouncedSync] Flushing formData to backend");const c=i==null?void 0:i();await claraApi.updateFormData(n,u.formData,u.documentChanges,u.chatHistory,c)}catch(c){console.error("[DebouncedSync] Error flushing formData:",c)}finally{a.current=!1}}},[n,i]);return{queueSync:React.useCallback((u,c,f)=>{var p,d,m;n&&(s.current={formData:{...(p=s.current)==null?void 0:p.formData,...u},documentChanges:c||((d=s.current)==null?void 0:d.documentChanges),chatHistory:f||((m=s.current)==null?void 0:m.chatHistory)},r.current&&clearTimeout(r.current),r.current=setTimeout(async()=>{if(!s.current||!n||a.current)return;a.current=!0;const P=s.current;s.current=null;try{console.log("[DebouncedSync] Syncing formData to backend");const T=i==null?void 0:i();console.log("[DebouncedSync] 📊 Got usageStats:",T),await claraApi.updateFormData(n,P.formData,P.documentChanges,P.chatHistory,T)}catch(T){console.error("[DebouncedSync] Error syncing formData:",T),s.current=P}finally{a.current=!1}},e))},[n,e,i]),flush:o}}function setNativeValue(n,e){var o;const i=String(e),s=Object.getPrototypeOf(n),r=Object.getOwnPropertyDescriptor(s,"value"),a=Object.getOwnPropertyDescriptor(n,"value");r&&(a==null?void 0:a.set)!==r.set?(o=r.set)==null||o.call(n,i):a!=null&&a.set?a.set.call(n,i):n.value=i}function dispatchInputEvents(n){try{n.focus()}catch{}try{const e=new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n.value});n.dispatchEvent(e)}catch{n.dispatchEvent(new Event("input",{bubbles:!0}))}n.dispatchEvent(new Event("change",{bubbles:!0})),n.dispatchEvent(new Event("blur",{bubbles:!0})),triggerReactInputTracker(n)}function triggerReactInputTracker(n){try{const e=n._valueTracker;e&&e.setValue("")}catch{}}function findField(n,e,i=document){var l,u,c;const s=i.getElementById(n);if(s&&isFormElement(s))return s;const r=[];try{r.push(`#${CSS.escape(n)}`)}catch{try{r.push(`[id="${n}"]`)}catch{}}if(r.push(`[name="${n}"]`,`[data-field="${n}"]`,`[data-id="${n}"]`,`[data-clara-field-id="${n}"]`,`input[id="${n}"]`,`select[id="${n}"]`,`textarea[id="${n}"]`),n.includes("__")){const f=n.split("__"),p=f[f.length-1];r.push(`[id$="__${p}"]`,`[name$="__${p}"]`,`[data-field$="__${p}"]`)}let a=null;if(e){const f=[`[data-section="${e}"]`,`[data-clara-section-key="${e}"]`,`#${e}`,`fieldset[data-section="${e}"]`,`.section-${e}`];for(const p of f){const d=i.querySelector(p);if(d)for(const m of r)try{if(a=d.querySelector(m),a&&isFormElement(a))return a}catch{}}}for(const f of r)try{if(a=i.querySelector(f),a&&isFormElement(a))return a}catch{}const o=i.querySelectorAll("input, select, textarea");for(const f of o){const p=f;if(p.id===n||p.name===n||((l=p.dataset)==null?void 0:l.field)===n||((u=p.dataset)==null?void 0:u.id)===n||((c=p.dataset)==null?void 0:c.claraFieldId)===n)return p}return null}function isFormElement(n){const e=n.tagName.toLowerCase();return e==="input"||e==="select"||e==="textarea"}function performLocalFill(n,e,i){var s;try{e==null&&(e=""),console.log("[Clara DOM] 🎯 Filling field:",{fieldName:n,value:e,sectionKey:i,type:typeof e});const r=document.querySelectorAll("input, select, textarea");if(console.log("[Clara DOM] 📋 Total fields in document:",r.length),r.length<50){const c=Array.from(r).map(f=>{const p=f;return`${p.tagName}#${p.id||"(no-id)"}[name=${p.name||"(no-name)"}]`});console.log("[Clara DOM] 📋 Fields:",c)}let a=findField(n,i,document),o=a?"document":"not-found";if(a&&console.log("[Clara DOM] 📍 Found in main document:",a.tagName,a.id||a.name,"type:",a.type),!a){const c=document.getElementsByTagName("iframe");console.log("[Clara DOM] 🔍 Checking",c.length,"iframes...");for(let f=0;f<c.length;f++)try{const p=c[f].contentDocument||((s=c[f].contentWindow)==null?void 0:s.document);if(p){const d=p.querySelectorAll("input, select, textarea");if(console.log(`[Clara DOM] 🔍 Iframe ${f} has ${d.length} fields`),a=findField(n,i,p),a){o="iframe",console.log("[Clara DOM] 📍 Found in iframe:",f,a.tagName,a.id);break}}}catch{console.log(`[Clara DOM] 🔍 Iframe ${f} is cross-origin, will broadcast`)}}if(!a)return console.warn("[Clara DOM] ❌ Field not found locally:",n),{success:!1,fieldId:n,value:e,foundIn:"not-found"};try{const c=a.style.borderColor,f=a.style.boxShadow;a.style.transition="all 0.3s ease",a.style.borderColor="#8b5cf6",a.style.boxShadow="0 0 0 4px rgba(139, 92, 246, 0.2)",setTimeout(()=>{try{a&&(a.style.borderColor=c||"",a.style.boxShadow=f||"")}catch(p){console.warn("[Clara DOM] Visual feedback cleanup error:",p)}},1e3)}catch(c){console.warn("[Clara DOM] Visual feedback error:",c)}const l=a.tagName.toLowerCase(),u=(a.type||"").toLowerCase();try{l==="select"?fillSelect(a,e):u==="checkbox"?fillCheckbox(a,e):u==="radio"?fillRadio(a,e):setNativeValue(a,String(e))}catch(c){return console.error("[Clara DOM] ❌ Fill error for",l,u,":",c),{success:!1,fieldId:n,value:e,foundIn:o}}return dispatchInputEvents(a),console.log("[Clara DOM] ✅ Field filled:",n,"=",e),{success:!0,fieldId:n,value:e,foundIn:o}}catch(r){return console.error("[Clara DOM] ❌ Unexpected error in performLocalFill:",r),{success:!1,fieldId:n,value:e,foundIn:"not-found"}}}function fillSelect(n,e){const i=String(e).toLowerCase().trim();let s=-1;console.log("[Clara DOM] 🔽 Filling SELECT:",n.id||n.name,"with value:",e),console.log("[Clara DOM] 🔽 Available options:",Array.from(n.options).map(r=>`${r.value} (${r.text})`));for(let r=0;r<n.options.length;r++)if(n.options[r].value.toLowerCase().trim()===i){s=r,console.log("[Clara DOM] 🔽 Exact value match found at index:",r);break}if(s===-1){for(let r=0;r<n.options.length;r++)if(n.options[r].text.toLowerCase().trim()===i){s=r,console.log("[Clara DOM] 🔽 Exact text match found at index:",r);break}}if(s===-1)for(let r=0;r<n.options.length;r++){const a=n.options[r];if(a.text.toLowerCase().includes(i)||i.includes(a.text.toLowerCase().trim())){s=r,console.log("[Clara DOM] 🔽 Partial match found at index:",r,"- option:",a.text);break}}s!==-1?(n.selectedIndex=s,console.log("[Clara DOM] ✅ SELECT set to index:",s,"- value:",n.value)):(n.value=String(e),console.warn("[Clara DOM] ⚠️ No option match for SELECT, tried direct value:",e))}function fillCheckbox(n,e){let i;if(typeof e=="boolean")i=e;else{const s=String(e).toLowerCase().trim();i=["si","sí","yes","true","1","on","checked"].includes(s)}if(console.log("[Clara DOM] ☑️ Filling CHECKBOX:",n.id||n.name),console.log("[Clara DOM] ☑️ Input value:",e,"-> shouldCheck:",i),console.log("[Clara DOM] ☑️ Current checked state:",n.checked),n.checked===i){console.log("[Clara DOM] ☑️ Already in correct state, skipping");return}try{const s=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"checked");s&&s.set?s.set.call(n,i):n.checked=i,console.log("[Clara DOM] ☑️ After native set, checked:",n.checked);const r=new Event("change",{bubbles:!0,cancelable:!1});n.dispatchEvent(r);const a=new Event("input",{bubbles:!0,cancelable:!1});n.dispatchEvent(a),console.log("[Clara DOM] ☑️ Events dispatched, final checked:",n.checked)}catch(s){console.error("[Clara DOM] ❌ Checkbox fill error:",s)}}function fillRadio(n,e){const s=(n.closest("form")||n.ownerDocument).querySelectorAll(`input[name="${n.name}"]`),r=String(e).toLowerCase().trim();console.log("[Clara DOM] 🔘 Filling RADIO group:",n.name,"with value:",e),console.log("[Clara DOM] 🔘 Found",s.length,"radio buttons in group");let a=!1;s.forEach(o=>{const l=o;console.log("[Clara DOM] 🔘 Checking radio value:",l.value,"against:",r),l.value.toLowerCase().trim()===r&&(l.checked=!0,l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0})),console.log("[Clara DOM] ✅ RADIO selected:",l.value),a=!0)}),a||console.warn("[Clara DOM] ⚠️ No matching radio found for value:",e)}function broadcastToIframes(n){var i;const e=document.getElementsByTagName("iframe");for(let s=0;s<e.length;s++)try{(i=e[s].contentWindow)==null||i.postMessage(n,"*")}catch{}}function broadcast(n,e){console.log(`[Clara DOM] Broadcasting ${n}`,e),n==="CLARA_CMD_FILL"&&performLocalFill(e.fieldName,e.value,e.sectionKey),n==="CLARA_CMD_ODONTO"&&window.dispatchEvent(new CustomEvent("odontograma:command",{detail:e.payload})),broadcastToIframes({type:n,...e})}function setupFieldListeners(n,e=document){e.querySelectorAll("input, textarea, select").forEach(s=>{var l;const r=s;if((l=r.dataset)!=null&&l.claraListener)return;r.dataset.claraListener="true";const a=r.id||r.name;if(!a)return;const o=()=>{const u=r.closest("[data-section], [data-clara-section-key]");return u&&(u.dataset.section||u.dataset.claraSectionKey)||null};r.addEventListener("click",()=>{n({fieldId:a,action:"click",sectionKey:o()})}),r.addEventListener("focus",()=>{n({fieldId:a,action:"focus",sectionKey:o()})}),r.addEventListener("blur",()=>{const u=r.type==="checkbox"?r.checked:r.value;n({fieldId:a,action:"blur",value:u,sectionKey:o()})}),r.addEventListener("change",u=>{if(u.isTrusted){let c=r.value;if(r.type==="checkbox")c=r.checked;else if(r.type==="radio"&&!r.checked)return;n({fieldId:a,action:"change",value:c,sectionKey:o()})}})})}function setupSectionListeners(n,e=document){e.querySelectorAll("[data-section], fieldset").forEach(s=>{var a;const r=s;(a=r.dataset)!=null&&a.claraSectionListener||(r.dataset.claraSectionListener="true",r.dataset.section||r.id,r.addEventListener("click",o=>{const l=o.target;l===r||["LEGEND","H2","H3"].includes(l.tagName)}))})}function isInIframe(){try{return window!==window.top}catch{return!0}}function initClaraListener(){return window.__claraListenerActive?(console.log("[Clara Listener] Already active"),!0):(console.log("[Clara Listener] 🎧 Initializing on:",window.location.pathname),window.addEventListener("message",n=>{var i,s;const e=n.data;if(!(!e||typeof e!="object")&&(i=e.type)!=null&&i.startsWith("CLARA_")){if(console.log("[Clara Listener] 📨 Received:",e.type,e),e.type==="CLARA_CMD_FILL"){const r=performLocalFill(e.fieldName,e.value,e.sectionKey);console.log("[Clara Listener] Fill result:",r)}e.type==="CLARA_CMD_FILL_MULTIPLE"&&((s=e.fields)==null||s.forEach(r=>{performLocalFill(r.fieldId,r.value,r.sectionKey)})),e.type==="CLARA_CMD_ODONTO"&&window.dispatchEvent(new CustomEvent("odontograma:command",{detail:e.payload}))}}),window.addEventListener("clara:fill",n=>{const{fieldId:e,value:i,sectionKey:s}=n.detail;console.log("[Clara Listener] 🎯 Custom event fill:",e,i),performLocalFill(e,i,s)}),window.addEventListener("clara:fill-multiple",n=>{const{fields:e}=n.detail;e==null||e.forEach(i=>{performLocalFill(i.fieldId,i.value,i.sectionKey)})}),window.__claraListenerActive=!0,console.log("[Clara Listener] ✅ Active and listening"),!0)}function sendFillCommand(n,e,i){console.log("[Clara Fill] 📤 Sending fill command:",n,e);const s=performLocalFill(n,e,i);if(s.success)return console.log("[Clara Fill] ✅ Direct fill succeeded"),s;try{window.dispatchEvent(new CustomEvent("clara:fill",{detail:{fieldId:n,value:e,sectionKey:i}}))}catch(r){console.warn("[Clara Fill] Custom event failed:",r)}try{window.postMessage({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i},"*")}catch(r){console.warn("[Clara Fill] Self postMessage failed:",r)}if(broadcastToIframes({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i}),isInIframe())try{window.parent.postMessage({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i},"*")}catch(r){console.warn("[Clara Fill] Parent postMessage failed:",r)}return s}const ClaraActiveSession=({onEndSession:n,primaryColor:e,sessionControlRef:i})=>{var Ue,Ne,Oe;const[s,r]=React.useState("transcription"),[a,o]=React.useState(!0),[l,u]=React.useState(3),c=React.useRef(null),f=React.useRef(null),p=React.useRef(!1),d=React.useRef(null),m=React.useRef(null),P=React.useRef(new Date().toISOString()),{config:T,accessToken:x,currentTemplate:y,currentAnalysis:C,transcriptMessages:g,chatMessages:S,isAutopilot:E,speechSpeed:A,voiceStyle:M,formData:b,documentChanges:F,userStreamInfo:G,analysisStreamInfo:L,isS2Connected:D,usageStats:U,addTranscriptMessage:z,addChatMessage:O,updateFormData:_,setFormData:I,setAnalysisTitle:V,setCurrentAnalysis:B,setUserStreamInfo:k,setAnalysisStreamInfo:R,setS2Connected:N,setUsageStats:H,clearSessionData:J}=useClaraStore(),$=T.lang||"es",W=React.useRef(null),{queueSync:Z,flush:ie}=useDebouncedFormDataSync(C==null?void 0:C.id,500,()=>{var q;return((q=W.current)==null?void 0:q.call(W))??{inputTokens:0,outputTokens:0,totalTokens:0,estimatedCost:0}}),ge=React.useCallback(q=>{try{console.log("[Session] Data extracted:",q);const j={...b};q.forEach(Y=>{try{_(Y.fieldId,Y.value,"ai_tool",Y.reason||"AI extraction"),j[Y.fieldId]=Y.value,sendFillCommand(Y.fieldId,Y.value),emitFieldFilled(Y.fieldId,Y.value),L&&(C!=null&&C.id)&&sendAIFill(L,C.id,Y.fieldId,Y.value)}catch(pe){console.error("[Session] Error processing field:",Y.fieldId,pe)}}),Z(j),emitFormDataUpdated(j,void 0,q.map(Y=>Y.fieldId))}catch(j){console.error("[Session] ❌ Error in handleDataExtracted:",j)}},[_,b,L,Z]),ve=React.useCallback(q=>{console.log("[Session] Transcript:",q),z(q);const j=[...g,q];emitTranscriptUpdated(q.role,q.content,j.map(Y=>({role:Y.role,content:Y.content,timestamp:Y.timestamp.toISOString()}))),L&&sendTranscript(L,j.map(Y=>({role:Y.role,content:Y.content,timestamp:Y.timestamp.toISOString()}))),C!=null&&C.id&&claraApi.syncTranscriptToDB(C.id,j)},[z,g,L,C]),ce=React.useCallback(q=>{console.log("[Session] Title updated:",q),V(q),emitTitleUpdated(q,C==null?void 0:C.id),L&&sendTitleUpdate(L,q),C!=null&&C.id&&claraApi.updateAnalysisTitle(C.id,q)},[V,C,L]),Te=React.useCallback(q=>{H(q)},[H]),ne=React.useCallback(q=>{if(console.log("[Session] Field interaction:",q),q.action==="change"&&q.value!==void 0){_(q.fieldId,q.value,"user","Manual edit"),L&&sendToS2(L,{action:"fill",fieldId:q.fieldId,value:q.value,sectionKey:q.sectionKey,editorSource:"user",source:"web_client"});const j={...b,[q.fieldId]:q.value};Z(j)}},[_,L,b,Z]),{isRecording:K,isConnected:he,isConnecting:ee,isPaused:Q,error:te,audioLevel:ye,startRecording:le,stopRecording:fe,togglePause:Se,getSessionUsage:de}=useGeminiLive({geminiApiKey:T.geminiApiKey,onDataExtracted:ge,onTranscriptUpdate:ve,onTitleUpdate:ce,onUsageUpdate:Te,isAutopilot:E,speechSpeed:A,style:M,sections:((Ue=y==null?void 0:y.structure)==null?void 0:Ue.sections)||[]});React.useEffect(()=>{W.current=de},[de]);const Pe=ee?SessionStatus.CONNECTING:he&&!Q?SessionStatus.ACTIVE:he&&Q?SessionStatus.PAUSED:SessionStatus.DISCONNECTED;React.useEffect(()=>(d.current=setInterval(()=>{u(q=>q<=1?(d.current&&clearInterval(d.current),0):q-1)},1e3),()=>{d.current&&clearInterval(d.current)}),[]),React.useEffect(()=>{he&&(o(!1),d.current&&clearInterval(d.current))},[he]);const oe=React.useRef(!1);React.useEffect(()=>{const q=claraApi.hasAuth()||T.apiKey||x;if(!q||oe.current){q||console.log("[Session] Waiting for auth...");return}return(async()=>{var Ge;oe.current=!0,claraApi.hasAuth()||(T.apiKey?claraApi.setApiKey(T.apiKey):x&&claraApi.setAccessToken(x)),console.log("[Session] Initializing session (optimized parallel)...");const Y=performance.now(),[pe,xe]=await Promise.all([claraApi.fetchUserStreamToken(),y&&!C?claraApi.createAnalysis(y.id,y):Promise.resolve(C)]);pe&&(k(pe),console.log("[Session] User stream token obtained"));const me=xe||C;if(me)B(me),console.log("[Session] Analysis ready:",me.id);else{console.error("[Session] No analysis available");return}const we=await claraApi.fetchAnalysisStreamToken(me.id,(Ge=me.stream)==null?void 0:Ge.id);if(we){R(we);const Fe=new S2StreamListener(we,{onFill:(se,be,Ce)=>{console.log("[S2 → Widget] 📥 Remote fill received:",{fieldId:se,value:be,sectionKey:Ce}),sendFillCommand(se,be,Ce),_(se,be,"agent","S2 remote fill"),emitFieldFilled(se,be,Ce)},onFillMultiple:se=>{console.log("[S2 → Widget] 📥 Remote fillMultiple received:",se);const be={...b};se.forEach(Ce=>{sendFillCommand(Ce.fieldId,Ce.value,Ce.sectionKey),_(Ce.fieldId,Ce.value,"agent","S2 remote fill"),be[Ce.fieldId]=Ce.value}),emitFormDataUpdated(be,void 0,se.map(Ce=>Ce.fieldId))},onChatMessage:se=>{const be=se;if(be.source!=="widget"){const Ce=be.id||`${se.role}-${se.content}-${se.timestamp}`;O({id:Ce,role:se.role==="assistant"?"model":se.role,content:se.content,timestamp:new Date(se.timestamp||Date.now())})}},onTranscript:se=>{},onTitleUpdate:se=>{V(se),emitTitleUpdated(se,me==null?void 0:me.id)},onPing:()=>{},onError:se=>{console.error("[Session] S2 Error:",se),N(!1)},onDisconnect:()=>N(!1)});f.current=Fe,Fe.start(),N(!0)}p.current||(setupFieldListeners(ne),setupSectionListeners(),p.current=!0),le(),pe&&me&&(notifyUserStream(pe,{action:"analysis_selected",analysisId:me.id,source:"web_agent"}),notifyUserStream(pe,{action:"session_status",status:"started",analysisId:me.id,source:"web_agent"})),emitSessionStarted(me.id),console.log(`[Session] Init completed in ${(performance.now()-Y).toFixed(0)}ms`)})(),()=>{f.current&&f.current.stop()}},[T.apiKey]),React.useEffect(()=>{if(!L||!(C!=null&&C.id))return;const q=()=>{sendSessionStatus(L,{status:Q?"paused":"recording",isPaused:Q,isConnected:D,analysisId:C.id,templateName:y==null?void 0:y.name,formDataCount:Object.keys(b).length,transcriptCount:g.length,startedAt:P.current})};return q(),m.current=setInterval(q,5e3),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[L,C==null?void 0:C.id,Q,D]);const Me=React.useCallback(async()=>{console.log("[Session] Stopping session..."),m.current&&(clearInterval(m.current),m.current=null),await ie();const q=de();if(console.log("[Session] Final usage stats:",q),fe(),L&&await sendSessionStatus(L,{status:"stopped",isPaused:!1,isConnected:!1,analysisId:C==null?void 0:C.id}),f.current&&(f.current.stop(),f.current=null),N(!1),C!=null&&C.id){const j=S.map(Y=>({id:Y.id||Date.now().toString(),role:Y.role,text:Y.content}));await claraApi.completeAnalysis(C.id,b,F,g,j,q.totalTokens>0?q:void 0)}G&&(C!=null&&C.id)&&notifyUserStream(G,{action:"session_status",status:"completed",analysisId:C.id,source:"web_agent"},!0),emitSessionStopped(C==null?void 0:C.id),J(),n()},[fe,de,n,C,b,F,g,S,G,L,N,J,ie]);React.useEffect(()=>{i&&(i.current={disconnect:Me,togglePause:Se,isPaused:Q})},[i,Me,Se,Q]),React.useEffect(()=>{const q=()=>{he&&(C!=null&&C.id)&&G&&notifyUserStream(G,{action:"session_status",status:"completed",analysisId:C.id,source:"web_agent"},!0)};return window.addEventListener("beforeunload",q),()=>window.removeEventListener("beforeunload",q)},[he,C,G]),React.useEffect(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)},[g,s]);const Ie=(()=>{switch(Pe){case SessionStatus.ACTIVE:return{bgClass:"bg-clara-success/20",borderClass:"border-clara-success/50",textClass:"text-clara-success",dotClass:"bg-clara-success animate-pulse",label:t("session.recording",$)};case SessionStatus.PAUSED:return{bgClass:"bg-clara-warning/20",borderClass:"border-clara-warning/50",textClass:"text-clara-warning",dotClass:"bg-clara-warning",label:t("session.paused",$)};case SessionStatus.CONNECTING:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground animate-pulse",label:t("common.loading",$)};default:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground",label:t("common.error",$)}}})(),ke=()=>jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 h-4",children:Array.from({length:5}).map((j,Y)=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full transition-all duration-75",style:{backgroundColor:ye>Y/5?e:"#374151",height:`${Math.max(20,(Y+1)*20)}%`}},Y))});return jsxRuntime.jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col h-full bg-clara-surface relative",children:[jsxRuntime.jsx(AnimatePresence,{children:a&&l>0&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-[120] flex items-center justify-center bg-black/60 backdrop-blur-sm rounded-2xl",children:jsxRuntime.jsx(motion.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},exit:{scale:1.5,opacity:0},className:"text-white text-8xl font-black drop-shadow-lg",children:l},l)})}),jsxRuntime.jsxs("div",{className:"bg-clara-dark text-white px-3 py-2.5 flex justify-between items-center shadow-md z-10",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ChartColumn,{className:"w-4 h-4 text-clara-success"}),jsxRuntime.jsx("span",{className:"font-semibold text-xs tracking-wide uppercase",children:t("session.recording",$)}),he&&ke(),jsxRuntime.jsx("span",{title:D?"S2 Conectado":"S2 Desconectado",children:D?jsxRuntime.jsx(Wifi,{className:"w-3 h-3 text-clara-success"}):jsxRuntime.jsx(WifiOff,{className:"w-3 h-3 text-muted-foreground"})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[te&&jsxRuntime.jsx("span",{className:"text-destructive text-[10px] mr-2",children:te}),jsxRuntime.jsx("button",{onClick:Se,disabled:!he,className:"p-1 rounded-full bg-gray-700 hover:bg-gray-600 transition-colors disabled:opacity-50",title:Pe===SessionStatus.ACTIVE?t("session.pause",$):t("session.resume",$),children:Pe===SessionStatus.PAUSED?jsxRuntime.jsx(Play,{className:"w-2.5 h-2.5",fill:"currentColor"}):jsxRuntime.jsx(Pause,{className:"w-2.5 h-2.5",fill:"currentColor"})}),jsxRuntime.jsx("button",{onClick:Me,className:"p-1 rounded-full bg-destructive/30 hover:bg-destructive/50 text-destructive-foreground border border-destructive/50 transition-colors",title:t("session.stop",$),children:jsxRuntime.jsx(Square,{className:"w-2.5 h-2.5",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:`flex items-center gap-1 px-2 py-0.5 rounded-full border text-[10px] font-medium ${Ie.bgClass} ${Ie.borderClass} ${Ie.textClass}`,children:[jsxRuntime.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${Ie.dotClass}`}),Ie.label]})]})]}),jsxRuntime.jsx("div",{className:"flex bg-card border-b border-border",children:["assistant","transcription","report"].map(q=>jsxRuntime.jsxs("button",{onClick:()=>r(q),className:`flex-1 py-2.5 text-[10px] font-bold tracking-wider uppercase transition-colors relative ${s===q?"":"text-muted-foreground hover:text-foreground"}`,style:s===q?{color:e}:{},children:[t(q==="assistant"?"tabs.chat":q==="transcription"?"tabs.transcript":"tabs.report",$),s===q&&jsxRuntime.jsx(motion.div,{layoutId:"activeSessionTab",className:"absolute bottom-0 left-0 w-full h-0.5",style:{backgroundColor:e}})]},q))}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[s==="assistant"&&jsxRuntime.jsx("div",{className:"flex-1 flex flex-col min-h-0",children:jsxRuntime.jsx(ClaraChat,{primaryColor:e})}),s==="transcription"&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"h-full flex flex-col p-3",children:[jsxRuntime.jsx("div",{className:"mb-3 p-2 bg-clara-warning/10 border border-clara-warning/30 rounded-lg",children:jsxRuntime.jsxs("p",{className:"text-[10px] text-clara-warning font-medium text-center",children:["⚠️ ",t("transcript.provisional",$)]})}),jsxRuntime.jsx("div",{ref:c,className:"flex-1 overflow-y-auto space-y-3",children:g.length===0?jsxRuntime.jsx("div",{className:"text-center text-muted-foreground mt-12 text-xs",children:t(ee?"transcript.connecting":he?"transcript.listening":"transcript.startSession",$)}):g.map((q,j)=>jsxRuntime.jsx("div",{className:`flex flex-col ${q.role==="user"?"items-end":"items-start"}`,children:jsxRuntime.jsx("div",{className:`max-w-[85%] px-2.5 py-2 rounded-lg text-xs ${q.role==="user"?"bg-card border border-border text-foreground rounded-tr-none shadow-sm":"rounded-tl-none"}`,style:q.role!=="user"?{borderColor:`${e}33`,backgroundColor:`${e}0D`,color:"inherit"}:{},children:q.content})},j))})]}),s==="report"&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"h-full flex flex-col overflow-y-auto p-4 bg-card overscroll-contain",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("h2",{className:"text-sm font-bold text-foreground",children:t("report.capturedData",$)}),jsxRuntime.jsxs("button",{onClick:()=>{var pe;const q=((pe=y==null?void 0:y.structure)==null?void 0:pe.sections)||[],j=window.open("","_blank");if(!j)return;let Y=`
420
+ <!DOCTYPE html>
421
+ <html>
422
+ <head>
423
+ <title>Reporte - ${(y==null?void 0:y.name)||"Clara"}</title>
424
+ <style>
425
+ body { font-family: system-ui, sans-serif; padding: 40px; max-width: 800px; margin: 0 auto; }
426
+ h1 { font-size: 24px; margin-bottom: 8px; }
427
+ h2 { font-size: 16px; margin-top: 24px; margin-bottom: 12px; color: #374151; border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; }
428
+ .meta { color: #6b7280; font-size: 12px; margin-bottom: 24px; }
429
+ table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
430
+ th, td { text-align: left; padding: 8px 12px; border: 1px solid #e5e7eb; font-size: 13px; }
431
+ th { background: #f9fafb; font-weight: 500; width: 35%; }
432
+ td { color: #374151; }
433
+ .empty { color: #9ca3af; font-style: italic; }
434
+ </style>
435
+ </head>
436
+ <body>
437
+ <h1>${(y==null?void 0:y.name)||"Reporte Médico"}</h1>
438
+ <p class="meta">Generado el ${new Date().toLocaleDateString("es-ES",{dateStyle:"full"})}</p>
439
+ `;q.filter(xe=>xe.enabled!==!1).forEach(xe=>{var me;Y+=`<h2>${xe.label}</h2><table>`,(me=xe.fields)==null||me.forEach(we=>{const Ge=we.htmlFieldId||we.id,Fe=b[Ge],se=Fe!==void 0&&Fe!==""?String(Fe):'<span class="empty">Sin datos</span>';Y+=`<tr><th>${we.label}</th><td>${se}</td></tr>`}),Y+="</table>"}),Y+="</body></html>",j.document.write(Y),j.document.close(),j.print()},className:"text-[10px] font-semibold uppercase tracking-wider hover:underline flex items-center gap-1",style:{color:e},children:[jsxRuntime.jsx(Download,{className:"w-3.5 h-3.5"}),t("report.export",$)]})]}),y?(((Ne=y.structure)==null?void 0:Ne.sections)||[]).filter(q=>q.enabled!==!1).length===0?jsxRuntime.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:$==="en"?"Template has no enabled sections":"La plantilla no tiene secciones habilitadas"}):jsxRuntime.jsx("div",{className:"space-y-4",children:(((Oe=y.structure)==null?void 0:Oe.sections)||[]).filter(q=>q.enabled!==!1).map(q=>{var j;return jsxRuntime.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[jsxRuntime.jsx("div",{className:"bg-secondary px-3 py-2 border-b border-border",children:jsxRuntime.jsx("h3",{className:"text-xs font-semibold text-foreground",children:q.label})}),jsxRuntime.jsx("table",{className:"w-full text-xs text-left",children:jsxRuntime.jsx("tbody",{className:"divide-y divide-border",children:(j=q.fields)==null?void 0:j.map(Y=>{const pe=Y.htmlFieldId||Y.id,xe=b[pe],me=xe!==void 0&&xe!=="";return jsxRuntime.jsxs("tr",{className:"bg-card hover:bg-secondary/50 transition-colors",children:[jsxRuntime.jsxs("td",{className:"px-3 py-2 font-medium text-foreground bg-secondary/30 w-1/2",children:[Y.label,Y.required&&jsxRuntime.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),jsxRuntime.jsx("td",{className:`px-3 py-2 w-1/2 ${me?"text-foreground":"text-muted-foreground italic"}`,children:me?String(xe):"Sin datos"})]},Y.id)})})})]},q.key)})}):jsxRuntime.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:t("report.selectTemplate",$)}),Object.keys(b).length>0&&jsxRuntime.jsxs("div",{className:"mt-4 p-3 bg-clara-success/10 border border-clara-success/20 rounded-lg flex items-start gap-2",children:[jsxRuntime.jsx(Check,{className:"w-4 h-4 text-clara-success mt-0.5 flex-shrink-0"}),jsxRuntime.jsxs("p",{className:"text-xs text-clara-success",children:[Object.keys(b).length," campos capturados durante la consulta"]})]})]})]})]})},ClaraWidget=()=>{const{config:n,isAuthenticated:e,setConfig:i}=useClaraStore(),s=n.primaryColor;React.useEffect(()=>{const y=localStorage.getItem("clara_api_key"),C=localStorage.getItem("clara_template_id"),g=localStorage.getItem("clara_auto_open"),S=localStorage.getItem("clara_primary_color"),E=localStorage.getItem("clara_position"),A=localStorage.getItem("clara_demo_template"),M=localStorage.getItem("clara_lang"),b={};y&&(b.apiKey=y),C&&(b.templateId=C),g&&(b.autoOpen=g==="true"),S&&(b.primaryColor=S),E&&(b.position=E),A&&(b.demoTemplate=A),M&&(b.lang=M),Object.keys(b).length>0&&(i(b),console.log("[ClaraWidget] Loaded config from localStorage:",{apiKey:y?"***":null,templateId:C,autoOpen:g,primaryColor:S,position:E,demoTemplate:A,lang:M}))},[i]),React.useEffect(()=>(e&&n.apiKey&&(console.log("[ClaraWidget] 🔐 Auth detected, initializing ephemeral token..."),ephemeralTokenManager.initialize().then(y=>{console.log("[ClaraWidget] 🔐 Ephemeral token initialization:",y?"SUCCESS":"FAILED")})),()=>{console.log("[ClaraWidget] 🧹 Component unmounting, destroying ephemeral token manager"),ephemeralTokenManager.destroy()}),[e,n.apiKey]);const r=()=>e&&n.apiKey?ViewState.DASHBOARD:ViewState.LOGIN,[a,o]=React.useState(r),[l,u]=React.useState(n.autoOpen),[c,f]=React.useState(!1),p=React.useRef(null);React.useEffect(()=>{e&&n.apiKey&&a===ViewState.LOGIN&&o(ViewState.DASHBOARD)},[e,n.apiKey]),React.useEffect(()=>{n.autoOpen&&u(!0)},[n.autoOpen]);const d=y=>{y.stopPropagation(),p.current&&p.current.disconnect()},m=()=>{useClaraStore.getState().setAuthenticated(!0),o(ViewState.DASHBOARD)},P=()=>{useClaraStore.getState().setAuthenticated(!1),useClaraStore.getState().setConfig({apiKey:null}),o(ViewState.LOGIN)},x=(()=>{switch(n.position){case"bottom-left":return"left-6 items-start";case"center":return"left-1/2 -translate-x-1/2 items-center";default:return"right-6 items-end"}})();return jsxRuntime.jsxs("div",{className:`fixed bottom-6 ${x} z-[9999] flex flex-col font-sans pointer-events-none`,children:[jsxRuntime.jsx(AnimatePresence,{children:l&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:"pointer-events-auto mb-4 w-[380px] h-[600px] bg-card rounded-2xl shadow-widget flex flex-col overflow-hidden border border-border",children:[a===ViewState.LOGIN&&jsxRuntime.jsx(ClaraLogin,{onLogin:m,primaryColor:s}),a===ViewState.DASHBOARD&&jsxRuntime.jsx(ClaraDashboard,{onStartSession:()=>o(ViewState.SESSION),onLogout:P,primaryColor:s}),a===ViewState.SESSION&&jsxRuntime.jsx(ClaraActiveSession,{onEndSession:()=>o(ViewState.DASHBOARD),primaryColor:s,sessionControlRef:p})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 pointer-events-auto",children:[jsxRuntime.jsx(AnimatePresence,{children:!l&&a===ViewState.SESSION&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:"flex items-center gap-2",children:[jsxRuntime.jsx(motion.button,{onClick:y=>{var C;y.stopPropagation(),(C=p.current)!=null&&C.togglePause&&(p.current.togglePause(),f(!c))},className:"w-12 h-12 rounded-2xl bg-clara-warning text-white shadow-lg flex items-center justify-center transition-all hover:brightness-110 hover:scale-105 active:scale-95",title:c?"Reanudar":"Pausar",children:c?jsxRuntime.jsx(Play,{className:"w-4 h-4",fill:"currentColor"}):jsxRuntime.jsx(Pause,{className:"w-4 h-4",fill:"currentColor"})}),jsxRuntime.jsx(motion.button,{onClick:d,className:"w-12 h-12 rounded-2xl bg-destructive text-destructive-foreground shadow-lg flex items-center justify-center transition-all hover:brightness-110 hover:scale-105 active:scale-95",title:"Detener sesión",children:jsxRuntime.jsx(Square,{className:"w-4 h-4",fill:"currentColor"})})]})}),jsxRuntime.jsx(motion.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>u(!l),style:{backgroundColor:s},className:"w-[72px] h-[72px] rounded-full text-white shadow-widget flex items-center justify-center transition-colors focus:outline-none focus:ring-4 focus:ring-ring/30 relative",children:jsxRuntime.jsx(AnimatePresence,{mode:"wait",children:l?jsxRuntime.jsx(motion.div,{initial:{rotate:-90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:90,opacity:0},transition:{duration:.2},children:jsxRuntime.jsx(X,{className:"w-8 h-8"})},"close"):jsxRuntime.jsxs(motion.div,{initial:{rotate:90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:-90,opacity:0},transition:{duration:.2},className:"relative flex items-center justify-center",children:[jsxRuntime.jsx("img",{src:claraLogo,alt:"Clara",className:"w-12 h-12",style:{filter:"brightness(0) invert(1)"}}),a===ViewState.SESSION&&jsxRuntime.jsxs("span",{className:"absolute -top-1 -right-1 flex h-4 w-4",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-destructive opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-4 w-4 bg-destructive border-2 border-white"})]})]},"open")})})]})]})};exports.ClaraActiveSession=ClaraActiveSession;exports.ClaraChat=ClaraChat;exports.ClaraDashboard=ClaraDashboard;exports.ClaraLogin=ClaraLogin;exports.ClaraStoreAPI=ClaraStoreAPI;exports.ClaraWidget=ClaraWidget;exports.S2StreamListener=S2StreamListener;exports.broadcast=broadcast;exports.claraApi=claraApi;exports.createTranslator=createTranslator;exports.emitFieldFilled=emitFieldFilled;exports.emitFormDataUpdated=emitFormDataUpdated;exports.emitSessionStarted=emitSessionStarted;exports.emitSessionStopped=emitSessionStopped;exports.emitTitleUpdated=emitTitleUpdated;exports.emitTranscriptUpdated=emitTranscriptUpdated;exports.ephemeralTokenManager=ephemeralTokenManager;exports.initClaraListener=initClaraListener;exports.notifyUserStream=notifyUserStream;exports.performLocalFill=performLocalFill;exports.sendAIFill=sendAIFill;exports.sendFillCommand=sendFillCommand;exports.sendTitleUpdate=sendTitleUpdate;exports.sendToS2=sendToS2;exports.sendTranscript=sendTranscript;exports.setupFieldListeners=setupFieldListeners;exports.t=t;exports.useClaraStore=useClaraStore;