UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

3,916 lines 39.9 kB
import { C as computed, It as ref } from "./vue.runtime.esm-bundler-tP5dCd7J.js";
import { C as getNodesWithNormalizedPosition, Ho as useSettingsStore, ac as getWorkflows, at as useNodeTypesStore, ec as getCategories, i as usePostHog, ic as getWorkflowTemplate, nc as getCollections, nr as useUsersStore, o as useWorkflowsStore, oc as STORES, rc as getTemplateById, t as useTelemetry, tc as getCollectionById } from "./useTelemetry-C797TaYa.js";
import { Io as VIEWS, cc as TEMPLATES_DATA_QUALITY_EXPERIMENT, nc as EXTRA_TEMPLATE_LINKS_EXPERIMENT, w as TEMPLATES_URLS } from "./constants-CX1ozgFz.js";
import { k as defineStore, r as useRootStore } from "./_baseOrderBy-DL6Sy5xK.js";
import { t as useCloudPlanStore } from "./cloudPlan.store-nppjm48S.js";
var batch1TemplateIds_default = [
	10135,
	10134,
	10132,
	10129,
	10127,
	10126,
	10120,
	10119,
	10118,
	10115,
	10107,
	10103,
	10102,
	10101,
	10096,
	10086,
	10084,
	10080,
	10077,
	10065,
	10063,
	10062,
	10060,
	10058,
	10057,
	10056,
	10053,
	10051,
	10046,
	10045,
	10037,
	10034,
	10025,
	10010,
	10009,
	10008,
	10007,
	10005,
	1e4,
	9999,
	9997,
	9994,
	9991,
	9989,
	9986,
	9985,
	9984,
	9983,
	9982,
	9981,
	9980,
	9976,
	9974,
	9973,
	9971,
	9970,
	9967,
	9966,
	9965,
	9961,
	9959,
	9955,
	9951,
	9947,
	9944,
	9943,
	9942,
	9935,
	9934,
	9933,
	9931,
	9930,
	9926,
	9924,
	9922,
	9920,
	9916,
	9909,
	9908,
	9902,
	9901,
	9896,
	9894,
	9891,
	9887,
	9886,
	9885,
	9882,
	9881,
	9878,
	9876,
	9866,
	9861,
	9860,
	9859,
	9858,
	9846,
	9843,
	9835,
	9834,
	9823,
	9814,
	9810,
	9769,
	9762,
	9754,
	9739,
	9736,
	9735,
	9732,
	9694,
	9692,
	9655,
	9625,
	9607,
	9605,
	9592,
	9582,
	9577,
	9546,
	9545,
	9544,
	9540,
	9489,
	9390,
	9383,
	9379,
	9372,
	9370,
	9364,
	9363,
	9362,
	9360,
	9358,
	9357,
	9356,
	9354,
	9352,
	9349,
	9347,
	9346,
	9345,
	9344,
	9343,
	9342,
	9339,
	9337,
	9332,
	9325,
	9315,
	9314,
	9309,
	9308,
	9306,
	9305,
	9301,
	9299,
	9295,
	9293,
	9292,
	9288,
	9285,
	9284,
	9280,
	9275,
	9273,
	9271,
	9266,
	9265,
	9264,
	9262,
	9260,
	9256,
	9254,
	9253,
	9252,
	9251,
	9250,
	9249,
	9248,
	9247,
	9246,
	9245,
	9243,
	9240,
	9239,
	9237,
	9236,
	9228,
	9227,
	9226,
	9225,
	9218,
	9217,
	9210,
	9209,
	9208,
	9204,
	9203,
	9200,
	9196,
	9195,
	9193,
	9191,
	9187,
	9185,
	9184,
	9182,
	9176,
	9174,
	9173,
	9172,
	9166,
	9165,
	9164,
	9162,
	9161,
	9160,
	9158,
	9157,
	9156,
	9155,
	9154,
	9152,
	9151,
	9150,
	9149,
	9147,
	9146,
	9145,
	9140,
	9139,
	9138,
	9137,
	9136,
	9135,
	9133,
	9132,
	9130,
	9129,
	9128,
	9127,
	9126,
	9121,
	9115,
	9114,
	9113,
	9112,
	9110,
	9108,
	9102,
	9101,
	9100,
	9098,
	9096,
	9089,
	9088,
	9087,
	9084,
	9081,
	9080,
	9071,
	9067,
	9066,
	9064,
	9061,
	9059,
	9058,
	9057,
	9056,
	9055,
	9054,
	9053,
	9046,
	9039,
	9036,
	9034,
	9031,
	9027,
	9026,
	9020,
	9019,
	9018,
	9014,
	9009,
	9008,
	9007,
	9005,
	9004,
	9003,
	9002,
	8995,
	8992,
	8991,
	8989,
	8988,
	8987,
	8986,
	8985,
	8984,
	8983,
	8982,
	8981,
	8978,
	8977,
	8972,
	8971,
	8970,
	8969,
	8968,
	8967,
	8966,
	8965,
	8963,
	8960,
	8957,
	8956,
	8955,
	8954,
	8952,
	8951,
	8950,
	8948,
	8947,
	8946,
	8945,
	8944,
	8943,
	8942,
	8939,
	8938,
	8936,
	8934,
	8933,
	8932,
	8930,
	8929,
	8928,
	8927,
	8923,
	8922,
	8921,
	8920,
	8919,
	8918,
	8917,
	8916,
	8915,
	8912,
	8910,
	8909,
	8907,
	8906,
	8905,
	8904,
	8897,
	8895,
	8891,
	8890,
	8888,
	8887,
	8886,
	8884,
	8881,
	8880,
	8879,
	8871,
	8869,
	8868,
	8867,
	8866,
	8864,
	8863,
	8862,
	8860,
	8859,
	8856,
	8852,
	8850,
	8848,
	8847,
	8846,
	8845,
	8844,
	8838,
	8837,
	8836,
	8834,
	8827,
	8825,
	8823,
	8820,
	8819,
	8818,
	8817,
	8816,
	8815,
	8814,
	8813,
	8811,
	8810,
	8809,
	8807,
	8801,
	8800,
	8797,
	8794,
	8793,
	8792,
	8790,
	8789,
	8788,
	8787,
	8785,
	8782,
	8780,
	8779,
	8778,
	8776,
	8775,
	8773,
	8772,
	8771,
	8770,
	8769,
	8768,
	8767,
	8764,
	8762,
	8760,
	8757,
	8756,
	8755,
	8754,
	8753,
	8751,
	8746,
	8745,
	8743,
	8742,
	8738,
	8736,
	8734,
	8733,
	8731,
	8728,
	8726,
	8724,
	8722,
	8720,
	8714,
	8713,
	8712,
	8709,
	8707,
	8706,
	8703,
	8702,
	8701,
	8698,
	8696,
	8694,
	8691,
	8690,
	8689,
	8688,
	8686,
	8685,
	8684,
	8680,
	8679,
	8678,
	8677,
	8676,
	8675,
	8674,
	8673,
	8672,
	8671,
	8670,
	8667,
	8665,
	8664,
	8663,
	8662,
	8660,
	8657,
	8656,
	8654,
	8653,
	8652,
	8650,
	8649,
	8648,
	8647,
	8646,
	8645,
	8644,
	8643,
	8642,
	8641,
	8639,
	8637,
	8635,
	8630,
	8629,
	8628,
	8627,
	8626,
	8623,
	8622,
	8620,
	8619,
	8616,
	8615,
	8614,
	8613,
	8612,
	8611,
	8610,
	8609,
	8608,
	8607,
	8606,
	8605,
	8604,
	8602,
	8601,
	8600,
	8599,
	8597,
	8596,
	8595,
	8594,
	8592,
	8591,
	8590,
	8586,
	8585,
	8584,
	8582,
	8578,
	8577,
	8576,
	8575,
	8573,
	8572,
	8571,
	8569,
	8568,
	8567,
	8565,
	8564,
	8563,
	8562,
	8559,
	8558,
	8557,
	8556,
	8555,
	8554,
	8553,
	8552,
	8551,
	8548,
	8547,
	8546,
	8545,
	8544,
	8541,
	8539,
	8538,
	8537,
	8535,
	8531,
	8530,
	8529,
	8526,
	8524,
	8523,
	8522,
	8520,
	8519,
	8518,
	8513,
	8510,
	8508,
	8506,
	8505,
	8504,
	8503,
	8502,
	8501,
	8500,
	8499,
	8498,
	8497,
	8496,
	8494,
	8492,
	8490,
	8489,
	8488,
	8487,
	8485,
	8484,
	8477,
	8476,
	8475,
	8472,
	8471,
	8470,
	8468,
	8467,
	8466,
	8464,
	8463,
	8461,
	8460,
	8458,
	8457,
	8456,
	8455,
	8454,
	8453,
	8452,
	8449,
	8448,
	8447,
	8446,
	8445,
	8442,
	8440,
	8439,
	8438,
	8435,
	8434,
	8431,
	8428,
	8426,
	8424,
	8420,
	8417,
	8415,
	8414,
	8413,
	8412,
	8411,
	8410,
	8408,
	8405,
	8404,
	8403,
	8400,
	8398,
	8396,
	8395,
	8393,
	8392,
	8391,
	8390,
	8389,
	8388,
	8387,
	8386,
	8383,
	8382,
	8380,
	8378,
	8377,
	8376,
	8375,
	8373,
	8371,
	8370,
	8369,
	8368,
	8367,
	8365,
	8364,
	8363,
	8362,
	8360,
	8358,
	8357,
	8356,
	8355,
	8354,
	8351,
	8350,
	8349,
	8346,
	8344,
	8341,
	8338,
	8336,
	8335,
	8334,
	8333,
	8332,
	8331,
	8328,
	8327,
	8326,
	8323,
	8321,
	8318,
	8314,
	8312,
	8309,
	8308,
	8305,
	8304,
	8296,
	8295,
	8293,
	8292,
	8289,
	8287,
	8286,
	8285,
	8284,
	8283,
	8282,
	8281,
	8279,
	8278,
	8275,
	8272,
	8271,
	8270,
	8268,
	8267,
	8266,
	8265,
	8264,
	8260,
	8258,
	8257,
	8256,
	8254,
	8252,
	8250,
	8249,
	8248,
	8247,
	8245,
	8242,
	8240,
	8238,
	8237,
	8235,
	8234,
	8231,
	8230,
	8229,
	8228,
	8227,
	8226,
	8225,
	8224,
	8223,
	8222,
	8221,
	8220,
	8219,
	8218,
	8214,
	8213,
	8212,
	8211,
	8210,
	8209,
	8206,
	8205,
	8203,
	8201,
	8200,
	8199,
	8198,
	8197,
	8195,
	8194,
	8193,
	8192,
	8191,
	8187,
	8185,
	8179,
	8178,
	8174,
	8163,
	8162,
	8161,
	8159,
	8158,
	8157,
	8156,
	8151,
	8149,
	8148,
	8147,
	8146,
	8144,
	8143,
	8142,
	8140,
	8139,
	8136,
	8134,
	8132,
	8131,
	8130,
	8124,
	8123,
	8122,
	8121,
	8120,
	8119,
	8118,
	8117,
	8116,
	8115,
	8114,
	8113,
	8112,
	8111,
	8109,
	8108,
	8104,
	8103,
	8102,
	8101,
	8099,
	8097,
	8096,
	8095,
	8094,
	8093,
	8092,
	8091,
	8090,
	8088,
	8085,
	8083,
	8082,
	8081,
	8080,
	8076,
	8075,
	8074,
	8073,
	8072,
	8071,
	8070,
	8069,
	8068,
	8066,
	8064,
	8063,
	8062,
	8060,
	8059,
	8058,
	8057,
	8056,
	8054,
	8053,
	8052,
	8050,
	8049,
	8048,
	8047,
	8046,
	8045,
	8044,
	8043,
	8042,
	8040,
	8039,
	8037,
	8036,
	8035,
	8034,
	8033,
	8032,
	8031,
	8030,
	8029,
	8028,
	8027,
	8024,
	8023,
	8022,
	8021,
	8019,
	8017,
	8014,
	8013,
	8012,
	8011,
	8010,
	8009,
	8008,
	8007,
	8006,
	8003,
	8002,
	7998,
	7997,
	7996,
	7992,
	7991,
	7989,
	7988,
	7987,
	7985,
	7983,
	7981,
	7979,
	7978,
	7975,
	7974,
	7971,
	7968,
	7966,
	7964,
	7963,
	7960,
	7959,
	7958,
	7957,
	7956,
	7955,
	7954,
	7952,
	7951,
	7950,
	7948,
	7947,
	7946,
	7945,
	7943,
	7942,
	7941,
	7939,
	7938,
	7937,
	7936,
	7935,
	7934,
	7933,
	7932,
	7930,
	7928,
	7927,
	7926,
	7925,
	7924,
	7923,
	7921,
	7920,
	7919,
	7917,
	7914,
	7913,
	7910,
	7908,
	7907,
	7906,
	7905,
	7904,
	7903,
	7902,
	7901,
	7898,
	7897,
	7892,
	7890,
	7889,
	7888,
	7887,
	7886,
	7885,
	7884,
	7883,
	7882,
	7881,
	7880,
	7877,
	7876,
	7874,
	7871,
	7870,
	7865,
	7863,
	7862,
	7861,
	7857,
	7855,
	7854,
	7853,
	7852,
	7851,
	7850,
	7849,
	7848,
	7845,
	7844,
	7842,
	7841,
	7840,
	7839,
	7838,
	7835,
	7834,
	7815,
	7814,
	7809,
	7806,
	7803,
	7802,
	7800,
	7799,
	7798,
	7797,
	7796,
	7794,
	7793,
	7790,
	7788,
	7787,
	7786,
	7785,
	7784,
	7783,
	7780,
	7779,
	7774,
	7773,
	7772,
	7771,
	7769,
	7766,
	7765,
	7763,
	7759,
	7758,
	7756,
	7755,
	7754,
	7753,
	7752,
	7748,
	7747,
	7744,
	7743,
	7742,
	7741,
	7740,
	7739,
	7738,
	7737,
	7736,
	7735,
	7734,
	7733,
	7731,
	7730,
	7729,
	7728,
	7726,
	7724,
	7723,
	7722,
	7721,
	7720,
	7719,
	7718,
	7717,
	7716,
	7715,
	7714,
	7713,
	7712,
	7711,
	7709,
	7708,
	7707,
	7706,
	7705,
	7704,
	7701,
	7700,
	7699,
	7698,
	7696,
	7695,
	7693,
	7691,
	7689,
	7688,
	7686,
	7685,
	7684,
	7681,
	7680,
	7679,
	7678,
	7677,
	7676,
	7675,
	7674,
	7673,
	7672,
	7671,
	7670,
	7669,
	7668,
	7667,
	7666,
	7665,
	7664,
	7663,
	7662,
	7661,
	7660,
	7655,
	7654,
	7653,
	7652,
	7651,
	7650,
	7649,
	7648,
	7647,
	7646,
	7645,
	7644,
	7643,
	7640,
	7639,
	7637,
	7635,
	7634,
	7633,
	7632,
	7631,
	7630,
	7629,
	7628,
	7627,
	7626,
	7625,
	7624,
	7623,
	7622,
	7621,
	7620,
	7619,
	7618,
	7617,
	7615,
	7613,
	7612,
	7610,
	7609,
	7608
];
var batch2TemplateIds_default = [
	7607,
	7605,
	7603,
	7602,
	7601,
	7600,
	7599,
	7598,
	7597,
	7595,
	7594,
	7593,
	7592,
	7591,
	7590,
	7586,
	7585,
	7583,
	7582,
	7581,
	7580,
	7579,
	7578,
	7577,
	7575,
	7571,
	7569,
	7568,
	7567,
	7566,
	7563,
	7562,
	7561,
	7560,
	7558,
	7557,
	7556,
	7554,
	7553,
	7550,
	7549,
	7548,
	7546,
	7545,
	7544,
	7543,
	7540,
	7539,
	7537,
	7536,
	7535,
	7533,
	7530,
	7529,
	7528,
	7527,
	7525,
	7524,
	7523,
	7522,
	7521,
	7520,
	7518,
	7517,
	7516,
	7515,
	7514,
	7513,
	7512,
	7511,
	7509,
	7508,
	7506,
	7504,
	7503,
	7502,
	7501,
	7500,
	7491,
	7490,
	7487,
	7486,
	7485,
	7484,
	7483,
	7482,
	7481,
	7480,
	7479,
	7475,
	7470,
	7469,
	7468,
	7467,
	7466,
	7465,
	7464,
	7463,
	7461,
	7460,
	7459,
	7458,
	7457,
	7456,
	7455,
	7453,
	7452,
	7451,
	7450,
	7449,
	7448,
	7436,
	7434,
	7432,
	7431,
	7430,
	7429,
	7426,
	7425,
	7424,
	7423,
	7422,
	7420,
	7419,
	7418,
	7417,
	7416,
	7415,
	7413,
	7411,
	7409,
	7408,
	7407,
	7404,
	7403,
	7402,
	7401,
	7400,
	7399,
	7398,
	7397,
	7396,
	7395,
	7394,
	7393,
	7392,
	7391,
	7390,
	7388,
	7386,
	7385,
	7384,
	7383,
	7381,
	7380,
	7379,
	7378,
	7377,
	7375,
	7374,
	7373,
	7372,
	7371,
	7370,
	7369,
	7368,
	7367,
	7366,
	7365,
	7364,
	7363,
	7362,
	7361,
	7360,
	7359,
	7358,
	7357,
	7356,
	7355,
	7354,
	7351,
	7350,
	7348,
	7346,
	7344,
	7343,
	7340,
	7339,
	7336,
	7335,
	7334,
	7331,
	7330,
	7329,
	7328,
	7326,
	7325,
	7324,
	7323,
	7322,
	7321,
	7319,
	7318,
	7317,
	7316,
	7315,
	7314,
	7313,
	7310,
	7307,
	7306,
	7305,
	7304,
	7303,
	7302,
	7301,
	7300,
	7299,
	7298,
	7297,
	7296,
	7295,
	7294,
	7293,
	7292,
	7291,
	7290,
	7289,
	7288,
	7287,
	7284,
	7278,
	7277,
	7276,
	7275,
	7274,
	7273,
	7272,
	7271,
	7269,
	7267,
	7266,
	7265,
	7264,
	7262,
	7258,
	7257,
	7256,
	7255,
	7254,
	7253,
	7252,
	7251,
	7250,
	7249,
	7248,
	7247,
	7245,
	7244,
	7243,
	7241,
	7239,
	7238,
	7237,
	7236,
	7235,
	7233,
	7232,
	7231,
	7230,
	7229,
	7228,
	7227,
	7225,
	7224,
	7223,
	7222,
	7221,
	7220,
	7219,
	7218,
	7216,
	7215,
	7214,
	7213,
	7211,
	7207,
	7206,
	7205,
	7203,
	7202,
	7201,
	7199,
	7196,
	7195,
	7192,
	7191,
	7189,
	7187,
	7186,
	7184,
	7183,
	7182,
	7181,
	7179,
	7178,
	7177,
	7175,
	7174,
	7173,
	7172,
	7170,
	7167,
	7164,
	7163,
	7162,
	7161,
	7160,
	7159,
	7158,
	7157,
	7156,
	7155,
	7154,
	7153,
	7152,
	7150,
	7149,
	7147,
	7145,
	7143,
	7141,
	7140,
	7139,
	7137,
	7133,
	7131,
	7129,
	7128,
	7126,
	7125,
	7123,
	7113,
	7111,
	7098,
	7092,
	7091,
	7090,
	7087,
	7086,
	7074,
	7072,
	7067,
	7066,
	7062,
	7059,
	7049,
	7046,
	7045,
	7041,
	7037,
	7034,
	7033,
	7032,
	7029,
	7027,
	7026,
	7025,
	7023,
	7022,
	7020,
	7019,
	7017,
	7012,
	7011,
	7009,
	7007,
	7006,
	7004,
	7003,
	7002,
	7001,
	6994,
	6993,
	6990,
	6986,
	6985,
	6983,
	6981,
	6979,
	6978,
	6977,
	6976,
	6975,
	6974,
	6972,
	6970,
	6968,
	6966,
	6962,
	6961,
	6950,
	6949,
	6948,
	6945,
	6943,
	6941,
	6937,
	6936,
	6935,
	6930,
	6929,
	6928,
	6926,
	6925,
	6919,
	6918,
	6916,
	6915,
	6914,
	6913,
	6912,
	6911,
	6910,
	6909,
	6908,
	6907,
	6906,
	6905,
	6904,
	6903,
	6902,
	6901,
	6899,
	6898,
	6897,
	6896,
	6895,
	6894,
	6890,
	6887,
	6876,
	6875,
	6873,
	6872,
	6858,
	6852,
	6847,
	6844,
	6843,
	6842,
	6841,
	6840,
	6835,
	6832,
	6829,
	6827,
	6825,
	6824,
	6823,
	6822,
	6820,
	6819,
	6818,
	6816,
	6815,
	6813,
	6812,
	6809,
	6808,
	6794,
	6792,
	6789,
	6788,
	6786,
	6779,
	6777,
	6776,
	6775,
	6772,
	6771,
	6769,
	6767,
	6756,
	6754,
	6753,
	6752,
	6749,
	6748,
	6746,
	6745,
	6742,
	6741,
	6740,
	6739,
	6736,
	6735,
	6731,
	6730,
	6729,
	6728,
	6727,
	6726,
	6716,
	6714,
	6713,
	6710,
	6709,
	6708,
	6706,
	6703,
	6702,
	6701,
	6700,
	6696,
	6695,
	6691,
	6688,
	6686,
	6682,
	6680,
	6679,
	6673,
	6672,
	6669,
	6668,
	6667,
	6665,
	6664,
	6663,
	6662,
	6661,
	6658,
	6657,
	6656,
	6653,
	6651,
	6649,
	6643,
	6642,
	6641,
	6640,
	6639,
	6638,
	6637,
	6635,
	6633,
	6632,
	6630,
	6629,
	6628,
	6627,
	6626,
	6625,
	6620,
	6619,
	6618,
	6617,
	6616,
	6614,
	6612,
	6608,
	6607,
	6599,
	6598,
	6597,
	6594,
	6593,
	6592,
	6590,
	6588,
	6587,
	6583,
	6577,
	6576,
	6575,
	6574,
	6573,
	6570,
	6569,
	6568,
	6567,
	6559,
	6558,
	6557,
	6556,
	6555,
	6551,
	6550,
	6549,
	6546,
	6545,
	6543,
	6542,
	6541,
	6540,
	6538,
	6537,
	6535,
	6534,
	6533,
	6532,
	6531,
	6530,
	6529,
	6528,
	6527,
	6525,
	6524,
	6523,
	6522,
	6518,
	6512,
	6504,
	6492,
	6490,
	6487,
	6486,
	6485,
	6484,
	6483,
	6482,
	6481,
	6480,
	6472,
	6468,
	6464,
	6457,
	6455,
	6454,
	6451,
	6448,
	6442,
	6441,
	6439,
	6438,
	6437,
	6436,
	6433,
	6432,
	6431,
	6430,
	6428,
	6422,
	6421,
	6420,
	6419,
	6418,
	6417,
	6409,
	6408,
	6404,
	6401,
	6400,
	6399,
	6398,
	6395,
	6394,
	6389,
	6387,
	6386,
	6384,
	6383,
	6381,
	6380,
	6379,
	6376,
	6375,
	6374,
	6372,
	6363,
	6361,
	6359,
	6357,
	6345,
	6343,
	6337,
	6335,
	6332,
	6330,
	6326,
	6325,
	6319,
	6315,
	6313,
	6310,
	6309,
	6308,
	6304,
	6303,
	6301,
	6299,
	6296,
	6295,
	6294,
	6293,
	6291,
	6290,
	6287,
	6286,
	6285,
	6283,
	6282,
	6281,
	6280,
	6276,
	6275,
	6274,
	6273,
	6270,
	6266,
	6264,
	6262,
	6258,
	6256,
	6255,
	6250,
	6247,
	6245,
	6241,
	6240,
	6239,
	6229,
	6225,
	6224,
	6221,
	6220,
	6219,
	6216,
	6215,
	6212,
	6211,
	6210,
	6209,
	6208,
	6207,
	6206,
	6204,
	6203,
	6202,
	6201,
	6198,
	6197,
	6195,
	6194,
	6192,
	6191,
	6188,
	6180,
	6177,
	6174,
	6172,
	6170,
	6169,
	6166,
	6162,
	6161,
	6160,
	6156,
	6155,
	6154,
	6153,
	6152,
	6151,
	6150,
	6148,
	6145,
	6144,
	6139,
	6137,
	6135,
	6133,
	6130,
	6129,
	6126,
	6119,
	6115,
	6113,
	6104,
	6103,
	6102,
	6100,
	6099,
	6098,
	6097,
	6095,
	6094,
	6093,
	6091,
	6089,
	6088,
	6086,
	6082,
	6081,
	6080,
	6077,
	6076,
	6075,
	6074,
	6073,
	6072,
	6071,
	6070,
	6067,
	6066,
	6065,
	6064,
	6063,
	6062,
	6061,
	6059,
	6057,
	6052,
	6051,
	6047,
	6046,
	6043,
	6042,
	6041,
	6039,
	6036,
	6035,
	6033,
	6031,
	6030,
	6027,
	6026,
	6025,
	6023,
	6022,
	6017,
	6015,
	6014,
	6013,
	6012,
	6011,
	6010,
	6003,
	6001,
	6e3,
	5998,
	5995,
	5994,
	5993,
	5991,
	5989,
	5987,
	5985,
	5984,
	5983,
	5982,
	5979,
	5978,
	5977,
	5976,
	5975,
	5974,
	5973,
	5972,
	5971,
	5970,
	5969,
	5968,
	5967,
	5966,
	5965,
	5964,
	5963,
	5962,
	5961,
	5960,
	5959,
	5958,
	5957,
	5956,
	5955,
	5954,
	5953,
	5952,
	5951,
	5950,
	5949,
	5948,
	5947,
	5946,
	5945,
	5944,
	5942,
	5940,
	5938,
	5937,
	5936,
	5934,
	5933,
	5932,
	5930,
	5929,
	5928,
	5926,
	5925,
	5924,
	5923,
	5922,
	5920,
	5919,
	5918,
	5917,
	5914,
	5913,
	5910,
	5909,
	5908,
	5907,
	5906,
	5904,
	5901,
	5900,
	5897,
	5896,
	5895,
	5891,
	5890,
	5884,
	5882,
	5881,
	5880,
	5877,
	5875,
	5874,
	5871,
	5870,
	5866,
	5864,
	5863,
	5862,
	5857,
	5856,
	5850,
	5849,
	5847,
	5846,
	5844,
	5843,
	5842,
	5841,
	5840,
	5839,
	5835,
	5832,
	5831,
	5830,
	5829,
	5828,
	5825,
	5821,
	5820,
	5819,
	5818,
	5817,
	5816,
	5811,
	5809,
	5808,
	5807,
	5805,
	5801,
	5799,
	5798,
	5796,
	5795,
	5792,
	5790,
	5789,
	5787,
	5783,
	5779,
	5778,
	5777,
	5775,
	5774,
	5773,
	5772,
	5765,
	5761,
	5757,
	5755,
	5753,
	5752,
	5751,
	5749,
	5747,
	5746,
	5744,
	5743,
	5742,
	5741,
	5740,
	5739,
	5738,
	5736,
	5734,
	5727,
	5725,
	5723,
	5722,
	5721,
	5720,
	5712,
	5707,
	5701,
	5700,
	5696,
	5694,
	5691,
	5683,
	5682,
	5680,
	5678,
	5677,
	5674,
	5671,
	5670,
	5666,
	5662,
	5661,
	5658,
	5657,
	5656,
	5654,
	5651,
	5650,
	5649,
	5647,
	5644,
	5641,
	5640,
	5633,
	5631,
	5626,
	5622,
	5619,
	5617,
	5615,
	5614,
	5611,
	5608,
	5607,
	5599,
	5598,
	5597,
	5595,
	5594,
	5593,
	5591,
	5589,
	5588,
	5587,
	5584,
	5583,
	5582,
	5580,
	5577,
	5575,
	5573,
	5572,
	5570,
	5567,
	5566,
	5557,
	5554,
	5553,
	5552,
	5550,
	5548,
	5542,
	5540,
	5539,
	5536,
	5535,
	5533,
	5528,
	5525,
	5523,
	5522,
	5521,
	5518,
	5516,
	5511,
	5509,
	5508,
	5507,
	5504,
	5502,
	5499,
	5498,
	5497,
	5496,
	5495,
	5494,
	5492,
	5486,
	5480,
	5479,
	5478,
	5475,
	5474,
	5473,
	5469,
	5468,
	5466,
	5464,
	5463,
	5462,
	5461,
	5460,
	5459,
	5454,
	5453,
	5452,
	5451,
	5449,
	5448,
	5446,
	5445,
	5443,
	5441,
	5438,
	5436,
	5435,
	5431,
	5430,
	5428,
	5427,
	5426,
	5424,
	5423,
	5421,
	5420,
	5417,
	5416,
	5413,
	5412,
	5411,
	5409,
	5405,
	5404,
	5403,
	5400,
	5398,
	5396,
	5394,
	5393,
	5391,
	5390,
	5388,
	5387,
	5386,
	5381,
	5380,
	5375,
	5374,
	5370,
	5369,
	5368,
	5345,
	5343,
	5339,
	5338,
	5330,
	5327,
	5325
];
var batch3TemplateIds_default = [
	5324,
	5322,
	5321,
	5313,
	5312,
	5309,
	5307,
	5306,
	5305,
	5303,
	5297,
	5296,
	5294,
	5293,
	5292,
	5291,
	5289,
	5286,
	5280,
	5279,
	5275,
	5274,
	5263,
	5262,
	5257,
	5248,
	5246,
	5244,
	5240,
	5238,
	5234,
	5232,
	5230,
	5229,
	5228,
	5210,
	5209,
	5208,
	5207,
	5206,
	5205,
	5204,
	5203,
	5202,
	5200,
	5199,
	5198,
	5197,
	5196,
	5195,
	5194,
	5193,
	5175,
	5172,
	5169,
	5168,
	5167,
	5165,
	5164,
	5163,
	5162,
	5160,
	5159,
	5158,
	5157,
	5152,
	5148,
	5146,
	5142,
	5141,
	5140,
	5139,
	5138,
	5135,
	5131,
	5130,
	5128,
	5123,
	5121,
	5118,
	5113,
	5111,
	5110,
	5108,
	5103,
	5100,
	5097,
	5095,
	5094,
	5092,
	5091,
	5090,
	5089,
	5088,
	5086,
	5085,
	5083,
	5082,
	5078,
	5074,
	5073,
	5068,
	5066,
	5051,
	5048,
	5046,
	5045,
	5044,
	5042,
	5035,
	5034,
	5028,
	5027,
	5026,
	5024,
	5023,
	5014,
	5012,
	5011,
	5010,
	5003,
	5002,
	5001,
	4987,
	4980,
	4978,
	4975,
	4972,
	4971,
	4969,
	4968,
	4967,
	4966,
	4952,
	4949,
	4941,
	4935,
	4931,
	4930,
	4927,
	4921,
	4917,
	4916,
	4915,
	4912,
	4911,
	4910,
	4904,
	4892,
	4891,
	4889,
	4887,
	4885,
	4884,
	4883,
	4881,
	4879,
	4877,
	4876,
	4875,
	4874,
	4873,
	4872,
	4870,
	4868,
	4867,
	4864,
	4863,
	4861,
	4857,
	4851,
	4849,
	4847,
	4846,
	4844,
	4841,
	4840,
	4838,
	4837,
	4836,
	4835,
	4832,
	4829,
	4828,
	4827,
	4823,
	4822,
	4821,
	4820,
	4817,
	4816,
	4815,
	4808,
	4807,
	4804,
	4803,
	4801,
	4798,
	4794,
	4793,
	4792,
	4790,
	4788,
	4783,
	4777,
	4774,
	4771,
	4767,
	4758,
	4757,
	4756,
	4755,
	4753,
	4751,
	4746,
	4745,
	4744,
	4743,
	4742,
	4741,
	4740,
	4739,
	4738,
	4736,
	4735,
	4733,
	4732,
	4729,
	4723,
	4722,
	4721,
	4717,
	4712,
	4709,
	4697,
	4696,
	4694,
	4693,
	4692,
	4689,
	4688,
	4687,
	4686,
	4682,
	4680,
	4678,
	4665,
	4663,
	4658,
	4654,
	4653,
	4651,
	4647,
	4645,
	4641,
	4638,
	4633,
	4631,
	4627,
	4622,
	4621,
	4619,
	4617,
	4612,
	4611,
	4606,
	4603,
	4600,
	4591,
	4589,
	4588,
	4586,
	4584,
	4581,
	4580,
	4578,
	4577,
	4576,
	4575,
	4570,
	4568,
	4566,
	4565,
	4560,
	4559,
	4558,
	4557,
	4556,
	4555,
	4553,
	4552,
	4551,
	4547,
	4545,
	4541,
	4528,
	4526,
	4514,
	4513,
	4510,
	4509,
	4507,
	4506,
	4505,
	4504,
	4501,
	4497,
	4496,
	4495,
	4494,
	4488,
	4486,
	4485,
	4484,
	4481,
	4478,
	4477,
	4475,
	4474,
	4472,
	4470,
	4467,
	4465,
	4459,
	4458,
	4457,
	4454,
	4452,
	4451,
	4449,
	4448,
	4447,
	4446,
	4443,
	4438,
	4436,
	4434,
	4432,
	4431,
	4428,
	4426,
	4425,
	4424,
	4423,
	4414,
	4413,
	4412,
	4406,
	4403,
	4402,
	4400,
	4399,
	4398,
	4396,
	4392,
	4391,
	4384,
	4382,
	4379,
	4378,
	4377,
	4376,
	4375,
	4374,
	4373,
	4372,
	4371,
	4370,
	4366,
	4365,
	4361,
	4359,
	4354,
	4352,
	4348,
	4345,
	4344,
	4341,
	4340,
	4336,
	4330,
	4329,
	4328,
	4327,
	4326,
	4325,
	4322,
	4316,
	4300,
	4281,
	4280,
	4278,
	4274,
	4273,
	4272,
	4271,
	4269,
	4268,
	4267,
	4265,
	4262,
	4259,
	4258,
	4255,
	4251,
	4250,
	4247,
	4246,
	4245,
	4242,
	4241,
	4237,
	4235,
	4231,
	4228,
	4223,
	4222,
	4219,
	4218,
	4217,
	4216,
	4210,
	4207,
	4206,
	4205,
	4204,
	4203,
	4197,
	4187,
	4186,
	4151,
	4150,
	4116,
	4114,
	4110,
	4108,
	4106,
	4102,
	4099,
	4098,
	4097,
	4096,
	4094,
	4093,
	4092,
	4087,
	4086,
	4077,
	4075,
	4073,
	4067,
	4059,
	4058,
	4057,
	4056,
	4053,
	4043,
	4040,
	4036,
	4032,
	4031,
	4030,
	4028,
	4023,
	4022,
	4020,
	4008,
	4007,
	4005,
	4001,
	3997,
	3988,
	3986,
	3971,
	3969,
	3967,
	3960,
	3959,
	3958,
	3954,
	3951,
	3950,
	3946,
	3945,
	3942,
	3940,
	3934,
	3930,
	3920,
	3912,
	3910,
	3908,
	3907,
	3906,
	3905,
	3904,
	3901,
	3900,
	3899,
	3894,
	3893,
	3889,
	3888,
	3887,
	3881,
	3879,
	3868,
	3867,
	3859,
	3858,
	3854,
	3853,
	3851,
	3849,
	3848,
	3846,
	3840,
	3838,
	3835,
	3832,
	3830,
	3829,
	3828,
	3826,
	3822,
	3820,
	3817,
	3816,
	3805,
	3804,
	3803,
	3798,
	3796,
	3793,
	3791,
	3790,
	3784,
	3779,
	3778,
	3777,
	3776,
	3775,
	3772,
	3770,
	3769,
	3767,
	3765,
	3763,
	3762,
	3761,
	3751,
	3719,
	3716,
	3713,
	3711,
	3710,
	3706,
	3705,
	3703,
	3702,
	3700,
	3699,
	3696,
	3694,
	3693,
	3691,
	3689,
	3688,
	3686,
	3684,
	3682,
	3681,
	3677,
	3675,
	3673,
	3672,
	3670,
	3663,
	3657,
	3656,
	3655,
	3654,
	3647,
	3644,
	3640,
	3638,
	3637,
	3636,
	3635,
	3634,
	3632,
	3631,
	3630,
	3628,
	3627,
	3626,
	3625,
	3624,
	3623,
	3620,
	3617,
	3610,
	3609,
	3607,
	3606,
	3605,
	3601,
	3600,
	3599,
	3596,
	3595,
	3592,
	3586,
	3583,
	3579,
	3577,
	3576,
	3574,
	3573,
	3569,
	3567,
	3564,
	3563,
	3561,
	3547,
	3546,
	3545,
	3542,
	3540,
	3539,
	3536,
	3535,
	3534,
	3533,
	3532,
	3531,
	3527,
	3517,
	3514,
	3510,
	3509,
	3507,
	3505,
	3502,
	3501,
	3500,
	3499,
	3498,
	3496,
	3495,
	3490,
	3479,
	3478,
	3476,
	3475,
	3473,
	3472,
	3460,
	3459,
	3457,
	3456,
	3452,
	3450,
	3449,
	3446,
	3443,
	3442,
	3441,
	3440,
	3438,
	3433,
	3427,
	3425,
	3424,
	3423,
	3422,
	3421,
	3420,
	3416,
	3414,
	3413,
	3411,
	3409,
	3408,
	3397,
	3396,
	3395,
	3393,
	3392,
	3381,
	3379,
	3363,
	3354,
	3353,
	3351,
	3350,
	3348,
	3346,
	3344,
	3336,
	3335,
	3329,
	3326,
	3318,
	3314,
	3306,
	3305,
	3304,
	3303,
	3302,
	3295,
	3291,
	3289,
	3288,
	3279,
	3278,
	3277,
	3275,
	3259,
	3249,
	3239,
	3238,
	3237,
	3236,
	3231,
	3224,
	3222,
	3219,
	3211,
	3207,
	3201,
	3200,
	3199,
	3195,
	3194,
	3192,
	3189,
	3188,
	3185,
	3184,
	3178,
	3169,
	3161,
	3158,
	3156,
	3155,
	3151,
	3149,
	3139,
	3135,
	3132,
	3131,
	3123,
	3121,
	3117,
	3115,
	3108,
	3107,
	3105,
	3102,
	3101,
	3100,
	3094,
	3093,
	3090,
	3089,
	3086,
	3085,
	3082,
	3079,
	3078,
	3076,
	3072,
	3068,
	3066,
	3062,
	3057,
	3054,
	3053,
	3052,
	3050,
	3049,
	3044,
	3042,
	3040,
	3037,
	3036,
	3035,
	3034,
	3033,
	3032,
	3028,
	3027,
	3025,
	3020,
	3018,
	3016,
	3012,
	3010,
	3008,
	3005,
	3003,
	2997,
	2995,
	2993,
	2992,
	2988,
	2987,
	2986,
	2982,
	2981,
	2978,
	2977,
	2976,
	2975,
	2972,
	2965,
	2964,
	2963,
	2957,
	2956,
	2946,
	2945,
	2943,
	2942,
	2940,
	2937,
	2931,
	2922,
	2917,
	2911,
	2907,
	2905,
	2904,
	2897,
	2894,
	2893,
	2883,
	2879,
	2878,
	2874,
	2873,
	2872,
	2871,
	2869,
	2865,
	2864,
	2862,
	2861,
	2860,
	2859,
	2852,
	2851,
	2850,
	2846,
	2845,
	2840,
	2825,
	2824,
	2823,
	2822,
	2819,
	2817,
	2816,
	2813,
	2812,
	2809,
	2804,
	2803,
	2800,
	2799,
	2797,
	2796,
	2792,
	2790,
	2789,
	2786,
	2784,
	2783,
	2782,
	2781,
	2780,
	2779,
	2777,
	2773,
	2771,
	2768,
	2766,
	2764,
	2758,
	2757,
	2754,
	2753,
	2752,
	2751,
	2749,
	2747,
	2743,
	2741,
	2740,
	2738,
	2736,
	2729,
	2722,
	2718,
	2717,
	2713,
	2706,
	2705,
	2703,
	2700,
	2699,
	2697,
	2693,
	2692,
	2688,
	2683,
	2682,
	2681,
	2680,
	2679,
	2673,
	2671,
	2669,
	2666,
	2665,
	2662,
	2661,
	2658,
	2657,
	2656,
	2655,
	2654,
	2651,
	2650,
	2649,
	2648,
	2647,
	2644,
	2643,
	2642,
	2637,
	2636,
	2632,
	2629,
	2621,
	2619,
	2618,
	2615,
	2614,
	2612,
	2606,
	2604,
	2592,
	2584,
	2583,
	2582,
	2580,
	2579,
	2576,
	2572,
	2568,
	2566,
	2565,
	2564,
	2563,
	2561,
	2560,
	2559,
	2557,
	2554,
	2552,
	2547,
	2541,
	2539,
	2534,
	2529,
	2526,
	2525,
	2522,
	2520,
	2517,
	2515,
	2513,
	2508,
	2504,
	2502,
	2491,
	2476,
	2473,
	2468,
	2467,
	2466,
	2465,
	2464,
	2463,
	2462,
	2456,
	2454,
	2453,
	2446,
	2442,
	2441,
	2440,
	2437,
	2436,
	2434,
	2433,
	2431,
	2421,
	2420,
	2419,
	2418,
	2417,
	2416,
	2415,
	2414,
	2413,
	2405,
	2402,
	2400,
	2398,
	2397,
	2395,
	2394,
	2392,
	2389,
	2388,
	2386,
	2384,
	2377,
	2374,
	2373,
	2372,
	2370,
	2358,
	2354,
	2347,
	2346,
	2344,
	2343,
	2342,
	2341,
	2339,
	2338,
	2336,
	2335,
	2334,
	2333,
	2331,
	2330,
	2328,
	2326,
	2325,
	2324,
	2323,
	2322,
	2321,
	2320,
	2318,
	2315,
	2292,
	2290,
	2288,
	2287,
	2271,
	2249,
	2245,
	2242,
	2235,
	2234,
	2233,
	2219,
	2217,
	2216,
	2207,
	2206,
	2201,
	2198,
	2197,
	2189,
	2187,
	2183,
	2180,
	2179,
	2178,
	2173,
	2170,
	2167,
	2165,
	2164,
	2163,
	2161,
	2154,
	2152,
	2139,
	2125,
	2121,
	2120,
	2119,
	2114,
	2098,
	2095,
	2094,
	2092,
	2090,
	2085,
	2083,
	2082,
	2039,
	2035,
	2033,
	2026,
	2025,
	2006,
	1996,
	1980,
	1978,
	1967,
	1963,
	1962,
	1961,
	1960,
	1959,
	1958,
	1957,
	1956,
	1955,
	1954,
	1953,
	1951,
	1938,
	1934,
	1900,
	1898,
	1897,
	1895,
	1862,
	1838,
	1535,
	1520,
	1467,
	1466,
	1401,
	1395,
	1394,
	1393,
	1282,
	1216,
	1111,
	1109,
	1107,
	1045,
	998,
	975,
	965,
	888,
	878,
	806,
	797,
	786,
	784,
	743,
	741,
	739,
	702,
	684,
	632,
	591,
	585,
	544,
	437,
	385,
	365,
	3
];
var NUMBER_OF_TEMPLATES = 6;
const useTemplatesDataQualityStore = defineStore("templatesDataQuality", () => {
	const telemetry = useTelemetry();
	const posthogStore = usePostHog();
	const templatesStore = useTemplatesStore();
	const settingsStore = useSettingsStore();
	const nodeTypesStore = useNodeTypesStore();
	const isFeatureEnabled = () => {
		return settingsStore.isTemplatesEnabled && (posthogStore.getVariant(TEMPLATES_DATA_QUALITY_EXPERIMENT.name) === TEMPLATES_DATA_QUALITY_EXPERIMENT.variant1 || posthogStore.getVariant(TEMPLATES_DATA_QUALITY_EXPERIMENT.name) === TEMPLATES_DATA_QUALITY_EXPERIMENT.variant2 || posthogStore.getVariant(TEMPLATES_DATA_QUALITY_EXPERIMENT.name) === TEMPLATES_DATA_QUALITY_EXPERIMENT.variant3);
	};
	async function getTemplateData(templateId) {
		return await templatesStore.fetchTemplateById(templateId.toString());
	}
	function getTemplateRoute(id) {
		return {
			name: VIEWS.TEMPLATE,
			params: { id }
		};
	}
	function getRandomTemplateIds() {
		const ids = posthogStore.getVariant(TEMPLATES_DATA_QUALITY_EXPERIMENT.name) === TEMPLATES_DATA_QUALITY_EXPERIMENT.variant1 ? batch1TemplateIds_default : posthogStore.getVariant(TEMPLATES_DATA_QUALITY_EXPERIMENT.name) === TEMPLATES_DATA_QUALITY_EXPERIMENT.variant2 ? batch2TemplateIds_default : batch3TemplateIds_default;
		const result = [];
		const picked = /* @__PURE__ */ new Set();
		const count = Math.min(NUMBER_OF_TEMPLATES, ids.length);
		while (result.length < count) {
			const index = Math.floor(Math.random() * ids.length);
			if (!picked.has(index)) {
				picked.add(index);
				result.push(ids[index]);
			}
		}
		return result;
	}
	function trackTemplateTileClick(templateId) {
		telemetry.track("User viewed template detail", { templateId });
	}
	function trackTemplateShown(templateId, tileNumber) {
		telemetry.track("User viewed template cell", {
			tileNumber,
			templateId
		});
	}
	async function loadExperimentTemplates() {
		await nodeTypesStore.loadNodeTypesIfNotLoaded();
		const promises = getRandomTemplateIds().map(async (id) => await getTemplateData(id));
		return (await Promise.allSettled(promises)).filter((result) => result.status === "fulfilled" && result.value !== null).map((result) => result.value);
	}
	return {
		isFeatureEnabled,
		getRandomTemplateIds,
		getTemplateData,
		getTemplateRoute,
		trackTemplateTileClick,
		trackTemplateShown,
		loadExperimentTemplates
	};
});
const isExtraTemplateLinksExperimentEnabled = () => {
	return usePostHog().getVariant(EXTRA_TEMPLATE_LINKS_EXPERIMENT.name) === EXTRA_TEMPLATE_LINKS_EXPERIMENT.variant && useCloudPlanStore().userIsTrialing || useTemplatesDataQualityStore().isFeatureEnabled();
};
let TemplateClickSource = /* @__PURE__ */ function(TemplateClickSource$1) {
	TemplateClickSource$1["emptyWorkflowLink"] = "empty_workflow_link";
	TemplateClickSource$1["emptyInstanceCard"] = "empty_instance_card";
	TemplateClickSource$1["sidebarButton"] = "sidebar_button";
	return TemplateClickSource$1;
}({});
const getTemplatePathByRole = (role) => {
	if (!role) return "";
	switch (role) {
		case "Executive/Owner":
		case "Product & Design": return "categories/ai/";
		case "Support": return "categories/support/";
		case "Sales": return "categories/sales/";
		case "IT":
		case "Engineering": return "categories/it-ops/";
		case "Marketing": return "categories/marketing/";
		case "Other": return "categories/other/";
		default: return "";
	}
};
const trackTemplatesClick = (source) => {
	useTelemetry().track("User clicked on templates", {
		role: useCloudPlanStore().currentUserCloudInfo?.role,
		active_workflow_count: useWorkflowsStore().activeWorkflows.length,
		source
	});
};
var TEMPLATES_PAGE_SIZE = 20;
function getSearchKey(query) {
	return JSON.stringify([query.search || "", [...query.categories].sort()]);
}
const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
	const categories = ref([]);
	const collections = ref({});
	const workflows = ref({});
	const workflowSearches = ref({});
	const collectionSearches = ref({});
	const currentSessionId = ref("");
	const previousSessionId = ref("");
	const currentN8nPath = ref(`${window.location.protocol}//${window.location.host}${window.BASE_PATH}`);
	const settingsStore = useSettingsStore();
	const rootStore = useRootStore();
	const userStore = useUsersStore();
	const cloudPlanStore = useCloudPlanStore();
	const workflowsStore = useWorkflowsStore();
	const allCategories = computed(() => {
		return categories.value.sort((a, b) => a.name > b.name ? 1 : -1);
	});
	const getTemplatesById = computed(() => {
		return (id) => workflows.value[id];
	});
	const getFullTemplateById = computed(() => {
		return (id) => {
			const template = workflows.value[id];
			return template && "full" in template && template.full ? template : null;
		};
	});
	const getCollectionById$1 = computed(() => collections.value);
	const getCategoryById = computed(() => {
		return (id) => categories.value[id];
	});
	const getSearchedCollections = computed(() => {
		return (query) => {
			const searchKey = getSearchKey(query);
			const search = collectionSearches.value[searchKey];
			if (!search) return null;
			return search.collectionIds.map((collectionId) => collections.value[collectionId]);
		};
	});
	const getSearchedWorkflows = computed(() => {
		return (query) => {
			const searchKey = getSearchKey(query);
			const search = workflowSearches.value[searchKey];
			if (!search) return null;
			return search.workflowIds.map((workflowId) => workflows.value[workflowId]);
		};
	});
	const getSearchedWorkflowsTotal = computed(() => {
		return (query) => {
			const searchKey = getSearchKey(query);
			const search = workflowSearches.value[searchKey];
			return search ? search.totalWorkflows : 0;
		};
	});
	const isSearchLoadingMore = computed(() => {
		return (query) => {
			const searchKey = getSearchKey(query);
			const search = workflowSearches.value[searchKey];
			return Boolean(search?.loadingMore);
		};
	});
	const isSearchFinished = computed(() => {
		return (query) => {
			const searchKey = getSearchKey(query);
			const search = workflowSearches.value[searchKey];
			return Boolean(search && !search.loadingMore && search.totalWorkflows === search.workflowIds.length);
		};
	});
	const hasCustomTemplatesHost = computed(() => {
		return settingsStore.templatesHost !== TEMPLATES_URLS.DEFAULT_API_HOST;
	});
	const userRole = computed(() => cloudPlanStore.currentUserCloudInfo?.role ?? (userStore.currentUser?.personalizationAnswers && "role" in userStore.currentUser.personalizationAnswers ? userStore.currentUser.personalizationAnswers.role : void 0));
	const websiteTemplateRepositoryParameters = computed(() => {
		const defaultParameters = {
			...TEMPLATES_URLS.UTM_QUERY,
			utm_instance: currentN8nPath.value,
			utm_n8n_version: rootStore.versionCli,
			utm_awc: String(workflowsStore.activeWorkflows.length)
		};
		if (userRole.value) defaultParameters.utm_user_role = userRole.value;
		return new URLSearchParams({ ...defaultParameters });
	});
	const websiteTemplateRepositoryURL = computed(() => `${TEMPLATES_URLS.BASE_WEBSITE_URL}${getTemplatePathByRole(userRole.value)}?${websiteTemplateRepositoryParameters.value.toString()}`);
	const constructTemplateRepositoryURL = (params, category) => {
		return `${category ? `${TEMPLATES_URLS.BASE_WEBSITE_URL}${category}` : TEMPLATES_URLS.BASE_WEBSITE_URL}?${params.toString()}`;
	};
	const addCategories = (_categories) => {
		categories.value = _categories;
	};
	const addCollections = (_collections) => {
		_collections.forEach((collection) => {
			const workflows$1 = (collection.workflows || []).map((workflow) => ({ id: workflow.id }));
			const cachedCollection = collections.value[collection.id] || {};
			collections.value[collection.id] = {
				...cachedCollection,
				...collection,
				workflows: workflows$1
			};
		});
	};
	const addWorkflows = (_workflows) => {
		_workflows.forEach((workflow) => {
			const cachedWorkflow = workflows.value[workflow.id] || {};
			workflows.value[workflow.id.toString()] = {
				...cachedWorkflow,
				...workflow
			};
		});
	};
	const addCollectionsSearch = (data) => {
		const collectionIds = data._collections.map((collection) => String(collection.id));
		const searchKey = getSearchKey(data.query);
		collectionSearches.value[searchKey] = { collectionIds };
	};
	const addWorkflowsSearch = (data) => {
		const workflowIds = data.workflows.map((workflow) => workflow.id);
		const searchKey = getSearchKey(data.query);
		const cachedResults = workflowSearches.value[searchKey];
		if (!cachedResults) {
			workflowSearches.value[searchKey] = {
				workflowIds,
				totalWorkflows: data.totalWorkflows,
				categories: categories.value
			};
			return;
		}
		workflowSearches.value[searchKey] = {
			workflowIds: [...cachedResults.workflowIds, ...workflowIds],
			totalWorkflows: data.totalWorkflows,
			categories: categories.value
		};
	};
	const setWorkflowSearchLoading = (query) => {
		const searchKey = getSearchKey(query);
		if (!workflowSearches.value[searchKey]) return;
		workflowSearches.value[searchKey] = {
			...workflowSearches.value[searchKey],
			loadingMore: true
		};
	};
	const setWorkflowSearchLoaded = (query) => {
		const searchKey = getSearchKey(query);
		if (!workflowSearches.value[searchKey]) return;
		workflowSearches.value[searchKey] = {
			...workflowSearches.value[searchKey],
			loadingMore: false
		};
	};
	const resetSessionId = () => {
		previousSessionId.value = currentSessionId.value;
		currentSessionId.value = "";
	};
	const setSessionId = () => {
		if (!currentSessionId.value) currentSessionId.value = `templates-${Date.now()}`;
	};
	const fetchTemplateById = async (templateId) => {
		const apiEndpoint = settingsStore.templatesHost;
		const versionCli = rootStore.versionCli;
		const template = {
			...(await getTemplateById(apiEndpoint, templateId, { "n8n-version": versionCli })).workflow,
			full: true
		};
		addWorkflows([template]);
		return template;
	};
	const fetchCollectionById = async (collectionId) => {
		const apiEndpoint = settingsStore.templatesHost;
		const versionCli = rootStore.versionCli;
		const response = await getCollectionById(apiEndpoint, collectionId, { "n8n-version": versionCli });
		addCollections([{
			...response.collection,
			full: true
		}]);
		addWorkflows(response.collection.workflows);
		return getCollectionById$1.value[collectionId];
	};
	const getCategories$1 = async () => {
		const cachedCategories = allCategories.value;
		if (cachedCategories.length) return cachedCategories;
		const apiEndpoint = settingsStore.templatesHost;
		const versionCli = rootStore.versionCli;
		const categories$1 = (await getCategories(apiEndpoint, { "n8n-version": versionCli })).categories;
		addCategories(categories$1);
		return categories$1;
	};
	const getCollections$1 = async (query) => {
		const cachedResults = getSearchedCollections.value(query);
		if (cachedResults) return cachedResults;
		const apiEndpoint = settingsStore.templatesHost;
		const versionCli = rootStore.versionCli;
		const collections$1 = (await getCollections(apiEndpoint, query, { "n8n-version": versionCli })).collections;
		addCollections(collections$1);
		addCollectionsSearch({
			query,
			_collections: collections$1
		});
		collections$1.forEach((collection) => addWorkflows(collection.workflows));
		return collections$1;
	};
	const getWorkflows$1 = async (query) => {
		const cachedResults = getSearchedWorkflows.value(query);
		if (cachedResults) {
			categories.value = workflowSearches.value[getSearchKey(query)].categories ?? [];
			return cachedResults;
		}
		const apiEndpoint = settingsStore.templatesHost;
		const versionCli = rootStore.versionCli;
		const payload = await getWorkflows(apiEndpoint, {
			...query,
			page: 1,
			limit: TEMPLATES_PAGE_SIZE
		}, { "n8n-version": versionCli });
		addWorkflows(payload.workflows);
		addWorkflowsSearch({
			...payload,
			query
		});
		return getSearchedWorkflows.value(query) || [];
	};
	const getMoreWorkflows = async (query) => {
		if (isSearchLoadingMore.value(query) && !isSearchFinished.value(query)) return [];
		const cachedResults = getSearchedWorkflows.value(query) || [];
		const apiEndpoint = settingsStore.templatesHost;
		setWorkflowSearchLoading(query);
		try {
			const payload = await getWorkflows(apiEndpoint, {
				...query,
				page: cachedResults.length / TEMPLATES_PAGE_SIZE + 1,
				limit: TEMPLATES_PAGE_SIZE
			});
			setWorkflowSearchLoaded(query);
			addWorkflows(payload.workflows);
			addWorkflowsSearch({
				...payload,
				query
			});
			return getSearchedWorkflows.value(query) || [];
		} catch (e) {
			setWorkflowSearchLoaded(query);
			throw e;
		}
	};
	const getWorkflowTemplate$1 = async (templateId) => {
		const apiEndpoint = settingsStore.templatesHost;
		const versionCli = rootStore.versionCli;
		return await getWorkflowTemplate(apiEndpoint, templateId, { "n8n-version": versionCli });
	};
	const getFixedWorkflowTemplate = async (templateId) => {
		const template = await getWorkflowTemplate$1(templateId);
		if (template?.workflow?.nodes) {
			template.workflow.nodes = getNodesWithNormalizedPosition(template.workflow.nodes);
			template.workflow.nodes?.forEach((node) => {
				if (node.credentials) delete node.credentials;
			});
		}
		return template;
	};
	return {
		categories,
		collections,
		workflows,
		workflowSearches,
		collectionSearches,
		currentSessionId,
		previousSessionId,
		currentN8nPath,
		allCategories,
		getTemplatesById,
		getFullTemplateById,
		getCollectionById: getCollectionById$1,
		getCategoryById,
		getSearchedCollections,
		getSearchedWorkflows,
		getSearchedWorkflowsTotal,
		isSearchLoadingMore,
		isSearchFinished,
		hasCustomTemplatesHost,
		websiteTemplateRepositoryURL,
		constructTemplateRepositoryURL,
		websiteTemplateRepositoryParameters,
		addCategories,
		addCollections,
		addWorkflows,
		addCollectionsSearch,
		addWorkflowsSearch,
		setWorkflowSearchLoading,
		setWorkflowSearchLoaded,
		resetSessionId,
		setSessionId,
		fetchTemplateById,
		fetchCollectionById,
		getCategories: getCategories$1,
		getCollections: getCollections$1,
		getWorkflows: getWorkflows$1,
		getMoreWorkflows,
		getWorkflowTemplate: getWorkflowTemplate$1,
		getFixedWorkflowTemplate
	};
});
export { useTemplatesDataQualityStore as a, trackTemplatesClick as i, TemplateClickSource as n, isExtraTemplateLinksExperimentEnabled as r, useTemplatesStore as t };